RSS/Atom feed Twitter
Site is read-only, email is disabled

unusual (babl/babl/util.h) sRGB tone curve values

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

7 of 7 messages available
Toggle history

Please log in to manage your subscriptions.

unusual (babl/babl/util.h) sRGB tone curve values Elle Stone 22 Aug 14:50
  unusual (babl/babl/util.h) sRGB tone curve values Nicolas Robidoux 22 Aug 15:00
   unusual (babl/babl/util.h) sRGB tone curve values Graeme Gill 22 Aug 22:33
    unusual (babl/babl/util.h) sRGB tone curve values Øyvind Kolås 23 Aug 08:37
    unusual (babl/babl/util.h) sRGB tone curve values Øyvind Kolås 23 Aug 08:37
  unusual (babl/babl/util.h) sRGB tone curve values Nicolas Robidoux 22 Aug 15:06
  unusual (babl/babl/util.h) sRGB tone curve values Øyvind Kolås 22 Aug 15:47
Elle Stone
2012-08-22 14:50:09 UTC (over 12 years ago)

unusual (babl/babl/util.h) sRGB tone curve values

Working on getting high bit depth color conversion to work (still not there yet!) has meant peeking into a lot of babl/gegl/gimp code. I noticed unusual sRGB tone curve values in the functions "linear_to_gamma_2_2" and "gamma_2_2_to_linear", defined in /babl/babl/util.h.

The standard values are: 0.04045 and 0.0031308. The util.h values are: 0.03928 and 0.0030402477.

I was curious as to whether/where/how gimp uses these functions (via babl, it must be) and why nonstandard values are used.

If anyone is interested, I put together some test code to see what difference the resulting values might be, given appropriate input values:
http://ninedegreesbelow.com/temp/gimp-lcms-4.html#srgbtc

Elle

Nicolas Robidoux
2012-08-22 15:00:25 UTC (over 12 years ago)

unusual (babl/babl/util.h) sRGB tone curve values

I stand to be corrected on this, but I believe that there is more than one sRGB standard. I also vaguely remember reading that the formulas are slightly different for 8 and 16 bit sRGB, meaning that they don't exactly agree at the common (scaled) values.

http://www.color.org/srgbprofiles.xalter

Nicolas Robidoux
2012-08-22 15:06:09 UTC (over 12 years ago)

unusual (babl/babl/util.h) sRGB tone curve values

Again from fading memory, I believe that the original formulas failed to be perfectly smooth, which was completely irrelevant in 8-bit but could be argued to be significant in 16-bit. I also would not be surprised if some 16-bit sRGBs have a slightly wider gamut. These tweaks would break the "alignment" of 8-bit sRGB with 16-bit sRGB.

Øyvind Kolås
2012-08-22 15:47:53 UTC (over 12 years ago)

unusual (babl/babl/util.h) sRGB tone curve values

On Wed, Aug 22, 2012 at 4:50 PM, Elle Stone wrote:

Working on getting high bit depth color conversion to work (still not there yet!) has meant peeking into a lot of babl/gegl/gimp code. I noticed unusual sRGB tone curve values in the functions "linear_to_gamma_2_2" and "gamma_2_2_to_linear", defined in /babl/babl/util.h.

The standard values are: 0.04045 and 0.0031308. The util.h values are: 0.03928 and 0.0030402477.

I have no chance of remembering more than what is in the code and comments for code that I wrote close to a decade ago, I'd suggest searching for the constants used in babl and see if the pages that turn up in a search result provide some rationale :)

Thank you for your continued interest in reviewing some of the fundamental core bits.

/

gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list
Graeme Gill
2012-08-22 22:33:05 UTC (over 12 years ago)

unusual (babl/babl/util.h) sRGB tone curve values

Nicolas Robidoux wrote:

I stand to be corrected on this, but I believe that there is more than one sRGB standard. I also vaguely remember reading that the formulas are slightly different for 8 and 16 bit sRGB, meaning that they don't exactly agree at the common (scaled) values.

Hi,
it appears that the util.h values are from a draft of the IEC sRGB standard, not the final one.

Elle Stone wrote:

