Remix.run Logo
herf 3 hours 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.

pixelesque 2 hours ago | parent | next [-]

As someone with a lot of experience in this area doing image processing and rendering for VFX (including writing image readers and writers for my own software and commercial VFX software), I think you might be forgetting that colourspace conversion (to sRGB 'linear' rec709 for old-school SDR, but other more wider gamuts for newer formats) would happen after this, so the 'squish' of the dynamic range would happen after loading.

Also, a lot of workflows for image processing and compositing do assume that 0 means zero, whether correctly or not (often incorrectly). So there are often assumptions that for 8-bit, 0u maps to 0.0f and 255 maps to 1.0f for things like masking or alpha: as soon as you have 0 values which become just over 0.0, you then have artifacts because some code somewhere is using a hard threshold of 0.0 to mask some other operation, and vice-versa for 1.0 with alpha, where suddenly because the 255 values are no longer 1.0f, you have very slightly see-through objects (often only visible in certain situations or when pixel-peeping) after pre-multiplication.

(Same thing can happen when 254 becomes 1.0f after +0.5 with masking).

herf an hour ago | parent [-]

good point - alpha is a notable exception, it is not luminance

dylan604 18 minutes ago | parent | prev | next [-]

> broadcast systems historically used 16-235

For 8-bit, 16 maps to 7.5IRE which is the well understood legal black. Mapping 235 means they mapped peak to 110IRE. This is based on a 0-120IRE scale. This gets weird as the broadcast limit for video was 100IRE allowing for the chroma to reach 110IRE. So if you're trying to limit your white values to 235, that'll be higher than is broadcast safe. Of course, nobody cares about NTSC broadcast limits any more. However, to this day, I still see out of spec tapes marked as "broadcast master" that have been ingested for streaming use. It drives me crazy to this day, and it's only getting worse as people don't even have scopes to adjust the VTR's TBC properly.

amavect 3 hours ago | parent | prev | next [-]

I agree. Additionally, both 0.0 and 1.0 don't really exist for dithered signals, so a byte should map to [0.5, 255.5] before division by 256. This also solves the signed integer asymmetry, as a signed byte maps to [-127.5, 127.5] before division by 128. I wonder if audio DSP folks have done this already.

amavect 6 minutes ago | parent [-]

Thinking about this more, dithering requires negative values to cancel out when adding. Works for audio, but color doesn't have negative numbers.

yxhuvud 3 hours ago | parent | prev | next [-]

Both solutions add 0.5, the difference is where in the process it happens.

infinet 2 hours ago | parent | prev | next [-]

Interesting idea, but somehow I feel the world is shaking. For the processing program, what used to black(0.0) and white(1.0) has became very dark gray and very bright gray.

themafia 2 hours ago | parent | prev [-]

> In a sense our eyes experience contrast on a sliding scale

There's a whole visual center to check the amount of incoming light and adjust your pupils for you. It's intentionally reactive.

> and there is no absolute zero in the system.

There maybe is. I think we call that "blind."

> broadcast systems historically used 16-235 as their luminance range for SDR

Mostly because it was a fully analog system and these all translate down to signal voltage. Jokingly NTSC used to be referred to as "Never Twice the Same Color" due to being a compromise bolted onto the side of an already compromised system.

a_conservative 29 minutes ago | parent [-]

>> and there is no absolute zero in the system.

> There maybe is. I think we call that "blind."

If you go looking into that, you'll see that the reality is far far more complex [0]

"The number of people with no light perception is unknown, but it is estimated to be less than 10 percent of totally blind individuals."

[0] https://chicagolighthouse.org/sandys-view/what-blind-people-...