dav1d AVX2 and AVX-512 Optimization Paths

This article examines the specialized AVX2 and AVX-512 instruction set architecture (ISA) optimization paths implemented in the open-source dav1d AV1 decoder. It details the specific algorithmic workloads targeted by these vector extensions—including inverse transforms, directional intra prediction, inter-frame motion compensation, in-loop filtering, and film grain synthesis—demonstrating how 256-bit and 512-bit vector pipelines maximize AV1 decode throughput on modern x86 architectures.

Architectural Overview

dav1d relies on handcrafted assembly routines using NASM to extract maximum performance from modern x86 CPUs. Rather than relying on auto-vectorization from C code, the decoder implements dedicated code paths for 8-bit and 10-bit/12-bit (High Bit Depth, or HBD) pixel pipelines.


Inverse Transforms (ITX)

The inverse transform stage converts frequency-domain coefficients back into spatial-domain residuals. AV1 supports multiple transform kernels—Discrete Cosine Transform (DCT), Asymmetric Discrete Sine Transform (ADST), FlipADST, and Identity (IDTX)—in block dimensions ranging from 4x4 up to 64x64.


In-Loop Filtering

AV1 employs three sequential in-loop filters to eliminate compression artifacts: the Deblocking Filter (LF), the Constrained Directional Enhancement Filter (CDEF), and the Loop Restoration Filter (LR).

Deblocking Filter (LF)

Deblocking operates across 4x4 block grid boundaries with threshold-based conditional clipping.

Constrained Directional Enhancement Filter (CDEF)

CDEF identifies the primary edge direction across 8x8 blocks and applies a non-linear deringing filter along and across that direction.

Loop Restoration (LR)

LR includes Wiener filtering (separable symmetric filtering) and Self-Guided Restoration (SGRproj).


Motion Compensation and Inter Prediction

Inter prediction generates predicted samples using motion vectors with subpixel accuracy (1/8th-pel precision), requiring 8-tap interpolation filters (Regular, Smooth, or Sharp).


Intra Prediction and Chroma from Luma (CfL)

Intra prediction synthesizes blocks based on adjacent boundary pixels.


Film Grain Synthesis

AV1 specifies an algorithmic film grain model, bypassing standard grain transmission by generating synthetic noise via an autoregressive (AR) process at playback.