From: Carl Hetherington Date: Wed, 4 Jan 2017 01:28:54 +0000 (+0000) Subject: Rename Time::round_up to Time::ceil. X-Git-Tag: v2.10.6-fix~7^2~1 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=11ac33e140f3aa9d6e992880a1e1b3a4ca649355 Rename Time::round_up to Time::ceil. --- diff --git a/src/lib/content.cc b/src/lib/content.cc index b5bae69b6..942e9e533 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -327,7 +327,7 @@ Content::reel_split_points () const { list t; /* XXX: this is questionable; perhaps the position itself should be forced to be on a frame boundary */ - t.push_back (position().round_up (film()->video_frame_rate())); + t.push_back (position().ceil (film()->video_frame_rate())); return t; } diff --git a/src/lib/dcpomatic_time.h b/src/lib/dcpomatic_time.h index 893bce257..6834ee099 100644 --- a/src/lib/dcpomatic_time.h +++ b/src/lib/dcpomatic_time.h @@ -118,7 +118,7 @@ public: * at some sampling rate. * @param r Sampling rate. */ - Time round_up (float r) const { + Time ceil (float r) const { Type const n = llrintf (HZ / r); Type const a = _t + n - 1; return Time (a - (a % n)); @@ -152,7 +152,7 @@ public: the calculation will round down before we get the chance to ceil(). */ - return ceil (_t * double(r) / HZ); + return ::ceil (_t * double(r) / HZ); } /** @param r Frames per second */ @@ -211,7 +211,7 @@ public: } private: - friend struct dcptime_round_up_test; + friend struct dcptime_ceil_test; Type _t; static const int HZ = 96000; diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index af6c8e167..ce87cc14f 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -381,7 +381,7 @@ FFmpeg::pts_offset (vector > audio_streams, option /* Now adjust so that the video pts starts on a frame */ if (first_video) { ContentTime const fvc = first_video.get() + po; - po += fvc.round_up (video_frame_rate) - fvc; + po += fvc.ceil (video_frame_rate) - fvc; } return po; diff --git a/src/lib/film.cc b/src/lib/film.cc index d331516dd..68266b4ec 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1416,7 +1416,7 @@ list Film::reels () const { list p; - DCPTime const len = length().round_up (video_frame_rate ()); + DCPTime const len = length().ceil (video_frame_rate ()); switch (reel_type ()) { case REELTYPE_SINGLE: diff --git a/test/reels_test.cc b/test/reels_test.cc index 51cb1f200..1951d5374 100644 --- a/test/reels_test.cc +++ b/test/reels_test.cc @@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE (reels_test3) BOOST_CHECK_EQUAL (i->to.get(), 96000 * 3); ++i; BOOST_CHECK_EQUAL (i->from.get(), 96000 * 3); - BOOST_CHECK_EQUAL (i->to.get(), sub->full_length().round_up(film->video_frame_rate()).get()); + BOOST_CHECK_EQUAL (i->to.get(), sub->full_length().ceil(film->video_frame_rate()).get()); } /** Check creation of a multi-reel DCP with a single .srt subtitle file; diff --git a/test/seek_zero_test.cc b/test/seek_zero_test.cc index faf4c9eac..0329364d9 100644 --- a/test/seek_zero_test.cc +++ b/test/seek_zero_test.cc @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE (seek_zero_test) video_delay = ContentTime (); } - Frame const first_frame = video_delay.round_up (content->active_video_frame_rate ()).frames_round (content->active_video_frame_rate ()); + Frame const first_frame = video_delay.ceil (content->active_video_frame_rate ()).frames_round (content->active_video_frame_rate ()); FFmpegDecoder decoder (content, film->log()); list a = decoder.video->get (first_frame, true); diff --git a/test/util_test.cc b/test/util_test.cc index 6abc9b5e7..c7bf9944d 100644 --- a/test/util_test.cc +++ b/test/util_test.cc @@ -51,21 +51,21 @@ BOOST_AUTO_TEST_CASE (digest_head_tail_test) BOOST_CHECK_THROW (digest_head_tail (p, 1024), OpenFileError); } -/* Straightforward test of DCPTime::round_up */ -BOOST_AUTO_TEST_CASE (dcptime_round_up_test) +/* Straightforward test of DCPTime::ceil */ +BOOST_AUTO_TEST_CASE (dcptime_ceil_test) { - BOOST_CHECK_EQUAL (DCPTime(0).round_up(DCPTime::HZ / 2).get(), 0); - BOOST_CHECK_EQUAL (DCPTime(1).round_up(DCPTime::HZ / 2).get(), 2); - BOOST_CHECK_EQUAL (DCPTime(2).round_up(DCPTime::HZ / 2).get(), 2); - BOOST_CHECK_EQUAL (DCPTime(3).round_up(DCPTime::HZ / 2).get(), 4); + BOOST_CHECK_EQUAL (DCPTime(0).ceil(DCPTime::HZ / 2).get(), 0); + BOOST_CHECK_EQUAL (DCPTime(1).ceil(DCPTime::HZ / 2).get(), 2); + BOOST_CHECK_EQUAL (DCPTime(2).ceil(DCPTime::HZ / 2).get(), 2); + BOOST_CHECK_EQUAL (DCPTime(3).ceil(DCPTime::HZ / 2).get(), 4); - BOOST_CHECK_EQUAL (DCPTime(0).round_up(DCPTime::HZ / 42).get(), 0); - BOOST_CHECK_EQUAL (DCPTime(1).round_up(DCPTime::HZ / 42).get(), 42); - BOOST_CHECK_EQUAL (DCPTime(42).round_up(DCPTime::HZ / 42).get(), 42); - BOOST_CHECK_EQUAL (DCPTime(43).round_up(DCPTime::HZ / 42).get(), 84); + BOOST_CHECK_EQUAL (DCPTime(0).ceil(DCPTime::HZ / 42).get(), 0); + BOOST_CHECK_EQUAL (DCPTime(1).ceil(DCPTime::HZ / 42).get(), 42); + BOOST_CHECK_EQUAL (DCPTime(42).ceil(DCPTime::HZ / 42).get(), 42); + BOOST_CHECK_EQUAL (DCPTime(43).ceil(DCPTime::HZ / 42).get(), 84); /* Check that rounding up to non-integer frame rates works */ - BOOST_CHECK_EQUAL (DCPTime(45312).round_up(29.976).get(), 48045); + BOOST_CHECK_EQUAL (DCPTime(45312).ceil(29.976).get(), 48045); } BOOST_AUTO_TEST_CASE (timecode_test)