From: Brendan McGrath bmcgrath@codeweavers.com
--- dlls/mf/tests/mf_test.h | 4 +- dlls/mf/tests/nv12frame-2d.bmp | Bin 0 -> 67638 bytes dlls/mf/tests/nv12frame-flip-2d.bmp | Bin 0 -> 67638 bytes dlls/mf/tests/resource.rc | 16 ++ dlls/mf/tests/rgb32frame-crop-flip-2d.bmp | Bin 0 -> 32310 bytes dlls/mf/tests/rgb32frame-flip-2d.bmp | Bin 0 -> 36918 bytes dlls/mf/tests/transform.c | 237 ++++++++++++++++++---- 7 files changed, 210 insertions(+), 47 deletions(-) create mode 100644 dlls/mf/tests/nv12frame-2d.bmp create mode 100644 dlls/mf/tests/nv12frame-flip-2d.bmp create mode 100644 dlls/mf/tests/rgb32frame-crop-flip-2d.bmp create mode 100644 dlls/mf/tests/rgb32frame-flip-2d.bmp
diff --git a/dlls/mf/tests/mf_test.h b/dlls/mf/tests/mf_test.h index 9fa5d4fef41..f118e921b11 100644 --- a/dlls/mf/tests/mf_test.h +++ b/dlls/mf/tests/mf_test.h @@ -114,6 +114,6 @@ struct sample_desc BOOL todo_time; };
-#define check_mf_sample_collection(a, b, c) check_mf_sample_collection_(__FILE__, __LINE__, a, b, c) +#define check_mf_sample_collection(a, b, c) check_mf_sample_collection_(__FILE__, __LINE__, a, b, c, FALSE) extern DWORD check_mf_sample_collection_(const char *file, int line, IMFCollection *samples, - const struct sample_desc *expect_samples, const WCHAR *expect_data_filename); + const struct sample_desc *expect_samples, const WCHAR *expect_data_filename, BOOL use_2d_buffer); diff --git a/dlls/mf/tests/nv12frame-2d.bmp b/dlls/mf/tests/nv12frame-2d.bmp new file mode 100644 index 0000000000000000000000000000000000000000..3f3670aa7e2ce632cfc4ceeec506d049eaf30fa4 GIT binary patch literal 67638 zcmeI0u}<Sa5Qe!o@FSd3U0#5QlB1@epoxTZHApF`-66`*@B{=!De?+bNI}{LQBkBp zR4L#M_SRJ6W>?9M<=FGBHIb#`@@N0=pYh6nPY<6Ce%4|5{1d7S^)J+~gWusZtf!yP z+Q+6WJ(c0X&8>e6wRl+WRL(iyX2Cv#ebqbgw>>}L4}a#r-3-wGcG>g%x6K~@@Mr$p z&H()3&-veO2Izmg?0azjdoAufmEpn3y?+kX)%X9f&tPBm4*YG;5BS5M`ENG^^uJy9 zJpXO8hd=z8|F$y#fB19$x0?a_-!A(eod4#t!c!R@JRbX5sII>MhkXY7s(0XTdw#$l z{>*>78KD2|vgi44n?3yD&-}NY0r<n8^S|8;(EoPX_u%|D9SuB{;lahJpN8t{`+wMH zu&;Ut{<h}_{Nd01x0?a_-!6Ne|F+q~AO6gL+ZljA{5k*I%>eyxmwgY;e^;xur!qWv zdH0v0y88Yf_8IJ}-hsdE`2m0UGym;ofd043p69=9_V9;4^WSy`;17S!|8_G#|J!BX zgY)0n_{&on9$bI=^H5!V{}1~N_Eqn|-}d}~Km3{hb~8Z#+hx!5-!^;r!=L$YI|J~C zKj(kD8KD2|vhTt9Z}>g&RE7s1r9TSQ)%X9f&tPBm4*YG;5BS5M`ENG^^uJy9JpXO8 zhd=z8|F$y#fB19$x0?a_-!A(eod0%xZ_WQ(?)=VQdgq+;ZI=8k-0Lvi#>Y0<SK8bB zR{mB$AMn@rv`aaKKm6OwK$m)@kH57|_LX)YJ?+w-;LrSTGXq`fl|KH~HrX@(+n+t~ zZ=XS%a|QnJZ!-fM?e(^(t+2P~(w5(#kN?7fX!ycEl0Rh!=s%IZ#bV#{_o}^~Yuium zUt9ha{ThH&{_tPf0rE%wgaiBDe{=0M6PpjWsr_rq&(W^|!2h@d<WJcF`ma;{H&tJ? z?I-8Iy8IM<=|Ft?Ifwt+4oLUY=O1nLDfzDfApda(uC&)>&Hm*4*OtFRzXl*q-#PqO zc7XhmKjFZ>_urZJIv1M{x2gSW%b%fN1AzZ=2gskY1N2{~`fsScj%wRa&VOzBA^J4{ z@#*Ir{wq5`{>YzjVBh;s{M1HnQ~Pg3RD3D=aR-D|joil7oohr?d@1^I2ZU9P+{V@6 z--zkrOH=-r%IoI#VJR>4;|?g>U*f+^-@`KQzH`N$?samHzH|Wp;|}PiuejSbf3rgO zdOVi&)BUHbJ}c12f9XKH`<xpMbgzq3sh-ZiuKH+zKK@GwQu$x4b+4Cqsh-ZiuKH?? zKK@GwQu!Z$>0Z~LQazo2UG?!7`uHy$Nag=~qI-RmQazo2UG?t?`uHy$NabJtZ4>wC W#~o<GbNQWdb?4;YHgUi2`u_ny&%5*h
literal 0 HcmV?d00001
diff --git a/dlls/mf/tests/nv12frame-flip-2d.bmp b/dlls/mf/tests/nv12frame-flip-2d.bmp new file mode 100644 index 0000000000000000000000000000000000000000..4fffacd51030977b35846210a4a2a0ca04a943fb GIT binary patch literal 67638 zcmeI0u}&i~6h+xT$S15)Ek6LFWT{h7&>$gEgG5O^9imJczJQ=81;0Rr1d<y>ML~n8 zQotX0Jydoxmew!wOzyGuM(J*R&wX#K`8(Np*!o#J;rS<26Y4b7udUzV8P>zkGkGj; z?>$w|1LvHtS+K9izV*H)`&JwN@FxTHGC=>=^S%$chd=ylW}pu}p!^?dvTwDOz3;=> z;m`c9nSnm^fbxH+$)5RNfA+w?K7*R`r#AoX?+Z^Ac<|Bqy-@#~A@~<~--qnNUweMQ zAO6gL-3-wGy6oHg2mImB{MXF@{jbZO`LE3${_to1YiD5K{11=6JXPSq<)=RiHPr9_ zurFZW_742D=Lh`Z&-~ZT0R6Aap7*~td-%hj`LCS;_`{$3zitNTe_i$)aQ{1hdiPX; z2hVT*EYwiH|HHn3ecL<m*Pb8nhd=XQHv{y)E_>ep+U(&Ef9Ah-2H+2W?*F<Op#OE* zZ@~R;x;yq%fd?lOKMgh1@BgqbVBhu*{I%x?{Nd01*UbR^ugjkIzczdL!=L%DodNj6 zpZmXV2IzlX_8V~jTg*qED)8WL-_Ju0_4_~U3)r{41Ap!L0e|>2|8+A!|Ld~n{jbd) z{_to1Yi9ud@aO)on*sV?m;DCZ|6WEjPZfA@aN{3C4fXp!><iepy#s&k`2m0UGyion zK>zEq=l!qE9{%uW{%dCd{_yAiubTn-Uzhy`-2YZh<Ea7<uCD!SsG)xUhkXJ2ws+vK zJwM<Nf9Ah#2IzlX_PqbK*~1_H%zy0+z#snH|8+A!|Ld~ffcxKa&C6xhn&p=nd58Xb z9l-x?2iEKUlKgkuFW>*$)@v_KbjE&XEx(O^0s#NJ9Uy<k4$yyt>c2zlb(9=Gd;hSO zKSVzP&^`T}!+&E3$RGKO9O!%hom;Q7=<wlZ?)=vB=jbN@@W0yu@@MP-{Wqxoo0_lW z_}TeyE<Z&-cA$IuIfwt&4#e)~??2Y+Q}UkxAphMCEUec&u|GTit>qW!Cjh$XJBR<q z4v;_c7dg=P{(G@rkI~`7&)oT~<zLWG0N{VO1LV)x0s3!H{kO7SugUSV^WR#2g?<8{ zd-^$t|HclGKk^qj(D(kky<hLnoqxURxA*9GJD~3W_l52LXi`VJ-FMDb{rdua{Er>T z<?r~*c3*zR>iPL=tA6~2KK{oJ<nsUYZo8k~V)cCfZPlON(Z~PTfn5G~$F}=q607I) zZ>zpLMj!uU2XgtJk8JndeypC)zpeUwgg*Yq4&?Gbn%VAyn^--ce_Qp@41N5M9mwUs WF<w{Kv3frL#_|pN_#Zov%l|*U>bvv+
literal 0 HcmV?d00001
diff --git a/dlls/mf/tests/resource.rc b/dlls/mf/tests/resource.rc index 6c9a6601c24..8eb147c90e6 100644 --- a/dlls/mf/tests/resource.rc +++ b/dlls/mf/tests/resource.rc @@ -85,6 +85,10 @@ h264data-2.bin RCDATA h264data-2.bin /* @makedep: nv12frame.bmp */ nv12frame.bmp RCDATA nv12frame.bmp
+/* Generated from running the tests on Windows */ +/* @makedep: nv12frame-2d.bmp */ +nv12frame-2d.bmp RCDATA nv12frame-2d.bmp + /* Generated from running the tests on Windows */ /* @makedep: nv12frame-grabber.bmp */ nv12frame-grabber.bmp RCDATA nv12frame-grabber.bmp @@ -93,6 +97,10 @@ nv12frame-grabber.bmp RCDATA nv12frame-grabber.bmp /* @makedep: nv12frame-flip.bmp */ nv12frame-flip.bmp RCDATA nv12frame-flip.bmp
+/* Generated from running the tests on Windows */ +/* @makedep: nv12frame-flip-2d.bmp */ +nv12frame-flip-2d.bmp RCDATA nv12frame-flip-2d.bmp + /* Generated from running the tests on Windows */ /* @makedep: i420frame.bmp */ i420frame.bmp RCDATA i420frame.bmp @@ -105,6 +113,10 @@ rgb32frame.bmp RCDATA rgb32frame.bmp /* @makedep: rgb32frame-flip.bmp */ rgb32frame-flip.bmp RCDATA rgb32frame-flip.bmp
+/* Generated from running the tests on Windows */ +/* @makedep: rgb32frame-flip-2d.bmp */ +rgb32frame-flip-2d.bmp RCDATA rgb32frame-flip-2d.bmp + /* Generated from running the tests on Windows */ /* @makedep: rgb32frame-crop.bmp */ rgb32frame-crop.bmp RCDATA rgb32frame-crop.bmp @@ -113,6 +125,10 @@ rgb32frame-crop.bmp RCDATA rgb32frame-crop.bmp /* @makedep: rgb32frame-crop-flip.bmp */ rgb32frame-crop-flip.bmp RCDATA rgb32frame-crop-flip.bmp
+/* Generated from running the tests on Windows */ +/* @makedep: rgb32frame-crop-flip-2d.bmp */ +rgb32frame-crop-flip-2d.bmp RCDATA rgb32frame-crop-flip-2d.bmp + /* Generated from running the tests on Windows */ /* @makedep: abgr32frame-crop.bmp */ abgr32frame-crop.bmp RCDATA abgr32frame-crop.bmp diff --git a/dlls/mf/tests/rgb32frame-crop-flip-2d.bmp b/dlls/mf/tests/rgb32frame-crop-flip-2d.bmp new file mode 100644 index 0000000000000000000000000000000000000000..53592995484a8ae67426dacdecfb612a89527adf GIT binary patch literal 32310 zcmeI4y-fo_5Jtxdbr8A&7eEXd1-J)taw<SbbU+bE<OJl7+yM=End7KnzLkbg_g31I zENeXDchBR~_~+*C@EE`AkjH)QWA6LhySUC{uD|=&8|!gI47SGL6u0BExL~ibU--da zXQ+4xfA}l@xX0o@{<}M@)Q|u8ulVC0i~soV?yyon{`>kLamiE9Rv0|Qxjg?-@)Emx z3;*8NFZ|)Z<z9sU_>cd!55Ts}ZPs(A|ImMCx#ajb_>cdN-p;C7@&A&eE4Id9Tz!}4 zKd{%>FZ|%IGgLf;Kl~Mc++*<{|J@x{>c@ZlSNw60#ee*FcUY+(|9$=6jTmf=!OQDY zdHw@?js3z8{yIa&L-@mA@y9(D|MB15VWocj$A85i_gMVLe|LwK`tje_|NQfx`~n4A zV(|7{p8rUBId7}G@b7&M!yo=z?nU^I|M*|}0T|am6Ry4KKlC5^5B;ah0s4<^|C#Xa z(`DVi$@~5>%JU!i>sNsA*BL4v!XN&MKkl*kkN@rtEA`_){ww~t$KpT!yF0AZkN>{@ z=irK^68Ngmf7H~(Cjt2PY5;%u_Y&yMj{orQCD5B4|KZ<Dpf@}I!@rk6Z+85*<^Kcu COpmqz
literal 0 HcmV?d00001
diff --git a/dlls/mf/tests/rgb32frame-flip-2d.bmp b/dlls/mf/tests/rgb32frame-flip-2d.bmp new file mode 100644 index 0000000000000000000000000000000000000000..8b5235b2ff12b40de19ef56fc8b88ec643af6eb6 GIT binary patch literal 36918 zcmeI&(M`iJ6oyfE6CRm>0eEKzMq;t9)Zma#@Y|B>%ZcO)gf6bX9931-&##Z4_IG{s z$M?RzpX=7%`cM6O{{8ypdOTV?tnmi-@X~&~{n;?gf7f6C3I_O}<2bdTzy7J63UmDP zU%_#D2LAa^?NpfKe^39dJvu)tZ*YBlmio{4b<eJL`mZ&lzyAOEwTOTI`S<>3l>x6m zUVm2Edxd@Z=l>NPu6hn*{vZ8gD{H(#`u<1z@%Cp!{pWN{J?gK2YNx^+|NK{QoSuPy z{!=>@=J@Bog5&fI{O{@icC^D9Z;<-ee!TtJQ2#j{Q;+)VpW3M~$3OoS9H(dCpa0ZO zg*pEDui!X61OI#a@82Fetnmh^f9=QHpAGe&(=qj^zy7J63UmDPU%_#D2LAa^?NpfK zpZ^Mu(=+hDr~kFjI@R`ibE$v*=iE#E=X6Xx>aTxlr@|cn{8w<Co`HY<Q#%#r_~*ZZ z<Ma&t@9DpP`NuV(K<a<O*8W8=p#NG1`s=^8z}nsU*MDt+wY&4L|Jnj;cjsUKwFTDh i&i|hM)B9#l0R<FLKmi35P(T3%6i`3`1r$(Vj{?7uQspQB
literal 0 HcmV?d00001
diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 7603d56f6ee..ffb3de92e2c 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -1196,18 +1196,13 @@ static void enum_mf_samples(IMFCollection *samples, const struct sample_desc *co ok(hr == E_INVALIDARG, "GetElement returned %#lx\n", hr); }
-static void dump_mf_media_buffer(IMFMediaBuffer *buffer, const struct buffer_desc *buffer_desc, HANDLE output) +static void dump_buffer_data(const struct buffer_desc *buffer_desc, void *data, DWORD length, HANDLE output) { - DWORD length, written; - HRESULT hr; - BYTE *data; - BOOL ret; - - hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length); - ok(hr == S_OK, "Lock returned %#lx\n", hr); + SIZE size = buffer_desc->size; + DWORD ret, written;
if (buffer_desc->dump) - buffer_desc->dump(data, length, &buffer_desc->size, output); + buffer_desc->dump(data, length, &size, output); else { if (buffer_desc->length == -1) @@ -1221,7 +1216,36 @@ static void dump_mf_media_buffer(IMFMediaBuffer *buffer, const struct buffer_des ok(ret, "WriteFile failed, error %lu\n", GetLastError()); ok(written == length, "written %lu bytes\n", written); } +} + +static void dump_mf_2d_buffer(IMFMediaBuffer *buffer, const struct buffer_desc *buffer_desc, HANDLE output) +{ + IMF2DBuffer2 *buffer2d; + DWORD length; + LONG stride; + BYTE *scanline; + HRESULT hr; + BYTE *data; + + hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer2, (void **)&buffer2d); + ok(hr == S_OK, "QueryInterface IMF2DBuffer2 returned %#lx\n", hr); + hr = IMF2DBuffer2_Lock2DSize(buffer2d, MF2DBuffer_LockFlags_Read, &scanline, &stride, &data, &length); + ok(hr == S_OK, "Lock2DSize returned %#lx\n", hr); + dump_buffer_data(buffer_desc, data, length, output); + hr = IMF2DBuffer2_Unlock2D(buffer2d); + ok(hr == S_OK, "Unlock2D returned %#lx\n", hr); + IMF2DBuffer2_Release(buffer2d); +} + +static void dump_mf_media_buffer(IMFMediaBuffer *buffer, const struct buffer_desc *buffer_desc, HANDLE output) +{ + DWORD length; + HRESULT hr; + BYTE *data;
+ hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length); + ok(hr == S_OK, "Lock returned %#lx\n", hr); + dump_buffer_data(buffer_desc, data, length, output); hr = IMFMediaBuffer_Unlock(buffer); ok(hr == S_OK, "Unlock returned %#lx\n", hr); } @@ -1231,8 +1255,13 @@ static void dump_mf_sample(IMFSample *sample, const struct sample_desc *sample_d enum_mf_media_buffers(sample, sample_desc, dump_mf_media_buffer, output); }
+static void dump_mf_sample_2d(IMFSample *sample, const struct sample_desc *sample_desc, HANDLE output) +{ + enum_mf_media_buffers(sample, sample_desc, dump_mf_2d_buffer, output); +} + static void dump_mf_sample_collection(IMFCollection *samples, const struct sample_desc *collection_desc, - const WCHAR *output_filename) + const WCHAR *output_filename, BOOL use_2d_buffer) { WCHAR path[MAX_PATH]; HANDLE output; @@ -1243,12 +1272,47 @@ static void dump_mf_sample_collection(IMFCollection *samples, const struct sampl output = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); ok(output != INVALID_HANDLE_VALUE, "CreateFileW failed, error %lu\n", GetLastError());
- enum_mf_samples(samples, collection_desc, dump_mf_sample, output); + enum_mf_samples(samples, collection_desc, use_2d_buffer ? dump_mf_sample_2d : dump_mf_sample, output);
trace("created %s\n", debugstr_w(path)); CloseHandle(output); }
+#define check_mf_2d_buffer(a, b, c) check_mf_2d_buffer_(__FILE__, __LINE__, a, b, c) +static DWORD check_mf_2d_buffer_(const char *file, int line, IMF2DBuffer2 *buffer, const struct buffer_desc *expect, + const BYTE **expect_data, DWORD *expect_data_len) +{ + DWORD length, diff = 0, expect_length = expect->length; + BYTE *scanline; + LONG stride; + HRESULT hr; + BYTE *data; + + hr = IMF2DBuffer2_Lock2DSize(buffer, MF2DBuffer_LockFlags_Read, &scanline, &stride, &data, &length); + ok_(file, line)(hr == S_OK, "Lock2DSize returned %#lx\n", hr); + todo_wine_if(expect->todo_length) + ok_(file, line)(length == expect_length, "got length %ld, expected %ld\n", length, expect_length); + + if (*expect_data) + { + if (*expect_data_len < length) + todo_wine_if(expect->todo_length) + ok_(file, line)(0, "missing %#lx bytes\n", length - *expect_data_len); + else if (!expect->compare) + diff = compare_bytes(data, &length, NULL, NULL, *expect_data); + else + diff = expect->compare(data, &length, &expect->size, &expect->compare_rect, *expect_data); + } + + hr = IMF2DBuffer2_Unlock2D(buffer); + ok_(file, line)(hr == S_OK, "Unlock2D returned %#lx\n", hr); + + *expect_data = *expect_data + min(length, *expect_data_len); + *expect_data_len = *expect_data_len - min(length, *expect_data_len); + + return diff; +} + #define check_mf_media_buffer(a, b, c) check_mf_media_buffer_(__FILE__, __LINE__, a, b, c) static DWORD check_mf_media_buffer_(const char *file, int line, IMFMediaBuffer *buffer, const struct buffer_desc *expect, const BYTE **expect_data, DWORD *expect_data_len) @@ -1267,7 +1331,7 @@ static DWORD check_mf_media_buffer_(const char *file, int line, IMFMediaBuffer * hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length); ok_(file, line)(hr == S_OK, "Lock returned %#lx\n", hr); todo_wine_if(expect->todo_length) - ok_(file, line)(length == expect_length, "got length %#lx\n", length); + ok_(file, line)(length == expect_length, "got length %ld, expected %ld\n", length, expect_length);
if (*expect_data) { @@ -1368,17 +1432,58 @@ static void check_mf_sample_collection_enum(IMFSample *sample, const struct samp ctx->diff += check_mf_sample_(ctx->file, ctx->line, sample, expect, &ctx->data, &ctx->data_len); }
+static void check_mf_sample_2d_buffer(IMFMediaBuffer *buffer, const struct buffer_desc *expect, void *context) +{ + struct check_mf_sample_context *ctx = context; + IMF2DBuffer2 *buffer2d; + HRESULT hr; + + hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer2, (void **)&buffer2d); + ok(hr == S_OK, "QueryInterface IMF2DBuffer2 returned %#lx\n", hr); + ctx->diff += check_mf_2d_buffer_(ctx->file, ctx->line, buffer2d, expect, &ctx->data, &ctx->data_len); + IMF2DBuffer2_Release(buffer2d); +} + +#define check_mf_sample_2d(a, b, c, d) check_mf_sample_2d_(__FILE__, __LINE__, a, b, c, d) +static DWORD check_mf_sample_2d_(const char *file, int line, IMFSample *sample, const struct sample_desc *expect, + const BYTE **expect_data, DWORD *expect_data_len) +{ + struct check_mf_sample_context ctx = {.data = *expect_data, .data_len = *expect_data_len, .file = file, .line = line}; + DWORD buffer_count; + HRESULT hr; + + buffer_count = 0xdeadbeef; + hr = IMFSample_GetBufferCount(sample, &buffer_count); + ok_(file, line)(hr == S_OK, "GetBufferCount returned %#lx\n", hr); + ok_(file, line)(buffer_count == expect->buffer_count, + "got %lu buffers\n", buffer_count); + + enum_mf_media_buffers(sample, expect, check_mf_sample_2d_buffer, &ctx); + + *expect_data = ctx.data; + *expect_data_len = ctx.data_len; + + return ctx.diff / buffer_count; +} + +static void check_mf_sample_collection_2d_enum(IMFSample *sample, const struct sample_desc *expect, void *context) +{ + struct check_mf_sample_context *ctx = context; + ctx->diff += check_mf_sample_2d_(ctx->file, ctx->line, sample, expect, &ctx->data, &ctx->data_len); +} + +#define check_2d_mf_sample_collection(a, b, c) check_mf_sample_collection_(__FILE__, __LINE__, a, b, c, TRUE) DWORD check_mf_sample_collection_(const char *file, int line, IMFCollection *samples, - const struct sample_desc *expect_samples, const WCHAR *expect_data_filename) + const struct sample_desc *expect_samples, const WCHAR *expect_data_filename, BOOL use_2d_buffer) { struct check_mf_sample_context ctx = {.file = file, .line = line}; DWORD count; HRESULT hr;
if (expect_data_filename) load_resource(expect_data_filename, &ctx.data, &ctx.data_len); - enum_mf_samples(samples, expect_samples, check_mf_sample_collection_enum, &ctx); + enum_mf_samples(samples, expect_samples, use_2d_buffer ? check_mf_sample_collection_2d_enum : check_mf_sample_collection_enum, &ctx);
- if (expect_data_filename) dump_mf_sample_collection(samples, expect_samples, expect_data_filename); + if (expect_data_filename) dump_mf_sample_collection(samples, expect_samples, expect_data_filename, use_2d_buffer);
hr = IMFCollection_GetElementCount(samples, &count); ok_(file, line)(hr == S_OK, "GetElementCount returned %#lx\n", hr); @@ -7541,7 +7646,7 @@ static void test_video_processor(BOOL use_2d_buffer) };
static const MFVideoArea actual_aperture = {.Area={82,84}}; - static const DWORD actual_width = 96, actual_height = 96; + static const DWORD actual_width = 96, actual_height = 96, nv12_aligned_width = 128; const struct attribute_desc rgb32_with_aperture[] = { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video, .required = TRUE), @@ -7688,6 +7793,18 @@ static void test_video_processor(BOOL use_2d_buffer) .sample_time = 0, .sample_duration = 10000000, .buffer_count = 1, .buffers = &rgb32_crop_buffer_desc, }; + const struct buffer_desc rgb32_crop_buffer_2d_desc = + { + .length = actual_width * actual_aperture.Area.cy * 4, + .compare = compare_rgb32, .compare_rect = {.right = actual_aperture.Area.cx, .bottom = actual_aperture.Area.cy}, + .dump = dump_rgb32, .size = {.cx = actual_width, .cy = actual_aperture.Area.cy}, + }; + const struct sample_desc rgb32_crop_sample_2d_desc = + { + .attributes = output_sample_attributes, + .sample_time = 0, .sample_duration = 10000000, + .buffer_count = 1, .buffers = &rgb32_crop_buffer_2d_desc, + };
const struct buffer_desc rgb555_buffer_desc = { @@ -7714,6 +7831,18 @@ static void test_video_processor(BOOL use_2d_buffer) .sample_time = 0, .sample_duration = 10000000, .buffer_count = 1, .buffers = &nv12_buffer_desc, }; + const struct buffer_desc nv12_buffer_2d_desc = + { + .length = nv12_aligned_width * actual_height * 3 / 2, + .compare = compare_nv12, .compare_rect = {.top = 12, .right = 82, .bottom = 96}, + .dump = dump_nv12, .size = {.cx = nv12_aligned_width, .cy = actual_height}, + }; + const struct sample_desc nv12_sample_2d_desc = + { + .attributes = output_sample_attributes, + .sample_time = 0, .sample_duration = 10000000, + .buffer_count = 1, .buffers = &nv12_buffer_2d_desc, + };
const struct transform_desc { @@ -7723,9 +7852,13 @@ static void test_video_processor(BOOL use_2d_buffer) const struct attribute_desc *output_type_desc; const struct attribute_desc *output_buffer_desc; const struct sample_desc *output_sample_desc; + const struct sample_desc *output_sample_2d_desc; const WCHAR *output_bitmap; + const WCHAR *output_bitmap_1d; + const WCHAR *output_bitmap_2d; ULONG delta; BOOL broken; + BOOL todo; } video_processor_tests[] = { @@ -7734,7 +7867,7 @@ static void test_video_processor(BOOL use_2d_buffer) .input_buffer_desc = use_2d_buffer ? nv12_default_stride : NULL, .output_type_desc = rgb32_default_stride, .output_bitmap = L"rgb32frame-flip.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_negative_stride : NULL, - .output_sample_desc = &rgb32_sample_desc, + .output_sample_desc = &rgb32_sample_desc, .output_sample_2d_desc = &rgb32_sample_desc, .delta = 2, /* Windows returns 0, Wine needs 2 */ }, { /* Test 1 */ @@ -7742,7 +7875,7 @@ static void test_video_processor(BOOL use_2d_buffer) .input_buffer_desc = use_2d_buffer ? nv12_default_stride : NULL, .output_type_desc = rgb32_negative_stride, .output_bitmap = L"rgb32frame-flip.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_negative_stride : NULL, - .output_sample_desc = &rgb32_sample_desc, + .output_sample_desc = &rgb32_sample_desc, .output_sample_2d_desc = &rgb32_sample_desc, .delta = 2, /* Windows returns 0, Wine needs 2 */ }, { /* Test 2 */ @@ -7750,31 +7883,31 @@ static void test_video_processor(BOOL use_2d_buffer) .input_buffer_desc = use_2d_buffer ? nv12_default_stride : NULL, .output_type_desc = rgb32_positive_stride, .output_bitmap = L"rgb32frame.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_positive_stride : NULL, - .output_sample_desc = &rgb32_sample_desc, + .output_sample_desc = &rgb32_sample_desc, .output_sample_2d_desc = &rgb32_sample_desc, .delta = 6, }, { /* Test 3 */ .input_type_desc = rgb32_default_stride, .input_bitmap = L"rgb32frame.bmp", .input_buffer_desc = use_2d_buffer ? rgb32_negative_stride : NULL, - .output_type_desc = nv12_default_stride, .output_bitmap = L"nv12frame-flip.bmp", + .output_type_desc = nv12_default_stride, .output_bitmap = L"nv12frame-flip.bmp", .output_bitmap_2d = L"nv12frame-flip-2d.bmp", .output_buffer_desc = use_2d_buffer ? nv12_default_stride : NULL, - .output_sample_desc = &nv12_sample_desc, + .output_sample_desc = &nv12_sample_desc, .output_sample_2d_desc = &nv12_sample_2d_desc, .delta = 2, /* Windows returns 0, Wine needs 2 */ }, { /* Test 4 */ .input_type_desc = rgb32_negative_stride, .input_bitmap = L"rgb32frame.bmp", .input_buffer_desc = use_2d_buffer ? rgb32_negative_stride : NULL, - .output_type_desc = nv12_default_stride, .output_bitmap = L"nv12frame-flip.bmp", + .output_type_desc = nv12_default_stride, .output_bitmap = L"nv12frame-flip.bmp", .output_bitmap_2d = L"nv12frame-flip-2d.bmp", .output_buffer_desc = use_2d_buffer ? nv12_default_stride : NULL, - .output_sample_desc = &nv12_sample_desc, + .output_sample_desc = &nv12_sample_desc, .output_sample_2d_desc = &nv12_sample_2d_desc, .delta = 2, /* Windows returns 0, Wine needs 2 */ }, { /* Test 5 */ .input_type_desc = rgb32_positive_stride, .input_bitmap = L"rgb32frame.bmp", .input_buffer_desc = use_2d_buffer ? rgb32_positive_stride : NULL, - .output_type_desc = nv12_default_stride, .output_bitmap = L"nv12frame.bmp", + .output_type_desc = nv12_default_stride, .output_bitmap = L"nv12frame.bmp", .output_bitmap_2d = L"nv12frame-2d.bmp", .output_buffer_desc = use_2d_buffer ? nv12_default_stride : NULL, - .output_sample_desc = &nv12_sample_desc, + .output_sample_desc = &nv12_sample_desc, .output_sample_2d_desc = &nv12_sample_2d_desc, .delta = 2, /* Windows returns 1, Wine needs 2 */ }, { /* Test 6 */ @@ -7782,14 +7915,14 @@ static void test_video_processor(BOOL use_2d_buffer) .input_buffer_desc = use_2d_buffer ? rgb32_negative_stride : NULL, .output_type_desc = rgb32_negative_stride, .output_bitmap = L"rgb32frame.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_negative_stride : NULL, - .output_sample_desc = &rgb32_sample_desc, + .output_sample_desc = &rgb32_sample_desc, .output_sample_2d_desc = &rgb32_sample_desc, }, { /* Test 7 */ .input_type_desc = rgb32_negative_stride, .input_bitmap = L"rgb32frame.bmp", .input_buffer_desc = use_2d_buffer ? rgb32_negative_stride : NULL, .output_type_desc = rgb32_positive_stride, .output_bitmap = L"rgb32frame-flip.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_positive_stride : NULL, - .output_sample_desc = &rgb32_sample_desc, + .output_sample_desc = &rgb32_sample_desc, .output_sample_2d_desc = &rgb32_sample_desc, .delta = 3, /* Windows returns 3 */ }, { /* Test 8 */ @@ -7797,7 +7930,7 @@ static void test_video_processor(BOOL use_2d_buffer) .input_buffer_desc = use_2d_buffer ? rgb32_positive_stride : NULL, .output_type_desc = rgb32_negative_stride, .output_bitmap = L"rgb32frame-flip.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_negative_stride : NULL, - .output_sample_desc = &rgb32_sample_desc, + .output_sample_desc = &rgb32_sample_desc, .output_sample_2d_desc = &rgb32_sample_desc, .delta = 3, /* Windows returns 3 */ }, { /* Test 9 */ @@ -7805,14 +7938,14 @@ static void test_video_processor(BOOL use_2d_buffer) .input_buffer_desc = use_2d_buffer ? rgb32_positive_stride : NULL, .output_type_desc = rgb32_positive_stride, .output_bitmap = L"rgb32frame.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_positive_stride : NULL, - .output_sample_desc = &rgb32_sample_desc, + .output_sample_desc = &rgb32_sample_desc, .output_sample_2d_desc = &rgb32_sample_desc, }, { /* Test 10 */ .input_type_desc = rgb32_with_aperture, .input_bitmap = L"rgb32frame.bmp", .input_buffer_desc = use_2d_buffer ? rgb32_with_aperture : NULL, .output_type_desc = rgb32_with_aperture, .output_bitmap = L"rgb32frame.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_with_aperture : NULL, - .output_sample_desc = &rgb32_sample_desc, + .output_sample_desc = &rgb32_sample_desc, .output_sample_2d_desc = &rgb32_sample_desc, .broken = TRUE, /* old Windows version incorrectly rescale */ }, { /* Test 11 */ @@ -7820,7 +7953,7 @@ static void test_video_processor(BOOL use_2d_buffer) .input_buffer_desc = use_2d_buffer ? rgb32_negative_stride : NULL, .output_type_desc = rgb555_default_stride, .output_bitmap = L"rgb555frame.bmp", .output_buffer_desc = use_2d_buffer ? rgb555_negative_stride : NULL, - .output_sample_desc = &rgb555_sample_desc, + .output_sample_desc = &rgb555_sample_desc, .output_sample_2d_desc = &rgb555_sample_desc, .delta = 5, /* Windows returns 0, Wine needs 5 */ }, { /* Test 12 */ @@ -7828,7 +7961,7 @@ static void test_video_processor(BOOL use_2d_buffer) .input_buffer_desc = use_2d_buffer ? rgb32_negative_stride : NULL, .output_type_desc = rgb555_negative_stride, .output_bitmap = L"rgb555frame.bmp", .output_buffer_desc = use_2d_buffer ? rgb555_negative_stride : NULL, - .output_sample_desc = &rgb555_sample_desc, + .output_sample_desc = &rgb555_sample_desc, .output_sample_2d_desc = &rgb555_sample_desc, .delta = 5, /* Windows returns 0, Wine needs 5 */ }, { /* Test 13 */ @@ -7836,7 +7969,7 @@ static void test_video_processor(BOOL use_2d_buffer) .input_buffer_desc = use_2d_buffer ? rgb32_negative_stride : NULL, .output_type_desc = rgb555_positive_stride, .output_bitmap = L"rgb555frame-flip.bmp", .output_buffer_desc = use_2d_buffer ? rgb555_positive_stride : NULL, - .output_sample_desc = &rgb555_sample_desc, + .output_sample_desc = &rgb555_sample_desc, .output_sample_2d_desc = &rgb555_sample_desc, .delta = 3, /* Windows returns 0, Wine needs 3 */ }, { /* Test 14 */ @@ -7844,38 +7977,40 @@ static void test_video_processor(BOOL use_2d_buffer) .input_buffer_desc = use_2d_buffer ? rgb555_negative_stride : NULL, .output_type_desc = rgb555_positive_stride, .output_bitmap = L"rgb555frame-flip.bmp", .output_buffer_desc = use_2d_buffer ? rgb555_positive_stride : NULL, - .output_sample_desc = &rgb555_sample_desc, + .output_sample_desc = &rgb555_sample_desc, .output_sample_2d_desc = &rgb555_sample_desc, .delta = 4, /* Windows returns 0, Wine needs 4 */ }, { /* Test 15 */ .input_type_desc = nv12_with_aperture, .input_bitmap = L"nv12frame.bmp", .input_buffer_desc = use_2d_buffer ? nv12_with_aperture : NULL, - .output_type_desc = rgb32_no_aperture, .output_bitmap = L"rgb32frame-crop-flip.bmp", + .output_type_desc = rgb32_no_aperture, .output_bitmap = L"rgb32frame-crop-flip.bmp", .output_bitmap_2d = L"rgb32frame-crop-flip-2d.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_no_aperture_negative_stride : NULL, - .output_sample_desc = &rgb32_crop_sample_desc, - .delta = 2, /* Windows returns 0, Wine needs 2 */ + .output_sample_desc = &rgb32_crop_sample_desc, .output_sample_2d_desc = &rgb32_crop_sample_2d_desc, + .delta = 3, /* Windows returns 3 with 2D buffer */ }, { /* Test 16 */ .input_type_desc = rgb32_no_aperture, .input_bitmap = L"rgb32frame-crop-flip.bmp", .input_buffer_desc = use_2d_buffer ? rgb32_no_aperture : NULL, - .output_type_desc = rgb32_with_aperture, .output_bitmap = L"rgb32frame-flip.bmp", + .output_type_desc = rgb32_with_aperture, .output_bitmap = L"rgb32frame-flip.bmp", .output_bitmap_1d = L"rgb32frame-flip-2d.bmp", .output_bitmap_2d = L"rgb32frame-flip-2d.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_with_aperture : NULL, - .output_sample_desc = &rgb32_sample_desc, + .output_sample_desc = &rgb32_sample_desc, .output_sample_2d_desc = &rgb32_sample_desc, .broken = TRUE, /* old Windows version incorrectly rescale */ + .todo = use_2d_buffer, }, { /* Test 17 */ .input_type_desc = rgb32_with_aperture, .input_bitmap = L"rgb32frame-flip.bmp", .input_buffer_desc = use_2d_buffer ? rgb32_with_aperture_negative_stride : NULL, - .output_type_desc = rgb32_no_aperture, .output_bitmap = L"rgb32frame-crop-flip.bmp", + .output_type_desc = rgb32_no_aperture, .output_bitmap = L"rgb32frame-crop-flip.bmp", .output_bitmap_2d = L"rgb32frame-crop-flip-2d.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_no_aperture_negative_stride : NULL, - .output_sample_desc = &rgb32_crop_sample_desc, + .output_sample_desc = &rgb32_crop_sample_desc, .output_sample_2d_desc = &rgb32_crop_sample_2d_desc, + .delta = 3, /* Windows returns 3 with 2D buffer */ }, { /* Test 18 */ .input_type_desc = rgb32_with_aperture_positive_stride, .input_bitmap = L"rgb32frame.bmp", .input_buffer_desc = use_2d_buffer ? rgb32_with_aperture_positive_stride : NULL, - .output_type_desc = rgb32_no_aperture, .output_bitmap = L"rgb32frame-crop-flip.bmp", + .output_type_desc = rgb32_no_aperture, .output_bitmap = L"rgb32frame-crop-flip.bmp", .output_bitmap_2d = L"rgb32frame-crop-flip-2d.bmp", .output_buffer_desc = use_2d_buffer ? rgb32_no_aperture_negative_stride : NULL, - .output_sample_desc = &rgb32_crop_sample_desc, + .output_sample_desc = &rgb32_crop_sample_desc, .output_sample_2d_desc = &rgb32_crop_sample_2d_desc, .delta = 3, /* Windows returns 3 */ }, }; @@ -7887,6 +8022,7 @@ static void test_video_processor(BOOL use_2d_buffer) IMFSample *input_sample, *output_sample; IMFMediaType *media_type, *media_type2; IMFCollection *output_samples; + const WCHAR *output_bitmap; IMFTransform *transform; IMFMediaBuffer *buffer; const BYTE *input_data; @@ -8313,8 +8449,19 @@ static void test_video_processor(BOOL use_2d_buffer) ref = IMFSample_Release(output_sample); ok(ref == 1, "Release returned %ld\n", ref);
- ret = check_mf_sample_collection(output_samples, test->output_sample_desc, test->output_bitmap); - ok(ret <= test->delta || broken(test->broken), "got %lu%% diff\n", ret); + output_bitmap = use_2d_buffer && test->output_bitmap_1d ? test->output_bitmap_1d : test->output_bitmap; + ret = check_mf_sample_collection(output_samples, test->output_sample_desc, output_bitmap); + todo_wine_if(test->todo) + ok(ret <= test->delta || broken(test->broken), "1d got %lu%% diff\n", ret); + + if (use_2d_buffer) + { + output_bitmap = test->output_bitmap_2d ? test->output_bitmap_2d : test->output_bitmap; + ret = check_2d_mf_sample_collection(output_samples, test->output_sample_2d_desc, output_bitmap); + todo_wine_if(test->todo) + ok(ret <= test->delta || broken(test->broken), "2d got %lu%% diff\n", ret); + } + IMFCollection_Release(output_samples);
output_sample = create_sample_(NULL, output_info.cbSize, test->output_buffer_desc);