#signal-processing #dct #transform #discrete #cosine #encoding #mdct

rustdct

Compute Discrete Cosine Transforms (DCT) of any size in O(nlogn) time, in pure Rust

12 releases (6 breaking)

0.7.1 Nov 8, 2022
0.7.0 Dec 29, 2021
0.6.0 Jan 5, 2021
0.5.0 Oct 9, 2020
0.1.3 Jun 28, 2017

#500 in Algorithms

Download history 4769/week @ 2024-06-20 4697/week @ 2024-06-27 4983/week @ 2024-07-04 5135/week @ 2024-07-11 4861/week @ 2024-07-18 4665/week @ 2024-07-25 5460/week @ 2024-08-01 8924/week @ 2024-08-08 7124/week @ 2024-08-15 7076/week @ 2024-08-22 6901/week @ 2024-08-29 6411/week @ 2024-09-05 5751/week @ 2024-09-12 4928/week @ 2024-09-19 7656/week @ 2024-09-26 9422/week @ 2024-10-03

28,540 downloads per month
Used in 50 crates (15 directly)

MIT/Apache

205KB
4K SLoC

RustDCT

minimum rustc 1.37

RustDCT is a pure-Rust signal processing library that computes the most common Discrete Cosine Transforms:

  • Discrete Cosine Transform (DCT) Types 1, 2, 3, 4
  • Discrete Sine Transform (DST) Types 1, 2, 3, 4
  • Modified Discrete Cosine Transform (MDCT)

Example

// Compute a DCT Type 2 of size 1234
use rustdct::DctPlanner;

let mut planner = DctPlanner::new();
let mut dct = planner.plan_dct2(1234);

let mut buffer = vec![0f32; 1234];

dct.process_dct2(&mut buffer);

Compatibility

The rustdct crate requires rustc 1.37 or greater.

Releases

Release notes are available in RELEASES.md.

Dependencies

~3MB
~57K SLoC