From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mf/tests/mf_test.h | 2 + dlls/mf/tests/nv12frame-flip.bmp | Bin 0 -> 50742 bytes dlls/mf/tests/resource.rc | 12 +++ dlls/mf/tests/rgb555frame-flip.bmp | Bin 0 -> 18486 bytes dlls/mf/tests/rgb555frame.bmp | Bin 0 -> 18486 bytes dlls/mf/tests/transform.c | 165 +++++++++++++++++++++++++++-- 6 files changed, 168 insertions(+), 11 deletions(-) create mode 100644 dlls/mf/tests/nv12frame-flip.bmp create mode 100644 dlls/mf/tests/rgb555frame-flip.bmp create mode 100644 dlls/mf/tests/rgb555frame.bmp
diff --git a/dlls/mf/tests/mf_test.h b/dlls/mf/tests/mf_test.h index 77af51abd55..75a09b1dd15 100644 --- a/dlls/mf/tests/mf_test.h +++ b/dlls/mf/tests/mf_test.h @@ -65,10 +65,12 @@ typedef DWORD (*compare_cb)(const BYTE *data, DWORD *length, const RECT *rect, c extern DWORD compare_nv12(const BYTE *data, DWORD *length, const RECT *rect, const BYTE *expect); extern DWORD compare_i420(const BYTE *data, DWORD *length, const RECT *rect, const BYTE *expect); extern DWORD compare_rgb32(const BYTE *data, DWORD *length, const RECT *rect, const BYTE *expect); +extern DWORD compare_rgb16(const BYTE *data, DWORD *length, const RECT *rect, const BYTE *expect); extern DWORD compare_pcm16(const BYTE *data, DWORD *length, const RECT *rect, const BYTE *expect);
typedef void (*dump_cb)(const BYTE *data, DWORD length, const RECT *rect, HANDLE output); extern void dump_rgb32(const BYTE *data, DWORD length, const RECT *rect, HANDLE output); +extern void dump_rgb16(const BYTE *data, DWORD length, const RECT *rect, HANDLE output); extern void dump_nv12(const BYTE *data, DWORD length, const RECT *rect, HANDLE output); extern void dump_i420(const BYTE *data, DWORD length, const RECT *rect, HANDLE output);
diff --git a/dlls/mf/tests/nv12frame-flip.bmp b/dlls/mf/tests/nv12frame-flip.bmp new file mode 100644 index 0000000000000000000000000000000000000000..72310512d44ec8b88e4186e2e7bd3ee61dc66fda GIT bin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ssNy|#a47`^nDiCR9JkI`%Ud-u_6`}=p%OMjW@ z|K-!1j$V8J(e2G?`pZl$pVn0L+Wy_i=(YW)<IzihnW*K{o{L`Fzql2>wtwOvdg(6{ QwR{?T(QEtp1ObJ>KcaD^#sB~S
literal 0 HcmV?d00001
diff --git a/dlls/mf/tests/resource.rc b/dlls/mf/tests/resource.rc index 1651d1d4d1e..b20363acc60 100644 --- a/dlls/mf/tests/resource.rc +++ b/dlls/mf/tests/resource.rc @@ -71,6 +71,10 @@ nv12frame.bmp RCDATA nv12frame.bmp /* @makedep: nv12frame-grabber.bmp */ nv12frame-grabber.bmp RCDATA nv12frame-grabber.bmp
+/* Generated from running the tests on Windows */ +/* @makedep: nv12frame-flip.bmp */ +nv12frame-flip.bmp RCDATA nv12frame-flip.bmp + /* Generated from running the tests on Windows */ /* @makedep: i420frame.bmp */ i420frame.bmp RCDATA i420frame.bmp @@ -87,6 +91,14 @@ rgb32frame-flip.bmp RCDATA rgb32frame-flip.bmp /* @makedep: rgb32frame-grabber.bmp */ rgb32frame-grabber.bmp RCDATA rgb32frame-grabber.bmp
+/* Generated from running the tests on Windows */ +/* @makedep: rgb555frame.bmp */ +rgb555frame.bmp RCDATA rgb555frame.bmp + +/* Generated from running the tests on Windows */ +/* @makedep: rgb555frame-flip.bmp */ +rgb555frame-flip.bmp RCDATA rgb555frame-flip.bmp + /* Generated with: * gst-launch-1.0 videotestsrc num-buffers=60 pattern=smpte100 ! \ * video/x-raw,format=I420,width=64,height=64,framerate=30000/1001 ! \ diff --git a/dlls/mf/tests/rgb555frame-flip.bmp b/dlls/mf/tests/rgb555frame-flip.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/rgb555frame.bmp b/dlls/mf/tests/rgb555frame.bmp new file mode 100644 index 0000000000000000000000000000000000000000..7feb1e4254cc61b1a82f4563b4db942c363e13a5 GIT binary patch literal 18486 zcmeH_F-ikb6h%kApon0s4Neo#4VX4yWs^>@bqRuv;4rf$w-Im;fmqvFDd=EQ-{uzo zisv6PB!o8{&imKP`AzeC=Hv5n{M_$8d(CA0HlE%8+aKHKD~AFUpa2CZKmiK;vjUqT zAGMOzb3V#{J>-Lb-5t@N{!Rhzk5kW|RsG-Z@=^Y8kNGJ7&y#$V|I0-_%Ky9MgMZx} z(VzZK0q&1e&!1KOKMwLy{$C{@<-aNUDF0Q-NBOTyKKR$&5&h}!6yW|i_54}-`wg8p zsQzu25B_y`M1T4_1-L&>J%5(|enaOCs{d7&kMf^(`6&O=<)i$Mp7K%tO_vY;b$3L6 z`a1=<KTbV=R`p-r=A-=gAM#QDXUF*{|I=AM%D-*$!N2Z~=udyA0QbkK=g+GC(?4*O r|M_7)%74-4qx^?HALZZn`QTr7NA#z^Q-J&9)bnTQ?>BVbp!)v+To6uM
literal 0 HcmV?d00001
diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 1bc618f63f7..1acc7d1e826 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -858,31 +858,41 @@ DWORD compare_i420(const BYTE *data, DWORD *length, const RECT *rect, const BYTE return diff * 100 / 256 / size; }
-DWORD compare_rgb32(const BYTE *data, DWORD *length, const RECT *rect, const BYTE *expect) +static DWORD compare_rgb(const BYTE *data, DWORD *length, const RECT *rect, const BYTE *expect, UINT bits) { - DWORD x, y, size, diff = 0, width = (rect->right + 0xf) & ~0xf, height = (rect->bottom + 0xf) & ~0xf; + DWORD x, y, step = bits / 8, size, diff = 0, width = (rect->right + 0xf) & ~0xf, height = (rect->bottom + 0xf) & ~0xf;
/* skip BMP header from the dump */ size = *(DWORD *)(expect + 2 + 2 * sizeof(DWORD)); *length = *length + size; expect = expect + size;
- for (y = 0; y < height; y++, data += width * 4, expect += width * 4) + for (y = 0; y < height; y++, data += width * step, expect += width * step) { if (y < rect->top || y >= rect->bottom) continue; for (x = 0; x < width; x++) { if (x < rect->left || x >= rect->right) continue; - diff += abs((int)expect[4 * x + 0] - (int)data[4 * x + 0]); - diff += abs((int)expect[4 * x + 1] - (int)data[4 * x + 1]); - diff += abs((int)expect[4 * x + 2] - (int)data[4 * x + 2]); + diff += abs((int)expect[step * x + 0] - (int)data[step * x + 0]); + diff += abs((int)expect[step * x + 1] - (int)data[step * x + 1]); + if (step >= 3) diff += abs((int)expect[step * x + 2] - (int)data[step * x + 2]); } }
- size = (rect->right - rect->left) * (rect->bottom - rect->top) * 3; + size = (rect->right - rect->left) * (rect->bottom - rect->top) * min(step, 3); return diff * 100 / 256 / size; }
+DWORD compare_rgb32(const BYTE *data, DWORD *length, const RECT *rect, const BYTE *expect) +{ + return compare_rgb(data, length, rect, expect, 32); +} + +DWORD compare_rgb16(const BYTE *data, DWORD *length, const RECT *rect, const BYTE *expect) +{ + return compare_rgb(data, length, rect, expect, 16); +} + DWORD compare_pcm16(const BYTE *data, DWORD *length, const RECT *rect, const BYTE *expect) { const INT16 *data_pcm = (INT16 *)data, *expect_pcm = (INT16 *)expect; @@ -904,7 +914,7 @@ static DWORD compare_bytes(const BYTE *data, DWORD *length, const RECT *rect, co return diff * 100 / 256 / size; }
-void dump_rgb32(const BYTE *data, DWORD length, const RECT *rect, HANDLE output) +static void dump_rgb(const BYTE *data, DWORD length, const RECT *rect, HANDLE output, UINT bits) { DWORD width = (rect->right + 0xf) & ~0xf, height = (rect->bottom + 0xf) & ~0xf; static const char magic[2] = "BM"; @@ -920,7 +930,7 @@ void dump_rgb32(const BYTE *data, DWORD length, const RECT *rect, HANDLE output) .biHeader = { .biSize = sizeof(BITMAPINFOHEADER), .biWidth = width, .biHeight = height, .biPlanes = 1, - .biBitCount = 32, .biCompression = BI_RGB, .biSizeImage = width * height * 4, + .biBitCount = bits, .biCompression = BI_RGB, .biSizeImage = width * height * (bits / 8), }, }; DWORD written; @@ -937,6 +947,16 @@ void dump_rgb32(const BYTE *data, DWORD length, const RECT *rect, HANDLE output) ok(written == length, "written %lu bytes\n", written); }
+void dump_rgb32(const BYTE *data, DWORD length, const RECT *rect, HANDLE output) +{ + return dump_rgb(data, length, rect, output, 32); +} + +void dump_rgb16(const BYTE *data, DWORD length, const RECT *rect, HANDLE output) +{ + return dump_rgb(data, length, rect, output, 16); +} + void dump_nv12(const BYTE *data, DWORD length, const RECT *rect, HANDLE output) { DWORD written, x, y, width = (rect->right + 0xf) & ~0xf, height = (rect->bottom + 0xf) & ~0xf; @@ -6172,6 +6192,29 @@ static void test_video_processor(void) ATTR_UINT32(MF_MT_DEFAULT_STRIDE, actual_width * 4), {0}, }; + const struct attribute_desc rgb555_default_stride[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video, .required = TRUE), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB555, .required = TRUE), + ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height, .required = TRUE), + {0}, + }; + const struct attribute_desc rgb555_negative_stride[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video, .required = TRUE), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB555, .required = TRUE), + ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height, .required = TRUE), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, -actual_width * 2), + {0}, + }; + const struct attribute_desc rgb555_positive_stride[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video, .required = TRUE), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB555, .required = TRUE), + ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height, .required = TRUE), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, actual_width * 2), + {0}, + }; const MFT_OUTPUT_STREAM_INFO initial_output_info = {0}; const MFT_INPUT_STREAM_INFO initial_input_info = {0}; MFT_OUTPUT_STREAM_INFO output_info = {0}; @@ -6194,6 +6237,30 @@ static void test_video_processor(void) .buffer_count = 1, .buffers = &rgb32_buffer_desc, };
+ const struct buffer_desc rgb555_buffer_desc = + { + .length = actual_width * actual_height * 2, + .compare = compare_rgb16, .dump = dump_rgb16, .rect = {.top = 12, .right = 82, .bottom = 96}, + }; + const struct sample_desc rgb555_sample_desc = + { + .attributes = output_sample_attributes, + .sample_time = 0, .sample_duration = 10000000, + .buffer_count = 1, .buffers = &rgb555_buffer_desc, + }; + + const struct buffer_desc nv12_buffer_desc = + { + .length = actual_width * actual_height * 3 / 2, + .compare = compare_nv12, .dump = dump_nv12, .rect = {.top = 12, .right = 82, .bottom = 96}, + }; + const struct sample_desc nv12_sample_desc = + { + .attributes = output_sample_attributes, + .sample_time = 0, .sample_duration = 10000000, + .buffer_count = 1, .buffers = &nv12_buffer_desc, + }; + const struct transform_desc { const struct attribute_desc *input_type_desc; @@ -6220,11 +6287,62 @@ static void test_video_processor(void) .output_sample_desc = &rgb32_sample_desc, .result_bitmap = L"rgb32frame.bmp", .delta = 6, }, + { + .input_type_desc = rgb32_default_stride, .output_type_desc = nv12_default_stride, + .output_sample_desc = &nv12_sample_desc, .result_bitmap = L"nv12frame-flip.bmp", + .delta = 2, /* Windows returns 0, Wine needs 2 */ + }, + { + .input_type_desc = rgb32_negative_stride, .output_type_desc = nv12_default_stride, + .output_sample_desc = &nv12_sample_desc, .result_bitmap = L"nv12frame-flip.bmp", + .delta = 2, /* Windows returns 0, Wine needs 2 */ + }, + { + .input_type_desc = rgb32_positive_stride, .output_type_desc = nv12_default_stride, + .output_sample_desc = &nv12_sample_desc, .result_bitmap = L"nv12frame.bmp", + .delta = 2, /* Windows returns 1, Wine needs 2 */ + }, + { + .input_type_desc = rgb32_negative_stride, .output_type_desc = rgb32_negative_stride, + .output_sample_desc = &rgb32_sample_desc, .result_bitmap = L"rgb32frame.bmp", + }, + { + .input_type_desc = rgb32_negative_stride, .output_type_desc = rgb32_positive_stride, + .output_sample_desc = &rgb32_sample_desc, .result_bitmap = L"rgb32frame-flip.bmp", + .delta = 3, /* Windows returns 3 */ + }, + { + .input_type_desc = rgb32_positive_stride, .output_type_desc = rgb32_negative_stride, + .output_sample_desc = &rgb32_sample_desc, .result_bitmap = L"rgb32frame-flip.bmp", + .delta = 3, /* Windows returns 3 */ + }, + { + .input_type_desc = rgb32_positive_stride, .output_type_desc = rgb32_positive_stride, + .output_sample_desc = &rgb32_sample_desc, .result_bitmap = L"rgb32frame.bmp", + }, { .input_type_desc = rgb32_with_aperture, .output_type_desc = rgb32_with_aperture, .output_sample_desc = &rgb32_sample_desc, .result_bitmap = L"rgb32frame.bmp", .broken = TRUE /* old Windows version incorrectly rescale */ }, + { + .input_type_desc = rgb32_default_stride, .output_type_desc = rgb555_default_stride, + .output_sample_desc = &rgb555_sample_desc, .result_bitmap = L"rgb555frame.bmp", + }, + { + .input_type_desc = rgb32_default_stride, .output_type_desc = rgb555_negative_stride, + .output_sample_desc = &rgb555_sample_desc, .result_bitmap = L"rgb555frame.bmp", + }, + { + .input_type_desc = rgb32_default_stride, .output_type_desc = rgb555_positive_stride, + .output_sample_desc = &rgb555_sample_desc, .result_bitmap = L"rgb555frame-flip.bmp", + .delta = 3, /* Windows returns 0, Wine needs 3 */ + }, + { + .input_type_desc = rgb555_default_stride, .output_type_desc = rgb555_positive_stride, + .output_sample_desc = &rgb555_sample_desc, .result_bitmap = L"rgb555frame-flip.bmp", + .delta = 4, /* Windows returns 0, Wine needs 4 */ + }, };
MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Video, MFVideoFormat_NV12}; @@ -6551,8 +6669,21 @@ static void test_video_processor(void) check_mft_set_output_type(transform, test->output_type_desc, S_OK); check_mft_get_output_current_type(transform, test->output_type_desc);
- output_info.cbSize = actual_width * actual_height * 4; - check_mft_get_output_stream_info(transform, S_OK, &output_info); + if (test->output_sample_desc == &nv12_sample_desc) + { + output_info.cbSize = actual_width * actual_height * 3 / 2; + check_mft_get_output_stream_info(transform, S_OK, &output_info); + } + else if (test->output_sample_desc == &rgb555_sample_desc) + { + output_info.cbSize = actual_width * actual_height * 2; + check_mft_get_output_stream_info(transform, S_OK, &output_info); + } + else + { + output_info.cbSize = actual_width * actual_height * 4; + check_mft_get_output_stream_info(transform, S_OK, &output_info); + }
if (test->input_type_desc == nv12_default_stride) { @@ -6566,6 +6697,18 @@ static void test_video_processor(void) ok(input_data_len == 13824, "got length %lu\n", input_data_len); input_data = input_data + length; } + else if (test->input_type_desc == rgb555_default_stride) + { + input_info.cbSize = actual_width * actual_height * 2; + check_mft_get_input_stream_info(transform, S_OK, &input_info); + + load_resource(L"rgb555frame.bmp", &input_data, &input_data_len); + /* skip BMP header and RGB data from the dump */ + length = *(DWORD *)(input_data + 2 + 2 * sizeof(DWORD)); + input_data_len -= length; + ok(input_data_len == 18432, "got length %lu\n", input_data_len); + input_data += length; + } else { input_info.cbSize = actual_width * actual_height * 4;