mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-01 19:42:03 +00:00
fix(render): require HDR transfer metadata (#2377)
This commit is contained in:
@@ -19,10 +19,10 @@ describe("isHdrColorSpace", () => {
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("detects bt2020 primaries", () => {
|
||||
it("does not treat SDR transfer in a BT.2020 gamut as HDR", () => {
|
||||
expect(
|
||||
isHdrColorSpace({ colorTransfer: "bt709", colorPrimaries: "bt2020", colorSpace: "bt709" }),
|
||||
).toBe(true);
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("detects smpte2084 (PQ)", () => {
|
||||
|
||||
@@ -15,12 +15,10 @@ export type HdrTransfer = "hlg" | "pq";
|
||||
*/
|
||||
export function isHdrColorSpace(cs: VideoColorSpace | null): boolean {
|
||||
if (!cs) return false;
|
||||
return (
|
||||
cs.colorPrimaries.includes("bt2020") ||
|
||||
cs.colorSpace.includes("bt2020") ||
|
||||
cs.colorTransfer === "smpte2084" ||
|
||||
cs.colorTransfer === "arib-std-b67"
|
||||
);
|
||||
// BT.2020 describes a color gamut/matrix, not a dynamic range. SDR media
|
||||
// can legitimately carry BT.2020 primaries with a BT.709 transfer. Only
|
||||
// the transfer function distinguishes HDR here: PQ (SMPTE 2084) or HLG.
|
||||
return cs.colorTransfer === "smpte2084" || cs.colorTransfer === "arib-std-b67";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user