I am using DM368 IPIPE Gamma module to tuning the image quality, convert from 12 bits bayer RGB to 10 bits.
Now I want to use some gamma value to generate Gamma table in RAM, I saw the example in DVSDK4.02, there are two parameters in each entry of the table: slope and offset, and I want know how can I generate the table using C code? For example, if I use gamma = 2.3, how to calculate the offset and slope for each entry?
I have found a formula:
LUT[index]/1024 = (index*8/4096)^(gamma).
slope[index] = LUT[index+1] – LUT[index]
Dose the index corresponding to "offset" in the table entry?
Following are some entries in the beginning of the Gamma table in your DVSDK example:
0 9
9 9
18 9
27 9
36 9
45 9
1st column is offset, 2nd column is slope accordint the exampe code.
Using the formula above, I can calc the gamma value in your exampe is about 0.7589, but using this gamma to calc following entries, the slopes is not the same of the 2nd column, i.e., using gamma = 0.7589, offset = index = 9, the LUT[9] = 47.6886, LUT[10] = 51.6583, so the slope is nearly 4, not 9 in the example. Does this mean the gamma value in your table is variable?
So please give me more details about how to generate the table according some gamma value?
Thanks very much!
Chris Meng:
Index 就是offset,0~511,中共512个。