t /= frc.speed_up;
}
- return rint (t);
+ return lrint (t);
}
string
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
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))
{
}
* @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));
}
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>
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
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");
}
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)))
);
}
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));
}
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 (
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
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;
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)
)
)
);
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 *
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;
void
Writer::set_encoder_threads (int threads)
{
- _maximum_frames_in_memory = rint (threads * 1.1);
+ _maximum_frames_in_memory = lrint (threads * 1.1);
}
long
if (panel_ratio < film_ratio) {
/* panel is less widscreen than the film; clamp width */
_out_size.width = _panel_size.width;
- _out_size.height = rint (_out_size.width / film_ratio);
+ _out_size.height = lrintf (_out_size.width / film_ratio);
} else {
/* panel is more widescreen than the film; clamp height */
_out_size.height = _panel_size.height;
- _out_size.width = rint (_out_size.height * film_ratio);
+ _out_size.width = lrintf (_out_size.height * film_ratio);
}
/* Catch silly values */
double const fps = _film->video_frame_rate ();
/* Count frame number from 1 ... not sure if this is the best idea */
- _frame_number->SetLabel (wxString::Format (wxT("%d"), int (rint (_position.seconds() * fps)) + 1));
+ _frame_number->SetLabel (wxString::Format (wxT("%d"), lrint (_position.seconds() * fps) + 1));
_timecode->SetLabel (time_to_timecode (_position, fps));
}
} else if (property == SubtitleContentProperty::SUBTITLE_Y_OFFSET) {
checked_set (_y_offset, scs ? (scs->subtitle_y_offset() * 100) : 0);
} else if (property == SubtitleContentProperty::SUBTITLE_X_SCALE) {
- checked_set (_x_scale, scs ? int (rint (scs->subtitle_x_scale() * 100)) : 100);
+ checked_set (_x_scale, scs ? lrint (scs->subtitle_x_scale() * 100) : 100);
} else if (property == SubtitleContentProperty::SUBTITLE_Y_SCALE) {
- checked_set (_y_scale, scs ? int (rint (scs->subtitle_y_scale() * 100)) : 100);
+ checked_set (_y_scale, scs ? lrint (scs->subtitle_y_scale() * 100) : 100);
} else if (property == SubtitleContentProperty::SUBTITLE_LANGUAGE) {
checked_set (_language, scs ? scs->subtitle_language() : "");
}
double mark_interval = rint (128 / pps);
if (mark_interval > 5) {
- mark_interval -= int (rint (mark_interval)) % 5;
+ mark_interval -= lrint (mark_interval) % 5;
}
if (mark_interval > 10) {
- mark_interval -= int (rint (mark_interval)) % 10;
+ mark_interval -= lrint (mark_interval) % 10;
}
if (mark_interval > 60) {
- mark_interval -= int (rint (mark_interval)) % 60;
+ mark_interval -= lrint (mark_interval) % 60;
}
if (mark_interval > 3600) {
- mark_interval -= int (rint (mark_interval)) % 3600;
+ mark_interval -= lrint (mark_interval) % 3600;
}
if (mark_interval < 1) {
w -= m * 60;
int const s = floor (w);
w -= s;
- int const f = rint (w * fps);
+ int const f = lrint (w * fps);
return wxString::Format (wxT("%02d:%02d:%02d.%02d"), h, m, s, f);
}
}
Frame audio_length () const {
- return rint (61.2942 * audio_stream()->frame_rate ());
+ return llrint (61.2942 * audio_stream()->frame_rate ());
}
};
/* The FrameRateChange within resampled_audio_frame_rate should choose to double-up
the 14.99 fps video to 30 and then run it slow at 25.
*/
- BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), rint (48000 * 2 * 14.99 / 25));
+ BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), lrint (48000 * 2 * 14.99 / 25));
}