Commit ae32fb46 authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

mfplat/tests: Add MEDIASUBTYPE_RGB* and NV11 image size tests.

parent aa7f3b1e
......@@ -337,6 +337,15 @@ static WCHAR *load_resource(const WCHAR *name)
return pathW;
}
static BOOL is_MEDIASUBTYPE_RGB(const GUID *subtype)
{
return IsEqualGUID(subtype, &MEDIASUBTYPE_RGB8)
|| IsEqualGUID(subtype, &MEDIASUBTYPE_RGB555)
|| IsEqualGUID(subtype, &MEDIASUBTYPE_RGB565)
|| IsEqualGUID(subtype, &MEDIASUBTYPE_RGB24)
|| IsEqualGUID(subtype, &MEDIASUBTYPE_RGB32);
}
struct test_callback
{
IMFAsyncCallback IMFAsyncCallback_iface;
......@@ -4261,6 +4270,16 @@ image_size_tests[] =
{ &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 },
{ &MEDIASUBTYPE_RGB8, 3, 5, 20 },
{ &MEDIASUBTYPE_RGB8, 1, 1, 4 },
{ &MEDIASUBTYPE_RGB555, 3, 5, 40 },
{ &MEDIASUBTYPE_RGB555, 1, 1, 4 },
{ &MEDIASUBTYPE_RGB565, 3, 5, 40 },
{ &MEDIASUBTYPE_RGB565, 1, 1, 4 },
{ &MEDIASUBTYPE_RGB24, 3, 5, 60 },
{ &MEDIASUBTYPE_RGB24, 1, 1, 4 },
{ &MEDIASUBTYPE_RGB32, 3, 5, 60 },
{ &MEDIASUBTYPE_RGB32, 1, 1, 4 },
/* YUV 4:4:4, 32 bpp, packed */
{ &MFVideoFormat_AYUV, 1, 1, 4, 0, 64, 4, 64 },
......@@ -4338,6 +4357,15 @@ image_size_tests[] =
{ &MFVideoFormat_IMC4, 4, 2, 12, 0, 384, 12, 128 },
{ &MFVideoFormat_IMC4, 4, 3, 18, 0, 576, 18, 128 },
{ &MFVideoFormat_IMC4, 320, 240, 115200, 0, 138240, 115200, 384 },
/* YUV 4:1:1, 12 bpp, semi-planar */
{ &MFVideoFormat_NV11, 1, 3, 18, 4, 576, 3, 128 },
{ &MFVideoFormat_NV11, 1, 2, 12, 3, 384, 2, 128 },
{ &MFVideoFormat_NV11, 2, 2, 12, 6, 384, 6, 128 },
{ &MFVideoFormat_NV11, 2, 4, 24, 12, 768, 12, 128 },
{ &MFVideoFormat_NV11, 3, 2, 12, 9, 384, 8, 128 },
{ &MFVideoFormat_NV11, 4, 2, 12, 0, 384, 12, 128 },
{ &MFVideoFormat_NV11, 320, 240, 115200, 0, 138240, 115200, 384 },
};
static void test_MFCalculateImageSize(void)
......@@ -4360,7 +4388,9 @@ static void test_MFCalculateImageSize(void)
IsEqualGUID(ptr->subtype, &MFVideoFormat_A2R10G10B10);
hr = MFCalculateImageSize(ptr->subtype, ptr->width, ptr->height, &size);
todo_wine_if(is_MEDIASUBTYPE_RGB(ptr->subtype) || IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
ok(hr == S_OK || (is_broken && hr == E_INVALIDARG), "%u: failed to calculate image size, hr %#lx.\n", i, hr);
todo_wine_if(is_MEDIASUBTYPE_RGB(ptr->subtype) || IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
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));
}
......@@ -4387,9 +4417,12 @@ static void test_MFGetPlaneSize(void)
{
const struct image_size_test *ptr = &image_size_tests[i];
unsigned int plane_size = ptr->plane_size ? ptr->plane_size : ptr->size;
if ((is_MEDIASUBTYPE_RGB(ptr->subtype)))
plane_size = 0;
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);
todo_wine_if(IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
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));
}
......@@ -5932,8 +5965,14 @@ static void test_MFCreate2DMediaBuffer(void)
{
const struct image_size_test *ptr = &image_size_tests[i];
if (is_MEDIASUBTYPE_RGB(ptr->subtype))
continue;
hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->subtype->Data1, FALSE, &buffer);
todo_wine_if(IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
ok(hr == S_OK, "Failed to create a buffer, hr %#lx.\n", hr);
if (hr != S_OK)
continue;
hr = IMFMediaBuffer_GetMaxLength(buffer, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
......@@ -6070,8 +6109,14 @@ static void test_MFCreate2DMediaBuffer(void)
{
const struct image_size_test *ptr = &image_size_tests[i];
if (is_MEDIASUBTYPE_RGB(ptr->subtype))
continue;
hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->subtype->Data1, FALSE, &buffer);
todo_wine_if(IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
ok(hr == S_OK, "Failed to create a buffer, hr %#lx.\n", hr);
if (hr != S_OK)
continue;
hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer, (void **)&_2dbuffer);
ok(hr == S_OK, "Failed to get interface, hr %#lx.\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment