We need to round the container size to the nearest multiple of 2
so that cropping subsampled sources does not leave gaps. As far
as I can see:
- the direction that you round x in doesn't matter
- it's better to round y up
(if you calculate the error in the resulting ratio in each case).
}
auto size = size_after_crop ();
- size.width *= _sample_aspect_ratio.get_value_or(1);
+ size.width = std::lrint(size.width * _sample_aspect_ratio.get_value_or(1));
/* This is what we will return unless there is any legacy stuff to take into account */
auto auto_size = fit_ratio_within (size.ratio(), film_container);
out_size.width = max (64, out_size.width);
out_size.height = max (64, out_size.height);
+ /* Make sure the video container sizes are always a multiple of 2 so that
+ * we don't get gaps with subsampled sources (e.g. YUV420)
+ */
+ if (out_size.width % 2) {
+ out_size.width++;
+ }
+ if (out_size.height % 2) {
+ out_size.height++;
+ }
+
_player->set_video_container_size (out_size);
}