X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fimage.cc;h=a327c3f855356ace8dacede031fabae880618941;hb=1dab4d3d084eda74612a3ebf0688ebc6fda7e78b;hp=0c7a0ef0da26bfad6ea20f96ec2a5316af678a9a;hpb=a978f3ac575f1af017002c861480d5203cf0a34e;p=dcpomatic.git diff --git a/src/lib/image.cc b/src/lib/image.cc index 0c7a0ef0d..a327c3f85 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -32,6 +32,7 @@ extern "C" { #include #include #include +#include } #include @@ -76,8 +77,8 @@ Image::sample_size (int n) const } return dcp::Size ( - rint (ceil (static_cast(size().width) / horizontal_factor)), - rint (ceil (static_cast(size().height) / line_factor (n))) + lrint (ceil (static_cast(size().width) / horizontal_factor)), + lrint (ceil (static_cast(size().height) / line_factor (n))) ); } @@ -166,7 +167,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 +176,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 (