[MPlayer-dev-eng] Re: [PATCH] sync libfaad2 CVS 5-1-04 large

D Richard Felker III dalias at aerifal.cx
Mon May 3 03:18:00 CEST 2004


On Mon, May 03, 2004 at 01:05:55AM +0000, adland wrote:
> > I went to great lengths
> > to remove all the uint16_t's from cfft.c and several other files, as
> > well as adding some better fixed point asm for x86.
>  
> just curious because these changes you did do not show up in the CVS info
> for this file libfaad2/cfft.c

That's because I haven't committed them. :)

> > - Apply my patches and forget about sync with upstream.
> Just curious where are your patches to try?

Attached now.

> > - Beg someone to write an AAC decoder for libavcodec and remove this
> >   shitty code from MPlayer cvs entirely.
> 
> not within my capabilities.

:(

Rich

-------------- next part --------------
Index: libfaad2/Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libfaad2/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- libfaad2/Makefile	3 Oct 2003 22:22:27 -0000	1.2
+++ libfaad2/Makefile	3 May 2004 01:13:40 -0000
@@ -6,7 +6,7 @@
 SRCS    = bits.c cfft.c common.c decoder.c dither.c drc.c error.c filtbank.c hcr.c huffman.c ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c pulse.c rvlc.c sbr_dct.c sbr_dec.c sbr_e_nf.c sbr_fbt.c sbr_hfadj.c sbr_hfgen.c sbr_huff.c sbr_qmf.c sbr_syntax.c sbr_tf_grid.c specrec.c ssr.c ssr_fb.c ssr_ipqf.c syntax.c tns.c
 OBJS	= $(SRCS:.c=.o)
 
-CFLAGS  = -I. $(OPTFLAGS) 
+CFLAGS  = -I. $(OPTFLAGS) -DFIXED_POINT
 
 .SUFFIXES: .c .o
 
Index: libfaad2/cfft.c
===================================================================
RCS file: /cvsroot/mplayer/main/libfaad2/cfft.c,v
retrieving revision 1.2
diff -u -r1.2 cfft.c
--- libfaad2/cfft.c	3 Oct 2003 22:22:27 -0000	1.2
+++ libfaad2/cfft.c	3 May 2004 01:13:40 -0000
@@ -55,40 +55,64 @@
 static void passf2(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch,
                    complex_t *wa, int8_t isign)
 {
-    uint16_t i, k, ah, ac;
+    int i, k, ah, ac;
+    int l1_1 = l1;
+    int ido_1 = ido, ido_l1 = ido_1*l1_1;
 
-    if (ido == 1)
+    if (ido_1 == 1)
     {
-        for (k = 0; k < l1; k++)
+        for (k = 0; k < l1_1; k++)
         {
             ah = 2*k;
             ac = 4*k;
 
             RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]);
-            RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]);
+            RE(ch[ah+l1_1]) = RE(cc[ac]) - RE(cc[ac+1]);
             IM(ch[ah])    = IM(cc[ac]) + IM(cc[ac+1]);
-            IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
+            IM(ch[ah+l1_1]) = IM(cc[ac]) - IM(cc[ac+1]);
         }
     } else {
-        for (k = 0; k < l1; k++)
+      if (isign == 1) {
+        for (k = 0; k < l1_1; k++)
         {
-            ah = k*ido;
-            ac = 2*k*ido;
+            ah = k*ido_1;
+            ac = 2*k*ido_1;
 
-            for (i = 0; i < ido; i++)
+            for (i = 0; i < ido_1; i++)
             {
                 complex_t t2;
 
-                RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]);
-                RE(t2)       = RE(cc[ac+i]) - RE(cc[ac+i+ido]);
+                RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido_1]);
+                RE(t2)       = RE(cc[ac+i]) - RE(cc[ac+i+ido_1]);
 
-                IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]);
-                IM(t2)       = IM(cc[ac+i]) - IM(cc[ac+i+ido]);
+                IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido_1]);
+                IM(t2)       = IM(cc[ac+i]) - IM(cc[ac+i+ido_1]);
 
