changeset 4741:d3a52470594c

More correct direct rendering usage
author nick
date Sun, 17 Feb 2002 12:22:01 +0000
parents 54226110dbe5
children a34682347090
files dec_video.c dec_video.h libvo/vosub_vidix.c mplayer.c
diffstat 4 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/dec_video.c	Sun Feb 17 12:04:20 2002 +0000
+++ b/dec_video.c	Sun Feb 17 12:22:01 2002 +0000
@@ -779,14 +779,15 @@
 
 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 @@
     {
 	/* 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(!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)
--- a/dec_video.h	Sun Feb 17 12:04:20 2002 +0000
+++ b/dec_video.h	Sun Feb 17 12:22:01 2002 +0000
@@ -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
--- a/libvo/vosub_vidix.c	Sun Feb 17 12:04:20 2002 +0000
+++ b/libvo/vosub_vidix.c	Sun Feb 17 12:22:01 2002 +0000
@@ -210,6 +210,7 @@
         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 @@
 		   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 @@
 	    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;
--- a/mplayer.c	Sun Feb 17 12:04:20 2002 +0000
+++ b/mplayer.c	Sun Feb 17 12:22:01 2002 +0000
@@ -1400,7 +1400,7 @@
 	    */
 	}
    }
-   init_video_vaa();
+   init_video_vaa(sh_video->disp_w);
    fflush(stdout);
 
 //================== MAIN: ==========================