Skip to main content

SvcConfig

Struct SvcConfig 

Source
pub struct SvcConfig {
    pub num_temporal_layers: u8,
    pub num_spatial_layers: u8,
    pub temporal_layers: Vec<TemporalLayerConfig>,
    pub spatial_layers: Vec<SpatialLayerConfig>,
    pub operating_points: Vec<OperatingPoint>,
    pub inter_layer_prediction: bool,
}
Expand description

SVC (Scalable Video Coding) configuration for AV1.

AV1 supports temporal scalability through operating points defined in the sequence header. Each operating point specifies which temporal and spatial layers are included, enabling adaptive streaming where decoders can drop higher layers for lower latency or bandwidth.

§Temporal Layer Structure

T0: I----P---------P---------P    (base layer, always decodable)
T1:      |    P         P         (enhancement, depends on T0)
T2:      |  P   P     P   P      (highest, depends on T0+T1)

§Example

use oximedia_codec::av1::sequence::{SvcConfig, TemporalLayerConfig};

let mut svc = SvcConfig::new(3, 1); // 3 temporal, 1 spatial
svc.set_temporal_layer(0, TemporalLayerConfig {
    layer_id: 0,
    framerate_fraction: 0.25,
    bitrate_fraction: 0.5,
    qp_offset: 0,
    reference_mode: SvcReferenceMode::KeyOnly,
});

Fields§

§num_temporal_layers: u8

Number of temporal layers (1-8).

§num_spatial_layers: u8

Number of spatial layers (1-4).

§temporal_layers: Vec<TemporalLayerConfig>

Per-layer temporal configuration.

§spatial_layers: Vec<SpatialLayerConfig>

Per-layer spatial configuration.

§operating_points: Vec<OperatingPoint>

Operating points derived from layer configuration.

§inter_layer_prediction: bool

Enable inter-layer prediction.

Implementations§

Source§

impl SvcConfig

Source

pub fn new(temporal_layers: u8, spatial_layers: u8) -> Self

Create a new SVC configuration.

§Arguments
  • temporal_layers - Number of temporal layers (clamped to 1-8)
  • spatial_layers - Number of spatial layers (clamped to 1-4)
Source

pub fn set_temporal_layer(&mut self, layer_id: u8, config: TemporalLayerConfig)

Set configuration for a specific temporal layer.

§Arguments
  • layer_id - Temporal layer index (0-based)
  • config - Layer configuration
Source

pub fn set_spatial_layer(&mut self, layer_id: u8, config: SpatialLayerConfig)

Set configuration for a specific spatial layer.

Source

pub fn get_operating_point( &self, temporal_id: u8, spatial_id: u8, ) -> Option<&OperatingPoint>

Get operating point for given temporal and spatial IDs.

Source

pub fn num_operating_points(&self) -> usize

Get total number of operating points.

Source

pub fn frame_temporal_layer(&self, frame_index: u64) -> u8

Determine which temporal layer a frame belongs to based on its index.

Uses a dyadic temporal structure:

  • Layer 0 (base): frames 0, 4, 8, … (for 3 layers)
  • Layer 1: frames 2, 6, 10, …
  • Layer 2: frames 1, 3, 5, 7, …
Source

pub fn frame_qp_offset(&self, frame_index: u64) -> i8

Get QP offset for a frame based on its temporal layer.

Source

pub fn is_droppable(&self, frame_index: u64) -> bool

Check if a frame at given index can be dropped without affecting lower temporal layers.

Source

pub fn frame_reference_mode(&self, frame_index: u64) -> SvcReferenceMode

Get the reference mode for a frame based on its temporal layer.

Source

pub fn validate(&self) -> CodecResult<()>

Validate the SVC configuration.

§Errors

Returns error if the configuration is inconsistent.

Trait Implementations§

Source§

impl Clone for SvcConfig

Source§

fn clone(&self) -> SvcConfig

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 SvcConfig

Source§

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

Formats the value using the given formatter. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.