[SCM] libav/experimental: imc: fix undefined float to int conversion

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 17:14:15 UTC 2013


The following commit has been merged in the experimental branch:
commit dd5f3238c13e2a6a2caf4d550113219d73122fde
Author: Måns Rullgård <mans at mansr.com>
Date:   Thu Aug 19 16:51:26 2010 +0000

    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.
    
    Originally committed as revision 24838 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index b549375..730d821 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -362,7 +362,7 @@ static int bit_allocation (IMCContext* q, int stream_format_code, int freebits,
         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;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list