[][src]Struct chfft::Dct1D

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

Perform a discrete cosine transform

Example

use chfft::{Dct1D, DctType};

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

    let mut dct = Dct1D::<f64>::new(DctType::Two, input.len(), false);
    let output = dct.forward(&input);
    println!("the transform of {:?} is {:?}", input, output);
}

Methods

impl<T: Float + FloatConst + NumAssign> Dct1D<T>[src]

pub fn new(dct_type: DctType, len: usize, is_ortho: bool) -> Self[src]

Returns a instances to execute DCT

use chfft::{Dct1D, DctType};
let mut dct = Dct1D::<f64>::new(DctType::Two, 1024, false);

pub fn setup(&mut self, dct_type: DctType, len: usize, is_ortho: bool)[src]

Reinitialize length

use chfft::{Dct1D, DctType};
let mut dct = Dct1D::<f64>::new(DctType::Two, 1024, false);

// reinitialize
dct.setup(DctType::Two, 2048, false);

pub fn forward(&mut self, source: &[T]) -> Vec<T>[src]

The 1 scaling factor forward transform

use chfft::{Dct1D, DctType};

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

let mut dct = Dct1D::<f64>::new(DctType::Two, input.len(), false);
let output = dct.forward0(&input);

pub fn forward0(&mut self, source: &[T]) -> Vec<T>[src]

The 1 scaling factor forward transform

use chfft::{Dct1D, DctType};

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

let mut dct = Dct1D::<f64>::new(DctType::Two, input.len(), false);
let output = dct.forward0(&input);

pub fn forwardu(&mut self, source: &[T]) -> Vec<T>[src]

The unitary transform scaling factor forward transform

use chfft::{Dct1D, DctType};

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

let mut dct = Dct1D::<f64>::new(DctType::Two, input.len(), false);
let output = dct.forwardu(&input);

pub fn forwardn(&mut self, source: &[T]) -> Vec<T>[src]

The inverse scaling factor forward transform

use chfft::{Dct1D, DctType};

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

let mut dct = Dct1D::<f64>::new(DctType::Two, input.len(), false);
let output = dct.forwardu(&input);

Trait Implementations

impl<T: Debug> Debug for Dct1D<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Dct1D<T> where
    T: RefUnwindSafe

impl<T> Send for Dct1D<T> where
    T: Send

impl<T> Sync for Dct1D<T> where
    T: Sync

impl<T> Unpin for Dct1D<T> where
    T: Unpin

impl<T> UnwindSafe for Dct1D<T> where
    T: UnwindSafe

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.