diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-08-25 22:17:23 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-08-25 22:17:23 +0100 |
| commit | 1d68fe1e3ad1a9aa85fa7fc6071a0b8c64973953 (patch) | |
| tree | cbad95204bf34c95ef2e6c6f5963eff00b81f140 /src/lib | |
| parent | e386b94425586760374d8e1cb16be99af09cf07f (diff) | |
Purge rint() and use llrint and friends.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/audio_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/dcp_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/dcpomatic_time.cc | 4 | ||||
| -rw-r--r-- | src/lib/dcpomatic_time.h | 4 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 2 | ||||
| -rw-r--r-- | src/lib/image.cc | 8 | ||||
| -rw-r--r-- | src/lib/image_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/job.cc | 2 | ||||
| -rw-r--r-- | src/lib/player.cc | 4 | ||||
| -rw-r--r-- | src/lib/util.cc | 4 | ||||
| -rw-r--r-- | src/lib/video_content_scale.cc | 4 | ||||
| -rw-r--r-- | src/lib/writer.cc | 2 |
13 files changed, 21 insertions, 21 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 4d821ad60..5e14fb232 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -206,7 +206,7 @@ AudioContent::resampled_audio_frame_rate () const t /= frc.speed_up; } - return rint (t); + return lrint (t); } string diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index b1c9e3815..57c103e03 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -146,7 +146,7 @@ DCPContent::full_length () const shared_ptr<const Film> film = _film.lock (); DCPOMATIC_ASSERT (film); FrameRateChange const frc (video_frame_rate (), film->video_frame_rate ()); - return DCPTime::from_frames (rint (video_length () * frc.factor ()), film->video_frame_rate ()); + return DCPTime::from_frames (llrint (video_length () * frc.factor ()), film->video_frame_rate ()); } string diff --git a/src/lib/dcpomatic_time.cc b/src/lib/dcpomatic_time.cc index 3d4ed1139..6f8f5efa2 100644 --- a/src/lib/dcpomatic_time.cc +++ b/src/lib/dcpomatic_time.cc @@ -23,14 +23,14 @@ using std::ostream; template <> Time<ContentTimeDifferentiator, DCPTimeDifferentiator>::Time (DCPTime d, FrameRateChange f) - : _t (rint (d.get() * f.speed_up)) + : _t (llrint (d.get() * f.speed_up)) { } template <> Time<DCPTimeDifferentiator, ContentTimeDifferentiator>::Time (ContentTime d, FrameRateChange f) - : _t (rint (d.get() / f.speed_up)) + : _t (llrint (d.get() / f.speed_up)) { } diff --git a/src/lib/dcpomatic_time.h b/src/lib/dcpomatic_time.h index c1d27407a..ba3c8fcad 100644 --- a/src/lib/dcpomatic_time.h +++ b/src/lib/dcpomatic_time.h @@ -118,7 +118,7 @@ public: * @param r Sampling rate. */ Time<S, O> round_up (float r) { - Type const n = rint (HZ / r); + Type const n = llrintf (HZ / r); Type const a = _t + n - 1; return Time<S, O> (a - (a % n)); } @@ -180,7 +180,7 @@ public: static Time<S, O> from_seconds (double s) { - return Time<S, O> (rint (s * HZ)); + return Time<S, O> (llrint (s * HZ)); } template <class T> diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 071f98612..4e49e1254 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -281,7 +281,7 @@ FFmpegContent::full_length () const shared_ptr<const Film> film = _film.lock (); DCPOMATIC_ASSERT (film); FrameRateChange const frc (video_frame_rate (), film->video_frame_rate ()); - return DCPTime::from_frames (rint (video_length_after_3d_combine() * frc.factor()), film->video_frame_rate()); + return DCPTime::from_frames (llrint (video_length_after_3d_combine() * frc.factor()), film->video_frame_rate()); } void diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index a17419dc7..eab85c04e 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -418,7 +418,7 @@ FFmpegDecoder::decode_video_packet () double const pts = i->second * av_q2d (_format_context->streams[_video_stream]->time_base) + _pts_offset.seconds (); video ( shared_ptr<ImageProxy> (new RawImageProxy (image)), - rint (pts * _ffmpeg_content->video_frame_rate ()) + llrint (pts * _ffmpeg_content->video_frame_rate ()) ); } else { LOG_WARNING_NC ("Dropping frame without PTS"); diff --git a/src/lib/image.cc b/src/lib/image.cc index 0c7a0ef0d..fcdcca95a 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -76,8 +76,8 @@ Image::sample_size (int n) const } return dcp::Size ( - rint (ceil (static_cast<double>(size().width) / horizontal_factor)), - rint (ceil (static_cast<double>(size().height) / line_factor (n))) + lrint (ceil (static_cast<double>(size().width) / horizontal_factor)), + lrint (ceil (static_cast<double>(size().height) / line_factor (n))) ); } @@ -166,7 +166,7 @@ Image::crop_scale_window ( round down so that we don't crop a subsampled pixel until we've cropped all of its Y-channel pixels. */ - int const x = int (rint (bytes_per_pixel(c) * crop.left)) & ~ ((int) desc->log2_chroma_w); + int const x = lrintf (bytes_per_pixel(c) * crop.left) & ~ ((int) desc->log2_chroma_w); scale_in_data[c] = data()[c] + x + stride()[c] * (crop.top / line_factor(c)); } @@ -175,7 +175,7 @@ Image::crop_scale_window ( uint8_t* scale_out_data[out->planes()]; for (int c = 0; c < out->planes(); ++c) { - scale_out_data[c] = out->data()[c] + int (rint (out->bytes_per_pixel(c) * corner.x)) + out->stride()[c] * corner.y; + scale_out_data[c] = out->data()[c] + lrintf (out->bytes_per_pixel(c) * corner.x) + out->stride()[c] * corner.y; } sws_scale ( diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index 920d7ae54..87aa1d66d 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -142,7 +142,7 @@ ImageContent::full_length () const shared_ptr<const Film> film = _film.lock (); DCPOMATIC_ASSERT (film); FrameRateChange const frc (video_frame_rate(), film->video_frame_rate()); - return DCPTime::from_frames (rint (video_length_after_3d_combine() * frc.factor ()), film->video_frame_rate ()); + return DCPTime::from_frames (llrint (video_length_after_3d_combine() * frc.factor ()), film->video_frame_rate ()); } string diff --git a/src/lib/job.cc b/src/lib/job.cc index 25a533654..d9715aa18 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -332,7 +332,7 @@ Job::status () const SafeStringStream s; if (!finished () && p) { - int pc = rint (p.get() * 100); + int pc = lrintf (p.get() * 100); if (pc == 100) { /* 100% makes it sound like we've finished when we haven't */ pc = 99; diff --git a/src/lib/player.cc b/src/lib/player.cc index c51f80067..a40c65cd5 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -293,8 +293,8 @@ Player::transform_image_subtitles (list<ImageSubtitle> subs) const true ), Position<int> ( - rint (_video_container_size.width * i->rectangle.x), - rint (_video_container_size.height * i->rectangle.y) + lrint (_video_container_size.width * i->rectangle.x), + lrint (_video_container_size.height * i->rectangle.y) ) ) ); diff --git a/src/lib/util.cc b/src/lib/util.cc index 76e76328d..bccc368da 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -539,10 +539,10 @@ dcp::Size fit_ratio_within (float ratio, dcp::Size full_frame) { if (ratio < full_frame.ratio ()) { - return dcp::Size (rint (full_frame.height * ratio), full_frame.height); + return dcp::Size (lrintf (full_frame.height * ratio), full_frame.height); } - return dcp::Size (full_frame.width, rint (full_frame.width / ratio)); + return dcp::Size (full_frame.width, lrintf (full_frame.width / ratio)); } void * diff --git a/src/lib/video_content_scale.cc b/src/lib/video_content_scale.cc index c8c295361..aae135311 100644 --- a/src/lib/video_content_scale.cc +++ b/src/lib/video_content_scale.cc @@ -155,8 +155,8 @@ VideoContentScale::size (shared_ptr<const VideoContent> c, dcp::Size display_con float (display_container.height) / film_container.height ); - size.width = rint (size.width * scale); - size.height = rint (size.height * scale); + size.width = lrintf (size.width * scale); + size.height = lrintf (size.height * scale); } return size; diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 053c18451..b7c85c2ae 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -770,7 +770,7 @@ operator== (QueueItem const & a, QueueItem const & b) void Writer::set_encoder_threads (int threads) { - _maximum_frames_in_memory = rint (threads * 1.1); + _maximum_frames_in_memory = lrint (threads * 1.1); } long |
