Struct chfft::Dct1D
[−]
[src]
pub struct Dct1D<T> { /* fields omitted */ }
Perform a discrete cosine transform
Example
extern crate chfft; use chfft::Dct1D; 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(2, 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: usize, len: usize, is_ortho: bool) -> Self
[src]
Returns a instances to execute DCT
use chfft::Dct1D; let mut dct = Dct1D::<f64>::new(2, 1024, false);
pub fn setup(&mut self, dct_type: usize, len: usize, is_ortho: bool)
[src]
Reinitialize length
use chfft::Dct1D; let mut dct = Dct1D::<f64>::new(2, 1024, false); // reinitialize dct.setup(2, 2048, false);
pub fn forward(&mut self, source: &[T]) -> Vec<T>
[src]
The 1 scaling factor forward transform
extern crate chfft; let input = [2.0, 0.0, 1.0, 1.0, 0.0, 3.0, 2.0, 4.0]; let mut dct = chfft::Dct1D::<f64>::new(2, input.len(), false); let output = dct.forward0(&input);
pub fn forward0(&mut self, source: &[T]) -> Vec<T>
[src]
The 1 scaling factor forward transform
extern crate chfft; let input = [2.0, 0.0, 1.0, 1.0, 0.0, 3.0, 2.0, 4.0]; let mut dct = chfft::Dct1D::<f64>::new(2, 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
extern crate chfft; let input = [2.0, 0.0, 1.0, 1.0, 0.0, 3.0, 2.0, 4.0]; let mut dct = chfft::Dct1D::<f64>::new(2, input.len(), false); let output = dct.forwardu(&input);
pub fn forwardn(&mut self, source: &[T]) -> Vec<T>
[src]
The inverse scaling factor forward transform
extern crate chfft; let input = [2.0, 0.0, 1.0, 1.0, 0.0, 3.0, 2.0, 4.0]; let mut dct = chfft::Dct1D::<f64>::new(2, input.len(), false); let output = dct.forwardu(&input);