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
- Date: Mon, 6 Oct 2008 10:30:36 -0400
- From: Laurent <laurent.aml@xxxxxxxxx>
- Subject: ***BOGO*** Re: [MPlayer-dev-eng] [PATCH] Fix packed YUV in dshow vo
On 10/5/08, Reimar Döffinger <Reimar.Doeffinger@xxxxxxxxxxxxxxxxxxxxx> wrote:
> On Sun, Oct 05, 2008 at 11:04:22AM +0200, Sascha Sommer wrote:
> > Not sure if MPlayer defines a MIN macro. If not you might introduce one in
> > vo_directx.c. You can then simply use
> >
> > minStride = MIN(srcStride,dstStride);
> >
> > instead of the if else block above.
>
> Please use FFMIN from libavutil (you might have to include
> libavutil/common.h).
> Maybe that header is a bit overkill but it is better than
> duplicated/obfuscated code IMO.
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng@xxxxxxxxxxxx
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
>
Here is a simplified version of the patch:
* ugly decls fixed
* use FFMIN
* debug msg removed.
Thanks,
Laurent
Index: libvo/vo_directx.c
===================================================================
--- libvo/vo_directx.c (revision 27514)
+++ libvo/vo_directx.c (working copy)
@@ -37,6 +37,8 @@
#include "aspect.h"
#include "geometry.h"
#include "mp_fifo.h"
+// For FFMIN
+#include "libavutil/common.h"
#ifdef CONFIG_GUI
#include "gui/interface.h"
@@ -1276,7 +1278,17 @@
}
else //packed
{
- fast_memcpy( image, mpi->planes[0], image_height * dstride);
+ const uint32_t source_stride = mpi->stride[0];
+ const uint32_t dest_stride = dstride;
+ const uint32_t min_stride = FFMIN(source_stride, dest_stride);
+ uint32_t line;
+ s = mpi->planes[0];
+ d = image;
+ for (line=0; line<image_height; line++) {
+ fast_memcpy(d, s, min_stride);
+ s += source_stride;
+ d += dest_stride;
+ }
}
return VO_TRUE;
}
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng