[FFmpeg-devel] [RFC] motion_est: avoid implicit truncation warnings

Måns Rullgård mans
Sun Jun 27 13:12:49 CEST 2010

Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:

> Hello,
> maybe a bit ugly to add an extra macro, but using the changed macro
> everywhere produces very different code at least on x86_64.
> Index: libavcodec/motion_est.c
> ===================================================================
> --- libavcodec/motion_est.c	(revision 23819)
> +++ libavcodec/motion_est.c	(working copy)
> @@ -1476,6 +1476,7 @@
>      const int xmax= c->xmax<<shift;
>      const int ymax= c->ymax<<shift;
>  #define HASH(fx,fy,bx,by) ((fx)+17*(fy)+63*(bx)+117*(by))
> +#define HASH_CONST(fx,fy,bx,by) ((uint8_t)HASH(fx,fy,bx,by))

What is CONST supposed to signify here.  There is nothing const about
the macro at all.  HASH8 would seem a better name.

Thanks for looking into this.  Those warnings were beginning to bug

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list