What Assembly Compiler Does libdav1d Use
This article explores the assembly compilers used during the build
process of libdav1d, the highly optimized AV1 video decoder
developed by VideoLAN. It details the specific assemblers required for
compiling x86 and ARM architectures, helping developers configure their
build environments correctly.
To achieve its industry-leading decoding speeds,
libdav1d relies heavily on hand-written assembly language
rather than relying solely on C compiler optimizations. The specific
assembly compiler used depends on the target hardware architecture.
For x86 and x86_64 Architectures: NASM
For Intel and AMD processors, libdav1d makes extensive
use of SIMD instruction sets such as SSE, AVX2, and AVX-512. To compile
these optimization paths, the build process requires:
- NASM (Netwide Assembler): This is the primary and default assembly compiler used for x86 platforms.
- Version Requirement: A modern version of NASM (typically version 2.14 or later) is necessary to recognize and properly compile the latest AVX-512 vector instructions used in the codebase.
- Alternative: While Yasm was
historically used in many video processing projects,
libdav1dofficially mandates NASM for its x86 assembly compilation.
For ARM and ARM64 (AArch64) Architectures: GAS / Clang
For ARM-based systems, such as mobile devices, Apple Silicon, and
Raspberry Pi single-board computers, libdav1d utilizes NEON
instructions. The assembly compilation on these platforms uses:
- GNU Assembler (GAS): Part of the GCC toolchain, commonly used on Linux-based ARM systems.
- Clang Integrated Assembler: Used when building with the LLVM/Clang toolchain, which is standard on macOS, iOS, and Android NDK environments.
Build System Orchestration
The compilation of these assembly files is orchestrated by the
Meson build system in combination with
Ninja. When you configure the build, Meson
automatically searches the host system environment for nasm
(for x86 targets) or the appropriate C/C++ compiler toolchain (for ARM
targets) to compile the assembly source files into the final binary.