2 ms·
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 interpretat
by ack_complete 2y ago
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.