CONCEPT Cited by 1 source
Grain intensity scaling function¶
Definition¶
A grain intensity scaling function is a piecewise-linear function from pixel value → grain intensity transmitted alongside AR grain coefficients in the AV1 Film Grain Synthesis bitstream. During decode, it controls how strongly synthesized grain is added at each point of the image — brighter regions get one intensity, darker regions another, mid-tones yet another (Source: sources/2025-07-03-netflix-av1scale-film-grain-synthesis-the-awakening).
The scaling function is "estimated during the encoding process" and "models the relationship between pixel value and noise intensity using a piecewise linear function. This allows for precise adjustments to the grain strength based on video brightness and color."
Why a scaling function is necessary¶
Film grain is not uniformly visible across an image. In real film stock and in digital sensor noise:
- Dark regions saturate grain into invisible territory or swamp it with shadow detail — grain is weak here.
- Highlights / bright whites — grain tends to be overwhelmed by the signal or clipped.
- Mid-tones — this is where grain is most visible, and where viewers perceive the "filmic look".
A single grain intensity applied uniformly to every pixel would either under-grain the mid-tones or over-grain the shadows. The scaling function avoids both failure modes by making intensity a function of local pixel brightness — so the reconstructed grain layer has the same "patchy, intensity-dependent" character as real film grain.
Why piecewise-linear¶
Piecewise-linear is the simplest parametric family rich enough to capture the intensity-vs-brightness relationship:
- Easy to estimate on the encoder — fit segments to the residual's local variance-vs-mean relationship.
- Compact to transmit — a small number of
(pixel_value, intensity)break points per frame or per GOP. - Trivial to evaluate on the decoder — linear interpolation between the nearest two break points, per pixel. This is a first-class design constraint: the decoder must run on commodity consumer devices (TVs, phones, set-top boxes).
Non-linear alternatives (cubic splines, learned networks) would be more expressive but none of them are justified given the grain-intensity relationship is empirically well-approximated by a small piecewise-linear curve.
Illustration (Netflix Fig. 2)¶
Grain intensity
│ ╱───╮
│ ╱ ╲
│ ╱ ╲____
│ ╱
│ ╱
│ ╱
└──────────────────────────────────► pixel value
dark mid-tones bright
Netflix's Fig. 2 shows this curve next to a grayscale SMPTE bars frame with the resulting grain applied: the mid-grey bars have visibly heavier grain than the darkest / brightest bars, matching the curve's peak.
Interaction with the AR model¶
The AR model — see concepts/auto-regressive-grain-model — describes the shape of the grain (coarseness, spatial correlation). The scaling function describes the amplitude of the grain as a function of pixel brightness. The two are orthogonal:
- AR coefficients answer "what does a grain speck look like?"
- The scaling function answers "how strongly does grain appear at this brightness?"
Together they specify a per-pixel grain value at the decoder:
where template_patch is the 32×32 random-position patch
extracted from the AR-generated 64×64 noise template, and
scale(·) is the piecewise-linear function interpolating
between transmitted break points.
Bitrate cost of the scaling function¶
The scaling function is a handful of (pixel_value,
intensity) break points plus colour-channel metadata — a few
tens of bytes per transmitted unit (frame, GOP, or per-
sequence). Vanishingly cheap compared to the bitrate saved by
denoising the source before compression. Together with the
AR coefficients it is the compact "side channel" that makes
decoder-
side synthesis for compression a net bitrate win.
Seen in¶
- sources/2025-07-03-netflix-av1scale-film-grain-synthesis-the-awakening — canonical wiki source; Fig. 2 illustrates the scaling function applied to a SMPTE bars frame.