Commit b6c77581 authored by Vitor Sessak's avatar Vitor Sessak

Move constant multiplication out of the loop

Originally committed as revision 15404 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent e60daa34
...@@ -96,12 +96,12 @@ static void decode(RA288Context *ractx, float gain, int cb_coef) ...@@ -96,12 +96,12 @@ static void decode(RA288Context *ractx, float gain, int cb_coef)
/* block 48 of G.728 spec */ /* block 48 of G.728 spec */
/* exp(sum * 0.1151292546497) == pow(10.0,sum/20) */ /* exp(sum * 0.1151292546497) == pow(10.0,sum/20) */
sumsum = exp(sum * 0.1151292546497) * gain / 2048.; sumsum = exp(sum * 0.1151292546497) * gain / (2048 * 4096);
for (i=0; i < 5; i++) for (i=0; i < 5; i++)
buffer[i] = codetable[cb_coef][i] * sumsum; buffer[i] = codetable[cb_coef][i] * sumsum;
sum = scalar_product_float(buffer, buffer, 5) / 5; sum = (4096 * 4096) * scalar_product_float(buffer, buffer, 5) / 5;
sum = FFMAX(sum, 1); sum = FFMAX(sum, 1);
...@@ -118,7 +118,7 @@ static void decode(RA288Context *ractx, float gain, int cb_coef) ...@@ -118,7 +118,7 @@ static void decode(RA288Context *ractx, float gain, int cb_coef)
/* output */ /* output */
for (i=0; i < 5; i++) for (i=0; i < 5; i++)
block[i] = av_clipf(block[i], -4095, 4095); block[i] = av_clipf(block[i], -4095./4096., 4095./4096.);
} }
/** /**
...@@ -210,7 +210,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data, ...@@ -210,7 +210,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
decode(ractx, gain, cb_coef); decode(ractx, gain, cb_coef);
for (j=0; j < 5; j++) for (j=0; j < 5; j++)
*(out++) = (1/4096.) * ractx->sp_hist[70 + 36 + j]; *(out++) = ractx->sp_hist[70 + 36 + j];
if ((i & 7) == 3) if ((i & 7) == 3)
backward_filter(ractx); backward_filter(ractx);
......
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