-                RE(ch[ah+i+l1*ido]) = MUL_R_C(RE(t2),RE(wa[i])) - MUL_R_C(IM(t2),IM(wa[i]))*isign;
-                IM(ch[ah+i+l1*ido]) = MUL_R_C(IM(t2),RE(wa[i])) + MUL_R_C(RE(t2),IM(wa[i]))*isign;
+                RE(ch[ah+i+ido_l1]) = MUL_R_C(RE(t2),RE(wa[i])) - MUL_R_C(IM(t2),IM(wa[i]));
+                IM(ch[ah+i+ido_l1]) = MUL_R_C(IM(t2),RE(wa[i])) + MUL_R_C(RE(t2),IM(wa[i]));
             }
         }
+      } else if (isign == -1) {
+        for (k = 0; k < l1_1; k++)
+        {
+            ah = k*ido_1;
+            ac = 2*k*ido_1;
+
+            for (i = 0; i < ido_1; i++)
+            {
+                complex_t t2;
+
+                RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido_1]);
+                RE(t2)       = RE(cc[ac+i]) - RE(cc[ac+i+ido_1]);
+
+                IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido_1]);
+                IM(t2)       = IM(cc[ac+i]) - IM(cc[ac+i+ido_1]);
+
+                RE(ch[ah+i+ido_l1]) = MUL_R_C(RE(t2),RE(wa[i])) + MUL_R_C(IM(t2),IM(wa[i]));
+                IM(ch[ah+i+ido_l1]) = MUL_R_C(IM(t2),RE(wa[i])) - MUL_R_C(RE(t2),IM(wa[i]));
+            }
+        }
+      }
     }
 }
 
@@ -98,7 +122,7 @@
 {
     static real_t taur = COEF_CONST(-0.5);
     static real_t taui = COEF_CONST(0.866025403784439);
-    uint16_t i, k, ac, ah;
+    int i, k, ac, ah;
     complex_t c2, c3, d2, d3, t2;
 
     if (ido == 1)
@@ -161,11 +185,87 @@
 static void passf4(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch,
                    complex_t *wa1, complex_t *wa2, complex_t *wa3, int8_t isign)
 {
-    uint16_t i, k, ac, ah;
+    int i, k, ac, ah;
+    int l1_1 = l1, l1_2 = 2*l1_1, l1_3 = 3*l1_1;
+    int ido_1 = ido, ido_2 = 2*ido_1, ido_3 = 3*ido_1;
+    int ido_l1 = l1*ido_1, ido_l1_2 = 2*ido_l1, ido_l1_3 = 3*ido_l1;
+
+    if (isign == 1)
+    {
+    if (ido_1 == 1)
+    {
+        for (k = 0; k < l1_1; k++)
+        {
+            complex_t t1, t2, t3, t4;
+
+            ac = 4*k;
+            ah = k;
+
+            RE(t2) = RE(cc[ac]) + RE(cc[ac+2]);
+            RE(t1) = RE(cc[ac]) - RE(cc[ac+2]);
+            IM(t2) = IM(cc[ac])   + IM(cc[ac+2]);
+            IM(t1) = IM(cc[ac]) - IM(cc[ac+2]);
+            RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]);
+            IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]);
+            IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]);
+            RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]);
+
+            RE(ch[ah]) = RE(t2) + RE(t3);
+            RE(ch[ah+l1_2]) = RE(t2) - RE(t3);
+
+            IM(ch[ah])      = IM(t2) + IM(t3);
+            IM(ch[ah+l1_2]) = IM(t2) - IM(t3);
+
+            RE(ch[ah+l1_1])   = RE(t1) + RE(t4);
+            RE(ch[ah+l1_3]) = RE(t1) - RE(t4);
+
+            IM(ch[ah+l1_1])   = IM(t1) + IM(t4);
+            IM(ch[ah+l1_3]) = IM(t1) - IM(t4);
+        }
+    } else {
+        for (k = 0; k < l1_1; k++)
+        {
+            ac = 4*k*ido_1;
+            ah = k*ido_1;
+
+            for (i = 0; i < ido_1; i++)
+            {
+                complex_t c2, c3, c4, t1, t2, t3, t4;
+
+                RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+ido_2]);
+                RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+ido_2]);
+                IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+ido_2]);
+                IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+ido_2]);
+                RE(t3) = RE(cc[ac+i+ido_1]) + RE(cc[ac+i+ido_3]);
+                IM(t4) = RE(cc[ac+i+ido_1]) - RE(cc[ac+i+ido_3]);
+                IM(t3) = IM(cc[ac+i+ido_3]) + IM(cc[ac+i+ido_1]);
+                RE(t4) = IM(cc[ac+i+ido_3]) - IM(cc[ac+i+ido_1]);
+
+                RE(c2) = RE(t1) + RE(t4);
+                RE(c4) = RE(t1) - RE(t4);
 
