Skip to content

Commit 00d2e62

Browse files
karltrillian
authored andcommitted
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.
1 parent 9617cea commit 00d2e62

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libspeexdsp/resample.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ static int resampler_basic_interpolate_single(SpeexResamplerState *st, spx_uint3
473473
}
474474

475475
cubic_coef(frac, interp);
476-
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));
476+
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]);
477477
sum = SATURATE32PSHR(sum, 15, 32767);
478478
#else
479479
cubic_coef(frac, interp);

0 commit comments

Comments
 (0)