[MPlayer-cvslog] CVS: main/libfaad2 output.c,1.7,1.8

Richard Felker CVS syncmail at mplayerhq.hu
Tue Mar 29 20:08:47 CEST 2005


CVS change done by Richard Felker CVS

Update of /cvsroot/mplayer/main/libfaad2
In directory mail:/var2/tmp/cvs-serv29721/libfaad2

Modified Files:
	output.c 
Log Message:
usable downmixing for fixed point mode

Index: output.c
===================================================================
RCS file: /cvsroot/mplayer/main/libfaad2/output.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- output.c	19 Feb 2005 01:21:19 -0000	1.7
+++ output.c	29 Mar 2005 18:08:44 -0000	1.8
@@ -463,7 +463,7 @@
     }
 }
 
-void* output_to_PCM(NeAACDecHandle hDecoder,
+void* output_to_PCM_sux(NeAACDecHandle hDecoder,
                     real_t **input, void *sample_buffer, uint8_t channels,
                     uint16_t frame_len, uint8_t format)
 {
@@ -554,4 +554,51 @@
     return sample_buffer;
 }
 
+void* output_to_PCM(NeAACDecHandle hDecoder,
+                    real_t **input, void *sample_buffer, uint8_t channels,
+                    uint16_t frame_len, uint8_t format)
+{
+    int ch;
+    int i;
+    int16_t *short_sample_buffer = (int16_t*)sample_buffer;
+    real_t *ch0 = input[hDecoder->internal_channel[0]];
+    real_t *ch1 = input[hDecoder->internal_channel[1]];
+    real_t *ch2 = input[hDecoder->internal_channel[2]];
+    real_t *ch3 = input[hDecoder->internal_channel[3]];
+    real_t *ch4 = input[hDecoder->internal_channel[4]];
+
+    if (format != FAAD_FMT_16BIT)
+        return output_to_PCM_sux(hDecoder, input, sample_buffer, channels, frame_len, format);
+
+    if (hDecoder->downMatrix) {
+        for(i = 0; i < frame_len; i++)
+        {
+	    int32_t tmp;
+	    tmp = (ch1[i] + ((ch0[i]+ch3[i])<<1) + (ch0[i]+ch3[i]) + (1<<(REAL_BITS+2))) >> (REAL_BITS+3);
+	    if (tmp & ~0xffff) tmp = ~(tmp>>31)-0x7fff;
+            short_sample_buffer[0] = tmp;
+	    tmp = (ch2[i] + ((ch0[i]+ch4[i])<<1) + (ch0[i]+ch4[i]) + (1<<(REAL_BITS+2))) >> (REAL_BITS+3);
+	    if (tmp & ~0xffff) tmp = ~(tmp>>31)-0x7fff;
+            short_sample_buffer[1] = tmp;
+	    short_sample_buffer += channels;
+        }
+        return sample_buffer;
+    }
+
+    /* Copy output to a standard PCM buffer */
+    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 & ~0xffff) tmp = ~(tmp>>31)-0x7fff;
+            *(short_sample_buffer++) = tmp;
+        }
+    }
+
+    return sample_buffer;
+}
+
 #endif




More information about the MPlayer-cvslog mailing list