[Mplayer-cvslog] CVS: main/libvo osd.c,NONE,1.1 Makefile,1.4,1.5 mga_common.c,1.8,1.9 video_out_internal.h,1.2,1.3 vo_x11.c,1.10,1.11 vo_xv.c,1.7,1.8 x11_common.c,1.2,1.3

GEREOFFY arpi_esp at users.sourceforge.net
Tue Apr 10 04:29:40 CEST 2001


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

Modified Files:
	Makefile mga_common.c video_out_internal.h vo_x11.c vo_xv.c 
	x11_common.c 
Added Files:
	osd.c 
Log Message:
OSD alpha renderers moved to osd.c

--- NEW FILE ---
// Generic alpha renderers for all YUV modes and RGB depths.
// These are "reference implementations", should be optimized later (MMX, etc)

void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
    int y;
    for(y=0;y<h;y++){
        register int x;
        for(x=0;x<w;x++){
            if(srca[x]) dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x];
        }
        src+=srcstride;
        srca+=srcstride;
        dstbase+=dststride;
    }
    return;
}

void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
    int y;
    for(y=0;y<h;y++){
        register int x;
        for(x=0;x<w;x++){
            if(srca[x]) dstbase[2*x]=((dstbase[2*x]*srca[x])>>8)+src[x];
        }
        src+=srcstride;
        srca+=srcstride;
        dstbase+=dststride;
    }
    return;
}

void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
    int y;
    for(y=0;y<h;y++){
        register unsigned char *dst = dstbase;
        register int x;
        for(x=0;x<w;x++){
            if(srca[x]){
		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+=3; // 24bpp
        }
        src+=srcstride;
        srca+=srcstride;
        dstbase+=dststride;
    }
    return;
}

void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
    int y;
    for(y=0;y<h;y++){
        register int x;
        for(x=0;x<w;x++){
            if(srca[x]){
		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];
            }
        }
        src+=srcstride;
        srca+=srcstride;
        dstbase+=dststride;
    }
    return;
}

void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
    int y;
    for(y=0;y<h;y++){
        register unsigned short *dst = (unsigned short*) dstbase;
        register int x;
        for(x=0;x<w;x++){
            if(srca[x]){
                unsigned char r=dst[x]&0x1F;
                unsigned char g=(dst[x]>>5)&0x1F;
                unsigned char b=(dst[x]>>10)&0x1F;
                r=(((r*srca[x])>>5)+src[x])>>3;
                g=(((g*srca[x])>>5)+src[x])>>3;
                b=(((b*srca[x])>>5)+src[x])>>3;
                dst[x]=(b<<10)|(g<<5)|r;
            }
        }
        src+=srcstride;
        srca+=srcstride;
        dstbase+=dststride;
    }
    return;
}

void vo_draw_alpha_rgb16(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
    int y;
    for(y=0;y<h;y++){
        register unsigned short *dst = (unsigned short*) dstbase;
        register int x;
        for(x=0;x<w;x++){
            if(srca[x]){
                unsigned char r=dst[x]&0x1F;
                unsigned char g=(dst[x]>>5)&0x3F;
                unsigned char b=(dst[x]>>11)&0x1F;
                r=(((r*srca[x])>>5)+src[x])>>3;
                g=(((g*srca[x])>>6)+src[x])>>2;
                b=(((b*srca[x])>>5)+src[x])>>3;
                dst[x]=(b<<11)|(g<<5)|r;
            }
        }
        src+=srcstride;
        srca+=srcstride;
        dstbase+=dststride;
    }
    return;
}


Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** Makefile	2001/03/25 04:28:40	1.4
--- Makefile	2001/04/10 02:29:38	1.5
***************
*** 4,9 ****
  LIBNAME = libvo.a
  
! SRCS=font_load.c rgb15to16mmx.c yuv2rgb_mmx.c yuv2rgb.c video_out.c vo_null.c vo_pgm.c vo_md5.c vo_odivx.c x11_common.c $(OPTIONAL_SRCS)
! OBJS=font_load.o rgb15to16mmx.o yuv2rgb_mmx.o yuv2rgb.o video_out.o vo_null.o vo_pgm.o vo_md5.o vo_odivx.o x11_common.o $(OPTIONAL_OBJS)
  
  CFLAGS  = $(OPTFLAGS) -I. -I.. -DMPG12PLAY
--- 4,9 ----
  LIBNAME = libvo.a
  
! SRCS=osd.c font_load.c rgb15to16mmx.c yuv2rgb_mmx.c yuv2rgb.c video_out.c vo_null.c vo_pgm.c vo_md5.c vo_odivx.c x11_common.c $(OPTIONAL_SRCS)
! OBJS=osd.o font_load.o rgb15to16mmx.o yuv2rgb_mmx.o yuv2rgb.o video_out.o vo_null.o vo_pgm.o vo_md5.o vo_odivx.o x11_common.o $(OPTIONAL_OBJS)
  
  CFLAGS  = $(OPTFLAGS) -I. -I.. -DMPG12PLAY

