[PATCH v3 2/8] mfplat/buffer: Fix image copy function for IMC2/IMC4 buffers with odd height.
Nikolay Sivov
nsivov at codeweavers.com
Thu Jun 16 07:33:05 CDT 2022
On 6/14/22 18:15, Giovanni Mascellani wrote:
> Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
> ---
> dlls/mfplat/buffer.c | 3 +--
> dlls/mfplat/tests/mfplat.c | 9 ++++-----
> 2 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c
> index 39407ccc9e2..a7ba306223d 100644
> --- a/dlls/mfplat/buffer.c
> +++ b/dlls/mfplat/buffer.c
> @@ -100,8 +100,7 @@ static void copy_image_imc1(BYTE *dest, LONG dest_stride, const BYTE *src, LONG
>
> static void copy_image_imc2(BYTE *dest, LONG dest_stride, const BYTE *src, LONG src_stride, DWORD width, DWORD lines)
> {
> - MFCopyImage(dest, dest_stride, src, src_stride, width / 2, lines / 2);
> - MFCopyImage(dest + dest_stride / 2, dest_stride, src + src_stride / 2, src_stride, width / 2, lines / 2);
> + MFCopyImage(dest, dest_stride / 2, src, src_stride / 2, width / 2, lines);
> }
I don't understand this. Why would it use fractions of strides? And
doing one copy instead of two related to odd heights? Or does the
subject need adjusting?
>
> static inline struct buffer *impl_from_IMFMediaBuffer(IMFMediaBuffer *iface)
> diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
> index 1b5e8cf7ed5..52608c05929 100644
> --- a/dlls/mfplat/tests/mfplat.c
> +++ b/dlls/mfplat/tests/mfplat.c
> @@ -6027,12 +6027,11 @@ static void test_MFCreate2DMediaBuffer(void)
>
> case MAKEFOURCC('I','M','C','2'):
> case MAKEFOURCC('I','M','C','4'):
> - for (j = ptr->height; j < length2 / stride; j++)
> + for (j = 0; ptr->height * stride + j * (stride / 2) < length2; j++)
> for (k = 0; k < ptr->width / 2; k++)
> - ok(data[j * pitch + k] == 0xff, "Unexpected byte %02x at test %d row %d column %d.\n", data[j * pitch + k], i, j, k);
> - for (j = ptr->height; j < length2 / stride; j++)
> - for (k = pitch / 2; k < pitch / 2 + ptr->width / 2; k++)
> - ok(data[j * pitch + k] == 0xff, "Unexpected byte %02x at test %d row %d column %d.\n", data[j * pitch + k], i, j, k);
> + ok(data[ptr->height * pitch + j * (pitch / 2) + k] == 0xff,
> + "Unexpected byte %02x at test %d row %d column %d.\n",
> + data[ptr->height * pitch + j * (pitch / 2) + k], i, j, k);
> break;
It feels like this could be more readable. I see initial contents are
set to 0xff, so I'm not even sure what we are testing. What else could
it be if not 0xff?
>
> case MAKEFOURCC('N','V','1','2'):
More information about the wine-devel
mailing list