diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2008-05-24 09:19:21 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2008-05-24 09:19:21 +0000 |
commit | 08533939791a2442fa1c82622fc910e9427ff65e (patch) | |
tree | b1081e3f8402a242c659db0cedd5996c1fbd669b /libavcodec/ra144.c | |
parent | c2c237a0d55ce1f0a57d66b9f051d1ca9556a792 (diff) | |
download | ffmpeg-08533939791a2442fa1c82622fc910e9427ff65e.tar.gz |
Simplify rms()
Originally committed as revision 13276 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ra144.c')
-rw-r--r-- | libavcodec/ra144.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c index 07431bfd08..e0b43c1870 100644 --- a/libavcodec/ra144.c +++ b/libavcodec/ra144.c @@ -181,30 +181,24 @@ static void final(const short *i1, const short *i2, static unsigned int rms(const int *data, int f) { - const int *c; int x; - unsigned int res; - int b; + unsigned int res = 0x10000; + int b = 0; - c = data; - b = 0; - res = 0x10000; for (x=0; x<10; x++) { - res = (((0x1000000 - (*c) * (*c)) >> 12) * res) >> 12; + res = (((0x1000000 - (*data) * (*data)) >> 12) * res) >> 12; if (res == 0) return 0; - if (res <= 0x3fff) { - while (res <= 0x3fff) { - b++; - res <<= 2; - } - } else { if (res > 0x10000) return 0; /* We're screwed, might as well go out with a bang. :P */ + + while (res <= 0x3fff) { + b++; + res <<= 2; } - c++; + data++; } if (res > 0) |