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

Måns Rullgård mans
Sun Jun 27 13:50:24 CEST 2010


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

> On Sun, Jun 27, 2010 at 12:12:49PM +0100, M?ns Rullg?rd wrote:
>> 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.
>
> As in "only suitable for values that are constant (and thus calculated
> at compile time)".

But that's not really true.  If a truncated value were needed
elsewhere, there would be no reason to not use that macro.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list