Skip to main content

JpegTranscodeConfig

Struct JpegTranscodeConfig 

Source
pub struct JpegTranscodeConfig {
    pub jpeg_reconstruction: bool,
    pub num_threads: usize,
    pub brotli_compression: Option<Box<dyn BrotliCompression>>,
    pub speed: Speed,
}
Expand description

Fields§

§jpeg_reconstruction: bool

Whether to embed the data needed to rebuild the original JPEG bytes.

Defaults to true. See Self::with_jpeg_reconstruction.

§num_threads: usize

Worker threads used while building the codestream. Defaults to 1.

See Self::with_num_threads.

§brotli_compression: Option<Box<dyn BrotliCompression>>

Optional Brotli implementation for JPEG reconstruction data and the Exif and XMP boxes.

When absent, Jixel uses its own small Brotli encoder, so no Brotli dependency is needed; a stronger one can be supplied here.

§speed: Speed

Entropy-coding effort. The coefficients, and so the decoded pixels and the reconstructed JPEG, are the same at every speed. Defaults to Speed::Fast.

Speed::Slow and Speed::ExtraSlow also try a learned DC context tree, retaining it only when the complete codestream is smaller.

Implementations§

Source§

impl JpegTranscodeConfig

Source

pub fn with_jpeg_reconstruction(self, enabled: bool) -> Self

Controls whether the original JPEG bytes can be recovered.

Source

pub fn with_num_threads(self, threads: usize) -> Self

Sets the number of worker threads, which does not affect the output.

Source

pub fn with_speed(self, speed: Speed) -> Self

Sets the entropy-coding effort; see Self::speed.

Source

pub fn with_brotli_compression( self, compressor: Box<dyn BrotliCompression>, ) -> Self

Uses a caller-provided Brotli encoder for JPEG reconstruction data and metadata boxes.

Trait Implementations§

Source§

impl Debug for JpegTranscodeConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for JpegTranscodeConfig

Source§

fn default() -> Self

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.