Sandwiched Compression: Repurposing Standard Codecs with Neural Network Wrappers

Onur G. Guleryuz, Philip A. Chou, Berivan Isik, Hugues Hoppe, Danhang Tang, Ruofei Du, Jonathan Taylor, Philip Davidson, Sean Fanello

TL;DR

This paper introduces a "sandwich architecture" that wraps standard, hardware-accelerated image and video codecs (like JPEG or HEVC) between neural network pre- and post-processors. By jointly training these neural wrappers using a custom differentiable codec proxy, the system can repurpose existing hardware to compress non-standard data types (like HDR or multi-channel graphics maps) and optimize for perceptual metrics, delivering up to 9 dB gains or 30% bitrate reductions.

What Problem Does This Paper Address?

End-to-end neural video codecs offer incredible rate-distortion performance, often outperforming traditional standards. However, they come with a massive catch: their computational complexity makes them impractical for real-time high-definition (HD) or ultra-high-definition (UHD) playback on consumer devices, especially power-constrained mobile chips.

On the flip side, traditional codecs (JPEG, H.264, HEVC) are baked directly into hardware ASICs, making them incredibly fast and power-efficient. But they are rigid. They were designed strictly for standard RGB/YUV photographic images and optimized using mathematically convenient metrics like Mean Squared Error (MSE). They cannot natively handle high dynamic range (HDR) imagery, multi-channel computer graphics assets (like normal or roughness maps), or optimize for human perceptual quality metrics without changing the underlying hardware.

The authors bridge this gap by asking: How can we exploit highly efficient, existing hardware codecs while gaining the flexibility and performance of neural networks?

Methods

The authors propose the Sandwich Architecture, which places a standard codec between two trainable neural networks: a pre-processor and a post-processor.

The sandwich architecture during operation and training.
  1. The Neural Pre-processor: Takes the original source image or video frame and compresses/transforms it into a "bottleneck image" (or neural code image) that the standard codec can understand.
  2. The Standard Codec: Compresses and decompresses the bottleneck image using existing, highly optimized hardware.
  3. The Neural Post-processor: Takes the decoded bottleneck image and reconstructs the final output, restoring details, channels, or resolutions that the standard codec couldn't natively process.

The Secret Sauce: Differentiable Proxies

Standard codecs contain non-differentiable operations (like quantization and entropy coding), making backpropagation impossible. To jointly train the pre- and post-processors, the authors developed a differentiable codec proxy that simulates the behavior of the standard codec during training. For video, this proxy includes differentiable approximations of motion compensation, intra/inter prediction mode selection, and loop filtering.

Datasets

The architecture was evaluated across a diverse set of tasks using several benchmarks:

  • Standard & High-Resolution Images: The Pets dataset and the CLIC (Challenge on Learned Image Compression) dataset.
  • High Dynamic Range (HDR): The HDR+ dataset (16-bit color components compressed over 8-bit codecs).
  • Computer Graphics Assets: The Relightables dataset, featuring 3-channel normal maps and 8-channel texture maps (albedo, normals, roughness, occlusion).
  • Video: 10-frame clips generated from the AOM Common Test Conditions (CTC).

Key Insights and Ideas

  • Neural Codes as "Watermarks": The pre-processor learns to embed complex, high-dimensional information into low-frequency, dither-like spatial modulation patterns that can survive standard compression. For example, it can pack a full-color RGB image into a single grayscale channel. The post-processor then demodulates these patterns to perfectly recover the color.
  • Leveraging Hardware for the Heavy Lifting: Instead of using massive neural networks to handle the entire compression loop, the sandwich architecture uses lightweight networks (like small U-Nets or MLPs). The heavy lifting—such as block transforms, entropy coding, and motion estimation—remains on the power-efficient hardware ASIC.
  • Cross-Codec Robustness: Even though the training proxy was modeled after JPEG, the trained neural wrappers seamlessly generalize to advanced codecs like HEVC or VVC without retraining.

Key Results

The sandwich architecture achieved remarkable quantitative improvements across multiple modalities:

  • Color over Grayscale (4:0:0): Achieved a 6–9 dB gain in MSE by hiding color inside grayscale channels.
  • Super-Resolution (HR over LR Codecs): Yielded 5–7 dB gains for JPEG and 7–8 dB gains for HEIC in the 0.3–0.5 bpp range.
  • High Dynamic Range (HDR): Allowed 8-bit codecs to break through their native "LDR saturation line," rising up to 3 dB above it by signaling tone-mapping curves via neural codes.
  • Computer Graphics Shading: For 8-channel texture maps, the sandwich architecture achieved a 20–30% reduction in bitrate under a novel "shaded distortion" metric.
  • Perceptual Video Compression: When optimized for the perceptual metric LPIPS, the sandwich architecture achieved a ~30% reduction in bitrate at the same visual quality compared to standard HEVC.
Visual comparison showing how the sandwich architecture preserves color and high-frequency details through a grayscale bottleneck.

Limitations and Future Work

While highly effective, the authors note a few areas for improvement:

  • Proxy Mismatch: The loop-filter proxy used during training occasionally performed better than the actual HEVC loop filter, causing the post-processor to leave some optimization on the table. Tighter coupling of the proxy to specific target codecs could yield even higher gains.
  • Standardization: To deploy this seamlessly in the real world, future video standards would need to support embedding neural post-processor weights directly into the compressed bitstream headers (e.g., at the GOP or picture level).

The authors suggest that future research should extend this framework to medical imagery, hyper-spectral data, and higher temporal resolutions.

Summary updated

BibTeX
@misc{guleryuz2024sandwiched,
  author = {Onur G. Guleryuz and Philip A. Chou and Berivan Isik and Hugues Hoppe and Danhang Tang and Ruofei Du and Jonathan Taylor and Philip Davidson and Sean Fanello},
  title = {{Sandwiched Compression: Repurposing Standard Codecs with Neural Network Wrappers}},
  year = {2024},
  eprint = {2402.05887},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.05887},
}
Figure