aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-02-27 10:53:56 -0800
committerChris Robinson <[email protected]>2016-02-27 11:38:40 -0800
commitadce176a3579b548be1193137583234bd622b6a0 (patch)
treed54417c0c5ec274b911de02166fa91cddb7ebbb8 /Alc
parent99f685d20d0e9bece99a6019a98d8cb3aecef227 (diff)
Separate the left and right output writes with UHJ encoding
Diffstat (limited to 'Alc')
-rw-r--r--Alc/uhjfilter.c21
1 files 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;
}
}