changeset 225:ae145876789d libavcodec

use multiply instead of divides for DC prediction on X86
author michaelni
date Tue, 05 Feb 2002 22:51:23 +0000
parents 8b3e70afa2ba
children 5784987c3940
files msmpeg4.c
diffstat 1 files changed, 10 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/msmpeg4.c	Tue Jan 29 04:21:27 2002 +0000
+++ b/msmpeg4.c	Tue Feb 05 22:51:23 2002 +0000
@@ -50,6 +50,8 @@
 static int msmpeg4_decode_motion(MpegEncContext * s, 
                                  int *mx_ptr, int *my_ptr);
 
+extern UINT32 inverse[256];
+
 #ifdef DEBUG
 int intra_count = 0;
 int frame_count = 0;
@@ -438,26 +440,22 @@
        fact they decided to store the quantized DC (which would lead
        to problems if Q could vary !) */
 #if defined ARCH_X86 && !defined PIC
-    /* 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"
+	"mull %4		\n\t"
+	"movl %%edx, %0		\n\t"
 	"movl %1, %%eax		\n\t"
-	"xorl %%edx, %%edx	\n\t"
-        "divw %w3		\n\t"
-	"movzwl %%ax, %1	\n\t"
+	"mull %4		\n\t"
+	"movl %%edx, %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)
+	"mull %4		\n\t"
+	"movl %%edx, %2		\n\t"
+	: "+r" (a), "+r" (b), "+r" (c)
+	: "g" (scale), "r" (inverse[scale])
 	: "%eax", "%edx"
     );
 #else