Mercurial > libavcodec.hg
comparison msmpeg4.c @ 204:fceb435fae6b libavcodec
(commit by michael)
16-bit divide instead of 32-bit on x86 in msmpeg_pred_dc()
author | arpi_esp |
---|---|
date | Mon, 14 Jan 2002 04:34:52 +0000 |
parents | 91ed656e7339 |
children | 2eb04d6be309 |
comparison
equal
deleted
inserted
replaced
203:9bfd3abd85eb | 204:fceb435fae6b |
---|---|
409 | 409 |
410 /* XXX: the following solution consumes divisions, but it does not | 410 /* XXX: the following solution consumes divisions, but it does not |
411 necessitate to modify mpegvideo.c. The problem comes from the | 411 necessitate to modify mpegvideo.c. The problem comes from the |
412 fact they decided to store the quantized DC (which would lead | 412 fact they decided to store the quantized DC (which would lead |
413 to problems if Q could vary !) */ | 413 to problems if Q could vary !) */ |
414 #ifdef ARCH_X86 | |
415 /* using 16bit divisions as they are large enough and 2x as fast */ | |
416 asm volatile( | |
417 "movl %3, %%eax \n\t" | |
418 "shrl $1, %%eax \n\t" | |
419 "addl %%eax, %2 \n\t" | |
420 "addl %%eax, %1 \n\t" | |
421 "addl %0, %%eax \n\t" | |
422 "xorl %%edx, %%edx \n\t" | |
423 "divw %w3 \n\t" | |
424 "movzwl %%ax, %0 \n\t" | |
425 "movl %1, %%eax \n\t" | |
426 "xorl %%edx, %%edx \n\t" | |
427 "divw %w3 \n\t" | |
428 "movzwl %%ax, %1 \n\t" | |
429 "movl %2, %%eax \n\t" | |
430 "xorl %%edx, %%edx \n\t" | |
431 "divw %w3 \n\t" | |
432 "movzwl %%ax, %2 \n\t" | |
433 : "+r" (a), "+r" (b), "+r" (c) | |
434 : "r" (scale) | |
435 : "%eax", "%edx" | |
436 ); | |
437 #else | |
414 a = (a + (scale >> 1)) / scale; | 438 a = (a + (scale >> 1)) / scale; |
415 b = (b + (scale >> 1)) / scale; | 439 b = (b + (scale >> 1)) / scale; |
416 c = (c + (scale >> 1)) / scale; | 440 c = (c + (scale >> 1)) / scale; |
417 | 441 #endif |
418 /* XXX: WARNING: they did not choose the same test as MPEG4. This | 442 /* XXX: WARNING: they did not choose the same test as MPEG4. This |
419 is very important ! */ | 443 is very important ! */ |
420 if (abs(a - b) <= abs(b - c)) { | 444 if (abs(a - b) <= abs(b - c)) { |
421 pred = c; | 445 pred = c; |
422 *dir_ptr = 1; | 446 *dir_ptr = 1; |