Should you normalize RGB values by 255 or 256?
39 points
1 hour ago
| 6 comments
| 30fps.net
| HN
crazygringo
5 minutes ago
[-]
Advice for anyone on mobile: read in landscape mode if you want to be able to see the division by 256 version.

The HTML/CSS is bad that lets it completely overflow the right edge of the page instead of wrapping.

I re-read this post three times in total confusion before I figured out the most important piece was missing entirely.

reply
herf
22 minutes ago
[-]
I'll argue for the +0.5 solution. First, I don't like half-sized intervals at the edges, and second, a 255-based representation is typically a SDR (not HDR) image.

RGB values represent luminances against some adapted state, and a "zero" in a daylit scene is not "zero luminance" - it's just about 0.001x as bright as the brightest point - it's millions of photons, way more than zero. In a sense our eyes experience contrast on a sliding scale, and there is no absolute zero in the system. For example, broadcast systems historically used 16-235 as their luminance range for SDR. I think any argument that says "we must have zero" is going to have a bias, but I don't think zero is needed for most things.

reply
yxhuvud
12 minutes ago
[-]
Both solutions add 0.5, the difference is where in the process it happens.
reply
theyeenzbeanz
22 minutes ago
[-]
Should always be 0-255 as that fits an unsigned byte.
reply
crazygringo
55 seconds ago
[-]
That's not what the article is about.
reply
Retr0id
3 minutes ago
[-]
> assume that in both cases the output values are clamped before the final typecast
reply
dudu24
30 minutes ago
[-]
If you have a ruler and it goes to 12 inches, you should normalize by the length L and not by 13, the number of points on the ruler.
reply
lacedeconstruct
16 minutes ago
[-]
yes but >> 8 is so much faster
reply
groundzeros2015
16 minutes ago
[-]
I’m dumb. Doesn’t 0 start at the beginning?
reply
DigitallyFidget
32 minutes ago
[-]
255 gives 0-255, which gives you a zero value. 256 is 1-256, you lose the option of setting 0.
reply
Retr0id
7 minutes ago
[-]
Both of these assume a linear transfer function, which is rarely the case.
reply