From: Brendan McGrath bmcgrath@codeweavers.com
--- dlls/mf/tests/mf_test.h | 7 +- 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 | 28 ++++ dlls/mf/tests/rgb32frame-2d.bmp | Bin 0 -> 36918 bytes 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/rgb555frame-2d.bmp | Bin 0 -> 18486 bytes dlls/mf/tests/rgb555frame-flip-2d.bmp | Bin 0 -> 18486 bytes dlls/mf/tests/transform.c | 159 +++++++++++++++++----- 10 files changed, 161 insertions(+), 33 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-2d.bmp create mode 100644 dlls/mf/tests/rgb32frame-crop-flip-2d.bmp create mode 100644 dlls/mf/tests/rgb32frame-flip-2d.bmp create mode 100644 dlls/mf/tests/rgb555frame-2d.bmp create mode 100644 dlls/mf/tests/rgb555frame-flip-2d.bmp
diff --git a/dlls/mf/tests/mf_test.h b/dlls/mf/tests/mf_test.h index 9fa5d4fef41..c1d826456c3 100644 --- a/dlls/mf/tests/mf_test.h +++ b/dlls/mf/tests/mf_test.h @@ -99,6 +99,9 @@ struct buffer_desc RECT compare_rect; dump_cb dump; SIZE size; + DWORD length_2d; + SIZE size_2d; + LONG abs_stride; /* absolute value of stride */ };
struct sample_desc @@ -114,6 +117,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..1071645273671208046c480df42e9a49cd289ceb GIT binary patch literal 67638 zcmeI0F>6#o6ovI4B%P(EG7v!o7i{e<7QrHwT`)x&!PZw;iGd{e11wBrO|f>icCy7I zkUk*Vgf#mT#u=;onm5e72j<=J+~F=PI(y!n@627-r_W|TZvCrSe7zsLi~Tb8?OS)_ zYpfstUI#BXT^HDP56(}QLDPNThnh|HcJ|3b4g0jGCi|pK{^ZXL*fYTUZ}-r14#}VV zH5uUde;c{cuupr)pZsfP!1H(Rl%AdUzm0pW&6HREfA-!5w%r4-{I4T_w%r4-{4aM7 z1KaKa`P)78oI|(#H;=<5+w1}P|KB+xfAZI4pyvPmByG-qOl~#o(;o82_+LB6<lhEI zZH~yF{52Wi{BI*S8un>VZT_n#Zvxxyfmi+)kw4q+fmi-tyN7{o_kjHE9(vB9SN@B$ zjli~hK>l_QJ?D`8$zPL!+Q0ui-?=G0yM}$*L;h{d4f1b;qjsi{Kly7i!1>=sZZz!E zp4$9Bf4CFab`QMr{}TDL?H+jLe=@%p*me)R^8Xn5v+W*u<$pBW3T(Rv<Zt)Ta}LR$ z{52V<{rk`Jotx6LYuKkf<ln~JApbTvYG(@hlfNbdod0d)M#DbsA%F6(nE~zh9rq1$ z>-GNcudV{y?g9DRJ@lMI@+W^y25NryCvDGnZc5LtVW0Mpe;ady{M+EDohjr`{+bMM z{<o1E4g0i*{K>y&2DIOI+&9dv*ZaS>{1w=C54`e!75TI69(d*d{PlHU+dc5g|3&1_ zwtL`}|9p2H*me)d-|nI39FjlzYcf#tw|~<1eCMY0>>BoI5Baw-H^{#Yj@p?*{^YO8 z0Ox-jxzVssd#dw)dlBYrvj^n=f9J?6|DB)j1KaL_SN@M8f41ENul%>y2Z3$(fc)(q zdd?yFlfNbdwSWJ4zH?K0b`ATqhy2@^8|2>xN9{}@fAZI4fb+kN+-TURJ+=8i{@n$( z-2<=uA4L9ay9ZwRfBUouY`X_u`G1f6*>(@S^4C5$_bmg$gWCW8L!5!1q0a*O>%D6s zcjQn0H8aq{9rApJn(ULdXYX2gcJk-^ubF`s?vUp*)MU^3Uw`(He|-iu=SOY+H}E<i zR6O5k!R2oT^5>)C@eiqwc7Xm%2bjNc2hi!eDZKxG;3eswXXno~yvp=1;YEGvz<B!m z9&Z1oRL|#+`e+B}zjR>g`Cq|Ho<4v7F5p$B{}o=o^cV0dJ3m~0L4D~!ZvN1Jv;)%p z{QN_!FADSj8D3@Q{{pWv{S$bV>3@V*nf?*Hs4pGJ&0o0vM^ZgMf2fakfc{Gdrk?+O zc*)b}?;l)#pZd~)T>j`k+5zc4^FQ_c?ZK;z|0{Tv=|6{8nf?oSmFdsnMSbZ&?*7B= zpG)=p{G~qH0s1c;n0o$q;3ZF=zkiS5Ri?iUFX~GNa`}hbzb)1C`J+DC0bl+<hF977 zAHb_j{~Nr@^uNQaOn>;d@$Yi;53e}<MCy+_Fmwz5Zd|?Z@ruJwr2e=AL$~nn#?|Zd z@8EU1lq+|BxO^woPnXmmcc8Zad+*SzjQ`FddX?#K9-|lar32&X?|ZcSo5xZ;KYyOQ zL9a6X?jd@W>7Q+&7xkqBx%{KuKiiP%`TT#lgI;C&^Lyx3ra#+4FX~GNa`{KQKiiV( z`TW<`UtOVB+4<4xt1IeD2XgtZ?f>!@ddbu0@89cd^eWTeU85KEr31PAqut+KOZ9yI z-d><rnf}lB=vAh_K0q((O9yiKN4vj1km~vT|L)MMO#jmYy~^~5e;fZU#~-ga{6y-H OJ1}$$|888p@BadFYmY+!
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..0903cb23a40290d682fc4c6819ce8d4c534008b0 GIT binary patch literal 67638 zcmeH~F>6#o6ovI4B%P(EG7v!o7i{e<7QrHwT`)x&A+4{l5(7!_2UwWMCdJyNO($C{ zf%E|}O-QppVVtqL+w3s+o@L&hJ$JaT3B!4FzB708UcVV!KKNgQ_<S0>i~T<K!v~M! zGuGw*=iKA`WE|M_JeW?Wp=OhPJ@(1_n(UJ{`IA30P%i_#|Mk4@L+;6+{A*^Q4|iad z-=QY^q`k`C_u=g1&-q_71AVvytNac%*(dFb?;|$A18s(D^Zymk&bE8tmH)H9U0~Zi z@XG&X<j=Ny;FbU8Y%j3w9+1D?L(e%RfAZI4p!Wa&p6^_r-d)2!?IHg*<_7t<!BIO? z$e;W*8Q}bHBR3lMX-{qbFMfXsY`X_u`EN!3Y`X_u`42x`1-9J-^0#~FIfrifZ_mPz zZT5itS35`KPyU(=)c*eC?8oF*!#?dHe~kaNb4>niaMb3A{K;RF0nYz6a-(6N_SEM8 z?&Dox+dc5g|83;YwtL`}|A+CPz_xqfmH$rU&$fHumH+PKCa~=ukiXqS&p9N2^4Dab z_V=IXJJ+Xo*RW4}$iI!bLH=!U)Xo(0Cx1-_IRD$ojfQ>NL;mDnGXvV+JMNp$t=Id1 zIM@hmy9eZN_t0|=$)Ef+8L0W&pR_&SxjwzShJD&Y{%y<+@^6EqcBYU&`D-%3`QJuv zH0;wJ@+beA8PNXTao>Dyz25(C!zY1l_rNRv<H(<F_rNRvpI;vZw%r4-{C`CLY`X_u z`HxQ50^9BZ`P)78oI~;_e@zBze)}hF&v&j*@2+8=_K<%YbA$Zb;HaG`<WK&Z3~>Ip zksA&Bw5K-zv+j9d+dUwEyN8~0=#~G~tNp;Xd*GG-B=Tq5J@Cr^di^M{?H-W7-9yhg zB!BYPWT5u<pXWQ*r+3$|PkYF}jk!VoZE)1i6!Is3O$Ips+sKWEecDr<|JFgcW}7`A z|JBZsSN?Z9p99<Ofmi;wkw4q+fmi<bT^HDP56Iu{q30ZuKly7iQ2YDO^PTI{yKC5| zJ>=iU+#vrpIBI7K`IEmU1DyYD<VM3j?IC~iubBbu?;ZEe=ho}}KVNdiY%i=O%bzb4 zkAI~8avh-miyc_5`{&I6V*95T@R}!@k)Qs8SDF4Zc$MkDgjbpVCcLOG9mwS$ZvUoK z&(A;VqaE<&{|k7Poqr2nW%@&SQC~Wcn}2Zohf+O1|EQ04fc{Gd`kw!H@RFy`-@mu; zD%1Y}uQL4|c$Mkz!i)OSf!zIv+rKN-^Y@SXXb0%ObfE9~KZKV&eg6Kz<qxSZ9mwU6 z{-Yg`?lb>=&)+wAmGM7@SDF4#c$Mk@fLEFR2wv2e4&?4X-2RbN&(B}#qaE<&{~5f> z&JUMAE7QM%SDF3<US;~%@S?tSAUFTv_Fqf&{QRdr+5!469q4=h@8Bg*pTB>%@G8^4 zhZpsw1G)Ue?Z21m`TS8I?Ew9k4)i_$C*$R=-1(QQeln*1Vh3vb|9ymB^Cwz-`sws< zhhAm+vpw{pzH}hRAMO5ZPpaqV&+jkjRi^*x3cbqow`b@@ed$0h|7iEOXHq?%|BrX* zRi;1wgI;C&lN<D+zH}g$f3*9P8>ybpe{KE226~m9AFV#vpuTh<m;c)S51*iyJbnKD zeSL&pW%{RU=tX_$Kra7i_fOZPdOm;MbMz|Hf3=TZW%}z!=tX_$Kra7i_t%f4dOrVK f2k2F%zw;Tr%Je&UQC~Wc%Rk)yPO9hgUt9klBV><5
literal 0 HcmV?d00001
diff --git a/dlls/mf/tests/resource.rc b/dlls/mf/tests/resource.rc index 6c9a6601c24..e17694be8a4 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 @@ -101,10 +109,18 @@ i420frame.bmp RCDATA i420frame.bmp /* @makedep: rgb32frame.bmp */ rgb32frame.bmp RCDATA rgb32frame.bmp
+/* Generated from running the tests on Windows */ +/* @makedep: rgb32frame-2d.bmp */ +rgb32frame-2d.bmp RCDATA rgb32frame-2d.bmp + /* Generated from running the tests on Windows */ /* @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 +129,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 @@ -125,10 +145,18 @@ rgb32frame-grabber.bmp RCDATA rgb32frame-grabber.bmp /* @makedep: rgb555frame.bmp */ rgb555frame.bmp RCDATA rgb555frame.bmp
+/* Generated from running the tests on Windows */ +/* @makedep: rgb555frame-2d.bmp */ +rgb555frame-2d.bmp RCDATA rgb555frame-2d.bmp + /* Generated from running the tests on Windows */ /* @makedep: rgb555frame-flip.bmp */ rgb555frame-flip.bmp RCDATA rgb555frame-flip.bmp
+/* Generated from running the tests on Windows */ +/* @makedep: rgb555frame-flip-2d.bmp */ +rgb555frame-flip-2d.bmp RCDATA rgb555frame-flip-2d.bmp + /* Generated from running the tests on Windows */ /* @makedep: iv50frame.bin */ iv50frame.bin RCDATA iv50frame.bin diff --git a/dlls/mf/tests/rgb32frame-2d.bmp b/dlls/mf/tests/rgb32frame-2d.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9f2ea1e5d1b2b808f3671b09c19ed6fcd090de85 GIT binary patch literal 36918 zcmeI*u}Yg^9EI^Cp-Y{_DXoJ;g<gTswR>Gccke(i!PP-=^b)K~Zl@ik*$ag_DEVIB zs5js_AC!Oc1db^3!j~V9MuH??za3ub`F7Ype(pPd-In(IXZ`m2{g*FZJ`TemmK(IQ zCTG~^_A5ijesu<a{MVrY`X8rbw*~z1ciUNqbM#OD>(H@#ALzek|36w2%MINA@47$B z4P5_^j}KzGf$Kl}_g5@8aQ)SmVz~kSxna^F{`e>TR6k4q^k2Q<<ofBK{*!*HpLP2` zZF8~Q!1X_93$fh5_5bxa70V4=|I0r|V!46q-=BUK8^OT*|2OPMuwONd|Ns3t#vlJp zek`GX`ltW5KMrrQ*_ij;{QYy=w#9M-_wUc&Z6cN%xc+<nX>*nvxc=YoC6*hw{_2lG zEH}VEH%vOjAOEDE>SyVn{;M~fTtEHOf6`C&v-D5@)f-N(-|c^?K`b}GKQ~M|#2^2p zpXz7npZ=>ioLoQs(|^)W^|SO(|J55#uHWtd=6w^(4P5`bNq_Ad78|(!AM_xW8@T>6 z_1C^(v4QKa{_H2q4e-wmlMeC6Kk29XS^B5{>J2B?Pyh6v^i%z;+yBYVTr4+m{Xe~1 zh~);Z|4&WDas$`@LPuh`f$KkPNh~+OKQ~M|#2^2ppXz7npZ=>ioLoQs(|^)W^|NmO z3w;sG4P5_w?TY0Fu75l4?_17tgEQ~_-`jOR$8rPLpL1`2%|gsDqX8PA0UDqI8lV9h MpaB}7fpQHz0TpqG-v9sr
literal 0 HcmV?d00001
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..a1b600c1deaa613ba47afe3c373b1d38c5086192 GIT binary patch literal 32310 zcmeI4JxT*n6h^-gY_t+9e+ml)R}iqZ*GBE#fv&(E=sMIUD@m_qFufp{LdiTIjvJW! z4TQ^_fin=o4KIiDrg(&$oloxdcTMX3q;gZas*H44@AdkBzkSi(m)a5d4rak?p;LkH zAgF)Vj3n?K;NN%XbclcaJN;yzrGNU*-mtTN`lo-VpX{^I{vUK9@Et_`ziL<DJBa!} z+E@sD2T}jG+f#w>AnIRQ)q_xQ9pHbx4dEaE?jFuOPyh6vxnFnf^iTh8Lz(BJ{a@-+ z;5&%=-_y6icM$bI9~Xh|AnN~Vvj}_#QU5D7_4Ef^2l!uaL-@zPyN5H+(?9)Z?$=#A z{nNkOQ0961r~l0Tx@(X2uTp>h0Ja1CueT%o<A2D{G5V)}`tQCAhU~1*@7~>fJJIJF zhWuIh=lM_n-FLzDQUc#Wck}JULH*et_zt4}-^*CwJBa#!DO&>HLDYY#XP@9Zz`yU% z=@9?;clyabOaJtry<unl^iTgzKiOxa{Xc$O2z&=o|8GCL0^dQ@|8ZFed<RkgcV#N@ z9Yp=B)B|X+9pHbx9pNAULw=6YKmF5x_gye#XMKM6?&jNxKG!hh&x-oL{Hp(b1Ga;x z|NWnDf$t#de_juM!FLe#|6Kip?;z^GX&Qm=0RO&2r$hYX-{~j&EdA4e_J*DH(?9(? R{bZk|fBMhfu(SSX|G$y_inRa$
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..cd9fb4fdd5c2ea8d4a359bd130767527de0a2241 GIT binary patch literal 36918 zcmeI&(M`iJ6o%1s6CRnM1MtocjKpHB)Zma#@Y~XDE+>*J5W2Yja#U4SKR)l@+uwB` zkMCoBJ=bk}8$XTf`S<ge^YO=}fC36Apnw7jD4>7>3Mim}0tzV5y1>3|yEWe+MWX$D z`=g=$YdWSL_18bO(_xN({yR8M&%i(bshtjU{PW+zae4;+ujzl=9^;l<d4u!gv($gS zuX}d3)4$e`{`&vt*CPJ;=imFEDg$1By#7?#dxd@Z=l>NPRy~I~|Bvypl{McWegC8V zeEXxJ{%bm>9`)BhwbNmafBri-PS3zU|EZl0bNut)!Et&9{;%o(wr{&N-yrp`{e1hQ zq5f++rXKazKef|gj(`3;I8M*NKmVzn4s-nT-@$Qu2L7+<e|&prx8@t9{<WWPe>Bv8 zO~=%u{`#kOI?VCUe+S3u8TjWvwbNmafBri-PS3#qHT~B<>r~t8&87bJUvn?@U(+%5 zsK5THoep#S^WVX7dItXaPwjM=<DdTyj?**ne@*}6%RjCK1ycVDw)QVZ0sU(k=&yfm gf!f{q*T1$v?e6^RUt6GdcmDOSEl|5V|JUsQ3leSRC;$Ke
literal 0 HcmV?d00001
diff --git a/dlls/mf/tests/rgb555frame-2d.bmp b/dlls/mf/tests/rgb555frame-2d.bmp new file mode 100644 index 0000000000000000000000000000000000000000..8e3102e19fe161ad83f5a0d73192a766691e371c GIT binary patch literal 18486 zcmeI2v1-CV9EVe`P$>m<t~85KU%;$_lZ#uStB+9VQs|L;CSM~@5zx6?CWRQ()!*{x zdcVjo9|_8F=Ht7QAh=u?tL%If-F4QTo9p?Ijk;IeaUH+Bxm?@8PhQ@J-@XmE?ekLp z@e8Pb{Kn`G>W}KgA5;JMjnN%Y|0eK*{EvYj<i892Aph!@ALL&Le&nBajnrTLEd{iH zEcNVjQUAYBevtqEn;+zV81jSsx9|KQ|JLy%|FmnQ{_1Zjp#5X1XP=AuH&6T^|D)pv z`R^P*$iH&@AphF&BmcB(r2gt}DWLshsb`<7{`Q8JPeA>1-vhw^e|li=)j#nnY5%1C zmaD(|TMFFq{+WAz(DQ5J`9c29^Mm}KfA~TEnde9TY1c^o)!$M;`^QqxJ{R?0fAE9+ zAHVoP{;x0mAph}{ALO5BJpldwl7IXH>L0%`x`X<oI`PNuxc{UF2YP<J4fsL+i;^GY WA4-0Zzs6KR1yn!<R6qs(zrYDi>aF(x
literal 0 HcmV?d00001
diff --git a/dlls/mf/tests/rgb555frame-flip-2d.bmp b/dlls/mf/tests/rgb555frame-flip-2d.bmp new file mode 100644 index 0000000000000000000000000000000000000000..e3a641a9a04d3e09b8ad12c3f437cece1dab2f30 GIT binary patch literal 18486 zcmeH_u}Z^G7)B#kP()B?i&+GH0lNxLF5LuIA3<;t4CyoZ8il??q0Vkj3L0$ZZ}|xK z6VE*)w1hu7oO^F()7$2EO^5sCa6N3Vo#uG>HLUIP&7aM^?ekfRm2cnnLVt<>_yy=c zeq;3o`l~wQKcoNnjnx-a|9PK}^1tr$QT}K9`6&O%A6Ux2ZSujt?jF&f{!RhTk5kW| zRsB!S^HKh%hxsV~-N$^C|LiUw<==Gq;9qx-=udyA0O!Z4=g+GC2haH^|I+27{3l&L z%Kxg%NBOs1KKR$&Bl^?dDZu%0>iM(u_ZvEIQ2kdWAN=d?5&h}!6yW?g_54}-`wg8p zsQ!zRkMduae3buJ$w&Er?B%2Uze_&&*WDxf)88q;`Ely`v#S5=MLx>^^C%zX|MrxR z@_)b2NBOVj`QTr7kLXW-rvT^2sprqC{)?A<l>d63kMidk1t>rP3Q&Lo6!>oiegF~` BPFnx~
literal 0 HcmV?d00001
diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index f246919f125..ebad1c10ca6 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -1206,46 +1206,80 @@ 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) +struct dump_mf_sample_context { + HANDLE output; + BOOL use_2d_buffer; +}; + +static void dump_mf_media_buffer(IMFMediaBuffer *buffer, const struct buffer_desc *buffer_desc, void *context) +{ + struct dump_mf_sample_context *ctx = context; + IMF2DBuffer2 *buffer2d2; + SIZE size; 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); + if (ctx->use_2d_buffer) + { + LONG stride; + BYTE *scanline; + + hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer2, (void**)&buffer2d2); + ok(hr == S_OK, "QueryInterface IMF2DBuffer2 returned %#lx\n", hr); + hr = IMF2DBuffer2_Lock2DSize(buffer2d2, MF2DBuffer_LockFlags_Read, &scanline, &stride, &data, &length); + ok(hr == S_OK, "Lock2DSize returned %#lx\n", hr); + size = buffer_desc->size_2d; + } + else + { + hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length); + ok(hr == S_OK, "Lock returned %#lx\n", hr); + size = buffer_desc->size; + }
if (buffer_desc->dump) - buffer_desc->dump(data, length, &buffer_desc->size, output); + buffer_desc->dump(data, length, &size, ctx->output); else { if (buffer_desc->length == -1) { - ret = WriteFile(output, &length, sizeof(length), &written, NULL); + ret = WriteFile(ctx->output, &length, sizeof(length), &written, NULL); ok(ret, "WriteFile failed, error %lu\n", GetLastError()); ok(written == sizeof(length), "written %lu bytes\n", written); }
- ret = WriteFile(output, data, length, &written, NULL); + ret = WriteFile(ctx->output, data, length, &written, NULL); ok(ret, "WriteFile failed, error %lu\n", GetLastError()); ok(written == length, "written %lu bytes\n", written); }
- hr = IMFMediaBuffer_Unlock(buffer); - ok(hr == S_OK, "Unlock returned %#lx\n", hr); + if (ctx->use_2d_buffer) + { + hr = IMF2DBuffer2_Unlock2D(buffer2d2); + ok(hr == S_OK, "Unlock2D returned %#lx\n", hr); + IMF2DBuffer2_Release(buffer2d2); + } + else + { + hr = IMFMediaBuffer_Unlock(buffer); + ok(hr == S_OK, "Unlock returned %#lx\n", hr); + } }
-static void dump_mf_sample(IMFSample *sample, const struct sample_desc *sample_desc, HANDLE output) +static void dump_mf_sample(IMFSample *sample, const struct sample_desc *sample_desc, void *context) { - enum_mf_media_buffers(sample, sample_desc, dump_mf_media_buffer, output); + enum_mf_media_buffers(sample, sample_desc, dump_mf_media_buffer, context); }
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; + struct dump_mf_sample_context context = { .use_2d_buffer = use_2d_buffer };
GetTempPathW(ARRAY_SIZE(path), path); lstrcatW(path, output_filename); @@ -1253,17 +1287,19 @@ 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); + context.output = output; + enum_mf_samples(samples, collection_desc, dump_mf_sample, &context);
trace("created %s\n", debugstr_w(path)); CloseHandle(output); }
-#define check_mf_media_buffer(a, b, c) check_mf_media_buffer_(__FILE__, __LINE__, a, b, c) +#define check_mf_media_buffer(a, b, c) check_mf_media_buffer_(__FILE__, __LINE__, a, b, c, FALSE) 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) + const BYTE **expect_data, DWORD *expect_data_len, BOOL use_2d_buffer) { - DWORD length, diff = 0, expect_length = expect->length; + IMF2DBuffer2 *buffer2d2; + DWORD length, diff = 0, expect_length = use_2d_buffer ? expect->length_2d : expect->length; HRESULT hr; BYTE *data;
@@ -1274,10 +1310,23 @@ static DWORD check_mf_media_buffer_(const char *file, int line, IMFMediaBuffer * *expect_data_len = *expect_data_len - sizeof(DWORD); }
- hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length); - ok_(file, line)(hr == S_OK, "Lock returned %#lx\n", hr); + if (use_2d_buffer) + { + BYTE *scanline; + LONG stride; + hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer2, (void**)&buffer2d2); + ok_(file, line)(hr == S_OK, "QueryInterface IMF2DBuffer2 returned %#lx\n", hr); + hr = IMF2DBuffer2_Lock2DSize(buffer2d2, MF2DBuffer_LockFlags_Read, &scanline, &stride, &data, &length); + ok_(file, line)(hr == S_OK, "Lock2DSize returned %#lx\n", hr); + ok(abs(stride) == expect->abs_stride, "got abs stride of %d, expected %ld\n", abs(stride), expect->abs_stride); + } + else + { + 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) { @@ -1290,8 +1339,17 @@ static DWORD check_mf_media_buffer_(const char *file, int line, IMFMediaBuffer * diff = expect->compare(data, &length, &expect->size, &expect->compare_rect, *expect_data); }
- hr = IMFMediaBuffer_Unlock(buffer); - ok_(file, line)(hr == S_OK, "Unlock returned %#lx\n", hr); + if (use_2d_buffer) + { + hr = IMF2DBuffer2_Unlock2D(buffer2d2); + ok_(file, line)(hr == S_OK, "Unlock2D returned %#lx\n", hr); + IMF2DBuffer2_Release(buffer2d2); + } + else + { + hr = IMFMediaBuffer_Unlock(buffer); + ok_(file, line)(hr == S_OK, "Unlock returned %#lx\n", hr); + }
*expect_data = *expect_data + min(length, *expect_data_len); *expect_data_len = *expect_data_len - min(length, *expect_data_len); @@ -1305,6 +1363,7 @@ struct check_mf_sample_context const BYTE *data; DWORD data_len; DWORD diff; + BOOL use_2d_buffer; const char *file; int line; }; @@ -1313,15 +1372,15 @@ static void check_mf_sample_buffer(IMFMediaBuffer *buffer, const struct buffer_d { struct check_mf_sample_context *ctx = context; DWORD expect_length = expect->length == -1 ? *(DWORD *)ctx->data : expect->length; - ctx->diff += check_mf_media_buffer_(ctx->file, ctx->line, buffer, expect, &ctx->data, &ctx->data_len); + ctx->diff += check_mf_media_buffer_(ctx->file, ctx->line, buffer, expect, &ctx->data, &ctx->data_len, ctx->use_2d_buffer); ctx->total_length += expect_length; }
-#define check_mf_sample(a, b, c, d) check_mf_sample_(__FILE__, __LINE__, a, b, c, d) +#define check_mf_sample(a, b, c, d) check_mf_sample_(__FILE__, __LINE__, a, b, c, d, FALSE) static DWORD check_mf_sample_(const char *file, int line, IMFSample *sample, const struct sample_desc *expect, - const BYTE **expect_data, DWORD *expect_data_len) + const BYTE **expect_data, DWORD *expect_data_len, BOOL use_2d_buffer) { - struct check_mf_sample_context ctx = {.data = *expect_data, .data_len = *expect_data_len, .file = file, .line = line}; + struct check_mf_sample_context ctx = {.data = *expect_data, .data_len = *expect_data_len, .use_2d_buffer = use_2d_buffer, .file = file, .line = line}; DWORD buffer_count, total_length, sample_flags; LONGLONG timestamp; HRESULT hr; @@ -1375,20 +1434,22 @@ static DWORD check_mf_sample_(const char *file, int line, IMFSample *sample, con static void check_mf_sample_collection_enum(IMFSample *sample, const struct sample_desc *expect, void *context) { struct check_mf_sample_context *ctx = context; - ctx->diff += check_mf_sample_(ctx->file, ctx->line, sample, expect, &ctx->data, &ctx->data_len); + ctx->diff += check_mf_sample_(ctx->file, ctx->line, sample, expect, &ctx->data, &ctx->data_len, ctx->use_2d_buffer); }
+#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}; + struct check_mf_sample_context ctx = {.file = file, .line = line, .use_2d_buffer = use_2d_buffer}; 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);
- 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); @@ -7727,6 +7788,8 @@ static void test_video_processor(BOOL use_2d_buffer) .length = actual_width * actual_height * 4, .compare = compare_rgb32, .compare_rect = {.top = 12, .right = 82, .bottom = 96}, .dump = dump_rgb32, .size = {.cx = actual_width, .cy = actual_height}, + .length_2d = actual_width * actual_height * 4, .abs_stride = actual_width * 4, + .size_2d = {.cx = actual_width, .cy = actual_height}, }; const struct sample_desc rgb32_sample_desc = { @@ -7740,6 +7803,8 @@ static void test_video_processor(BOOL use_2d_buffer) .length = actual_aperture.Area.cx * actual_aperture.Area.cy * 4, .compare = compare_rgb32, .compare_rect = {.right = actual_aperture.Area.cx, .bottom = actual_aperture.Area.cy}, .dump = dump_rgb32, .size = actual_aperture.Area, + .length_2d = actual_width * actual_aperture.Area.cy * 4, .abs_stride = actual_width * 4, + .size_2d = {.cx = actual_width, .cy = actual_aperture.Area.cy}, }; const struct sample_desc rgb32_crop_sample_desc = { @@ -7753,6 +7818,8 @@ static void test_video_processor(BOOL use_2d_buffer) .length = actual_width * actual_height * 2, .compare = compare_rgb16, .compare_rect = {.top = 12, .right = 82, .bottom = 96}, .dump = dump_rgb16, .size = {.cx = actual_width, .cy = actual_height}, + .length_2d = actual_width * actual_height * 2, .abs_stride = actual_width * 2, + .size_2d = {.cx = actual_width, .cy = actual_height}, }; const struct sample_desc rgb555_sample_desc = { @@ -7766,6 +7833,8 @@ static void test_video_processor(BOOL use_2d_buffer) .length = actual_width * actual_height * 3 / 2, .compare = compare_nv12, .compare_rect = {.top = 12, .right = 82, .bottom = 96}, .dump = dump_nv12, .size = {.cx = actual_width, .cy = actual_height}, + .length_2d = nv12_aligned_width * actual_height * 3 / 2, .abs_stride = nv12_aligned_width, + .size_2d = {.cx = nv12_aligned_width, .cy = actual_height}, }; const struct sample_desc nv12_sample_desc = { @@ -7781,6 +7850,7 @@ static void test_video_processor(BOOL use_2d_buffer) const struct attribute_desc *output_type_desc; const struct sample_desc *output_sample_desc; const WCHAR *output_bitmap; + const WCHAR *output_2d_bitmap; ULONG delta; BOOL broken; const struct buffer2d_desc *input_2d_desc; @@ -7791,114 +7861,133 @@ static void test_video_processor(BOOL use_2d_buffer) { .input_type_desc = nv12_default_stride, .input_bitmap = L"nv12frame.bmp", .output_type_desc = rgb32_default_stride, .output_bitmap = L"rgb32frame-flip.bmp", + .output_2d_bitmap = L"rgb32frame-flip-2d.bmp", .output_sample_desc = &rgb32_sample_desc, .delta = 2, /* Windows returns 0, Wine needs 2 */ .input_2d_desc = &nv12_default_stride_2d, .output_2d_desc = &rgb32_negative_stride_2d, }, { .input_type_desc = nv12_default_stride, .input_bitmap = L"nv12frame.bmp", .output_type_desc = rgb32_negative_stride, .output_bitmap = L"rgb32frame-flip.bmp", + .output_2d_bitmap = L"rgb32frame-flip-2d.bmp", .output_sample_desc = &rgb32_sample_desc, .delta = 2, /* Windows returns 0, Wine needs 2 */ .input_2d_desc = &nv12_default_stride_2d, .output_2d_desc = &rgb32_negative_stride_2d, }, { .input_type_desc = nv12_default_stride, .input_bitmap = L"nv12frame.bmp", .output_type_desc = rgb32_positive_stride, .output_bitmap = L"rgb32frame.bmp", + .output_2d_bitmap = L"rgb32frame-2d.bmp", .output_sample_desc = &rgb32_sample_desc, .delta = 6, .input_2d_desc = &nv12_default_stride_2d, .output_2d_desc = &rgb32_positive_stride_2d, }, { .input_type_desc = rgb32_default_stride, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = nv12_default_stride, .output_bitmap = L"nv12frame-flip.bmp", + .output_2d_bitmap = L"nv12frame-flip-2d.bmp", .output_sample_desc = &nv12_sample_desc, .delta = 2, /* Windows returns 0, Wine needs 2 */ .input_2d_desc = &rgb32_negative_stride_2d, .output_2d_desc = &nv12_default_stride_2d, }, { .input_type_desc = rgb32_negative_stride, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = nv12_default_stride, .output_bitmap = L"nv12frame-flip.bmp", + .output_2d_bitmap = L"nv12frame-flip-2d.bmp", .output_sample_desc = &nv12_sample_desc, .delta = 2, /* Windows returns 0, Wine needs 2 */ .input_2d_desc = &rgb32_negative_stride_2d, .output_2d_desc = &nv12_default_stride_2d, }, { .input_type_desc = rgb32_positive_stride, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = nv12_default_stride, .output_bitmap = L"nv12frame.bmp", + .output_2d_bitmap = L"nv12frame-2d.bmp", .output_sample_desc = &nv12_sample_desc, .delta = 2, /* Windows returns 1, Wine needs 2 */ .input_2d_desc = &rgb32_positive_stride_2d, .output_2d_desc = &nv12_default_stride_2d, }, { .input_type_desc = rgb32_negative_stride, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = rgb32_negative_stride, .output_bitmap = L"rgb32frame.bmp", + .output_2d_bitmap = L"rgb32frame-2d.bmp", .output_sample_desc = &rgb32_sample_desc, .input_2d_desc = &rgb32_negative_stride_2d, .output_2d_desc = &rgb32_negative_stride_2d, }, { .input_type_desc = rgb32_negative_stride, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = rgb32_positive_stride, .output_bitmap = L"rgb32frame-flip.bmp", + .output_2d_bitmap = L"rgb32frame-flip-2d.bmp", .output_sample_desc = &rgb32_sample_desc, .delta = 3, /* Windows returns 3 */ .input_2d_desc = &rgb32_negative_stride_2d, .output_2d_desc = &rgb32_positive_stride_2d, }, { .input_type_desc = rgb32_positive_stride, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = rgb32_negative_stride, .output_bitmap = L"rgb32frame-flip.bmp", + .output_2d_bitmap = L"rgb32frame-flip-2d.bmp", .output_sample_desc = &rgb32_sample_desc, .delta = 3, /* Windows returns 3 */ .input_2d_desc = &rgb32_positive_stride_2d, .output_2d_desc = &rgb32_negative_stride_2d, }, { .input_type_desc = rgb32_positive_stride, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = rgb32_positive_stride, .output_bitmap = L"rgb32frame.bmp", + .output_2d_bitmap = L"rgb32frame-2d.bmp", .output_sample_desc = &rgb32_sample_desc, .input_2d_desc = &rgb32_positive_stride_2d, .output_2d_desc = &rgb32_positive_stride_2d, }, { .input_type_desc = rgb32_with_aperture, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = rgb32_with_aperture, .output_bitmap = L"rgb32frame.bmp", + .output_2d_bitmap = L"rgb32frame-2d.bmp", .output_sample_desc = &rgb32_sample_desc, .broken = TRUE, /* old Windows version incorrectly rescale */ .input_2d_desc = &rgb32_negative_stride_2d, .output_2d_desc = &rgb32_negative_stride_2d, }, { .input_type_desc = rgb32_default_stride, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = rgb555_default_stride, .output_bitmap = L"rgb555frame.bmp", + .output_2d_bitmap = L"rgb555frame-2d.bmp", .output_sample_desc = &rgb555_sample_desc, .input_2d_desc = &rgb32_negative_stride_2d, .output_2d_desc = &rgb555_negative_stride_2d, }, { .input_type_desc = rgb32_default_stride, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = rgb555_negative_stride, .output_bitmap = L"rgb555frame.bmp", + .output_2d_bitmap = L"rgb555frame-2d.bmp", .output_sample_desc = &rgb555_sample_desc, .input_2d_desc = &rgb32_negative_stride_2d, .output_2d_desc = &rgb555_negative_stride_2d, }, { .input_type_desc = rgb32_default_stride, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = rgb555_positive_stride, .output_bitmap = L"rgb555frame-flip.bmp", + .output_2d_bitmap = L"rgb555frame-flip-2d.bmp", .output_sample_desc = &rgb555_sample_desc, .delta = 3, /* Windows returns 0, Wine needs 3 */ .input_2d_desc = &rgb32_negative_stride_2d, .output_2d_desc = &rgb555_positive_stride_2d, }, { .input_type_desc = rgb555_default_stride, .input_bitmap = L"rgb555frame.bmp", .output_type_desc = rgb555_positive_stride, .output_bitmap = L"rgb555frame-flip.bmp", + .output_2d_bitmap = L"rgb555frame-flip-2d.bmp", .output_sample_desc = &rgb555_sample_desc, .delta = 4, /* Windows returns 0, Wine needs 4 */ .input_2d_desc = &rgb555_negative_stride_2d, .output_2d_desc = &rgb555_positive_stride_2d, }, { .input_type_desc = nv12_with_aperture, .input_bitmap = L"nv12frame.bmp", .output_type_desc = rgb32_no_aperture, .output_bitmap = L"rgb32frame-crop-flip.bmp", - .output_sample_desc = &rgb32_crop_sample_desc, .delta = 2, /* Windows returns 0, Wine needs 2 */ + .output_2d_bitmap = L"rgb32frame-crop-flip-2d.bmp", + .output_sample_desc = &rgb32_crop_sample_desc, .delta = 3, /* Windows returns 0, Wine needs 3 */ .input_2d_desc = &nv12_default_stride_2d, .output_2d_desc = &rgb32_no_aperture_2d, }, { .input_type_desc = rgb32_no_aperture, .input_bitmap = L"rgb32frame-crop-flip.bmp", .output_type_desc = rgb32_with_aperture, .output_bitmap = L"rgb32frame-flip.bmp", + .output_2d_bitmap = L"rgb32frame-flip-2d.bmp", .output_sample_desc = &rgb32_sample_desc, .broken = TRUE, /* old Windows version incorrectly rescale */ .input_2d_desc = &rgb32_no_aperture_2d, .output_2d_desc = &rgb32_negative_stride_2d, }, { .input_type_desc = rgb32_with_aperture, .input_bitmap = L"rgb32frame-flip.bmp", .output_type_desc = rgb32_no_aperture, .output_bitmap = L"rgb32frame-crop-flip.bmp", - .output_sample_desc = &rgb32_crop_sample_desc, + .output_2d_bitmap = L"rgb32frame-crop-flip-2d.bmp", + .output_sample_desc = &rgb32_crop_sample_desc, .delta = 2, /* Windows returns 2 with 2d image */ .input_2d_desc = &rgb32_negative_stride_2d, .output_2d_desc = &rgb32_no_aperture_2d, }, { .input_type_desc = rgb32_with_aperture_positive_stride, .input_bitmap = L"rgb32frame.bmp", .output_type_desc = rgb32_no_aperture, .output_bitmap = L"rgb32frame-crop-flip.bmp", + .output_2d_bitmap = L"rgb32frame-crop-flip-2d.bmp", .output_sample_desc = &rgb32_crop_sample_desc, .delta = 3, /* Windows returns 3 */ .input_2d_desc = &rgb32_positive_stride_2d, .output_2d_desc = &rgb32_no_aperture_2d, }, @@ -7924,7 +8013,10 @@ static void test_video_processor(BOOL use_2d_buffer) hr = CoInitialize(NULL); ok(hr == S_OK, "Failed to initialize, hr %#lx.\n", hr);
- winetest_push_context("videoproc"); + if (use_2d_buffer) + winetest_push_context("videoproc 2d"); + else + winetest_push_context("videoproc 1d");
if (!check_mft_enum(MFT_CATEGORY_VIDEO_PROCESSOR, &input_type, &output_type, class_id)) goto failed; @@ -8339,6 +8431,11 @@ static void test_video_processor(BOOL use_2d_buffer)
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); + if (use_2d_buffer) + { + ret = check_2d_mf_sample_collection(output_samples, test->output_sample_desc, test->output_2d_bitmap); + ok(ret <= test->delta || broken(test->broken), "got %lu%% diff\n", ret); + } IMFCollection_Release(output_samples);
output_sample = create_sample_type(use_2d_buffer, NULL, output_info.cbSize, test->output_2d_desc);