Skip to main content

OutputMetadata

Struct OutputMetadata 

Source
#[non_exhaustive]
pub struct OutputMetadata { pub icc: Option<Arc<[u8]>>, pub cicp: Option<Cicp>, pub hdr: Option<HdrMetadata>, }
Expand description

Metadata that the encoder should embed alongside the pixel data.

Generated atomically by finalize_for_output to guarantee that the metadata matches the pixel values.

§Not the same as ColorContext / ColorOrigin

Three carriers touch color and overlap on icc / cicp, but each answers a different question and lives at a different point in the pipeline:

  • ColorOriginhow the source file described its color (provenance + which field is authoritative). Immutable, set once at decode, consulted for re-encode decisions.
  • ColorContextwhat the working pixels are right now (the profile needed to interpret their values: icc / cicp / diffuse_white). Rides on the PixelSlice via Arc and is rewritten as conversions change the pixels. It deliberately carries no content light level / mastering display — those don’t change how a value is interpreted, only how a display should present it.
  • OutputMetadata (this type) — the color blocks the encoder writes into the container (icc / cicp). It is the lowering target of a codec’s color plan (zencodec::ColorEmitPlan is itself just { cicp, icc }) and mirrors that shape. Its reason to exist as a distinct type is the EncodeReady atomicity guarantee: the converted bytes and the embedded color are produced together and cannot drift apart — which a re-used ColorContext would not give. HDR content descriptors (content light level, mastering display, diffuse_white) are deliberately not here: they are not color-profile data and ride the codec-boundary metadata carrier (zencodec::Metadata, which already holds all three) instead.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§icc: Option<Arc<[u8]>>

ICC profile bytes to embed, if any.

§cicp: Option<Cicp>

CICP code points to embed, if any.

§hdr: Option<HdrMetadata>
👎Deprecated since 0.2.14:

unwired bundled HDR carrier; replaced by sibling content_light_level / mastering_display fields when the encoder path that populates them lands (0.3.0).

HDR metadata to embed (content light level, mastering display), if any.

Deprecated and never wiredfinalize_for_output always sets it to None. The bundled HdrMetadata carrier is being removed at 0.3.0 (it has frozen public fields and bundles transfer, which the prior art keeps on the descriptor).

What replaces it: nothing — and that is correct by design, not a stub. Removing this leaves OutputMetadata { icc, cicp }, which mirrors the color plan a codec lowers here (zencodec::ColorEmitPlan is itself just { cicp, icc }). The HDR content descriptors — content light level, mastering display, and the diffuse_white / intensity_target anchor — are not color-profile data: they ride the codec-boundary metadata carrier instead. zencodec::Metadata already carries all three as sibling fields (the un-bundled shape this HdrMetadata bundle should have been), threaded by its metadata policy, and the codec embeds them from there. Nothing ever read them off this field — HdrMetadata had zero consumers across ~/work, and zencodec routed around it from the start. See CHANGELOG.md “QUEUED BREAKING CHANGES”.

Trait Implementations§

Source§

impl Clone for OutputMetadata

Source§

fn clone(&self) -> OutputMetadata

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 OutputMetadata

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.