Why JPEG compression processes image by 8x8 blocks instead of applying Discrete Cosine Transform to the whole image?
-
Consider that the DCT is good at compressing rather smooth areas with low frequency content, but quite bad at compressing high frequency content areas.– Dan D.May 28, 2012 at 6:57
-
identical question: stackoverflow.com/questions/11147666/…– ctrl-alt-delorJun 22, 2012 at 9:35
-
Earlier identical question: stackoverflow.com/questions/74892/…– David CaryJun 23, 2012 at 4:38
2 Answers
8 X 8 was chosen after numerous experiments with other sizes.
The conclusions of experiments are: 1. Any matrices of sizes greater than 8 X 8 are harder to do mathematical operations (like transforms etc..) or not supported by hardware or take longer time. 2. Any matrices of sizes less than 8 X 8 dont have enough information to continue along with the pipeline. It results in bad quality of the compressed image.
Because, that would take "forever" to decode. I don't remember fully now, but I think you need at least as many coefficients as there are pixels in the block. If you code the whole image as a single block I think you need to, for every pixel, iterate through all the DCT coefficients.
I'm not very good at big O calculations but I guess the complexity would be O("forever"). ;-)
For modern video codecs I think they've started using 16x16 blocks instead.
-
2If you need to iterate on everything every iteration, it's O(n^2), not "forever", which is O(n!).– Triang3lDec 19, 2012 at 10:45
-
I'm not sure about "forever" - I have a program, called "FourierPainter" and it performs the Fourier transformation and back to image in a split second. The whole image, mind you. And Fourier is not much different from DCT, makes slightly more calculations even (keep imaginary values as phases, whilst DCT doesn't). You can download the Fourier Painter yourself and check it: jcrystal.com/products/fp– shalMay 2, 2018 at 12:36