[−][src]Struct chfft::Dct1D
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
Auto Trait Implementations
impl<T> RefUnwindSafe for Dct1D<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Dct1D<T> where
T: Send,
T: Send,
impl<T> Sync for Dct1D<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Dct1D<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Dct1D<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,