Skip to main content

Encoder

Struct Encoder 

Source
pub struct Encoder<'d> { /* private fields */ }
Available on crate feature unstable only.
Expand description

A blocking baseline JPEG encoder.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Implementations§

Source§

impl<'d> Encoder<'d>

Source

pub fn new( peripheral: JPEG<'d>, tx: DMA2D_TX_CH0<'d>, rx: impl Into<AnyDma2dRxChannel<'d>>, ) -> Self

Creates a new JPEG encoder using DMA2D TX0 for macroblock reordering.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn set_timeout(&mut self, timeout: Option<Duration>)

Sets the software timeout for JPEG completion.

The timeout is disabled by default (None). DMA cleanup can extend past this limit.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn encode( &mut self, input: &[u8], output: &mut [u8], config: EncodeConfig, ) -> Result<usize, Error>

Encodes a tightly packed image and returns the JPEG length in bytes.

See supported formats for valid format combinations and PixelFormat for input layout requirements.

The input must be in SRAM or initialized PSRAM. RGB565, BGR565, and YCbCr 4:2:2 input must be aligned to two bytes.

The output address and length must be multiples of 64 bytes in cached SRAM, 4 bytes in uncached SRAM, or 128 bytes in PSRAM. PSRAM configurations that require strictly aligned memory transactions, such as encryption or ECC, are unsupported. Output contents are unspecified on error.

§Errors
§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Trait Implementations§

Source§

impl<'d> Debug for Encoder<'d>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'d> !UnwindSafe for Encoder<'d>

§

impl<'d> Forget for Encoder<'d>

§

impl<'d> Freeze for Encoder<'d>
where PhantomData<&'d mut ()>: Freeze,

§

impl<'d> Move for Encoder<'d>

§

impl<'d> RefUnwindSafe for Encoder<'d>

§

impl<'d> Send for Encoder<'d>

§

impl<'d> Sync for Encoder<'d>

§

impl<'d> Unpin for Encoder<'d>
where &'d mut (): Unpin,

§

impl<'d> UnsafeUnpin for Encoder<'d>
where PhantomData<&'d mut ()>: UnsafeUnpin,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = !

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.