Skip to content
Snippets Groups Projects
Commit 6fe84b43 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

use multiply instead of divides for DC prediction on X86

Originally committed as revision 286 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b81cf274
Branches
Tags
No related merge requests found
...@@ -50,6 +50,8 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr); ...@@ -50,6 +50,8 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
static int msmpeg4_decode_motion(MpegEncContext * s, static int msmpeg4_decode_motion(MpegEncContext * s,
int *mx_ptr, int *my_ptr); int *mx_ptr, int *my_ptr);
extern UINT32 inverse[256];
#ifdef DEBUG #ifdef DEBUG
int intra_count = 0; int intra_count = 0;
int frame_count = 0; int frame_count = 0;
...@@ -438,26 +440,22 @@ static int msmpeg4_pred_dc(MpegEncContext * s, int n, ...@@ -438,26 +440,22 @@ static int msmpeg4_pred_dc(MpegEncContext * s, int n,
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 !) */
#if defined ARCH_X86 && !defined PIC #if defined ARCH_X86 && !defined PIC
/* using 16bit divisions as they are large enough and 2x as fast */
asm volatile( asm volatile(
"movl %3, %%eax \n\t" "movl %3, %%eax \n\t"
"shrl $1, %%eax \n\t" "shrl $1, %%eax \n\t"
"addl %%eax, %2 \n\t" "addl %%eax, %2 \n\t"
"addl %%eax, %1 \n\t" "addl %%eax, %1 \n\t"
"addl %0, %%eax \n\t" "addl %0, %%eax \n\t"
"xorl %%edx, %%edx \n\t" "mull %4 \n\t"
"divw %w3 \n\t" "movl %%edx, %0 \n\t"
"movzwl %%ax, %0 \n\t"
"movl %1, %%eax \n\t" "movl %1, %%eax \n\t"
"xorl %%edx, %%edx \n\t" "mull %4 \n\t"
"divw %w3 \n\t" "movl %%edx, %1 \n\t"
"movzwl %%ax, %1 \n\t"
"movl %2, %%eax \n\t" "movl %2, %%eax \n\t"
"xorl %%edx, %%edx \n\t" "mull %4 \n\t"
"divw %w3 \n\t" "movl %%edx, %2 \n\t"
"movzwl %%ax, %2 \n\t" : "+r" (a), "+r" (b), "+r" (c)
: "+r" (a), "+r" (b), "+r" (c) : "g" (scale), "r" (inverse[scale])
: "r" (scale)
: "%eax", "%edx" : "%eax", "%edx"
); );
#else #else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment