pub trait PixelBufferHdrConvertExt {
// Required methods
fn convert_to_sdr(
&self,
target: PixelDescriptor,
) -> Result<PixelBuffer, At<ConvertError>>;
fn convert_to_with_hdr_config(
&self,
target: PixelDescriptor,
hdr: HdrConfig,
) -> Result<PixelBuffer, At<ConvertError>>;
}Expand description
Adds HDR-aware conversion methods to PixelBuffer.
HDR→SDR conversions need a source-peak luminance to parameterize the
BT.2446-A tone-map curve. Plain
convert_to refuses such cases
with ConvertError::HdrSourceRequiresPeak.
These methods supply the peak — either explicitly
(convert_to_with_hdr_config) or
by measuring MaxCLL from the buffer itself
(convert_to_sdr).
Gated behind hdr-experimental.
Required Methods§
Sourcefn convert_to_sdr(
&self,
target: PixelDescriptor,
) -> Result<PixelBuffer, At<ConvertError>>
fn convert_to_sdr( &self, target: PixelDescriptor, ) -> Result<PixelBuffer, At<ConvertError>>
Convert this HDR buffer to target (typically an SDR descriptor —
sRGB / BT.709 / Gamma22), auto-measuring source peak via
CllMeasure::measure_max
(the production-default per the 2026-06-22 audited shootout —
wins 3 of 6 ranking criteria including the user-visible
pct_above_de5, see DEFAULT_PERCENTILE docs for the alternative
percentile path).
For non-HDR sources this falls back to
convert_to (so the call is
safe to use when the source’s HDR-ness isn’t known up front).
Allocates a new PixelBuffer.
Sourcefn convert_to_with_hdr_config(
&self,
target: PixelDescriptor,
hdr: HdrConfig,
) -> Result<PixelBuffer, At<ConvertError>>
fn convert_to_with_hdr_config( &self, target: PixelDescriptor, hdr: HdrConfig, ) -> Result<PixelBuffer, At<ConvertError>>
Convert this HDR buffer to target with explicit HDR knobs.
hdr.source_peak_nits is mandatory and parameterizes the BT.2446-A
curve. target_peak_nits defaults to 100.0 (SDR), gamut_knee
to 0.96 — start from
HdrConfig::for_source_peak.
For non-HDR sources the hdr argument is ignored and the call
behaves like convert_to.
Allocates a new PixelBuffer.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl PixelBufferHdrConvertExt for PixelBuffer
hdr-experimental only.