comparison msmpeg4.c @ 221:fe243b4aec02 libavcodec

* temporal solution for shared lib compilation * using ALPHA code optimalization for non ARCH_I386
author kabi
date Mon, 28 Jan 2002 18:06:28 +0000
parents 73df666cacc7
children ae145876789d
comparison
equal deleted inserted replaced
220:0b234715e205 221:fe243b4aec02
435 435
436 /* XXX: the following solution consumes divisions, but it does not 436 /* XXX: the following solution consumes divisions, but it does not
437 necessitate to modify mpegvideo.c. The problem comes from the 437 necessitate to modify mpegvideo.c. The problem comes from the
438 fact they decided to store the quantized DC (which would lead 438 fact they decided to store the quantized DC (which would lead
439 to problems if Q could vary !) */ 439 to problems if Q could vary !) */
440 #ifdef ARCH_X86 440 #if defined ARCH_X86 && !defined PIC
441 /* using 16bit divisions as they are large enough and 2x as fast */ 441 /* using 16bit divisions as they are large enough and 2x as fast */
442 asm volatile( 442 asm volatile(
443 "movl %3, %%eax \n\t" 443 "movl %3, %%eax \n\t"
444 "shrl $1, %%eax \n\t" 444 "shrl $1, %%eax \n\t"
445 "addl %%eax, %2 \n\t" 445 "addl %%eax, %2 \n\t"
458 "movzwl %%ax, %2 \n\t" 458 "movzwl %%ax, %2 \n\t"
459 : "+r" (a), "+r" (b), "+r" (c) 459 : "+r" (a), "+r" (b), "+r" (c)
460 : "r" (scale) 460 : "r" (scale)
461 : "%eax", "%edx" 461 : "%eax", "%edx"
462 ); 462 );
463 #elif defined (ARCH_ALPHA) 463 #else
464 /* #elif defined (ARCH_ALPHA) */
464 /* Divisions are extremely costly on Alpha; optimize the most 465 /* Divisions are extremely costly on Alpha; optimize the most
465 common case. */ 466 common case. But they are costly everywhere...
467 */
466 if (scale == 8) { 468 if (scale == 8) {
467 a = (a + (8 >> 1)) / 8; 469 a = (a + (8 >> 1)) / 8;
468 b = (b + (8 >> 1)) / 8; 470 b = (b + (8 >> 1)) / 8;
469 c = (c + (8 >> 1)) / 8; 471 c = (c + (8 >> 1)) / 8;
470 } else { 472 } else {
471 a = (a + (scale >> 1)) / scale; 473 a = (a + (scale >> 1)) / scale;
472 b = (b + (scale >> 1)) / scale; 474 b = (b + (scale >> 1)) / scale;
473 c = (c + (scale >> 1)) / scale; 475 c = (c + (scale >> 1)) / scale;
474 } 476 }
475 #else
476 a = (a + (scale >> 1)) / scale;
477 b = (b + (scale >> 1)) / scale;
478 c = (c + (scale >> 1)) / scale;
479 #endif 477 #endif
480 /* XXX: WARNING: they did not choose the same test as MPEG4. This 478 /* XXX: WARNING: they did not choose the same test as MPEG4. This
481 is very important ! */ 479 is very important ! */
482 if (abs(a - b) <= abs(b - c)) { 480 if (abs(a - b) <= abs(b - c)) {
483 pred = c; 481 pred = c;