diff options
author | Karl Tomlinson <karlt+@karlt.net> | 2020-08-29 03:33:00 +0300 |
---|---|---|
committer | Ralph Giles <giles@thaumas.net> | 2020-10-02 19:23:27 +0300 |
commit | 00d2e621c53bd5ca6dabd12f97d1224b3705645a (patch) | |
tree | ca0fedcfaa5aaeaf1768c1f67073baecef7a118f | |
parent | 9617cea1d4d41199a36c664cc268a830aa0f4ba7 (diff) |
fixed-point resample: remove 1-bit shift right before interpolation
This was added in
https://gitlab.xiph.org/xiph/speexdsp/-/commit/0dd7bfebe55abcac7e9acbca9d2ac2eddeee2b6f#5424d940076d3b85a3fc2d9f2dcf0d905c43abf0_466_472
to address truncation reported at
http://lists.xiph.org/pipermail/speex-dev/2009-June/007277.html
Truncation of the most-signficant bit was occuring on conversion to
spx_word16_t in MULT16_32_Q15(). Changes to MULT16_32_Q15() mean this will no
longer occur.
The associated adjustment to the bit-shift before saturation was accidentally
removed in
https://gitlab.xiph.org/xiph/speexdsp/-/commit/0e5d424fdba2fd1c132428da38add0c0845b4178#6479ffd77de750bc70cf92af3f9b8a4c1e15a98a_473_478
which caused the output to have half the intended amplitude when the
interpolating resampler was used.
Reported by Andreas Pehrson.
-rw-r--r-- | libspeexdsp/resample.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libspeexdsp/resample.c b/libspeexdsp/resample.c index cd2477b..2bfbc1c 100644 --- a/libspeexdsp/resample.c +++ b/libspeexdsp/resample.c @@ -473,7 +473,7 @@ static int resampler_basic_interpolate_single(SpeexResamplerState *st, spx_uint3 } cubic_coef(frac, interp); - sum = MULT16_32_Q15(interp[0],SHR32(accum[0], 1)) + MULT16_32_Q15(interp[1],SHR32(accum[1], 1)) + MULT16_32_Q15(interp[2],SHR32(accum[2], 1)) + MULT16_32_Q15(interp[3],SHR32(accum[3], 1)); + sum = MULT16_32_Q15(interp[0],accum[0]) + MULT16_32_Q15(interp[1],accum[1]) + MULT16_32_Q15(interp[2],accum[2]) + MULT16_32_Q15(interp[3],accum[3]); sum = SATURATE32PSHR(sum, 15, 32767); #else cubic_coef(frac, interp); |