From 0a83c6ec7bfeef0f53c6e891fcb5788d9fe88ed6 Mon Sep 17 00:00:00 2001 From: nick Date: Sun, 17 Feb 2002 12:22:01 +0000 Subject: [PATCH] More correct direct rendering usage git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4742 b3059339-0415-0410-9bf9-f77b7e298cf2 --- dec_video.c | 9 +++++---- dec_video.h | 2 +- libvo/vosub_vidix.c | 12 ++++++++---- mplayer.c | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/dec_video.c b/dec_video.c index 7000286be1..d15c248a8a 100644 --- a/dec_video.c +++ b/dec_video.c @@ -779,14 +779,15 @@ if ((sh_video->codec->driver == VFM_QTRLE) && (sh_video->bih->biBitCount != 24)) extern int vaa_use_dr; -static int use_dr=0; +static int use_dr=0,use_dr_422=0; static bes_da_t bda; -void init_video_vaa( void ) +void init_video_vaa( unsigned width ) { memset(&bda,0,sizeof(bes_da_t)); if(vo_vaa.query_bes_da) use_dr = vo_vaa.query_bes_da(&bda) ? 0 : 1; if(!vaa_use_dr) use_dr = 0; + use_dr_422 = use_dr && bda.dest.pitch.y == 16 && (width*2+15)&~15 == width*2; } #ifdef USE_LIBVO2 @@ -939,7 +940,7 @@ switch(sh_video->codec->driver){ { /* FIXME: WILL WORK ONLY FOR PACKED FOURCC. BUT WHAT ABOUT PLANAR? */ vmem = 0; - if(use_dr && bda.dest.pitch.y == 16) + if(use_dr_422) { vmem = bda.dga_addr + bda.offsets[0] + bda.offset.y; if(vo_doublebuffering && bda.num_frames>1) @@ -1054,7 +1055,7 @@ if(verbose>1){ if(!in_size) break; /* FIXME: WILL WORK ONLY FOR PACKED FOURCC. BUT WHAT ABOUT PLANAR? */ vmem = 0; - if(use_dr && bda.dest.pitch.y == 16) + if(use_dr_422) { vmem = bda.dga_addr + bda.offsets[0] + bda.offset.y; if(vo_doublebuffering && bda.num_frames>1) diff --git a/dec_video.h b/dec_video.h index 86251316a2..ab5451cd90 100644 --- a/dec_video.h +++ b/dec_video.h @@ -3,7 +3,7 @@ extern int video_read_properties(sh_video_t *sh_video); extern int init_video(sh_video_t *sh_video, int *pitches); -extern void init_video_vaa( void ); +extern void init_video_vaa( unsigned width ); void uninit_video(sh_video_t *sh_video); #ifdef USE_LIBVO2 diff --git a/libvo/vosub_vidix.c b/libvo/vosub_vidix.c index 4cf9ad9be9..531a081976 100644 --- a/libvo/vosub_vidix.c +++ b/libvo/vosub_vidix.c @@ -210,6 +210,7 @@ static uint32_t vidix_draw_slice_422(uint8_t *image[], int stride[], int w,int h src+=stride[0]; dest += bespitch; } +printf("\nw = %u apitch=%u stride[0] = %u bespitch=%u\n",w,apitch,stride[0],bespitch); return 0; } @@ -479,7 +480,7 @@ int vidix_init(unsigned src_width,unsigned src_height, unsigned vid_w,unsigned vid_h,const void *info) { size_t i,awidth; - int err; + int err,is_422_planes_eq; if(verbose > 1) printf("vosub_vidix: vidix_init() was called\n" "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" @@ -607,23 +608,26 @@ int vidix_init(unsigned src_width,unsigned src_height, memset(vidix_mem + vidix_play.offsets[i], 0x80, vidix_play.frame_size); /* tune some info here */ + is_422_planes_eq = vidix_play.src.pitch.y == vidix_play.dest.pitch.y && + src_width*2 == (src_width*2+(vidix_play.dest.pitch.y-1))&~ + (vidix_play.dest.pitch.y-1); if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) vo_server->draw_slice = vidix_draw_slice_420; else if(src_format == IMGFMT_RGB32 || src_format == IMGFMT_BGR32) vo_server->draw_slice = - vidix_play.src.pitch.y == vidix_play.dest.pitch.y ? + is_422_planes_eq ? vidix_draw_slice_32_fast: vidix_draw_slice_32; else if(src_format == IMGFMT_RGB24 || src_format == IMGFMT_BGR24) vo_server->draw_slice = - vidix_play.src.pitch.y == vidix_play.dest.pitch.y ? + is_422_planes_eq ? vidix_draw_slice_24_fast: vidix_draw_slice_24; else vo_server->draw_slice = - vidix_play.src.pitch.y == vidix_play.dest.pitch.y ? + is_422_planes_eq ? vidix_draw_slice_422_fast: vidix_draw_slice_422; return 0; diff --git a/mplayer.c b/mplayer.c index c546fa1b33..8f6c078ed5 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1400,7 +1400,7 @@ current_module="init_libvo"; */ } } - init_video_vaa(); + init_video_vaa(sh_video->disp_w); fflush(stdout); //================== MAIN: ==========================