+                IM(c2) = IM(t1) + IM(t4);
+                IM(c4) = IM(t1) - IM(t4);
+
+                RE(ch[ah+i]) = RE(t2) + RE(t3);
+                RE(c3) = RE(t2) - RE(t3);
+
+                IM(ch[ah+i]) = IM(t2) + IM(t3);
+                IM(c3) = IM(t2) - IM(t3);
+
+                IM(ch[ah+i+ido_l1])   = MUL_R_C(IM(c2),RE(wa1[i])) + MUL_R_C(RE(c2),IM(wa1[i]));
+                RE(ch[ah+i+ido_l1])   = MUL_R_C(RE(c2),RE(wa1[i])) - MUL_R_C(IM(c2),IM(wa1[i]));
+                IM(ch[ah+i+ido_l1_2]) = MUL_R_C(IM(c3),RE(wa2[i])) + MUL_R_C(RE(c3),IM(wa2[i]));
+                RE(ch[ah+i+ido_l1_2]) = MUL_R_C(RE(c3),RE(wa2[i])) - MUL_R_C(IM(c3),IM(wa2[i]));
+                IM(ch[ah+i+ido_l1_3]) = MUL_R_C(IM(c4),RE(wa3[i])) + MUL_R_C(RE(c4),IM(wa3[i]));
+                RE(ch[ah+i+ido_l1_3]) = MUL_R_C(RE(c4),RE(wa3[i])) - MUL_R_C(IM(c4),IM(wa3[i]));
+            }
+        }
+    }
+    } else if (isign == -1) {
     if (ido == 1)
     {
-        for (k = 0; k < l1; k++)
+        for (k = 0; k < l1_1; k++)
         {
             complex_t t1, t2, t3, t4;
 
@@ -182,41 +282,41 @@
             RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]);
 
             RE(ch[ah]) = RE(t2) + RE(t3);
-            RE(ch[ah+2*l1]) = RE(t2) - RE(t3);
+            RE(ch[ah+l1_2]) = RE(t2) - RE(t3);
 
             IM(ch[ah])      = IM(t2) + IM(t3);
-            IM(ch[ah+2*l1]) = IM(t2) - IM(t3);
+            IM(ch[ah+l1_2]) = IM(t2) - IM(t3);
 
-            RE(ch[ah+l1])   = RE(t1) + RE(t4)*isign;
-            RE(ch[ah+3*l1]) = RE(t1) - RE(t4)*isign;
+            RE(ch[ah+l1_1])   = RE(t1) - RE(t4);
+            RE(ch[ah+l1_3]) = RE(t1) + RE(t4);
 
-            IM(ch[ah+l1])   = IM(t1) + IM(t4)*isign;
-            IM(ch[ah+3*l1]) = IM(t1) - IM(t4)*isign;
+            IM(ch[ah+l1_1])   = IM(t1) - IM(t4);
+            IM(ch[ah+l1_3]) = IM(t1) + IM(t4);
         }
     } else {
-        for (k = 0; k < l1; k++)
+        for (k = 0; k < l1_1; k++)
         {
-            ac = 4*k*ido;
-            ah = k*ido;
+            ac = 4*k*ido_1;
+            ah = k*ido_1;
 
-            for (i = 0; i < ido; i++)
+            for (i = 0; i < ido_1; i++)
             {
                 complex_t c2, c3, c4, t1, t2, t3, t4;
 
-                RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]);
-                RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]);
-                IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]);
-                IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]);
-                RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]);
-                IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]);
-                IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]);
-                RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]);
+                RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+ido_2]);
+                RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+ido_2]);
+                IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+ido_2]);
+                IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+ido_2]);
+                RE(t3) = RE(cc[ac+i+ido_1]) + RE(cc[ac+i+ido_3]);
+                IM(t4) = RE(cc[ac+i+ido_1]) - RE(cc[ac+i+ido_3]);
+                IM(t3) = IM(cc[ac+i+ido_3]) + IM(cc[ac+i+ido_1]);
+                RE(t4) = IM(cc[ac+i+ido_3]) - IM(cc[ac+i+ido_1]);
 
