Simplify irms()

Originally committed as revision 13215 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Vitor Sessak 2008-05-21 16:43:33 +00:00
parent bf6497e911
commit c32985829a
1 changed files with 3 additions and 5 deletions

View File

@ -112,12 +112,10 @@ static void rotate_block(const short *source, short *target, int offset)
/* inverse root mean square */
static int irms(const short *data, int factor)
{
const short *p1, *p2;
unsigned int sum;
unsigned int i, sum = 0;
p2 = (p1 = data) + BLOCKSIZE;
for (sum=0; p2 > p1; p1++)
sum += (*p1) * (*p1);
for (i=0; i < BLOCKSIZE; i++)
sum += data[i] * data[i];
if (sum == 0)
return 0; /* OOPS - division by zero */