pub struct DCTplanner<T> { /* fields omitted */ }
The DCT planner is used to make new DCT algorithm instances.
RustDCT has several DCT algorithms available for each DCT type; For a given DCT type and problem size, the FFTplanner
decides which of the available DCT algorithms to use and then initializes them.
use std::sync::Arc;
use rustdct::DCTplanner;
let mut input: Vec<f32> = vec![0f32; 1234];
let mut output: Vec<f32> = vec![0f32; 1234];
let mut planner = DCTplanner::new();
let dct4 = planner.plan_dct4(1234);
dct4.process_dct4(&mut input, &mut output);
let dct4_clone = Arc::clone(&dct4);
If you plan on creating multiple DCT instances, it is recommnded to reuse the same planner for all of them. This
is because the planner re-uses internal data across DCT instances wherever possible, saving memory and reducing
setup time. (DCT instances created with one planner will never re-use data and buffers with DCT instances created
by a different planner)
Each DCT instance owns Arc
s to its shared internal data, rather than borrowing it from the planner, so it's
perfectly safe to drop the planner after creating DCT instances.
Returns a DCT Type 1 instance which processes signals of size len
.
If this is called multiple times, it will attempt to re-use internal data between instances
Returns a DCT Type 2 instance which processes signals of size len
.
If this is called multiple times, it will attempt to re-use internal data between instances
Returns DCT Type 3 instance which processes signals of size len
.
If this is called multiple times, it will attempt to re-use internal data between instances
Returns a DCT Type 4 instance which processes signals of size len
.
If this is called multiple times, it will attempt to re-use internal data between instances
Returns a DST Type 1 instance which processes signals of size len
.
If this is called multiple times, it will attempt to re-use internal data between instances
Returns DST Type 2 instance which processes signals of size len
.
If this is called multiple times, it will attempt to re-use internal data between instances
Returns DST Type 3 instance which processes signals of size len
.
If this is called multiple times, it will attempt to re-use internal data between instances
Returns DST Type 4 instance which processes signals of size len
.
If this is called multiple times, it will attempt to re-use internal data between instances
Returns a MDCT instance which processes inputs of size len * 2
and produces outputs of size len
.
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.
If this is called multiple times, it will attempt to re-use internal data between instances
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)