diff mbox series

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

Message ID 20231014035957.66508-1-zgzf1001@gmail.com
State New
Headers show
Series [FFmpeg-devel] libavcodec/dxva2.c: fix dxva2 does not support H264 baseline profile | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

xyz1001 Oct. 14, 2023, 3:59 a.m. UTC
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
---
 libavcodec/dxva2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Benjamin Cheng Oct. 14, 2023, 4:36 p.m. UTC | #1
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};
Hendrik Leppkes Oct. 14, 2023, 5:10 p.m. UTC | #2
On Sat, Oct 14, 2023 at 6:02 AM xyz1001 <zgzf1001@gmail.com> 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
> ---
>  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};

Baseline is not compatible with main/high profile accelerators.
There is only one profile defined by DXVA2 that supports Baseline
completely, and I have never seen a GPU expose it - and we don't
support it.

- Hendrik
diff mbox series

Patch

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};