[FFmpeg-devel] [PATCH v10 2/9] avcodec: add D3D12VA hardware accelerated H264 decoding

Wu, Tong1 tong1.wu at intel.com
Sun Dec 3 02:30:38 EET 2023


>> The implementation is based on:
>> https://learn.microsoft.com/en-us/windows/win32/medfound/direct3d-12-
>video-overview
>>
>> With the Direct3D 12 video decoding support, we can render or process
>> the decoded images by the pixel shaders or compute shaders directly
>> without the extra copy overhead, which is beneficial especially if you
>> are trying to render or post-process a 4K or 8K video.
>>
>> The command below is how to enable d3d12va:
>> ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4
>>
>> Signed-off-by: Wu Jianhua <toqsxw at outlook.com>
>> Signed-off-by: Tong Wu <tong1.wu at intel.com>
>> ---
>>  configure                   |   2 +
>>  libavcodec/Makefile         |   3 +
>>  libavcodec/d3d11va.h        |   3 -
>>  libavcodec/d3d12va_decode.c | 564
>++++++++++++++++++++++++++++++++++++
>>  libavcodec/d3d12va_decode.h | 179 ++++++++++++
>>  libavcodec/d3d12va_h264.c   | 207 +++++++++++++
>>  libavcodec/dxva2.c          |  29 +-
>>  libavcodec/dxva2.h          |   3 -
>>  libavcodec/dxva2_av1.c      |   4 +-
>>  libavcodec/dxva2_h264.c     |  26 +-
>>  libavcodec/dxva2_hevc.c     |   6 +-
>>  libavcodec/dxva2_internal.h |  74 ++---
>>  libavcodec/dxva2_mpeg2.c    |   6 +-
>>  libavcodec/dxva2_vc1.c      |   6 +-
>>  libavcodec/dxva2_vp9.c      |   6 +-
>>  libavcodec/h264_slice.c     |   4 +
>>  libavcodec/h264dec.c        |   3 +
>>  libavcodec/hwaccels.h       |   1 +
>>  libavcodec/hwconfig.h       |   2 +
>>  19 files changed, 1061 insertions(+), 67 deletions(-)
>>  create mode 100644 libavcodec/d3d12va_decode.c
>>  create mode 100644 libavcodec/d3d12va_decode.h
>>  create mode 100644 libavcodec/d3d12va_h264.c
>
>breaks build with mingw64 here
>
>make
>CC	libavcodec/dxva2.o
>In file included from src/libavcodec/dxva2.c:33:0:
>src/libavcodec/dxva2_internal.h:141:39: error: unknown type name
>‘D3D12VADecodeContext’; did you mean ‘AVD3D11VADeviceContext’?
>                                       D3D12VADecodeContext *ctx, const AVFrame *frame,
>                                       ^~~~~~~~~~~~~~~~~~~~
>                                       AVD3D11VADeviceContext
>src/ffbuild/common.mak:81: recipe for target 'libavcodec/dxva2.o' failed
>make: *** [libavcodec/dxva2.o] Error 1
>

Thanks for pointing this out. I'll add #if CONFIG_D3D12VA for this function int next patch set. BTW it seems CONFIG_D3D12VA was not automatically enabled on your side.

Thanks,
Tong

>
>[...]
>--
>Michael     GnuPG fingerprint:
>9FF2128B147EF6730BADF133611EC787040B0FAB
>
>Old school: Use the lowest level language in which you can solve the problem
>            conveniently.
>New school: Use the highest level language in which the latest supercomputer
>            can solve the problem without the user falling asleep waiting.


More information about the ffmpeg-devel mailing list