changeset 4745:398e3663ed71

Allow using direct rendering with any HW pitches (even on matrox g400).
author nick
date Sun, 17 Feb 2002 15:54:58 +0000
parents da595f0e882e
children cbce019d2d94
files dec_video.c libvo/vosub_vidix.c
diffstat 2 files changed, 26 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dec_video.c	Sun Feb 17 15:09:46 2002 +0000
+++ b/dec_video.c	Sun Feb 17 15:54:58 2002 +0000
@@ -783,11 +783,19 @@
 static bes_da_t bda;
 void init_video_vaa( unsigned width )
 {
+  unsigned adp;
   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;
+  if(use_dr)
+  {
+    uint32_t sstride,dstride;
+    sstride=width*2;
+    adp = bda.dest.pitch.y-1;
+    dstride=(width*2+adp)&~adp;
+    if(sstride == dstride) use_dr_422 = 1;
+  }
 }
 
 #ifdef USE_LIBVO2
--- a/libvo/vosub_vidix.c	Sun Feb 17 15:09:46 2002 +0000
+++ b/libvo/vosub_vidix.c	Sun Feb 17 15:54:58 2002 +0000
@@ -229,8 +229,6 @@
         src+=stride[0];
         dest += bespitch;
     }
-printf("\nw = %u apitch=%u stride[0] = %u bespitch=%u\n",w,apitch,stride[0],bespitch);
-
     return 0;
 }
 
@@ -373,34 +371,40 @@
     void *lvo_mem;
     lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
     apitch = vidix_play.dest.pitch.y-1;
-    bespitch = (vidix_play.src.w + apitch) & (~apitch);
     switch(vidix_play.fourcc){
     case IMGFMT_YV12:
     case IMGFMT_IYUV:
     case IMGFMT_I420:
+	bespitch = (vidix_play.src.w + apitch) & (~apitch);
         vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch);
         break;
     case IMGFMT_YUY2:
-        vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+2*(bespitch*y0+x0),2*bespitch);
+	bespitch = (vidix_play.src.w*2 + apitch) & (~apitch);
+        vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0,bespitch);
         break;
     case IMGFMT_UYVY:
-        vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+2*(bespitch*y0+x0)+1,2*bespitch);
+	bespitch = (vidix_play.src.w*2 + apitch) & (~apitch);
+        vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0+1,bespitch);
         break;
     case IMGFMT_RGB32:
     case IMGFMT_BGR32:
-	vo_draw_alpha_rgb32(w,h,src,srca,stride,lvo_mem+4*(y0*bespitch+x0),4*bespitch);
+	bespitch = (vidix_play.src.w*4 + apitch) & (~apitch);
+	vo_draw_alpha_rgb32(w,h,src,srca,stride,lvo_mem+y0*bespitch+4*x0,bespitch);
         break;
     case IMGFMT_RGB24:
     case IMGFMT_BGR24:
-	vo_draw_alpha_rgb24(w,h,src,srca,stride,lvo_mem+3*(y0*bespitch+x0),3*bespitch);
+	bespitch = (vidix_play.src.w*3 + apitch) & (~apitch);
+	vo_draw_alpha_rgb24(w,h,src,srca,stride,lvo_mem+y0*bespitch+3*x0,bespitch);
         break;
     case IMGFMT_RGB16:
     case IMGFMT_BGR16:
-	vo_draw_alpha_rgb16(w,h,src,srca,stride,lvo_mem+2*(y0*bespitch+x0),2*bespitch);
+	bespitch = (vidix_play.src.w*2 + apitch) & (~apitch);
+	vo_draw_alpha_rgb16(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch);
         break;
     case IMGFMT_RGB15:
     case IMGFMT_BGR15:
-	vo_draw_alpha_rgb15(w,h,src,srca,stride,lvo_mem+2*(y0*bespitch+x0),2*bespitch);
+	bespitch = (vidix_play.src.w*2 + apitch) & (~apitch);
+	vo_draw_alpha_rgb15(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch);
         break;
     default:
         draw_alpha_null(x0,y0,w,h,src,srca,stride);
@@ -500,6 +504,7 @@
 {
   size_t i,awidth;
   int err,is_422_planes_eq;
+  uint32_t sstride,dstride;
   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"
@@ -627,9 +632,9 @@
 	    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);
+	sstride = src_width*2;
+	dstride = (src_width*2+(vidix_play.dest.pitch.y-1))&~(vidix_play.dest.pitch.y-1);
+	is_422_planes_eq = sstride == dstride;
         if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV)
 		vo_server->draw_slice = vidix_draw_slice_420;
 	else