[PATCH v3 2/4] mf/tests: Check H264 decoder first NV12 decoded frame.
Rémi Bernon
rbernon at codeweavers.com
Wed Mar 9 02:53:04 CST 2022
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/mf/tests/mf.c | 66 ++++++++++++++++++++++++++++++++++--
dlls/mf/tests/nv12frame.bin | Bin 0 -> 9600 bytes
dlls/mf/tests/resource.rc | 3 ++
3 files changed, 66 insertions(+), 3 deletions(-)
create mode 100644 dlls/mf/tests/nv12frame.bin
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index ead2d56dc70..a2d7ad7a33f 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -6614,19 +6614,23 @@ static void test_h264_decoder(void)
MFT_REGISTER_TYPE_INFO input_type = {MFMediaType_Video, MFVideoFormat_H264};
MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Video, MFVideoFormat_NV12};
+ const BYTE *h264_encoded_data, *nv12_frame_data;
+ ULONG h264_encoded_data_len, nv12_frame_len;
MFT_OUTPUT_STREAM_INFO output_info;
MFT_INPUT_STREAM_INFO input_info;
MFT_OUTPUT_DATA_BUFFER output;
- const BYTE *h264_encoded_data;
- ULONG h264_encoded_data_len;
+ IMFMediaBuffer *media_buffer;
+ WCHAR output_path[MAX_PATH];
IMFAttributes *attributes;
IMFMediaType *media_type;
IMFTransform *transform;
+ DWORD status, length;
ULONG i, ret, flags;
+ HANDLE output_file;
IMFSample *sample;
HRSRC resource;
GUID class_id;
- DWORD status;
+ BYTE *data;
HRESULT hr;
hr = CoInitialize(NULL);
@@ -6923,6 +6927,62 @@ static void test_h264_decoder(void)
todo_wine
ok(i == 5, "%lu output media types\n", i);
+ /* and generate a new one as well in a temporary directory */
+ GetTempPathW(ARRAY_SIZE(output_path), output_path);
+ lstrcatW(output_path, L"nv12frame.bin");
+ output_file = CreateFileW(output_path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
+ ok(output_file != INVALID_HANDLE_VALUE, "CreateFileW failed, error %lu\n", GetLastError());
+
+ resource = FindResourceW(NULL, L"nv12frame.bin", (const WCHAR *)RT_RCDATA);
+ ok(resource != 0, "FindResourceW failed, error %lu\n", GetLastError());
+ nv12_frame_data = LockResource(LoadResource(GetModuleHandleW(NULL), resource));
+ nv12_frame_len = SizeofResource(GetModuleHandleW(NULL), resource);
+ ok(nv12_frame_len == 9600, "got frame length %lu\n", nv12_frame_len);
+
+ status = 0;
+ memset(&output, 0, sizeof(output));
+ output.pSample = create_sample(NULL, 0x3200);
+ hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status);
+ todo_wine
+ ok(hr == S_OK, "ProcessOutput returned %#lx\n", hr);
+ ok(output.dwStreamID == 0, "got dwStreamID %lu\n", output.dwStreamID);
+ ok(!!output.pSample, "got pSample %p\n", output.pSample);
+ ok(output.dwStatus == 0, "got dwStatus %#lx\n", output.dwStatus);
+ ok(!output.pEvents, "got pEvents %p\n", output.pEvents);
+ ok(status == 0, "got status %#lx\n", status);
+ if (hr == S_OK)
+ {
+ /* Win8 and before pad the data with garbage instead of original
+ * buffer data, make sure it's consistent. */
+ hr = IMFSample_ConvertToContiguousBuffer(output.pSample, &media_buffer);
+ ok(hr == S_OK, "ConvertToContiguousBuffer returned %#lx\n", hr);
+ hr = IMFMediaBuffer_Lock(media_buffer, &data, NULL, &length);
+ ok(hr == S_OK, "Lock returned %#lx\n", hr);
+ todo_wine
+ ok(length == nv12_frame_len, "got length %lu\n", length);
+ if (length == nv12_frame_len)
+ {
+ for (i = 0; i < 74; ++i)
+ {
+ memset(data + 80 * i + 78, 0xcd, 2);
+ memset(data + 80 * (80 + i) + 78, 0xcd, 2);
+ }
+ memset(data + 80 * 74, 0xcd, 6 * 80);
+ memset(data + 80 * 117, 0xcd, 3 * 80);
+ }
+ hr = IMFMediaBuffer_Unlock(media_buffer);
+ ok(hr == S_OK, "Unlock returned %#lx\n", hr);
+ IMFMediaBuffer_Release(media_buffer);
+
+ if (length == nv12_frame_len)
+ check_sample(output.pSample, nv12_frame_data, nv12_frame_len, output_file);
+ }
+ ret = IMFSample_Release(output.pSample);
+ ok(ret == 0, "Release returned %lu\n", ret);
+
+ trace("created %s\n", debugstr_w(output_path));
+ CloseHandle(output_file);
+
ret = IMFTransform_Release(transform);
ok(ret == 0, "Release returned %lu\n", ret);
ret = IMFSample_Release(sample);
diff --git a/dlls/mf/tests/nv12frame.bin b/dlls/mf/tests/nv12frame.bin
new file mode 100644
index 0000000000000000000000000000000000000000..9ceceb8fedbaace124ee5155566822fc2f441335
GIT binary patch
literal 9600
zcmaF;8V)WYz$yfohyYm#5QqSpNZ{;QxM{CnBaFL*Fm4sXxQPhkvJl1vA{nPSY91sI
zN5c=4Y(~=yD4UGt4`>-PTE2jah0*d9R4k0vAK+qPw7wjzFA)X8Xni?aUyioNK_$Xy
z`+2ne3~M6Lw*8D`x&Q(omBa`^0eGrhxe7 at XDaXD(dzLKoRt=bWf)I}o at Gn;Py?Xun
z)!_FpQbY*|AV<|}6d49EfC?#qfxube^hMfBHDga-U81g)s8CRm`||8r6kQ~lC-+))
zX_BV!lGR#5ratAxP7f|5Ev3Y~wc;^{?>Nfs^P8}Gf19!VYtc0+mXw%x!R49V%Yc5P
zJrY%3tAr9KCat=eM~Qh$j+xizWi7jKttD`p at YN%B31&%qDKYQnql(APGjH}8UP+NZ
zF1>G6xl(pECFVJ0Zs<BwBJMNe;lWjsPY<2T-1sz!67!zxKREJ2we>}O%ZAks*7K&S
zyU0~hV&0ST6SbG}p33){)bvf*C%-fLVC;QL%sZx{dO~%ha9qvg^!u~>3wM|-$zDK-
zd5$|ub}zNI7t$7SHk+dQ;<nQHLz$GAx8Xw7#uHkT)Tc;J-#jVxSnrFa7iLppUdJR|
zuasNo#L^31MYm-idb0P98*qG*?EI^E<BDYF)$@Iw4%4bPos5$>cI}dl7X{`ixCOND
znALM)-MX{MNr$?OHpj>;3Z=w6wb1r#TjOg57b43xob}H0-ndX)g%a~lY<*lMkz8=f
ze6M^_oPN#rOQ%<?q{KXtncB4__EYnFq|R9;7Cw^jTN87b67wcq-`=qz at 8~%>uM}%3
z#d*u!o=KfQI|_z*2sFTfN2kCf7+fX*gL#r>N-%ip9t=);9`ykRKjb0c*|Tut8b-|n
zh2d!Ufzr%qdV%DT(fk1^VPK`pX#RkdsH6E~q~?zu<uKR)tTAB_CbpxzGbK6 at 1`(o@
zXXNgHL4 at dz^0Q|Vb at 7gJL|qK4w@=+$x*j2l$c2+V5TeK|>YI1l2?qDOPfCN?wRHW`
z^|vnF2EvoOw=Lebc=jZa%w!K3>`H;DM5WK3Jtm5Pi at lL$UmrujZHtj*aI;6vLxc??
X^j;qu4L?M<AhW2SUWR#h1H*d&)8J<o
literal 0
HcmV?d00001
diff --git a/dlls/mf/tests/resource.rc b/dlls/mf/tests/resource.rc
index 17adc3ed46c..5a2bf913672 100644
--- a/dlls/mf/tests/resource.rc
+++ b/dlls/mf/tests/resource.rc
@@ -25,3 +25,6 @@ wmadata.bin RCDATA wmadata.bin
/* @makedep: h264data.bin */
h264data.bin RCDATA h264data.bin
+
+/* @makedep: nv12frame.bin */
+nv12frame.bin RCDATA nv12frame.bin
--
2.35.1
More information about the wine-devel
mailing list