Martin Storsjö ac5dfb0a85 examples: Treat SDL2 headers as system headers
This makes those headers included with -isystem rather than -I,
which makes the compiler skip producing any warnings about them
(as they're expected to be out of the user code's control).

This avoids warnings with newer versions of the
dav1d-debian-unstable CI image, warnings (treated as errors in CI)
like this:

    In file included from /usr/include/SDL2/SDL_config.h:51,
                     from /usr/include/SDL2/SDL_stdinc.h:33,
                     from /usr/include/SDL2/SDL_main.h:25,
                     from /usr/include/SDL2/SDL.h:31,
                     from ../examples/dav1dplay.c:33:
    /usr/include/SDL2/SDL_config_unix.h:186:9: error: 'HAVE_GETAUXVAL' redefined [-Werror]
      186 | #define HAVE_GETAUXVAL 1
          |         ^~~~~~~~~~~~~~
    In file included from ../examples/dav1dplay.c:27:
    ./config.h:66:9: note: this is the location of the previous definition
       66 | #define HAVE_GETAUXVAL 0
          |         ^~~~~~~~~~~~~~

Recently, Debian Unstable has switched from providing the
actual SDL 2 to providing the SDL 2 API through the sdl2-compat
package on top of SDL 3.

The SDL 2 headers expose their full config.h as part of their
installed headers (that the user code ends up including). This
includes unnamespaced defines, such as "#define HAVE_GETAUXVAL 1".

This issue hasn't shown up with the original SDL 2 package in
Debian, due to a Debian packaging detail. While most SDL 2
headers are installed in /usr/include/SDL2 (and user code
includes it as <SDL.h>, requiring the build system to include
/usr/include/SDL2), the Debian packaging has replaced
/usr/include/SDL2/SDL_config.h with a header that includes
<SDL2/_real_SDL_config.h>, which then gets resolved in
/usr/include/x86_64-linux-gnu/SDL2. Due to this being included
from a compiler default system include path
(/usr/include/x86_64-linux-gnu), no warnings about the header
was printed, even though that one also produced the same kind
of conflicting redefinitions. (We could also avoid the same issue
by attempting to include <SDL2/SDL.h> instead of <SDL.h>,
avoiding the use of the build system provided include directory,
resolving that from /usr/include, and having the compiler consider
it a system header.)

The sdl2-compat package in Debian doesn't redirect that header
in the same way, but includes SDL_config_unix.h in the same
directory in /usr/include/SDL2. Due to this being included
from a user specified -I (as long as it is included as <SDL.h>,
not <SDL2/SDL.h>), it's considered a user header, and warnings
are printed for it.

It seems like SDL 3 no longer exposes their config.h headers as
part of the installed headers.

The conflict between SDL 2's config.h's HAVE_GETAUXVAL and
our stems from the fact that we only try to detect GETAUXVAL
on architectures where we want to use it (arm/aarch64, loongarch,
ppc or riscv). On x86, where we don't need it, we don't try
to detect it, and set "#define HAVE_GETAUXVAL 0" in our
config.h.

To avoid warnings due to the conflict, we can declare the
SDL 2 dependency with the argument "include_type: 'system'",
which should silence any warnings in the SDL headers. This
Meson feature is available since Meson 0.52.0 (and we currently
require Meson 0.54.0).

An alternative way to avoid the redefinition conflict would be
to always try to detect getauxval on all architectures, to make
our config.h agree with SDL 2's config headers.

A third (and much more hacky way) around the conflict would be
to avoid the public SDL headers including the SDL_config header
by defining "SDL_config_h_" before including SDL.h. Doing this
also requires manually including a couple more standard headers
before SDL.h (stdint.h, stdio.h, stddef.h).
2026-05-06 14:00:31 +03:00
2022-05-06 01:52:36 +02:00
2023-03-01 19:59:10 +01:00
2025-08-12 01:23:14 +02:00
2024-02-22 19:13:23 +01:00
2025-12-31 15:50:45 +01:00
2024-03-08 23:24:30 +01:00

dav1d logo

dav1d

dav1d is an AV1 cross-platform decoder, open-source, and focused on speed and correctness.

It is now battle-tested and production-ready and can be used everywhere.

The canonical repository URL for this repo is https://code.videolan.org/videolan/dav1d

This project was partially funded by the Alliance for Open Media/AOM.

Goal and Features

The goal of this project is to provide a decoder for most platforms, and achieve the highest speed possible to overcome the temporary lack of AV1 hardware decoder.

It supports all features from AV1, including all subsampling and bit-depth parameters.

In the future, this project will host simple tools or simple wrappings (like, for example, an MFT transform).

License

dav1d is released under a very liberal license, a contrario from the other VideoLAN projects, so that it can be embedded anywhere, including non-open-source software; or even drivers, to allow the creation of hybrid decoders.

