From adce176a3579b548be1193137583234bd622b6a0 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 27 Feb 2016 10:53:56 -0800 Subject: Separate the left and right output writes with UHJ encoding --- Alc/uhjfilter.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Alc/uhjfilter.c b/Alc/uhjfilter.c index 63a88aa7..cb1a4348 100644 --- a/Alc/uhjfilter.c +++ b/Alc/uhjfilter.c @@ -22,8 +22,8 @@ void EncodeUhj2(Uhj2Encoder *enc, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALf for(base = 0;base < SamplesToDo;) { - ALfloat D[MAX_UPDATE_SAMPLES], S; - ALuint todo = minu(SamplesToDo - base, MAX_UPDATE_SAMPLES); + ALfloat D[MAX_UPDATE_SAMPLES/2], S[MAX_UPDATE_SAMPLES/2]; + ALuint todo = minu(SamplesToDo - base, MAX_UPDATE_SAMPLES/2); /* D = 0.6554516*Y */ for(i = 0;i < todo;i++) @@ -63,10 +63,7 @@ void EncodeUhj2(Uhj2Encoder *enc, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALf D[i] += enc->Filter2_WX[3].y[0]; } - /* S = 0.9396926*W' + 0.1855740*X - * Left = (S + D)/2.0 - * Right = (S - D)/2.0 - */ + /* S = 0.9396926*W' + 0.1855740*X */ for(i = 0;i < todo;i++) { ALfloat in = 0.9396926f*1.414213562f*InSamples[0][base+i] + @@ -81,11 +78,17 @@ void EncodeUhj2(Uhj2Encoder *enc, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALf enc->Filter1_WX[c].y[0] = out; in = out; } - S = enc->Filter1_WX[3].y[1]; - OutBuffer[0][base + i] += (S + D[i]) * 0.5f; - OutBuffer[1][base + i] += (S - D[i]) * 0.5f; + S[i] = enc->Filter1_WX[3].y[1]; } + /* Left = (S + D)/2.0 + * Right = (S - D)/2.0 + */ + for(i = 0;i < todo;i++) + OutBuffer[0][base + i] += (S[i] + D[i]) * 0.5f; + for(i = 0;i < todo;i++) + OutBuffer[1][base + i] += (S[i] - D[i]) * 0.5f; + base += todo; } } -- cgit v1.2.3