Skip to main content

Encoder

Struct Encoder 

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

Ultra HDR encoder.

For production use without a bundled JPEG codec, use encode_ultrahdr directly.

The builder methods that require a JPEG codec (set_hdr_image, set_sdr_image, encode) are only available in tests where zenjpeg is a dev-dependency.

Implementations§

Source§

impl Encoder

Source

pub fn new() -> Self

Create a new encoder with default settings.

Source

pub fn set_compressed_sdr(&mut self, jpeg: Vec<u8>) -> &mut Self

Set a pre-compressed SDR JPEG.

Source

pub fn set_base_jpeg(&mut self, jpeg: Vec<u8>) -> &mut Self

Alias for set_compressed_sdr.

Source

pub fn set_existing_gainmap_jpeg( &mut self, jpeg: Vec<u8>, metadata: GainMapMetadata, ) -> &mut Self

Set an existing gain map as raw JPEG bytes and metadata.

Source

pub fn set_gainmap_jpeg( &mut self, jpeg: Vec<u8>, metadata: GainMapMetadata, ) -> &mut Self

Alias for set_existing_gainmap_jpeg.

Source

pub fn set_quality(&mut self, base: u8, gainmap: u8) -> &mut Self

Set JPEG quality for base and gain map images.

Source

pub fn set_gainmap_scale(&mut self, scale: u8) -> &mut Self

Set gain map downscale factor.

Source

pub fn set_target_display_peak(&mut self, nits: f32) -> &mut Self

Set target display peak brightness in nits.

Source

pub fn set_min_content_boost(&mut self, boost: f32) -> &mut Self

Set minimum content boost.

Source

pub fn encode_from_jpegs(&self) -> Result<Vec<u8>>

Encode to Ultra HDR JPEG from pre-set JPEGs (production API).

Trait Implementations§

Source§

impl Default for Encoder

Source§

fn default() -> Encoder

Returns the “default value” for a type. 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> 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, 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.