diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-06-10 23:04:54 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-06-10 23:04:54 +0200 |
| commit | 9704833bdfc8c8f104203200be27f714fa677506 (patch) | |
| tree | 8060672f5ddb4e708f472a8a67f04b9e931ec59e /test | |
| parent | 7fa7b39acdb940d8eafdf8b553525dae7c152084 (diff) | |
Fix incorrect burnt-in subtitle colours when burning into a DCP source (#2261).
dcp::combined_rgb_to_xyz was changed in libdcp (the values are no longer scaled
by 65535) but DoM wasn't changed, and there was no test to catch it.
Diffstat (limited to 'test')
| -rw-r--r-- | test/image_test.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/image_test.cc b/test/image_test.cc index 8d934bdd6..a529a3935 100644 --- a/test/image_test.cc +++ b/test/image_test.cc @@ -201,6 +201,44 @@ BOOST_AUTO_TEST_CASE (alpha_blend_test) } +/** Test Image::alpha_blend when the "base" image is XYZ12LE */ +BOOST_AUTO_TEST_CASE (alpha_blend_test_onto_xyz) +{ + Image xyz(AV_PIX_FMT_XYZ12LE, dcp::Size(50, 50), Image::Alignment::PADDED); + xyz.make_black(); + + auto overlay = make_shared<Image>(AV_PIX_FMT_RGBA, dcp::Size(8, 8), Image::Alignment::PADDED); + for (int y = 0; y < 8; ++y) { + uint8_t* p = overlay->data()[0] + (y * overlay->stride()[0]); + for (int x = 0; x < 8; ++x) { + *p++ = 255; + *p++ = 0; + *p++ = 0; + *p++ = 255; + } + } + + xyz.alpha_blend(overlay, Position<int>(4, 4)); + + for (int y = 0; y < 50; ++y) { + uint16_t* p = reinterpret_cast<uint16_t*>(xyz.data()[0]) + (y * xyz.stride()[0] / 2); + for (int x = 0; x < 50; ++x) { + std::cout << "x=" << x << ", y=" << y << "\n"; + if (4 <= x && x < 12 && 4 <= y && y < 12) { + BOOST_REQUIRE_EQUAL(p[0], 45078U); + BOOST_REQUIRE_EQUAL(p[1], 34939U); + BOOST_REQUIRE_EQUAL(p[2], 13892U); + } else { + BOOST_REQUIRE_EQUAL(p[0], 0U); + BOOST_REQUIRE_EQUAL(p[1], 0U); + BOOST_REQUIRE_EQUAL(p[2], 0U); + } + p += 3; + } + } +} + + /** Test merge (list<PositionImage>) with a single image */ BOOST_AUTO_TEST_CASE (merge_test1) { |
