Don't scale chroma subsampled images to sizes that don't align with the subsampling...
[dcpomatic.git] / src / lib / pixel_quanta.cc
index 12eea5031a606a88427233b631f30822dde4cba2..7c1d285cffd3d0c1b55b0384f73cc582b10cd135 100644 (file)
@@ -39,6 +39,27 @@ PixelQuanta::as_xml (xmlpp::Element* node) const
 }
 
 
+int
+PixelQuanta::round_x (int x_) const
+{
+       return x_ - (x_ % x);
+}
+
+
+int
+PixelQuanta::round_y (int y_) const
+{
+       return y_ - (y_ % y);
+}
+
+
+dcp::Size
+PixelQuanta::round (dcp::Size size) const
+{
+       return dcp::Size (round_x(size.width), round_y(size.height));
+}
+
+
 PixelQuanta
 max (PixelQuanta const& a, PixelQuanta const& b)
 {