Struct chfft::Mdct1D [] [src]

pub struct Mdct1D<T, F: Fn(usize, usize) -> T> { /* fields omitted */ }

Perform a Modified discrete cosine transform

Example

extern crate chfft;

use chfft::Mdct1D;

fn main() {
    let input = [2.0 as f64, 0.0, 1.0, 1.0, 0.0, 3.0, 2.0, 4.0];

    let mut mdct = Mdct1D::with_sine(input.len());
    let output = mdct.forward(&input);
    println!("the transform of {:?} is {:?}", input, output);
}

Methods

impl<T: Float + FloatConst + NumAssign> Mdct1D<T, fn(_: usize, _: usize) -> T>
[src]

[src]

Returns a instances to execute DCT with sine window

use chfft::Mdct1D;
let mut mdct = Mdct1D::<f64, _>::with_sine(1024);

[src]

Returns a instances to execute DCT with vorbis window

use chfft::Mdct1D;
let mut mdct = Mdct1D::<f64, _>::with_vorbis(1024);

impl<T: Float + FloatConst + NumAssign, F: Fn(usize, usize) -> T> Mdct1D<T, F>
[src]

[src]

Returns a instances to execute DCT

extern crate chfft;
let mut mdct = chfft::Mdct1D::new(|l, p| (std::f64::consts::PI * (p as f64 + 0.5) / l as f64).sin(), 1024);

[src]

Reinitialize length

use chfft::Mdct1D;
let mut mdct = Mdct1D::<f64, _>::with_sine(1024);

// reinitialize
mdct.setup(2048);

[src]

The 1 scaling factor forward transform

extern crate chfft;

let input = [2.0 as f64, 0.0, 1.0, 1.0, 0.0, 3.0, 2.0, 4.0];

let mut mdct = chfft::Mdct1D::with_sine(input.len());
let output = mdct.forward(&input);

[src]

The 1 scaling factor backward transform

extern crate chfft;

let input = [2.0 as f64, 0.0, 1.0, 1.0, 0.0, 3.0, 2.0, 4.0];

let mut mdct = chfft::Mdct1D::with_sine(input.len() << 1);
let output = mdct.backward(&input);

[src]

The \(\sqrt{\frac 2 n}\) scaling factor forward transform

extern crate chfft;

let input = [2.0 as f64, 0.0, 1.0, 1.0, 0.0, 3.0, 2.0, 4.0];

let mut mdct = chfft::Mdct1D::with_sine(input.len());
let output = mdct.forward(&input);

[src]

The \(\sqrt{\frac 2 n}\) scaling factor backward transform

extern crate chfft;

let input = [2.0 as f64, 0.0, 1.0, 1.0, 0.0, 3.0, 2.0, 4.0];

let mut mdct = chfft::Mdct1D::with_sine(input.len() << 1);
let output = mdct.backward(&input);

Trait Implementations

Auto Trait Implementations

impl<T, F> Send for Mdct1D<T, F> where
    F: Send,
    T: Send

impl<T, F> Sync for Mdct1D<T, F> where
    F: Sync,
    T: Sync