Rename Time::round_up to Time::ceil.
authorCarl Hetherington <cth@carlh.net>
Wed, 4 Jan 2017 01:28:54 +0000 (01:28 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 4 Jan 2017 01:28:54 +0000 (01:28 +0000)
src/lib/content.cc
src/lib/dcpomatic_time.h
src/lib/ffmpeg.cc
src/lib/film.cc
test/reels_test.cc
test/seek_zero_test.cc
test/util_test.cc

index b5bae69b684f8a57c50a94dc96803ee74571c15a..942e9e533c8535b852af35df0b2108da5d8951fa 100644 (file)
@@ -327,7 +327,7 @@ Content::reel_split_points () const
 {
        list<DCPTime> 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;
 }
 
index 893bce2572e21752a1de59f6dcdb43f9eb8a0ca4..6834ee099616a94c273175fa8323378f8372fd14 100644 (file)
@@ -118,7 +118,7 @@ public:
         *  at some sampling rate.
         *  @param r Sampling rate.
         */
-       Time<S, O> round_up (float r) const {
+       Time<S, O> ceil (float r) const {
                Type const n = llrintf (HZ / r);
                Type const a = _t + n - 1;
                return Time<S, O> (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;
index af6c8e1674e66c12b01dcafbbc2f428ddc96d561..ce87cc14f2d7801f2974202008012f624b09d1ae 100644 (file)
@@ -381,7 +381,7 @@ FFmpeg::pts_offset (vector<shared_ptr<FFmpegAudioStream> > 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;
index d331516dd1e9cac9c7b9b979975a1d4578927266..68266b4ec52a3a4f4825eaeb5cd3e5073081052e 100644 (file)
@@ -1416,7 +1416,7 @@ list<DCPTimePeriod>
 Film::reels () const
 {
        list<DCPTimePeriod> p;
-       DCPTime const len = length().round_up (video_frame_rate ());
+       DCPTime const len = length().ceil (video_frame_rate ());
 
        switch (reel_type ()) {
        case REELTYPE_SINGLE:
index 51cb1f2005dcbe655036bbedc3455a4b8ee71d9c..1951d53748a8f9b4cfeda161c8b83fb3d0fd6bed 100644 (file)
@@ -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;
index faf4c9eac7c35ad5521d5ebb7e7a609446369761..0329364d97ed6a555f8c10859bbe6fcff1bcaf14 100644 (file)
@@ -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<ContentVideo> a = decoder.video->get (first_frame, true);
index 6abc9b5e727273ca9a250939efc287e26d1e584f..c7bf9944d926e90fe037c58f89340a4daf44789e 100644 (file)
@@ -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)