diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bsinc_tables.cpp | 52 | ||||
-rw-r--r-- | core/mixer/mixer_c.cpp | 6 | ||||
-rw-r--r-- | core/mixer/mixer_neon.cpp | 6 | ||||
-rw-r--r-- | core/mixer/mixer_sse.cpp | 6 |
4 files changed, 29 insertions, 41 deletions
diff --git a/core/bsinc_tables.cpp b/core/bsinc_tables.cpp index 315e1448..334822f5 100644 --- a/core/bsinc_tables.cpp +++ b/core/bsinc_tables.cpp @@ -189,16 +189,16 @@ struct BSincFilterArray { } size_t idx{0}; - for(size_t si{0};si < BSincScaleCount-1;++si) + for(size_t si{0};si < BSincScaleCount;++si) { const size_t m{((hdr.a[si]*2) + 3) & ~3u}; const size_t o{(BSincPointsMax-m) / 2}; + /* Write out each phase index's filter and phase delta for this + * quality scale. + */ for(size_t pi{0};pi < BSincPhaseCount;++pi) { - /* Write out the filter. Also calculate and write out the phase - * and scale deltas. - */ for(size_t i{0};i < m;++i) mTable[idx++] = static_cast<float>(filter[si][pi][o+i]); @@ -210,11 +210,22 @@ struct BSincFilterArray { const double phDelta{filter[si][pi+1][o+i] - filter[si][pi][o+i]}; mTable[idx++] = static_cast<float>(phDelta); } - + } + /* Calculate and write out each phase index's filter quality scale + * deltas. The last scale index doesn't have any scale or scale- + * phase deltas. + */ + if(si == BSincScaleCount-1) + { + for(size_t i{0};i < BSincPhaseCount*m*2;++i) + mTable[idx++] = 0.0f; + } + else for(size_t pi{0};pi < BSincPhaseCount;++pi) + { /* 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) + * Given a difference in the number of points between scales, + * the destination points will be 0, thus: x = a + f (-a) */ for(size_t i{0};i < m;++i) { @@ -223,8 +234,8 @@ struct BSincFilterArray { } /* This last simplification is done to complete the bilinear - * equation for the combination of phase and scale. - */ + * equation for the combination of phase and scale. + */ for(size_t i{0};i < m;++i) { const double spDelta{(filter[si+1][pi+1][o+i] - filter[si+1][pi][o+i]) - @@ -233,29 +244,6 @@ struct BSincFilterArray { } } } - { - /* The last scale index doesn't have any scale or scale-phase - * deltas. - */ - constexpr size_t si{BSincScaleCount-1}; - const size_t m{((hdr.a[si]*2) + 3) & ~3u}; - const size_t o{(BSincPointsMax-m) / 2}; - - for(size_t pi{0};pi < BSincPhaseCount;++pi) - { - for(size_t i{0};i < m;++i) - mTable[idx++] = static_cast<float>(filter[si][pi][o+i]); - for(size_t i{0};i < m;++i) - { - const double phDelta{filter[si][pi+1][o+i] - filter[si][pi][o+i]}; - mTable[idx++] = static_cast<float>(phDelta); - } - for(size_t i{0};i < m;++i) - mTable[idx++] = 0.0f; - for(size_t i{0};i < m;++i) - mTable[idx++] = 0.0f; - } - } assert(idx == hdr.total_size); } }; diff --git a/core/mixer/mixer_c.cpp b/core/mixer/mixer_c.cpp index 8c2c60c5..f82f7dd1 100644 --- a/core/mixer/mixer_c.cpp +++ b/core/mixer/mixer_c.cpp @@ -38,9 +38,9 @@ inline float do_bsinc(const InterpState &istate, const float *RESTRICT vals, con const uint pi{frac >> FracPhaseBitDiff}; const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)}; - const float *RESTRICT fil{istate.bsinc.filter + m*pi*4}; + const float *RESTRICT fil{istate.bsinc.filter + m*pi*2}; const float *RESTRICT phd{fil + m}; - const float *RESTRICT scd{phd + m}; + const float *RESTRICT scd{fil + BSincPhaseCount*2*m}; const float *RESTRICT spd{scd + m}; // Apply the scale and phase interpolated filter. @@ -58,7 +58,7 @@ inline float do_fastbsinc(const InterpState &istate, const float *RESTRICT vals, const uint pi{frac >> FracPhaseBitDiff}; const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)}; - const float *RESTRICT fil{istate.bsinc.filter + m*pi*4}; + const float *RESTRICT fil{istate.bsinc.filter + m*pi*2}; const float *RESTRICT phd{fil + m}; // Apply the phase interpolated filter. diff --git a/core/mixer/mixer_neon.cpp b/core/mixer/mixer_neon.cpp index 8cd7e610..a3afdc6b 100644 --- a/core/mixer/mixer_neon.cpp +++ b/core/mixer/mixer_neon.cpp @@ -131,9 +131,9 @@ float *Resample_<BSincTag,NEONTag>(const InterpState *state, float *RESTRICT src float32x4_t r4{vdupq_n_f32(0.0f)}; { const float32x4_t pf4{vdupq_n_f32(pf)}; - const float *RESTRICT fil{filter + m*pi*4}; + const float *RESTRICT fil{filter + m*pi*2}; const float *RESTRICT phd{fil + m}; - const float *RESTRICT scd{phd + m}; + const float *RESTRICT scd{fil + BSincPhaseCount*2*m}; const float *RESTRICT spd{scd + m}; size_t td{m >> 2}; size_t j{0u}; @@ -177,7 +177,7 @@ float *Resample_<FastBSincTag,NEONTag>(const InterpState *state, float *RESTRICT float32x4_t r4{vdupq_n_f32(0.0f)}; { const float32x4_t pf4{vdupq_n_f32(pf)}; - const float *RESTRICT fil{filter + m*pi*4}; + const float *RESTRICT fil{filter + m*pi*2}; const float *RESTRICT phd{fil + m}; size_t td{m >> 2}; size_t j{0u}; diff --git a/core/mixer/mixer_sse.cpp b/core/mixer/mixer_sse.cpp index ba53d0a5..2a11601c 100644 --- a/core/mixer/mixer_sse.cpp +++ b/core/mixer/mixer_sse.cpp @@ -96,9 +96,9 @@ float *Resample_<BSincTag,SSETag>(const InterpState *state, float *RESTRICT src, __m128 r4{_mm_setzero_ps()}; { const __m128 pf4{_mm_set1_ps(pf)}; - const float *RESTRICT fil{filter + m*pi*4}; + const float *RESTRICT fil{filter + m*pi*2}; const float *RESTRICT phd{fil + m}; - const float *RESTRICT scd{phd + m}; + const float *RESTRICT scd{fil + BSincPhaseCount*2*m}; const float *RESTRICT spd{scd + m}; size_t td{m >> 2}; size_t j{0u}; @@ -143,7 +143,7 @@ float *Resample_<FastBSincTag,SSETag>(const InterpState *state, float *RESTRICT __m128 r4{_mm_setzero_ps()}; { const __m128 pf4{_mm_set1_ps(pf)}; - const float *RESTRICT fil{filter + m*pi*4}; + const float *RESTRICT fil{filter + m*pi*2}; const float *RESTRICT phd{fil + m}; size_t td{m >> 2}; size_t j{0u}; |