[MPlayer-dev-eng] [PATCH] Fix to vo_yuv4mpeg.c

Robert Kesterson robertk at robertk.com
Wed Feb 13 18:33:33 CET 2002


There is an error in the vo_yuv4mpeg.c file that prevents proper operation
with yuv source material (for example, a DVD).  The attached patch fixes
this.

--
  Robert Kesterson
  robertk at robertk.com
-------------- next part --------------
? yuvpatch.txt
Index: libvo/vo_yuv4mpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_yuv4mpeg.c,v
retrieving revision 1.4
diff -c -u -r1.4 vo_yuv4mpeg.c
--- libvo/vo_yuv4mpeg.c	10 Feb 2002 16:56:30 -0000	1.4
+++ libvo/vo_yuv4mpeg.c	13 Feb 2002 17:42:30 -0000
@@ -108,18 +108,19 @@
 		}

 		{

 			// copy U + V:

+			int imgstride = image_width >> 1;

 			uint8_t *src1 = srcimg[1];

 			uint8_t *src2 = srcimg[2];

-			uint8_t *dstu = image_u + image_width * (y / 2) + (x / 2);

-			uint8_t *dstv = image_v + image_width * (y / 2) + (x / 2);

+			uint8_t *dstu = image_u + imgstride * (y >> 1) + (x >> 1);

+			uint8_t *dstv = image_v + imgstride * (y >> 1) + (x >> 1);

 			for (i = 0; i < h / 2; i++)

 			{

-				memcpy(dstu, src1 , w / 2);

-				memcpy(dstv, src2, w / 2);

+				memcpy(dstu, src1 , w >> 1);

+				memcpy(dstv, src2, w >> 1);

 				src1 += stride[1];

 				src2 += stride[2];

-				dstu += image_width / 2;

-				dstv += image_width / 2;

+				dstu += imgstride;

+				dstv += imgstride;

 			}

 		}

 	}

@@ -154,7 +155,6 @@
 				rgb24toyv12(src[0], image_y, image_u, image_v, 

 							image_width, image_height, 

 							image_width, image_width / 2, image_width * 3);

-//				RGB2YUV(image_width, image_height, src[0], image_y, image_u, image_v, 1);

 			}

 			break;

 	}



More information about the MPlayer-dev-eng mailing list