Why AV1 Replaced SAO with CDEF and Loop Restoration
The AV1 video codec abandoned the Sample Adaptive Offset (SAO) filter used in HEVC in favor of a dual in-loop pipeline consisting of the Constrained Directional Enhancement Filter (CDEF) and Loop Restoration. While SAO helped reduce banding and ringing artifacts in earlier codecs, its simplistic offset mechanism frequently led to noticeable blurring and loss of fine detail. By decoupling edge-ringing reduction from detail preservation, AV1’s combination of CDEF and Loop Restoration achieves higher visual fidelity, sharper edges, and superior rate-distortion performance.
The Limitations of Sample Adaptive Offset (SAO)
HEVC introduced SAO directly after the deblocking filter to correct sample values by classifying pixels into categories (edge offsets or band offsets) and applying simple positive or negative DC offsets. While computationally lightweight, SAO suffers from fundamental drawbacks:
- Over-Smoothing: SAO tends to act as a blunt instrument. When reducing artifacts in flat areas or near edges, it often introduces a "waxy" or smoothed appearance, erasing high-frequency skin textures and film grain.
- Inability to Handle Directional Ringing: Ringing artifacts around sharp transitions typically align with the angle of the edge. SAO evaluates local pixel neighborhoods uniformly without analyzing edge orientation, making it ineffective at eliminating directional ringing without softening the edge itself.
CDEF: Targeted Directional Deringing
To address the geometric nature of compression artifacts, AV1 introduced CDEF, which combines the Directional Deringing Filter and the Clamped Directional Filter.
CDEF operates on 8x8 blocks by first calculating the primary direction of edges within the block (choosing from one of eight angles). Once the direction is established, it applies a non-linear low-pass filter oriented along that primary direction rather than across it. A strict clamping mechanism ensures that filtered pixel values do not deviate significantly from their inputs.
By filtering parallel to edges, CDEF effectively eliminates ringing artifacts and mosquito noise while maintaining the crispness of sharp boundaries.
Loop Restoration: Reconstructing Lost Detail
While CDEF handles directional edge cleanup, the Loop Restoration stage focuses on recovering fine detail lost during transform quantization and earlier filtering passes. Operating on larger blocks called Restoration Units, Loop Restoration utilizes two distinct mathematical filters:
- Separable Symmetric Wiener Filter: A 2D separable filter that uses error-minimization mathematics to partially invert the blurring introduced by the encoding process, bringing the reconstructed frame mathematically closer to the original source.
- Self-Guided Restoration: A dual-scale edge-preserving smoothing technique that constructs a subspace projection of the image. It uses guided filters to enhance contrast and restore textures without re-introducing ringing.
During encoding, the codec tests these filters against the uncompressed original frame, selects the method that yields the highest rate-distortion efficiency, and signals the filter coefficients in the bitstream.
Why the Dual Pipeline Succeeded
AV1 replaced SAO because image degradation from lossy compression cannot be solved optimally with a single additive offset model. CDEF and Loop Restoration perform orthogonal tasks: CDEF acts locally to remove directional ringing, while Loop Restoration acts globally to sharpen blur and recover lost micro-textures.
This division of labor eliminates the waxy, over-filtered appearance characteristic of aggressive SAO filtering, allowing AV1 to retain texture and edge definition at significantly lower bitrates.