aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-08-16 02:05:10 -0700
committerChris Robinson <[email protected]>2017-08-16 02:05:10 -0700
commit520dd5c77972cad13d1a97e228903b3c5bdc384f (patch)
tree29d72d9414d1b9d98ebcd80eab3b987eb4425279 /Alc/ALu.c
parent4dd53ab9429f0ca561dfd45f8f6022ae9871455a (diff)
Make the bsinc table layout more efficient
The old layout separated filters, scale deltas, phase deltas, and scale phase deltas into separate segments that each contained a numbers of scale and phase entries, Since processing a sample needed a filter and one of each delta entry relating to a particular scale and phase, the memory needed would be spread across the whole table. And since subsequent samples would use a different phase, it would jump around the table a whole lot as well. The new layout packs the data in a way more consistent with its use. The filters, scale deltas, phase deltas, and scale phase deltas are interleaved, such that for a particular scale and phase, the filter and delta entries used are contiguous. And the phase entries for a particular scale are kept together, so the ~500 to ~1000 samples processed per source update stay within the same 3KB to 6KB area of the 70+KB table, which is much more cache friendly.
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 0bf9fc11..d559649a 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -267,10 +267,10 @@ ALboolean BsincPrepare(const ALuint increment, BsincState *state)
*/
for(pi = 0;pi < BSINC_PHASE_COUNT;pi++)
{
- state->coeffs[pi].filter = &bsinc.Tab[bsinc.to[0][si] + bsinc.tm[0][si]*pi];
- state->coeffs[pi].scDelta = &bsinc.Tab[bsinc.to[1][si] + bsinc.tm[1][si]*pi];
- state->coeffs[pi].phDelta = &bsinc.Tab[bsinc.to[2][si] + bsinc.tm[0][si]*pi];
- state->coeffs[pi].spDelta = &bsinc.Tab[bsinc.to[3][si] + bsinc.tm[1][si]*pi];
+ state->coeffs[pi].filter = &bsinc.Tab[bsinc.filterOffset[si] + bsinc.m[si]*(pi*4 + 0)];
+ state->coeffs[pi].scDelta = &bsinc.Tab[bsinc.filterOffset[si] + bsinc.m[si]*(pi*4 + 1)];
+ state->coeffs[pi].phDelta = &bsinc.Tab[bsinc.filterOffset[si] + bsinc.m[si]*(pi*4 + 2)];
+ state->coeffs[pi].spDelta = &bsinc.Tab[bsinc.filterOffset[si] + bsinc.m[si]*(pi*4 + 3)];
}
return uncut;
}