Data processing method and system, electronic equipment and storage medium

By compensating the value Y after the bit width conversion based on the probability Fk in data processing, the truncation error problem caused by the bit width conversion is solved, and the efficiency and scope of application of data processing are improved.

CN119719608AActive Publication Date: 2025-03-28HEFEI I TEK OPTOELECTRONICS CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510217855.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-26
Publication Date
2025-03-28
Estimated Expiration
2045-02-26

AI Technical Summary

Technical Problem

During data processing, the truncation error caused by bit width conversion will introduce a 'water stain' or 'pseudo-contour' pattern, and the prior art is difficult to effectively compensate for these errors in multi-stage tandem image algorithms, affecting the processing efficiency.

Method used

By obtaining the numerical value Y after multiple bit width conversion and adding the compensation value k to the numerical value Y based on the preset probability Fk, the compensated numerical value is obtained, and the probability form compensation for multiple truncation errors is achieved.

Benefits of technology

This solution compensates multiple truncation errors in one go through the form of probability, improving the real-time and efficiency of data processing, and is suitable for multi-level tandem image algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719608A_ABST
    Figure CN119719608A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method and system, electronic equipment and a storage medium, and relates to the field of data processing. The method comprises the following steps: acquiring a numerical value Y after multiple bit width conversion; and based on a preset probability Fk, adding a compensation value k to the numerical value Y to obtain a compensated numerical value. Based on the above processing, according to the data processing scheme provided by the invention, the compensation value k is added on the numerical value Y based on the probability Fk, and meanwhile, based on the formula content of the probability Fk, the probability expectation obtained by multiplying the probability Fk by the compensation value k is the same as the sum of truncation errors of the numerical value Y in multiple bit width conversion. Therefore, according to the scheme, multiple truncation errors can be compensated once in a probability form, the real-time performance is high, the operation process is simple, consumed resources are few, and the method can be suitable for a multi-stage serial image algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of data processing, and in particular relates to a data processing method, system, electronic equipment and storage medium. Background Art

[0002] In the process of data processing, bit width conversion is a commonly used technology. For example, in the process of performing algorithm calculations on 8-bit images, the intermediate calculation link first converts the 8-bit data into 12-bit data, and then converts it into 8-bit output after the calculation is completed. In the above-mentioned 12-bit to 8-bit bit width conversion process, the upper 8 bits of the 12 bits are usually used as output, and the lower 4 bits are directly discarded. As a result, there is a truncation error in the bit width conversion.

[0003] Taking image processing as an example, in the field of digital images, there are "water stains" or "pseudo contours" on the image after bit width conversion, such as Figure 1 Furthermore, in the process of digital image processing, there are usually multiple image algorithms involving bit width conversion, and image algorithms often work in series, with the output of the previous algorithm serving as the input of the next algorithm.

[0004] If the truncation error existing in the bit width conversion process is compensated after each level of algorithm processing, the efficiency of image processing will be affected. Therefore, a data processing solution is urgently needed to solve the above problem. Summary of the invention

[0005] The present application proposes a data processing method, system, electronic device and storage medium to achieve truncation error compensation in the above-mentioned multi-stage series connection situation and improve data processing efficiency.

[0006] To achieve the above objectives, this application proposes the following technical solutions: In a first aspect of the present application, a data processing method is provided, comprising: Get the value Y after multiple bit width conversions; Based on the preset probability F k , add the compensation value k to the value Y to get the compensated value; in, ; k represents any integer between 0 and Q; F k represents the probability of adding compensation value k to value Y; Q represents the total number of bit width conversions; R represents a set consisting of integers between 1 and Q; R1 represents a subset of set R and contains k elements in set R; R2 represents the complement of set R1 within the range of set R; i and j represent index values ​​in set R1 and set R2 respectively; p i represents the truncation error during the i-th bit width conversion process, p jrepresents the truncation error during the j-th bit width conversion process, and ; ;d i Indicates that during the i-th bit width conversion, when the data bit width is M i In the case of bit width conversion, the difference between the value before bit width conversion and the value after bit width conversion is subtracted; M i Indicates the data bit width before conversion during the i-th bit width conversion process; N i Indicates the data bit width after conversion during the i-th bit width conversion process.

[0007] Optionally, before obtaining the value Y after multiple bit width conversions, the method further includes: Calculate the truncation error during each bit width conversion.

[0008] Optionally, based on a preset probability F k , before adding the compensation value k to the value Y, the method further includes: Calculate the probability F corresponding to the compensation value k k .

