diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-09-15 23:36:21 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-09-27 13:41:46 +0200 |
| commit | 3799e91d126d243d41c44dcb0ca1bfa66b53a57e (patch) | |
| tree | 74348b18d5ac0ef81bbebb27fe32862b22baa0b2 /test | |
| parent | 9bfa07293928c371d59db2091ba2b7e715ce5994 (diff) | |
Replace aligned bool with enum Alignment.
Diffstat (limited to 'test')
| -rw-r--r-- | test/butler_test.cc | 2 | ||||
| -rw-r--r-- | test/client_server_test.cc | 10 | ||||
| -rw-r--r-- | test/dcp_decoder_test.cc | 6 | ||||
| -rw-r--r-- | test/dcp_playback_test.cc | 6 | ||||
| -rw-r--r-- | test/ffmpeg_audio_only_test.cc | 2 | ||||
| -rw-r--r-- | test/ffmpeg_audio_test.cc | 6 | ||||
| -rw-r--r-- | test/ffmpeg_decoder_sequential_test.cc | 2 | ||||
| -rw-r--r-- | test/image_test.cc | 85 | ||||
| -rw-r--r-- | test/low_bitrate_test.cc | 20 | ||||
| -rw-r--r-- | test/overlap_video_test.cc | 3 | ||||
| -rw-r--r-- | test/pixel_formats_test.cc | 2 | ||||
| -rw-r--r-- | test/player_test.cc | 47 | ||||
| -rw-r--r-- | test/test.cc | 4 | ||||
| -rw-r--r-- | test/time_calculation_test.cc | 7 | ||||
| -rw-r--r-- | test/upmixer_a_test.cc | 2 | ||||
| -rw-r--r-- | test/vf_test.cc | 2 | ||||
| -rw-r--r-- | test/video_level_test.cc | 9 |
17 files changed, 113 insertions, 102 deletions
diff --git a/test/butler_test.cc b/test/butler_test.cc index 99bd95fce..787d1c324 100644 --- a/test/butler_test.cc +++ b/test/butler_test.cc @@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE (butler_test1) map.set (i, i, 1); } - Butler butler (film, make_shared<Player>(film, false), map, 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, false, false); + Butler butler (film, make_shared<Player>(film, Image::Alignment::COMPACT), map, 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::COMPACT, false, false); BOOST_CHECK (butler.get_video(true, 0).second == DCPTime()); BOOST_CHECK (butler.get_video(true, 0).second == DCPTime::from_frames(1, 24)); diff --git a/test/client_server_test.cc b/test/client_server_test.cc index f518f9383..7a99f7227 100644 --- a/test/client_server_test.cc +++ b/test/client_server_test.cc @@ -66,7 +66,7 @@ do_remote_encode (shared_ptr<DCPVideo> frame, EncodeServerDescription descriptio BOOST_AUTO_TEST_CASE (client_server_test_rgb) { - auto image = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size (1998, 1080), true); + auto image = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size (1998, 1080), Image::Alignment::PADDED); uint8_t* p = image->data()[0]; for (int y = 0; y < 1080; ++y) { @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb) p += image->stride()[0]; } - auto sub_image = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (100, 200), true); + auto sub_image = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (100, 200), Image::Alignment::PADDED); p = sub_image->data()[0]; for (int y = 0; y < 200; ++y) { uint8_t* q = p; @@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb) BOOST_AUTO_TEST_CASE (client_server_test_yuv) { - auto image = make_shared<Image>(AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true); + auto image = make_shared<Image>(AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), Image::Alignment::PADDED); for (int i = 0; i < image->planes(); ++i) { uint8_t* p = image->data()[i]; @@ -162,7 +162,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv) } } - auto sub_image = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (100, 200), true); + auto sub_image = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (100, 200), Image::Alignment::PADDED); uint8_t* p = sub_image->data()[0]; for (int y = 0; y < 200; ++y) { uint8_t* q = p; @@ -236,7 +236,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv) BOOST_AUTO_TEST_CASE (client_server_test_j2k) { - auto image = make_shared<Image>(AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true); + auto image = make_shared<Image>(AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), Image::Alignment::PADDED); for (int i = 0; i < image->planes(); ++i) { uint8_t* p = image->data()[i]; diff --git a/test/dcp_decoder_test.cc b/test/dcp_decoder_test.cc index 9461effc5..66cd402c4 100644 --- a/test/dcp_decoder_test.cc +++ b/test/dcp_decoder_test.cc @@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE (check_reuse_old_data_test) ov_content = make_shared<DCPContent>(ov->dir(ov->dcp_name(false))); test->examine_and_add_content (ov_content); BOOST_REQUIRE (!wait_for_jobs()); - auto player = make_shared<Player>(test, false); + auto player = make_shared<Player>(test, Image::Alignment::COMPACT); auto decoder = std::dynamic_pointer_cast<DCPDecoder>(player->_pieces.front()->decoder); BOOST_REQUIRE (decoder); @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE (check_reuse_old_data_test) auto vf_content = make_shared<DCPContent>(vf->dir(vf->dcp_name(false))); test->examine_and_add_content (vf_content); BOOST_REQUIRE (!wait_for_jobs()); - player = make_shared<Player>(test, false); + player = make_shared<Player>(test, Image::Alignment::COMPACT); decoder = std::dynamic_pointer_cast<DCPDecoder>(player->_pieces.front()->decoder); BOOST_REQUIRE (decoder); @@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE (check_reuse_old_data_test) auto encrypted_content = make_shared<DCPContent>(encrypted->dir(encrypted->dcp_name(false))); test->examine_and_add_content (encrypted_content); BOOST_REQUIRE (!wait_for_jobs()); - player = make_shared<Player>(test, false); + player = make_shared<Player>(test, Image::Alignment::COMPACT); decoder = std::dynamic_pointer_cast<DCPDecoder>(player->_pieces.front()->decoder); BOOST_REQUIRE (decoder); diff --git a/test/dcp_playback_test.cc b/test/dcp_playback_test.cc index 2ea638d74..28368dc34 100644 --- a/test/dcp_playback_test.cc +++ b/test/dcp_playback_test.cc @@ -45,12 +45,12 @@ BOOST_AUTO_TEST_CASE (dcp_playback_test) auto butler = std::make_shared<Butler>( film, - make_shared<Player>(film, false), + make_shared<Player>(film, Image::Alignment::COMPACT), AudioMapping(6, 6), 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, - false, + Image::Alignment::COMPACT, true, false ); @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE (dcp_playback_test) } /* assuming DCP is 24fps/48kHz */ butler->get_audio (audio_buffer, 2000); - p.first->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true); + p.first->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::COMPACT, true); } delete[] audio_buffer; } diff --git a/test/ffmpeg_audio_only_test.cc b/test/ffmpeg_audio_only_test.cc index 9f185fdf3..40c909b39 100644 --- a/test/ffmpeg_audio_only_test.cc +++ b/test/ffmpeg_audio_only_test.cc @@ -101,7 +101,7 @@ test (boost::filesystem::path file) ref_buffer_size = info.samplerate * info.channels; ref_buffer = new float[ref_buffer_size]; - auto player = make_shared<Player>(film, false); + auto player = make_shared<Player>(film, Image::Alignment::COMPACT); player->Audio.connect (bind (&audio, _1, info.channels)); while (!player->pass ()) {} diff --git a/test/ffmpeg_audio_test.cc b/test/ffmpeg_audio_test.cc index 0cc602a9a..6bdadce97 100644 --- a/test/ffmpeg_audio_test.cc +++ b/test/ffmpeg_audio_test.cc @@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test2) film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); - auto player = make_shared<Player>(film, false); + auto player = make_shared<Player>(film, Image::Alignment::COMPACT); while (!player->pass ()) {} } @@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test3) film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); - auto player = make_shared<Player>(film, false); + auto player = make_shared<Player>(film, Image::Alignment::COMPACT); player->set_fast (); while (!player->pass ()) {} } @@ -162,7 +162,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test4) film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); - auto player = make_shared<Player>(film, false); + auto player = make_shared<Player>(film, Image::Alignment::COMPACT); player->set_fast (); BOOST_CHECK_NO_THROW (while (!player->pass()) {}); } diff --git a/test/ffmpeg_decoder_sequential_test.cc b/test/ffmpeg_decoder_sequential_test.cc index 7d6d547ff..73eea719f 100644 --- a/test/ffmpeg_decoder_sequential_test.cc +++ b/test/ffmpeg_decoder_sequential_test.cc @@ -75,7 +75,7 @@ ffmpeg_decoder_sequential_test_one (boost::filesystem::path file, float fps, int film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs()); film->write_metadata (); - auto player = make_shared<Player>(film, false); + auto player = make_shared<Player>(film, Image::Alignment::COMPACT); BOOST_REQUIRE (content->video_frame_rate()); BOOST_CHECK_CLOSE (content->video_frame_rate().get(), fps, 0.01); diff --git a/test/image_test.cc b/test/image_test.cc index 9d0d43664..395aef8fd 100644 --- a/test/image_test.cc +++ b/test/image_test.cc @@ -39,13 +39,12 @@ using std::cout; using std::list; using std::make_shared; -using std::shared_ptr; using std::string; BOOST_AUTO_TEST_CASE (aligned_image_test) { - auto s = new Image (AV_PIX_FMT_RGB24, dcp::Size (50, 50), true); + auto s = new Image (AV_PIX_FMT_RGB24, dcp::Size (50, 50), Image::Alignment::PADDED); BOOST_CHECK_EQUAL (s->planes(), 1); /* 192 is 150 aligned to the nearest 64 bytes */ BOOST_CHECK_EQUAL (s->stride()[0], 192); @@ -72,7 +71,7 @@ BOOST_AUTO_TEST_CASE (aligned_image_test) BOOST_CHECK_EQUAL (t->stride()[0], s->stride()[0]); /* assignment operator */ - auto u = new Image (AV_PIX_FMT_YUV422P, dcp::Size (150, 150), false); + auto u = new Image (AV_PIX_FMT_YUV422P, dcp::Size (150, 150), Image::Alignment::COMPACT); *u = *s; BOOST_CHECK_EQUAL (u->planes(), 1); BOOST_CHECK_EQUAL (u->stride()[0], 192); @@ -96,7 +95,7 @@ BOOST_AUTO_TEST_CASE (aligned_image_test) BOOST_AUTO_TEST_CASE (compact_image_test) { - auto s = new Image (AV_PIX_FMT_RGB24, dcp::Size (50, 50), false); + auto s = new Image (AV_PIX_FMT_RGB24, dcp::Size (50, 50), Image::Alignment::COMPACT); BOOST_CHECK_EQUAL (s->planes(), 1); BOOST_CHECK_EQUAL (s->stride()[0], 50 * 3); BOOST_CHECK_EQUAL (s->line_size()[0], 50 * 3); @@ -122,7 +121,7 @@ BOOST_AUTO_TEST_CASE (compact_image_test) BOOST_CHECK_EQUAL (t->stride()[0], s->stride()[0]); /* assignment operator */ - auto u = new Image (AV_PIX_FMT_YUV422P, dcp::Size (150, 150), true); + auto u = new Image (AV_PIX_FMT_YUV422P, dcp::Size (150, 150), Image::Alignment::PADDED); *u = *s; BOOST_CHECK_EQUAL (u->planes(), 1); BOOST_CHECK_EQUAL (u->stride()[0], 50 * 3); @@ -148,10 +147,10 @@ void alpha_blend_test_one (AVPixelFormat format, string suffix) { auto proxy = make_shared<FFmpegImageProxy>(TestPaths::private_data() / "prophet_frame.tiff"); - auto raw = proxy->image(false).image; - auto background = raw->convert_pixel_format (dcp::YUVToRGB::REC709, format, true, false); + auto raw = proxy->image(Image::Alignment::COMPACT).image; + auto background = raw->convert_pixel_format (dcp::YUVToRGB::REC709, format, Image::Alignment::PADDED, false); - auto overlay = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size(431, 891), true); + auto overlay = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size(431, 891), Image::Alignment::PADDED); overlay->make_transparent (); for (int y = 0; y < 128; ++y) { @@ -180,7 +179,7 @@ alpha_blend_test_one (AVPixelFormat format, string suffix) background->alpha_blend (overlay, Position<int> (13, 17)); - auto save = background->convert_pixel_format (dcp::YUVToRGB::REC709, AV_PIX_FMT_RGB24, false, false); + auto save = background->convert_pixel_format (dcp::YUVToRGB::REC709, AV_PIX_FMT_RGB24, Image::Alignment::COMPACT, false); write_image (save, "build/test/image_test_" + suffix + ".png"); check_image ("build/test/image_test_" + suffix + ".png", TestPaths::private_data() / ("image_test_" + suffix + ".png")); @@ -205,7 +204,7 @@ BOOST_AUTO_TEST_CASE (merge_test1) { int const stride = 48 * 4; - auto A = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (48, 48), false); + auto A = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (48, 48), Image::Alignment::COMPACT); A->make_transparent (); auto a = A->data()[0]; @@ -221,7 +220,7 @@ BOOST_AUTO_TEST_CASE (merge_test1) list<PositionImage> all; all.push_back (PositionImage (A, Position<int>(0, 0))); - auto merged = merge (all, false); + auto merged = merge (all, Image::Alignment::COMPACT); BOOST_CHECK (merged.position == Position<int>(0, 0)); BOOST_CHECK_EQUAL (memcmp (merged.image->data()[0], A->data()[0], stride * 48), 0); @@ -231,7 +230,7 @@ BOOST_AUTO_TEST_CASE (merge_test1) /** Test merge (list<PositionImage>) with two images */ BOOST_AUTO_TEST_CASE (merge_test2) { - auto A = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (48, 1), false); + auto A = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (48, 1), Image::Alignment::COMPACT); A->make_transparent (); auto a = A->data()[0]; for (int x = 0; x < 16; ++x) { @@ -241,7 +240,7 @@ BOOST_AUTO_TEST_CASE (merge_test2) a[x * 4 + 3] = 255; } - auto B = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (48, 1), false); + auto B = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (48, 1), Image::Alignment::COMPACT); B->make_transparent (); auto b = B->data()[0]; for (int x = 0; x < 16; ++x) { @@ -254,7 +253,7 @@ BOOST_AUTO_TEST_CASE (merge_test2) list<PositionImage> all; all.push_back (PositionImage(A, Position<int>(0, 0))); all.push_back (PositionImage(B, Position<int>(0, 0))); - auto merged = merge (all, false); + auto merged = merge (all, Image::Alignment::COMPACT); BOOST_CHECK (merged.position == Position<int>(0, 0)); @@ -274,11 +273,11 @@ BOOST_AUTO_TEST_CASE (merge_test2) BOOST_AUTO_TEST_CASE (crop_scale_window_test) { auto proxy = make_shared<FFmpegImageProxy>("test/data/flat_red.png"); - auto raw = proxy->image(false).image; + auto raw = proxy->image(Image::Alignment::COMPACT).image; auto out = raw->crop_scale_window( - Crop(), dcp::Size(1998, 836), dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_YUV420P, VideoRange::FULL, true, false + Crop(), dcp::Size(1998, 836), dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_YUV420P, VideoRange::FULL, Image::Alignment::PADDED, false ); - auto save = out->scale(dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, AV_PIX_FMT_RGB24, false, false); + auto save = out->scale(dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, AV_PIX_FMT_RGB24, Image::Alignment::COMPACT, false); write_image(save, "build/test/crop_scale_window_test.png"); check_image("test/data/crop_scale_window_test.png", "build/test/crop_scale_window_test.png"); } @@ -287,12 +286,12 @@ BOOST_AUTO_TEST_CASE (crop_scale_window_test) /** Special cases of Image::crop_scale_window which triggered some valgrind warnings */ BOOST_AUTO_TEST_CASE (crop_scale_window_test2) { - auto image = make_shared<Image>(AV_PIX_FMT_XYZ12LE, dcp::Size(2048, 858), true); + auto image = make_shared<Image>(AV_PIX_FMT_XYZ12LE, dcp::Size(2048, 858), Image::Alignment::PADDED); image->crop_scale_window ( - Crop(279, 0, 0, 0), dcp::Size(1069, 448), dcp::Size(1069, 578), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_RGB24, VideoRange::FULL, false, false + Crop(279, 0, 0, 0), dcp::Size(1069, 448), dcp::Size(1069, 578), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_RGB24, VideoRange::FULL, Image::Alignment::COMPACT, false ); image->crop_scale_window ( - Crop(2048, 0, 0, 0), dcp::Size(1069, 448), dcp::Size(1069, 578), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_RGB24, VideoRange::FULL, false, false + Crop(2048, 0, 0, 0), dcp::Size(1069, 448), dcp::Size(1069, 578), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_RGB24, VideoRange::FULL, Image::Alignment::COMPACT, false ); } @@ -300,9 +299,9 @@ BOOST_AUTO_TEST_CASE (crop_scale_window_test2) BOOST_AUTO_TEST_CASE (crop_scale_window_test3) { auto proxy = make_shared<FFmpegImageProxy>(TestPaths::private_data() / "player_seek_test_0.png"); - auto xyz = proxy->image(false).image->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_RGB24, true, false); + auto xyz = proxy->image(Image::Alignment::COMPACT).image->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_RGB24, Image::Alignment::PADDED, false); auto cropped = xyz->crop_scale_window( - Crop(512, 0, 0, 0), dcp::Size(1486, 1080), dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_RGB24, VideoRange::FULL, false, false + Crop(512, 0, 0, 0), dcp::Size(1486, 1080), dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_RGB24, VideoRange::FULL, Image::Alignment::COMPACT, false ); write_image(cropped, "build/test/crop_scale_window_test3.png"); check_image("test/data/crop_scale_window_test3.png", "build/test/crop_scale_window_test3.png"); @@ -312,9 +311,9 @@ BOOST_AUTO_TEST_CASE (crop_scale_window_test3) BOOST_AUTO_TEST_CASE (crop_scale_window_test4) { auto proxy = make_shared<FFmpegImageProxy>(TestPaths::private_data() / "player_seek_test_0.png"); - auto xyz = proxy->image(false).image->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_RGB24, true, false); + auto xyz = proxy->image(Image::Alignment::COMPACT).image->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_RGB24, Image::Alignment::PADDED, false); auto cropped = xyz->crop_scale_window( - Crop(512, 0, 0, 0), dcp::Size(1486, 1080), dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_XYZ12LE, VideoRange::FULL, false, false + Crop(512, 0, 0, 0), dcp::Size(1486, 1080), dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_XYZ12LE, VideoRange::FULL, Image::Alignment::COMPACT, false ); write_image(cropped, "build/test/crop_scale_window_test4.png"); check_image("test/data/crop_scale_window_test4.png", "build/test/crop_scale_window_test4.png", 35000); @@ -324,9 +323,9 @@ BOOST_AUTO_TEST_CASE (crop_scale_window_test4) BOOST_AUTO_TEST_CASE (crop_scale_window_test5) { auto proxy = make_shared<FFmpegImageProxy>(TestPaths::private_data() / "player_seek_test_0.png"); - auto xyz = proxy->image(false).image->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_XYZ12LE, true, false); + auto xyz = proxy->image(Image::Alignment::COMPACT).image->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_XYZ12LE, Image::Alignment::PADDED, false); auto cropped = xyz->crop_scale_window( - Crop(512, 0, 0, 0), dcp::Size(1486, 1080), dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_RGB24, VideoRange::FULL, false, false + Crop(512, 0, 0, 0), dcp::Size(1486, 1080), dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_RGB24, VideoRange::FULL, Image::Alignment::COMPACT, false ); write_image(cropped, "build/test/crop_scale_window_test5.png"); check_image("test/data/crop_scale_window_test5.png", "build/test/crop_scale_window_test5.png"); @@ -336,9 +335,9 @@ BOOST_AUTO_TEST_CASE (crop_scale_window_test5) BOOST_AUTO_TEST_CASE (crop_scale_window_test6) { auto proxy = make_shared<FFmpegImageProxy>(TestPaths::private_data() / "player_seek_test_0.png"); - auto xyz = proxy->image(false).image->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_XYZ12LE, true, false); + auto xyz = proxy->image(Image::Alignment::COMPACT).image->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_XYZ12LE, Image::Alignment::PADDED, false); auto cropped = xyz->crop_scale_window( - Crop(512, 0, 0, 0), dcp::Size(1486, 1080), dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_XYZ12LE, VideoRange::FULL, false, false + Crop(512, 0, 0, 0), dcp::Size(1486, 1080), dcp::Size(1998, 1080), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_XYZ12LE, VideoRange::FULL, Image::Alignment::COMPACT, false ); write_image(cropped, "build/test/crop_scale_window_test6.png"); check_image("test/data/crop_scale_window_test6.png", "build/test/crop_scale_window_test6.png", 35000); @@ -351,7 +350,7 @@ BOOST_AUTO_TEST_CASE (crop_scale_window_test7) using namespace boost::filesystem; for (int left_crop = 0; left_crop < 8; ++left_crop) { auto proxy = make_shared<FFmpegImageProxy>("test/data/rgb_grey_testcard.png"); - auto yuv = proxy->image(false).image->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_YUV420P, true, false); + auto yuv = proxy->image(Image::Alignment::COMPACT).image->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_YUV420P, Image::Alignment::PADDED, false); int rounded = left_crop - (left_crop % 2); auto cropped = yuv->crop_scale_window( Crop(left_crop, 0, 0, 0), @@ -361,7 +360,7 @@ BOOST_AUTO_TEST_CASE (crop_scale_window_test7) VideoRange::VIDEO, AV_PIX_FMT_RGB24, VideoRange::VIDEO, - true, + Image::Alignment::PADDED, false ); path file = String::compose("crop_scale_window_test7-%1.png", left_crop); @@ -374,8 +373,8 @@ BOOST_AUTO_TEST_CASE (crop_scale_window_test7) BOOST_AUTO_TEST_CASE (as_png_test) { auto proxy = make_shared<FFmpegImageProxy>("test/data/3d_test/000001.png"); - auto image_rgb = proxy->image(false).image; - auto image_bgr = image_rgb->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_BGRA, true, false); + auto image_rgb = proxy->image(Image::Alignment::COMPACT).image; + auto image_bgr = image_rgb->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_BGRA, Image::Alignment::PADDED, false); image_rgb->as_png().write ("build/test/as_png_rgb.png"); image_bgr->as_png().write ("build/test/as_png_bgr.png"); @@ -388,11 +387,11 @@ BOOST_AUTO_TEST_CASE (as_png_test) static void fade_test_format_black (AVPixelFormat f, string name) { - Image yuv (f, dcp::Size(640, 480), true); + Image yuv (f, dcp::Size(640, 480), Image::Alignment::PADDED); yuv.make_black (); yuv.fade (0); string const filename = "fade_test_black_" + name + ".png"; - yuv.convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_RGBA, true, false)->as_png().write("build/test/" + filename); + yuv.convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_RGBA, Image::Alignment::PADDED, false)->as_png().write("build/test/" + filename); check_image ("test/data/" + filename, "build/test/" + filename); } @@ -402,10 +401,10 @@ static void fade_test_format_red (AVPixelFormat f, float amount, string name) { auto proxy = make_shared<FFmpegImageProxy>("test/data/flat_red.png"); - auto red = proxy->image(false).image->convert_pixel_format(dcp::YUVToRGB::REC709, f, true, false); + auto red = proxy->image(Image::Alignment::COMPACT).image->convert_pixel_format(dcp::YUVToRGB::REC709, f, Image::Alignment::PADDED, false); red->fade (amount); string const filename = "fade_test_red_" + name + ".png"; - red->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_RGBA, true, false)->as_png().write("build/test/" + filename); + red->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_RGBA, Image::Alignment::PADDED, false)->as_png().write("build/test/" + filename); check_image ("test/data/" + filename, "build/test/" + filename); } @@ -482,9 +481,9 @@ BOOST_AUTO_TEST_CASE (make_black_test) int N = 0; for (auto i: pix_fmts) { - auto foo = make_shared<Image>(i, in_size, true); + auto foo = make_shared<Image>(i, in_size, Image::Alignment::PADDED); foo->make_black (); - auto bar = foo->scale (out_size, dcp::YUVToRGB::REC601, AV_PIX_FMT_RGB24, true, false); + auto bar = foo->scale (out_size, dcp::YUVToRGB::REC601, AV_PIX_FMT_RGB24, Image::Alignment::PADDED, false); uint8_t* p = bar->data()[0]; for (int y = 0; y < bar->size().height; ++y) { @@ -506,7 +505,7 @@ BOOST_AUTO_TEST_CASE (make_black_test) BOOST_AUTO_TEST_CASE (make_part_black_test) { auto proxy = make_shared<FFmpegImageProxy>("test/data/flat_red.png"); - auto original = proxy->image(false).image; + auto original = proxy->image(Image::Alignment::COMPACT).image; list<AVPixelFormat> pix_fmts = { AV_PIX_FMT_RGB24, @@ -526,9 +525,9 @@ BOOST_AUTO_TEST_CASE (make_part_black_test) int N = 0; for (auto i: pix_fmts) { for (auto j: positions) { - auto foo = original->convert_pixel_format(dcp::YUVToRGB::REC601, i, true, false); + auto foo = original->convert_pixel_format(dcp::YUVToRGB::REC601, i, Image::Alignment::PADDED, false); foo->make_part_black (j.first, j.second); - auto bar = foo->convert_pixel_format (dcp::YUVToRGB::REC601, AV_PIX_FMT_RGB24, true, false); + auto bar = foo->convert_pixel_format (dcp::YUVToRGB::REC601, AV_PIX_FMT_RGB24, Image::Alignment::PADDED, false); auto p = bar->data()[0]; for (int y = 0; y < bar->size().height; ++y) { @@ -569,10 +568,10 @@ BOOST_AUTO_TEST_CASE (make_part_black_test) */ BOOST_AUTO_TEST_CASE (over_crop_test) { - auto image = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size(128, 128), true); + auto image = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size(128, 128), Image::Alignment::PADDED); image->make_black (); auto scaled = image->crop_scale_window ( - Crop(0, 0, 128, 128), dcp::Size(1323, 565), dcp::Size(1349, 565), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_RGB24, VideoRange::FULL, true, true + Crop(0, 0, 128, 128), dcp::Size(1323, 565), dcp::Size(1349, 565), dcp::YUVToRGB::REC709, VideoRange::FULL, AV_PIX_FMT_RGB24, VideoRange::FULL, Image::Alignment::PADDED, true ); string const filename = "over_crop_test.png"; write_image (scaled, "build/test/" + filename); diff --git a/test/low_bitrate_test.cc b/test/low_bitrate_test.cc index 33ce2635d..7050dd771 100644 --- a/test/low_bitrate_test.cc +++ b/test/low_bitrate_test.cc @@ -35,10 +35,26 @@ using std::make_shared; BOOST_AUTO_TEST_CASE (low_bitrate_test) { - auto image = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size(1998, 1080), true); + auto image = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size(1998, 1080), Image::Alignment::PADDED); image->make_black (); + auto proxy = make_shared<RawImageProxy>(image); - auto frame = make_shared<PlayerVideo>(proxy, Crop(), boost::optional<double>(), dcp::Size(1998, 1080), dcp::Size(1998, 1080), Eyes::BOTH, Part::WHOLE, boost::optional<ColourConversion>(), VideoRange::FULL, std::weak_ptr<Content>(), boost::optional<Frame>(), false); + + auto frame = make_shared<PlayerVideo>( + proxy, + Crop(), + boost::optional<double>(), + dcp::Size(1998, 1080), + dcp::Size(1998, 1080), + Eyes::BOTH, + Part::WHOLE, + boost::optional<ColourConversion>(), + VideoRange::FULL, + std::weak_ptr<Content>(), + boost::optional<Frame>(), + false + ); + auto dcp_video = make_shared<DCPVideo>(frame, 0, 24, 100000000, Resolution::TWO_K); auto j2k = dcp_video->encode_locally(); BOOST_REQUIRE (j2k.size() >= 16536); diff --git a/test/overlap_video_test.cc b/test/overlap_video_test.cc index d0d5a8bbf..3c969921d 100644 --- a/test/overlap_video_test.cc +++ b/test/overlap_video_test.cc @@ -40,7 +40,6 @@ using std::dynamic_pointer_cast; using std::make_shared; -using std::shared_ptr; BOOST_AUTO_TEST_CASE (overlap_video_test1) @@ -57,7 +56,7 @@ BOOST_AUTO_TEST_CASE (overlap_video_test1) B->video->set_length (24); B->set_position (film, dcpomatic::DCPTime::from_seconds(1)); - auto player = make_shared<Player>(film, false); + auto player = make_shared<Player>(film, Image::Alignment::COMPACT); auto pieces = player->_pieces; BOOST_REQUIRE_EQUAL (pieces.size(), 2U); BOOST_CHECK_EQUAL (pieces.front()->content, A); diff --git a/test/pixel_formats_test.cc b/test/pixel_formats_test.cc index a4d42e399..12a95bd69 100644 --- a/test/pixel_formats_test.cc +++ b/test/pixel_formats_test.cc @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE (pixel_formats_test) f->height = 480; f->format = static_cast<int> (i.format); av_frame_get_buffer (f, true); - Image t (f, false); + Image t (f, Image::Alignment::COMPACT); BOOST_CHECK_EQUAL(t.planes(), i.planes); BOOST_CHECK_EQUAL(t.sample_size(0).height, i.lines[0]); BOOST_CHECK_EQUAL(t.sample_size(1).height, i.lines[1]); diff --git a/test/player_test.cc b/test/player_test.cc index c1e2d2cbe..2caa34753 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -25,21 +25,21 @@ */ -#include "lib/film.h" -#include "lib/ffmpeg_content.h" -#include "lib/dcp_content_type.h" -#include "lib/ratio.h" #include "lib/audio_buffers.h" -#include "lib/player.h" -#include "lib/video_content.h" -#include "lib/image_content.h" -#include "lib/string_text_file_content.h" -#include "lib/content_factory.h" -#include "lib/dcp_content.h" -#include "lib/text_content.h" #include "lib/butler.h" #include "lib/compose.hpp" +#include "lib/content_factory.h" #include "lib/cross.h" +#include "lib/dcp_content.h" +#include "lib/dcp_content_type.h" +#include "lib/ffmpeg_content.h" +#include "lib/film.h" +#include "lib/image_content.h" +#include "lib/player.h" +#include "lib/ratio.h" +#include "lib/string_text_file_content.h" +#include "lib/text_content.h" +#include "lib/video_content.h" #include "test.h" #include <boost/test/unit_test.hpp> #include <boost/algorithm/string.hpp> @@ -48,7 +48,6 @@ using std::cout; using std::list; -using std::pair; using std::shared_ptr; using std::make_shared; using boost::bind; @@ -84,7 +83,7 @@ BOOST_AUTO_TEST_CASE (player_silence_padding_test) accumulated = std::make_shared<AudioBuffers>(film->audio_channels(), 0); - auto player = std::make_shared<Player>(film, false); + auto player = std::make_shared<Player>(film, Image::Alignment::COMPACT); player->Audio.connect (bind (&accumulate, _1, _2)); while (!player->pass ()) {} BOOST_REQUIRE (accumulated->frames() >= 48000); @@ -164,7 +163,7 @@ BOOST_AUTO_TEST_CASE (player_subframe_test) /* Length should be rounded up from B's length to the next video frame */ BOOST_CHECK (film->length() == DCPTime::from_frames(3 * 24 + 1, 24)); - auto player = std::make_shared<Player>(film, false); + auto player = std::make_shared<Player>(film, Image::Alignment::COMPACT); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_black._periods.size(), 1U); BOOST_CHECK (player->_black._periods.front() == DCPTimePeriod(DCPTime::from_frames(3 * 24, 24), DCPTime::from_frames(3 * 24 + 1, 24))); @@ -206,7 +205,7 @@ BOOST_AUTO_TEST_CASE (player_interleave_test) film->examine_and_add_content (s); BOOST_REQUIRE (!wait_for_jobs ()); - auto player = std::make_shared<Player>(film, false); + auto player = std::make_shared<Player>(film, Image::Alignment::COMPACT); player->Video.connect (bind (&video, _1, _2)); player->Audio.connect (bind (&audio, _1, _2)); video_frames = audio_frames = 0; @@ -229,12 +228,12 @@ BOOST_AUTO_TEST_CASE (player_seek_test) BOOST_REQUIRE (!wait_for_jobs ()); dcp->only_text()->set_use (true); - auto player = std::make_shared<Player>(film, false); + auto player = std::make_shared<Player>(film, Image::Alignment::COMPACT); player->set_fast (); player->set_always_burn_open_subtitles (); player->set_play_referenced (); - auto butler = std::make_shared<Butler>(film, player, AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true, false); + auto butler = std::make_shared<Butler>(film, player, AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::COMPACT, true, false); butler->disable_audio(); for (int i = 0; i < 10; ++i) { @@ -242,7 +241,7 @@ BOOST_AUTO_TEST_CASE (player_seek_test) butler->seek (t, true); auto video = butler->get_video(true, 0); BOOST_CHECK_EQUAL(video.second.get(), t.get()); - write_image(video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true), String::compose("build/test/player_seek_test_%1.png", i)); + write_image(video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::COMPACT, true), String::compose("build/test/player_seek_test_%1.png", i)); /* This 14.08 is empirically chosen (hopefully) to accept changes in rendering between the reference and a test machine (17.10 and 16.04 seem to anti-alias a little differently) but to reject gross errors e.g. missing fonts or missing text altogether. @@ -261,12 +260,12 @@ BOOST_AUTO_TEST_CASE (player_seek_test2) BOOST_REQUIRE (!wait_for_jobs ()); dcp->only_text()->set_use (true); - auto player = std::make_shared<Player>(film, false); + auto player = std::make_shared<Player>(film, Image::Alignment::COMPACT); player->set_fast (); player->set_always_burn_open_subtitles (); player->set_play_referenced (); - auto butler = std::make_shared<Butler>(film, player, AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true, false); + auto butler = std::make_shared<Butler>(film, player, AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::COMPACT, true, false); butler->disable_audio(); butler->seek(DCPTime::from_seconds(5), true); @@ -277,7 +276,7 @@ BOOST_AUTO_TEST_CASE (player_seek_test2) auto video = butler->get_video(true, 0); BOOST_CHECK_EQUAL(video.second.get(), t.get()); write_image( - video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true), String::compose("build/test/player_seek_test2_%1.png", i) + video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::COMPACT, true), String::compose("build/test/player_seek_test2_%1.png", i) ); check_image(TestPaths::private_data() / String::compose("player_seek_test2_%1.png", i), String::compose("build/test/player_seek_test2_%1.png", i), 14.08); } @@ -335,7 +334,7 @@ BOOST_AUTO_TEST_CASE (player_ignore_video_and_audio_test) text->only_text()->set_type (TextType::CLOSED_CAPTION); text->only_text()->set_use (true); - auto player = std::make_shared<Player>(film, false); + auto player = std::make_shared<Player>(film, Image::Alignment::COMPACT); player->set_ignore_video (); player->set_ignore_audio (); @@ -355,9 +354,9 @@ BOOST_AUTO_TEST_CASE (player_trim_crash) film->examine_and_add_content (boon); BOOST_REQUIRE (!wait_for_jobs()); - auto player = std::make_shared<Player>(film, false); + auto player = std::make_shared<Player>(film, Image::Alignment::COMPACT); player->set_fast (); - auto butler = std::make_shared<Butler>(film, player, AudioMapping(), 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true, false); + auto butler = std::make_shared<Butler>(film, player, AudioMapping(), 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::COMPACT, true, false); /* Wait for the butler to fill */ dcpomatic_sleep_seconds (5); diff --git a/test/test.cc b/test/test.cc index 3395d9672..8417b30d2 100644 --- a/test/test.cc +++ b/test/test.cc @@ -364,9 +364,9 @@ double rms_error (boost::filesystem::path ref, boost::filesystem::path check) { FFmpegImageProxy ref_proxy (ref); - auto ref_image = ref_proxy.image(false).image; + auto ref_image = ref_proxy.image(Image::Alignment::COMPACT).image; FFmpegImageProxy check_proxy (check); - auto check_image = check_proxy.image(false).image; + auto check_image = check_proxy.image(Image::Alignment::COMPACT).image; BOOST_REQUIRE_EQUAL (ref_image->pixel_format(), check_image->pixel_format()); AVPixelFormat const format = ref_image->pixel_format(); diff --git a/test/time_calculation_test.cc b/test/time_calculation_test.cc index 285285395..4ab5d0942 100644 --- a/test/time_calculation_test.cc +++ b/test/time_calculation_test.cc @@ -36,7 +36,6 @@ using std::list; using std::make_shared; -using std::shared_ptr; using std::string; using namespace dcpomatic; @@ -197,7 +196,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) film->set_sequence (false); film->add_content (content); - auto player = make_shared<Player>(film, false); + auto player = make_shared<Player>(film, Image::Alignment::COMPACT); /* Position 0, no trim, content rate = DCP rate */ content->set_position (film, DCPTime()); @@ -403,7 +402,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) film->set_sequence (false); film->add_content (content); - auto player = make_shared<Player>(film, false); + auto player = make_shared<Player>(film, Image::Alignment::COMPACT); /* Position 0, no trim, content rate = DCP rate */ content->set_position (film, DCPTime()); @@ -580,7 +579,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) film->set_sequence (false); film->add_content (content); - auto player = make_shared<Player>(film, false); + auto player = make_shared<Player>(film, Image::Alignment::COMPACT); /* Position 0, no trim, video/audio content rate = video/audio DCP rate */ content->set_position (film, DCPTime()); diff --git a/test/upmixer_a_test.cc b/test/upmixer_a_test.cc index 3310a9277..af6c8b9e2 100644 --- a/test/upmixer_a_test.cc +++ b/test/upmixer_a_test.cc @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE (upmixer_a_test) Ls = sf_open ("build/test/upmixer_a_test/Ls.wav", SFM_WRITE, &info); Rs = sf_open ("build/test/upmixer_a_test/Rs.wav", SFM_WRITE, &info); - auto player = make_shared<Player>(film, false); + auto player = make_shared<Player>(film, Image::Alignment::COMPACT); player->Audio.connect (bind (&write, _1, _2)); while (!player->pass()) {} diff --git a/test/vf_test.cc b/test/vf_test.cc index d25eb3cca..4db48dd60 100644 --- a/test/vf_test.cc +++ b/test/vf_test.cc @@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE (vf_test5) make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}); /* Check that the selected reel assets are right */ - auto player = make_shared<Player>(vf, false); + auto player = make_shared<Player>(vf, Image::Alignment::COMPACT); auto a = player->get_reel_assets(); BOOST_REQUIRE_EQUAL (a.size(), 4U); auto i = a.begin(); diff --git a/test/video_level_test.cc b/test/video_level_test.cc index 8d82e9d76..54513464c 100644 --- a/test/video_level_test.cc +++ b/test/video_level_test.cc @@ -54,7 +54,6 @@ using std::min; -using std::make_pair; using std::max; using std::pair; using std::string; @@ -71,7 +70,7 @@ static shared_ptr<Image> grey_image (dcp::Size size, uint8_t pixel) { - auto grey = make_shared<Image>(AV_PIX_FMT_RGB24, size, true); + auto grey = make_shared<Image>(AV_PIX_FMT_RGB24, size, Image::Alignment::PADDED); for (int y = 0; y < size.height; ++y) { uint8_t* p = grey->data()[0] + y * grey->stride()[0]; for (int x = 0; x < size.width; ++x) { @@ -94,7 +93,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_image_full_range_not_changed) write_image (grey_image(size, grey_pixel), file); FFmpegImageProxy proxy (file); - ImageProxy::Result result = proxy.image (false); + ImageProxy::Result result = proxy.image (Image::Alignment::COMPACT); BOOST_REQUIRE (!result.error); for (int y = 0; y < size.height; ++y) { @@ -128,7 +127,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_image_video_range_expanded) BOOST_REQUIRE (!player->pass()); } - auto image = player_video->image ([](AVPixelFormat f) { return f; }, VideoRange::FULL, true, false); + auto image = player_video->image ([](AVPixelFormat f) { return f; }, VideoRange::FULL, Image::Alignment::PADDED, false); for (int y = 0; y < size.height; ++y) { uint8_t* p = image->data()[0] + y * image->stride()[0]; @@ -214,7 +213,7 @@ pixel_range (shared_ptr<const Film> film, shared_ptr<const Content> content) BOOST_REQUIRE (!decoder->pass()); } - return pixel_range (content_video->image->image(false).image); + return pixel_range (content_video->image->image(Image::Alignment::COMPACT).image); } |
