[FFmpeg-devel] [PATCH] Encapsulation func to get width and height most of mb's checked oper are defined in mpegutils' marcos, so mb's checked oper about width/height should be put it together with others.
Anton Khirnov
anton at khirnov.net
Mon Mar 16 12:06:18 EET 2020
>Subject: Re: [FFmpeg-devel] [PATCH] Encapsulation func to get width and height most of mb's checked oper are defined in mpegutils' marcos, so mb's checked oper about width/height should be put it together with others.
This is not the right way to write commit messages. See git-howto.txt
and other commits in the tree.
Quoting numberwolf (2020-03-14 17:03:01)
> Reviewed-by: Carl Eugen Hoyos <ceffmpeg at gmail.com>
> Signed-off-by: numberwolf <porschegt23 at foxmail.com>
> ---
> libavcodec/mpegutils.c | 4 ++--
> libavcodec/mpegutils.h | 3 +++
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
> index c0ee3aa..819293c 100644
> --- a/libavcodec/mpegutils.c
> +++ b/libavcodec/mpegutils.c
> @@ -34,8 +34,8 @@ static int add_mb(AVMotionVector *mb, uint32_t mb_type,
> int motion_x, int motion_y, int motion_scale,
> int direction)
> {
> - mb->w = IS_8X8(mb_type) || IS_8X16(mb_type) ? 8 : 16;
> - mb->h = IS_8X8(mb_type) || IS_16X8(mb_type) ? 8 : 16;
> + mb->w = MB_SIZE_WIDTH(mb_type);
> + mb->h = MB_SIZE_HEIGHT(mb_type);
> mb->motion_x = motion_x;
> mb->motion_y = motion_y;
> mb->motion_scale = motion_scale;
> diff --git a/libavcodec/mpegutils.h b/libavcodec/mpegutils.h
> index 1ed21c1..ed59716 100644
> --- a/libavcodec/mpegutils.h
> +++ b/libavcodec/mpegutils.h
> @@ -95,6 +95,9 @@
> #define IS_QUANT(a) ((a) & MB_TYPE_QUANT)
> #define IS_DIR(a, part, list) ((a) & (MB_TYPE_P0L0 << ((part) + 2 * (list))))
>
> +#define MB_SIZE_WIDTH(a) (((a) & MB_TYPE_8x8) || ((a) & MB_TYPE_8x16)) ? 8 : 16
> +#define MB_SIZE_HEIGHT(a) (((a) & MB_TYPE_8x8) || ((a) & MB_TYPE_16x8)) ? 8 : 16
Why are you testing the type directly instead of using the IS_* macros
as the original code does?
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list