[MPlayer-dev-eng] PATCH 4/5: substract surround from front in pl_surround

Tobias Diedrich td at informatik.uni-hannover.de
Sun Dec 9 04:03:49 CET 2001


-- 
Tobias								PGP: 0x9AC7E0BC
-------------- next part --------------
diff -urN main-current/libao2/pl_surround.c main-multi/libao2/pl_surround.c
--- main-current/libao2/pl_surround.c	Fri Dec  7 23:36:33 2001
+++ main-multi/libao2/pl_surround.c	Sun Dec  9 02:55:20 2001
@@ -143,9 +143,8 @@
 // processes 'ao_plugin_data.len' bytes of 'data'
 // called for every block of data
 static int play(){
-  int16_t *in, *out;
+  int16_t *in, *out, surround;
   int i, samples;
-  int surround;
 
   if (pl_surround.passthrough) return 1;
 
@@ -166,14 +165,15 @@
     //   keeping levels in balance, we scale L and R down by 3dB (*.707),
     //   and scale the surround down by 6dB (.707*.707=.5)
 
+    surround = in[0]/2 - in[1]/2;
     // front left and right
-    out[0] = in[0]*.707;
-    out[1] = in[1]*.707;
+    out[0] = in[0]*.707 - surround;
+    out[1] = in[1]*.707 + surround;
     // surround - from 15msec ago
     out[2] = pl_surround.delaybuf[pl_surround.delaybuf_ptr];
-    out[3] = -out[2];
+    out[3] = out[2];
     // calculate and save surround for 15msecs time
-    pl_surround.delaybuf[pl_surround.delaybuf_ptr++] = (in[0]/2 - in[1]/2);
+    pl_surround.delaybuf[pl_surround.delaybuf_ptr++] = surround;
     pl_surround.delaybuf_ptr %= pl_surround.delaybuf_len;
     // next samples...
     in = &in[pl_surround.input_channels];  out = &out[4];


More information about the MPlayer-dev-eng mailing list