Friday, June 26, 2020

Exact Recompression

Is it possible to "reverse engineer" a compressed lossy image or audio file?

By this, instead of re-encoding and incurring more compression artifacts is it possible to work out what the original compressed data looks like and repacket back in to the original compressed file without any loss or degradation?

A researcher at Cambridge was able to revert a decompressed bitmap to a JPEG source, covered by this paper on Exact JPEG recompression. The authors are able to recover the compression parameters (quantized DCT coefficients) for 96% of the blocks** in images compressed at a JPEG quality of 75%.

Exact JPEG recompression

 Andrew B. Lewis, Markus G. Kuhn 
Computer Laboratory, University of Cambridge, 


We present a variant of the JPEG baseline image compression algorithm optimized for images that were generated by a JPEG decompressor. It inverts the computational steps of one particular JPEG decompressor implementation (Independent JPEG Group, IJG), and uses interval arithmetic and an iterative process to infer the possible values of intermediate results during the decompression, which are not directly evident from the decompressor output due to rounding. We applied our exact recompressor on a large database of images, each compressed at ten different quality factors. At the default IJG quality factor 75, our implementation reconstructed the exact quantized transform coefficients in 96% of the 64-pixel image blocks. For blocks where exact reconstruction is not feasible, our implementation can output transform-coefficient intervals, each guaranteed to contain the respective original value. Where different JPEG images decompress to the same result, we can output all possible bit-streams. At quality factors 90 and above, exact recompression becomes infeasible due to combinatorial explosion; but 68% of blocks still recompressed exactly. 

Matt Montag discussed the possiblity of doing this with MP3.

I am sure it should be possible to train neural networks to be able to effectively do this. 

No comments: