[][src]Struct rustdct::mdct::MDCTViaDCT4

pub struct MDCTViaDCT4<T> { /* fields omitted */ }

MDCT implementation that converts the problem to a DCT Type 4 of the same size.

It is much easier to express a MDCT as a DCT Type 4 than it is to express it as a FFT, so converting the MDCT to a DCT4 before converting it to a FFT results in greatly simplified code

// Computes a MDCT of input size 1234 via a DCT4, using the MP3 window function
use rustdct::mdct::{MDCT, MDCTViaDCT4, window_fn};
use rustdct::DCTplanner;

let len = 1234;
let input:  Vec<f32> = vec![0f32; len * 2];
let mut output: Vec<f32> = vec![0f32; len];

let mut planner = DCTplanner::new();
let inner_dct4 = planner.plan_dct4(len);
 
let dct = MDCTViaDCT4::new(inner_dct4, window_fn::mp3);
dct.process_mdct(&input, &mut output);

Methods

impl<T: DCTnum> MDCTViaDCT4<T>
[src]

pub fn new<F>(inner_dct: Arc<dyn TransformType4<T>>, window_fn: F) -> Self where
    F: FnOnce(usize) -> Vec<T>, 
[src]

Creates a new MDCT context that will process signals of length inner_dct.len() * 2, with an output of length inner_dct.len()

inner_dct.len() must be even.

window_fn is a function that takes a size and returns a Vec containing size window values. See the window_fn module for provided window functions.

Trait Implementations

impl<T: DCTnum> MDCT<T> for MDCTViaDCT4<T>
[src]

fn process_mdct(&self, input: &[T], output: &mut [T])
[src]

Computes the MDCT on the input buffer and places the result in the output buffer. Read more

fn process_imdct(&self, input: &[T], output: &mut [T])
[src]

Computes the IMDCT on the input buffer and places the result in the output buffer. Read more

impl<T> Length for MDCTViaDCT4<T>
[src]

Auto Trait Implementations

impl<T> !Send for MDCTViaDCT4<T>

impl<T> !Sync for MDCTViaDCT4<T>

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.