Skip to main content

OutputPlan

Struct OutputPlan 

Source
pub struct OutputPlan { /* private fields */ }
Expand description

Atomic encoder preparation plan combining ImagePlan with OutputSignaling.

Implementations§

Source§

impl OutputPlan

Source

pub fn build( src: impl AsRef<PixelFormat>, dst: impl AsRef<PixelFormat>, policy: &ConvertPolicy, peak: PeakSource, signaling: OutputSignaling, ) -> Result<Self, At<ConvertError>>

Build an encode-ready output plan.

Accepts either borrowed &PixelFormat or owned PixelFormat at the call site and borrows &ConvertPolicy (retaining internal clones inside the built plan).

Validates pixel conversion feasibility AND container signaling compatibility upfront (for non-origin-dependent signaling modes) so invalid output configurations fail before processing any pixels. Note that signaling rules inspect the destination spec (dst) — for example, OutputSignaling::CicpOnly and OutputSignaling::Auto refuse Transfer::Hlg(HlgMode::Display(_)) when dst targets display-referred HLG (converting from display HLG to sRGB or PQ succeeds because the output signaling is sRGB or PQ).

Source

pub fn build_with_pulse( src: impl AsRef<PixelFormat>, dst: impl AsRef<PixelFormat>, policy: &ConvertPolicy, peak: PeakSource, signaling: OutputSignaling, pulse: Option<&dyn Pulse>, ) -> Result<Self, At<ConvertError>>

Build an encode-ready output plan with optional cooperative cancellation and progress via pulse (forwarded to any configured CmsBackend or ToneMapper; pass None when not needed).

Source

pub const fn is_identity(&self) -> bool

Whether pixel bytes require no conversion under the plan’s policy (src == dst, excluding unverified AlphaMode::Opaque buffers that need alpha canonicalization).

Note: even when is_identity() is false due to an unverified Opaque alpha slot, execute_view and execute_buf still take the zero-copy path when the runtime input carries facts().all_opaque == true.

Source

pub fn execute_view<'a>( &self, view: PixelView<'a>, origin: &ColorOrigin, ) -> Result<EncodeReady<'a>, At<ConvertError>>

Execute on a borrowed PixelView<'a>, returning zero-copy PixelCow::Borrowed on identity.

Source

pub fn execute_view_with_pulse<'a>( &self, view: PixelView<'a>, origin: &ColorOrigin, pulse: Option<&dyn Pulse>, ) -> Result<EncodeReady<'a>, At<ConvertError>>

Execute on a borrowed PixelView<'a> with optional cooperative cancellation and progress via pulse (pass None when not needed).

Source

pub fn execute_buf( &self, buf: PixelBuf, ) -> Result<EncodeReady<'static>, At<ConvertError>>

Execute on an owned PixelBuf, moving buf zero-copy on identity!

Source

pub fn execute_buf_with_pulse( &self, buf: PixelBuf, pulse: Option<&dyn Pulse>, ) -> Result<EncodeReady<'static>, At<ConvertError>>

Execute on an owned PixelBuf with optional cooperative cancellation and progress via pulse (pass None when not needed).

Source

pub fn source_format(&self) -> &PixelFormat

Source spec.

Source

pub fn destination_format(&self) -> &PixelFormat

Destination spec.

Source

pub fn resolve_signaling( &self, origin: &ColorOrigin, ) -> Result<ResolvedSignaling, At<ConvertError>>

Resolve and validate container color signaling (cicp and icc) upfront before streaming rows into an encoder (avoids materializing a full EncodeReady buffer).

Source

pub fn build_row_plan( &self, resolved_source_peak: Option<Nits>, ) -> Result<RowPlan, At<ConvertError>>

Build a streaming RowPlan matching this output plan so row encoders can emit validated headers via resolve_signaling and convert scanlines without full-frame allocation.

Source

pub fn build_row_plan_with_pulse( &self, resolved_source_peak: Option<Nits>, pulse: Option<&dyn Pulse>, ) -> Result<RowPlan, At<ConvertError>>

Build a streaming RowPlan matching this output plan with optional cooperative cancellation and progress via pulse (pass None when not needed).

Source

pub fn adapt_for_encode<'a>( src: PixelView<'a>, origin: &ColorOrigin, supported: &[PixelFormat], policy: &ConvertPolicy, peak: PeakSource, signaling: OutputSignaling, ) -> Result<(NegotiatedFormat, EncodeReady<'a>), At<ConvertError>>

One-shot encoder preparation: negotiate the lowest-loss, lowest-effort format from supported under policy, convert (or borrow zero-copy on identity), and resolve guaranteed-matching container color signaling (cicp, icc, hdr).

Thin wrapper combining Negotiate::select, OutputPlan::build, and OutputPlan::execute_view, automatically merging src.attached_claims() into policy.source_claims before negotiation. Returns ConvertError::UnsupportedRoute if no candidate in supported satisfies policy.

Source

pub fn adapt_for_encode_with_pulse<'a>( src: PixelView<'a>, origin: &ColorOrigin, supported: &[PixelFormat], policy: &ConvertPolicy, peak: PeakSource, signaling: OutputSignaling, pulse: Option<&dyn Pulse>, ) -> Result<(NegotiatedFormat, EncodeReady<'a>), At<ConvertError>>

One-shot encoder preparation with optional cooperative cancellation and progress via pulse (pass None when not needed).

Trait Implementations§

Source§

impl Clone for OutputPlan

Source§

fn clone(&self) -> OutputPlan

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OutputPlan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.