X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-core%2Fsrc%2Fdsp%2Fmdct.rs;fp=nihav-core%2Fsrc%2Fdsp%2Fmdct.rs;h=e6ed3dc9bdfd5994aad24ff48dca12e536e27362;hb=4e034a32d947e1ef5f357cc2477d6f1c3b8454a9;hp=f883c7f42e148e536b863c23b89acbd62b189cf7;hpb=33b5689af80186c4aaf3e85a8a65730566024524;p=nihav.git diff --git a/nihav-core/src/dsp/mdct.rs b/nihav-core/src/dsp/mdct.rs index f883c7f..e6ed3dc 100644 --- a/nihav-core/src/dsp/mdct.rs +++ b/nihav-core/src/dsp/mdct.rs @@ -1,6 +1,8 @@ +//! Modified Discrete Cosine transform functionality. use std::f32::consts; use super::fft::*; +/// IMDCT working context. pub struct IMDCT { twiddle: Vec, fft: FFT, @@ -19,6 +21,7 @@ fn imdct(src: &[f32], dst: &mut [f32], length: usize) { }*/ impl IMDCT { + /// Constructs a new instance of `IMDCT` context. pub fn new(size: usize, scaledown: bool) -> Self { let mut twiddle: Vec = Vec::with_capacity(size / 4); let factor = 2.0 * consts::PI / ((8 * size) as f32); @@ -31,6 +34,7 @@ impl IMDCT { z.resize(size / 2, FFTC_ZERO); IMDCT { twiddle, fft, size, z } } + /// Calculates IMDCT. pub fn imdct(&mut self, src: &[f32], dst: &mut [f32]) { let size2 = self.size / 2; let size4 = self.size / 4; @@ -54,6 +58,7 @@ impl IMDCT { dst[3 * size4 + 2 * n + 1] = -self.z[size4 - n - 1].re; } } + /// Calculates only non-mirrored part of IMDCT. pub fn imdct_half(&mut self, src: &[f32], dst: &mut [f32]) { let size2 = self.size / 2; let size4 = self.size / 4;