[FFmpeg-devel] [PATCH] qsv: fix the dangerous macro definitions

Carl Eugen Hoyos ceffmpeg at gmail.com
Thu Mar 28 13:48:59 EET 2019


2019-03-27 11:24 GMT+01:00, Zhong Li <zhong.li at intel.com>:
> Signed-off-by: Zhong Li <zhong.li at intel.com>
> ---
>  libavcodec/qsv_internal.h | 8 ++++----
>  libavfilter/qsvvpp.h      | 8 ++++----
>  2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
> index 394c558883..86a5dbad98 100644
> --- a/libavcodec/qsv_internal.h
> +++ b/libavcodec/qsv_internal.h
> @@ -35,12 +35,12 @@
>  #define QSV_MAX_ENC_PAYLOAD 2       // # of mfxEncodeCtrl payloads
> supported
>
>  #define QSV_VERSION_ATLEAST(MAJOR, MINOR)   \
> -    (MFX_VERSION_MAJOR > (MAJOR) ||         \
> -     MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR))
> +    ((MFX_VERSION_MAJOR > (MAJOR) ||         \
> +     MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR)))

This part is not needed, the existing code starts with an opening
parenthesis that is closed at the end of the macro.

>  #define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR) \
> -    (MFX_VERSION.Major > (MAJOR)) ||                           \
> -    (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR))
> +    ((MFX_VERSION.Major > (MAJOR)) ||                           \
> +    (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))

This one is of course correct.

Carl Eugen


More information about the ffmpeg-devel mailing list