-                RE(c2) = RE(t1) + RE(t4)*isign;
-                RE(c4) = RE(t1) - RE(t4)*isign;
+                RE(c2) = RE(t1) - RE(t4);
+                RE(c4) = RE(t1) + RE(t4);
 
-                IM(c2) = IM(t1) + IM(t4)*isign;
-                IM(c4) = IM(t1) - IM(t4)*isign;
+                IM(c2) = IM(t1) - IM(t4);
+                IM(c4) = IM(t1) + IM(t4);
 
                 RE(ch[ah+i]) = RE(t2) + RE(t3);
                 RE(c3) = RE(t2) - RE(t3);
@@ -224,15 +324,16 @@
                 IM(ch[ah+i]) = IM(t2) + IM(t3);
                 IM(c3) = IM(t2) - IM(t3);
 
-                IM(ch[ah+i+l1*ido])   = MUL_R_C(IM(c2),RE(wa1[i])) + MUL_R_C(RE(c2),IM(wa1[i]))*isign;
-                RE(ch[ah+i+l1*ido])   = MUL_R_C(RE(c2),RE(wa1[i])) - MUL_R_C(IM(c2),IM(wa1[i]))*isign;
-                IM(ch[ah+i+2*l1*ido]) = MUL_R_C(IM(c3),RE(wa2[i])) + MUL_R_C(RE(c3),IM(wa2[i]))*isign;
-                RE(ch[ah+i+2*l1*ido]) = MUL_R_C(RE(c3),RE(wa2[i])) - MUL_R_C(IM(c3),IM(wa2[i]))*isign;
-                IM(ch[ah+i+3*l1*ido]) = MUL_R_C(IM(c4),RE(wa3[i])) + MUL_R_C(RE(c4),IM(wa3[i]))*isign;
-                RE(ch[ah+i+3*l1*ido]) = MUL_R_C(RE(c4),RE(wa3[i])) - MUL_R_C(IM(c4),IM(wa3[i]))*isign;
+                IM(ch[ah+i+ido_l1])   = MUL_R_C(IM(c2),RE(wa1[i])) - MUL_R_C(RE(c2),IM(wa1[i]));
+                RE(ch[ah+i+ido_l1])   = MUL_R_C(RE(c2),RE(wa1[i])) + MUL_R_C(IM(c2),IM(wa1[i]));
+                IM(ch[ah+i+ido_l1_2]) = MUL_R_C(IM(c3),RE(wa2[i])) - MUL_R_C(RE(c3),IM(wa2[i]));
+                RE(ch[ah+i+ido_l1_2]) = MUL_R_C(RE(c3),RE(wa2[i])) + MUL_R_C(IM(c3),IM(wa2[i]));
+                IM(ch[ah+i+ido_l1_3]) = MUL_R_C(IM(c4),RE(wa3[i])) - MUL_R_C(RE(c4),IM(wa3[i]));
+                RE(ch[ah+i+ido_l1_3]) = MUL_R_C(RE(c4),RE(wa3[i])) + MUL_R_C(IM(c4),IM(wa3[i]));
             }
         }
     }
+    }
 }
 
 
@@ -244,7 +345,7 @@
     static real_t ti11 = COEF_CONST(0.951056516295154);
     static real_t tr12 = COEF_CONST(-0.809016994374947);
     static real_t ti12 = COEF_CONST(0.587785252292473);
-    uint16_t i, k, ac, ah;
+    int i, k, ac, ah;
     complex_t c2, c3, c4, c5, d3, d4, d5, d2, t2, t3, t4, t5;
 
     if (ido == 1)
@@ -343,9 +444,9 @@
 INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch,
                    uint16_t *ifac, complex_t *wa, int8_t isign)
 {
-    uint16_t i;
-    uint16_t k1, l1, l2;
-    uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1;
+    int i;
+    int k1, l1, l2;
+    int na, nf, ip, iw, ix2, ix3, ix4, ido, idl1;
 
     nf = ifac[1];
     na = 0;
@@ -430,16 +531,16 @@
 
 static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac)
 {
-    static uint16_t ntryh[4] = {3, 4, 2, 5};
+    static int ntryh[4] = {3, 4, 2, 5};
 #ifndef FIXED_POINT
     real_t arg, argh, argld, fi;
-    uint16_t ido, ipm;
-    uint16_t i1, k1, l1, l2;
-    uint16_t ld, ii, ip;
+    int ido, ipm;
+    int i1, k1, l1, l2;
+    int ld, ii, ip;
 #endif
-    uint16_t ntry, i, j;
-    uint16_t ib;
-    uint16_t nf, nl, nq, nr;
+    int ntry, i, j;
+    int ib;
+    int nf, nl, nq, nr;
 
     nl = n;
     nf = 0;
Index: libfaad2/fixed.h
===================================================================
RCS file: /cvsroot/mplayer/main/libfaad2/fixed.h,v
retrieving revision 1.2
diff -u -r1.2 fixed.h
--- libfaad2/fixed.h	3 Oct 2003 22:22:27 -0000	1.2
+++ libfaad2/fixed.h	3 May 2004 01:13:40 -0000
@@ -127,6 +127,50 @@
        return arm_mul( A, B, COEF_BITS);
 }
 
