Mercurial > mplayer.hg
changeset 4060:974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
author | atmos4 |
---|---|
date | Tue, 08 Jan 2002 20:58:53 +0000 |
parents | a77ce64a7066 |
children | 5455b83b922c |
files | libvo/vo_dga.c libvo/vo_png.c |
diffstat | 2 files changed, 69 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vo_dga.c Tue Jan 08 19:03:29 2002 +0000 +++ b/libvo/vo_dga.c Tue Jan 08 20:58:53 2002 +0000 @@ -23,6 +23,9 @@ * - works only on x86 architectures * * $Log$ + * Revision 1.36 2002/01/08 20:58:53 atmos4 + * SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me + * * Revision 1.35 2001/12/28 20:52:54 alex * use XF86VidMode later in init (at line 1031) only if we've got support (if have_vm==1) * @@ -151,7 +154,9 @@ #include "config.h" #include "video_out.h" #include "video_out_internal.h" +#include "../postproc/swscale.h" #include "../postproc/rgb2rgb.h" +#include "aspect.h" LIBVO_EXTERN( dga ) @@ -346,6 +351,13 @@ static unsigned char *vo_dga_base; static Display *vo_dga_dpy; +/* saved src and dst dimensions for SwScaler */ +static unsigned int scale_srcW = 0, + scale_dstW = 0, + scale_srcH = 0, + scale_dstH = 0; + + //--------------------------------------------------------- #define VD_INFO 0 @@ -553,12 +565,19 @@ static uint32_t draw_slice( uint8_t *src[],int stride[], int w,int h,int x,int y ) { - - yuv2rgb( vo_dga_base + vo_dga_dbf_current * vo_dga_dbf_mem_offset + vo_dga_vp_offset + + if (scale_srcW) { + uint8_t *dst[3] = {vo_dga_base + vo_dga_dbf_current * vo_dga_dbf_mem_offset + vo_dga_vp_offset, NULL, NULL}; + SwScale_YV12slice(src,stride,y,h, + dst, + /*scale_dstW*/ vo_dga_width * HW_MODE.vdm_bytespp, HW_MODE.vdm_bitspp, + scale_srcW, scale_srcH, scale_dstW, scale_dstH); + } else { + yuv2rgb( vo_dga_base + vo_dga_dbf_current * vo_dga_dbf_mem_offset + vo_dga_vp_offset + (vo_dga_width * y +x) * HW_MODE.vdm_bytespp, src[0], src[1], src[2], w,h, vo_dga_width * HW_MODE.vdm_bytespp, stride[0],stride[1] ); + } return 0; }; @@ -786,7 +805,7 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width,uint32_t d_height, - uint32_t fullscreen,char *title,uint32_t format ) + uint32_t flags,char *title,uint32_t format ) { int x_off, y_off; @@ -810,7 +829,8 @@ #endif if( vo_dga_is_running )return -1; - vo_dga_src_format = format; + vo_dga_src_format = format; + wanted_width = d_width; wanted_height = d_height; @@ -907,8 +927,30 @@ width, height, SRC_MODE.vdm_depth, SRC_MODE.vdm_bitspp); - vo_dga_vp_width =mX; + vo_dga_vp_width = mX; vo_dga_vp_height = mY; + + if((flags&0x04)||(flags&0x01)) { /* -zoom or -fs */ + scale_dstW = (d_width + 7) & ~7; + scale_dstH = d_height; + scale_srcW = width; + scale_srcH = height; + aspect_save_screenres(mX,mY); + aspect_save_orig(scale_srcW,scale_srcH); + aspect_save_prescale(scale_dstW,scale_dstH); + SwScale_Init(); + if(flags&0x01) /* -fs */ + aspect(&scale_dstW,&scale_dstH,A_ZOOM); + else if(flags&0x04) /* -fs */ + aspect(&scale_dstW,&scale_dstH,A_NOZOOM); + vd_printf(VD_INFO, + "vo_dga: Aspect corrected size for SwScaler: %4d x %4d.\n", + scale_dstW, scale_dstH); + /* XXX this is a hack, but I'm lazy ;-) :: atmos */ + width = scale_dstW; + height = scale_dstH; + } + vo_dga_width = modelines[j].bytesPerScanline / HW_MODE.vdm_bytespp ; dga_modenum = modelines[j].num; max_vpy_pos = modelines[j].maxViewportY;
--- a/libvo/vo_png.c Tue Jan 08 19:03:29 2002 +0000 +++ b/libvo/vo_png.c Tue Jan 08 20:58:53 2002 +0000 @@ -22,6 +22,7 @@ #include "video_out.h" #include "video_out_internal.h" +#include "../postproc/swscale.h" #include "../postproc/rgb2rgb.h" LIBVO_EXTERN (png) @@ -44,6 +45,7 @@ static int image_format; static uint8_t *image_data=NULL; //static char *image_data; +static unsigned int scale_srcW = 0, scale_srcH = 0; static int bpp = 24; static int cspace = RGB; @@ -63,10 +65,19 @@ static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) { - image_height = height; - image_width = width; + if (fullscreen&0x04 && (width != d_width || height != d_height) && format==IMGFMT_YV12) { + /* software scaling */ + image_width = (d_width + 7) & ~7; + image_height = d_height; + scale_srcW = width; + scale_srcH = height; + SwScale_Init(); + } + else { + image_height = height; + image_width = width; + } image_format = format; - //printf("Verbose level is %i\n", verbose); switch(format) { @@ -262,11 +273,17 @@ static uint32_t draw_slice( uint8_t *src[],int stride[],int w,int h,int x,int y ) { + if (scale_srcW) { + uint8_t *dst[3] = {image_data, NULL, NULL}; + SwScale_YV12slice(src,stride,y,h, + dst, image_width*((bpp+7)/8), bpp, + scale_srcW, scale_srcH, image_width, image_height); + } + else { uint8_t *dst; - dst = image_data + (image_width * y + x) * (bpp/8); yuv2rgb(dst,src[0],src[1],src[2],w,h,image_width*(bpp/8),stride[0],stride[1]); - + } return 0; }