How SVT-AV1 VMAF Tuning Modifies RDO Curves
This article provides an overview of how the VMAF (Video Multi-Method Assessment Fusion) tuning mode in the SVT-AV1 encoder shifts traditional rate-distortion optimization (RDO). By replacing standard mathematical error metrics with perceptually weighted calculations, SVT-AV1 adjusts the cost function, reshapes the operational Lagrangian multipliers, and modifies spatial-temporal quantization offsets. These mechanics alter the shape and slope of the encoder's rate-distortion curves, favoring visual and metric-specific efficiencies over raw mathematical fidelity.
The Baseline RDO Model
In standard encoding modes, rate-distortion optimization relies on a Lagrangian cost function:
\[J = D + \lambda R\]
Here, \(J\) is the cost to minimize, \(R\) is the rate (bit count), \(D\) is the distortion, and \(\lambda\) (lambda) is the Lagrange multiplier that governs the trade-off between quality loss and bitrate.
By default, SVT-AV1 measures distortion (\(D\)) using Sum of Squared Errors (SSE) or Mean Squared Error (MSE). While mathematically straightforward, SSE treats all pixel errors equally regardless of human visual perception or the specific algorithmic biases of perceptual quality models like VMAF.
Distortion Metric Replacement in VMAF Tuning
When VMAF tuning is enabled in SVT-AV1 (typically using
--tune 2), the encoder alters the calculation of \(D\). VMAF measures quality through a
combination of Visual Information Fidelity (VIF), Detail Loss Metric
(DLM), and temporal motion features.
To align with VMAF:
- High-Frequency Preservation: VIF rewards the preservation of texture and edge contrast. SVT-AV1 scales down the distortion penalty for high-frequency residual loss if that loss does not degrade the structural integrity assessed by VIF.
- Luminance and Contrast Weighting: VMAF exhibits non-linear sensitivity to contrast changes across different luminance bands. SVT-AV1 adjusts the error penalty per block based on local variance, penalizing blurriness more heavily than high-frequency noise.
Because the distortion calculation \(D\) changes at the transform and mode-decision stages, decisions that look suboptimal to an SSE-based metric are chosen if they yield higher predicted VMAF scores.
Modification of the Lagrange Multiplier (\(\lambda\))
The Lagrange multiplier \(\lambda\) dictates the slope of the rate-distortion curve at any given operating point:
\[\lambda = -\frac{dD}{dR}\]
In SSE mode, \(\lambda\) is strictly derived from the base Quantization Parameter (QP) using an exponential relationship tailored to minimize square error across frames.
In VMAF tuning mode, SVT-AV1 modifies the base \(\lambda\) tables:
- Slope Adjustment: The encoder steepens or flattens \(\lambda\) dynamically depending on the temporal and spatial complexity of the frame.
- Diminishing Returns Threshold: VMAF saturates near 100 at higher bitrates faster than PSNR does. To prevent wasting bits where VMAF gains plateau, SVT-AV1 inflates \(\lambda\) at lower QPs (higher bitrates), pricing additional bits more expensively and shifting the rate-distortion trade-off toward rate savings.
Perceptual Quantization and Dynamic QP Offsets
SVT-AV1’s VMAF tuning directly influences delta-QP assignments and quantization matrix application:
- Spatial Modulation: Flat areas, where artifacting might lower VMAF scores via visible distortion, receive lower local QPs. Complex textures, which mask errors both to the human eye and within VMAF’s feature extractors, are assigned higher local QPs to conserve bits.
- Temporal Hierarchy Adjustments: Lower-layer reference frames (such as base keyframes and golden frames) receive higher fidelity investments because VMAF tracks temporal consistency. An error introduced in a base reference degrades the VMAF score across multiple frames, prompting SVT-AV1's RDO logic to assign lower \(\lambda\) values to these temporal anchors.
Impact on the Resulting R-D Curves
These modifications alter the graphical representation of rate-distortion curves:
- VMAF vs. Bitrate: The VMAF-rate curve shifts upward and to the left in the low-to-medium bitrate regions. The encoder reaches higher VMAF scores with fewer bits because the RDO specifically optimizes for VMAF's feature metrics.
- PSNR vs. Bitrate Degradation: If the resulting bitstream is evaluated on a PSNR-rate curve, the curve shifts downward. By departing from SSE-based RDO, the encoder accepts higher raw mathematical error to optimize for the targeted perceptual score.
- Saturation Plateau: At higher bitrates, the VMAF-rate curve flattens earlier than in standard tuning, as SVT-AV1 actively prevents over-allocation to regions where VMAF shows diminishing returns.