[MPlayer-dev-eng] [PATCH] Direct3D libvo driver

Ivan Kalvachev ikalvachev at gmail.com
Sun Nov 16 17:11:41 CET 2008


On 11/13/08, Georgi Petrov <gogothebee at gmail.com> wrote:
[...]
> When I create the Offscreen Surface with some dimensions and lock a
> pointer to the surface, I can't just do one big memcpy (3 big memcpys
> in case of planar colorspace), because of this:
> http://msdn.microsoft.com/en-us/library/bb206357(VS.85).aspx
>
> In brief: each horizontal line in the locked surface is in fact longer
> than the width of the surface and for each line I should increment a
> pointer with the real width of the line to get it pointing to the next
> line. That's why in vo_directx.c you copy (for example packed mode,
> because it's fewer lines) like that:
>
> mem2agpcpy_pic(image, mpi->planes[0], w * (mpi->bpp / 8), h, dstride,
> mpi->stride[0]);
>
> And in Direct3D I copy the same image with as many memcpys as lines we
> have on the screen:
>
> pScanlineBegin = (char *) stLockedRect.pBits;
> for (i = 0; i < mpi->height; i++)
> {
>     fast_memcpy (pScanlineBegin, mpi->planes[0] +
>                (i * mpi->stride[0]), mpi->stride[0]);
>     pScanlineBegin += stLockedRect.Pitch;
> }

You haven't read the article carefully enough. Let me quote:
"The value in the Pitch member describes the surface's memory pitch, also called stride."
Here in mplayer we call it only "stride". So all you have to do is 
    dstride=stLockedRect.Pitch;
and use the directx code ;)




More information about the MPlayer-dev-eng mailing list