This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM365 Gamma Table in ROM/RAM

Dear Sir:

I tried to apply a user-defined gamma table in RAM.

But the result is not good.

It will work, but I can not get a result as good as the ROM table.

There are two questions:

(1) There seems to be a problem when I create the gamma table's maximum offset as 1023.

The high light area will become black and blue. It looks like overshoot.

I has to reduce the maximum offset to 511 to keep the image look normal.

(2) What is the gamma value of the ROM gamma table?

The result of ROM gamma table is good, but I want to make it even better.

I tested RAM gamma table in 0.8, 0.7,0.6... to 0.1. But nothing better is available.

Any comment will be appreciated.

Best regards,

Ray

  • Hi Ray,

    I assume this is for DM36x since you did not specify the platform.

    First of all, I suspect this is most likely because the gamma tables you generated are incorrect.

    If you look at the VPFE UG, you can find that ROM and RAM tables are of different format. ROM table has 1024 entries of 8-bit each. RAM table on the other hand can have different # of entries. Usually we use 512 entries, which is the maximum available. Each entry has a 20-bit field, which is split into an 10-bit offset field and a 10-bit slope field.

    Here is how it works:

    For example, if you have a 12-bit input data with a value of 2837, which is 0xB15 in hex value, you'd first down-shift the data by 3 to get the index to the gamma look-up-table, which is 0x162 in this case, or 354 in decimal.The lsb 3bits of the data, which is 5, is upshifted by 3 to yield 40.

    Now assume your  gamma[354] entry has a offset value of 719 and a slope value of 2.

    The final output from the gamma table operation will then be:

    clip(719+((2*40)>>6)) = 720.

    Here I also attached an example gamma table for your reference. This has a gamma value of 0.45, or the most-often used 2.2 Gamma.

    0        18
    18        18
    36        17
    53        18
    71        18
    89        16
    105        14
    119        12
    131        11
    142        10
    152        9
    161        9
    170        8
    178        7
    185        8
    193        7
    200        6
    206        7
    213        6
    219        6
    225        5
    230        6
    236        5
    241        6
    247        5
    252        5
    257        5
    262        5
    267        4
    271        5
    276        4
    280        5
    285        4
    289        4
    293        5
    298        4
    302        4
    306        4
    310        4
    314        3
    317        4
    321        4
    325        4
    329        3
    332        4
    336        3
    339        4
    343        3
    346        4
    350        3
    353        3
    356        4
    360        3
    363        3
    366        3
    369        4
    373        3
    376        3
    379        3
    382        3
    385        3
    388        3
    391        3
    394        3
    397        3
    400        2
    402        3
    405        3
    408        3
    411        3
    414        2
    416        3
    419        3
    422        2
    424        3
    427        3
    430        2
    432        3
    435        3
    438        2
    440        3
    443        2
    445        3
    448        2
    450        3
    453        2
    455        3
    458        2
    460        2
    462        3
    465        2
    467        3
    470        2
    472        2
    474        3
    477        2
    479        2
    481        2
    483        3
    486        2
    488        2
    490        2
    492        3
    495        2
    497        2
    499        2
    501        2
    503        3
    506        2
    508        2
    510        2
    512        2
    514        2
    516        2
    518        2
    520        2
    522        2
    524        3
    527        2
    529        2
    531        2
    533        2
    535        2
    537        2
    539        2
    541        2
    543        2
    545        2
    547        1
    548        2
    550        2
    552        2
    554        2
    556        2
    558        2
    560        2
    562        2
    564        2
    566        2
    568        1
    569        2
    571        2
    573        2
    575        2
    577        2
    579        1
    580        2
    582        2
    584        2
    586        2
    588        1
    589        2
    591        2
    593        2
    595        1
    596        2
    598        2
    600        2
    602        1
    603        2
    605        2
    607        2
    609        1
    610        2
    612        2
    614        1
    615        2
    617        2
    619        1
    620        2
    622        2
    624        1
    625        2
    627        2
    629        1
    630        2
    632        2
    634        1
    635        2
    637        1
    638        2
    640        2
    642        1
    643        2
    645        1
    646        2
    648        2
    650        1
    651        2
    653        1
    654        2
    656        1
    657        2
    659        2
    661        1
    662        2
    664        1
    665        2
    667        1
    668        2
    670        1
    671        2
    673        1
    674        2
    676        1
    677        2
    679        1
    680        2
    682        1
    683        2
    685        1
    686        2
    688        1
    689        2
    691        1
    692        2
    694        1
    695        1
    696        2
    698        1
    699        2
    701        1
    702        2
    704        1
    705        2
    707        1
    708        1
    709        2
    711        1
    712        2
    714        1
    715        1
    716        2
    718        1
    719        2
    721        1
    722        1
    723        2
    725        1
    726        1
    727        2
    729        1
    730        2
    732        1
    733        1
    734        2
    736        1
    737        1
    738        2
    740        1
    741        1
    742        2
    744        1
    745        1
    746        2
    748        1
    749        1
    750        2
    752        1
    753        1
    754        2
    756        1
    757        1
    758        2
    760        1
    761        1
    762        1
    763        2
    765        1
    766        1
    767        2
    769        1
    770        1
    771        1
    772        2
    774        1
    775        1
    776        1
    777        2
    779        1
    780        1
    781        2
    783        1
    784        1
    785        1
    786        2
    788        1
    789        1
    790        1
    791        1
    792        2
    794        1
    795        1
    796        1
    797        2
    799        1
    800        1
    801        1
    802        2
    804        1
    805        1
    806        1
    807        1
    808        2
    810        1
    811        1
    812        1
    813        1
    814        2
    816        1
    817        1
    818        1
    819        1
    820        1
    821        2
    823        1
    824        1
    825        1
    826        1
    827        2
    829        1
    830        1
    831        1
    832        1
    833        1
    834        2
    836        1
    837        1
    838        1
    839        1
    840        1
    841        1
    842        2
    844        1
    845        1
    846        1
    847        1
    848        1
    849        1
    850        2
    852        1
    853        1
    854        1
    855        1
    856        1
    857        1
    858        1
    859        1
    860        2
    862        1
    863        1
    864        1
    865        1
    866        1
    867        1
    868        1
    869        1
    870        2
    872        1
    873        1
    874        1
    875        1
    876        1
    877        1
    878        1
    879        1
    880        1
    881        1
    882        2
    884        1
    885        1
    886        1
    887        1
    888        1
    889        1
    890        1
    891        1
    892        1
    893        1
    894        1
    895        1
    896        1
    897        1
    898        2
    900        1
    901        1
    902        1
    903        1
    904        1
    905        1
    906        1
    907        1
    908        1
    909        1
    910        1
    911        1
    912        1
    913        1
    914        1
    915        1
    916        1
    917        1
    918        1
    919        1
    920        1
    921        1
    922        1
    923        1
    924        1
    925        2
    927        1
    928        1
    929        1
    930        1
    931        1
    932        1
    933        1
    934        1
    935        1
    936        1
    937        1
    938        1
    939        1
    940        1
    941        1
    942        1
    943        1
    944        1
    945        1
    946        1
    947        1
    948        1
    949        1
    950        1
    951        1
    952        1
    953        1
    954        1
    955        0
    955        1
    956        1
    957        1
    958        1
    959        1
    960        1
    961        1
    962        1
    963        1
    964        1
    965        1
    966        1
    967        1
    968        1
    969        1
    970        1
    971        1
    972        1
    973        1
    974        1
    975        1
    976        1
    977        1
    978        1
    979        1
    980        1
    981        1
    982        0
    982        1
    983        1
    984        1
    985        1
    986        1
    987        1
    988        1
    989        1
    990        1
    991        1
    992        1
    993        1
    994        1
    995        1
    996        1
    997        0
    997        1
    998        1
    999        1
    1000        1
    1001        1
    1002        1
    1003        1
    1004        1
    1005        1
    1006        1
    1007        1
    1008        1
    1009        0
    1009        1
    1010        1
    1011        1
    1012        1
    1013        1
    1014        1
    1015        1
    1016        1
    1017        1
    1018        1
    1019        0
    1019        1
    1020        1
    1021        1
    1022        1
    1023        0


  • Dear Xiangdong:

    Yes. I am using DM365/DM368.


    I also used the gamma table from the example of DVSDK and

    they were not working.

    According to Figure 4.41, I created the gamma table by generating the offset

    with 1023* (x**gamma), here "**" means "power" and x is the input value from 0.0-1.0.

    The slop would be the difference of two offsets.

    Would you mind telling me the way you create the gamma table?

    In the long run, I still need to create difference gamma tables to find the best choice.

    Even the way which ROM table is used is different from the way RAM table is,

    I am still interested in what is the gamma value of the ROM table.

    In case you know the gamma value, would you mind sharing it with us?

    Thanks for your help very much.

    Best regards,

    Ray

  • Please take a look at "4.3.11 Gamma Correction Module" in the VPFE doc "http://www.ti.com/litv/pdf/sprufg8c".

    It explains all the details about how to program the RAM table correctly.

  • Dear Sir:

    I have read this paragraph for several times.

    But I still can not create suitable gamma tables.

    Is there anyway to create a set of gamma tables which have the same effect

    of the ROM gamma tables, so that I can use it as a starting point to

    develop my own gamma tables?

    The ROM gamma tables provide me a pretty good result, but our customers 

    ask me to enhance the colors of the videos a little bit more.

    Best regards,

    Ray

  • Ray,

    The document is quite clear on how Gamma H/W works.

    So, I suppose your problem is about which Gamma curve you want (not about how to program a curve into H/W).

    Enhancing color is a separate issue.

    We cannot discuss those problems on public forum, because they are covered by NDA.

    Please contact your local FAE or sales representative for support.

  • Dear Gang:

    Thanks.

    I think I know how to make the gamma curve.

    Actually I tried the gamma table from  Xiangdong and the example gamma tables from SDK4.

    None of them work as good as the ROM gamma table.

    I realize there are differences between ROM and RAM.

    But if the ROM gamma table is known, it may help me to construct a better RAM gamma table.

    About the color enhancement problem, I will go for domestic FAE for support.

    Best regards,

    Ray

  • Your FAE can provide the ROM gamma too.

  • Dear Gang:

    Thanks for your help.

    I will ask our local FAE.

    Best regards,

    Ray

  • No problem.

  • Hi, Fu!

    Plese tell me how you calculate the offset value? What is the formula? 

    Thansk very much!