pub struct CeltDecoder { /* private fields */ }Implementations§
Source§impl CeltDecoder
impl CeltDecoder
pub fn new(mode: &'static CeltMode, channels: usize) -> Self
Sourcepub fn seed_from(&mut self, src: &CeltDecoder)
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.
Sourcepub fn set_stream_channels(&mut self, sc: usize)
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).
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
libopus OPUS_RESET_STATE for the decoder: clear everything from rng onward, then oldLogE/oldLogE2 = -28 (oldBandE stays 0).
pub fn decode( &mut self, compressed: &[u8], frame_size: usize, pcm: &mut [f32], ) -> usize
pub fn decode_with_start_band( &mut self, compressed: &[u8], frame_size: usize, pcm: &mut [f32], start_band: usize, ) -> usize
pub fn decode_from_range_coder( &mut self, rc: &mut RangeCoder, total_bits: i32, frame_size: usize, pcm: &mut [f32], start_band: usize, ) -> usize
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
Sourcepub fn conceal_lost(&mut self, frame_size: usize, pcm: &mut [f32])
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.