OSDN Git Service

g723.1: simplify and fix multiplication overflow
authorMans Rullgard <mans@mansr.com>
Fri, 10 Aug 2012 00:14:32 +0000 (01:14 +0100)
committerMans Rullgard <mans@mansr.com>
Fri, 10 Aug 2012 11:18:38 +0000 (12:18 +0100)
commit52aa3015a3c895cf74e555c4bb56c08cd067383e
treecb304e7a3d6d5f654c2c30184c8a4b5d1173ed28
parente141cf2c5794cd9884f2806b7766a1e0bb47ebe5
g723.1: simplify and fix multiplication overflow

In 16-bit arithmetic, x * 0xffffc is simply x * -4 with extra overflows,
(and the constant was probably meant to be 0xfffc).  Combined with the
shift, this simplifies to -x >> 1.  Finally, clearing the low two bits
with a 32-bit mask and switching to a 32-bit type allows more efficient
code on 32-bit machines.

Signed-off-by: Mans Rullgard <mans@mansr.com>
libavcodec/g723_1.c