[Mplayer-cvslog] CVS: main/libmpcodecs vf_denoise3d.c,1.3,1.4

Arpi of Ize arpi at mplayerhq.hu
Sun Feb 9 13:52:02 CET 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv26920

Modified Files:
	vf_denoise3d.c 
Log Message:
cleanup & more optimize


Index: vf_denoise3d.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_denoise3d.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- vf_denoise3d.c	9 Feb 2003 02:07:11 -0000	1.3
+++ vf_denoise3d.c	9 Feb 2003 12:51:59 -0000	1.4
@@ -68,20 +68,7 @@
     free(vf->priv->Line);
 }
 
-//#define LowPass(Prev, Curr, Coef) (((Prev)*Coef[Prev - Curr] + (Curr)*(65536-(Coef[Prev - Curr]))) / 65536)
-//#define LowPass(Prev, Curr, Coef) ((  Prev*Coef[Prev-Curr] + Curr*(65536-(Coef[Prev-Curr]))  )/65536)
-//#define LowPass(Prev, Curr, Coef) ((  Prev*Coef[Prev-Curr] + Curr*65536 - Curr*Coef[Prev-Curr]  )/65536)
-//#define LowPass(Prev, Curr, Coef) (((int)(Curr)) + ((  (int)Prev*Coef[Prev-Curr] - (int)Curr*Coef[Prev-Curr]  )>>16) )
-//#define LowPass(Prev, Curr, Coef) (Curr + ((  Prev*Coef[Prev-Curr] - Curr*Coef[Prev-Curr]  )>>16) )
-//#define LowPass(Prev, Curr, Coef) (Curr + ((  (Prev-Curr)*(Coef[Prev-Curr])  )>>16) )
-
-//#define LowPass(Prev, Curr, Coef) (Curr + (((Prev - Curr)*Coef[Prev - Curr]) / 65536))
-#define LowPass(Prev, Curr, Coef) (Curr + ((((unsigned int)(Prev - Curr))*Coef[Prev - Curr]) / 65536))
-//#define LowPass(Prev, Curr, Coef) (Curr + ((((unsigned int)(Prev - Curr))*Coef[((unsigned int)(Prev - Curr))]) / 65536))
-//#define LowPass(Prev, Curr, Coef) (Curr + ((((unsigned char)(Prev - Curr))*Coef[Prev - Curr]) / 65536))
-//#define LowPass(Prev, Curr, Coef) (Curr + (( ((((int)(Prev))-((int)(Curr)))) *Coef[Prev - Curr]) / 65536))
-//#define LowPass(Prev, Curr, Coef) (Curr + (((unsigned int)((Prev - Curr)*Coef[Prev - Curr])) / 65536))
-//#define LowPass(Prev, Curr, Coef) (Curr + (((Prev - Curr)*Coef[Prev - Curr]) >> 16))
+#define LowPass(Prev, Curr, Coef) (Curr + Coef[Prev - Curr])
 
 static void deNoise(unsigned char *Frame,        // mpi->planes[x]
                     unsigned char *FramePrev,    // pmpi->planes[x]
@@ -185,14 +172,16 @@
 static void PrecalcCoefs(int *Ct, double Dist25)
 {
     int i;
-    double Gamma, Simil;
+    double Gamma, Simil, C;
 
     Gamma = log(0.25) / log(1.0 - Dist25/255.0);
 
     for (i = -256; i <= 255; i++)
     {
         Simil = 1.0 - ABS(i) / 255.0;
-        Ct[256+i] = pow(Simil, Gamma) * 65536;
+//        Ct[256+i] = lround(pow(Simil, Gamma) * (double)i);
+        C = pow(Simil, Gamma) * (double)i;
+        Ct[256+i] = (C<0) ? (C-0.5) : (C+0.5);
     }
 }
 



More information about the MPlayer-cvslog mailing list