Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- v2: * Remove the multiplier * The missing test cases will be reinsterted in a later commit --- dlls/mfplat/buffer.c | 22 ++++++++++++++++++--- dlls/mfplat/tests/mfplat.c | 40 ++++++++++++++++---------------------- 2 files changed, 36 insertions(+), 26 deletions(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c index eada3df18ad..39407ccc9e2 100644 --- a/dlls/mfplat/buffer.c +++ b/dlls/mfplat/buffer.c @@ -1351,8 +1351,25 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo if (is_yuv && bottom_up) return MF_E_INVALIDMEDIATYPE;
- if (FAILED(hr = MFGetPlaneSize(fourcc, width, height, &plane_size))) - return hr; + switch (fourcc) + { + case MAKEFOURCC('I','M','C','1'): + case MAKEFOURCC('I','M','C','3'): + plane_size = stride * height * 2; + break; + case MAKEFOURCC('I','M','C','2'): + case MAKEFOURCC('I','M','C','4'): + plane_size = stride * 3 / 2 * height; + break; + case MAKEFOURCC('N','V','1','2'): + case MAKEFOURCC('Y','V','1','2'): + case MAKEFOURCC('I','4','2','0'): + case MAKEFOURCC('I','Y','U','V'): + plane_size = stride * height * 3 / 2; + break; + default: + plane_size = stride * height; + }
if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY; @@ -1377,7 +1394,6 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo case MAKEFOURCC('I','M','C','1'): case MAKEFOURCC('I','M','C','3'): max_length = pitch * height * 2; - plane_size *= 2; break; case MAKEFOURCC('N','V','1','2'): case MAKEFOURCC('Y','V','1','2'): diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 28b89de4b1f..1b5e8cf7ed5 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -5723,48 +5723,49 @@ static void test_MFCreate2DMediaBuffer(void) unsigned int fourcc; unsigned int contiguous_length; int pitch; - unsigned int plane_multiplier; unsigned int max_length; } _2d_buffer_tests[] = { - { 2, 2, MAKEFOURCC('N','V','1','2'), 6, 64, 0, 192 }, + { 2, 2, MAKEFOURCC('N','V','1','2'), 6, 64, 192 }, { 4, 2, MAKEFOURCC('N','V','1','2'), 12, 64 }, { 2, 4, MAKEFOURCC('N','V','1','2'), 12, 64 }, { 1, 3, MAKEFOURCC('N','V','1','2'), 4, 64 }, - { 4, 16, MAKEFOURCC('N','V','1','2'), 96, 64, 0, 1536 }, + { 4, 16, MAKEFOURCC('N','V','1','2'), 96, 64, 1536 },
- { 2, 2, MAKEFOURCC('I','M','C','2'), 6, 128, 0, 384 }, + { 2, 2, MAKEFOURCC('I','M','C','2'), 6, 128, 384 }, { 4, 2, MAKEFOURCC('I','M','C','2'), 12, 128 }, { 2, 4, MAKEFOURCC('I','M','C','2'), 12, 128 }, + { 3, 5, MAKEFOURCC('I','M','C','2'), 20, 128 }, { 2, 2, MAKEFOURCC('I','M','C','4'), 6, 128 }, { 4, 2, MAKEFOURCC('I','M','C','4'), 12, 128 }, { 2, 4, MAKEFOURCC('I','M','C','4'), 12, 128 }, + { 3, 5, MAKEFOURCC('I','M','C','4'), 20, 128 },
- { 4, 2, MAKEFOURCC('I','M','C','1'), 32, 128, 2 }, - { 4, 4, MAKEFOURCC('I','M','C','1'), 64, 128, 2 }, - { 4, 16, MAKEFOURCC('I','M','C','1'), 256, 128, 2, 4096 }, - { 4, 20, MAKEFOURCC('I','M','C','1'), 320, 128, 2 }, + { 4, 2, MAKEFOURCC('I','M','C','1'), 32, 128 }, + { 4, 4, MAKEFOURCC('I','M','C','1'), 64, 128 }, + { 4, 16, MAKEFOURCC('I','M','C','1'), 256, 128, 4096 }, + { 4, 20, MAKEFOURCC('I','M','C','1'), 320, 128 },
- { 4, 2, MAKEFOURCC('I','M','C','3'), 32, 128, 2 }, - { 4, 4, MAKEFOURCC('I','M','C','3'), 64, 128, 2 }, - { 4, 16, MAKEFOURCC('I','M','C','3'), 256, 128, 2, 4096 }, - { 4, 20, MAKEFOURCC('I','M','C','3'), 320, 128, 2 }, + { 4, 2, MAKEFOURCC('I','M','C','3'), 32, 128 }, + { 4, 4, MAKEFOURCC('I','M','C','3'), 64, 128 }, + { 4, 16, MAKEFOURCC('I','M','C','3'), 256, 128, 4096 }, + { 4, 20, MAKEFOURCC('I','M','C','3'), 320, 128 },
{ 4, 2, MAKEFOURCC('Y','V','1','2'), 12, 128 }, { 4, 4, MAKEFOURCC('Y','V','1','2'), 24, 128 }, - { 4, 16, MAKEFOURCC('Y','V','1','2'), 96, 128, 0, 3072 }, + { 4, 16, MAKEFOURCC('Y','V','1','2'), 96, 128, 3072 },
{ 4, 2, MAKEFOURCC('A','Y','U','V'), 32, 64 }, { 4, 4, MAKEFOURCC('A','Y','U','V'), 64, 64 }, - { 4, 16, MAKEFOURCC('A','Y','U','V'), 256, 64, 0, 1024 }, + { 4, 16, MAKEFOURCC('A','Y','U','V'), 256, 64, 1024 },
{ 4, 2, MAKEFOURCC('Y','U','Y','2'), 16, 64 }, { 4, 4, MAKEFOURCC('Y','U','Y','2'), 32, 64 }, - { 4, 16, MAKEFOURCC('Y','U','Y','2'), 128, 64, 0, 1024 }, + { 4, 16, MAKEFOURCC('Y','U','Y','2'), 128, 64, 1024 },
{ 4, 2, MAKEFOURCC('U','Y','V','Y'), 16, 64 }, { 4, 4, MAKEFOURCC('U','Y','V','Y'), 32, 64 }, - { 4, 16, MAKEFOURCC('U','Y','V','Y'), 128, 64, 0, 1024 }, + { 4, 16, MAKEFOURCC('U','Y','V','Y'), 128, 64, 1024 },
{ 2, 4, D3DFMT_A8R8G8B8, 32, 64 }, { 1, 4, D3DFMT_A8R8G8B8, 16, 64 }, @@ -5998,13 +5999,6 @@ static void test_MFCreate2DMediaBuffer(void) hr = IMFMediaBuffer_Unlock(buffer); ok(hr == S_OK, "Failed to unlock buffer, hr %#lx.\n", hr);
- hr = pMFGetPlaneSize(ptr->fourcc, ptr->width, ptr->height, &length2); - ok(hr == S_OK, "Failed to get plane size, hr %#lx.\n", hr); - if (ptr->plane_multiplier) - length2 *= ptr->plane_multiplier; - ok(length2 == length, "%d: contiguous length %lu does not match plane size %lu, %u x %u, format %s.\n", i, length, - length2, ptr->width, ptr->height, wine_dbgstr_an((char *)&ptr->fourcc, 4)); - hr = IMF2DBuffer_Lock2D(_2dbuffer, &data, &pitch); ok(hr == S_OK, "Failed to lock buffer, hr %#lx.\n", hr);
Signed-off-by: Giovanni Mascellani gmascellani@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); }
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;
case MAKEFOURCC('N','V','1','2'):
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116967
Your paranoid android.
=== w7u_adm (32 bit report) ===
mfplat: 0868:mfplat: unhandled exception c0000005 at 6ED77D1C
=== debian11 (32 bit report) ===
Report validation errors: mfplat:mfplat prints too much data (41310 bytes)
=== debian11 (32 bit WoW report) ===
Report validation errors: mfplat:mfplat prints too much data (41298 bytes)
On 6/14/22 18:15, Giovanni Mascellani wrote:
Signed-off-by: Giovanni Mascellani gmascellani@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'):
Hi,
Il 16/06/22 14:33, Nikolay Sivov ha scritto:
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?
Yeah, maybe it's better to explain; first, notice that when the height is even mine code and yours are precisely equivalent: copying x/2 lines of data with stride y and then other x/2 with the same stride y, but offsetted by a y/2, is precisely equivalent to copying x lines with stride y/2.
For example, suppose that width == 4, stride == 8 and lines == 4. You may represent the UV part of the image in this way (where "." denotes padding data):
XX..YY.. XX..YY..
If you use the approach currently in the code, you will first copy all the X data and then all the Y data. But the same data can also be represented as
XX.. YY.. XX.. YY..
I.e., with the double number of lines and half the stride. The code I am proposing "looks" at data in this way and does the copy with a single call to MFCopyImage().
Looking from this point of view, the change is correct, but not particularly useful. The point is that for odd heights the two approaches are different, and from my tests it seems that mine is correct.
Specifically, if width == 4, stride == 8 and lines == 5 the data will look like:
XX..YY.. XX..YY.. XX..
The current code will only copy the first two XX blocks (because it copies lines / 2 == 2 lines), but I think that Microsoft thinks that the third XX line is still part of the image. The new code will correctly copy all the five lines.
Does this make sense?
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?
Yeah, the image format is a bit involved so I have to do some trickery to do the right checks. The point is that what we set of 0xff is the buffer locked with _Lock(), therefore in its contiguous format. When we then lock it with _Lock2D() there will be a lot of padding bytes that are not necessarily set to 0xff (though they could be, I don't think they're guaranteed to be zero). What that test is checking is which bytes of the 2D buffer are really part of the image (i.e., they're not padding), and the result is that the last half-line of the UV section of a image of odd height is still considered part of the image (therefore the change made in the first hunk is appropriate).
You can try to keep the second hunk and revert the first one, and you'll see that the tests fail on Wine (but they don't on Windows).
Thanks, Giovanni.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/mfplat/tests/mfplat.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 52608c05929..aefd4aa46c1 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -6391,6 +6391,7 @@ static void test_MFCreateDXSurfaceBuffer(void) { IDirect3DSurface9 *backbuffer = NULL, *surface; IDirect3DSwapChain9 *swapchain; + D3DLOCKED_RECT locked_rect; DWORD length, max_length; IDirect3DDevice9 *device; IMF2DBuffer2 *_2dbuffer2; @@ -6463,9 +6464,32 @@ static void test_MFCreateDXSurfaceBuffer(void) ok(hr == S_OK, "Failed to get length, hr %#lx.\n", hr); ok(length == 2 * max_length, "Unexpected length %lu.\n", length);
+ hr = IDirect3DSurface9_LockRect(backbuffer, &locked_rect, NULL, 0); + ok(hr == S_OK, "Failed to lock back buffer, hr %#lx.\n", hr); + + /* Cannot lock while the surface is locked. */ + hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr); + + hr = IDirect3DSurface9_UnlockRect(backbuffer); + ok(hr == S_OK, "Failed to unlock back buffer, hr %#lx.\n", hr); + + hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(length == max_length, "Unexpected length %lu instead of %lu.\n", length, max_length); + + /* You can lock the surface while the media buffer is locked. */ + hr = IDirect3DSurface9_LockRect(backbuffer, &locked_rect, NULL, 0); + ok(hr == S_OK, "Failed to lock back buffer, hr %#lx.\n", hr); + hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(length == max_length, "Unexpected length.\n"); + + hr = IMFMediaBuffer_Unlock(buffer); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IDirect3DSurface9_UnlockRect(backbuffer); + ok(hr == S_OK, "Failed to unlock back buffer, hr %#lx.\n", hr);
/* Unlock twice. */ hr = IMFMediaBuffer_Unlock(buffer);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116968
Your paranoid android.
=== w8 (32 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6571: Test failed: Unexpected leading byte. mfplat.c:6573: Test failed: Unexpected hr 0x80070057.
=== w8adm (32 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6571: Test failed: Unexpected leading byte. mfplat.c:6573: Test failed: Unexpected hr 0x80070057.
=== w864 (32 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6571: Test failed: Unexpected leading byte. mfplat.c:6573: Test failed: Unexpected hr 0x80070057.
=== w1064v1507 (32 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6571: Test failed: Unexpected leading byte. mfplat.c:6573: Test failed: Unexpected hr 0x80070057.
=== w864 (64 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6571: Test failed: Unexpected leading byte. mfplat.c:6573: Test failed: Unexpected hr 0x80070057.
=== w1064v1507 (64 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6571: Test failed: Unexpected leading byte. mfplat.c:6573: Test failed: Unexpected hr 0x80070057.
=== debian11 (32 bit report) ===
Report validation errors: mfplat:mfplat prints too much data (41310 bytes)
=== debian11 (32 bit WoW report) ===
Report validation errors: mfplat:mfplat prints too much data (38396 bytes)
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/mfplat/tests/mfplat.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index aefd4aa46c1..fd757d26d9b 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -6519,9 +6519,23 @@ static void test_MFCreateDXSurfaceBuffer(void) hr = IMF2DBuffer_GetScanline0AndPitch(_2dbuffer, &data, &pitch); ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_UNLOCKED), "Unexpected hr %#lx.\n", hr);
+ hr = IDirect3DSurface9_LockRect(backbuffer, &locked_rect, NULL, 0); + ok(hr == S_OK, "Failed to lock back buffer, hr %#lx.\n", hr); + + /* Cannot lock the buffer while the surface is locked. */ + hr = IMF2DBuffer_Lock2D(_2dbuffer, &data, &pitch); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr); + + hr = IDirect3DSurface9_UnlockRect(backbuffer); + ok(hr == S_OK, "Failed to unlock back buffer, hr %#lx.\n", hr); + hr = IMF2DBuffer_Lock2D(_2dbuffer, &data, &pitch); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+ /* Cannot lock the surface once the buffer is locked. */ + hr = IDirect3DSurface9_LockRect(backbuffer, &locked_rect, NULL, 0); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr); + hr = IMF2DBuffer_GetScanline0AndPitch(_2dbuffer, &data, &pitch); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116969
Your paranoid android.
=== w7u_adm (32 bit report) ===
mfplat: 0860:mfplat: unhandled exception c0000005 at 6ED77D1C
=== w7u_el (32 bit report) ===
mfplat: 0860:mfplat: unhandled exception c0000005 at 723C7D1C
=== w8 (32 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6585: Test failed: Unexpected leading byte. mfplat.c:6587: Test failed: Unexpected hr 0x80070057.
=== w8adm (32 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6585: Test failed: Unexpected leading byte. mfplat.c:6587: Test failed: Unexpected hr 0x80070057.
=== w864 (32 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6585: Test failed: Unexpected leading byte. mfplat.c:6587: Test failed: Unexpected hr 0x80070057.
=== w1064v1507 (32 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6585: Test failed: Unexpected leading byte. mfplat.c:6587: Test failed: Unexpected hr 0x80070057.
=== w864 (64 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6585: Test failed: Unexpected leading byte. mfplat.c:6587: Test failed: Unexpected hr 0x80070057.
=== w1064v1507 (64 bit report) ===
mfplat: mfplat.c:6479: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6496: Test failed: Unexpected hr 0x80070057. mfplat.c:6513: Test failed: Unexpected hr 0x80070057. mfplat.c:6585: Test failed: Unexpected leading byte. mfplat.c:6587: Test failed: Unexpected hr 0x80070057.
=== debian11 (32 bit report) ===
Report validation errors: mfplat:mfplat prints too much data (38279 bytes)
=== debian11 (32 bit WoW report) ===
Report validation errors: mfplat:mfplat prints too much data (38282 bytes)
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- v2: * Remove the trace in memory_2d_buffer_Lock2D() v3: * Redirect all invocations to helper functions. --- dlls/mfplat/buffer.c | 140 ++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 90 deletions(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c index a7ba306223d..5a447817145 100644 --- a/dlls/mfplat/buffer.c +++ b/dlls/mfplat/buffer.c @@ -485,11 +485,17 @@ static ULONG WINAPI memory_2d_buffer_Release(IMF2DBuffer2 *iface) return IMFMediaBuffer_Release(&buffer->IMFMediaBuffer_iface); }
-static HRESULT memory_2d_buffer_lock(struct buffer *buffer, BYTE **scanline0, LONG *pitch, - BYTE **buffer_start, DWORD *buffer_length) +static HRESULT memory_2d_buffer_lock2d(IMF2DBuffer2 *iface, MF2DBuffer_LockFlags flags, BYTE **scanline0, + LONG *pitch, BYTE **buffer_start, DWORD *buffer_length) { + struct buffer *buffer = impl_from_IMF2DBuffer2(iface); HRESULT hr = S_OK;
+ if (!scanline0 || !pitch || !buffer_start || !buffer_length) + return E_POINTER; + + EnterCriticalSection(&buffer->cs); + if (buffer->_2d.linear_buffer) hr = MF_E_UNEXPECTED; else @@ -503,26 +509,19 @@ static HRESULT memory_2d_buffer_lock(struct buffer *buffer, BYTE **scanline0, LO *buffer_length = buffer->max_length; }
+ LeaveCriticalSection(&buffer->cs); + return hr; }
static HRESULT WINAPI memory_2d_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **scanline0, LONG *pitch) { - struct buffer *buffer = impl_from_IMF2DBuffer2(iface); - HRESULT hr; + DWORD buffer_length; + BYTE *buffer_start;
TRACE("%p, %p, %p.\n", iface, scanline0, pitch);
- if (!scanline0 || !pitch) - return E_POINTER; - - EnterCriticalSection(&buffer->cs); - - hr = memory_2d_buffer_lock(buffer, scanline0, pitch, NULL, NULL); - - LeaveCriticalSection(&buffer->cs); - - return hr; + return memory_2d_buffer_lock2d(iface, MF2DBuffer_LockFlags_ReadWrite, scanline0, pitch, &buffer_start, &buffer_length); }
static HRESULT WINAPI memory_2d_buffer_Unlock2D(IMF2DBuffer2 *iface) @@ -615,21 +614,9 @@ static HRESULT WINAPI memory_2d_buffer_ContiguousCopyFrom(IMF2DBuffer2 *iface, c static HRESULT WINAPI memory_2d_buffer_Lock2DSize(IMF2DBuffer2 *iface, MF2DBuffer_LockFlags flags, BYTE **scanline0, LONG *pitch, BYTE **buffer_start, DWORD *buffer_length) { - struct buffer *buffer = impl_from_IMF2DBuffer2(iface); - HRESULT hr; - TRACE("%p, %#x, %p, %p, %p, %p.\n", iface, flags, scanline0, pitch, buffer_start, buffer_length);
- if (!scanline0 || !pitch || !buffer_start || !buffer_length) - return E_POINTER; - - EnterCriticalSection(&buffer->cs); - - hr = memory_2d_buffer_lock(buffer, scanline0, pitch, buffer_start, buffer_length); - - LeaveCriticalSection(&buffer->cs); - - return hr; + return memory_2d_buffer_lock2d(iface, flags, scanline0, pitch, buffer_start, buffer_length); }
static HRESULT WINAPI memory_2d_buffer_Copy2DTo(IMF2DBuffer2 *iface, IMF2DBuffer2 *dest_buffer) @@ -655,14 +642,13 @@ static const IMF2DBuffer2Vtbl memory_2d_buffer_vtbl = memory_2d_buffer_Copy2DTo, };
-static HRESULT WINAPI d3d9_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **scanline0, LONG *pitch) +static HRESULT d3d9_surface_buffer_lock2d(IMF2DBuffer2 *iface, MF2DBuffer_LockFlags flags, BYTE **scanline0, + LONG *pitch, BYTE **buffer_start, DWORD *buffer_length) { struct buffer *buffer = impl_from_IMF2DBuffer2(iface); HRESULT hr = S_OK;
- TRACE("%p, %p, %p.\n", iface, scanline0, pitch); - - if (!scanline0 || !pitch) + if (!scanline0 || !pitch || !buffer_start || !buffer_length) return E_POINTER;
EnterCriticalSection(&buffer->cs); @@ -679,6 +665,10 @@ static HRESULT WINAPI d3d9_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **sca buffer->_2d.locks++; *scanline0 = buffer->d3d9_surface.rect.pBits; *pitch = buffer->d3d9_surface.rect.Pitch; + if (buffer_start) + *buffer_start = *scanline0; + if (buffer_length) + *buffer_length = buffer->d3d9_surface.rect.Pitch * buffer->_2d.height; }
LeaveCriticalSection(&buffer->cs); @@ -686,6 +676,16 @@ static HRESULT WINAPI d3d9_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **sca return hr; }
+static HRESULT WINAPI d3d9_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **scanline0, LONG *pitch) +{ + DWORD buffer_length; + BYTE *buffer_start; + + TRACE("%p, %p, %p.\n", iface, scanline0, pitch); + + return d3d9_surface_buffer_lock2d(iface, MF2DBuffer_LockFlags_ReadWrite, scanline0, pitch, &buffer_start, &buffer_length); +} + static HRESULT WINAPI d3d9_surface_buffer_Unlock2D(IMF2DBuffer2 *iface) { struct buffer *buffer = impl_from_IMF2DBuffer2(iface); @@ -743,37 +743,9 @@ static HRESULT WINAPI d3d9_surface_buffer_GetScanline0AndPitch(IMF2DBuffer2 *ifa static HRESULT WINAPI d3d9_surface_buffer_Lock2DSize(IMF2DBuffer2 *iface, MF2DBuffer_LockFlags flags, BYTE **scanline0, LONG *pitch, BYTE **buffer_start, DWORD *buffer_length) { - struct buffer *buffer = impl_from_IMF2DBuffer2(iface); - HRESULT hr = S_OK; - TRACE("%p, %#x, %p, %p, %p, %p.\n", iface, flags, scanline0, pitch, buffer_start, buffer_length);
- if (!scanline0 || !pitch || !buffer_start || !buffer_length) - return E_POINTER; - - EnterCriticalSection(&buffer->cs); - - if (buffer->_2d.linear_buffer) - hr = MF_E_UNEXPECTED; - else if (!buffer->_2d.locks) - { - hr = IDirect3DSurface9_LockRect(buffer->d3d9_surface.surface, &buffer->d3d9_surface.rect, NULL, 0); - } - - if (SUCCEEDED(hr)) - { - buffer->_2d.locks++; - *scanline0 = buffer->d3d9_surface.rect.pBits; - *pitch = buffer->d3d9_surface.rect.Pitch; - if (buffer_start) - *buffer_start = *scanline0; - if (buffer_length) - *buffer_length = buffer->d3d9_surface.rect.Pitch * buffer->_2d.height; - } - - LeaveCriticalSection(&buffer->cs); - - return hr; + return d3d9_surface_buffer_lock2d(iface, flags, scanline0, pitch, buffer_start, buffer_length); }
static const IMF2DBuffer2Vtbl d3d9_surface_buffer_vtbl = @@ -1030,14 +1002,13 @@ static HRESULT WINAPI dxgi_surface_buffer_SetCurrentLength(IMFMediaBuffer *iface return S_OK; }
-static HRESULT WINAPI dxgi_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **scanline0, LONG *pitch) +static HRESULT dxgi_surface_buffer_lock2d(IMF2DBuffer2 *iface, MF2DBuffer_LockFlags flags, + BYTE **scanline0, LONG *pitch, BYTE **buffer_start, DWORD *buffer_length) { struct buffer *buffer = impl_from_IMF2DBuffer2(iface); HRESULT hr = S_OK;
- TRACE("%p, %p, %p.\n", iface, scanline0, pitch); - - if (!scanline0 || !pitch) + if (!scanline0 || !pitch || !buffer_start || !buffer_length) return E_POINTER;
EnterCriticalSection(&buffer->cs); @@ -1051,6 +1022,10 @@ static HRESULT WINAPI dxgi_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **sca { *scanline0 = buffer->dxgi_surface.map_desc.pData; *pitch = buffer->dxgi_surface.map_desc.RowPitch; + if (buffer_start) + *buffer_start = *scanline0; + if (buffer_length) + *buffer_length = buffer->dxgi_surface.map_desc.RowPitch * buffer->_2d.height; }
LeaveCriticalSection(&buffer->cs); @@ -1058,6 +1033,16 @@ static HRESULT WINAPI dxgi_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **sca return hr; }
+static HRESULT WINAPI dxgi_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **scanline0, LONG *pitch) +{ + DWORD buffer_length; + BYTE *buffer_start; + + TRACE("%p, %p, %p.\n", iface, scanline0, pitch); + + return dxgi_surface_buffer_lock2d(iface, MF2DBuffer_LockFlags_ReadWrite, scanline0, pitch, &buffer_start, &buffer_length); +} + static HRESULT WINAPI dxgi_surface_buffer_Unlock2D(IMF2DBuffer2 *iface) { struct buffer *buffer = impl_from_IMF2DBuffer2(iface); @@ -1112,34 +1097,9 @@ static HRESULT WINAPI dxgi_surface_buffer_GetScanline0AndPitch(IMF2DBuffer2 *ifa static HRESULT WINAPI dxgi_surface_buffer_Lock2DSize(IMF2DBuffer2 *iface, MF2DBuffer_LockFlags flags, BYTE **scanline0, LONG *pitch, BYTE **buffer_start, DWORD *buffer_length) { - struct buffer *buffer = impl_from_IMF2DBuffer2(iface); - HRESULT hr = S_OK; - TRACE("%p, %#x, %p, %p, %p, %p.\n", iface, flags, scanline0, pitch, buffer_start, buffer_length);
- if (!scanline0 || !pitch || !buffer_start || !buffer_length) - return E_POINTER; - - EnterCriticalSection(&buffer->cs); - - if (buffer->_2d.linear_buffer) - hr = MF_E_UNEXPECTED; - else if (!buffer->_2d.locks++) - hr = dxgi_surface_buffer_map(buffer); - - if (SUCCEEDED(hr)) - { - *scanline0 = buffer->dxgi_surface.map_desc.pData; - *pitch = buffer->dxgi_surface.map_desc.RowPitch; - if (buffer_start) - *buffer_start = *scanline0; - if (buffer_length) - *buffer_length = buffer->dxgi_surface.map_desc.RowPitch * buffer->_2d.height; - } - - LeaveCriticalSection(&buffer->cs); - - return hr; + return dxgi_surface_buffer_lock2d(iface, flags, scanline0, pitch, buffer_start, buffer_length); }
static HRESULT WINAPI dxgi_buffer_QueryInterface(IMFDXGIBuffer *iface, REFIID riid, void **obj)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116970
Your paranoid android.
=== debian11 (32 bit report) ===
Report validation errors: mfplat:mfplat prints too much data (41290 bytes)
=== debian11 (32 bit WoW report) ===
Report validation errors: mfplat:mfplat prints too much data (38259 bytes)
I think equivalent of memory_2d_buffer_lock() would be better. With same arguments, locking and arguments checks in methods.
The same tests are already performed in test_MFGetPlaneSize().
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- v2: * Added --- dlls/mfplat/tests/mfplat.c | 10 ---------- 1 file changed, 10 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index fd757d26d9b..74de51b42f1 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -4318,7 +4318,6 @@ image_size_tests[] =
static void test_MFCalculateImageSize(void) { - DWORD plane_size; unsigned int i; UINT32 size; HRESULT hr; @@ -4340,15 +4339,6 @@ static void test_MFCalculateImageSize(void) ok(hr == S_OK || (is_broken && hr == E_INVALIDARG), "%u: failed to calculate image size, hr %#lx.\n", i, hr); ok(size == ptr->size, "%u: unexpected image size %u, expected %u. Size %u x %u, format %s.\n", i, size, ptr->size, ptr->width, ptr->height, wine_dbgstr_an((char *)&ptr->subtype->Data1, 4)); - - if (pMFGetPlaneSize) - { - unsigned int expected = ptr->plane_size ? ptr->plane_size : ptr->size; - - hr = pMFGetPlaneSize(ptr->subtype->Data1, ptr->width, ptr->height, &plane_size); - ok(hr == S_OK, "%u: failed to get plane size, hr %#lx.\n", i, hr); - ok(plane_size == expected, "%u: unexpected plane size %lu, expected %u.\n", i, plane_size, expected); - } } }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116971
Your paranoid android.
=== w7u_adm (32 bit report) ===
mfplat: 086c:mfplat: unhandled exception c0000005 at 6ED77D1C
=== w7u_el (32 bit report) ===
mfplat: 086c:mfplat: unhandled exception c0000005 at 72497D1C
=== w8 (32 bit report) ===
mfplat: mfplat.c:6469: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6503: Test failed: Unexpected hr 0x80070057. mfplat.c:6575: Test failed: Unexpected leading byte. mfplat.c:6577: Test failed: Unexpected hr 0x80070057.
=== w8adm (32 bit report) ===
mfplat: mfplat.c:6469: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6503: Test failed: Unexpected hr 0x80070057. mfplat.c:6575: Test failed: Unexpected leading byte. mfplat.c:6577: Test failed: Unexpected hr 0x80070057.
=== w864 (32 bit report) ===
mfplat: mfplat.c:6469: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6503: Test failed: Unexpected hr 0x80070057. mfplat.c:6575: Test failed: Unexpected leading byte. mfplat.c:6577: Test failed: Unexpected hr 0x80070057.
=== w1064v1507 (32 bit report) ===
mfplat: mfplat.c:6469: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6503: Test failed: Unexpected hr 0x80070057. mfplat.c:6575: Test failed: Unexpected leading byte. mfplat.c:6577: Test failed: Unexpected hr 0x80070057.
=== w864 (64 bit report) ===
mfplat: mfplat.c:6469: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6503: Test failed: Unexpected hr 0x80070057. mfplat.c:6575: Test failed: Unexpected leading byte. mfplat.c:6577: Test failed: Unexpected hr 0x80070057.
=== w1064v1507 (64 bit report) ===
mfplat: mfplat.c:6469: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6503: Test failed: Unexpected hr 0x80070057. mfplat.c:6575: Test failed: Unexpected leading byte. mfplat.c:6577: Test failed: Unexpected hr 0x80070057.
=== debian11 (32 bit report) ===
Report validation errors: mfplat:mfplat prints too much data (41310 bytes)
=== debian11 (32 bit WoW report) ===
Report validation errors: mfplat:mfplat prints too much data (41298 bytes)
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- v2: * Added --- dlls/mfplat/buffer.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c index 5a447817145..8934f761817 100644 --- a/dlls/mfplat/buffer.c +++ b/dlls/mfplat/buffer.c @@ -1276,13 +1276,25 @@ static HRESULT create_1d_buffer(DWORD max_length, DWORD alignment, IMFMediaBuffe
static p_copy_image_func get_2d_buffer_copy_func(DWORD fourcc) { - if (fourcc == MAKEFOURCC('N','V','1','2')) - return copy_image_nv12; - if (fourcc == MAKEFOURCC('I','M','C','1') || fourcc == MAKEFOURCC('I','M','C','3')) - return copy_image_imc1; - if (fourcc == MAKEFOURCC('I','M','C','2') || fourcc == MAKEFOURCC('I','M','C','4')) - return copy_image_imc2; - return NULL; + switch (fourcc) + { + case MAKEFOURCC('N','V','1','2'): + return copy_image_nv12; + + case MAKEFOURCC('I','M','C','1'): + case MAKEFOURCC('I','M','C','3'): + return copy_image_imc1; + + case MAKEFOURCC('I','M','C','2'): + case MAKEFOURCC('I','M','C','4'): + case MAKEFOURCC('Y','V','1','2'): + case MAKEFOURCC('I','4','2','0'): + case MAKEFOURCC('I','Y','U','V'): + return copy_image_imc2; + + default: + return NULL; + } }
static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bottom_up, IMFMediaBuffer **buffer) @@ -1318,12 +1330,12 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo break; case MAKEFOURCC('I','M','C','2'): case MAKEFOURCC('I','M','C','4'): - plane_size = stride * 3 / 2 * height; - break; - case MAKEFOURCC('N','V','1','2'): case MAKEFOURCC('Y','V','1','2'): case MAKEFOURCC('I','4','2','0'): case MAKEFOURCC('I','Y','U','V'): + plane_size = stride * 3 / 2 * height; + break; + case MAKEFOURCC('N','V','1','2'): plane_size = stride * height * 3 / 2; break; default: @@ -1340,6 +1352,8 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo case MAKEFOURCC('I','M','C','3'): case MAKEFOURCC('I','M','C','4'): case MAKEFOURCC('Y','V','1','2'): + case MAKEFOURCC('I','4','2','0'): + case MAKEFOURCC('I','Y','U','V'): row_alignment = MF_128_BYTE_ALIGNMENT; break; default: @@ -1358,6 +1372,8 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo case MAKEFOURCC('Y','V','1','2'): case MAKEFOURCC('I','M','C','2'): case MAKEFOURCC('I','M','C','4'): + case MAKEFOURCC('I','4','2','0'): + case MAKEFOURCC('I','Y','U','V'): max_length = pitch * height * 3 / 2; break; default:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116972
Your paranoid android.
=== debian11 (32 bit report) ===
Report validation errors: mfplat:mfplat prints too much data (37054 bytes)
=== debian11 (32 bit WoW report) ===
Report validation errors: mfplat:mfplat prints too much data (41318 bytes)
We should figure out better tests for 2/8 first. According to msdn description IYUV and YV12 are similar, but IMC2/4 are using different strides.
Hi,
Il 16/06/22 14:51, Nikolay Sivov ha scritto:
We should figure out better tests for 2/8 first. According to msdn description IYUV and YV12 are similar, but IMC2/4 are using different strides.
My understanding is that they're using the same strides, they're just organizing UV data in a different way.
Specifically, IMC2 has a half-stride of U data, than a half-stride of V data, and it keeps interleaving. YV12 has all the V data in half-strides and then all the U data in half-strides. They occupy the same exact bytes, but with the U and V planes interleaved in the case of IMC2 and kept together in the case of YV12 (and then IMC4 and IYUV are just the same, except swapping U and V).
Giovanni.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- v2: * Added --- dlls/mfplat/tests/mfplat.c | 279 +++++++++++++++++-------------------- 1 file changed, 131 insertions(+), 148 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 74de51b42f1..8d8bd27b8fb 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -4233,87 +4233,122 @@ static const struct image_size_test UINT32 height; UINT32 size; UINT32 plane_size; /* Matches image size when 0. */ + UINT32 max_length; + UINT32 contiguous_length; + UINT32 pitch; } image_size_tests[] = { - { &MFVideoFormat_RGB8, 3, 5, 20 }, - { &MFVideoFormat_RGB8, 1, 1, 4 }, - { &MFVideoFormat_RGB555, 3, 5, 40 }, - { &MFVideoFormat_RGB555, 1, 1, 4 }, - { &MFVideoFormat_RGB565, 3, 5, 40 }, - { &MFVideoFormat_RGB565, 1, 1, 4 }, - { &MFVideoFormat_RGB24, 3, 5, 60 }, - { &MFVideoFormat_RGB24, 1, 1, 4 }, - { &MFVideoFormat_RGB32, 3, 5, 60 }, - { &MFVideoFormat_RGB32, 1, 1, 4 }, - { &MFVideoFormat_ARGB32, 3, 5, 60 }, - { &MFVideoFormat_ARGB32, 1, 1, 4 }, - { &MFVideoFormat_A2R10G10B10, 3, 5, 60 }, - { &MFVideoFormat_A2R10G10B10, 1, 1, 4 }, - { &MFVideoFormat_A16B16G16R16F, 3, 5, 120 }, - { &MFVideoFormat_A16B16G16R16F, 1, 1, 8 }, - - /* YUV */ - { &MFVideoFormat_NV12, 1, 3, 9, 4 }, - { &MFVideoFormat_NV12, 1, 2, 6, 3 }, - { &MFVideoFormat_NV12, 2, 2, 6, 6 }, - { &MFVideoFormat_NV12, 3, 2, 12, 9 }, - { &MFVideoFormat_NV12, 4, 2, 12 }, - { &MFVideoFormat_NV12, 320, 240, 115200 }, - { &MFVideoFormat_AYUV, 1, 1, 4 }, - { &MFVideoFormat_AYUV, 2, 1, 8 }, - { &MFVideoFormat_AYUV, 1, 2, 8 }, - { &MFVideoFormat_AYUV, 4, 3, 48 }, - { &MFVideoFormat_AYUV, 320, 240, 307200 }, - { &MFVideoFormat_IMC1, 1, 1, 4 }, - { &MFVideoFormat_IMC1, 2, 1, 4 }, - { &MFVideoFormat_IMC1, 1, 2, 8 }, - { &MFVideoFormat_IMC1, 4, 3, 24 }, - { &MFVideoFormat_IMC1, 320, 240, 153600 }, - { &MFVideoFormat_IMC3, 1, 1, 4 }, - { &MFVideoFormat_IMC3, 2, 1, 4 }, - { &MFVideoFormat_IMC3, 1, 2, 8 }, - { &MFVideoFormat_IMC3, 4, 3, 24 }, - { &MFVideoFormat_IMC3, 320, 240, 153600 }, - { &MFVideoFormat_IMC2, 1, 3, 9, 4 }, - { &MFVideoFormat_IMC2, 1, 2, 6, 3 }, - { &MFVideoFormat_IMC2, 2, 2, 6, 6 }, - { &MFVideoFormat_IMC2, 3, 2, 12, 9 }, - { &MFVideoFormat_IMC2, 4, 2, 12 }, - { &MFVideoFormat_IMC2, 320, 240, 115200 }, - { &MFVideoFormat_IMC4, 1, 3, 9, 4 }, - { &MFVideoFormat_IMC4, 1, 2, 6, 3 }, - { &MFVideoFormat_IMC4, 2, 2, 6, 6 }, - { &MFVideoFormat_IMC4, 3, 2, 12, 9 }, - { &MFVideoFormat_IMC4, 4, 2, 12 }, - { &MFVideoFormat_IMC4, 320, 240, 115200 }, - { &MFVideoFormat_YV12, 1, 1, 3, 1 }, - { &MFVideoFormat_YV12, 2, 1, 3 }, - { &MFVideoFormat_YV12, 1, 2, 6, 3 }, - { &MFVideoFormat_YV12, 4, 3, 18 }, - { &MFVideoFormat_YV12, 320, 240, 115200 }, - - { &MFVideoFormat_I420, 1, 1, 3, 1 }, - { &MFVideoFormat_I420, 2, 1, 3 }, - { &MFVideoFormat_I420, 1, 2, 6, 3 }, - { &MFVideoFormat_I420, 4, 3, 18 }, - { &MFVideoFormat_I420, 320, 240, 115200 }, - - { &MFVideoFormat_IYUV, 1, 1, 3, 1 }, - { &MFVideoFormat_IYUV, 2, 1, 3 }, - { &MFVideoFormat_IYUV, 1, 2, 6, 3 }, - { &MFVideoFormat_IYUV, 4, 3, 18 }, - { &MFVideoFormat_IYUV, 320, 240, 115200 }, - - { &MFVideoFormat_YUY2, 2, 1, 4 }, - { &MFVideoFormat_YUY2, 4, 3, 24 }, - { &MFVideoFormat_YUY2, 128, 128, 32768 }, - { &MFVideoFormat_YUY2, 320, 240, 153600 }, - - { &MFVideoFormat_UYVY, 2, 1, 4 }, - { &MFVideoFormat_UYVY, 4, 3, 24 }, - { &MFVideoFormat_UYVY, 128, 128, 32768 }, - { &MFVideoFormat_UYVY, 320, 240, 153600 }, + /* RGB */ + { &MFVideoFormat_RGB8, 3, 5, 20, 0, 320, 20, 64 }, + { &MFVideoFormat_RGB8, 1, 1, 4, 0, 64, 4, 64 }, + { &MFVideoFormat_RGB555, 3, 5, 40, 0, 320, 40, 64 }, + { &MFVideoFormat_RGB555, 1, 1, 4, 0, 64, 4, 64 }, + { &MFVideoFormat_RGB565, 3, 5, 40, 0, 320, 40, 64 }, + { &MFVideoFormat_RGB565, 1, 1, 4, 0, 64, 4, 64 }, + { &MFVideoFormat_RGB24, 3, 5, 60, 0, 320, 60, 64 }, + { &MFVideoFormat_RGB24, 1, 1, 4, 0, 64, 4, 64 }, + { &MFVideoFormat_RGB32, 3, 5, 60, 0, 320, 60, 64 }, + { &MFVideoFormat_RGB32, 1, 1, 4, 0, 64, 4, 64 }, + { &MFVideoFormat_ARGB32, 3, 5, 60, 0, 320, 60, 64 }, + { &MFVideoFormat_ARGB32, 1, 1, 4, 0, 64, 4, 64 }, + { &MFVideoFormat_A2R10G10B10, 3, 5, 60, 0, 320, 60, 64 }, + { &MFVideoFormat_A2R10G10B10, 1, 1, 4, 0, 64, 4, 64 }, + { &MFVideoFormat_A16B16G16R16F, 3, 5, 120, 0, 320, 120, 64 }, + { &MFVideoFormat_A16B16G16R16F, 1, 1, 8, 0, 64, 8, 64 }, + + /* YUV, 32 bpp, packed */ + { &MFVideoFormat_AYUV, 1, 1, 4, 0, 64, 4, 64 }, + { &MFVideoFormat_AYUV, 2, 1, 8, 0, 64, 8, 64 }, + { &MFVideoFormat_AYUV, 1, 2, 8, 0, 128, 8, 64 }, + { &MFVideoFormat_AYUV, 4, 3, 48, 0, 192, 48, 64 }, + { &MFVideoFormat_AYUV, 320, 240, 307200, 0, 307200, 307200, 1280 }, + + /* YUV, 16 bpp, packed */ + { &MFVideoFormat_YUY2, 2, 1, 4, 0, 64, 4, 64 }, + { &MFVideoFormat_YUY2, 4, 3, 24, 0, 192, 24, 64 }, + { &MFVideoFormat_YUY2, 128, 128, 32768, 0, 32768, 32768, 256 }, + { &MFVideoFormat_YUY2, 320, 240, 153600, 0, 153600, 153600, 640 }, + + { &MFVideoFormat_UYVY, 2, 1, 4, 0, 64, 4, 64 }, + { &MFVideoFormat_UYVY, 4, 3, 24, 0, 192, 24, 64 }, + { &MFVideoFormat_UYVY, 128, 128, 32768, 0, 32768, 32768, 256 }, + { &MFVideoFormat_UYVY, 320, 240, 153600, 0, 153600, 153600, 640 }, + + /* YUV, 16 bpp, planar */ + { &MFVideoFormat_IMC1, 1, 1, 4, 0, 256, 8, 128 }, + { &MFVideoFormat_IMC1, 2, 1, 4, 0, 256, 8, 128 }, + { &MFVideoFormat_IMC1, 1, 2, 8, 0, 512, 16, 128 }, + { &MFVideoFormat_IMC1, 2, 2, 8, 0, 512, 16, 128 }, + { &MFVideoFormat_IMC1, 2, 4, 16, 0, 1024, 32, 128 }, + { &MFVideoFormat_IMC1, 4, 2, 16, 0, 512, 32, 128 }, + { &MFVideoFormat_IMC1, 4, 3, 24, 0, 768, 48, 128 }, + { &MFVideoFormat_IMC1, 320, 240, 153600, 0, 307200, 307200, 640 }, + + { &MFVideoFormat_IMC3, 1, 1, 4, 0, 256, 8, 128 }, + { &MFVideoFormat_IMC3, 2, 1, 4, 0, 256, 8, 128 }, + { &MFVideoFormat_IMC3, 1, 2, 8, 0, 512, 16, 128 }, + { &MFVideoFormat_IMC3, 2, 2, 8, 0, 512, 16, 128 }, + { &MFVideoFormat_IMC3, 2, 4, 16, 0, 1024, 32, 128 }, + { &MFVideoFormat_IMC3, 4, 2, 16, 0, 512, 32, 128 }, + { &MFVideoFormat_IMC3, 4, 3, 24, 0, 768, 48, 128 }, + { &MFVideoFormat_IMC3, 320, 240, 153600, 0, 307200, 307200, 640 }, + + /* YUV, 12 bpp, planar, full stride */ + { &MFVideoFormat_NV12, 1, 3, 9, 4, 288, 4, 64 }, + { &MFVideoFormat_NV12, 1, 2, 6, 3, 192, 3, 64 }, + { &MFVideoFormat_NV12, 2, 2, 6, 6, 192, 6, 64 }, + { &MFVideoFormat_NV12, 2, 4, 12, 0, 384, 12, 64 }, + { &MFVideoFormat_NV12, 3, 2, 12, 9, 192, 9, 64 }, + { &MFVideoFormat_NV12, 4, 2, 12, 0, 192, 12, 64 }, + { &MFVideoFormat_NV12, 320, 240, 115200, 0, 115200, 115200, 320 }, + + /* YUV, 12 bpp, planar, half stride */ + { &MFVideoFormat_IMC2, 1, 3, 9, 4, 576, 3, 128 }, + { &MFVideoFormat_IMC2, 3, 5, 30, 22, 960, 20, 128 }, + { &MFVideoFormat_IMC2, 1, 2, 6, 3, 384, 2, 128 }, + { &MFVideoFormat_IMC2, 2, 2, 6, 6, 384, 6, 128 }, + { &MFVideoFormat_IMC2, 2, 4, 12, 0, 768, 12, 128 }, + { &MFVideoFormat_IMC2, 3, 2, 12, 9, 384, 8, 128 }, + { &MFVideoFormat_IMC2, 4, 2, 12, 0, 384, 12, 128 }, + { &MFVideoFormat_IMC2, 320, 240, 115200, 0, 138240, 115200, 384 }, + + { &MFVideoFormat_IMC4, 1, 3, 9, 4, 576, 3, 128 }, + { &MFVideoFormat_IMC4, 3, 5, 30, 22, 960, 20, 128 }, + { &MFVideoFormat_IMC4, 1, 2, 6, 3, 384, 2, 128 }, + { &MFVideoFormat_IMC4, 2, 2, 6, 6, 384, 6, 128 }, + { &MFVideoFormat_IMC4, 2, 4, 12, 0, 768, 12, 128 }, + { &MFVideoFormat_IMC4, 3, 2, 12, 9, 384, 8, 128 }, + { &MFVideoFormat_IMC4, 4, 2, 12, 0, 384, 12, 128 }, + { &MFVideoFormat_IMC4, 320, 240, 115200, 0, 138240, 115200, 384 }, + + { &MFVideoFormat_YV12, 1, 1, 3, 1, 192, 1, 128 }, + { &MFVideoFormat_YV12, 2, 1, 3, 0, 192, 3, 128 }, + { &MFVideoFormat_YV12, 1, 2, 6, 3, 384, 2, 128 }, + { &MFVideoFormat_YV12, 2, 2, 6, 0, 384, 6, 128 }, + { &MFVideoFormat_YV12, 2, 4, 12, 0, 768, 12, 128 }, + { &MFVideoFormat_YV12, 4, 2, 12, 0, 384, 12, 128 }, + { &MFVideoFormat_YV12, 4, 3, 18, 0, 576, 18, 128 }, + { &MFVideoFormat_YV12, 320, 240, 115200, 0, 138240, 115200, 384 }, + + { &MFVideoFormat_I420, 1, 1, 3, 1, 192, 1, 128 }, + { &MFVideoFormat_I420, 2, 1, 3, 0, 192, 3, 128 }, + { &MFVideoFormat_I420, 1, 2, 6, 3, 384, 2, 128 }, + { &MFVideoFormat_I420, 2, 2, 6, 0, 384, 6, 128 }, + { &MFVideoFormat_I420, 2, 4, 12, 0, 768, 12, 128 }, + { &MFVideoFormat_I420, 4, 2, 12, 0, 384, 12, 128 }, + { &MFVideoFormat_I420, 4, 3, 18, 0, 576, 18, 128 }, + { &MFVideoFormat_I420, 320, 240, 115200, 0, 138240, 115200, 384 }, + + { &MFVideoFormat_IYUV, 1, 1, 3, 1, 192, 1, 128 }, + { &MFVideoFormat_IYUV, 2, 1, 3, 0, 192, 3, 128 }, + { &MFVideoFormat_IYUV, 1, 2, 6, 3, 384, 2, 128 }, + { &MFVideoFormat_IYUV, 2, 2, 6, 0, 384, 6, 128 }, + { &MFVideoFormat_IYUV, 2, 4, 12, 0, 768, 12, 128 }, + { &MFVideoFormat_IYUV, 4, 2, 12, 0, 384, 12, 128 }, + { &MFVideoFormat_IYUV, 4, 3, 18, 0, 576, 18, 128 }, + { &MFVideoFormat_IYUV, 320, 240, 115200, 0, 138240, 115200, 384 }, + };
static void test_MFCalculateImageSize(void) @@ -4366,7 +4401,8 @@ static void test_MFGetPlaneSize(void)
hr = pMFGetPlaneSize(ptr->subtype->Data1, ptr->width, ptr->height, &size); ok(hr == S_OK, "%u: failed to get plane size, hr %#lx.\n", i, hr); - ok(size == plane_size, "%u: unexpected plane size %lu, expected %u.\n", i, size, plane_size); + ok(size == plane_size, "%u: unexpected plane size %lu, expected %u. Size %u x %u, format %s.\n", i, size, plane_size, + ptr->width, ptr->height, wine_dbgstr_an((char*)&ptr->subtype->Data1, 4)); } }
@@ -5706,61 +5742,6 @@ static void test_MFGetStrideForBitmapInfoHeader(void)
static void test_MFCreate2DMediaBuffer(void) { - static const struct _2d_buffer_test - { - unsigned int width; - unsigned int height; - unsigned int fourcc; - unsigned int contiguous_length; - int pitch; - unsigned int max_length; - } _2d_buffer_tests[] = - { - { 2, 2, MAKEFOURCC('N','V','1','2'), 6, 64, 192 }, - { 4, 2, MAKEFOURCC('N','V','1','2'), 12, 64 }, - { 2, 4, MAKEFOURCC('N','V','1','2'), 12, 64 }, - { 1, 3, MAKEFOURCC('N','V','1','2'), 4, 64 }, - { 4, 16, MAKEFOURCC('N','V','1','2'), 96, 64, 1536 }, - - { 2, 2, MAKEFOURCC('I','M','C','2'), 6, 128, 384 }, - { 4, 2, MAKEFOURCC('I','M','C','2'), 12, 128 }, - { 2, 4, MAKEFOURCC('I','M','C','2'), 12, 128 }, - { 3, 5, MAKEFOURCC('I','M','C','2'), 20, 128 }, - { 2, 2, MAKEFOURCC('I','M','C','4'), 6, 128 }, - { 4, 2, MAKEFOURCC('I','M','C','4'), 12, 128 }, - { 2, 4, MAKEFOURCC('I','M','C','4'), 12, 128 }, - { 3, 5, MAKEFOURCC('I','M','C','4'), 20, 128 }, - - { 4, 2, MAKEFOURCC('I','M','C','1'), 32, 128 }, - { 4, 4, MAKEFOURCC('I','M','C','1'), 64, 128 }, - { 4, 16, MAKEFOURCC('I','M','C','1'), 256, 128, 4096 }, - { 4, 20, MAKEFOURCC('I','M','C','1'), 320, 128 }, - - { 4, 2, MAKEFOURCC('I','M','C','3'), 32, 128 }, - { 4, 4, MAKEFOURCC('I','M','C','3'), 64, 128 }, - { 4, 16, MAKEFOURCC('I','M','C','3'), 256, 128, 4096 }, - { 4, 20, MAKEFOURCC('I','M','C','3'), 320, 128 }, - - { 4, 2, MAKEFOURCC('Y','V','1','2'), 12, 128 }, - { 4, 4, MAKEFOURCC('Y','V','1','2'), 24, 128 }, - { 4, 16, MAKEFOURCC('Y','V','1','2'), 96, 128, 3072 }, - - { 4, 2, MAKEFOURCC('A','Y','U','V'), 32, 64 }, - { 4, 4, MAKEFOURCC('A','Y','U','V'), 64, 64 }, - { 4, 16, MAKEFOURCC('A','Y','U','V'), 256, 64, 1024 }, - - { 4, 2, MAKEFOURCC('Y','U','Y','2'), 16, 64 }, - { 4, 4, MAKEFOURCC('Y','U','Y','2'), 32, 64 }, - { 4, 16, MAKEFOURCC('Y','U','Y','2'), 128, 64, 1024 }, - - { 4, 2, MAKEFOURCC('U','Y','V','Y'), 16, 64 }, - { 4, 4, MAKEFOURCC('U','Y','V','Y'), 32, 64 }, - { 4, 16, MAKEFOURCC('U','Y','V','Y'), 128, 64, 1024 }, - - { 2, 4, D3DFMT_A8R8G8B8, 32, 64 }, - { 1, 4, D3DFMT_A8R8G8B8, 16, 64 }, - { 4, 1, D3DFMT_A8R8G8B8, 16, 64 }, - }; static const char two_aas[] = { 0xaa, 0xaa }; static const char eight_bbs[] = { 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb }; DWORD max_length, length, length2; @@ -5958,18 +5939,17 @@ static void test_MFCreate2DMediaBuffer(void)
IMFMediaBuffer_Release(buffer);
- for (i = 0; i < ARRAY_SIZE(_2d_buffer_tests); ++i) + for (i = 0; i < ARRAY_SIZE(image_size_tests); ++i) { - const struct _2d_buffer_test *ptr = &_2d_buffer_tests[i]; + const struct image_size_test *ptr = &image_size_tests[i];
- hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->fourcc, FALSE, &buffer); + hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->subtype->Data1, FALSE, &buffer); ok(hr == S_OK, "Failed to create a buffer, hr %#lx.\n", hr);
hr = IMFMediaBuffer_GetMaxLength(buffer, &length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (ptr->max_length) - ok(length == ptr->max_length, "%u: unexpected maximum length %lu for %u x %u, format %s.\n", - i, length, ptr->width, ptr->height, wine_dbgstr_an((char *)&ptr->fourcc, 4)); + ok(length == ptr->max_length, "%u: unexpected maximum length %lu for %u x %u, format %s.\n", + i, length, ptr->width, ptr->height, wine_dbgstr_guid(ptr->subtype));
hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer, (void **)&_2dbuffer); ok(hr == S_OK, "Failed to get interface, hr %#lx.\n", hr); @@ -5977,12 +5957,12 @@ static void test_MFCreate2DMediaBuffer(void) hr = IMF2DBuffer_GetContiguousLength(_2dbuffer, &length); ok(hr == S_OK, "Failed to get length, hr %#lx.\n", hr); ok(length == ptr->contiguous_length, "%d: unexpected contiguous length %lu for %u x %u, format %s.\n", - i, length, ptr->width, ptr->height, wine_dbgstr_an((char *)&ptr->fourcc, 4)); + i, length, ptr->width, ptr->height, wine_dbgstr_guid(ptr->subtype));
hr = IMFMediaBuffer_Lock(buffer, &data, &length2, NULL); ok(hr == S_OK, "Failed to lock buffer, hr %#lx.\n", hr); ok(length2 == ptr->contiguous_length, "%d: unexpected linear buffer length %lu for %u x %u, format %s.\n", - i, length2, ptr->width, ptr->height, wine_dbgstr_an((char *)&ptr->fourcc, 4)); + i, length2, ptr->width, ptr->height, wine_dbgstr_guid(ptr->subtype));
memset(data, 0xff, length2);
@@ -6002,11 +5982,11 @@ static void test_MFCreate2DMediaBuffer(void) for (k = 0; k < ptr->width; 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);
- hr = pMFGetStrideForBitmapInfoHeader(ptr->fourcc, ptr->width, &stride); + hr = pMFGetStrideForBitmapInfoHeader(ptr->subtype->Data1, ptr->width, &stride); ok(hr == S_OK, "Failed to get stride, hr %#lx.\n", hr);
/* secondary planes */ - switch (ptr->fourcc) + switch (ptr->subtype->Data1) { case MAKEFOURCC('I','M','C','1'): case MAKEFOURCC('I','M','C','3'): @@ -6017,6 +5997,9 @@ static void test_MFCreate2DMediaBuffer(void)
case MAKEFOURCC('I','M','C','2'): case MAKEFOURCC('I','M','C','4'): + case MAKEFOURCC('Y','V','1','2'): + case MAKEFOURCC('I','4','2','0'): + case MAKEFOURCC('I','Y','U','V'): for (j = 0; ptr->height * stride + j * (stride / 2) < length2; j++) for (k = 0; k < ptr->width / 2; k++) ok(data[ptr->height * pitch + j * (pitch / 2) + k] == 0xff, @@ -6038,7 +6021,7 @@ static void test_MFCreate2DMediaBuffer(void) ok(hr == S_OK, "Failed to unlock buffer, hr %#lx.\n", hr);
ok(pitch == ptr->pitch, "%d: unexpected pitch %ld, expected %d, %u x %u, format %s.\n", i, pitch, ptr->pitch, - ptr->width, ptr->height, wine_dbgstr_an((char *)&ptr->fourcc, 4)); + ptr->width, ptr->height, wine_dbgstr_guid(ptr->subtype));
ret = TRUE; hr = IMF2DBuffer_IsContiguousFormat(_2dbuffer, &ret); @@ -6051,11 +6034,11 @@ static void test_MFCreate2DMediaBuffer(void) }
/* Alignment tests */ - for (i = 0; i < ARRAY_SIZE(_2d_buffer_tests); ++i) + for (i = 0; i < ARRAY_SIZE(image_size_tests); ++i) { - const struct _2d_buffer_test *ptr = &_2d_buffer_tests[i]; + const struct image_size_test *ptr = &image_size_tests[i];
- hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->fourcc, FALSE, &buffer); + hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->subtype->Data1, FALSE, &buffer); ok(hr == S_OK, "Failed to create a buffer, hr %#lx.\n", hr);
hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer, (void **)&_2dbuffer);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116973
Your paranoid android.
=== w7u_adm (32 bit report) ===
mfplat: 0864:mfplat: unhandled exception c0000005 at 6ED67D1C
=== w8 (32 bit report) ===
mfplat: mfplat.c:6452: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6469: Test failed: Unexpected hr 0x80070057. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6558: Test failed: Unexpected leading byte. mfplat.c:6560: Test failed: Unexpected hr 0x80070057.
=== w8adm (32 bit report) ===
mfplat: mfplat.c:6452: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6469: Test failed: Unexpected hr 0x80070057. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6558: Test failed: Unexpected leading byte. mfplat.c:6560: Test failed: Unexpected hr 0x80070057.
=== w864 (32 bit report) ===
mfplat: mfplat.c:6452: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6469: Test failed: Unexpected hr 0x80070057. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6558: Test failed: Unexpected leading byte. mfplat.c:6560: Test failed: Unexpected hr 0x80070057.
=== w1064v1507 (32 bit report) ===
mfplat: mfplat.c:6452: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6469: Test failed: Unexpected hr 0x80070057. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6558: Test failed: Unexpected leading byte. mfplat.c:6560: Test failed: Unexpected hr 0x80070057.
=== w864 (64 bit report) ===
mfplat: mfplat.c:6452: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6469: Test failed: Unexpected hr 0x80070057. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6558: Test failed: Unexpected leading byte. mfplat.c:6560: Test failed: Unexpected hr 0x80070057.
=== w1064v1507 (64 bit report) ===
mfplat: mfplat.c:6452: Test failed: Unexpected length 0 instead of 1228800. mfplat.c:6469: Test failed: Unexpected hr 0x80070057. mfplat.c:6486: Test failed: Unexpected hr 0x80070057. mfplat.c:6558: Test failed: Unexpected leading byte. mfplat.c:6560: Test failed: Unexpected hr 0x80070057.
=== debian11 (32 bit report) ===
Report validation errors: mfplat:mfplat prints too much data (41233 bytes)
=== debian11 (32 bit Hebrew:Israel report) ===
mfplat: Unhandled exception: assertion failed in 32-bit code (0xf7f05559).
=== debian11 (32 bit WoW report) ===
Report validation errors: mfplat:mfplat prints too much data (38378 bytes)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116966
Your paranoid android.
=== debian11 (32 bit report) ===
Report validation errors: mfplat:mfplat prints too much data (41310 bytes)
=== debian11 (32 bit WoW report) ===
Report validation errors: mfplat:mfplat prints too much data (41318 bytes)