Skip to main content

FrameHeader

Struct FrameHeader 

Source
pub struct FrameHeader {
Show 30 fields pub frame_type: FrameType, pub encoding: Encoding, pub xyb_encoded: bool, pub flags: u64, pub do_ycbcr: bool, pub jpeg_upsampling: [u8; 3], pub upsampling: u32, pub ec_upsampling: Vec<u32>, pub group_size_shift: u32, pub x_qm_scale: u32, pub b_qm_scale: u32, pub num_passes: u32, pub x0: i32, pub y0: i32, pub width: u32, pub height: u32, pub blend_mode: BlendMode, pub ec_blend_modes: Vec<BlendMode>, pub blend_source: u32, pub alpha_blend_channel: u32, pub save_as_reference: u32, pub save_before_ct: bool, pub name: String, pub have_animation: bool, pub have_timecodes: bool, pub duration: u32, pub timecode: u32, pub is_last: bool, pub gaborish: bool, pub epf_iters: u32,
}
Expand description

Frame header structure.

Used by both VarDCT and Modular encoding paths. Fields are parameterized to cover both modes. Use lossy() or lossless() constructors for defaults.

Fields§

§frame_type: FrameType

Frame type.

§encoding: Encoding

Encoding method.

§xyb_encoded: bool

Whether the image metadata has xyb_encoded=true. Controls whether do_ycbcr is written (only when false).

§flags: u64

Frame flags (e.g., SKIP_ADAPTIVE_LF_SMOOTHING=0x80, ENABLE_NOISE=0x01).

§do_ycbcr: bool

Whether the frame uses YCbCr color transform (only written when !xyb_encoded).

§jpeg_upsampling: [u8; 3]

JPEG upsampling mode for chroma (only for VarDCT + YCbCr).

§upsampling: u32

Upsampling factor (1, 2, 4, or 8).

§ec_upsampling: Vec<u32>

Extra channel upsampling factors.

§group_size_shift: u32

Group size shift (Modular only: 0=128, 1=256, 2=512, 3=1024).

§x_qm_scale: u32

X channel quant matrix scale (VarDCT only, 3 bits, range 0-7).

§b_qm_scale: u32

B channel quant matrix scale (VarDCT only, 3 bits, range 0-7).

§num_passes: u32

Number of passes (1-10).

§x0: i32

X offset for cropped frames.

§y0: i32

Y offset for cropped frames.

§width: u32

Frame width (0 = full image width).

§height: u32

Frame height (0 = full image height).

§blend_mode: BlendMode

Blending information for the main frame.

§ec_blend_modes: Vec<BlendMode>

Per-extra-channel blending modes.

§blend_source: u32

Source reference frame for blending (0-3).

§alpha_blend_channel: u32

Alpha channel to use for blending.

§save_as_reference: u32

Whether frame is saved for reference.

§save_before_ct: bool

Whether to save before color transform.

§name: String

Frame name.

§have_animation: bool

Whether the file header signals animation (have_animation=true). When true, duration/timecode fields are written for normal frames.

§have_timecodes: bool

Whether the file header signals have_timecodes.

§duration: u32

Duration in ticks (for animation).

§timecode: u32

Timecode (if have_timecodes).

§is_last: bool

Whether this is the last frame.

§gaborish: bool

Enable gaborish (Gabor-like blur in decoder loop filter).

§epf_iters: u32

Number of EPF (Edge-Preserving Filter) iterations (0-3).

Implementations§

Source§

impl FrameHeader

Source

pub fn lossy() -> Self

Creates a frame header for a lossy VarDCT frame with default parameters.

Defaults: xyb_encoded=true, flags=SKIP_ADAPTIVE_LF_SMOOTHING (0x80), gaborish=true, epf_iters=2.

Source

pub fn lossless() -> Self

Creates a frame header for a lossless Modular frame.

Defaults: xyb_encoded=false, do_ycbcr=false, flags=0, group_size_shift=1 (256), gaborish=false, epf_iters=0.

Source

pub fn write(&self, writer: &mut BitWriter) -> Result<()>

Writes the frame header to the bitstream.

Follows the JXL codestream specification (ISO 18181-1) Table A.2.

Trait Implementations§

Source§

impl Clone for FrameHeader

Source§

fn clone(&self) -> FrameHeader

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
Source§

impl Debug for FrameHeader

Source§

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

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

impl Default for FrameHeader

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> 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.