Skip to main content

CeltDecoder

Struct CeltDecoder 

Source
pub struct CeltDecoder { /* private fields */ }

Implementations§

Source§

impl CeltDecoder

Source

pub fn new(mode: &'static CeltMode, channels: usize) -> Self

Source

pub fn seed_from(&mut self, src: &CeltDecoder)

Seed this decoder’s inter-frame state from another decoder (typically the auxiliary mono decoder), replicating its channel 0 into every channel of self. Used at a mono->stereo switch so the primary stereo CeltDecoder’s overlap/energy/prefilter state is continuous with the preceding mono packets (which libopus keeps in one continuous decoder) — without this the first stereo frame’s MDCT overlap-add starts from silence.

Source

pub fn set_stream_channels(&mut self, sc: usize)

Channels coded in the next packet’s bitstream (1 for a mono packet decoded by a stereo decoder — keeps 2-channel state continuous across switches).

Source

pub fn reset(&mut self)

libopus OPUS_RESET_STATE for the decoder: clear everything from rng onward, then oldLogE/oldLogE2 = -28 (oldBandE stays 0).

Source

pub fn decode( &mut self, compressed: &[u8], frame_size: usize, pcm: &mut [f32], ) -> usize

Source

pub fn decode_with_start_band( &mut self, compressed: &[u8], frame_size: usize, pcm: &mut [f32], start_band: usize, ) -> usize

Source

pub fn decode_from_range_coder( &mut self, rc: &mut RangeCoder, total_bits: i32, frame_size: usize, pcm: &mut [f32], start_band: usize, ) -> usize

Source

pub fn decode_from_range_coder_with_band_range( &mut self, rc: &mut RangeCoder, total_bits: i32, frame_size: usize, pcm: &mut [f32], start_band: usize, end_band: usize, ) -> usize

Source

pub fn conceal_lost(&mut self, frame_size: usize, pcm: &mut [f32])

Packet-loss concealment for a lost CELT frame — a port of libopus celt_decode_lost (celt_decoder.c). For the first few losses of a burst it uses the pitch-based branch (LPC-whitened excitation extrapolated at the last pitch period, resynthesized through the LPC filter — good for tonal/music content); once the burst runs long (loss_count >= 5) it falls back to the noise-based branch (spectrally-shaped, energy-decayed random excitation). Both fill the decode buffer, then this deemphasises to pcm (interleaved, /32768). Real attenuating audio instead of silence.

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