[Mplayer-cvslog] CVS: main/libac3 decode.c,1.7,1.8

Stephen Davies steve at mplayer.dev.hu
Wed Nov 28 13:48:39 CET 2001


Update of /cvsroot/mplayer/main/libac3
In directory mplayer:/var/tmp.root/cvs-serv26424/libac3

Modified Files:
	decode.c 
Log Message:
Extended oss output driver and libac3 to support 4 and 6 channel output mixes.  added -channels command line option

Index: decode.c
===================================================================
RCS file: /cvsroot/mplayer/main/libac3/decode.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- decode.c	14 Jul 2001 16:33:11 -0000	1.7
+++ decode.c	28 Nov 2001 12:48:36 -0000	1.8
@@ -62,9 +62,10 @@
 //the floating point samples for one audblk
 static stream_samples_t samples;
 
-//the integer samples for the entire frame (with enough space for 2 ch out)
-//if this size change, be sure to change the size when muting
-static int16_t s16_samples[2 * 6 * 256] __attribute__ ((aligned(16)));
+//the integer samples for the entire frame (with enough space for MAX_OUTPUT_CHANNELS ch out)
+//#define MAX_OUTPUT_CHANNELS 2
+#define MAX_OUTPUT_CHANNELS 6
+static int16_t s16_samples[6 * MAX_OUTPUT_CHANNELS * 256] __attribute__ ((aligned(16)));
 
 // downmix stuff
 static float cmixlev_lut[4] = { 0.707, 0.595, 0.500, 0.707 };
@@ -153,7 +154,7 @@
 decode_mute(void)
 {
 	//mute the frame
-	memset (s16_samples, 0, sizeof(int16_t) * 256 * 2 * 6);
+	memset (s16_samples, 0, sizeof(int16_t) * 256 * MAX_OUTPUT_CHANNELS * 6);
 	error_flag = 0;
 }
 
@@ -172,14 +173,15 @@
 	sanity_check_init(&syncinfo,&bsi,&audblk);
 	decode_mute();
 #if defined(HAVE_SSE)
-	printf("!! libac3"AC3VER": using SSE optimization\n");
+	printf("!! libac3"AC3VER": using SSE optimization");
 #elif defined(HAVE_3DNOWEX)
-	printf("!! libac3"AC3VER": using 3dNow-dsp! optimization\n");
+	printf("!! libac3"AC3VER": using 3dNow-dsp! optimization");
 #elif defined(HAVE_3DNOW)
-	printf("!! libac3"AC3VER": using 3dNow! optimization\n");
+	printf("!! libac3"AC3VER": using 3dNow! optimization");
 #else
-	printf("!! libac3"AC3VER": using FPU optimization\n");
+	printf("!! libac3"AC3VER": using FPU optimization");
 #endif
+	printf(", mixing to %d output channels\n", ac3_config.num_output_ch);
 }
 
 static ac3_frame_t ac3_frame;
@@ -205,8 +207,7 @@
 			done_banner = 1;
 		}
 
-		// compute downmix parameters
-		// downmix to tow channels for now
+		// compute downmix parameters - to be used for downmix to two channels
 		dm_par.clev = 0.0; dm_par.slev = 0.0; dm_par.unit = 1.0;
 		if (bsi.acmod & 0x1)	// have center
 			dm_par.clev = cmixlev_lut[bsi.cmixlev];
@@ -243,7 +244,11 @@
 				rematrix (&audblk,samples);
 
 			// Convert the frequency samples into time samples 
-			imdct (&bsi,&audblk,samples, &s16_samples[i * 2 * 256], &dm_par);
+			// Downmix at the same time...
+			imdct (&bsi,&audblk,samples,
+			       ac3_config.num_output_ch,
+			       &s16_samples[i*ac3_config.num_output_ch*256],
+			       &dm_par);
 
 			// Downmix into the requested number of channels
 			// and convert floating point to int16_t
@@ -262,4 +267,3 @@
 
 	return &ac3_frame;
 }
-




More information about the MPlayer-cvslog mailing list