diff mbox

[FFmpeg-devel] lavc/qsvenc: disable CO3 for mpeg2

Message ID 20190428123529.22572-1-zhong.li@intel.com
State New
Headers show

Commit Message

Zhong Li April 28, 2019, 12:35 p.m. UTC
Currenntly there is no any function of CO3 appled to mpeg2,
and enabling for mpeg2 it will cause regression with some old
libmfx libaries (see tiket #7839), so disable CO3 for mpeg2.

Also add runtime version check for CO3.

Signed-off-by: Zhong Li <zhong.li@intel.com>
---
 libavcodec/qsvenc.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Carl Eugen Hoyos April 28, 2019, 10:31 p.m. UTC | #1
2019-04-28 14:35 GMT+02:00, Zhong Li <zhong.li@intel.com>:
> Currenntly there is no any function of CO3 appled to mpeg2,
> and enabling for mpeg2 it will cause regression with some old
> libmfx libaries (see tiket #7839), so disable CO3 for mpeg2.
>
> Also add runtime version check for CO3.
>
> Signed-off-by: Zhong Li <zhong.li@intel.com>
> ---
>  libavcodec/qsvenc.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index a03ab69590..e0886aeedb 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -750,15 +750,18 @@ FF_ENABLE_DEPRECATION_WARNINGS
>              }
>  #endif
>          }
> +
> +        if (avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO &&
> QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 11)) {
>  #if QSV_HAVE_CO3
> -        q->extco3.Header.BufferId      = MFX_EXTBUFF_CODING_OPTION3;
> -        q->extco3.Header.BufferSz      = sizeof(q->extco3);
> +            q->extco3.Header.BufferId      = MFX_EXTBUFF_CODING_OPTION3;
> +            q->extco3.Header.BufferSz      = sizeof(q->extco3);
>  #if QSV_HAVE_GPB
> -        if (avctx->codec_id == AV_CODEC_ID_HEVC)
> -            q->extco3.GPB              = q->gpb ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
> +            if (avctx->codec_id == AV_CODEC_ID_HEVC)
> +                q->extco3.GPB              = q->gpb ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>  #endif
> -        q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer
> *)&q->extco3;
> +            q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer
> *)&q->extco3;
>  #endif
> +        }

Please separate the cosmetic from the function change(s) to make
the patch more readable.

Thank you, Carl Eugen
diff mbox

Patch

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index a03ab69590..e0886aeedb 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -750,15 +750,18 @@  FF_ENABLE_DEPRECATION_WARNINGS
             }
 #endif
         }
+
+        if (avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO && QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 11)) {
 #if QSV_HAVE_CO3
-        q->extco3.Header.BufferId      = MFX_EXTBUFF_CODING_OPTION3;
-        q->extco3.Header.BufferSz      = sizeof(q->extco3);
+            q->extco3.Header.BufferId      = MFX_EXTBUFF_CODING_OPTION3;
+            q->extco3.Header.BufferSz      = sizeof(q->extco3);
 #if QSV_HAVE_GPB
-        if (avctx->codec_id == AV_CODEC_ID_HEVC)
-            q->extco3.GPB              = q->gpb ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
+            if (avctx->codec_id == AV_CODEC_ID_HEVC)
+                q->extco3.GPB              = q->gpb ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
 #endif
-        q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco3;
+            q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco3;
 #endif
+        }
     }
 
     if (!check_enc_param(avctx,q)) {