[Mplayer-cvslog] CVS: main/TOOLS/subfont-c subfont.c,1.6,1.7

Arpi of Ize arpi at mplayer.dev.hu
Mon Aug 13 21:33:43 CEST 2001


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

Modified Files:
	subfont.c 
Log Message:
speed optimized :)

Index: subfont.c
===================================================================
RCS file: /cvsroot/mplayer/main/TOOLS/subfont-c/subfont.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- subfont.c	13 Aug 2001 18:39:23 -0000	1.6
+++ subfont.c	13 Aug 2001 19:33:41 -0000	1.7
@@ -453,23 +453,23 @@
 	int r,
 	int mwidth) {
 
-    int x, y, mx, my;
+    int x, y;
     for (y = 0; y<height; ++y) {
 	for (x = 0; x<width; ++x, ++s, ++t) {
 	    unsigned max = 0;
 	    unsigned *mrow = m + r;
 	    unsigned char *srow = s -r*width;
+	    int x1=(x<r)?-x:-r;
+	    int x2=(x+r>=width)?(width-x-1):r;
+	    int my;
 
 	    for (my = -r; my<=r; ++my, srow+= width, mrow+= mwidth) {
+		int mx;
 		if (y+my < 0) continue;
 		if (y+my >= height) break;
 
-		for (mx = -r; mx<=r; ++mx) {
-		    unsigned v;
-		    if (x+mx < 0) continue;
-		    if (x+mx >= width) break;
-
-		    v = srow[mx] * mrow[mx];
+		for (mx = x1; mx<=x2; ++mx) {
+		    unsigned v = srow[mx] * mrow[mx];
 		    if (v>max) max = v;
 		}
 	    }
@@ -523,24 +523,25 @@
 	int mwidth,
 	unsigned volume) {
 
-    int x, y, mx, my;
+    int x, y;
 
     for (y = 0; y<height; ++y) {
 	for (x = 0; x<width; ++x, ++s, ++t) {
 	    unsigned sum = 0;
 	    unsigned *mrow = m + r;
 	    unsigned char *srow = s -r*width;
+	    int x1=(x<r)?-x:-r;
+	    int x2=(x+r>=width)?(width-x-1):r;
+	    int my;
 
 	    for (my = -r; my<=r; ++my, srow+= width, mrow+= mwidth) {
+		int mx;
 		if (y+my < 0) continue;
 		if (y+my >= height) break;
 
-		for (mx = -r; mx<=r; ++mx) {
-		    if (x+mx < 0) continue;
-		    if (x+mx >= width) break;
-
+		for (mx = x1; mx<=x2; ++mx)
 		    sum+= srow[mx] * mrow[mx];
-		}
+
 	    }
 	    *t = (sum + volume/2) / volume;
 	}
@@ -592,9 +593,12 @@
     if (DEBUG) eprintf("\n");
 
 
-    outline(buffer, tbuffer, width, height, om, o_r, o_w);	// solid outline
+    if(thickness==1.0)
+      outline1(buffer, tbuffer, width, height);	// FAST solid 1 pixel outline
+    else
+      outline(buffer, tbuffer, width, height, om, o_r, o_w);	// solid outline
+    
     //outline(buffer, tbuffer, width, height, gm, g_r, g_w);	// Gaussian outline
-    //outline1(buffer, tbuffer, width, height);	// solid 1 pixel outline
 
     blur(tbuffer, abuffer, width, height, gm, g_r, g_w, volume);
 




More information about the MPlayer-cvslog mailing list