mfplat: Add I420 format support for frame size helpers.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-05-06 22:27:03 +03:00 committed by Alexandre Julliard
parent fde3bc0677
commit 6dc14ce625
2 changed files with 26 additions and 3 deletions

View File

@ -1791,6 +1791,7 @@ static const struct uncompressed_video_format video_formats[] =
{ &MFVideoFormat_RGB8, 1, 3, 1, 0 }, { &MFVideoFormat_RGB8, 1, 3, 1, 0 },
{ &MFVideoFormat_L8, 1, 3, 1, 0 }, { &MFVideoFormat_L8, 1, 3, 1, 0 },
{ &MFVideoFormat_AYUV, 4, 3, 0, 1 }, { &MFVideoFormat_AYUV, 4, 3, 0, 1 },
{ &MFVideoFormat_I420, 1, 0, 0, 1 },
{ &MFVideoFormat_IMC1, 2, 3, 0, 1 }, { &MFVideoFormat_IMC1, 2, 3, 0, 1 },
{ &MFVideoFormat_IMC2, 1, 0, 0, 1 }, { &MFVideoFormat_IMC2, 1, 0, 0, 1 },
{ &MFVideoFormat_IMC3, 2, 3, 0, 1 }, { &MFVideoFormat_IMC3, 2, 3, 0, 1 },
@ -1876,6 +1877,7 @@ HRESULT WINAPI MFCalculateImageSize(REFGUID subtype, UINT32 width, UINT32 height
case MAKEFOURCC('I','M','C','4'): case MAKEFOURCC('I','M','C','4'):
case MAKEFOURCC('N','V','1','2'): case MAKEFOURCC('N','V','1','2'):
case MAKEFOURCC('Y','V','1','2'): case MAKEFOURCC('Y','V','1','2'):
case MAKEFOURCC('I','4','2','0'):
/* 2 x 2 block, interleaving UV for half the height */ /* 2 x 2 block, interleaving UV for half the height */
*size = ((width + 1) & ~1) * height * 3 / 2; *size = ((width + 1) & ~1) * height * 3 / 2;
break; break;
@ -1917,6 +1919,7 @@ HRESULT WINAPI MFGetPlaneSize(DWORD fourcc, DWORD width, DWORD height, DWORD *si
case MAKEFOURCC('I','M','C','4'): case MAKEFOURCC('I','M','C','4'):
case MAKEFOURCC('N','V','1','2'): case MAKEFOURCC('N','V','1','2'):
case MAKEFOURCC('Y','V','1','2'): case MAKEFOURCC('Y','V','1','2'):
case MAKEFOURCC('I','4','2','0'):
*size = stride * height * 3 / 2; *size = stride * height * 3 / 2;
break; break;
default: default:

View File

@ -3553,41 +3553,56 @@ static void test_MFCalculateImageSize(void)
{ &MFVideoFormat_NV12, 1, 2, 6, 3 }, { &MFVideoFormat_NV12, 1, 2, 6, 3 },
{ &MFVideoFormat_NV12, 2, 2, 6, 6 }, { &MFVideoFormat_NV12, 2, 2, 6, 6 },
{ &MFVideoFormat_NV12, 3, 2, 12, 9 }, { &MFVideoFormat_NV12, 3, 2, 12, 9 },
{ &MFVideoFormat_NV12, 4, 2, 12, 12 }, { &MFVideoFormat_NV12, 4, 2, 12 },
{ &MFVideoFormat_NV12, 320, 240, 115200 },
{ &MFVideoFormat_AYUV, 1, 1, 4 }, { &MFVideoFormat_AYUV, 1, 1, 4 },
{ &MFVideoFormat_AYUV, 2, 1, 8 }, { &MFVideoFormat_AYUV, 2, 1, 8 },
{ &MFVideoFormat_AYUV, 1, 2, 8 }, { &MFVideoFormat_AYUV, 1, 2, 8 },
{ &MFVideoFormat_AYUV, 4, 3, 48 }, { &MFVideoFormat_AYUV, 4, 3, 48 },
{ &MFVideoFormat_AYUV, 320, 240, 307200 },
{ &MFVideoFormat_IMC1, 1, 1, 4 }, { &MFVideoFormat_IMC1, 1, 1, 4 },
{ &MFVideoFormat_IMC1, 2, 1, 4 }, { &MFVideoFormat_IMC1, 2, 1, 4 },
{ &MFVideoFormat_IMC1, 1, 2, 8 }, { &MFVideoFormat_IMC1, 1, 2, 8 },
{ &MFVideoFormat_IMC1, 4, 3, 24 }, { &MFVideoFormat_IMC1, 4, 3, 24 },
{ &MFVideoFormat_IMC1, 320, 240, 153600 },
{ &MFVideoFormat_IMC3, 1, 1, 4 }, { &MFVideoFormat_IMC3, 1, 1, 4 },
{ &MFVideoFormat_IMC3, 2, 1, 4 }, { &MFVideoFormat_IMC3, 2, 1, 4 },
{ &MFVideoFormat_IMC3, 1, 2, 8 }, { &MFVideoFormat_IMC3, 1, 2, 8 },
{ &MFVideoFormat_IMC3, 4, 3, 24 }, { &MFVideoFormat_IMC3, 4, 3, 24 },
{ &MFVideoFormat_IMC3, 320, 240, 153600 },
{ &MFVideoFormat_IMC2, 1, 3, 9, 4 }, { &MFVideoFormat_IMC2, 1, 3, 9, 4 },
{ &MFVideoFormat_IMC2, 1, 2, 6, 3 }, { &MFVideoFormat_IMC2, 1, 2, 6, 3 },
{ &MFVideoFormat_IMC2, 2, 2, 6, 6 }, { &MFVideoFormat_IMC2, 2, 2, 6, 6 },
{ &MFVideoFormat_IMC2, 3, 2, 12, 9 }, { &MFVideoFormat_IMC2, 3, 2, 12, 9 },
{ &MFVideoFormat_IMC2, 4, 2, 12, 12 }, { &MFVideoFormat_IMC2, 4, 2, 12 },
{ &MFVideoFormat_IMC2, 320, 240, 115200 },
{ &MFVideoFormat_IMC4, 1, 3, 9, 4 }, { &MFVideoFormat_IMC4, 1, 3, 9, 4 },
{ &MFVideoFormat_IMC4, 1, 2, 6, 3 }, { &MFVideoFormat_IMC4, 1, 2, 6, 3 },
{ &MFVideoFormat_IMC4, 2, 2, 6, 6 }, { &MFVideoFormat_IMC4, 2, 2, 6, 6 },
{ &MFVideoFormat_IMC4, 3, 2, 12, 9 }, { &MFVideoFormat_IMC4, 3, 2, 12, 9 },
{ &MFVideoFormat_IMC4, 4, 2, 12, 12 }, { &MFVideoFormat_IMC4, 4, 2, 12 },
{ &MFVideoFormat_IMC4, 320, 240, 115200 },
{ &MFVideoFormat_YV12, 1, 1, 3, 1 }, { &MFVideoFormat_YV12, 1, 1, 3, 1 },
{ &MFVideoFormat_YV12, 2, 1, 3 }, { &MFVideoFormat_YV12, 2, 1, 3 },
{ &MFVideoFormat_YV12, 1, 2, 6, 3 }, { &MFVideoFormat_YV12, 1, 2, 6, 3 },
{ &MFVideoFormat_YV12, 4, 3, 18 }, { &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_YUY2, 2, 1, 4 }, { &MFVideoFormat_YUY2, 2, 1, 4 },
{ &MFVideoFormat_YUY2, 4, 3, 24 }, { &MFVideoFormat_YUY2, 4, 3, 24 },
{ &MFVideoFormat_YUY2, 128, 128, 32768 }, { &MFVideoFormat_YUY2, 128, 128, 32768 },
{ &MFVideoFormat_YUY2, 320, 240, 153600 },
{ &MFVideoFormat_UYVY, 2, 1, 4 }, { &MFVideoFormat_UYVY, 2, 1, 4 },
{ &MFVideoFormat_UYVY, 4, 3, 24 }, { &MFVideoFormat_UYVY, 4, 3, 24 },
{ &MFVideoFormat_UYVY, 128, 128, 32768 }, { &MFVideoFormat_UYVY, 128, 128, 32768 },
{ &MFVideoFormat_UYVY, 320, 240, 153600 },
}; };
unsigned int i; unsigned int i;
UINT32 size; UINT32 size;
@ -4716,6 +4731,11 @@ static void test_MFGetStrideForBitmapInfoHeader(void)
{ &MFVideoFormat_YV12, 1, 1 }, { &MFVideoFormat_YV12, 1, 1 },
{ &MFVideoFormat_YV12, 2, 2 }, { &MFVideoFormat_YV12, 2, 2 },
{ &MFVideoFormat_YV12, 3, 3 }, { &MFVideoFormat_YV12, 3, 3 },
{ &MFVideoFormat_YV12, 320, 320 },
{ &MFVideoFormat_I420, 1, 1 },
{ &MFVideoFormat_I420, 2, 2 },
{ &MFVideoFormat_I420, 3, 3 },
{ &MFVideoFormat_I420, 320, 320 },
}; };
unsigned int i; unsigned int i;
LONG stride; LONG stride;