@hyperframes/engine 0.8.174 → 0.8.176

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,17 +46,9 @@ export declare function decodePngToRgb48le(buf: Buffer): {
46
46
  * ## Convention
47
47
  *
48
48
  * "Linear" here means **scene light in [0, 1] relative to SDR reference white**
49
- * (not absolute nits). The HLG branch applies the OETF directly — no OOTF (no
50
- * gamma 1.2 scene→display conversion). This is the right choice for DOM
51
- * overlays that will be composited ON TOP of HLG video pixels (which are
52
- * already in HLG signal space); we need the overlay to sit in the same space
53
- * as what it’s blending onto. Applying the OOTF here would double-apply it
54
- * when the HDR video already carries scene-light semantics.
55
- *
56
- * For PQ, SDR white is placed at 203 nits per ITU-R BT.2408 ("SDR white"
57
- * reference level) and normalized against 10,000-nit peak. This lets SDR
58
- * content (text, UI) sit at the conventional SDR-white brightness within a
59
- * PQ frame rather than at peak brightness.
49
+ * (not absolute nits). Both branches put SDR white at BT.2408 reference white,
50
+ * below peak: HLG at 75% signal (the OETF takes peak-relative light, so it is
51
+ * scaled first; no OOTF), PQ at 203 nits of the 10,000-nit peak.
60
52
  *
61
53
  * Note: converts the transfer function but not the color primaries (bt709 →
62
54
  * bt2020). For neutral/near-neutral content (text, UI) the gamut difference
@@ -245,17 +245,9 @@ export function decodePngToRgb48le(buf) {
245
245
  * ## Convention
246
246
  *
247
247
  * "Linear" here means **scene light in [0, 1] relative to SDR reference white**
248
- * (not absolute nits). The HLG branch applies the OETF directly — no OOTF (no
249
- * gamma 1.2 scene→display conversion). This is the right choice for DOM
250
- * overlays that will be composited ON TOP of HLG video pixels (which are
251
- * already in HLG signal space); we need the overlay to sit in the same space
252
- * as what it’s blending onto. Applying the OOTF here would double-apply it
253
- * when the HDR video already carries scene-light semantics.
254
- *
255
- * For PQ, SDR white is placed at 203 nits per ITU-R BT.2408 ("SDR white"
256
- * reference level) and normalized against 10,000-nit peak. This lets SDR
257
- * content (text, UI) sit at the conventional SDR-white brightness within a
258
- * PQ frame rather than at peak brightness.
248
+ * (not absolute nits). Both branches put SDR white at BT.2408 reference white,
249
+ * below peak: HLG at 75% signal (the OETF takes peak-relative light, so it is
250
+ * scaled first; no OOTF), PQ at 203 nits of the 10,000-nit peak.
259
251
  *
260
252
  * Note: converts the transfer function but not the color primaries (bt709 →
261
253
  * bt2020). For neutral/near-neutral content (text, UI) the gamut difference
@@ -272,6 +264,7 @@ function buildSrgbToSignalLut(transfer) {
272
264
  const hlgA = 0.17883277;
273
265
  const hlgB = 1 - 4 * hlgA;
274
266
  const hlgC = 0.5 - hlgA * Math.log(4 * hlgA);
267
+ const hlgSdrWhite = (Math.exp((0.75 - hlgC) / hlgA) + hlgB) / 12;
275
268
  // PQ (SMPTE 2084) OETF constants
276
269
  const pqM1 = 0.1593017578125;
277
270
  const pqM2 = 78.84375;
@@ -288,8 +281,8 @@ function buildSrgbToSignalLut(transfer) {
288
281
  const linear = srgbByteToLinear(i);
289
282
  let signal;
290
283
  if (transfer === "hlg") {
291
- signal =
292
- linear <= 1 / 12 ? Math.sqrt(3 * linear) : hlgA * Math.log(12 * linear - hlgB) + hlgC;
284
+ const scene = linear * hlgSdrWhite;
285
+ signal = scene <= 1 / 12 ? Math.sqrt(3 * scene) : hlgA * Math.log(12 * scene - hlgB) + hlgC;
293
286
  }
294
287
  else {
295
288
  // PQ OETF: linear light (in SDR nits) → PQ signal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/engine",
3
- "version": "0.8.174",
3
+ "version": "0.8.176",
4
4
  "description": "Seekable web page to video rendering engine (Puppeteer + FFmpeg)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,8 +50,8 @@
50
50
  "linkedom": "^0.18.12",
51
51
  "puppeteer": "^25.8.0",
52
52
  "puppeteer-core": "^25.8.0",
53
- "@hyperframes/core": "^0.8.174",
54
- "@hyperframes/parsers": "^0.8.174"
53
+ "@hyperframes/parsers": "^0.8.176",
54
+ "@hyperframes/core": "^0.8.176"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/node": "^25.0.10",