changeset 5317:80fbb03b385a

U,V plane odrer fixed
author arpi
date Sun, 24 Mar 2002 20:45:30 +0000
parents ce6f625f6682
children 207c13e15ffc
files libvo/mga_common.c libvo/vo_xmga.c
diffstat 2 files changed, 27 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/mga_common.c	Sun Mar 24 19:14:40 2002 +0000
+++ b/libvo/mga_common.c	Sun Mar 24 20:45:30 2002 +0000
@@ -85,8 +85,14 @@
         width/=2;height/=2;x/=2;y/=2;
 
 	dest = vid_data + bespitch*mga_vid_config.src_height + bespitch*y + 2*x;
-        src = image[1];
-        src2 = image[2];
+	if(mga_vid_config.format==MGA_VID_FORMAT_YV12){
+	    src = image[1];
+	    src2 = image[2];
+	} else {
+	    src = image[2];
+	    src2 = image[1];
+	}
+	
 	for(h=0; h < height; h++)
 	{
 #ifdef HAVE_MMX
@@ -145,6 +151,7 @@
 {
     uint8_t *src;
     uint8_t *dest;
+    uint8_t *dest2;
     uint32_t bespitch,bespitch2;
     int i;
 
@@ -155,14 +162,18 @@
     mem2agpcpy_pic(dest, image[0], w, h, bespitch, stride[0]);
     
     w/=2;h/=2;x/=2;y/=2;
-    
+
     dest = vid_data + bespitch*mga_vid_config.src_height + bespitch2 * y + x;
-    mem2agpcpy_pic(dest, image[1], w, h, bespitch2, stride[1]);
+    dest2= dest + bespitch2*mga_vid_config.src_height / 2; 
 
-    dest = vid_data + bespitch*mga_vid_config.src_height
-                    + bespitch*mga_vid_config.src_height / 4 
-                    + bespitch2 * y + x;
+  if(mga_vid_config.format==MGA_VID_FORMAT_YV12){
+    // mga_vid's YV12 assumes Y,U,V order (insteda of Y,V,U) :(
+    mem2agpcpy_pic(dest, image[1], w, h, bespitch2, stride[1]);
+    mem2agpcpy_pic(dest2,image[2], w, h, bespitch2, stride[2]);
+  } else {
     mem2agpcpy_pic(dest, image[2], w, h, bespitch2, stride[2]);
+    mem2agpcpy_pic(dest2,image[1], w, h, bespitch2, stride[1]);
+  }
 
 }
 
@@ -233,9 +244,13 @@
        // we're lucky or codec accepts stride => ok, let's go!
        if(mpi->flags&MP_IMGFLAG_PLANAR){
 	   mpi->planes[0]=vid_data;
-	   mpi->planes[1]=vid_data + bespitch*mga_vid_config.src_height;
-	   mpi->planes[2]=vid_data + bespitch*mga_vid_config.src_height
-                    + bespitch*mga_vid_config.src_height / 4;
+	   if(mpi->flags&MP_IMGFLAG_SWAPPED){
+	       mpi->planes[1]=vid_data + bespitch*mga_vid_config.src_height;
+	       mpi->planes[2]=mpi->planes[1] + bespitch2*mga_vid_config.src_height/2;
+	   } else {
+	       mpi->planes[2]=vid_data + bespitch*mga_vid_config.src_height;
+	       mpi->planes[1]=mpi->planes[2] + bespitch2*mga_vid_config.src_height/2;
+	   }
 	   mpi->width=mpi->stride[0]=bespitch;
 	   mpi->stride[1]=mpi->stride[2]=bespitch2;
        } else {
--- a/libvo/vo_xmga.c	Sun Mar 24 19:14:40 2002 +0000
+++ b/libvo/vo_xmga.c	Sun Mar 24 20:45:30 2002 +0000
@@ -218,17 +218,13 @@
   {
    case IMGFMT_YV12:
 	height+=height&1;
-        mga_vid_config.format=MGA_VID_FORMAT_YV12;
+        mga_vid_config.format=MGA_VID_FORMAT_IYUV;
         mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2;
         break;
    case IMGFMT_I420:
-	height+=height&1;
-        mga_vid_config.format=MGA_VID_FORMAT_I420;
-        mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2;
-        break;
    case IMGFMT_IYUV:
 	height+=height&1;
-        mga_vid_config.format=MGA_VID_FORMAT_IYUV;
+        mga_vid_config.format=MGA_VID_FORMAT_YV12;
         mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2;
         break;
    case IMGFMT_YUY2: