Mercurial > mplayer.hg
comparison libvo/vo_dga.c @ 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 | cd642e995366 |
children | ed5b85b713a3 |
comparison
equal
deleted
inserted
replaced
4059:a77ce64a7066 | 4060:974e028471a4 |
---|---|
21 * BGR_32_24_888 | 21 * BGR_32_24_888 |
22 * | 22 * |
23 * - works only on x86 architectures | 23 * - works only on x86 architectures |
24 * | 24 * |
25 * $Log$ | 25 * $Log$ |
26 * Revision 1.36 2002/01/08 20:58:53 atmos4 | |
27 * SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me | |
28 * | |
26 * Revision 1.35 2001/12/28 20:52:54 alex | 29 * Revision 1.35 2001/12/28 20:52:54 alex |
27 * use XF86VidMode later in init (at line 1031) only if we've got support (if have_vm==1) | 30 * use XF86VidMode later in init (at line 1031) only if we've got support (if have_vm==1) |
28 * | 31 * |
29 * Revision 1.34 2001/12/04 17:24:25 alex | 32 * Revision 1.34 2001/12/04 17:24:25 alex |
30 * do not crash if can't get modelines (dga2.0) | 33 * do not crash if can't get modelines (dga2.0) |
149 #include <string.h> | 152 #include <string.h> |
150 | 153 |
151 #include "config.h" | 154 #include "config.h" |
152 #include "video_out.h" | 155 #include "video_out.h" |
153 #include "video_out_internal.h" | 156 #include "video_out_internal.h" |
157 #include "../postproc/swscale.h" | |
154 #include "../postproc/rgb2rgb.h" | 158 #include "../postproc/rgb2rgb.h" |
159 #include "aspect.h" | |
155 | 160 |
156 LIBVO_EXTERN( dga ) | 161 LIBVO_EXTERN( dga ) |
157 | 162 |
158 #include <X11/Xlib.h> | 163 #include <X11/Xlib.h> |
159 #include <X11/extensions/xf86dga.h> | 164 #include <X11/extensions/xf86dga.h> |
343 static int | 348 static int |
344 vo_dga_dbf_current; // current buffer (0 or 1) | 349 vo_dga_dbf_current; // current buffer (0 or 1) |
345 | 350 |
346 static unsigned char *vo_dga_base; | 351 static unsigned char *vo_dga_base; |
347 static Display *vo_dga_dpy; | 352 static Display *vo_dga_dpy; |
353 | |
354 /* saved src and dst dimensions for SwScaler */ | |
355 static unsigned int scale_srcW = 0, | |
356 scale_dstW = 0, | |
357 scale_srcH = 0, | |
358 scale_dstH = 0; | |
359 | |
348 | 360 |
349 //--------------------------------------------------------- | 361 //--------------------------------------------------------- |
350 | 362 |
351 #define VD_INFO 0 | 363 #define VD_INFO 0 |
352 #define VD_ERR 0 | 364 #define VD_ERR 0 |
551 //--------------------------------------------------------- | 563 //--------------------------------------------------------- |
552 | 564 |
553 static uint32_t draw_slice( uint8_t *src[],int stride[], | 565 static uint32_t draw_slice( uint8_t *src[],int stride[], |
554 int w,int h,int x,int y ) | 566 int w,int h,int x,int y ) |
555 { | 567 { |
556 | 568 if (scale_srcW) { |
557 yuv2rgb( vo_dga_base + vo_dga_dbf_current * vo_dga_dbf_mem_offset + vo_dga_vp_offset + | 569 uint8_t *dst[3] = {vo_dga_base + vo_dga_dbf_current * vo_dga_dbf_mem_offset + vo_dga_vp_offset, NULL, NULL}; |
570 SwScale_YV12slice(src,stride,y,h, | |
571 dst, | |
572 /*scale_dstW*/ vo_dga_width * HW_MODE.vdm_bytespp, HW_MODE.vdm_bitspp, | |
573 scale_srcW, scale_srcH, scale_dstW, scale_dstH); | |
574 } else { | |
575 yuv2rgb( vo_dga_base + vo_dga_dbf_current * vo_dga_dbf_mem_offset + vo_dga_vp_offset + | |
558 (vo_dga_width * y +x) * HW_MODE.vdm_bytespp, | 576 (vo_dga_width * y +x) * HW_MODE.vdm_bytespp, |
559 src[0], src[1], src[2], | 577 src[0], src[1], src[2], |
560 w,h, vo_dga_width * HW_MODE.vdm_bytespp, | 578 w,h, vo_dga_width * HW_MODE.vdm_bytespp, |
561 stride[0],stride[1] ); | 579 stride[0],stride[1] ); |
580 } | |
562 return 0; | 581 return 0; |
563 }; | 582 }; |
564 | 583 |
565 //--------------------------------------------------------- | 584 //--------------------------------------------------------- |
566 | 585 |
784 | 803 |
785 //--------------------------------------------------------- | 804 //--------------------------------------------------------- |
786 | 805 |
787 static uint32_t init( uint32_t width, uint32_t height, | 806 static uint32_t init( uint32_t width, uint32_t height, |
788 uint32_t d_width,uint32_t d_height, | 807 uint32_t d_width,uint32_t d_height, |
789 uint32_t fullscreen,char *title,uint32_t format ) | 808 uint32_t flags,char *title,uint32_t format ) |
790 { | 809 { |
791 | 810 |
792 int x_off, y_off; | 811 int x_off, y_off; |
793 int wanted_width, wanted_height; | 812 int wanted_width, wanted_height; |
794 | 813 |
808 #endif | 827 #endif |
809 int bank, ram; | 828 int bank, ram; |
810 #endif | 829 #endif |
811 | 830 |
812 if( vo_dga_is_running )return -1; | 831 if( vo_dga_is_running )return -1; |
813 vo_dga_src_format = format; | 832 vo_dga_src_format = format; |
833 | |
814 wanted_width = d_width; | 834 wanted_width = d_width; |
815 wanted_height = d_height; | 835 wanted_height = d_height; |
816 | 836 |
817 if(!wanted_height) wanted_height = height; | 837 if(!wanted_height) wanted_height = height; |
818 if(!wanted_width) wanted_width = width; | 838 if(!wanted_width) wanted_width = width; |
905 vd_printf(VD_INFO, | 925 vd_printf(VD_INFO, |
906 "vo_dga: Video parameters by codec: %3d x %3d, depth %2d, bitspp %2d.\n", | 926 "vo_dga: Video parameters by codec: %3d x %3d, depth %2d, bitspp %2d.\n", |
907 width, height, | 927 width, height, |
908 SRC_MODE.vdm_depth, | 928 SRC_MODE.vdm_depth, |
909 SRC_MODE.vdm_bitspp); | 929 SRC_MODE.vdm_bitspp); |
910 vo_dga_vp_width =mX; | 930 vo_dga_vp_width = mX; |
911 vo_dga_vp_height = mY; | 931 vo_dga_vp_height = mY; |
932 | |
933 if((flags&0x04)||(flags&0x01)) { /* -zoom or -fs */ | |
934 scale_dstW = (d_width + 7) & ~7; | |
935 scale_dstH = d_height; | |
936 scale_srcW = width; | |
937 scale_srcH = height; | |
938 aspect_save_screenres(mX,mY); | |
939 aspect_save_orig(scale_srcW,scale_srcH); | |
940 aspect_save_prescale(scale_dstW,scale_dstH); | |
941 SwScale_Init(); | |
942 if(flags&0x01) /* -fs */ | |
943 aspect(&scale_dstW,&scale_dstH,A_ZOOM); | |
944 else if(flags&0x04) /* -fs */ | |
945 aspect(&scale_dstW,&scale_dstH,A_NOZOOM); | |
946 vd_printf(VD_INFO, | |
947 "vo_dga: Aspect corrected size for SwScaler: %4d x %4d.\n", | |
948 scale_dstW, scale_dstH); | |
949 /* XXX this is a hack, but I'm lazy ;-) :: atmos */ | |
950 width = scale_dstW; | |
951 height = scale_dstH; | |
952 } | |
953 | |
912 vo_dga_width = modelines[j].bytesPerScanline / HW_MODE.vdm_bytespp ; | 954 vo_dga_width = modelines[j].bytesPerScanline / HW_MODE.vdm_bytespp ; |
913 dga_modenum = modelines[j].num; | 955 dga_modenum = modelines[j].num; |
914 max_vpy_pos = modelines[j].maxViewportY; | 956 max_vpy_pos = modelines[j].maxViewportY; |
915 | 957 |
916 XFree(modelines); | 958 XFree(modelines); |