AV1 Film Grain Random Noise Generator Standard

This article provides an overview of how film grain synthesis is standardized in the AV1 video codec, focusing on the specific random noise generator used inside compliant decoders. It explains the normative 16-bit Linear Feedback Shift Register (LFSR) algorithm, how it initializes and produces pseudo-random values, and how these values are processed through autoregressive modeling to generate realistic film grain across different platforms.

The Standardized PRNG: 16-Bit Linear Feedback Shift Register

To synthesize film grain rather than encoding it directly into the video stream, the AV1 specification defines a deterministic pseudo-random number generator (PRNG). Standardizing this generator ensures that every compliant hardware and software decoder outputs visual grain patterns that look consistent without requiring the transmission of high-frequency noise data.

AV1 specifies a 16-bit Linear Feedback Shift Register (LFSR) as its core random noise generator. Decoders run this LFSR using a specific feedback polynomial to produce a stream of pseudo-random bits.

The bitwise operation for generating the next feedback bit is defined as:

\[\text{bit} = \left( (\text{seed} \gg 0) \oplus (\text{seed} \gg 1) \oplus (\text{seed} \gg 3) \oplus (\text{seed} \gg 12) \right) \ \& \ 1\]

The register updates its state by shifting right by one bit and inserting the calculated feedback bit into the most significant position:

\[\text{seed} = (\text{seed} \gg 1) \ | \ (\text{bit} \ll 15)\]

Because the state space is strictly 16 bits, the PRNG is lightweight and well-suited for fixed-function hardware decoders, DSPs, and low-power mobile chips.

Seed Initialization and Frame Signaling

The LFSR relies on a 16-bit seed parameter (film_grain_seed_param or random_seed) provided directly in the frame header bitstream:

From Pseudo-Random Bits to Film Grain

The output of the 16-bit LFSR is not applied directly to decoded pixels as raw white noise. Instead, AV1 uses the PRNG to populate synthetic grain templates via an Autoregressive (AR) process:

  1. Uniform Value Generation: The LFSR outputs integers that are mapped into uniform pseudo-random values within a centered range (typically between -128 and 127).
  2. Template Synthesis: Decoders generate small blocks of noise (a 64×64 sample template for luma, and 32×32 templates for chroma).
  3. Autoregressive (AR) Filtering: An AR filter of order 0, 1, 2, or 3 shapes the spatial correlation of the uniform noise values. By applying filter weights signaled in the bitstream to neighboring random samples, the decoder converts raw white noise into structured, fine, or coarse grain.
  4. Luminance-Based Scaling: The generated grain is modulated by a piecewise linear scaling function before being added back to the reconstructed picture. This step ensures that noise intensity adapts dynamically to local pixel brightness, matching the behavior of physical film stock.