[FFmpeg-devel] [PATCH] libavcodec/dxva2.c: fix dxva2 does not support H264 baseline profile

Benjamin Cheng ben at bcheng.me
Sat Oct 14 19:36:42 EEST 2023


On Fri Oct 13, 2023 at 11:59 PM EDT, xyz1001 wrote:
> dxva2 fail to init when decode h264 with baseline profile becase `prof_h264_high` does not contains `AV_PROFILE_H264_BASELINE` and `dxva_check_codec_compatibility` will return error

prof_h264_high uses either DXVA2_ModeH264_E or DXVA2_ModeH264_F, which
only supports up to H.264 High, and H.264 Baseline has features that are
not in High. You have to use a different DXVA profile for Baseline.

> ---
>  libavcodec/dxva2.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
> index d7bc587562..e6b83f89cc 100644
> --- a/libavcodec/dxva2.c
> +++ b/libavcodec/dxva2.c
> @@ -61,7 +61,8 @@ typedef struct dxva_mode {
>  static const int prof_mpeg2_main[]   = {AV_PROFILE_MPEG2_SIMPLE,
>                                          AV_PROFILE_MPEG2_MAIN,
>                                          AV_PROFILE_UNKNOWN};
> -static const int prof_h264_high[]    = {AV_PROFILE_H264_CONSTRAINED_BASELINE,
> +static const int prof_h264_high[]    = {AV_PROFILE_H264_BASELINE,
> +                                        AV_PROFILE_H264_CONSTRAINED_BASELINE,
>                                          AV_PROFILE_H264_MAIN,
>                                          AV_PROFILE_H264_HIGH,
>                                          AV_PROFILE_UNKNOWN};



More information about the ffmpeg-devel mailing list