Commit 1eb1f6f2 authored by Mans Rullgard's avatar Mans Rullgard

g723.1: remove useless uses of MUL64()

The operands in both cases are 16-bit so cannot overflow a 32-bit
destination.  In gain_scale() the inputs are reduced to 14-bit,
so even the shift cannot overflow.
Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent 5a43eba9
...@@ -574,7 +574,7 @@ static int dot_product(const int16_t *a, const int16_t *b, int length) ...@@ -574,7 +574,7 @@ static int dot_product(const int16_t *a, const int16_t *b, int length)
int i, sum = 0; int i, sum = 0;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
int64_t prod = av_clipl_int32(MUL64(a[i], b[i]) << 1); int64_t prod = av_clipl_int32((int64_t)(a[i] * b[i]) << 1);
sum = av_clipl_int32(sum + prod); sum = av_clipl_int32(sum + prod);
} }
return sum; return sum;
...@@ -889,9 +889,9 @@ static void gain_scale(G723_1_Context *p, int16_t * buf, int energy) ...@@ -889,9 +889,9 @@ static void gain_scale(G723_1_Context *p, int16_t * buf, int energy)
num = energy; num = energy;
denom = 0; denom = 0;
for (i = 0; i < SUBFRAME_LEN; i++) { for (i = 0; i < SUBFRAME_LEN; i++) {
int64_t temp = buf[i] >> 2; int temp = buf[i] >> 2;
temp = av_clipl_int32(MUL64(temp, temp) << 1); temp *= temp;
denom = av_clipl_int32(denom + temp); denom = av_clipl_int32((int64_t)denom + (temp << 1));
} }
if (num && denom) { if (num && denom) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment