aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ra288.c
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-09-24 20:31:24 +0000
committerVitor Sessak <vitor1001@gmail.com>2008-09-24 20:31:24 +0000
commitb6c77581683c9ed0b5a72e2b598291162d12cf4b (patch)
tree2293e923c109c785b38f4f01cd20caab5c5f64e8 /libavcodec/ra288.c
parente60daa340b57040ecfeb888c8f917efecca97e49 (diff)
downloadffmpeg-b6c77581683c9ed0b5a72e2b598291162d12cf4b.tar.gz
Move constant multiplication out of the loop
Originally committed as revision 15404 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ra288.c')
-rw-r--r--libavcodec/ra288.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c
index 3993c342ea..11d5e4c6ec 100644
--- a/libavcodec/ra288.c
+++ b/libavcodec/ra288.c
@@ -96,12 +96,12 @@ static void decode(RA288Context *ractx, float gain, int cb_coef)
/* block 48 of G.728 spec */
/* 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++)
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);
@@ -118,7 +118,7 @@ static void decode(RA288Context *ractx, float gain, int cb_coef)
/* output */
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,
decode(ractx, gain, cb_coef);
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)
backward_filter(ractx);