The reasoning behind this decision is the same as for libvorbis, see RMS on vorbis.

Roadmap

The plan is the following:

Reached

  1. Complete C implementation of the decoder,
  2. Provide a usable API,
  3. Port to most platforms,
  4. Make it fast on desktop, by writing asm for AVX2 chips.
  5. Make it fast on mobile, by writing asm for ARMv8 chips,
  6. Make it fast on older desktop, by writing asm for SSSE3+ chips,
  7. Make high bit-depth fast on mobile, by writing asm for ARMv8 chips.
  8. Make it fast on older mobile, by writing asm for ARMv7 chips,
  9. Make high bit-depth fast on older mobile, by writing asm for ARMv7 chips,
  10. Make high bit-depth fast on desktop, by writing asm for AVX2 chips,
  11. Make high bit-depth fast on older desktop, by writing asm for SSSE3+ chips,
  12. Improve threading.

On-going

  1. Improve C code base with various tweaks,
  2. Accelerate for less common architectures, like PPC, SSE2, RISC-V or AVX-512.

After

  1. Use more GPU decoding, when possible.

Contribute

Currently, we are looking for help from:

  • C developers,
  • asm developers,
  • platform-specific developers,
  • GPGPU developers,
  • testers.

Our contributions guidelines are quite strict. We want to build a coherent codebase to simplify maintenance and achieve the highest possible speed.

Notably, the codebase is in pure C and asm.

We are on IRC, on the #dav1d channel on Libera.chat. If you do not have an IRC Client at hand, use IRC Web Interface.

See the contributions document.

CLA

There is no CLA.

People will keep their copyright and their authorship rights, while adhering to the BSD 2-clause license.

VideoLAN will only have the collective work rights.

CoC

The VideoLAN Code of Conduct applies to this project.

Compile

General compilation steps

  1. Install Meson (0.54 or higher), Ninja, and, for x86* targets, nasm (2.14 or higher)
  2. Run mkdir build && cd build to create a build directory and enter it
  3. Run meson setup .. to configure meson, add --default-library=static if static linking is desired
  4. Run ninja to compile

Following are modification of step 3 and 4, for specific purpose.

Cross-Compilation for 32- or 64-bit Windows, 32-bit Linux

If you're on a linux build machine trying to compile .exe for a Windows target/host machine, configure meson like this

meson setup .. --cross-file=../package/crossfiles/x86_64-w64-mingw32.meson

or, for 32-bit:

meson setup .. --cross-file=../package/crossfiles/i686-w64-mingw32.meson

mingw-w64 is a pre-requisite and should be installed on your linux machine via your preferred method or package manager. Note the binary name formats may differ between distributions. Verify the names, and use alias if certain binaries cannot be found.

For 32-bit linux, run

meson setup .. --cross-file=../package/crossfiles/i686-linux32.meson

Build documentation

  1. Make sure doxygen and graphviz are installed.
  2. Run meson setup .. -Denable_docs=true to configure meson to generate docs from the build directory.
  3. Run ninja doc/html to build the docs

The result can be found in build/doc/html/. An online version built from master can be found here.

Run tests

  1. In the root directory, run git clone https://code.videolan.org/videolan/dav1d-test-data.git tests/dav1d-test-data to fetch the test data repository
  2. During meson configuration, specify -Dtestdata_tests=true
  3. Run meson test -v after compiling

Decoder conformance tests (optional but encouraged)

  1. Download the argon conformance bitstreams from https://streams.videolan.org/argon/
  2. Extract into dav1d directory by running tar -xvf argon.tar.zst
  3. Execute tests with tests/dav1d_argon.bash -d build/tools/dav1d -a argon
  4. Expected outcome is 2763 files successfully verified in XXmYYs (dav1d 1.x.y-zz-gHHHHHHH filmgrain=1 cpumask=-1)

Support

This project is partially funded by the Alliance for Open Media/AOM and is supported by TwoOrioles and VideoLabs.

These companies can provide support and integration help, should you need it.

FAQ

Why do you not improve libaom rather than starting a new project?

  • We believe that libaom is a very good library. It was however developed for research purposes during AV1 design. We think that an implementation written from scratch can achieve faster decoding, in the same way that ffvp9 was faster than libvpx.

Is dav1d a recursive acronym?

  • Yes.

Can I help?

I am not a developer. Can I help?

  • Yes. We need testers, bug reporters and documentation writers.

What about the AV1 patent license?

  • This project is an implementation of a decoder. It gives you no special rights on the AV1 patents.

Please read the AV1 patent license that applies to the AV1 specification and codec.

Will you care about <my_arch>? <my_os>?

  • We do, but we don't have either the time or the knowledge. Therefore, patches and contributions welcome.
S
Description
MIRROR: dav1d, the fastest AV1 decoder on all platforms
Readme
11 MiB
Languages
Assembly 80.1%
C 19.4%
Meson 0.5%