5 ms·
Right. The lossiness in JPEG comes from quantization of the DCT coefficients. But with the way the DCT works: - You can flip a block horizontally, left-to-ri
by a_e_k 2y ago
Right. The lossiness in JPEG comes from quantization of the DCT coefficients. But with the way the DCT works:
- You can flip a block horizontally, left-to-right, by negating the DCT coefficients in the odd-numbered columns (zero-indexed).
- You can flip a block vertically, top-to-bottom, by negating the DCT coefficients in the odd-numbered rows (zero-indexed).
- You can transpose a block by transposing the DCT coefficients.
In combination, that's enough to rotate a block in 90 degree increments, and to do so losslessly/reversibly without harming the original quantization (you don't even need to do an IDCT). Then you swap the blocks around to the right order and redo the lossless entropy encoding stages.