}
Self {
- imdct: IMDCT::new(FFTMode::SplitRadix, 512),
+ imdct: IMDCT::new(FFTMode::SplitRadix, 512, false),
tmp: [0.0; ATRAC3_FRAME_SIZE + 64],
gain_tab, gain_tab2, window,
}
gain_tab[i] = pow_tab[i + 53].powf(8.0 / fsamples);
}
let size = samples;
- CookDSP { imdct: IMDCT::new(FFTMode::SplitRadix, samples*2), window: window, out: [0.0; 2048], size, pow_tab, hpow_tab, gain_tab }
+ CookDSP { imdct: IMDCT::new(FFTMode::SplitRadix, samples*2, false), window: window, out: [0.0; 2048], size, pow_tab, hpow_tab, gain_tab }
}
}
}*/
impl IMDCT {
- pub fn new(mode: FFTMode, size: usize) -> Self {
+ pub fn new(mode: FFTMode, size: usize, scaledown: bool) -> Self {
let mut twiddle: Vec<FFTComplex> = Vec::with_capacity(size / 4);
let factor = 2.0 * consts::PI / ((8 * size) as f32);
+ let scale = if scaledown { (1.0 / (size as f32)).sqrt() } else { 1.0 };
for k in 0..size/4 {
- twiddle.push(FFTComplex::exp(factor * ((8 * k + 1) as f32)));
+ twiddle.push(FFTComplex::exp(factor * ((8 * k + 1) as f32)).scale(scale));
}
let fft = FFTBuilder::new_fft(mode, size/4);
let mut z: Vec<FFTComplex> = Vec::with_capacity(size / 2);