aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ra144.c
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-06-05 16:11:51 +0000
committerVitor Sessak <vitor1001@gmail.com>2008-06-05 16:11:51 +0000
commit11bb2eb00305f934596e6f26b304b48535bf6356 (patch)
treeb7672b54e8af583a840dcc229488bc784ef7e378 /libavcodec/ra144.c
parentffa5ed2464ded23c3a4b3a0bea81d83e9b4899c6 (diff)
downloadffmpeg-11bb2eb00305f934596e6f26b304b48535bf6356.tar.gz
Split function rms() in two (it does two unrelated things)
Originally committed as revision 13663 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ra144.c')
-rw-r--r--libavcodec/ra144.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c
index ac5caa5149..5ddbaaeb19 100644
--- a/libavcodec/ra144.c
+++ b/libavcodec/ra144.c
@@ -174,7 +174,12 @@ static void final(const int16_t *i1, const int16_t *i2,
memcpy(statbuf, work + 40, 20);
}
-static unsigned int rms(const int *data, int f)
+static unsigned int rescale_rms(int rms, int energy)
+{
+ return (rms * energy) >> 10;
+}
+
+static unsigned int rms(const int *data)
{
int x;
unsigned int res = 0x10000;
@@ -197,7 +202,6 @@ static unsigned int rms(const int *data, int f)
res = t_sqrt(res);
res >>= (b + 10);
- res = (res * f) >> 10;
return res;
}
@@ -314,13 +318,13 @@ static int interp(RA144Context *ractx, int16_t *decsp, int block_num,
// coefficients
if (copynew) {
int_to_int16(decsp, ractx->lpc_coef);
- return rms(ractx->lpc_refl, energy);
+ return rescale_rms(rms(ractx->lpc_refl), energy);
} else {
int_to_int16(decsp, ractx->lpc_coef_old);
- return rms(ractx->lpc_refl_old, energy);
+ return rescale_rms(rms(ractx->lpc_refl_old), energy);
}
} else {
- return rms(work, energy);
+ return rescale_rms(rms(work), energy);
}
}
@@ -358,7 +362,7 @@ static int ra144_decode_frame(AVCodecContext * avctx,
refl_rms[1] = interp(ractx, block_coefs[1], 1, energy > ractx->old_energy,
t_sqrt(energy*ractx->old_energy) >> 12);
refl_rms[2] = interp(ractx, block_coefs[2], 2, 1, energy);
- refl_rms[3] = rms(ractx->lpc_refl, energy);
+ refl_rms[3] = rescale_rms(rms(ractx->lpc_refl), energy);
int_to_int16(block_coefs[3], ractx->lpc_coef);