comparison mpegaudio.c @ 70:c7767df463f4 libavcodec

log2 to av_log2
author glantau
date Wed, 15 Aug 2001 13:11:31 +0000
parents 5aa6292a1660
children 608c7f964bca
comparison
equal deleted inserted replaced
69:361631a8d140 70:c7767df463f4
315 overflow left */ 315 overflow left */
316 norm = 0; 316 norm = 0;
317 for(i=0;i<32;i++) { 317 for(i=0;i<32;i++) {
318 norm |= abs(tmp1[i]); 318 norm |= abs(tmp1[i]);
319 } 319 }
320 n = log2(norm) - 12; 320 n = av_log2(norm) - 12;
321 if (n > 0) { 321 if (n > 0) {
322 for(i=0;i<32;i++) 322 for(i=0;i<32;i++)
323 tmp1[i] >>= n; 323 tmp1[i] >>= n;
324 } else { 324 } else {
325 n = 0; 325 n = 0;
362 if (v > vmax) 362 if (v > vmax)
363 vmax = v; 363 vmax = v;
364 } 364 }
365 /* compute the scale factor index using log 2 computations */ 365 /* compute the scale factor index using log 2 computations */
366 if (vmax > 0) { 366 if (vmax > 0) {
367 n = log2(vmax); 367 n = av_log2(vmax);
368 /* n is the position of the MSB of vmax. now 368 /* n is the position of the MSB of vmax. now
369 use at most 2 compares to find the index */ 369 use at most 2 compares to find the index */
370 index = (21 - n) * 3 - 3; 370 index = (21 - n) * 3 - 3;
371 if (index >= 0) { 371 if (index >= 0) {
372 while (vmax <= scale_factor_table[index+1]) 372 while (vmax <= scale_factor_table[index+1])