Method and device for calculating Gamma correction in RISC-V processor
By dividing Gamma correction into a six-stage pipeline structure, and using lookup tables and segmented linear approximation methods, the problem of low Gamma correction calculation on RISC-V processors is solved, and efficient and accurate Gamma correction calculation is achieved.
Patent Information
- Application Number
- CN202510315016.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-03-18
AI Technical Summary
When the prior art realizes Gamma correction on a RISC-V processor, the computing efficiency is low and it is difficult to meet the needs of efficient and fast computing.
Gamma correction is divided into six-stage pipeline structures, including floating-point adder, floating-point shifter, lookup table, logarithmic operation module, product operation module, exponential operation module and anti-normalization processing module. The lookup table and segmented linear approximation methods are used for approximate calculations.
It significantly improves the calculation efficiency of the Gamma correction algorithm, maintains high data accuracy, avoids image details loss and color distortion caused by quantization errors, and reduces the resource utilization of the processor.
Smart Images

Figure CN119850494A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of integrated circuits, and in particular to a method for calculating gamma correction in a RISC-V processor, and a device for calculating gamma correction in a RISC-V processor. Background Art
[0002] In modern image and video processing systems, gamma correction plays a vital role in improving the visual effects of images. Gamma correction can adjust the brightness and contrast of an image so that the image can present finer details on different display devices. Traditional gamma correction algorithms often face the problem of low computational efficiency when implemented on some general-purpose processors or software. Especially in resource-constrained embedded systems or image processing scenarios with high real-time requirements, existing technologies are difficult to meet the needs of efficient and fast gamma correction calculations.
[0003] As an emerging open source instruction set architecture, RISC-V architecture has significant advantages such as simplicity, flexibility, and scalability, and has been increasingly widely used in embedded systems and IoT devices. However, there is currently no calculation method for the gamma correction algorithm specifically designed for RISC-V processors. Therefore, developing an efficient gamma correction algorithm calculation method for RISC-V processors has important practical significance. Summary of the invention
[0004] In order to overcome the defects of the prior art, the technical problem to be solved by the present invention is to provide a method for calculating gamma correction in a RISC-V processor, which can improve the execution efficiency and calculation accuracy of the gamma correction algorithm on the RISC-V processor.
[0005] The technical solution of the present invention is: the method for calculating gamma correction in the RISC-V processor divides the gamma correction into a six-stage pipeline structure: The first stage consists of a floating-point adder and a floating-point shifter, which maps the input pixel value in the integer range of 0-255 to the real number range of 0-1; The second stage performs a reciprocal operation on the Gamma value, which also includes a lookup table. The lookup table outputs the corresponding γ value according to the different input pixel values to implement the adaptive strategy of Gamma correction; The third stage performs logarithmic operations on the input pixel values, using a lookup table and piecewise linear approximation method; The fourth stage uses a floating-point multiplier to perform a product operation on the result of the reciprocal operation and the result of the logarithmic operation, and the result is used as the input of the fifth stage; The fifth stage performs exponential operation on the output of the fourth stage, and outputs pixel values in the range of 0-1 after gamma correction; The sixth stage consists of a floating-point shifter and a floating-point subtractor, which remaps the gamma-corrected image pixel values back to the 0-255 integer range.
[0006] The beneficial technical effects of the present invention are as follows: (1) By adopting an approximate calculation strategy that combines a lookup table with piecewise linear approximation, the computational complexity and execution time of the complex power operations in the gamma correction algorithm are significantly reduced, greatly improving the computational efficiency.
[0007] (2) High data accuracy is always maintained during the calculation process. Compared with traditional algorithms based on fixed-point operations, it effectively avoids the loss of image details and color distortion caused by quantization errors, and can accurately restore the original details of the image.
[0008] (3) Through special design based on the hardware architecture characteristics of the RISC-V processor and by rationally organizing the data structure and computing process, the resource utilization of the processor is effectively reduced.
[0009] A device for calculating gamma correction in a RISC-V processor is also provided, comprising: A normalization processing module, which is composed of a floating-point adder and a floating-point shifter, maps the pixel value in the integer range of 0-255 to the real number range of 0-1; The reciprocal operation module performs a reciprocal operation on the Gamma value, and also includes a lookup table, which outputs corresponding γ values according to different input pixel values to implement an adaptive strategy for Gamma correction; A logarithmic operation module performs logarithmic operation on input pixel values using a lookup table and piecewise linear approximation method; A product operation module uses a floating-point multiplier to perform a product operation on the result of the reciprocal operation and the result of the logarithm operation, and the result is used as the input of the fifth stage; An exponential operation module performs an exponential operation on the result output by the product operation module, and outputs a pixel value within the range of 0-1 after Gamma correction; The denormalization processing module, which is composed of a floating-point shifter and a floating-point subtractor, remaps the pixel values of the image after gamma correction back to the integer range of 0-255. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 A schematic diagram of a method for calculating gamma correction in a RISC-V processor according to the present invention is shown.
[0011] Figure 2 FIG. 4 is a schematic diagram of the structure of a floating-point shifter according to the present invention.
[0012] Figure 3 Schematic diagram of the reciprocal operation structure according to the present invention.
[0013] Figure 4 Schematic diagram of the logarithmic module operation structure according to the present invention.
[0014] Figure 5 Schematic diagram of the overall structure of the index module according to the present invention.
[0015] Figure 6 FIG. 4 is a schematic diagram of the structure of a symbol processing unit according to the present invention.
[0016] Figure 7 Schematic diagram of the structure of an integer decomposition unit according to the present invention.
[0017] Figure 8 Schematic diagram of the exponential operation structure according to the present invention. DETAILED DESCRIPTION
[0018] When a conventional RISC-V processor executes a gamma correction algorithm, a large number of floating-point extension instructions will be generated through the compiler, which will affect the image processing efficiency and increase the processor execution burden. The present invention designs a gamma correction algorithm calculation method based on the RISC-V floating-point processor, divides the gamma correction algorithm into a six-stage pipeline for operation, designs corresponding floating-point shift operators (replacing floating-point multipliers and floating-point dividers), floating-point reciprocal operators (replacing floating-point dividers) and floating-point absolute value operators, and performs special processing on special cases in logarithmic operations to improve the execution efficiency and calculation accuracy of the gamma correction algorithm on the RISC-V processor.
[0019] Specifically, this method of calculating gamma correction in the RISC-V processor divides the gamma correction into a six-stage pipeline structure: The first stage consists of a floating-point adder and a floating-point shifter, which maps the input pixel value in the integer range of 0-255 to the real number range of 0-1; The second stage performs a reciprocal operation on the Gamma value, which also includes a lookup table. The lookup table outputs the corresponding γ value according to the different input pixel values to implement the adaptive strategy of Gamma correction; The third stage performs logarithmic operations on the input pixel values, using a lookup table and piecewise linear approximation method; The fourth stage uses a floating-point multiplier to perform a product operation on the result of the reciprocal operation and the result of the logarithmic operation, and the result is used as the input of the fifth stage; The fifth stage performs exponential operation on the output of the fourth stage, and outputs pixel values in the range of 0-1 after gamma correction; The sixth stage consists of a floating-point shifter and a floating-point subtractor, which remaps the gamma-corrected image pixel values back to the 0-255 integer range.
[0020] The beneficial technical effects of the present invention are as follows: (1) By adopting an approximate calculation strategy that combines a lookup table with piecewise linear approximation, the computational complexity and execution time of the complex power operations in the gamma correction algorithm are significantly reduced, greatly improving the computational efficiency.
[0021] (2) High data accuracy is always maintained during the calculation process. Compared with traditional algorithms based on fixed-point operations, it effectively avoids the loss of image details and color distortion caused by quantization errors, and can accurately restore the original details of the image.
[0022] (3) Through special design based on the hardware architecture characteristics of the RISC-V processor and by rationally organizing the data structure and computing process, the resource utilization of the processor is effectively reduced.
[0023] Preferably, in the first stage, for a floating point number , shifted left by n bits is equivalent to , shifting right by n bits is equivalent to , perform addition and subtraction operations on the exponent E, and the sign bit S and the mantissa bit F remain unchanged; the exponent: if it moves left by n bits, the exponent increases by n; if it moves right by n bits, the exponent decreases by n; if the exponent overflows, it returns 255 or 0, and the exception status flag is inaccurate.
[0024] Preferably, in the second stage, 1 is first converted into the standard format of IEEE-754 floating point number, the sign bit remains unchanged, and then the exponent bit and the mantissa bit are processed accordingly.
[0025] Preferably, the third stage comprises a control unit, an amplification unit, a lookup table, a selection unit, a multiple-select-one data selector, a floating-point multiplier, and two floating-point adders; The control unit is based on the normalized pixel value of the input Choose how to process the input pixels. There are three cases for the processing. The first case is when When it is equal to 0 or 1, the corresponding result is output directly; the second case is when When it is very close to 0, Amplify and then use the base replacement formula for processing; the third case uses a lookup table and linear approximation method for processing; Amplify pixels that are very close to 0 Perform amplification processing; The lookup table stores the slope, intercept, and pre-calculated ln2 values; Select cells based on pixel value Find the corresponding partition interval; The multiple-choice data selector outputs the corresponding results.
[0026] Preferably, the fifth stage comprises a sign processing unit, an integer decomposition unit, an integer shifter, an exponential operation unit, a multiplication operation unit and a reciprocal operation unit; Symbol Processing Unit Computation The value of a floating point number , the absolute value is , set the sign bit S to 0, and keep the exponent and mantissa bits unchanged; The integer decomposition unit decomposes the exponential part into an integer part and a fractional part, uses a floating-point divider and a floating-point to integer conversion unit to calculate the value of the integer part n, and uses a floating-point multiplier and a floating-point adder to calculate the value of the fractional part r, which are used as input values for the integer shifter and the exponential operation respectively; This is achieved by using integer shifters in the shared ALU module; The method of lookup table and piecewise linear approximation is adopted to realize the method, which includes a comparator, a lookup table, a data selector, a floating point multiplier and a floating point adder; Using floating point multipliers and reciprocal calculations, we can calculate The value of .
[0027] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes the steps of the above-mentioned embodiment method, and the storage medium can be: ROM / RAM, disk, optical disk, memory card, etc. Therefore, corresponding to the method of the present invention, the present invention also includes a device for calculating gamma correction in a RISC-V processor, which is usually represented in the form of functional modules corresponding to the steps of the method. The device includes: A normalization processing module, which is composed of a floating-point adder and a floating-point shifter, maps the pixel value in the integer range of 0-255 to the real number range of 0-1; The reciprocal operation module performs a reciprocal operation on the Gamma value, and also includes a lookup table, which outputs corresponding γ values according to different input pixel values to implement an adaptive strategy for Gamma correction; A logarithmic operation module performs logarithmic operation on input pixel values using a lookup table and piecewise linear approximation method; A product operation module uses a floating-point multiplier to perform a product operation on the result of the reciprocal operation and the result of the logarithm operation, and the result is used as the input of the fifth stage; An exponential operation module performs an exponential operation on the result output by the product operation module, and outputs a pixel value within the range of 0-1 after Gamma correction; The denormalization processing module, which is composed of a floating-point shifter and a floating-point subtractor, remaps the pixel values of the image after gamma correction back to the integer range of 0-255.
[0028] Preferably, in the normalization processing module, for a floating point number , shifted left by n bits is equivalent to , shifting right by n bits is equivalent to , perform addition and subtraction operations on the exponent E, and the sign bit S and the mantissa bit F remain unchanged; the exponent: if it moves left by n bits, the exponent increases by n; if it moves right by n bits, the exponent decreases by n; if the exponent overflows, it returns 255 or 0, and the exception status flag is inaccurate.
[0029] Preferably, in the reciprocal operation module, 1 is first converted into the standard format of IEEE-754 floating point numbers, the sign bit remains unchanged, and then the exponent bits and the mantissa bits are processed accordingly.
[0030] Preferably, the logarithmic operation module comprises a control unit, an amplification unit, a lookup table, a selection unit, a multiple-select-one data selector, a floating-point multiplier, and two floating-point adders; The control unit is based on the normalized pixel value of the input Choose how to process the input pixels. There are three cases for the processing. The first case is when When it is equal to 0 or 1, the corresponding result is output directly; the second case is when When it is very close to 0, Amplify and then use the base replacement formula for processing; the third case uses a lookup table and linear approximation method for processing; Amplify pixels that are very close to 0 Perform amplification processing; The lookup table stores the slope, intercept, and pre-calculated ln2 values; Select cells based on pixel value Find the corresponding partition interval; The multiple-choice data selector outputs the corresponding results.
[0031] Preferably, the fifth stage comprises a sign processing unit, an integer decomposition unit, an integer shifter, an exponential operation unit, a multiplication operation unit and a reciprocal operation unit; Symbol Processing Unit Computation The value of a floating point number , the absolute value is , set the sign bit S to 0, and keep the exponent and mantissa bits unchanged; The integer decomposition unit decomposes the exponential part into an integer part and a fractional part, uses a floating-point divider and a floating-point to integer conversion unit to calculate the value of the integer part n, and uses a floating-point multiplier and a floating-point adder to calculate the value of the fractional part r, which are used as input values for the integer shifter and the exponential operation respectively; This is achieved by using integer shifters in the shared ALU module; The method of lookup table and piecewise linear approximation is adopted to realize the method, which includes a comparator, a lookup table, a data selector, a floating point multiplier and a floating point adder; Using floating point multipliers and reciprocal calculations, we can calculate The value of .
[0032] The present invention is described in more detail below.
[0033] The gamma correction formula is: , in: : Input pixel value, the value range is 0≤ ≤255; γ: γ correction value, the value range is 0<γ<2.5; : Output pixel value, the value range is 0≤ ≤255.
[0034] like Figure 1 As shown in the figure, gamma correction first requires normalization of the input pixel values, then power operation, that is, pre-compensation of the normalized data, and finally de-normalization. The overall operation is divided into a six-stage pipeline to reduce the critical path and improve the performance of the processor.
[0035] Gamma correction steps: Normalization: , Power operation: , Denormalization: , in: The power module is converted to: , : is the normalized pixel value, the value range is 0≤ ≤1; : The value range is -∞< ≤0; : The value range is -∞< ≤0; : The value range is 0< ≤1.
[0036] The first-level data normalization unit consists of a floating-point adder and a floating-point shifter in series to output the normalized pixel value. .
[0037] like Figure 2 As shown in FIG. 1 , a structural diagram of a floating-point shifter is shown.
[0038] For a floating point number , shifted left by n bits is equivalent to , shifting right by n bits is equivalent to , mainly performing addition and subtraction operations on the exponent E, the sign bit S and the mantissa bit F remain unchanged, the exponent: if it moves n bits to the left, the exponent increases by n; if it moves n bits to the right, the exponent decreases by n; if the exponent overflows (exceeds the maximum value or is less than the minimum value), it returns 255 or 0, and the exception status flag is inaccurate.
[0039] The second level lookup table is used to calculate the pixel values according to different pixel values. , output the corresponding γ value, so that the areas with different gray levels are enhanced accordingly.
[0040] The reciprocal operation is used to convert the γ value into The purpose of calculating the exponent is to ensure that when the data after the exponentiation is input to the display device, the display device can correctly reproduce the brightness of the original image.
[0041] like Figure 3 As shown in the figure, it is the structural diagram of the reciprocal operation. The reciprocal operation can be regarded as a special case of floating-point division operation. For a floating point number , its reciprocal , so the sign bit remains unchanged, only the exponent bit and the mantissa bit need to be adjusted. The exponent E is directly negative, and the mantissa bit is The calculation of the mantissa is implemented using the base 2 recovery remainder algorithm in the floating-point divider.
[0042] The third level logarithmic module is used to find The value of Figure 4As shown, it includes a control unit, a selection unit, an amplification unit, a lookup table, a floating-point multiplier and two floating-point adders, and a multiple-select-one data selector.
[0043] The control unit is used to control the pixel value according to the input , to control how the operation is performed. When it is 0 or 1, the result is output directly. When it is very close to 0 (the threshold is set to 0.01), the pixel value is first Zoom in, and then perform the corresponding calculation according to the base replacement formula. In other cases, the lookup table and linear piecewise approximation method are used for calculation.
[0044] When the pixel value When it is very close to 0, there will be problems with numerical precision and calculation overflow. Therefore, in order to avoid this situation, first calculate the pixel value Amplify it, and then perform corresponding calculations according to the bottom replacement formula. When , use the base replacement formula to Translates to: , Compare The larger the value, the more stable it is and the higher the accuracy.
[0045] In other cases, first divide the interval and divide [0,1] into multiple intervals: [0,0.05), [0.05,0.1)…[0.95,1].
[0046] Lookup table to store slope and intercept: Calculate the slope of each interval in advance and the intercept , stored in the lookup table.
[0047] calculate :according to The value of , first find the corresponding interval by selecting the unit , and then find the slope of the corresponding interval from the lookup table and the intercept , and finally calculated by floating-point multiplier and floating-point adder : .
[0048] The fourth stage uses a floating-point multiplier to calculate the output of the second stage. The value of the third level output The product of the values, that is The value of is the input value of the exponential module.
[0049] The fifth level is the index module to find The value of Figure 5 As shown, it includes a sign processing unit, an integer decomposition unit, an integer shifter, an exponential operation unit, a multiplication operation unit and a reciprocal operation unit.
[0050] make , and -∞≤ ≤0, then .
[0051] in: , yes The integer part of yes The decimal part of .
[0052] The symbol processing unit is used to calculate The value of Figure 6 As shown, for a floating point number , find the absolute value of , so we only need to set the sign bit S to 0 (the case of positive numbers remains unchanged), and the exponent and mantissa bits remain unchanged.
[0053] The integer decomposition unit is used to decompose the exponential part into an integer part and a decimal part. Figure 7 As shown, the floating-point divider and the floating-point to integer unit are used to calculate the value of the integer part n, and the floating-point multiplier and the floating-point adder are used to calculate the value of the fractional part r, which are used as input values for the integer shifter and the exponential operation respectively.
[0054] Directly share the integer shifter implementation in the ALU module.
[0055] It is also implemented using a lookup table and piecewise linear approximation method. Figure 8 As shown, it includes a comparator, a lookup table, a data selector, a floating-point multiplier and a floating-point adder. The specific implementation method is the same as the logarithmic operation method.
[0056] Finally, the floating-point multiplier and the reciprocal operation method are used to calculate The value of .
[0057] The sixth stage is the data denormalization unit, which consists of a floating-point shifter and a floating-point subtractor to convert the image pixel values after Gamma correction. Remap back to the 0-255 integer range.
[0058] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention are still within the protection scope of the technical solution of the present invention.
Claims
1. A method for calculating gamma correction in a RISC-V processor, characterized in that: Gamma correction is divided into a six-stage pipeline structure: The first stage consists of a floating-point adder and a floating-point shifter, which maps the input pixel value in the integer range of 0-255 to the real number range of 0-1; The second stage performs a reciprocal operation on the Gamma value, which also includes a lookup table. The lookup table outputs the corresponding γ value according to the different input pixel values to implement the adaptive strategy of Gamma correction; The third stage performs logarithmic operations on the input pixel values, using a lookup table and piecewise linear approximation method; The fourth stage uses a floating-point multiplier to perform a product operation on the result of the reciprocal operation and the result of the logarithmic operation, and the result is used as the input of the fifth stage; The fifth stage performs exponential operation on the output of the fourth stage, and outputs pixel values in the range of 0-1 after gamma correction; The sixth stage consists of a floating-point shifter and a floating-point subtractor, which remaps the gamma-corrected image pixel values back to the 0-255 integer range.
2. The method for calculating gamma correction in a RISC-V processor according to claim 1, characterized in that: In the first level, for a floating point number , shifted left by n bits is equivalent to , shifting right by n bits is equivalent to , perform addition and subtraction operations on the exponent E, and the sign bit S and the mantissa bit F remain unchanged; the exponent: if it moves left by n bits, the exponent increases by n; if it moves right by n bits, the exponent decreases by n; if the exponent overflows, it returns 255 or 0, and the exception status flag is inaccurate.
3. The method for calculating gamma correction in a RISC-V processor according to claim 2, characterized in that: In the second stage, 1 is first converted into the standard format of IEEE-754 floating point numbers, with the sign bit remaining unchanged, and then the exponent bit and the mantissa bit are processed accordingly.
4. The method for calculating gamma correction in a RISC-V processor according to claim 3, characterized in that: The third stage includes a control unit, an amplification unit, a lookup table, a selection unit, a multiple-select-one data selector, a floating-point multiplier, and two floating-point adders; The control unit is based on the normalized pixel value of the input Choose how to process the input pixels. There are three cases for the processing. The first case is when When it is equal to 0 or 1, the corresponding result is output directly; the second case is when When it is very close to 0, Amplify and then use the base replacement formula for processing; the third case uses a lookup table and linear approximation method for processing; Amplify pixels that are very close to 0 Perform amplification processing; The lookup table stores the slope, intercept, and pre-calculated ln2 values; Select cells based on pixel value Find the corresponding partition interval; The multiple-choice data selector outputs the corresponding results.
5. The method for calculating gamma correction in a RISC-V processor according to claim 4, characterized in that: The fifth stage includes a sign processing unit, an integer decomposition unit, an integer shifter, an exponential operation unit, a multiplication operation unit, and a reciprocal operation unit; Symbol Processing Unit Computation The value of a floating point number , the absolute value is , set the sign bit S to 0, and keep the exponent and mantissa bits unchanged; The integer decomposition unit decomposes the exponential part into an integer part and a fractional part, uses a floating-point divider and a floating-point to integer conversion unit to calculate the value of the integer part n, and uses a floating-point multiplier and a floating-point adder to calculate the value of the fractional part r, which are used as input values for the integer shifter and the exponential operation respectively; This is achieved by using integer shifters in the shared ALU module; The method of lookup table and piecewise linear approximation is adopted to realize the method, which includes a comparator, a lookup table, a data selector, a floating point multiplier and a floating point adder; Using floating point multipliers and reciprocal calculations, we can calculate The value of .
6. The device for calculating the gamma correction method in the RISC-V processor according to claim 1, characterized in that: It includes: A normalization processing module, which is composed of a floating-point adder and a floating-point shifter, maps the pixel value in the integer range of 0-255 to the real number range of 0-1; The reciprocal operation module performs a reciprocal operation on the Gamma value, and also includes a lookup table, which outputs corresponding γ values according to different input pixel values to implement an adaptive strategy for Gamma correction; A logarithmic operation module performs logarithmic operation on input pixel values using a lookup table and piecewise linear approximation method; A product operation module, which uses a floating-point multiplier to perform a product operation on the result of the reciprocal operation and the result of the logarithm operation, and the result is used as the input of the fifth stage; An exponential operation module performs an exponential operation on the result output by the product operation module, and outputs a pixel value within the range of 0-1 after Gamma correction; The denormalization processing module, which is composed of a floating-point shifter and a floating-point subtractor, remaps the pixel values of the image after gamma correction back to the integer range of 0-255.
7. The device for calculating the gamma correction method in the RISC-V processor according to claim 6, characterized in that: In the normalization processing module, for a floating point number , shifted left by n bits is equivalent to , shifting right by n bits is equivalent to , perform addition and subtraction operations on the exponent E, and the sign bit S and the mantissa bit F remain unchanged; the exponent: if it moves left by n bits, the exponent increases by n; if it moves right by n bits, the exponent decreases by n; if the exponent overflows, it returns 255 or 0, and the exception status flag is inaccurate.
8. The device for calculating the gamma correction method in the RISC-V processor according to claim 7, characterized in that: In the reciprocal operation module, 1 is first converted into the standard format of IEEE-754 floating point numbers, the sign bit remains unchanged, and then the exponent bit and the mantissa bit are processed accordingly.
9. The device for calculating the gamma correction method in the RISC-V processor according to claim 8, characterized in that: The logarithmic operation module includes a control unit, an amplification unit, a lookup table, a selection unit, a multiple-select-one data selector, a floating-point multiplier, and two floating-point adders; The control unit is based on the normalized pixel value of the input Choose how to process the input pixels. There are three cases for the processing. The first case is when When it is equal to 0 or 1, the corresponding result is output directly; the second case is when When it is very close to 0, Amplify and then use the base replacement formula for processing; the third case uses a lookup table and linear approximation method for processing; Amplify pixels that are very close to 0 Perform amplification processing; The lookup table stores the slope, intercept, and pre-calculated ln2 values; Select cells based on pixel value Find the corresponding partition interval; The multiple-choice data selector outputs the corresponding results.
10. The device for calculating the gamma correction method in the RISC-V processor according to claim 9, characterized in that: The fifth stage includes a sign processing unit, an integer decomposition unit, an integer shifter, an exponential operation unit, a multiplication operation unit, and a reciprocal operation unit; Symbol Processing Unit Computation The value of a floating point number , the absolute value is , set the sign bit S to 0, and keep the exponent and mantissa bits unchanged; The integer decomposition unit decomposes the exponential part into an integer part and a fractional part, uses a floating-point divider and a floating-point to integer conversion unit to calculate the value of the integer part n, and uses a floating-point multiplier and a floating-point adder to calculate the value of the fractional part r, which are used as input values for the integer shifter and the exponential operation respectively; This is achieved by using integer shifters in the shared ALU module; The method of lookup table and piecewise linear approximation is adopted to realize the method, which includes a comparator, a lookup table, a data selector, a floating point multiplier and a floating point adder; Using floating point multipliers and reciprocal calculations, we can calculate The value of .
Citation Information
Patent Citations
Gamma correction method and system
CN114390157A
High-performance embedded processor based on RISC-V architecture
CN116661870A
Economical gamma correction method and device
CN117372296A
RISC-V-based high-speed operation floating point instruction extension unit
CN118259965A
Floating point multiplication and addition operation method and device for floating point data, electronic equipment and storage medium
CN118819465A
Cited By
Image correction method and device based on FPGA
CN121190369A