SVT-AV1 Encode Times: Impact of CDEF and Loop Restoration
This article analyzes how the Constrained Directional Enhancement
Filter (CDEF) and Loop Restoration (LR) directly impact encoding times
in the SVT-AV1 (libsvtav1) encoder. It examines the
computational overhead of these in-loop filters, how they scale across
different encoding presets, and the trade-offs between processing speed
and visual quality when enabling or disabling them.
Understanding the In-Loop Filters in SVT-AV1
In the AV1 video coding format, CDEF and Loop Restoration are two critical in-loop filtering stages applied after deblocking. Because they run “in-the-loop,” their outputs are used as references for future frames. This means the encoder must perform these calculations in real-time during the encoding process, which heavily impacts CPU utilization and overall encode times.
- CDEF (Constrained Directional Enhancement Filter): This filter identifies the direction of edges within each block and applies a directional smooth filter to eliminate ringing artifacts and mosquito noise without blurring sharp edges.
- Loop Restoration (LR): Operating after CDEF, LR uses Wiener and Self-Guided Synthesis filters to restore pixel-level details and correct distortions introduced during the quantization process.
Direct Impact on Encode Times
In SVT-AV1, CDEF and Loop Restoration are among the most computationally expensive tools. Disabling or restricting them yields a direct, measurable reduction in encode times, though the exact impact depends heavily on the chosen preset.
1. The Overhead of CDEF
The primary bottleneck in CDEF is the direction search algorithm, which requires the encoder to test multiple directions for each block to find the optimal filtering path.
- Time Savings: Disabling CDEF
(
--enable-cdef 0in SVT-AV1) can reduce total encoding times by 10% to 15% on slower, higher-quality presets (Presets 0 to 4). - Quality Cost: Disabling CDEF results in noticeable ringing artifacts around high-contrast edges, degrading the subjective visual quality of the output.
2. The Overhead of Loop Restoration
Loop Restoration is even more computationally demanding than CDEF. It requires intensive pixel-by-pixel mathematical calculations (solving Wiener filter coefficients or applying self-guided filtering) across large frame areas.
- Time Savings: Disabling Loop Restoration
(
--enable-restoration 0) can decrease encoding times by 15% to 25% on medium-to-slow presets (Presets 3 to 6). - Quality Cost: Without Loop Restoration, the video loses fine textures and high-frequency details, resulting in a softer, slightly blurred image.
3. Combined Impact of Disabling Both Filters
If both CDEF and Loop Restoration are completely disabled, the encoder bypasses two major mathematical bottlenecks.
- Total Speedup: Encoding speeds can increase by 25% to 40% depending on the CPU architecture and resolution (with higher resolutions like 4K seeing the most dramatic speedups).
- BD-Rate Penalty: While the speed gains are massive, the compression efficiency drops significantly. Disabling both filters can result in a 5% to 12% BD-Rate loss, meaning you will need up to 12% more bitrate to maintain the same visual quality as an encode with the filters enabled.
SVT-AV1 Preset Scaling and Automation
You do not always need to manually disable these filters, as SVT-AV1
automatically adjusts their complexity based on the preset level
(-preset 0 to 13):
- Low Presets (0 to 4): Both filters are fully enabled with exhaustive searches. This delivers the highest visual quality but results in the slowest encode times.
- Medium Presets (5 to 8): SVT-AV1 uses fast-heuristic search patterns for both CDEF and LR. This maintains most of the visual benefits while reclaiming a significant portion of the encoding speed.
- High Presets (9 to 13): The encoder uses highly simplified versions of these filters or disables them entirely on certain frames to achieve real-time and live-streaming encoding speeds.