Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Maybe someone can chime in with a good explanation: I've never really understood why the DCT is better than the discrete Fourier transform for compression. I once read it had something to do with it not needing a window function and working better for small block/window sizes.


The DCT copes better than the FFT with the piecewise blocking done by image codecs.

Consider a shallow 1D gradient, which is just a ramp. The DFT's interpretation of this as a periodic signal turns it into a sawtooth, which takes lots of high frequency components to reduce ringing and keep the edge sharp enough. The DCT is equivalent to the DFT on the mirrored signal, which instead turns this into a triangle wave, which takes less high frequency components to represent reasonably.

This varies for different types of data; my understanding is that audio codecs tend to prefer the modified DCT (MDCT) instead due to the different characteristics of audio signals.


The cosine function itself is symmetrical around the Y-axis. Supposedly, the main advantage of the DCT is that it's better at representing symmetrical features in data sets, which is a good fit for both image and audio data.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: