MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / analyzeCompositionHdr

Function analyzeCompositionHdr

packages/engine/src/utils/hdr.ts:120–137  ·  view source on GitHub ↗
(
  colorSpaces: Array<VideoColorSpace | null>,
)

Source from the content-addressed store, hash-verified

118 * contains HDR content and what the dominant transfer function is.
119 */
120export function analyzeCompositionHdr(
121 colorSpaces: Array<VideoColorSpace | null>,
122): CompositionHdrInfo {
123 let hasPq = false;
124 let hasHdr = false;
125
126 for (const cs of colorSpaces) {
127 if (!isHdrColorSpace(cs)) continue;
128 hasHdr = true;
129 if (cs?.colorTransfer === "smpte2084") hasPq = true;
130 }
131
132 if (!hasHdr) return { hasHdr: false, dominantTransfer: null };
133
134 // PQ takes priority — it's the more common HDR10 format
135 const dominantTransfer: HdrTransfer = hasPq ? "pq" : "hlg";
136 return { hasHdr: true, dominantTransfer };
137}

Callers 3

resolveEffectiveHdrModeFunction · 0.90
hdr.test.tsFile · 0.85
extractAllVideoFramesFunction · 0.85

Calls 1

isHdrColorSpaceFunction · 0.85

Tested by

no test coverage detected