CAVLC

Context Adaptive Variable Length Coding

Physical Layer
Introduced in Rel-12
CAVLC is a lossless compression algorithm used in 3GPP Enhanced Voice Services (EVS) codec to efficiently encode quantized spectral coefficients. It reduces bitrate requirements for high-quality audio transmission by exploiting statistical redundancies in the frequency domain. This enables superior voice quality at lower bitrates compared to previous codecs.

Description

Context Adaptive Variable Length Coding (CAVLC) is a sophisticated entropy coding technique implemented within the 3GPP Enhanced Voice Services (EVS) audio codec, standardized in TS 26.906. It operates on the quantized spectral coefficients generated after the Modified Discrete Cosine Transform (MDCT) in the EVS encoder's frequency-domain coding path. Unlike simpler Huffman coding, CAVLC dynamically adapts its variable-length code tables based on the local statistical context of the data being encoded, specifically the values of previously coded coefficients. This context adaptation allows it to achieve higher compression efficiency by using shorter codewords for more probable coefficient patterns and longer codewords for less probable ones.

The algorithm processes spectral coefficients in a specific scanning order, typically starting from lower frequencies and moving to higher frequencies, or using a zig-zag pattern to group coefficients with similar statistical properties. For each coefficient or group of coefficients (like runs of zeros), CAVLC selects an appropriate VLC table from a predefined set based on contextual parameters such as the number of non-zero coefficients in neighboring frequency bands or the magnitude of recently coded coefficients. Key components of the CAVLC process include the encoding of the total number of non-zero coefficients and trailing ones (coefficients with absolute value of 1), the encoding of the signs of those trailing ones, the encoding of the levels (magnitudes) of remaining non-zero coefficients, and the encoding of the total number of zeros before the last non-zero coefficient.

Within the EVS codec architecture, CAVLC plays a critical role in the core encoder's bitstream multiplexer. After the spectral coefficients are quantized and grouped, CAVLC compresses this data for transmission. The decoder performs the inverse process, using the same contextual rules to select the correct VLC tables to parse the bitstream and reconstruct the quantized spectral coefficients, which are then inverse transformed and synthesized to produce the audio output. The efficiency of CAVLC directly impacts the operational bitrate range of the EVS codec, enabling it to deliver high-quality speech and music at bitrates from as low as 5.9 kbps up to 128 kbps for super-wideband and fullband content.

The design of CAVLC in EVS is optimized for the statistical characteristics of audio signals. It handles the heavy-tailed distribution of coefficient magnitudes (many zeros and small values, with fewer large values) efficiently. The context modeling is carefully designed to track local statistics without excessive computational complexity or memory requirements, making it suitable for real-time implementation on mobile devices. Its integration is seamless with other EVS components like bandwidth-adaptive linear prediction, noise-filling, and temporal noise shaping, contributing to the overall codec's robustness against packet losses and its ability to maintain high audio quality across diverse network conditions.

Purpose & Motivation

CAVLC was introduced in 3GPP Release 12 as part of the Enhanced Voice Services (EVS) codec to address the growing demand for higher quality audio services (like HD voice) over mobile networks while optimizing bandwidth usage. Prior codecs like AMR-WB used simpler entropy coding methods or fixed codebooks that were less efficient at compressing the spectral data of wideband and super-wideband audio. This inefficiency either limited audio quality at a given bitrate or required higher bitrates to achieve quality targets, straining network capacity especially as voice over LTE (VoLTE) deployments scaled.

The primary problem CAVLC solves is the efficient, lossless compression of quantized frequency-domain coefficients. Audio signals transformed to the frequency domain (via MDCT) exhibit specific statistical patterns: a large number of coefficients are zero or near-zero, especially at higher frequencies, and the non-zero coefficients have a predictable distribution of magnitudes. Simple fixed-length coding or basic variable-length coding wastes bits. CAVLC's context-adaptive approach exploits these local correlations, significantly reducing the average number of bits needed per coefficient. This bit saving is directly reinvested to allow for finer quantization of the coefficients at the same overall bitrate, leading to higher perceptual audio quality, or to lower the operational bitrate for equivalent quality, freeing up radio resources.

Historically, the evolution from narrowband to wideband and fullband audio services created a data compression challenge. The EVS codec was designed to be the successor to AMR-WB, requiring state-of-the-art compression tools for competitive performance. CAVLC, drawing principles from advanced video coding standards like H.264/AVC (which uses a similar technique for residual data), was adapted for audio's unique characteristics. It addressed the limitations of previous algebraic code-excited linear prediction (ACELP) and transform-coded excitation (TCX) codebooks by providing a more flexible and efficient way to represent the spectral envelope and detail, which was crucial for supporting music and mixed content in addition to speech, a key goal for EVS.

Key Features

  • Lossless compression of quantized spectral coefficients
  • Dynamic adaptation of VLC tables based on local coefficient statistics
  • Efficient encoding of runs of zeros and coefficient magnitudes
  • Optimized for the heavy-tailed distribution of audio MDCT coefficients
  • Enables high-quality audio at lower bitrates for EVS codec
  • Low-complexity design suitable for real-time mobile device processing

Evolution Across Releases

Rel-12 Initial

CAVLC was initially standardized as a core component of the Enhanced Voice Services (EVS) codec in TS 26.906. Its architecture was defined for compressing quantized MDCT coefficients within the EVS frequency-domain coding modes. The initial design included the mechanisms for context derivation, a set of predefined VLC tables, and the procedures for encoding the number of non-zero coefficients, trailing ones, levels, and total zeros.

Defining Specifications

SpecificationTitle
TS 26.906 3GPP TS 26.906