Commit 64e4af2a authored by Vitor Sessak's avatar Vitor Sessak

Do instead of divising a float by a constant, multiply by its inverse

Originally committed as revision 15417 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 68997192
...@@ -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 * 4096); sumsum = exp(sum * 0.1151292546497) * gain * (1.0/(1<<23));
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 = (4096 * 4096) * scalar_product_float(buffer, buffer, 5) / 5; sum = scalar_product_float(buffer, buffer, 5) * ((1<<24)/5.);
sum = FFMAX(sum, 1); sum = FFMAX(sum, 1);
......
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