Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Gamma correction

JohnZhang
New Contributor I
1,648 Views

Can someone provide some insight into the Gamma correction logic in the IPP library. From my understanding after reading the description (Gamma Correction (intel.com)), the Gamma correction is a "encoding" process to transform linear RGB into nonlinear R'G'B' for the proper color reproduction on the display. But it uses a different formula to the sRGB gamma encoding (sRGB - Wikipedia). It has not provided any explanation for that.

 

In addition, in the color model page (Color Models (intel.com)), it states that all color conversion functions take the gamma corrected RGB values, denoted by R', G' and B'.

But some of the functions, for example RGB2XYZ function, use R, G, B instead. Does that mean the RGB values are the linear RGB values?

 

Many thanks

John

 

 

0 Kudos
7 Replies
ShanmukhS_Intel
Moderator
1,605 Views

Hi John,


Thanks for posting on Intel Communities.

As mentioned by you

  1. Gamma correction of images is used to optimize the usage of data type depth when encoding an image by taking advantage of the non-linear manner in which humans perceive light and color.
  2. This non-linearity must be compensated to achieve correct color reproduction.
  3. To do this, the luminance of each of the linear red, green, and blue components is reduced to a non-linear form using an inverse transformation. 


We will get back to you soon with the other requested information.


Best Regards,

Shanmukh.SS


0 Kudos
ShanmukhS_Intel
Moderator
1,580 Views

Hi John,

 

But it uses a different formula to the sRGB gamma encoding

>>For different gamma formula in IPP vs sRGB(which was mentioned by you), IPP follow ITU-R BT.709 standard instead of IEC 61966-2-1 standard which was mentioned.

 

IPP vs sRGB -> https://en.wikipedia.org/wiki/SRGB#:~:text=sRGB%20is%20a%20standard%20RGB,%2D2%2D1%3A1999.

IPP-> https://en.wikipedia.org/wiki/Rec._709

 

Best Regards,

Shanmukh.SS

 

0 Kudos
JohnZhang
New Contributor I
1,571 Views

Thanks for the reply and links. It looks like IPP follows the HDTV standard and is newer than the sRGB transfer function. Could you clarify whether RGB2XYZ function operates in the linear RGB space? Thanks

 

John 

0 Kudos
ShanmukhS_Intel
Moderator
1,556 Views

Hi John,


Thanks for sharing the feedback. Regarding the contradiction between the Color Model description and RGB2XYZ description, We are discussing the issue with the relevant team. We will get back to you soon with an update.


Best Regards,

Shanmukh.SS


0 Kudos
ShanmukhS_Intel
Moderator
1,526 Views

Hi John,

 

Could you clarify whether RGB2XYZ function operates in the linear RGB space?

>> Yes, we could see most of them are denoted by R', G' and B' in the IPP developer reference, but RGB2XYZ or XYZ2RBG functions, use linear R, G, and B instead. As informed, our team is working on the issue internally.

 

Best Regards,

Shanmukh.SS

 

0 Kudos
ShanmukhS_Intel
Moderator
1,355 Views

Hi John,

 

This is to kindly inform you, the contradiction between the Color Model description mentioned by you would be fixed in Intel IPP upcoming versions. You could refer to the IPP release notes for more information. We are closing the thread for now, If the issue still persists in the upcoming versions, we would like to request you to raise a new thread.

 

In addition to the above-mentioned information, “It looks like there are misprints in the description of Color Models in IPP Developer Reference. Linear RGB values should be used in RGBToXYZ/XYZToRGB functions.

 

More details can be found in [Foley90] James D. Foley, Andries van Dam, Steven K. Feiner, and John F. Hughes. Computer Graphics — Principles and Practice, Second Edition. Addison Wesley, 1990. This book is also mentioned in IPP bibliography.”

 

Best Regards,

Shanmukh.SS

 

0 Kudos
ElMicro
Beginner
1,089 Views

Hi, I'm noticing this too. You say it will be fixed in version 2021.9. If it adds to the conversation, the matrix to convert from RGB to XYZ in your documentation is for sRGB color space with D65 as you can see in one of the common references:

http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html

But you need to apply an inverse sRGB companding after the matrix:

http://www.brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.html

So, actually the API gives wrong results because doesn't apply the companding, and if it's linear, those are not the right values.

And actually is assumed that the results are for sRGB as it says in the OneAPI documentation when you use de XYZ to LAB conversion.

So, there's a lot of different variables in color spaces and gamma and white point out there that maybe could not be tackled but using the right sRGB aproach could be the best for the most used cases but with the companding.

 

If you need   more detailed information that could be useful, let me know but I know that you are working in the issue.

Besta regards.

Thank you so much.

0 Kudos
Reply