diff mbox series

[FFmpeg-devel] 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.

Message ID 20200314160301.23900-1-porschegt23@foxmail.com
State New
Headers show
Series [FFmpeg-devel] 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. | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

numberwolf March 14, 2020, 4:03 p.m. UTC
Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: numberwolf <porschegt23@foxmail.com>
---
 libavcodec/mpegutils.c | 4 ++--
 libavcodec/mpegutils.h | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Anton Khirnov March 16, 2020, 10:06 a.m. UTC | #1
>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@gmail.com>
> Signed-off-by: numberwolf <porschegt23@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?
diff mbox series

Patch

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
+
 // does this mb use listX, note does not work if subMBs
 #define USES_LIST(a, list) ((a) & ((MB_TYPE_P0L0 | MB_TYPE_P1L0) << (2 * (list))))