[MPlayer-dev-eng] [PATCH]: hqdn3d.c: refactorize LowPassMul in macro, 10%~20% faster on Athlon X2

Zhou Zongyi zhouzongyi at pset.suntec.net
Tue Jan 6 02:56:01 CET 2009


Hi all,

The following patch refactorizes LowPassMul in macro. My compiler is MinGW 4.3.2 and the new version gives me 10%~20% speedup.

Index: libmpcodecs/vf_hqdn3d.c 
=================================================================== 
--- libmpcodecs/vf_hqdn3d.c (revision 28262) 
+++ libmpcodecs/vf_hqdn3d.c (working copy) 
@@ -67,12 +67,7 @@ 
  return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); 
 } 
  
-static inline unsigned int LowPassMul(unsigned int PrevMul, unsigned int CurrMul, int* Coef){ 
-//    int dMul= (PrevMul&0xFFFFFF)-(CurrMul&0xFFFFFF); 
-    int dMul= PrevMul-CurrMul; 
-    int d=((dMul+0x10007FF)>>12); 
-    return CurrMul + Coef[d]; 
-} 
+#define LowPassMul(PrevMul, CurrMul, Coef) ((CurrMul)+(Coef)[((PrevMul)-(CurrMul)+0x10007FF)>>12]) 
  
 static void deNoiseTemporal( 
                     unsigned char *Frame,        // mpi->planes[x]


Zhou Zongyi, zhouzongyi at pset.suntec.net 
2009-01-06


More information about the MPlayer-dev-eng mailing list