The standard values are: 0.04045 and 0.0031308. The util.h values are: 0.03928 and 0.0030402477.

Nicolas Robidoux wrote:

Again from fading memory, I believe that the original formulas failed to be perfectly smooth, which was completely irrelevant in 8-bit but could be argued to be significant in 16-bit. I also would not be surprised if some 16-bit sRGBs have a slightly wider gamut. These tweaks would break the "alignment" of 8-bit sRGB with 16-bit sRGB.

Let's see:

Current IEC specification values: 0.04045 / 12.92 = 0.003130804954 ((0.04045 + 0.055)/1.055)^2.4 = 0.003130807229 continuity error of 1 part in 1.3e6

Draft IEC sRGB & util.h values 0.03928 / 12.92 = 0.003040247678 ((0.03928 + 0.055)/1.055)^2.4 = 0.003039492412 continuity error of 1 part in 4e3

So the util.h values are a lot less smooth than the sRGB standard values.

Graeme Gill

Øyvind Kolås
2012-08-23 08:37:42 UTC (over 12 years ago)

unusual (babl/babl/util.h) sRGB tone curve values

On Thu, Aug 23, 2012 at 12:33 AM, Graeme Gill

Hi,
it appears that the util.h values are from a draft of the IEC sRGB standard, not the final one.

Elle Stone wrote:

The standard values are: 0.04045 and 0.0031308. The util.h values are: 0.03928 and 0.0030402477.

Let's see:

Current IEC specification values: 0.04045 / 12.92 = 0.003130804954 ((0.04045 + 0.055)/1.055)^2.4 = 0.003130807229 continuity error of 1 part in 1.3e6

Draft IEC sRGB & util.h values 0.03928 / 12.92 = 0.003040247678 ((0.03928 + 0.055)/1.055)^2.4 = 0.003039492412 continuity error of 1 part in 4e3

So the util.h values are a lot less smooth than the sRGB standard values.

Thank you both, I've pushed changes that should make babl adhere to the current standard.

/yvind K.

commit 1cec819c3070c21d90eac9a7ab27717499e75239 Author: yvind Kols
Date: Thu Aug 23 10:26:29 2012 +0200

Adjust constants used for sRGB gamma

Spotted by Elle Stone and clarified by Graeme Gill, now updated to Current IEC
specification values.

commit 2675787f341ce259f9abec3e326b5efece45ecbf Author: yvind Kols
Date: Thu Aug 23 10:30:32 2012 +0200

tests: adjust float to 8bit regression test for new sRGB precision

gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list
Øyvind Kolås
2012-08-23 08:37:42 UTC (over 12 years ago)

unusual (babl/babl/util.h) sRGB tone curve values

On Thu, Aug 23, 2012 at 12:33 AM, Graeme Gill

Hi,
it appears that the util.h values are from a draft of the IEC sRGB standard, not the final one.

Elle Stone wrote:

The standard values are: 0.04045 and 0.0031308. The util.h values are: 0.03928 and 0.0030402477.

Let's see:

Current IEC specification values: 0.04045 / 12.92 = 0.003130804954 ((0.04045 + 0.055)/1.055)^2.4 = 0.003130807229 continuity error of 1 part in 1.3e6

Draft IEC sRGB & util.h values 0.03928 / 12.92 = 0.003040247678 ((0.03928 + 0.055)/1.055)^2.4 = 0.003039492412 continuity error of 1 part in 4e3

So the util.h values are a lot less smooth than the sRGB standard values.

Thank you both, I've pushed changes that should make babl adhere to the current standard.

/yvind K.

commit 1cec819c3070c21d90eac9a7ab27717499e75239 Author: yvind Kols
Date: Thu Aug 23 10:26:29 2012 +0200

Adjust constants used for sRGB gamma

Spotted by Elle Stone and clarified by Graeme Gill, now updated to Current IEC
specification values.

commit 2675787f341ce259f9abec3e326b5efece45ecbf Author: yvind Kols
Date: Thu Aug 23 10:30:32 2012 +0200

tests: adjust float to 8bit regression test for new sRGB precision

gegl-developer-list mailing list
gegl-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gegl-developer-list