changeset 15054:d8f97f45cfbe

10l, integer overflow. who uses 14 fractional bits?! only faad developers.... *sigh*
author rfelker
date Tue, 05 Apr 2005 05:43:41 +0000
parents f2fa02814093
children cec31d399b8a
files libfaad2/output.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libfaad2/output.c	Mon Apr 04 23:31:33 2005 +0000
+++ b/libfaad2/output.c	Tue Apr 05 05:43:41 2005 +0000
@@ -573,10 +573,10 @@
         for(i = 0; i < frame_len; i++)
         {
 	    int32_t tmp;
-	    tmp = ((ch1[i]<<2) + ((ch0[i]+ch3[i])<<1) + (ch0[i]+ch3[i]) + (1<<(REAL_BITS+2))) >> (REAL_BITS+3);
+	    tmp = (ch1[i] + ((ch0[i]+ch3[i])>>1) + ((ch0[i]+ch3[i])>>2) + (1<<(REAL_BITS))) >> (REAL_BITS+1);
 	    if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000;
             short_sample_buffer[0] = tmp;
-	    tmp = ((ch2[i]<<2) + ((ch0[i]+ch4[i])<<1) + (ch0[i]+ch4[i]) + (1<<(REAL_BITS+2))) >> (REAL_BITS+3);
+	    tmp = (ch2[i] + ((ch0[i]+ch4[i])>>1) + ((ch0[i]+ch4[i])>>2) + (1<<(REAL_BITS))) >> (REAL_BITS+1);
 	    if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000;
             short_sample_buffer[1] = tmp;
 	    short_sample_buffer += channels;