changeset 249:2dadc379a934

OSD/SUB image quality & speed improvement
author arpi_esp
date Thu, 29 Mar 2001 16:06:36 +0000
parents 33360ef1b97a
children d4f711fde94b
files libvo/font_load.c libvo/mga_common.c libvo/vo_x11.c libvo/vo_xv.c
diffstat 4 files changed, 29 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/font_load.c	Thu Mar 29 16:00:52 2001 +0000
+++ b/libvo/font_load.c	Thu Mar 29 16:06:36 2001 +0000
@@ -199,7 +199,8 @@
         printf("font: Missing bitmap(s) for sub-font #%d\n",i);
         return NULL;
     }
-    if(factor!=1.0f){
+    //if(factor!=1.0f)
+    {
         // re-sample alpha
         int f=factor*256.0f;
         int size=desc->pic_a[i]->w*desc->pic_a[i]->h;
@@ -208,12 +209,21 @@
         for(j=0;j<size;j++){
             int x=desc->pic_a[i]->bmp[j];
             int y=desc->pic_b[i]->bmp[j];
-            
-            x=((x*f*(255-y))>>16)+y;
+
+	    x=((x*f)>>8); // scale
+	    if(x<0) x=0; else if(x>255) x=255;
+	    x^=255; // invert
+	    
+	    if(x+y>255) x=255-y; // to avoid overflows
+	    
+	    //x=0;            
+            //x=((x*f*(255-y))>>16);
+            //x=((x*f*(255-y))>>16)+y;
             //x=(x*f)>>8;if(x<y) x=y;
             
-            if(x<0) x=0; else
-            if(x>255) x=255;
+            if(x<1) x=1; else
+            if(x>=252) x=0;
+	    
             desc->pic_a[i]->bmp[j]=x;
         }
         printf("DONE!\n");
--- a/libvo/mga_common.c	Thu Mar 29 16:00:52 2001 +0000
+++ b/libvo/mga_common.c	Thu Mar 29 16:06:36 2001 +0000
@@ -18,7 +18,8 @@
         for(x=0;x<w;x++){
 //            dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
             if(srca[x])
-            dst[x]=(dst[x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
+	    dst[x]=((dst[x]*srca[x])>>8)+src[x];
+            //dst[x]=(dst[x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
         }
         src+=stride;
         srca+=stride;
@@ -31,7 +32,8 @@
         for(x=0;x<w;x++){
 //            dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
             if(srca[x])
-            dst[2*x]=(dst[2*x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
+	    dst[2*x]=((dst[2*x]*srca[x])>>8)+src[x];
+            //dst[2*x]=(dst[2*x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
         }
         src+=stride;
         srca+=stride;
--- a/libvo/vo_x11.c	Thu Mar 29 16:00:52 2001 +0000
+++ b/libvo/vo_x11.c	Thu Mar 29 16:06:36 2001 +0000
@@ -392,9 +392,12 @@
         for(x=0;x<w;x++){
 //            dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
             if(srca[x]){
-                dst[0]=(dst[0]*(srca[x]^255)+src[x]*(srca[x]))>>8;
-                dst[1]=(dst[1]*(srca[x]^255)+src[x]*(srca[x]))>>8;
-                dst[2]=(dst[2]*(srca[x]^255)+src[x]*(srca[x]))>>8;
+		dst[0]=((dst[0]*srca[x])>>8)+src[x];
+		dst[1]=((dst[1]*srca[x])>>8)+src[x];
+		dst[2]=((dst[2]*srca[x])>>8)+src[x];
+                //dst[0]=(dst[0]*(srca[x]^255)+src[x]*(srca[x]))>>8;
+                //dst[1]=(dst[1]*(srca[x]^255)+src[x]*(srca[x]))>>8;
+                //dst[2]=(dst[2]*(srca[x]^255)+src[x]*(srca[x]))>>8;
             }
             dst+=dbpp;
         }
--- a/libvo/vo_xv.c	Thu Mar 29 16:00:52 2001 +0000
+++ b/libvo/vo_xv.c	Thu Mar 29 16:06:36 2001 +0000
@@ -264,7 +264,8 @@
         for(x=0;x<w;x++){
 //            dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
             if(srca[x])
-            dst[x]=(dst[x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
+//            dst[x]=(dst[x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
+            dst[x]=((dst[x]*srca[x])>>8)+src[x];
         }
         src+=stride;
         srca+=stride;
@@ -277,7 +278,8 @@
         for(x=0;x<w;x++){
 //            dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
             if(srca[x])
-            dst[2*x]=(dst[2*x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
+//            dst[2*x]=(dst[2*x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
+            dst[2*x]=((dst[2*x]*srca[x])>>8)+src[x];
         }
         src+=stride;
         srca+=stride;