[0009] Optionally, if the data undergoes a bit width conversion, the method further includes: Get the bit width M of the data before bit width conversion 1 and the value a before conversion, and the bit width N after conversion 1 and the converted value b; Based on the preset probability p 1 Compensate the value b to obtain the compensated value c; The compensation formula is: 1 In the case of probability p, c=b; 1 In the case of , c=b+1; ;d 1 =ab.

[0010] Optionally, the probability p based on a preset 1 Compensate the value b to obtain the compensated value c, including: From 0 to Randomly select a value e from the integer interval; Based on the value e and the difference d 1 The comparison result between them is the compensated value c; when the value e≤d 1 When the value e>d 1 , c=b.

[0011] Optionally, the value Y includes the grayscale value of any pixel.

[0012] In a second aspect of the present application, a data processing system is provided, comprising: A value acquisition module is used to obtain the value Y after multiple bit width conversions; Probabilistic compensation module, used for k , add the compensation value k to the value Y to get the compensated value; in, ; k represents any integer between 0 and Q; F k represents the probability of adding compensation value k to value Y; Q represents the total number of bit width conversions; R represents a set consisting of integers between 1 and Q; R1 represents a subset of set R and contains k elements in set R; R2 represents the complement of set R1 within the range of set R; i and j represent index values ​​in set R1 and set R2 respectively; p i represents the truncation error during the i-th bit width conversion process, p j represents the truncation error during the j-th bit width conversion process, and ; ;d i Indicates that during the i-th bit width conversion, when the data bit width is M i In the case of bit width conversion, the difference between the value before bit width conversion and the value after bit width conversion is subtracted; M i Indicates the data bit width before conversion during the i-th bit width conversion process; N i Indicates the data bit width after conversion during the i-th bit width conversion process.

[0013] Optionally, the system further includes: An error calculation module is used to calculate the truncation error in each bit width conversion process; Probability calculation module, used to calculate the probability F corresponding to the compensation value k k .

[0014] In a third aspect of the present application, an electronic device is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; The processor is used to implement the data processing method described in any one of the first aspects when executing the program stored in the memory.

[0015] In a fourth aspect of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the data processing method described in any one of the first aspects is implemented.

[0016] The beneficial effects of this application are as follows: The present application provides a data processing method, comprising: obtaining a value Y after multiple bit width conversions; based on a preset probability F k , add the compensation value k to the value Y to get the compensated value.

[0017] in, ; k represents any integer between 0 and Q; F k represents the probability of adding compensation value k to value Y; Q represents the total number of bit width conversions; R represents a set consisting of integers between 1 and Q; R1 represents a subset of set R and contains k elements in set R; R2 represents the complement of set R1 within the range of set R; i and j represent index values ​​in set R1 and set R2 respectively; p i represents the truncation error during the i-th bit width conversion process, p j represents the truncation error during the j-th bit width conversion process, and ; ;d i Indicates that during the i-th bit width conversion, when the data bit width is M i In the case of bit width conversion, the difference between the value before bit width conversion and the value after bit width conversion is subtracted; M i Indicates the data bit width before conversion during the i-th bit width conversion process; N i Indicates the data bit width after conversion during the i-th bit width conversion process.

[0018] Based on the above processing, the present application provides a data processing solution based on probability F k Add the compensation value k to the value Y, and at the same time, based on the probability F k From the formula content, we can know that the probability F k The probability expectation obtained by multiplying the compensation value k is the same as the sum of the truncation errors of the value Y in multiple bit width conversions. Therefore, in this scheme, multiple truncation errors can be compensated once in the form of probability, with high real-time performance, simple operation process, low resource consumption, and can be applied to multi-stage cascade image algorithms. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 This application provides an image with water stains due to truncation error; Figure 2 It is a flowchart of a data processing method provided by this application; Figure 3It is a flowchart of another data processing method provided by the present application; Figure 4 is a structural schematic diagram of a pixel data processing device provided by the present application; Figure 5 is an error-compensated image provided by the present application; Figure 6 It is a structural schematic diagram of a data processing system provided by the present application; Figure 7 It is a structural diagram of an electronic device provided by this application. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments.

[0021] In the process of converting M-bit image data to N-bit (M>N), the lower MN bits are discarded, resulting in errors, which will form patterns such as "water stains" and "false contours" on the converted image, such as Figure 1 The reason for this phenomenon is that there is a truncation error in the grayscale value bit width conversion process, which causes part of the image information to be lost, causing the originally gradually changing image to produce a sudden "pseudo contour" at some locations.