+#elif defined(__GNUC__) && defined (ARCH_X86)
+
+/* multiply real with real */
+static INLINE real_t MUL(real_t A, real_t B)
+{
+    real_t ret;
+    asm("imul %2 \n\t"
+        "shrl %3, %%eax \n\t"
+	"shll %4, %%edx \n\t"
+	"orl %%edx, %%eax \n\t"
+	: "=a" (ret)
+	: "a" (A), "r" (B), "I" (REAL_BITS), "I" (32-REAL_BITS)
+	: "edx");
+    return ret;
+}
+
+/* multiply coef with coef */
+static INLINE real_t MUL_C_C(real_t A, real_t B)
+{
+    real_t ret;
+    asm("imul %2 \n\t"
+        "shrl %3, %%eax \n\t"
+	"shll %4, %%edx \n\t"
+	"orl %%edx, %%eax \n\t"
+	: "=a" (ret)
+	: "a" (A), "r" (B), "I" (COEF_BITS), "I" (32-COEF_BITS)
+	: "edx");
+    return ret;
+}
+
+/* multiply real with coef */
+static INLINE real_t MUL_R_C(real_t A, real_t B)
+{
+    real_t ret;
+    asm("imul %2 \n\t"
+        "shrl %3, %%eax \n\t"
+	"shll %4, %%edx \n\t"
+	"orl %%edx, %%eax \n\t"
+	: "=a" (ret)
+	: "a" (A), "r" (B), "I" (COEF_BITS), "I" (32-COEF_BITS)
+	: "edx");
+    return ret;
+}
+
 #else
 
   /* multiply real with real */
