Re: [FFmpeg-devel] [ffmpeg-devel][PATCH] Encapsulation func to get width and height

2020-03-14 Thread Carl Eugen Hoyos
Am Sa., 14. März 2020 um 10:57 Uhr schrieb numberwolf :
>
> ---
>  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

Doesn't this patch make the code less readable / isn't the existing macro
enough to easily understand above assignment?

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [ffmpeg-devel][PATCH] Encapsulation func to get width and height

2020-03-14 Thread numberwolf
---
 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
+
 // 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
 
-- 
2.17.2 (Apple Git-113)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".