I am aware that JPEG compression is lossy. I have 2 questions:
Given an operation T:
1. Take a JPEG-80 image
2. Decode it to a byte buffer
3. Encode given byte buffer as JPEG-80
Is T an idempotent operation in terms of visual quality? Or will the quality of the image keep degrading as I repeat T? Does the same hold true for the JPEG-XR codec?
Thank you!
Edit: Since there have been conflicting answers, it would be great if you could provide references!
In a JPEG we store the DCT (Discrete Cosine Transform) information using Huffman encoding.
JPEG, the group of people, created JPEG, a standard for digital image compression, in 1992. Anyone who's ever used the internet has probably seen a JPEG-encoded image. It is by far the most ubiquitous way of encoding, sending and storing images.
It's not guaranteed, but it may happen. Especially if you repeat the encode -> decode -> encode -> decode process enough times, it will eventually settle on a fixpoint and stop losing quality further (as long as you stick to the same quality and same encoder).
JPEG encoding is done in several steps:
And decoding is the same process backwards.
Steps 1 and 2 have rounding errors (especially in speed-optimized encoders using integer math), so for idempotent re-encoding you need to be lucky to get encoding and decoding rounding errors to be small or cancel each other out.
The step 3, which is the major lossy step, is actually idempotent. If your decoded pixels convert to similar-enough DCT it will quantize to the same data again!
JPEG XR also uses YUV, so it may suffer some rounding errors, but OTOH instead of DCT it uses a different transform that can be computed without rounding errors, so it should be easier to round-trip JPEG-XR than other formats.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With