[0022] In order to solve this problem, the prior art has disclosed a variety of technical means, including methods of adding random noise, error diffusion, and random compensation.

[0023] There are existing methods for adding random noise, such as Japanese patents JP1993122523A and JP2003162717A, which add random noise to each pixel in the M-bit image data, so that the part that would have been truncated and discarded originally may obtain the superposition of random noise to produce a carry, thereby showing the effect of increasing the grayscale value, which can compensate for the truncation error to a certain extent, thereby improving the "pseudo contour" problem.

[0024] Error diffusion-based technologies, such as Chinese patent CN 105391912 A, can solve the "pseudo-contour" problem by calculating the truncation error of the current pixel and distributing it to the surrounding pixels to offset the truncation error on a macro scale.

[0025] In addition, in the field of direct digital synthesis, Chinese patent CN117311442 A discloses a method of randomly compensating data with 0 or 1 after truncation, which can solve the problem of RF signal spectrum deterioration in the field of digital synthesis, and has a certain degree of similarity with the problem to be solved in this application.

[0026] However, the existing technology also has defects such as high noise, low real-time performance, high resource consumption and narrow scope of application.

[0027] Specifically, the method of adding random noise generates a random number in a certain range, adds it to the image data before the bit width conversion, and then performs the bit width conversion, which will increase the noise of the output image and reduce the image quality.

[0028] The error diffusion technology disperses the grayscale truncation error of the current pixel to the surrounding pixels. Therefore, L lines of image data need to be cached (L>1). It cannot achieve real-time processing at the pixel level, has low real-time performance, and consumes more resources when implemented in hardware circuits.

[0029] In addition, the error diffusion-based technology and the method of randomly compensating the data with 0 or 1 after truncation can only compensate for one truncation error. However, in the process of digital image data processing, there are usually multiple image algorithms involving bit width conversion. These algorithms often work in series, and the output of the previous algorithm is used as the input of the next algorithm. In each algorithm, in order to improve the calculation accuracy, the bit width is first increased to perform intermediate operations and then output in stages. Therefore, the existing technology can only process one level of conversion and is difficult to apply to multi-level series image algorithms.

[0030] In order to solve the above problems, the present application provides a data processing method, such as Figure 2 As shown, the method comprises the following steps: S1. Obtain the value Y after multiple bit width conversions.

[0031] S2, based on the preset probability F k , add the compensation value k to the value Y to get the compensated value.

[0032] in, ; k represents any integer between 0 and Q; F k represents the probability of adding compensation value k to value Y; Q represents the total number of bit width conversions; R represents a set consisting of integers between 1 and Q; R1 represents a subset of set R and contains k elements in set R; R2 represents the complement of set R1 within the range of set R; i and j represent index values ​​in set R1 and set R2 respectively; p i represents the truncation error during the i-th bit width conversion process, p j represents the truncation error during the j-th bit width conversion process, and ; ;d i Indicates that during the i-th bit width conversion, when the data bit width is M iIn the case of bit width conversion, the difference between the value before bit width conversion and the value after bit width conversion is subtracted; M i Indicates the data bit width before conversion during the i-th bit width conversion process; N i Indicates the data bit width after conversion during the i-th bit width conversion process.

[0033] Similarly, d j Indicates that during the jth bit width conversion, when the data bit width is M j In the case of bit width conversion, the difference between the value before bit width conversion and the value after bit width conversion is subtracted; M j Indicates the data bit width before conversion during the jth bit width conversion process; N j Indicates the data bit width after conversion during the jth bit width conversion.

[0034] Based on the above processing, the present application provides a data processing solution based on probability F k Add the compensation value k to the value Y, and at the same time, based on the probability F k From the formula content, we can know that the probability F k The probability expectation obtained by multiplying the compensation value k is the same as the sum of the truncation errors of the value Y in multiple bit width conversions. Therefore, in this scheme, multiple truncation errors can be compensated once in the form of probability, with high real-time performance, simple operation process, low resource consumption, and can be applied to multi-stage cascade image algorithms.

[0035] Compared with the prior art, the present application adopts a probability statistics-based approach to perform appropriate expected compensation for truncation errors, which has the advantages of good processing effect, high real-time performance, low resource consumption and wide application range.

