pub struct CeltDecoder {
pub config: CeltFrameConfig,
pub prev_energy: CeltEnergy,
}Expand description
CELT frame decoder scaffold.
Provides energy decoding and the MDCT-IV inverse transform. Full
entropy-coded CELT decoding (PVQ, fine energy, band prediction …) is
provided by crate::opus::celt; this type is intentionally lightweight
and intended for testing and scaffolding.
Fields§
§config: CeltFrameConfigFrame configuration.
prev_energy: CeltEnergyPer-band energy state carried across frames.
Implementations§
Source§impl CeltDecoder
impl CeltDecoder
Sourcepub fn new(config: CeltFrameConfig) -> Self
pub fn new(config: CeltFrameConfig) -> Self
Creates a new CeltDecoder for the given configuration.
Sourcepub fn decode_frame(&mut self, data: &[u8]) -> Result<CeltFrame, String>
pub fn decode_frame(&mut self, data: &[u8]) -> Result<CeltFrame, String>
Parses energy values from the first bytes of data and returns a
CeltFrame with zeroed samples.
Each active band contributes one byte to the energy encoding: the byte
is interpreted as a signed i8 and scaled by 1/16 to produce a
log-domain energy value. Bands beyond the end of data default to
0.0.
Full PVQ coefficient decoding is not performed; this method is a scaffold.
Sourcepub fn apply_mdct_inverse(&self, coeffs: &[f32]) -> Vec<f32>
pub fn apply_mdct_inverse(&self, coeffs: &[f32]) -> Vec<f32>
Computes the Type-IV MDCT inverse transform (IMDCT-IV).
Given N = coeffs.len() spectral coefficients X[k], the output
time-domain samples are:
x[n] = sqrt(2/N) * sum_{k=0}^{N-1} X[k] * cos(π/N * (n + 0.5 + N/2) * (k + 0.5))for n = 0 .. N-1.
Returns an empty vector if coeffs is empty.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CeltDecoder
impl RefUnwindSafe for CeltDecoder
impl Send for CeltDecoder
impl Sync for CeltDecoder
impl Unpin for CeltDecoder
impl UnsafeUnpin for CeltDecoder
impl UnwindSafe for CeltDecoder
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> 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