Index: libfaad2/mdct.c
===================================================================
RCS file: /cvsroot/mplayer/main/libfaad2/mdct.c,v
retrieving revision 1.2
diff -u -r1.2 mdct.c
--- libfaad2/mdct.c	3 Oct 2003 22:22:27 -0000	1.2
+++ libfaad2/mdct.c	3 May 2004 01:13:40 -0000
@@ -194,16 +194,16 @@
 
 void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
 {
-    uint16_t k;
+    int k;
 
     complex_t x;
     complex_t *Z1 = mdct->Z1;
     complex_t *sincos = mdct->sincos;
 
-    uint16_t N  = mdct->N;
-    uint16_t N2 = N >> 1;
-    uint16_t N4 = N >> 2;
-    uint16_t N8 = N >> 3;
+    int N  = mdct->N;
+    int N2 = N >> 1;
+    int N4 = N >> 2;
+    int N8 = N >> 3;
 
     /* pre-IFFT complex multiplication */
     for (k = 0; k < N4; k++)
@@ -242,23 +242,23 @@
 #ifdef LTP_DEC
 void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
 {
-    uint16_t k;
+    int k;
 
     complex_t x;
     complex_t *Z1 = mdct->Z1;
     complex_t *sincos = mdct->sincos;
 
-    uint16_t N  = mdct->N;
-    uint16_t N2 = N >> 1;
-    uint16_t N4 = N >> 2;
-    uint16_t N8 = N >> 3;
+    int N  = mdct->N;
+    int N2 = N >> 1;
+    int N4 = N >> 2;
+    int N8 = N >> 3;
 
 	real_t scale = REAL_CONST(N);
 
     /* pre-FFT complex multiplication */
     for (k = 0; k < N8; k++)
     {
-        uint16_t n = k << 1;
+        int n = k << 1;
         RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 +     n];
         IM(x) = X_in[    N4 +     n] - X_in[    N4 - 1 - n];
 
Index: libfaad2/output.c
===================================================================
RCS file: /cvsroot/mplayer/main/libfaad2/output.c,v
retrieving revision 1.2
diff -u -r1.2 output.c
--- libfaad2/output.c	3 Oct 2003 22:22:27 -0000	1.2
+++ libfaad2/output.c	3 May 2004 01:13:40 -0000
@@ -220,21 +220,38 @@
                     real_t **input, void *sample_buffer, uint8_t channels,
                     uint16_t frame_len, uint8_t format)
 {
-    uint8_t ch;
-    uint16_t i;
+    int ch;
+    int i;
     int16_t *short_sample_buffer = (int16_t*)sample_buffer;
 
+    if (hDecoder->downMatrix) {
+        for(i = 0; i < frame_len; i++)
+        {
+            for (ch = 0; ch < 2; ch++)
+            {
+                int32_t tmp = (input[ch+1][i]>>1)+(input[0][i]>>2)+(input[ch+3][i]>>2);
+                tmp += (1 << (REAL_BITS-1));
+                tmp >>= REAL_BITS;
+                if (tmp > 0x7fff)       tmp = 0x7fff;
+                else if (tmp <= -32768) tmp = -32768;
+                short_sample_buffer[ch] = (int16_t)tmp;
+            }
+	    short_sample_buffer += channels;
+        }
+        return sample_buffer;
+    }
+
     /* Copy output to a standard PCM buffer */
-    for (ch = 0; ch < channels; ch++)
+    for(i = 0; i < frame_len; i++)
     {
-        for(i = 0; i < frame_len; i++)
+        for (ch = 0; ch < channels; ch++)
         {
             int32_t tmp = input[ch][i];
             tmp += (1 << (REAL_BITS-1));
             tmp >>= REAL_BITS;
             if (tmp > 0x7fff)       tmp = 0x7fff;
             else if (tmp <= -32768) tmp = -32768;
-            short_sample_buffer[(i*channels)+ch] = (int16_t)tmp;
+            *(short_sample_buffer++) = (int16_t)tmp;
         }
     }
 
Index: libfaad2/sbr_dct.c
===================================================================
RCS file: /cvsroot/mplayer/main/libfaad2/sbr_dct.c,v
retrieving revision 1.2
diff -u -r1.2 sbr_dct.c
--- libfaad2/sbr_dct.c	3 Oct 2003 22:22:27 -0000	1.2
+++ libfaad2/sbr_dct.c	3 May 2004 01:13:41 -0000
@@ -380,7 +380,7 @@
 
 void DCT2_64_unscaled(real_t *y, real_t *x)
 {
-    int16_t i0;
+    int i0;
     real_t f2, f3, f4, f5, f6, f7, f8, f9, f10;
     real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
     real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
@@ -1098,7 +1098,7 @@
 
 void DCT4_64(real_t *y, real_t *x)
 {
-    int16_t i0;
+    int i0;
     real_t f2;
     real_t f3;
     real_t f4;
Index: libfaad2/sbr_qmf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libfaad2/sbr_qmf.c,v
retrieving revision 1.2
diff -u -r1.2 sbr_qmf.c
--- libfaad2/sbr_qmf.c	3 Oct 2003 22:22:27 -0000	1.2
+++ libfaad2/sbr_qmf.c	3 May 2004 01:13:41 -0000
@@ -62,7 +62,7 @@
 void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
                          qmf_t *X, uint8_t offset, uint8_t kx)
 {
-    uint8_t l;
+    int l;
     real_t u[64];
 #ifndef SBR_LOW_POWER
     real_t x[64], y[64];
@@ -74,7 +74,7 @@
     /* qmf subsample l */
     for (l = 0; l < sbr->numTimeSlotsRate; l++)
     {
-        int16_t n;
+        int n;
 
         /* shift input buffer x */
         memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t));
@@ -184,8 +184,8 @@
 void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t *X,
                           real_t *output)
 {
-    uint8_t l;
-    int16_t n, k;
+    int l;
+    int n, k;
     real_t x[64];
     real_t *outptr = output;
 
@@ -248,8 +248,8 @@
 void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t *X,
                           real_t *output)
 {
-    uint8_t l;
-    int16_t n, k;
+    int l;
+    int n, k;
     real_t x1[64], x2[64];
     real_t *outptr = output;
 


More information about the MPlayer-dev-eng mailing list