pub struct Mdct { /* private fields */ }Expand description
MDCT processor with pre-computed windows and FFT plans
Provides O(N log N) MDCT/IMDCT transforms using FFT acceleration.
Implementations§
Source§impl Mdct
impl Mdct
Sourcepub fn new(channels: usize, window_type: WindowType) -> Self
pub fn new(channels: usize, window_type: WindowType) -> Self
Create a new MDCT processor
Sourcepub fn sine_window(n: usize) -> Vec<f32>
pub fn sine_window(n: usize) -> Vec<f32>
Sine window: w[n] = sin(π(n+0.5)/N)
Sourcepub fn vorbis_window(n: usize) -> Vec<f32>
pub fn vorbis_window(n: usize) -> Vec<f32>
Vorbis window: sin(π/2 * sin²(π(n+0.5)/N))
Sourcepub fn forward(&self, samples: &[f32], block_size: BlockSize) -> Vec<f32>
pub fn forward(&self, samples: &[f32], block_size: BlockSize) -> Vec<f32>
Forward MDCT: N time samples → N/2 frequency coefficients
X[k] = Σ x[n] * w[n] * cos(π/N * (n + 0.5 + N/2) * (k + 0.5))
Sourcepub fn inverse(&self, coeffs: &[f32], block_size: BlockSize) -> Vec<f32>
pub fn inverse(&self, coeffs: &[f32], block_size: BlockSize) -> Vec<f32>
Inverse MDCT: N/2 frequency coefficients → N time samples
y[n] = 2/N * Σ(k=0 to N-1) X[k] * cos(π/N * (n + 0.5 + N/2) * (k + 0.5))
Sourcepub fn process_frame(
&mut self,
samples: &[f32],
channel: usize,
block_size: BlockSize,
) -> (Vec<f32>, Vec<f32>)
pub fn process_frame( &mut self, samples: &[f32], channel: usize, block_size: BlockSize, ) -> (Vec<f32>, Vec<f32>)
Process a frame with overlap-add for perfect reconstruction Returns N/2 output samples (the middle half after overlap-add)
Auto Trait Implementations§
impl Freeze for Mdct
impl !RefUnwindSafe for Mdct
impl Send for Mdct
impl Sync for Mdct
impl Unpin for Mdct
impl !UnwindSafe for Mdct
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
Mutably borrows from an owned value. Read more