How libdav1d Handles AV1 Super-Resolution

This article provides a technical overview of how the libdav1d AV1 decoder internally processes the AV1 Super-Resolution feature. It explains the decoding pipeline sequence, how horizontal-only scaling is integrated with loop filters, and the assembly-level optimizations used to achieve high-performance real-time playback.

The AV1 Super-Resolution Concept

AV1 Super-Resolution allows a frame to be encoded at a lower horizontal resolution (the coded width) and then scaled back to its original horizontal size (the upscaled width) during the decoding process. This technique reduces the bitrate by processing fewer pixels during entropy decoding and early loop filtering, while still outputting a full-resolution image. Unlike standard post-processing scalers, Super-Resolution in AV1 is normatively integrated directly into the decoding loop.

Inside the libdav1d Decoding Pipeline

In libdav1d, the Super-Resolution process is carefully positioned within the frame reconstruction pipeline. It does not occur at the very end of decoding; instead, it is executed sequentially between specific loop-filtering stages:

  1. Coded-Resolution Stages: The frame is reconstructed, and both the Deblocking Filter (LF) and the Constrained Directional Enhancement Filter (CDEF) are applied to the frame at its smaller, coded resolution. This reduces computational overhead because these filters run on fewer pixels.
  2. Horizontal Scaling (Super-Resolution): Once CDEF is complete, libdav1d applies the Super-Resolution process. It scales the frame horizontally using a normative 8-tap polyphase filter.
  3. Upscaled-Resolution Stages: After the frame is horizontally upscaled, Loop Restoration (LR) is applied at the full, upscaled resolution. Finally, if film grain is present in the bitstream, Film Grain Synthesis is applied to the upscaled image.

Memory Management and Threading

libdav1d is designed for massive multi-threading, utilizing both frame-level and tile/row-level threading. Managing Super-Resolution internally requires sophisticated buffer handling:

SIMD and Assembly Optimizations

The 8-tap horizontal scaling filter is mathematically intensive. To prevent Super-Resolution from becoming a bottleneck, the libdav1d codebase features hand-written assembly optimizations for various hardware architectures:

By leveraging these hardware-specific optimizations and integrating the scaling directly into the row-threading pipeline, libdav1d minimizes the CPU and memory bandwidth overhead associated with AV1 Super-Resolution.