Bit Allocation using Optimization

Tongda Xu, Han Gao, Chenjian Gao, Yuanyuan Wang, Dailan He, Jinyong Pi, Jixiang Luo, Ziyu Zhu, Mao Ye, Hongwei Qin, Yan Wang, Jingjing Liu, Ya-Qin Zhang

TL;DR

This paper reveals a mathematical equivalence between Semi-Amortized Variational Inference (SAVI) and optimal pixel-level bit allocation in Neural Video Compression (NVC). By extending SAVI to handle complex, multi-level latent dependencies and introducing tractable approximations, the authors create a gradient-based bit allocation method that requires no empirical models. This approach sets a new empirical upper bound for NVC performance, outperforming existing methods by roughly 0.5 dB PSNR.

The Problem: Guesswork in Bit Allocation

In video compression, the primary goal is to minimize the Rate-Distortion (R-D) cost—balancing the bitrate (file size) against distortion (video quality). Because video frames reference each other (e.g., a P-frame predicts its content based on a previous I-frame), allocating bits evenly is highly inefficient. Giving more bits to a reference frame improves the quality of all subsequent frames that depend on it.

Deciding exactly how to distribute these bits across different frames and pixels is known as bit allocation. Historically, both traditional codecs (like H.265) and modern Neural Video Compression (NVC) models have relied on hand-crafted, empirical models or simple heuristics to guess this optimal distribution. Because these empirical models are mere approximations, they leave a lot of compression efficiency on the table. This paper asks: Can we find the mathematically optimal bit allocation without relying on flawed empirical models?

Methods: A New Paradigm with SAVI

The authors propose a novel paradigm for bit allocation using Semi-Amortized Variational Inference (SAVI). Instead of using a formula to guess bit allocation, they use gradient-based optimization during the encoding process to find it directly.

  1. The Equivalence Theorem: The authors mathematically prove that applying SAVI to maximize the likelihood of an entire Group-of-Pictures (GoP) is exactly equivalent to performing pixel-level optimal bit allocation.
  2. Accurate SAVI on DAGs: Standard SAVI only works for independent, single-level latent variables. Video frames, however, are autoregressive (later frames depend on earlier ones), forming a Directed Acyclic Graph (DAG). The authors extend SAVI to handle these DAG dependencies by recursively applying back-propagation through gradient ascent.
  3. Tractable Approximations: The "Accurate SAVI" algorithm has an exponential time complexity of $\Theta(K^N)$ (where $K$ is gradient steps and $N$ is GoP size), making it impossible to run in practice. To resolve this, they introduce two practical versions:
  4. Proposed-Approx: Drops a recursive gradient term, reducing temporal complexity to linear $\Theta(KN)$.
  5. Proposed-Scalable: Limits the gradient evaluation look-ahead to a constant $C$ future frames instead of the whole GoP, reducing spatial (memory) complexity to $\Theta(C)$.

Key Insights

  • No More Guesswork: By using the neural network's own gradients to define the rate and quality dependency model, bit allocation becomes an exact optimization problem rather than an empirical guessing game.
  • OEU is Just Coarse Bit Allocation: The authors point out that a popular existing technique called Online Encoder Update (OEU)—previously thought of as an "error propagation aware" strategy—is actually just a coarse, frame-level version of bit allocation.
  • A New Upper Bound: Because this method optimizes bit allocation at the pixel level directly on the specific video being encoded, it serves as an empirical upper bound for how well any bit allocation algorithm could possibly perform on a given neural codec.

Key Results

  • Massive Performance Gains: The proposed method outperforms the previous state-of-the-art bit allocation method (OEU) by a significant margin of roughly 0.5 dB BD-PSNR. When applied to the DVC baseline on the HEVC Class D dataset, the Proposed-Approx method achieved a -35.86% BD-BR (bitrate reduction), absolutely crushing OEU's -18.97%.
Rate-Distortion performance across different datasets and baselines
  • Speed-Memory Tradeoffs: The Proposed-Scalable version drastically cuts down encoding time and memory. It reduced encoding time from 528.3 seconds/frame to 74.6 seconds/frame and used less than half the RAM of OEU, while still maintaining a highly competitive -29.81% BD-BR.
Encoding time, memory usage, and BD-BR comparisons

Limitations and Future Work

  • Encoding Speed: The primary limitation is computational complexity. Because the method requires hundreds or thousands of gradient ascent steps per frame during encoding, it is incredibly slow. It is currently best suited for scenarios where encoding time doesn't matter (e.g., a streaming service encoding a movie once for millions of viewers) or as a benchmark for evaluating faster algorithms.
  • Scope of Evaluation: The current evaluation is limited to NVC architectures using P-frames (predictive frames).
  • Future Work: The authors note that they will continue to investigate faster approximations to bring this optimal bit allocation closer to real-time encoding speeds.

Summary updated

BibTeX
@inproceedings{xu2023bit,
  author = {Tongda Xu and Han Gao and Chenjian Gao and Yuanyuan Wang and Dailan He and Jinyong Pi and Jixiang Luo and Ziyu Zhu and Mao Ye and Hongwei Qin and Yan Wang and Jingjing Liu and Ya-Qin Zhang},
  title = {{Bit Allocation using Optimization}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=vpXYb9vqU4},
}
Figure