You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
(commit by michael)
16-bit divide instead of 32-bit on x86 in msmpeg_pred_dc() Originally committed as revision 264 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@@ -411,10 +411,34 @@ static int msmpeg4_pred_dc(MpegEncContext * s, int n,
|
|||||||
necessitate to modify mpegvideo.c. The problem comes from the
|
necessitate to modify mpegvideo.c. The problem comes from the
|
||||||
fact they decided to store the quantized DC (which would lead
|
fact they decided to store the quantized DC (which would lead
|
||||||
to problems if Q could vary !) */
|
to problems if Q could vary !) */
|
||||||
|
#ifdef ARCH_X86
|
||||||
|
/* using 16bit divisions as they are large enough and 2x as fast */
|
||||||
|
asm volatile(
|
||||||
|
"movl %3, %%eax \n\t"
|
||||||
|
"shrl $1, %%eax \n\t"
|
||||||
|
"addl %%eax, %2 \n\t"
|
||||||
|
"addl %%eax, %1 \n\t"
|
||||||
|
"addl %0, %%eax \n\t"
|
||||||
|
"xorl %%edx, %%edx \n\t"
|
||||||
|
"divw %w3 \n\t"
|
||||||
|
"movzwl %%ax, %0 \n\t"
|
||||||
|
"movl %1, %%eax \n\t"
|
||||||
|
"xorl %%edx, %%edx \n\t"
|
||||||
|
"divw %w3 \n\t"
|
||||||
|
"movzwl %%ax, %1 \n\t"
|
||||||
|
"movl %2, %%eax \n\t"
|
||||||
|
"xorl %%edx, %%edx \n\t"
|
||||||
|
"divw %w3 \n\t"
|
||||||
|
"movzwl %%ax, %2 \n\t"
|
||||||
|
: "+r" (a), "+r" (b), "+r" (c)
|
||||||
|
: "r" (scale)
|
||||||
|
: "%eax", "%edx"
|
||||||
|
);
|
||||||
|
#else
|
||||||
a = (a + (scale >> 1)) / scale;
|
a = (a + (scale >> 1)) / scale;
|
||||||
b = (b + (scale >> 1)) / scale;
|
b = (b + (scale >> 1)) / scale;
|
||||||
c = (c + (scale >> 1)) / scale;
|
c = (c + (scale >> 1)) / scale;
|
||||||
|
#endif
|
||||||
/* XXX: WARNING: they did not choose the same test as MPEG4. This
|
/* XXX: WARNING: they did not choose the same test as MPEG4. This
|
||||||
is very important ! */
|
is very important ! */
|
||||||
if (abs(a - b) <= abs(b - c)) {
|
if (abs(a - b) <= abs(b - c)) {
|
||||||
|
Reference in New Issue
Block a user