Struct Components

Source
pub(crate) struct Components {
Show 23 fields pub component_id: ComponentID, pub vertical_sample: usize, pub horizontal_sample: usize, pub dc_huff_table: usize, pub ac_huff_table: usize, pub quantization_table_number: u8, pub quantization_table: [i32; 64], pub dc_pred: i32, pub up_sampler: fn(input: &[i16], in_near: &[i16], in_far: &[i16], scratch_space: &mut [i16], output: &mut [i16]), pub width_stride: usize, pub id: u8, pub needed: bool, pub raw_coeff: Vec<i16>, pub upsample_dest: Vec<i16>, pub row_up: Vec<i16>, pub row: Vec<i16>, pub first_row_upsample_dest: Vec<i16>, pub idct_pos: usize, pub x: usize, pub w2: usize, pub y: usize, pub sample_ratio: SampleRatios, pub fix_an_annoying_bug: usize,
}
Expand description

Component Data from start of frame

Fields§

§component_id: ComponentID

The type of component that has the metadata below, can be Y,Cb or Cr

§vertical_sample: usize

Sub-sampling ratio of this component in the x-plane

§horizontal_sample: usize

Sub-sampling ratio of this component in the y-plane

§dc_huff_table: usize

DC huffman table position

§ac_huff_table: usize

AC huffman table position for this element.

§quantization_table_number: u8

Quantization table number

§quantization_table: [i32; 64]

Specifies quantization table to use with this component

§dc_pred: i32

dc prediction for the component

§up_sampler: fn(input: &[i16], in_near: &[i16], in_far: &[i16], scratch_space: &mut [i16], output: &mut [i16])

An up-sampling function, can be basic or SSE, depending on the platform

§width_stride: usize

How pixels do we need to go to get to the next line?

§id: u8

Component ID for progressive

§needed: bool

Whether we need to decode this image component.

§raw_coeff: Vec<i16>

Upsample scanline

§upsample_dest: Vec<i16>

Upsample destination, stores a scanline worth of sub sampled data

§row_up: Vec<i16>

previous row, used to handle MCU boundaries

§row: Vec<i16>

current row, used to handle MCU boundaries again

§first_row_upsample_dest: Vec<i16>§idct_pos: usize§x: usize§w2: usize§y: usize§sample_ratio: SampleRatios§fix_an_annoying_bug: usize

Implementations§

Source§

impl Components

Source

pub fn from(a: [u8; 3], pos: u8) -> Result<Components, DecodeErrors>

Create a new instance from three bytes from the start of frame

Source

pub fn setup_upsample_scanline(&mut self)

Setup space for upsampling

During upsample, we need a reference of the last row so that upsampling can proceed correctly, so we store the last line of every scanline and use it for the next upsampling procedure to store this, but since we don’t need it for 1v1 upsampling, we only call this for routines that need upsampling

§Requirements
  • width stride of this element is set for the component.

Trait Implementations§

Source§

impl Clone for Components

Source§

fn clone(&self) -> Components

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. 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.