* 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));
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 */
}
private:
- friend struct dcptime_round_up_test;
+ friend struct dcptime_ceil_test;
Type _t;
static const int HZ = 96000;
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;
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);
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)