Index: mga_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/mga_common.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** mga_common.c	2001/04/04 21:42:28	1.8
--- mga_common.c	2001/04/10 02:29:38	1.9
***************
*** 11,45 ****
      int x,y;
      uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
! 
!   if (mga_vid_config.format==MGA_VID_FORMAT_YV12){
! 
!     for(y=0;y<h;y++){
!         uint8_t *dst = vid_data + bespitch * (y0+y) + x0;
!         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])>>8)+src[x];
!             //dst[x]=(dst[x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
!         }
!         src+=stride;
!         srca+=stride;
!     }
! 
!   } else {
! 
!     for(y=0;y<h;y++){
!         uint8_t *dst = vid_data + 2*(bespitch * (y0+y) + x0);
!         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])>>8)+src[x];
!             //dst[2*x]=(dst[2*x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
!         }
!         src+=stride;
!         srca+=stride;
!     }
! 
!   }
! 
  }
  
--- 11,18 ----
      int x,y;
      uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
!     if (mga_vid_config.format==MGA_VID_FORMAT_YV12)
!         vo_draw_alpha_yv12(w,h,src,srca,stride,vid_data+bespitch*y0+x0,bespitch);
!     else
!         vo_draw_alpha_yuy2(w,h,src,srca,stride,vid_data+2*(bespitch*y0+x0),2*bespitch);
  }
  

Index: video_out_internal.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out_internal.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** video_out_internal.h	2001/03/03 21:46:39	1.2
--- video_out_internal.h	2001/04/10 02:29:38	1.3
***************
*** 42,43 ****
--- 42,50 ----
  	uninit,\
  };
+ 
+ void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride);
+ void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride);
+ 
+ 
+ 
+ 

Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** vo_x11.c	2001/04/10 00:18:41	1.10
--- vo_x11.c	2001/04/10 02:29:38	1.11
***************
*** 386,410 ****
  
  static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
!     int dbpp=( bpp+7 )/8;
!     int x,y;
! 
!     for(y=0;y<h;y++){
!         uint8_t *dst = ImageData+ dbpp*((y+y0)*image_width+x0);
!         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])>>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;
!         }
!         src+=stride;
!         srca+=stride;
      }
- 
  }
  
--- 386,404 ----
  
  static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
!     switch(bpp){
!         case 24: 
!           vo_draw_alpha_rgb24(w,h,src,srca,stride,ImageData+3*(y0*image_width+x0),3*image_width);
!           break;
!         case 32: 
!           vo_draw_alpha_rgb32(w,h,src,srca,stride,ImageData+4*(y0*image_width+x0),4*image_width);
!           break;
!         case 15:
!         case 16:
!           if(depth==15)
!             vo_draw_alpha_rgb15(w,h,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width);
!           else
!             vo_draw_alpha_rgb16(w,h,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width);
!           break;
      }
  }
  

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** vo_xv.c	2001/04/10 00:00:04	1.7
--- vo_xv.c	2001/04/10 02:29:38	1.8
***************
*** 257,292 ****
  
  
  static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
      int x,y;
- 
-   if (xv_format==IMGFMT_YV12){
- 
-     for(y=0;y<h;y++){
- 	uint8_t *dst = xvimage[0]->data + image_width * (y+y0) + x0;
-         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];
-         }
-         src+=stride;
-         srca+=stride;
-     }
- 
-   } else {
- 
-     for(y=0;y<h;y++){
- 	uint8_t *dst = xvimage[0]->data + 2*(image_width * (y+y0) + x0);
-         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];
-         }
-         src+=stride;
-         srca+=stride;
-     }
  
!   }
  
  }
--- 257,270 ----
  
  
+ //void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride);
+ //void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride);
+ 
  static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
      int x,y;
  
!   if (xv_format==IMGFMT_YV12)
!     vo_draw_alpha_yv12(w,h,src,srca,stride,xvimage[0]->data+image_width*y0+x0,image_width);
!   else
!     vo_draw_alpha_yuy2(w,h,src,srca,stride,xvimage[0]->data+2*(image_width*y0+x0),2*image_width);
  
  }

Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** x11_common.c	2001/04/10 00:00:04	1.2
--- x11_common.c	2001/04/10 02:29:38	1.3
***************
*** 200,202 ****
  	XSetScreenSaver(mDisplay, 0, interval, prefer_blank, allow_exp);
  		    // turning off screensaver
! }
\ No newline at end of file
--- 200,202 ----
  	XSetScreenSaver(mDisplay, 0, interval, prefer_blank, allow_exp);
  		    // turning off screensaver
! }


_______________________________________________
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