Mercurial > mplayer.hg
changeset 3208:98a587aaf505
Support for YV12 with DXR3, patch by D. Holm.
author | atmos4 |
---|---|
date | Thu, 29 Nov 2001 19:18:48 +0000 |
parents | 6ea45643506c |
children | 0b172eb639f1 |
files | DOCS/DXR3 configure libvo/vo_dxr3.c |
diffstat | 3 files changed, 58 insertions(+), 56 deletions(-) [+] |
line wrap: on
line diff
--- a/DOCS/DXR3 Thu Nov 29 19:00:48 2001 +0000 +++ b/DOCS/DXR3 Thu Nov 29 19:18:48 2001 +0000 @@ -1,6 +1,10 @@ DXR3/H+ video/audio output plugins manual by David Holm ======================================================= +2001-11-29: thanks to Felix Buenemann I managed to + optimize the odivx playback as well as add + support for the rest of the codecs! + 2001-11-28: ffmpeg replaced with mp1e, divx playback won't get much faster than this, huge thanks goes out to Ivan Kalvachev for helping me @@ -51,15 +55,17 @@ the CVS version since most of the time I use the latest features which are only available through cvs) - * Second, if you want DivX playback you need to download and install - RTE from zapping.sourceforge.net compile and install it BEFORE - running configure in the mplayer dir. + * Second, if you want to be able to play back anything other than + mpeg12 (vcd/dvd) through your dxr3 you need to install RTE from + zapping.sourceforge.net compile and install it BEFORE running + configure in the mplayer dir. With RTE you should be able to play + any movie supported by MPlayer. * Run <mplayerdir>/configure and make sure that DXR3/H+ support =yes and optionally that mp1e rte = yes, if it's = no, please mail me your configure.log and I'll fix it. - From here on compilation (of at least my code ;) should go without + From here on compilation (of at least my code ;) should go without any problems. @@ -82,17 +88,12 @@ any of these video types _without_ "-vo dxr3"! DIVX Notes -When playing divx's add "-vc odivx" +When playing divx's add "-vc odivx" for maximum performance. I've switched to mp1e from ffmpeg so it should be lightning fast now. Other codecs: -Currently they don't work. I'm working on implementing libvo2 which -will be a much more convenient and faster way of working with -vo<->codec interaction. If libvo2 takes longer to develop than I -have estimated perhaps I'll add more codec support to libvo. Otherwise -you'll just have to wait for libvo2. (there is an implementation -for other codecs, but I think it's pretty broken currently ;) - +No "-vc <codec>" switches should be required as mplayer will autodetect. +If you find an unsupported codec please contact me! 4. Contacting me
--- a/configure Thu Nov 29 19:00:48 2001 +0000 +++ b/configure Thu Nov 29 19:18:48 2001 +0000 @@ -1751,6 +1751,7 @@ _ld_dxr3='-ldxr3' _vosrc="$_vosrc vo_dxr3.c" _aosrc="$_aosrc ao_dxr3.c" + _vomodules="dxr3 $_vomodules" _aomodules="dxr3 $_aomodules" else _def_dxr3='#undef HAVE_DXR3'
--- a/libvo/vo_dxr3.c Thu Nov 29 19:00:48 2001 +0000 +++ b/libvo/vo_dxr3.c Thu Nov 29 19:18:48 2001 +0000 @@ -4,9 +4,6 @@ * * Copyright (C) 2001 David Holm <dholm@iname.com> * - * libav - MPEG-PS multiplexer, part of ffmpeg - * Copyright Gerard Lantau (see http://ffmpeg.sf.net) - * */ #include "fastmemcpy.h" @@ -124,7 +121,7 @@ s_height = scr_height; spubuf = malloc(53220); /* 53220 bytes is the standardized max size of a subpic */ - if( format == IMGFMT_YV12 ) + if( format == IMGFMT_YV12 || format == IMGFMT_YUY2 ) { #ifdef USE_MP1E int size; @@ -194,7 +191,7 @@ } rte_set_input( mp1e_context, RTE_VIDEO, RTE_PUSH, TRUE, NULL, NULL, NULL ); - rte_set_output( mp1e_context, write_dxr3, NULL, NULL ); + rte_set_output( mp1e_context, (void*)write_dxr3, NULL, NULL ); if( !rte_init_context( mp1e_context ) ) { @@ -205,16 +202,18 @@ osd_w=scr_width; d_pos_x=(c_width-(int)scr_width)/2; - if(d_pos_x<0){ - s_pos_x=-d_pos_x;d_pos_x=0; - osd_w=c_width; + if(d_pos_x<0) + { + s_pos_x=-d_pos_x;d_pos_x=0; + osd_w=c_width; } else s_pos_x=0; osd_h=scr_height; d_pos_y=(c_height-(int)scr_height)/2; - if(d_pos_y<0){ - s_pos_y=-d_pos_y;d_pos_y=0; - osd_h=c_height; + if(d_pos_y<0) + { + s_pos_y=-d_pos_y;d_pos_y=0; + osd_h=c_height; } else s_pos_y=0; printf("VO: [dxr3] position mapping: %d;%d => %d;%d\n",s_pos_x,s_pos_y,d_pos_x,d_pos_y); @@ -279,6 +278,27 @@ return 0; } + else if( img_format == IMGFMT_YUY2 ) + { + int w=v_width,h=v_height; + unsigned char *s,*dY,*dU,*dV; + + if(d_pos_x+w>picture_linesize[0]) w=picture_linesize[0]-d_pos_x; + if(d_pos_y+h>c_height) h=c_height-d_pos_y; + + s = src[0]+s_pos_x+s_pos_y*(w*2); + dY = picture_data[0]+d_pos_x+d_pos_y*picture_linesize[0]; + dU = picture_data[1]+(d_pos_x/2)+(d_pos_y/2)*picture_linesize[1]; + dV = picture_data[2]+(d_pos_x/2)+(d_pos_y/2)*picture_linesize[2]; + + yuy2toyv12( s, dY, dU, dV, w, h, picture_linesize[0], picture_linesize[1], w*2 ); + + mp1e_buffer.data = picture_data[0]; + mp1e_buffer.time = vo_pts/90000.0; + mp1e_buffer.user_data = NULL; + rte_push_video_buffer( mp1e_context, &mp1e_buffer ); + return 0; + } printf( "VO: [dxr3] Error in draw_frame(...)\n" ); return -1; @@ -297,7 +317,6 @@ static uint32_t draw_slice( uint8_t *srcimg[], int stride[], int w, int h, int x0, int y0 ) { - int y; unsigned char* s; unsigned char* d; @@ -309,38 +328,18 @@ if(x0+w>picture_linesize[0]) w=picture_linesize[0]-x0; if(y0+h>c_height) h=c_height-y0; - // Y s=srcimg[0]+s_pos_x+s_pos_y*stride[0]; d=picture_data[0]+x0+y0*picture_linesize[0]; - for( y = 0; y < h; y++) - { - memcpy(d,s,w); - s+=stride[0]; - d+=picture_linesize[0]; - } - - w/=2;h/=2;x0/=2;y0/=2; + memcpy(d,s,(w*h)); - // U - s=srcimg[1]+(s_pos_x/2)+(s_pos_y/2)*stride[1]; - d=picture_data[1]+x0+y0*picture_linesize[1]; - for( y = 0; y < h; y++) - { - memcpy(d,s,w); - s+=stride[1]; - d+=picture_linesize[1]; - } - - // V - s=srcimg[2]+(s_pos_x/2)+(s_pos_y/2)*stride[2]; - d=picture_data[2]+x0+y0*picture_linesize[2]; - for(y=0;y<h;y++) - { - memcpy(d,s,w); - s+=stride[2]; - d+=picture_linesize[2]; - } + s=srcimg[1]+s_pos_x+s_pos_y*stride[1]; + d=picture_data[1]+(x0/2)+(y0/2)*picture_linesize[1]; + memcpy(d,s,(w*h)/4); + s=srcimg[2]+s_pos_x+s_pos_y*stride[2]; + d=picture_data[2]+(x0/2)+(y0/2)*picture_linesize[2]; + memcpy(d,s,(w*h)/4); + return 0; #endif printf( "VO: [dxr3] You need to install mp1e rte, read DOCS/DXR3\n" ); @@ -357,15 +356,16 @@ if(format==IMGFMT_MPEGPES) return 1; #ifdef USE_MP1E if(format==IMGFMT_YV12) return 1; + if(format==IMGFMT_YUY2) return 1; #else - if(format==IMGFMT_YV12) {printf("VO: [dxr3] You need to compile with mp1e rte to play this file! (http://zapping.sf.net)\n" ); return 0;} + if(format==IMGFMT_YV12) {printf("VO: [dxr3] You need to compile with mp1e rte to play this file! Read DOCS/DXR3\n" ); return 0;} + if(format==IMGFMT_YUY2) {printf("VO: [dxr3] You need to compile with mp1e rte to play this file! Read DOCS/DXR3\n" ); return 0;} #endif - else printf( "If this is a DivX add \"-vc odivx\" or if it is an mpeg add \"-vc mpegpes\" otherwise this video format is currently unsupported\n" ); + else printf( "VO: [dxr3] Format unsupported, mail dholm@iname.com\n" ); return 0; } -static void -uninit(void) +static void uninit(void) { printf( "VO: [dxr3] Uninitializing\n" ); #ifdef USE_MP1E