diff options
-rw-r--r-- | alc/mixer/mixer_c.cpp | 8 | ||||
-rw-r--r-- | alc/mixer/mixer_neon.cpp | 8 | ||||
-rw-r--r-- | alc/mixer/mixer_sse.cpp | 8 | ||||
-rw-r--r-- | native-tools/bsincgen.c | 43 |
4 files changed, 34 insertions, 33 deletions
diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp index fafda70d..f2164f53 100644 --- a/alc/mixer/mixer_c.cpp +++ b/alc/mixer/mixer_c.cpp @@ -31,9 +31,9 @@ inline ALfloat do_bsinc(const InterpState &istate, const ALfloat *RESTRICT vals, #undef FRAC_PHASE_BITDIFF const ALfloat *fil{istate.bsinc.filter + m*pi*4}; - const ALfloat *scd{fil + m}; - const ALfloat *phd{scd + m}; - const ALfloat *spd{phd + m}; + const ALfloat *phd{fil + m}; + const ALfloat *scd{phd + m}; + const ALfloat *spd{scd + m}; // Apply the scale and phase interpolated filter. ALfloat r{0.0f}; @@ -53,7 +53,7 @@ inline ALfloat do_fastbsinc(const InterpState &istate, const ALfloat *RESTRICT v #undef FRAC_PHASE_BITDIFF const ALfloat *fil{istate.bsinc.filter + m*pi*4}; - const ALfloat *phd{fil + m*2}; + const ALfloat *phd{fil + m}; // Apply the phase interpolated filter. ALfloat r{0.0f}; diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp index 178c7d6e..75faa61f 100644 --- a/alc/mixer/mixer_neon.cpp +++ b/alc/mixer/mixer_neon.cpp @@ -91,9 +91,9 @@ const ALfloat *Resample_<BSincTag,NEONTag>(const InterpState *state, const ALflo { const float32x4_t pf4{vdupq_n_f32(pf)}; const float *fil{filter + m*pi*4}; - const float *scd{fil + m}; - const float *phd{scd + m}; - const float *spd{phd + m}; + const float *phd{fil + m}; + const float *scd{phd + m}; + const float *spd{scd + m}; size_t td{m >> 2}; size_t j{0u}; @@ -140,7 +140,7 @@ const ALfloat *Resample_<FastBSincTag,NEONTag>(const InterpState *state, { const float32x4_t pf4{vdupq_n_f32(pf)}; const float *fil{filter + m*pi*4}; - const float *phd{fil + m*2}; + const float *phd{fil + m}; size_t td{m >> 2}; size_t j{0u}; diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index 002d6064..84f651d1 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -36,9 +36,9 @@ const ALfloat *Resample_<BSincTag,SSETag>(const InterpState *state, const ALfloa { const __m128 pf4{_mm_set1_ps(pf)}; const float *fil{filter + m*pi*4}; - const float *scd{fil + m}; - const float *phd{scd + m}; - const float *spd{phd + m}; + const float *phd{fil + m}; + const float *scd{phd + m}; + const float *spd{scd + m}; size_t td{m >> 2}; size_t j{0u}; @@ -88,7 +88,7 @@ const ALfloat *Resample_<FastBSincTag,SSETag>(const InterpState *state, { const __m128 pf4{_mm_set1_ps(pf)}; const float *fil{filter + m*pi*4}; - const float *phd{fil + m*2}; + const float *phd{fil + m}; size_t td{m >> 2}; size_t j{0u}; diff --git a/native-tools/bsincgen.c b/native-tools/bsincgen.c index de59ddff..7e7a1fa3 100644 --- a/native-tools/bsincgen.c +++ b/native-tools/bsincgen.c @@ -137,8 +137,8 @@ static double CalcKaiserBeta(const double rejection) static void BsiGenerateTables(FILE *output, const char *tabname, const double rejection, const int order)
{
static double filter[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT + 1][BSINC_POINTS_MAX];
- static double scDeltas[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT ][BSINC_POINTS_MAX];
static double phDeltas[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT + 1][BSINC_POINTS_MAX];
+ static double scDeltas[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT ][BSINC_POINTS_MAX];
static double spDeltas[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT ][BSINC_POINTS_MAX];
static int mt[BSINC_SCALE_COUNT];
static double at[BSINC_SCALE_COUNT];
@@ -147,8 +147,8 @@ static void BsiGenerateTables(FILE *output, const char *tabname, const double re int si, pi, i;
memset(filter, 0, sizeof(filter));
- memset(scDeltas, 0, sizeof(scDeltas));
memset(phDeltas, 0, sizeof(phDeltas));
+ memset(scDeltas, 0, sizeof(scDeltas));
memset(spDeltas, 0, sizeof(spDeltas));
/* Calculate windowing parameters. The width describes the transition
@@ -172,8 +172,8 @@ static void BsiGenerateTables(FILE *output, const char *tabname, const double re }
/* Calculate the Kaiser-windowed Sinc filter coefficients for each scale
- and phase.
- */
+ * and phase.
+ */
for(si = 0; si < BSINC_SCALE_COUNT; si++)
{
const int m = mt[si];
@@ -195,13 +195,10 @@ static void BsiGenerateTables(FILE *output, const char *tabname, const double re }
}
- /* Linear interpolation between scales is simplified by pre-calculating
- the delta (b - a) in: x = a + f (b - a)
-
- Given a difference in points between scales, the destination points
- will be 0, thus: x = a + f (-a)
- */
- for(si = 0; si < (BSINC_SCALE_COUNT - 1); si++)
+ /* Linear interpolation between phases is simplified by pre-calculating the
+ * delta (b - a) in: x = a + f (b - a)
+ */
+ for(si = 0; si < BSINC_SCALE_COUNT; si++)
{
const int m = mt[si];
const int o = num_points_min - (m / 2);
@@ -209,12 +206,16 @@ static void BsiGenerateTables(FILE *output, const char *tabname, const double re for(pi = 0; pi < BSINC_PHASE_COUNT; pi++)
{
for(i = 0; i < m; i++)
- scDeltas[si][pi][o + i] = filter[si + 1][pi][o + i] - filter[si][pi][o + i];
+ phDeltas[si][pi][o + i] = filter[si][pi + 1][o + i] - filter[si][pi][o + i];
}
}
- // Linear interpolation between phases is also simplified.
- for(si = 0; si < BSINC_SCALE_COUNT; si++)
+ /* Linear interpolation between scales is also simplified.
+ *
+ * Given a difference in points between scales, the destination points will
+ * be 0, thus: x = a + f (-a)
+ */
+ for(si = 0; si < (BSINC_SCALE_COUNT - 1); si++)
{
const int m = mt[si];
const int o = num_points_min - (m / 2);
@@ -222,13 +223,13 @@ static void BsiGenerateTables(FILE *output, const char *tabname, const double re for(pi = 0; pi < BSINC_PHASE_COUNT; pi++)
{
for(i = 0; i < m; i++)
- phDeltas[si][pi][o + i] = filter[si][pi + 1][o + i] - filter[si][pi][o + i];
+ scDeltas[si][pi][o + i] = filter[si + 1][pi][o + i] - filter[si][pi][o + i];
}
}
/* This last simplification is done to complete the bilinear equation for
- the combination of scale and phase.
- */
+ * the combination of phase and scale.
+ */
for(si = 0; si < (BSINC_SCALE_COUNT - 1); si++)
{
const int m = mt[si];
@@ -241,11 +242,11 @@ static void BsiGenerateTables(FILE *output, const char *tabname, const double re }
}
- // Make sure the number of points is a multiple of 4 (for SIMD).
+ /* Make sure the number of points is a multiple of 4 (for SIMD). */
for(si = 0; si < BSINC_SCALE_COUNT; si++)
mt[si] = (mt[si]+3) & ~3;
- // Calculate the table size.
+ /* Calculate the table size. */
i = 0;
for(si = 0; si < BSINC_SCALE_COUNT; si++)
i += 4 * BSINC_PHASE_COUNT * mt[si];
@@ -276,10 +277,10 @@ static void BsiGenerateTables(FILE *output, const char *tabname, const double re fprintf(output, " %+14.9ef,", filter[si][pi][o + i]);
fprintf(output, "\n ");
for(i = 0; i < m; i++)
- fprintf(output, " %+14.9ef,", scDeltas[si][pi][o + i]);
+ fprintf(output, " %+14.9ef,", phDeltas[si][pi][o + i]);
fprintf(output, "\n ");
for(i = 0; i < m; i++)
- fprintf(output, " %+14.9ef,", phDeltas[si][pi][o + i]);
+ fprintf(output, " %+14.9ef,", scDeltas[si][pi][o + i]);
fprintf(output, "\n ");
for(i = 0; i < m; i++)
fprintf(output, " %+14.9ef,", spDeltas[si][pi][o + i]);
|