[0036] like Figure 3 As shown, the data processing solution provided by the present application further includes the following steps before step S1: S3. Calculate the truncation error in each bit width conversion process.

[0037] Among them, the truncation error of each bit width conversion is ; Note that when using compensation values ​​of 0 and 1 to compensate for a truncation error, in order to meet the requirement that the probability expectation is the same as the truncation error, the probability corresponding to the compensation value 1 is also p i or p j .

[0038] Before step S2, the present application further includes the following steps: S4. Calculate the probability F corresponding to the compensation value k k .

[0039] in, .

[0040] In some embodiments, if the data undergoes a bit width conversion, the data processing method provided by the present application further includes the following steps: S5. Obtain the bit width M of the data before bit width conversion 1 and the value a before conversion, and the bit width N after conversion 1 and the converted value b.

[0041] S6. Based on the preset probability p 1 The value b is compensated to obtain a compensated value c.

[0042] The compensation formula is: 1 In the case of probability p, c=b; 1 In the case of , c=b+1; ;d 1 =ab.

[0043] In some embodiments, step S6 includes the following: S601, between 0 and Randomly select a value e from the integer interval .

[0044] S602, based on the value e and the difference d 1 The comparison result between them is the compensated value c. Among them, when the value e≤d 1 When the value e>d 1 , c=b.

[0045] The following uses digital image processing as an example to illustrate data compensation in a bit width conversion.

[0046] Step 1: During the bit width conversion process, the data bit width M of the input image 1 bits, requiring the data bit width of the output image to be N 1 Bit (M 1 >N 1 >0). Among them, the output image N 1 bit is input M 1 The high bit of the bit data, let the input (i.e., the gray value of the pixel before the bit width conversion) be a, and the output (i.e., the gray value of the pixel after the bit width conversion) be b, then b=a>(M 1 -N 1 ), that is, b is equal to a shifted right by M 1 -N 1 Bit.

[0047] Step 2: Calculate the truncation error d at this time 1 = ab. Among them, d 1 Indicated as M 1 The truncation error under bit, corresponding to N1 The truncation error is d 1 / (2^(M 1 -N 1 )).

[0048] Step 3: With probability p 1 Perform LSB (Least Significant Bit) data compensation on the output data b to obtain c. Specifically, c=b ​​(probability 1-p 1 ) c=b+1 (with probability p 1 ) Among them, the probability The principle is that truncation in bit width conversion brings errors in the converted image, which is d before conversion. 1 , is discarded when converted to a decimal, and the decimal is d 1 / (2^(M 1 -N 1 )), set this error to probability p 1 , with p 1 The probability of compensating the gray level of 1, then the compensation expectation = p 1 ×1=d 1 / (2^(M 1 -N 1 )), from a statistical point of view, the output c is compensated compared to b, and the compensation statistical value is equal to the truncation error, so the "pseudo contour" or "water stain" problem existing in the digital image during the bit width conversion process can be solved.

[0049] In addition, for step three, this application also provides a specific implementation method: generate a natural random number e, which obeys a uniform distribution and ranges from 0 to , then 1<=e<=d 1 The probability is d 1 / (2^(M 1 -N 1 )), that is, 1<=e<=d 1 The probability is p 1 , so if the generated random number e satisfies 1<=e<=d 1 Then implement c=b+1 (with probability p 1 ), otherwise implement c=b (with probability 1-p 1 ).

[0050] When the digital image data undergoes multi-level bit width conversion during processing, the solution provided by the present application performs error compensation in step S2 for the value Y outputted at the last level. The principle of multi-level error compensation is described as follows: In the Q-level bit width conversion, for each level, the probability p i To compensate 1, the probability (1-p j ) is compensated 0, so the probability of Q levels compensating k in total is that k levels out of Q levels compensate 1 and Qk levels compensate 0. Considering independent and identical distribution, the probability multiplication is p for k levels i Multiply by Qk levels (1-p j ) multiplied.

[0051] Let the natural numbers from 1 to Q form a set R, then extracting k levels from it can form a set R1, R1 is a subset of R, and its complement is defined as R2. Therefore, there are many ways to combine R1 and R2, and the probabilities of different combinations need to be added.

[0052] For example, there are two bit width conversion levels A and B executed in series. According to the above analysis, bit width truncation will occur in each level, and the truncation error generated by A will be transmitted to the input of level B, resulting in the output data of level B containing the truncation error of the output data of level A itself in addition to the truncation error of level B itself.

