[FFmpeg-soc] [PATCH 1/5] Use av_clip_int16() in FIX15(). Output will differ now in some cases, but the AC3 regtest is unchanged.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Nov 17 07:58:22 CET 2010


On Wed, Nov 17, 2010 at 02:58:40AM +0000, Ronald S. Bultje wrote:
> Hi,
> 
> On Wed, Nov 17, 2010 at 2:37 AM, Justin Ruggles
> <justin.ruggles at gmail.com> wrote:
> > +/** convert float in range [-1..1] to int16_t in range [-32768..32767] */
> > +#define FIX15(a) ((int16_t)av_clip_int16((int)(a * (float)(1 << 15))))
> 
> -32768, so you might want to update the comment.

Huh? He did.

> Also, is the cast at
> the start needed (int16_t)?

Shouldn't be, and removing it might well result in faster code.
However, in the description of this patch for example I
missed an explanation of why, I guess here it is for speed
reasons.
Could you please look at the commit messages when committing
and make sure they explain why you are making changes (and
in this case also why output might change and why you think
it does not matter)?
Just saying you use av_clip_int16 is a bit pointless, that
is quite obvious from the patch ;-)


More information about the FFmpeg-soc mailing list