Home > Back-end >  I believe I converted between sRGB and linear RGB correctly, so why do the results look worse for da
I believe I converted between sRGB and linear RGB correctly, so why do the results look worse for da

Time:10-02

After a study of enter image description here

Top half: checkerboarded red (255, 0, 0) and green (0, 255, 0) pixels.
Lower left: naive mixdown by division with 2 (128, 128, 0).
Lower right: (188, 188, 0)

The lower half shows two different attempts at what the top half could look like when scaled down by 50% on both axes. Since the top half is interleaved full green and full red pixels, a downscale would have to add half red and half green together, the value for which is what I calculated earlier (188).

The lower right matches the top half quite exactly on my plain consumer display monitor when crossing my eyes, so it seems like this whole conversion math is working out.

But what about darker colors?

log.Printf("Half of sRGB 64 calculated in linear RGB is %d", Standardb(Linearb(64)/2))
prints Half of sRGB 64 calculated in linear RGB is 44.

I do the same as before:

enter image description here

Top half: checkerboarded dark red (64, 0, 0) and dark green (0, 64, 0) pixels.
Lower left: naive mixdown by division with 2 (32, 32, 0).
Lower right: (44, 44, 0)

This time, on my display, the naive (incorrect) method matches the upper half almost perfectly, while the value that I went through the effort to calculate in the lower right looks way too bright.

Did I make a mistake? Or is this just the extent of error to expect on consumer display devices?

CodePudding user response:

Did I make a mistake?

Yes and no. Your code is correct, but your testing methodology has an oversight:

is this just the extent of error to expect on consumer display devices?

Yes. In particular, this likely is caused by the display panel's control driver. See someone making a similar observation here: enter image description here

Second image with horizontal lines:

enter image description here

  • Related