diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-08-02 18:23:36 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-08-02 18:23:36 +0200 |
| commit | 7d9e108ba3629b2e9120bc1da3354935c41aca37 (patch) | |
| tree | c8ffdb2bca75d62bfe9fa2262e9fc4cd19c45027 /test | |
| parent | 6f98afd8021f9475bbd342bdcb39162b3167fa9e (diff) | |
WIP: more hacks.shared-ptr
Diffstat (limited to 'test')
| -rw-r--r-- | test/dcp_test.cc | 16 | ||||
| -rw-r--r-- | test/decryption_test.cc | 4 | ||||
| -rw-r--r-- | test/kdm_test.cc | 2 | ||||
| -rw-r--r-- | test/round_trip_test.cc | 14 | ||||
| -rw-r--r-- | test/sound_asset_writer_test.cc | 6 | ||||
| -rw-r--r-- | test/sound_frame_test.cc | 8 | ||||
| -rw-r--r-- | test/sync_test.cc | 16 |
7 files changed, 33 insertions, 33 deletions
diff --git a/test/dcp_test.cc b/test/dcp_test.cc index 63de990f..61cfa711 100644 --- a/test/dcp_test.cc +++ b/test/dcp_test.cc @@ -215,21 +215,21 @@ test_rewriting_sound(string name, bool modify) bool need_to_modify = modify; for (int i = 0; i < A_sound->asset()->intrinsic_duration(); ++i) { auto sf = reader->get_frame (i); - float* out[sf->channels()]; - for (int j = 0; j < sf->channels(); ++j) { - out[j] = new float[sf->samples()]; + float* out[sf.channels()]; + for (int j = 0; j < sf.channels(); ++j) { + out[j] = new float[sf.samples()]; } - for (int j = 0; j < sf->samples(); ++j) { - for (int k = 0; k < sf->channels(); ++k) { - out[k][j] = static_cast<float>(sf->get(k, j)) / (1 << 23); + for (int j = 0; j < sf.samples(); ++j) { + for (int k = 0; k < sf.channels(); ++k) { + out[k][j] = static_cast<float>(sf.get(k, j)) / (1 << 23); if (need_to_modify) { out[k][j] += 1.0 / (1 << 23); need_to_modify = false; } } } - writer->write(out, sf->channels(), sf->samples()); - for (int j = 0; j < sf->channels(); ++j) { + writer->write(out, sf.channels(), sf.samples()); + for (int j = 0; j < sf.channels(); ++j) { delete[] out[j]; } } diff --git a/test/decryption_test.cc b/test/decryption_test.cc index 1aadc461..7610d985 100644 --- a/test/decryption_test.cc +++ b/test/decryption_test.cc @@ -83,10 +83,10 @@ get_frame (dcp::DCP const & dcp) auto mono_picture = dynamic_pointer_cast<const dcp::MonoJ2KPictureAsset>(picture); auto reader = mono_picture->start_read(); auto j2k_frame = reader->get_frame(0); - auto xyz = j2k_frame->xyz_image(); + auto xyz = j2k_frame.xyz_image(); std::vector<uint8_t> argb(xyz->size().width * xyz->size().height * 4); - dcp::xyz_to_rgba(j2k_frame->xyz_image(), dcp::ColourConversion::srgb_to_xyz(), argb.data(), xyz->size().width * 4); + dcp::xyz_to_rgba(j2k_frame.xyz_image(), dcp::ColourConversion::srgb_to_xyz(), argb.data(), xyz->size().width * 4); return make_pair (argb, xyz->size ()); } diff --git a/test/kdm_test.cc b/test/kdm_test.cc index 75a6019e..2f788439 100644 --- a/test/kdm_test.cc +++ b/test/kdm_test.cc @@ -380,5 +380,5 @@ BOOST_AUTO_TEST_CASE (vf_kdm_test) BOOST_REQUIRE(mono_asset); auto reader = mono_asset->start_read(); reader->set_check_hmac(false); - reader->get_frame(0)->xyz_image(); + reader->get_frame(0).xyz_image(); } diff --git a/test/round_trip_test.cc b/test/round_trip_test.cc index ffba5cbd..151bc1bc 100644 --- a/test/round_trip_test.cc +++ b/test/round_trip_test.cc @@ -128,16 +128,16 @@ BOOST_AUTO_TEST_CASE (round_trip_test) BOOST_CHECK (!kdm_B.keys().empty ()); asset_B->set_key (kdm_B.keys().front().key()); - auto xyz_A = asset_A->start_read()->get_frame(0)->xyz_image (); - auto xyz_B = asset_B->start_read()->get_frame(0)->xyz_image (); + auto xyz_A = asset_A->start_read()->get_frame(0).xyz_image(); + auto xyz_B = asset_B->start_read()->get_frame(0).xyz_image(); - scoped_array<uint8_t> frame_A (new uint8_t[xyz_A->size().width * xyz_A->size().height * 4]); - dcp::xyz_to_rgba (xyz_A, dcp::ColourConversion::srgb_to_xyz(), frame_A.get(), xyz_A->size().width * 4); + vector<uint8_t> frame_A(xyz_A->size().width * xyz_A->size().height * 4); + dcp::xyz_to_rgba(xyz_A, dcp::ColourConversion::srgb_to_xyz(), frame_A.data(), xyz_A->size().width * 4); - scoped_array<uint8_t> frame_B (new uint8_t[xyz_B->size().width * xyz_B->size().height * 4]); - dcp::xyz_to_rgba (xyz_B, dcp::ColourConversion::srgb_to_xyz(), frame_B.get(), xyz_B->size().width * 4); + vector<uint8_t> frame_B(xyz_B->size().width * xyz_B->size().height * 4); + dcp::xyz_to_rgba(xyz_B, dcp::ColourConversion::srgb_to_xyz(), frame_B.data(), xyz_B->size().width * 4); BOOST_CHECK_EQUAL (xyz_A->size().width, xyz_B->size().width); BOOST_CHECK_EQUAL (xyz_A->size().height, xyz_B->size().height); - BOOST_CHECK_EQUAL (memcmp (frame_A.get(), frame_B.get(), xyz_A->size().width * xyz_A->size().height * 4), 0); + BOOST_CHECK_EQUAL (memcmp (frame_A.data(), frame_B.data(), xyz_A->size().width * xyz_A->size().height * 4), 0); } diff --git a/test/sound_asset_writer_test.cc b/test/sound_asset_writer_test.cc index d5a66489..ee70c80c 100644 --- a/test/sound_asset_writer_test.cc +++ b/test/sound_asset_writer_test.cc @@ -64,7 +64,7 @@ no_padding_test(boost::filesystem::path path, std::function<void (shared_ptr<dcp for (auto channel = 0; channel < 6; ++channel) { for (auto sample = 0; sample < 2000; ++sample) { - BOOST_REQUIRE_EQUAL(frame->get(channel, sample), dist(rng)); + BOOST_REQUIRE_EQUAL(frame.get(channel, sample), dist(rng)); } } } @@ -135,13 +135,13 @@ padding_test(boost::filesystem::path path, std::function<void (shared_ptr<dcp::S for (auto channel = 0; channel < 6; ++channel) { for (auto sample = 0; sample < 2000; ++sample) { - BOOST_REQUIRE_EQUAL(frame->get(channel, sample), dist(rng)); + BOOST_REQUIRE_EQUAL(frame.get(channel, sample), dist(rng)); } } for (auto channel = 7; channel < 14; ++channel) { for (auto sample = 0; sample < 2000; ++sample) { - BOOST_REQUIRE_EQUAL(frame->get(channel, sample), 0); + BOOST_REQUIRE_EQUAL(frame.get(channel, sample), 0); } } } diff --git a/test/sound_frame_test.cc b/test/sound_frame_test.cc index a8060bd4..60a08b33 100644 --- a/test/sound_frame_test.cc +++ b/test/sound_frame_test.cc @@ -50,9 +50,9 @@ BOOST_AUTO_TEST_CASE (sound_frame_test) private_test / "TONEPLATES-SMPTE-PLAINTEXT_TST_F_XX-XX_ITL-TD_51-XX_2K_WOE_20111001_WOE_OV/pcm_95734608-5d47-4d3f-bf5f-9e9186b66afa_.mxf" ); - shared_ptr<const dcp::SoundFrame> frame = asset.start_read()->get_frame(42); + auto frame = asset.start_read()->get_frame(42); - BOOST_REQUIRE_EQUAL (frame->size(), channels * frame_length * 3); + BOOST_REQUIRE_EQUAL(frame.size(), channels * frame_length * 3); boost::filesystem::path ref_file = private_test / "data" / "frame.wav"; SF_INFO info; @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE (sound_frame_test) BOOST_REQUIRE_EQUAL (read, frame_length); /* Check raw data is as we expect */ - uint8_t const * p = frame->data (); + uint8_t const * p = frame.data(); for (int i = 0; i < (frame_length * channels); ++i) { int x = ref_data[i] >> 8; if (x < 0) { @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE (sound_frame_test) int* ref = ref_data; for (int sample = 0; sample < frame_length; ++sample) { for (int channel = 0; channel < channels; ++channel) { - BOOST_REQUIRE_EQUAL ((*ref++) >> 8, frame->get(channel, sample)); + BOOST_REQUIRE_EQUAL((*ref++) >> 8, frame.get(channel, sample)); } } } diff --git a/test/sync_test.cc b/test/sync_test.cc index 67920e2f..51a18282 100644 --- a/test/sync_test.cc +++ b/test/sync_test.cc @@ -83,10 +83,10 @@ BOOST_AUTO_TEST_CASE (sync_test1) { dcp::SoundAsset asset (private_test / "data" / "atmos_pcm.mxf"); shared_ptr<dcp::SoundAssetReader> reader = asset.start_read (); - shared_ptr<const dcp::SoundFrame> frame = reader->get_frame (0); + auto frame = reader->get_frame(0); /* Read the samples from the first MXF frame of channel 14 and decode them to bits */ - uint8_t const * data = frame->data (); + uint8_t const * data = frame.data(); vector<bool> ref; /* There's 2000 samples which contain 500 bits of data */ for (int i = 0; i < 500; ++i) { @@ -146,13 +146,13 @@ BOOST_AUTO_TEST_CASE (sync_test2) dcp::SoundAsset ref (private_test / "data" / "atmos_pcm.mxf"); dcp::SoundAsset check ("build/test/foo.mxf"); - shared_ptr<dcp::SoundAssetReader> ref_read = ref.start_read (); - shared_ptr<dcp::SoundAssetReader> check_read = check.start_read (); + auto ref_read = ref.start_read(); + auto check_read = check.start_read(); - shared_ptr<const dcp::SoundFrame> ref_frame = ref_read->get_frame(0); - uint8_t const* ref_data = ref_frame->data(); - shared_ptr<const dcp::SoundFrame> check_frame = check_read->get_frame(0); - uint8_t const* check_data = check_frame->data(); + auto ref_frame = ref_read->get_frame(0); + uint8_t const* ref_data = ref_frame.data(); + auto check_frame = check_read->get_frame(0); + uint8_t const* check_data = check_frame.data(); for (int i = 0; i < frames; ++i) { int ref_sample = read_sync_sample (ref_data, i, ref.channels()); |
