Skip to content

add dav1d DXVA decoder support

Steve Lhomme requested to merge robUx4/vlc:dav1d-dxva/15 into master

Since we can't have dav1d and FFmpeg DXVA support at the same time, and the AV1 software decoder in FFmpeg is much slower than dav1d we don't want to use that. So until FFmpeg can fallback to hardware decoders when using dav1d we need proper hardware support directly in dav1d.

I proposed an API to add some callback support in dav1d. It has a good chance of being merged. I only tested with DXVA which is a low level decoder. I would still like to test much higher level decoders to make sure it works, or maybe rely on the packetizer to handle sequence changes (should not happen within MP4 or Matroska/WebM) to do the switch to pure hardware decoders.

The proposed API is also necessary if FFmpeg even wants to use their DXVA code at the same time as dav1d as well.

Only 1 frame delay works with the current code. I'm not sure it will ever work with more than that. However it uses the usual amount of threads we use with dav1d so we don't have to check the hardware first and never allow fallback to software decoding.


v5:

  • fixed handling of Sequence Header change
  • verified fallback to software works
  • enable HW decoder even without a sequence header, picking the default decoder if there is one. Either is will be used when we get the Sequence Header or it will fallback to software decoding. The only difference is that max_delay_frame might be forced to 1 (at least with DXVA). It's still possible to use only the software decoder with -no-hw-dec or if the GPU can't decode AV1 (likely for most people)
  • fallback to/from other higher level HW decoders (Media Foundation, nvdec) should work but they need to have a variant with a higher priority than dav1d (10000).

v6:

  • use vlc_module_match
  • don't keep the hw_module
  • fix dav1d patches so it passes all unit tests (and fixes software default usage)
  • use the new API to get the proper frame delay (since the HW patches will be merged on top of that) (see !1623 (merged))

v7: fix early hw_current_output initialization


v8: !1705 (diffs, comment 319329)


v9:

  • rebased to integrate dav1d changes
  • get a video_format_t from the HW module so it can set the proper width/height and possibly other things
  • change return values in UpdateDecoder() (not a vlc_fourcc_t anymore)
  • fix warning when calling AV1_get_frame_max_dimensions()
  • fix hw_pool.c/h CRLF
Edited by Steve Lhomme

Merge request reports