# HG changeset patch # User arpi_esp # Date 986869778 0 # Node ID f6b5c2dbc88e6ece51dd2b445a716723a4d7bd7f # Parent b2fd5c172f801184724d29d92147fa7b58203a06 OSD alpha renderers moved to osd.c diff -r b2fd5c172f80 -r f6b5c2dbc88e libvo/Makefile --- a/libvo/Makefile Tue Apr 10 00:18:41 2001 +0000 +++ b/libvo/Makefile Tue Apr 10 02:29:38 2001 +0000 @@ -3,8 +3,8 @@ 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) +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 # -I/usr/X11R6/include/ diff -r b2fd5c172f80 -r f6b5c2dbc88e libvo/mga_common.c --- a/libvo/mga_common.c Tue Apr 10 00:18:41 2001 +0000 +++ b/libvo/mga_common.c Tue Apr 10 02:29:38 2001 +0000 @@ -10,37 +10,10 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ 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>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>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; - } - - } - + 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); } diff -r b2fd5c172f80 -r f6b5c2dbc88e libvo/osd.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libvo/osd.c Tue Apr 10 02:29:38 2001 +0000 @@ -0,0 +1,115 @@ +// 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>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>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>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>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>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>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; +} + diff -r b2fd5c172f80 -r f6b5c2dbc88e libvo/osd_template.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libvo/osd_template.c Tue Apr 10 02:29:38 2001 +0000 @@ -0,0 +1,115 @@ +// 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>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>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>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>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>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>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; +} + diff -r b2fd5c172f80 -r f6b5c2dbc88e libvo/video_out_internal.h --- a/libvo/video_out_internal.h Tue Apr 10 00:18:41 2001 +0000 +++ b/libvo/video_out_internal.h Tue Apr 10 02:29:38 2001 +0000 @@ -41,3 +41,10 @@ check_events,\ 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); + + + + diff -r b2fd5c172f80 -r f6b5c2dbc88e libvo/vo_x11.c --- a/libvo/vo_x11.c Tue Apr 10 00:18:41 2001 +0000 +++ b/libvo/vo_x11.c Tue Apr 10 02:29:38 2001 +0000 @@ -385,27 +385,21 @@ } 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>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; + 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; } - } diff -r b2fd5c172f80 -r f6b5c2dbc88e libvo/vo_xv.c --- a/libvo/vo_xv.c Tue Apr 10 00:18:41 2001 +0000 +++ b/libvo/vo_xv.c Tue Apr 10 02:29:38 2001 +0000 @@ -256,38 +256,16 @@ } +//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){ - - for(y=0;ydata + image_width * (y+y0) + x0; - for(x=0;x>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;ydata + 2*(image_width * (y+y0) + x0); - for(x=0;x>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; - } - - } + 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); } diff -r b2fd5c172f80 -r f6b5c2dbc88e libvo/x11_common.c --- a/libvo/x11_common.c Tue Apr 10 00:18:41 2001 +0000 +++ b/libvo/x11_common.c Tue Apr 10 02:29:38 2001 +0000 @@ -199,4 +199,4 @@ if (timeout_save) XSetScreenSaver(mDisplay, 0, interval, prefer_blank, allow_exp); // turning off screensaver -} \ No newline at end of file +}