#[non_exhaustive]pub enum HdrPolicy {
Refuse,
CodeValues,
}Expand description
What happens to a frame whose ndi_color_info gives the PQ or HLG
transfer function. Frames with BT.2020 primaries or either HDR transfer
need a color tag, which the encoder can write only in PNG.
| The frame’s primaries | The frame’s transfer | HdrPolicy::Refuse | HdrPolicy::CodeValues |
|---|---|---|---|
| Unspecified, BT.601 or BT.709 | Unspecified or SDR | Every format, untagged | Every format, untagged |
| BT.2020 | Unspecified or SDR | PNG, tagged | PNG, tagged |
| Any | PQ or HLG | Error::InvalidFrame | PNG of the code values, tagged |
When PNG is required, JPEG and WebP return Error::InvalidInput
with InputDefect::ColorTagNeedsPng.
The check applies to every pixel format, RGB as well as YUV. The encoder
does not tone-map. A program that wants an SDR rendering of HDR video
makes it itself, from a 16-bit PNG or from the frame, and
color_info lets it check a frame before
encoding it.
This enum is marked #[non_exhaustive] so that policies can be added
without a breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Refuse
Refuse a PQ or HLG frame with
Error::InvalidFrame.
CodeValues
Write a PQ or HLG frame’s non-linear code values to a PNG, tagged with
a cICP chunk that tells an HDR-aware viewer their primaries and
transfer function. Use SampleDepth::Sixteen to keep a
high-bit-depth frame’s precision.
RGB-received frames already contain the SDK’s BT.709 limited-range
conversion, whatever ndi_color_info says; 16-bit output cannot recover
their original HDR code values. Receive YUV with
ReceiverColorFormat::Best to keep
them. The tag still decides HDR refusal and the PNG cICP chunk.
JPEG and WebP refuse such a frame with Error::InvalidInput.