AV1 HRD Leaky Bucket Buffer Model Parameters

The AV1 Hypothetical Reference Decoder (HRD) relies on a leaky bucket model to mathematically verify that a bitstream can be decoded in real time without causing memory overflow or buffer underflow. This article breaks down the essential parameters governing the leaky bucket model in the AV1 specification, detailing how bit rate, buffer capacity, initial delays, and timing metadata define the continuous intake and instantaneous removal of compressed video data within the Coded Picture Buffer (CPB).

The Core Leaky Bucket Triplet

In video coding standards, the leaky bucket model conceptualizes the decoder buffer as a bucket with a hole in the bottom. In AV1's implementation for the CPB, bits typically enter the bucket at a constant or bounded transmission rate (the input) and are removed instantaneously as complete frames (the leak) at designated decode times.

The model is formally defined by three primary parameters:

  1. Bit Rate (\(R\)): The transmission speed at which coded bits flow into the buffer.
  2. Buffer Size (\(B\)): The maximum storage capacity of the decoder's buffer.
  3. Initial Delay (\(F\)): The duration or initial fullness required before the decoder begins extracting and decoding frames.

In AV1, multiple operating points can exist within a single bitstream, and each operating point can define its own set of leaky bucket parameters to handle varying network constraints and decoder capabilities.


Key Syntax Elements in the AV1 Specification

The parameters that construct the leaky bucket model are transmitted within the sequence_header_obu under the decoder model information (decoder_model_info) and operating parameters information (operating_parameters_info).

1. Bit Rate Specification

The transmission rate \(R\) is calculated using a base value and an exponent scale:

  • bit_rate_scale: A 4-bit unsigned integer that provides the scaling factor exponent.
  • bit_rate_value_minus1[i]: A value specifying the mantissa of the bit rate for operating point i.

The peak or nominal bit rate is derived as: \[\text{BitRate} = (\text{bit\_rate\_value\_minus1}[i] + 1) \times 2^{(6 + \text{bit\_rate\_scale})}\]

2. Buffer Capacity Specification

The size \(B\) of the Coded Picture Buffer is configured similarly:

  • buffer_size_scale: A 4-bit unsigned integer that defines the size scaling exponent.
  • buffer_size_value_minus1[i]: A value specifying the mantissa of the buffer capacity for operating point i.

The maximum buffer capacity is derived as: \[\text{BufferSize} = (\text{buffer\_size\_value\_minus1}[i] + 1) \times 2^{(4 + \text{buffer\_size\_scale})}\]

3. Initial Buffer Fullness and Delay Parameters

To prevent the decoder from running out of bits during the initial presentation phase, the model sets initial buffering delays:

  • buffer_delay_length_minus1: Determines the bit-depth of the delay syntax elements.
  • decoder_buffer_delay[i]: Specifies the time interval between the start of bit delivery to the CPB and the removal of the first frame for operating point i.
  • encoder_decoder_buffer_delay[i]: An optional parameter specifying the total combined encoder-decoder buffer delay, useful for low-latency live streaming.

These values are quantified using a time base defined by the sequence timing info.

4. Time Scale and Clock Ticks

The timing of frame delivery and extraction depends on reference clock values defined in timing_info:

  • num_units_in_display_tick: The number of time units that pass in one clock tick of the display timer.
  • time_scale: The number of time units that pass in one second.
  • equal_picture_interval: A flag indicating whether pictures are output at strictly uniform intervals.

Buffer Dynamics: Underflow and Overflow Rules

The leaky bucket parameters enforce two strict operational conditions on the bitstream:

  • Underflow Prevention: A frame cannot be removed from the CPB until all bits belonging to that frame have arrived. If a frame’s scheduled removal time arrives before its data is fully present in the CPB, an underflow occurs, violating bitstream conformance.
  • Overflow Prevention: The cumulative number of bits delivered to the CPB minus the bits removed by the decoding process must never exceed BufferSize. If the bit inflow exceeds the maximum capacity, an overflow occurs, causing decoder memory failure.

By embedding these parameters directly into the bitstream headers, AV1 allows streaming servers and decoders to negotiate suitable operating points, guarantee continuous playback, and prevent buffer exhaustion regardless of network variance.