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: u8Number of temporal layers (1-8).
num_spatial_layers: u8Number 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: boolEnable inter-layer prediction.
Implementations§
Source§impl SvcConfig
impl SvcConfig
Sourcepub fn new(temporal_layers: u8, spatial_layers: u8) -> Self
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)
Sourcepub fn set_temporal_layer(&mut self, layer_id: u8, config: TemporalLayerConfig)
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
Sourcepub fn set_spatial_layer(&mut self, layer_id: u8, config: SpatialLayerConfig)
pub fn set_spatial_layer(&mut self, layer_id: u8, config: SpatialLayerConfig)
Set configuration for a specific spatial layer.
Sourcepub fn get_operating_point(
&self,
temporal_id: u8,
spatial_id: u8,
) -> Option<&OperatingPoint>
pub fn get_operating_point( &self, temporal_id: u8, spatial_id: u8, ) -> Option<&OperatingPoint>
Get operating point for given temporal and spatial IDs.
Sourcepub fn num_operating_points(&self) -> usize
pub fn num_operating_points(&self) -> usize
Get total number of operating points.
Sourcepub fn frame_temporal_layer(&self, frame_index: u64) -> u8
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, …
Sourcepub fn frame_qp_offset(&self, frame_index: u64) -> i8
pub fn frame_qp_offset(&self, frame_index: u64) -> i8
Get QP offset for a frame based on its temporal layer.
Sourcepub fn is_droppable(&self, frame_index: u64) -> bool
pub fn is_droppable(&self, frame_index: u64) -> bool
Check if a frame at given index can be dropped without affecting lower temporal layers.
Sourcepub fn frame_reference_mode(&self, frame_index: u64) -> SvcReferenceMode
pub fn frame_reference_mode(&self, frame_index: u64) -> SvcReferenceMode
Get the reference mode for a frame based on its temporal layer.
Sourcepub fn validate(&self) -> CodecResult<()>
pub fn validate(&self) -> CodecResult<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SvcConfig
impl RefUnwindSafe for SvcConfig
impl Send for SvcConfig
impl Sync for SvcConfig
impl Unpin for SvcConfig
impl UnsafeUnpin for SvcConfig
impl UnwindSafe for SvcConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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