w3c / ColorWeb-CG

repo for the Color on the Web Community Group
51 stars 21 forks source link

Add interface to query the display color volume and linear display light encoding #106

Closed palemieux closed 11 months ago

palemieux commented 1 year ago

Closes #110 Closes #109 Closes #103 Closes #102 Closes #100 Closes #99 Closes #92 Closes #50 Closes #42 Closes #39 Closes #36

palemieux commented 1 year ago

Per 2023-09-06 meeting: add support for enumerated values of the color volume,

palemieux commented 11 months ago

From Lars:

Typos?
CURRENT:

function simpleTransform(value, systemGamma) {

  if (value < 1.0) {

    return -1.0 * Math.pow(-1.0 * value, systemGamma);

  } else {

    return Math.pow(value, systemGamma);

  }

}

function simpleInverseTransform(value, systemGamma) {

  if (value < 1.0) {

    return -1.0 * Math.pow(-1.0 * value, 1.0 / systemGamma);

  } else {

    return Math.pow(value, 1.0 / systemGamma);

  }

}

I believe the if statements should be if (value < 0.0)
palemieux commented 11 months ago

From Lars:

I belive pq to srgb needs a similar code snippet to map to sRGB gamut:

const r3 = simpleInverseTransform(r2, systemGamma);

  const g3 = simpleInverseTransform(g2, systemGamma);

  const b3 = simpleInverseTransform(b2, systemGamma);

  const [r4, g4, b4] = limitTosRGBGamut(r3, g3, b3);
palemieux commented 11 months ago

From Lars:

Why is PQ to srgb using gamma 2.4 while HLG uses 2.2? 2.2 is usually the better fit for sRGB. But maybe you want 709 brightness levels?