diff options
author | steve <steve@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-12-07 22:36:33 +0000 |
---|---|---|
committer | steve <steve@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-12-07 22:36:33 +0000 |
commit | e237409b4671ebffd69a1ad6dbac36a3287e54af (patch) | |
tree | 4fc8cde34f205d61198195a3ca56f28dc666e316 | |
parent | 0f864df68d81c79fc78c5314a9affc5b82739280 (diff) | |
download | mpv-e237409b4671ebffd69a1ad6dbac36a3287e54af.tar.bz2 mpv-e237409b4671ebffd69a1ad6dbac36a3287e54af.tar.xz |
Corrected front:surround levels
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3374 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libao2/pl_surround.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libao2/pl_surround.c b/libao2/pl_surround.c index 387e524a3e..8735004096 100644 --- a/libao2/pl_surround.c +++ b/libao2/pl_surround.c @@ -155,9 +155,20 @@ static int play(){ out = pl_surround.databuf; in = (int16_t *)ao_plugin_data.data; for (i=0; i<samples; i++) { + + // About the .707 here and the /2 for surround: + // Surround encoding does the following: + // Lt=L+.707*C+.707*S, Rt=R+.707*C-.707*S + // So S needs to be extracted as: + // .707*(L-R) + // But L-R could still be as much as 32767-(-32768), way off scale + // for signed 16 bits, so to avoid running out of bits, whilst still + // keeping levels in balance, we scale L and R down by 3dB (*.707), + // and scale the surround down by 6dB (.707*.707=.5) + // front left and right - out[0] = in[0]; - out[1] = in[1]; + out[0] = in[0]*.707; + out[1] = in[1]*.707; // surround - from 15msec ago out[2] = pl_surround.delaybuf[pl_surround.delaybuf_ptr]; out[3] = -out[2]; |