Standard image and video codecs like JPEG and HEVC are the workhorses of the internet. They are incredibly efficient and hardware-accelerated on almost every device, but they are also rigid—designed primarily for "natural" photos and optimized for simple mathematical metrics like Mean Squared Error (MSE).
In a new paper titled "Sandwiched Compression: Repurposing Standard Codecs with Neural Network Wrappers," researchers from Google Research propose a clever way to modernize these legacy tools without replacing them. By "sandwiching" a standard codec between two neural networks, they transform rigid compression pipelines into flexible, high-performance systems capable of handling everything from high-dynamic-range (HDR) imaging to complex computer graphics textures.
Proposed Architecture and Methods
The core idea is a three-stage pipeline designed to optimize rate-distortion performance while leveraging existing hardware. The architecture consists of:
- Neural Pre-processor: A network (typically a U-Net or MLP) takes the source image and transforms it into a "neural code image" (or bottleneck image).
- Standard Codec: This bottleneck image is compressed using a standard, non-differentiable codec (like JPEG or HEVC).
- Neural Post-processor: A second network takes the reconstructed bottleneck image and "demodulates" it back into the final output.
Differentiable Proxies
Since standard codecs are "black boxes" that cannot be backpropagated through, the authors developed differentiable codec proxies. During training, they replace the real codec with a mathematical approximation (modeled after JPEG's DCT/IDCT and quantization) that allows gradients to flow from the output back to the pre-processor. Remarkably, even though the proxy is simple, the networks learn features that generalize well to much more complex codecs like HEVC.
Key Insights: Neural Code Images
A striking visual finding of this research is the nature of the "neural code images" produced by the pre-processor. To transmit complex data through limited channels—such as sending full RGB color through a grayscale-only codec—the pre-processor creates subtle, dither-like high-frequency patterns. These patterns "hide" information in a way that survives the codec's quantization process.
This "modulation" approach allows the sandwich to effectively "trick" an 8-bit codec into carrying 16-bit HDR data or a low-resolution codec into carrying high-resolution details. Furthermore, because the neural wrappers are trained end-to-end, the system is metric agnostic. By simply changing the loss function (e.g., using LPIPS for perceptual quality), the entire system can be optimized for human vision without modifying the underlying codec logic.
Experimental Results
The researchers evaluated the method across diverse data types, including natural images (CLIC, HDR+), video (AOM Common Test Conditions), and computer graphics (Relightables 8-channel texture maps). Quantitative improvements were substantial:
- Color over Grayscale: Using a grayscale JPEG codec to carry full RGB data resulted in a 6–9 dB gain in PSNR compared to standard methods.
- Super-Resolution: Sandwiching a low-resolution codec to transport high-resolution images yielded gains of up to 9 dB.
- Video Bitrate Savings: For video optimized for perceptual metrics (LPIPS), the sandwich achieved a 30% reduction in bitrate at the same visual quality compared to standard HEVC.
- Graphics Textures: For complex 8-channel graphics assets, the method reduced bitrates by 20-30% while maintaining high fidelity in the final rendered output.
Conclusion and Future Work
"Sandwiched Compression" offers a pragmatic path forward for media compression. It provides "generational" gains—comparable to moving from HEVC to VVC—without the massive implementation cost of new hardware. While the U-Nets add some computational overhead, the authors demonstrate that "slim" versions of these networks can maintain most gains with significantly fewer parameters. Future work may involve developing more sophisticated proxies for advanced codecs like AV1 to unlock even higher performance.
Summary updated