pub struct CeltEncoder { /* private fields */ }Expand description
A CELT encoder at 48 kHz (mono or stereo).
Implementations§
Source§impl CeltEncoder
impl CeltEncoder
Sourcepub fn with_channels(channels: usize) -> Self
pub fn with_channels(channels: usize) -> Self
Sourcepub const fn set_complexity(&mut self, complexity: u8)
pub const fn set_complexity(&mut self, complexity: u8)
Sets the encode complexity 0-10 (clamped), gating the analysis stages.
Sourcepub fn encode_frame(&mut self, pcm: &[f32], nb_bytes: usize) -> Vec<u8> ⓘ
pub fn encode_frame(&mut self, pcm: &[f32], nb_bytes: usize) -> Vec<u8> ⓘ
Encodes one fullband frame of pcm (interleaved f32 in [-1, 1];
120, 240, 480 or 960 samples per channel at 48 kHz) into nb_bytes.
§Panics
Panics on invalid frame sizes or byte budgets outside 2..=1275.
Sourcepub fn encode_frame_bw(
&mut self,
pcm: &[f32],
nb_bytes: usize,
end: usize,
) -> Vec<u8> ⓘ
pub fn encode_frame_bw( &mut self, pcm: &[f32], nb_bytes: usize, end: usize, ) -> Vec<u8> ⓘ
Encodes one frame coding bands 0..end (end selects the CELT
bandwidth: 13 = narrowband, 17 = wideband, 19 = super-wideband,
21 = fullband). The bands above end are left for the decoder to
fill with folded noise.
§Panics
Panics on invalid frame sizes, byte budgets outside 2..=1275, or
end outside 1..=21.
Sourcepub const fn final_range(&self) -> u32
pub const fn final_range(&self) -> u32
The range state after the last encoded frame; a conformant decoder finishes the frame with this exact value.
Sourcepub const fn set_target_bitrate(&mut self, bitrate: Option<u32>)
pub const fn set_target_bitrate(&mut self, bitrate: Option<u32>)
Sets the VBR target bitrate in bits/s (None restores CBR, which
fills the nb_bytes budget exactly). In VBR the nb_bytes passed to
encode_frame* is an upper bound; each frame is shrunk to its own
target.
Sourcepub const fn last_transient(&self) -> bool
pub const fn last_transient(&self) -> bool
Whether the last frame was detected as a transient and coded with short blocks.
Sourcepub const fn last_pitch(&self) -> (usize, f32)
pub const fn last_pitch(&self) -> (usize, f32)
The pitch period (samples) and gain the pre-filter analysis chose for the last frame. Currently informational - the comb filter and its post-filter bitstream coding are not yet applied.