lists.zerezo.com



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

***BOGO*** Re: [MPlayer-dev-eng] [PATCH] Fix packed YUV in dshow vo



On 9/23/08, Laurent <laurent.aml@xxxxxxxxx> wrote:
> Here is a patch to support packed yuv in DirectX when strides are
> different between input and output buffers.
>
> Thanks,
>
>

MPlayer crashes on Intel-based GPU (eg 945) when the Packed YUV
colorspace is used.

To reproduce the crash, start
  mplayer.exe -vf format=YUY2 <yourvideo>

Would it be possible to apply this patch, or get suggestions?

Thanks,

Laurent
Index: libvo/vo_directx.c
===================================================================
--- libvo/vo_directx.c	(revision 27514)
+++ libvo/vo_directx.c	(working copy)
@@ -1276,7 +1276,35 @@
 	}
 	else //packed
 	{
-        fast_memcpy( image, mpi->planes[0], image_height * dstride);
+		const srcStride = mpi->stride[0];
+		const dstStride = dstride;
+		int srcPlane = mpi->planes[0];
+		int dstPlane = image;
+		int minStride;
+		int srcH;
+
+		if (srcStride == dstStride)
+		{
+			// Same buffer size, same line alignment.
+			fast_memcpy(dstPlane, srcPlane, image_height * srcStride);
+		}
+		else
+		{
+			// Line by line copy is required.
+			if (srcStride > dstStride) {
+				mp_msg(MSGT_VO, MSGL_DBG3,"<vo_directx><DB3>Using shortest stride from back buffer (%d) instead of source stride.\n", dstStride, srcStride);
+				minStride = dstStride;
+			} else {
+				mp_msg(MSGT_VO, MSGL_DBG3,"<vo_directx><DB3>Using shortest stride from source (%d) instead of back buffer stride.\n", srcStride, dstStride);
+				minStride = srcStride;
+			}
+			mp_msg(MSGT_VO, MSGL_DBG3 ,"<vo_directx><DB3>Packed src=%x srcstride=%d dst=%x dststride=%d w=%d h=%d size=%d\n", srcPlane, srcStride, dstPlane, dstStride, image_width, image_height, image_height * minStride);
+			for (srcH=0; srcH<image_height; srcH++) {
+				fast_memcpy(dstPlane, srcPlane, minStride);
+				srcPlane += srcStride;
+				dstPlane += dstStride;
+			}
+		}
 	}
 	return VO_TRUE;
 }
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng