Re: [csswg-drafts] [css-color-hdr] In what colorspace is `eps` = 0.001 one just noticeable difference? (#11788)

Sorry, I had thought that I'd written this down, but I hadn't.

I also see that I wrote "let eps=0.001 (one linear just noticeable difference)" in the spec. And I don't know why I wrote that. Epsilon is unrelated to JND, sorry.

**Background:**

The epsilon parameter in `color-hdr` is to match a parameter in ST 2094-50 (in development, trying to get it out to the public ASAP, it overlaps a lot with [this ICC proposal](https://www.color.org/specification/ICC.1_Adaptive_Gain_Curve.pdf)), which in turn is to match a parameter in ISO 21496-1 gain maps.

The idea with gain maps is that the gain map stores the value as:
`G=log(HDR/SDR)`
and then reconstructs HDR from SDR as
`HDR=SDR*exp2(G)`

If you're starting with an HDR and SDR representation and computing `G`, this can start getting poorly conditioned, so we let there be the `eps` parameter so one can store
`G=log( (HDR+eps) / (SDR+eps) )`
to avoid divide-by-zero issues. And so then you have the reconstruction is
`HDR=(SDR+eps)*exp2(G)-eps`

The most extreme end of this is a place where the HDR color is non-zero, but the SDR color was zero.

**In this specification:**

This parameter will only matter when a component needs to go from zero to non-zero.

This is an example of going from 1 to 2, and epsilon makes no difference.

<img width="441" height="517" alt="Image" src="https://github.com/user-attachments/assets/b52fe85d-b9be-4819-8dc4-2575a929e379" />

This however is going from 0 to 1, and it makes a huge difference.

<img width="452" height="517" alt="Image" src="https://github.com/user-attachments/assets/f5ba9241-6f2b-465d-9947-3f36d2e26c46" />

How often do we go from 0 to 1? Effectively never. But zero-or-near to non-zero of an individual component can indeed happen. I think a default of 0.001 is fine for those. A more impactful factor is the gain application color space. The spec currently says XYZ, but most images and videos will use sRGB, P3, or Rec2020, so we may want to look into that.

-- 
GitHub Notification of comment by ccameron-chromium
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11788#issuecomment-3090319983 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 18 July 2025 18:30:36 UTC