[Ffmpeg-cvslog] r6615 - trunk/libavcodec/cabac.h

michael subversion
Tue Oct 10 03:08:39 CEST 2006

Author: michael
Date: Tue Oct 10 03:08:39 2006
New Revision: 6615


replace a few and/sub/... by cmov
this is faster on P3, should be faster on AMD, and should be slower on P4
its disabled by default (benchmarks welcome so we know when to enable it)

Modified: trunk/libavcodec/cabac.h
--- trunk/libavcodec/cabac.h	(original)
+++ trunk/libavcodec/cabac.h	Tue Oct 10 03:08:39 2006
@@ -459,6 +459,14 @@
         "movl "LOW      "(%2), %%ebx            \n\t"
 //eax:state ebx:low, edx:range, esi:RangeLPS
         "subl %%esi, %%edx                      \n\t"
+#ifdef CMOV_IS_FAST //FIXME actually define this somewhere
+        "cmpl %%ebx, %%edx                      \n\t"
+        "cmova %%edx, %%esi                     \n\t"
+        "sbbl %%ecx, %%ecx                      \n\t"
+        "andl %%ecx, %%edx                      \n\t"
+        "subl %%edx, %%ebx                      \n\t"
+        "xorl %%ecx, %%eax                      \n\t"
         "movl %%edx, %%ecx                      \n\t"
         "subl %%ebx, %%edx                      \n\t"
         "sarl $31, %%edx                        \n\t" //lps_mask
@@ -467,9 +475,10 @@
         "addl %%ecx, %%esi                      \n\t" //new range
         "andl %%edx, %%ecx                      \n\t"
         "subl %%ecx, %%ebx                      \n\t"
+        "xorl %%edx, %%eax                      \n\t"
 //eax:state ebx:low edx:mask esi:range
-        "xorl %%edx, %%eax                      \n\t"
         "movzbl "MPS_STATE"(%2, %%eax), %%ecx   \n\t"
         "movb %%cl, (%1)                        \n\t"

More information about the ffmpeg-cvslog mailing list