[0053] Referring to the principle of the above scheme, the compensation expectation of level A is set to pa, and the compensation expectation of level B is set to pb. Then it can be considered that the final compensation expectation p_total=pa+pb, and the value range of p_total is 0~2, which means that the final compensation value has three possible situations: 0, 1, and 2. Correspondingly, if there are Q levels, the value range of the compensation value p_total is 0~Q, and there are 0 / 1 / 2…Q, a total of Q+1 compensation situations.

[0054] The probability of each compensation situation is different. Take the two levels A / B as an example: Compensation value 2: A / B links need to compensate 1 each, with a probability of pa×pb. Compensation value 1: One of the A / B links needs to compensate 1, and the other does not need compensation, with a probability of pa×(1-pb)+(1-pa)×pb. Compensation value 0: Neither A / B link needs compensation, with a probability of (1-pb)×(1-pa).

[0055] Verify that the expected value of the total compensation according to this scheme = 2×pa×pb+1×(pa×(1-pb)+(1-pa)×pb)+0×(1-pb)×(1-pa)=pa+pb, which is the same as the expected p_total=pa+pb.

[0056] Because F k The calculation of F is more complicated, so it can be calculated in advance k The value can be saved and directly loaded for use, which can improve the operating efficiency of this solution.

[0057] In addition, compared with the existing technology based on "error diffusion", the data processing solution provided by this application only performs real-time processing on the current pixel without associating other pixels. Therefore, when implemented in the hardware system, there is no need to cache additional image data, which reduces resource consumption. At the same time, this application performs appropriate expected compensation for truncation errors based on probability statistics, which can be applied to the case of multi-level bit width conversion.

[0058] For the truncation error in digital image processing, the present application also provides a pixel data processing device, such as Figure 4 As shown, the device comprises: Digital image algorithm circuit 1: used to execute digital image algorithm 1.

[0059] Bit width conversion circuit 1: used to convert the output image data bit width of the digital image algorithm circuit 1 to the required bit width.

[0060] The truncation error calculation circuit 1 is used to calculate the truncation error generated after the bit width conversion circuit 1 converts the bit width of a pixel.

[0061] Digital image algorithm circuit 2: used for executing digital image algorithm 2.

[0062] Bit width conversion circuit 2: used to convert the output image data bit width of the digital image algorithm circuit 2 to the required bit width.

[0063] Truncation error calculation circuit 2: used to calculate the truncation error generated after the bit width conversion circuit 2 converts the bit width of a pixel.

[0064] F k Lookup table circuit: stores the probability F of compensation k corresponding to each truncation error value algorithm level k Random number generator circuit: used to generate a random number to determine the probability of F k Whether the event occurred.

[0065] Truncation compensation circuit: Reception probability F k The value of the random number generated by the receiving random number generator circuit is determined to have a probability of F k Whether the event occurs, if it does, the image data is compensated for grayscale k, and the cycle is performed for k=1~Q, where Q is the number of bit width conversion circuits, and the number in this pixel data processing device is 2. Figure 5 An error-compensated image provided by this application, such as Figure 5 As shown, the data processing solution provided by the present application can effectively compensate for the truncation error in the bit width conversion process.

[0066] In addition, the number of digital image algorithm circuits, bit width conversion circuits, and truncation error calculation circuits of the pixel data processing device provided in the present application is not limited to 2, and can be 3, 4, 5 or more.

[0067] Based on the same inventive concept, the present application also provides a data processing system, such as Figure 6 As shown, the system includes: A value acquisition module 601 is used to acquire a value Y after multiple bit width conversions; The probability compensation module 602 is used to compensate the probability of k , add the compensation value k to the value Y to get the compensated value; in, ; k represents any integer between 0 and Q; F k represents the probability of adding compensation value k to value Y; Q represents the total number of bit width conversions; R represents a set consisting of integers between 1 and Q; R1 represents a subset of set R and contains k elements in set R; R2 represents the complement of set R1 within the range of set R; i and j represent index values ​​in set R1 and set R2 respectively; p i represents the truncation error during the i-th bit width conversion process, p j represents the truncation error during the j-th bit width conversion process, and ; ;d i Indicates that during the i-th bit width conversion, when the data bit width is M i In the case of bit width conversion, the difference between the value before bit width conversion and the value after bit width conversion is subtracted; M i Indicates the data bit width before conversion during the i-th bit width conversion process; N i Indicates the data bit width after conversion during the i-th bit width conversion process.

