diff imc.c @ 12391:4be72e19ab0e libavcodec

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.
author mru
date Thu, 19 Aug 2010 16:51:26 +0000
parents 93ba40eb28b9
children
line wrap: on
line diff
--- a/imc.c	Wed Aug 18 13:50:32 2010 +0000
+++ b/imc.c	Thu Aug 19 16:51:26 2010 +0000
@@ -362,7 +362,7 @@
         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;