[Mplayer-cvslog] CVS: main/libvo font_load.c,1.13,1.14 osd.c,1.2,1.3 osd.h,1.1,1.2 sub.c,1.11,1.12

GEREOFFY arpi_esp at users.sourceforge.net
Sat Jun 2 18:02:00 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory usw-pr-cvs1:/tmp/cvs-serv17527

Modified Files:
	font_load.c osd.c osd.h sub.c 
Log Message:
FAST_OSD option to disable font outline antialiasing

Index: font_load.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/font_load.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** font_load.c	2001/05/08 20:09:39	1.13
--- font_load.c	2001/06/02 16:01:58	1.14
***************
*** 4,7 ****
--- 4,8 ----
  #include <string.h>
  
+ #include "config.h"
  #include "font_load.h"
  
***************
*** 211,217 ****
          if(verbose) printf("font: resampling alpha by factor %5.3f (%d) ",factor,f);fflush(stdout);
          for(j=0;j<size;j++){
!             int x=desc->pic_a[i]->bmp[j];
!             int y=desc->pic_b[i]->bmp[j];
  
  	    x=255-((x*f)>>8); // scale
  	    //if(x<0) x=0; else if(x>255) x=255;
--- 212,222 ----
          if(verbose) printf("font: resampling alpha by factor %5.3f (%d) ",factor,f);fflush(stdout);
          for(j=0;j<size;j++){
!             int x=desc->pic_a[i]->bmp[j];	// alpha
!             int y=desc->pic_b[i]->bmp[j];	// bitmap
  
+ #ifdef FAST_OSD
+ 	    x=(x<(255-f))?0:1;
+ #else
+ 
  	    x=255-((x*f)>>8); // scale
  	    //if(x<0) x=0; else if(x>255) x=255;
***************
*** 227,230 ****
--- 232,236 ----
              if(x<1) x=1; else
              if(x>=252) x=0;
+ #endif
  
              desc->pic_a[i]->bmp[j]=x;

Index: osd.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/osd.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** osd.c	2001/04/24 20:03:13	1.2
--- osd.c	2001/06/02 16:01:58	1.3
***************
*** 2,13 ****
--- 2,25 ----
  // These are "reference implementations", should be optimized later (MMX, etc)
  
+ //#define FAST_OSD
+ //#define FAST_OSD_TABLE
+ 
+ #include "config.h"
  #include "osd.h"
  
  void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
      int y;
+ #ifdef FAST_OSD
+     w=w>>1;
+ #endif
      for(y=0;y<h;y++){
          register int x;
          for(x=0;x<w;x++){
+ #ifdef FAST_OSD
+             if(srca[2*x+0]) dstbase[2*x+0]=src[2*x+0];
+             if(srca[2*x+1]) dstbase[2*x+1]=src[2*x+1];
+ #else
              if(srca[x]) dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x];
+ #endif
          }
          src+=srcstride;
***************
*** 20,27 ****
--- 32,47 ----
  void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
      int y;
+ #ifdef FAST_OSD
+     w=w>>1;
+ #endif
      for(y=0;y<h;y++){
          register int x;
          for(x=0;x<w;x++){
+ #ifdef FAST_OSD
+             if(srca[2*x+0]) dstbase[4*x+0]=src[2*x+0];
+             if(srca[2*x+1]) dstbase[4*x+2]=src[2*x+1];
+ #else
              if(srca[x]) dstbase[2*x]=((dstbase[2*x]*srca[x])>>8)+src[x];
+ #endif
          }
          src+=srcstride;
***************
*** 39,45 ****
--- 59,69 ----
          for(x=0;x<w;x++){
              if(srca[x]){
+ #ifdef FAST_OSD
+ 		dst[0]=dst[1]=dst[2]=src[x];
+ #else
  		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];
+ #endif
              }
              dst+=3; // 24bpp
***************
*** 58,64 ****
--- 82,92 ----
          for(x=0;x<w;x++){
              if(srca[x]){
+ #ifdef FAST_OSD
+ 		dstbase[4*x+0]=dstbase[4*x+1]=dstbase[4*x+2]=src[x];
+ #else
  		dstbase[4*x+0]=((dstbase[4*x+0]*srca[x])>>8)+src[x];
  		dstbase[4*x+1]=((dstbase[4*x+1]*srca[x])>>8)+src[x];
  		dstbase[4*x+2]=((dstbase[4*x+2]*srca[x])>>8)+src[x];
+ #endif
              }
          }
***************
*** 70,73 ****
--- 98,116 ----
  }
  
+ #ifdef FAST_OSD_TABLE
+ static unsigned short fast_osd_15bpp_table[256];
+ static unsigned short fast_osd_16bpp_table[256];
+ #endif
+ 
+ void vo_draw_alpha_init(){
+ #ifdef FAST_OSD_TABLE
+     int i;
+     for(i=0;i<256;i++){
+         fast_osd_15bpp_table[i]=((i>>3)<<10)|((i>>3)<<5)|(i>>3);
+         fast_osd_16bpp_table[i]=((i>>3)<<11)|((i>>2)<<5)|(i>>3);
+     }
+ #endif
+ }
+ 
  void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
      int y;
***************
*** 77,80 ****
--- 120,131 ----
          for(x=0;x<w;x++){
              if(srca[x]){
+ #ifdef FAST_OSD
+ #ifdef FAST_OSD_TABLE
+                 dst[x]=fast_osd_15bpp_table[src[x]];
+ #else
+ 		register unsigned int a=src[x]>>3;
+                 dst[x]=(a<<10)|(a<<5)|a;
+ #endif
+ #else
                  unsigned char r=dst[x]&0x1F;
                  unsigned char g=(dst[x]>>5)&0x1F;
***************
*** 84,87 ****
--- 135,139 ----
                  b=(((b*srca[x])>>5)+src[x])>>3;
                  dst[x]=(b<<10)|(g<<5)|r;
+ #endif
              }
          }
***************
*** 100,103 ****
--- 152,162 ----
          for(x=0;x<w;x++){
              if(srca[x]){
+ #ifdef FAST_OSD
+ #ifdef FAST_OSD_TABLE
+                 dst[x]=fast_osd_16bpp_table[src[x]];
+ #else
+                 dst[x]=((src[x]>>3)<<11)|((src[x]>>2)<<5)|(src[x]>>3);
+ #endif
+ #else
                  unsigned char r=dst[x]&0x1F;
                  unsigned char g=(dst[x]>>5)&0x3F;
***************
*** 107,110 ****
--- 166,170 ----
                  b=(((b*srca[x])>>5)+src[x])>>3;
                  dst[x]=(b<<11)|(g<<5)|r;
+ #endif
              }
          }

Index: osd.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/osd.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** osd.h	2001/04/24 11:35:07	1.1
--- osd.h	2001/06/02 16:01:58	1.2
***************
*** 6,9 ****
--- 6,11 ----
  // These are "reference implementations", should be optimized later (MMX, etc)
  
+ extern void vo_draw_alpha_init(); // build tables
+ 
  extern void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride);
  extern void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride);

Index: sub.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/sub.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** sub.c	2001/05/24 20:48:45	1.11
--- sub.c	2001/06/02 16:01:58	1.12
***************
*** 187,194 ****
--- 187,200 ----
  }
  
+ static int draw_alpha_init_flag=0;
  
  void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
  
      if(!vo_font) return; // no font
+ 
+     if(!draw_alpha_init_flag){
+ 	draw_alpha_init_flag=1;
+ 	vo_draw_alpha_init();
+     }
  
      if(vo_osd_text){


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list