[0068] In some embodiments, the data processing system provided by the present application further includes: An error calculation module is used to calculate the truncation error in each bit width conversion process; Probability calculation module, used to calculate the probability F corresponding to the compensation value k k .

[0069] The present application also provides an electronic device, such as Figure 7 As shown, it includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704; Memory 703, used for storing computer programs; The processor 701 is used to implement any of the above-mentioned data processing methods when executing the program stored in the memory 703.

[0070] The communication bus mentioned in the above electronic device can be a peripheral component interconnect (pCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0071] The communication interface is used for communication between the above electronic device and other devices.

[0072] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0073] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0074] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, any of the above-mentioned data processing method steps is implemented.

[0075] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any step of the data processing method in the above embodiments.

[0076] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A data processing method, characterized in that: include: Get the value Y after multiple bit width conversions; Based on the preset probability F k , add the compensation value k to the value Y to get the compensated value; in, ; k represents any integer between 0 and Q; F k represents the probability of adding compensation value k to value Y; Q represents the total number of bit width conversions; R represents a set consisting of integers between 1 and Q; R1 represents a subset of set R and contains k elements in set R; R2 represents the complement of set R1 within the range of set R; i and j represent index values ​​in set R1 and set R2 respectively; p i represents the truncation error during the i-th bit width conversion process, p j represents the truncation error during the j-th bit width conversion process, and ; ;d i Indicates that during the i-th bit width conversion, when the data bit width is M i In the case of bit width conversion, the difference between the value before bit width conversion and the value after bit width conversion is subtracted; M i Indicates the data bit width before conversion during the i-th bit width conversion process; N i Indicates the data bit width after conversion during the i-th bit width conversion process.

2. The method according to claim 1, characterized in that Before obtaining the value Y after multiple bit width conversions, the method further includes: Calculate the truncation error during each bit width conversion.

3. The method according to claim 1, characterized in that Based on the preset probability F k , before adding the compensation value k to the value Y, the method further includes: Calculate the probability F corresponding to the compensation value k k .

4. The method according to claim 1, characterized in that: If the data undergoes a bit width conversion, the method further includes: Obtaining the bit width M1 of the data before bit width conversion and the value a before conversion, as well as the bit width N1 and the value b after conversion; Compensate the value b based on the preset probability p1 to obtain a compensated value c; The compensation formula is: in the case of probability 1-p1, c=b; in the case of probability p1, c=b+1; ;d1=ab.

5. The method according to claim 4, characterized in that The compensating the value b based on the preset probability p1 to obtain the compensated value c includes: From 0 to Randomly select a value e from the integer interval; Based on the comparison result between the value e and the difference d1, the compensated value c is obtained; wherein, when the value e≤d1, c=b+1; when the value e>d1, c=b.

6. The method according to any one of claims 1 to 5, characterized in that: The value Y includes the grayscale value of any pixel.

7. A data processing system, characterized in that: include: A value acquisition module is used to obtain the value Y after multiple bit width conversions; Probabilistic compensation module, used for k , add the compensation value k to the value Y to get the compensated value; in, ; k represents any integer between 0 and Q; F k represents the probability of adding compensation value k to value Y; Q represents the total number of bit width conversions; R represents a set consisting of integers between 1 and Q; R1 represents a subset of set R and contains k elements in set R; R2 represents the complement of set R1 within the range of set R; i and j represent index values ​​in set R1 and set R2 respectively; p i represents the truncation error during the i-th bit width conversion process, p j represents the truncation error during the j-th bit width conversion process, and ; ;d i Indicates that during the i-th bit width conversion, when the data bit width is M i In the case of bit width conversion, the difference between the value before bit width conversion and the value after bit width conversion is subtracted; M i Indicates the data bit width before conversion during the i-th bit width conversion process; N i Indicates the data bit width after conversion during the i-th bit width conversion process.

8. The system according to claim 7, characterized in that The system further comprises: An error calculation module is used to calculate the truncation error in each bit width conversion process; Probability calculation module, used to calculate the probability F corresponding to the compensation value k k .

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the data processing method according to any one of claims 1 to 6 when executing a program stored in a memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data processing method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Lossy compression algorithm based on peak clipping and tail insertion technology and geometrical progression companding transform

    CN106992787A

  • Design method of compensation circuit under arbitrary truncation bit width of approximate multiplier

    CN118210473A

  • Method and system for error compensation

    US20070002380A1

  • Error reduction method and apparatus for a direct digital synthesizer

    US4975699A