[FFmpeg-cvslog] r18737 - trunk/libavcodec/ppc/mathops.h

mru subversion
Mon May 4 19:31:15 CEST 2009


Author: mru
Date: Mon May  4 19:31:15 2009
New Revision: 18737

Log:
PPC: implement MULH() in assembler

Left to its own devices, gcc calculates the full 64-bit product only to
discard the low 32 bits.  This forces it to do the right thing.

20% faster MP3 decoding on G4.

Modified:
   trunk/libavcodec/ppc/mathops.h

Modified: trunk/libavcodec/ppc/mathops.h
==============================================================================
--- trunk/libavcodec/ppc/mathops.h	Mon May  4 16:23:48 2009	(r18736)
+++ trunk/libavcodec/ppc/mathops.h	Mon May  4 19:31:15 2009	(r18737)
@@ -37,4 +37,11 @@
     __rt; })
 #endif
 
+#define MULH MULH
+static inline av_const int MULH(int a, int b){
+    int r;
+    __asm__ ("mulhw %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
+    return r;
+}
+
 #endif /* AVCODEC_PPC_MATHOPS_H */



More information about the ffmpeg-cvslog mailing list