[Mplayer-cvslog] CVS: main/TOOLS/subfont-c subfont.c,1.2,1.3

Arpi of Ize arpi at mplayer.dev.hu
Thu Aug 9 20:39:46 CEST 2001


Update of /cvsroot/mplayer/main/TOOLS/subfont-c
In directory mplayer:/var/tmp.root/cvs-serv12363

Modified Files:
	subfont.c 
Log Message:
some optimization

Index: subfont.c
===================================================================
RCS file: /cvsroot/mplayer/main/TOOLS/subfont-c/subfont.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- subfont.c	9 Aug 2001 17:29:25 -0000	1.2
+++ subfont.c	9 Aug 2001 18:39:43 -0000	1.3
@@ -362,37 +362,31 @@
 	for (x = 0; x<width; ++x) {
 	    float max = 0;
 	    for (my = -r; my<=r; ++my)
-		if (y+my>0 && y+my<height-1)
+		if (y+my>0 && y+my<height-1){
+		    int ay=(y+my)*width;
 		    for (mx = -r; mx<=r; ++mx) {
-			if (x+mx>0 && x+mx<width-1) {
-//			    int p = buffer[x+mx+(y+my)*width] * m[mx+r+(my+r)*w];
-			    int p = 0;
+			int ax=x+mx;
+			if (ax>0 && ax<width-1) {
+			    int p =
 
-			    p = ( (buffer[x+mx-1+(y+my-1)*width]) +
-			    (buffer[x+mx-1+(y+my+1)*width]) +
-			    (buffer[x+mx+1+(y+my-1)*width]) +
-			    (buffer[x+mx+1+(y+my+1)*width]) )/2 +
+			  ( (buffer[ax-1+ay-width]) +
+			    (buffer[ax-1+ay+width]) +
+			    (buffer[ax+1+ay-width]) +
+			    (buffer[ax+1+ay+width]) )/2 +
 
-			  ( (buffer[x+mx-1+(y+my)*width]) +
-			    (buffer[x+mx+1+(y+my)*width]) +
-			    (buffer[x+mx+(y+my-1)*width]) +
-			    (buffer[x+mx+(y+my+1)*width]) +
+			  ( (buffer[ax-1+ay]) +
+			    (buffer[ax+1+ay]) +
+			    (buffer[ax+ay-width]) +
+			    (buffer[ax+ay+width]) +
 
-			    (buffer[x+mx+(y+my)*width]) ) ;
+			    (buffer[ax+ay]) ) ;
 			    
-			    if(p>255) p=255;
-			    
-			//    p*=m[mx+r+(my+r)*w];
-			//    if (p>max) {
-			//	max = p;
-			//	abuffer[x+y*width] = (p + maxcolor/2) / maxcolor;
-			//    }
-			    //max+=(p + maxcolor/2) / maxcolor;
-			    max+=p*m[mx+r+(my+r)*w]/(float)sum;
+			    max+=(p>255?255:p)*m[mx+r+(my+r)*w];
 			}
 		    
 		    }
-	    max=max*alpha_factor;
+		}
+	    max*=alpha_factor/(float)sum;
 //	    printf("%5.3f ",max);
 	    if(max>255) max=255;
 	    abuffer[x+y*width] = max;




More information about the MPlayer-cvslog mailing list