Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multidimensional DCTs #2

Open
abonander opened this issue Dec 26, 2018 · 4 comments
Open

Multidimensional DCTs #2

abonander opened this issue Dec 26, 2018 · 4 comments

Comments

@abonander
Copy link
Contributor

I'm looking to upgrade/replace the naive DCT implementation in my img_hash crate.

However, I need a 2 dimensional DCT, which I know I can implement with a row-column algorithm of 1D DCTs but I'm wondering if it's possible to produce an optimized 2D DCT.

I imagine, though, this would require RustFFT to implement a 2D FFT algorithm.

@ejmahler
Copy link
Owner

ejmahler commented Dec 26, 2018 via email

@abonander
Copy link
Contributor Author

An advantage of my naive implementation is that it doesn't require transposing rows to columns; I use an adapter type to wrap the math to index columns directly. I also precompute the DCT coefficients since the matrix size is known ahead of time. It's probably worth benchmarking against using your 1D implementation with a transposition step.

@ejmahler
Copy link
Owner

ejmahler commented Dec 26, 2018 via email

@abonander
Copy link
Contributor Author

abonander commented Dec 27, 2018

@ejmahler actually the default is 8x8 but the idea is to have any user-configurable dimensions. In fact that default would be 16x16 because the algorithm does the DCT on a double size image and then crops to the lower corner to cut out high frequency information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants