[FFmpeg-cvslog] r24838 - trunk/libavcodec/imc.c

mru subversion
Thu Aug 19 18:51:26 CEST 2010


Author: mru
Date: Thu Aug 19 18:51:26 2010
New Revision: 24838

Log:
imc: fix undefined float to int conversion

Conversion of an out of range float to int is undefined.  Clipping to
the final range first avoids such problems.  This fixes decoding on
MIPS, which handles these conversions differently from many other CPUs.

Modified:
   trunk/libavcodec/imc.c

Modified: trunk/libavcodec/imc.c
==============================================================================
--- trunk/libavcodec/imc.c	Thu Aug 19 18:51:24 2010	(r24837)
+++ trunk/libavcodec/imc.c	Thu Aug 19 18:51:26 2010	(r24838)
@@ -362,7 +362,7 @@ static int bit_allocation (IMCContext* q
         iacc = 0;
 
         for(j = (stream_format_code & 0x2)?4:0; j < BANDS; j++) {
-            cwlen = av_clip((int)((q->flcoeffs4[j] * 0.5) - summa + 0.5), 0, 6);
+            cwlen = av_clipf(((q->flcoeffs4[j] * 0.5) - summa + 0.5), 0, 6);
 
             q->bitsBandT[j] = cwlen;
             summer += q->bandWidthT[j] * cwlen;



More information about the ffmpeg-cvslog mailing list