summaryrefslogtreecommitdiff
path: root/libavcodec/adxdec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-01-20 20:20:43 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-21 10:01:46 +0100
commit340e6b018596837db950e82b4d5232d993e23934 (patch)
tree3b936305c2241548fcad27ecce122987fb97b393 /libavcodec/adxdec.c
parent59a9d65e0d790821f88527a82569f56eb2f8a9be (diff)
avcodec/adxdec: Remove unnecessary left-shift
Replace "(a * (1 << shift) * b + c) >> shift" by "a * b + (c >> shift)". It is equivalent to the old code because a is in the range of uint16_t, shift is 12 and b is effectively a signed 4-bit number, so that no overflow/truncation of high bits happens during the multiplication (overflow would be undefined anyway). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/adxdec.c')
-rw-r--r--libavcodec/adxdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index 178ea99dcf..40ed8e5ba7 100644
--- a/libavcodec/adxdec.c
+++ b/libavcodec/adxdec.c
@@ -81,7 +81,7 @@ static int adx_decode(ADXContext *c, int16_t *out, int offset,
s2 = prev->s2;
for (i = 0; i < BLOCK_SAMPLES; i++) {
d = get_sbits(&gb, 4);
- s0 = ((d * (1 << COEFF_BITS)) * scale + c->coeff[0] * s1 + c->coeff[1] * s2) >> COEFF_BITS;
+ s0 = d * scale + ((c->coeff[0] * s1 + c->coeff[1] * s2) >> COEFF_BITS);
s2 = s1;
s1 = av_clip_int16(s0);
*out++ = s1;