summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/pixel_quanta.cc7
-rw-r--r--src/lib/pixel_quanta.h2
-rw-r--r--src/lib/player.cc17
-rw-r--r--src/lib/player_video.cc7
-rw-r--r--src/lib/util.cc3
-rw-r--r--src/lib/util.h11
-rw-r--r--src/lib/video_content.cc2
-rw-r--r--src/lib/video_content.h5
8 files changed, 43 insertions, 11 deletions
diff --git a/src/lib/pixel_quanta.cc b/src/lib/pixel_quanta.cc
index 09e684064..7c1d285cf 100644
--- a/src/lib/pixel_quanta.cc
+++ b/src/lib/pixel_quanta.cc
@@ -53,6 +53,13 @@ PixelQuanta::round_y (int y_) const
}
+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)
{
diff --git a/src/lib/pixel_quanta.h b/src/lib/pixel_quanta.h
index c37ba189b..018ce3346 100644
--- a/src/lib/pixel_quanta.h
+++ b/src/lib/pixel_quanta.h
@@ -26,6 +26,7 @@
#include "warnings.h"
#include <libcxml/cxml.h>
+#include <dcp/types.h>
DCPOMATIC_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
DCPOMATIC_ENABLE_WARNINGS
@@ -54,6 +55,7 @@ public:
int round_x (int x_) const;
int round_y (int y_) const;
+ dcp::Size round (dcp::Size size) const;
int x;
int y;
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 285126ced..b93bf3f4a 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -920,16 +920,23 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
}
}
+ auto const content_video = piece->content->video;
+
_last_video[wp] = std::make_shared<PlayerVideo>(
video.image,
- piece->content->video->actual_crop(),
- piece->content->video->fade (_film, video.frame),
- scale_for_display(piece->content->video->scaled_size(_film->frame_size()), _video_container_size, _film->frame_size()),
+ content_video->actual_crop(),
+ content_video->fade (_film, video.frame),
+ scale_for_display(
+ content_video->scaled_size(_film->frame_size()),
+ _video_container_size,
+ _film->frame_size(),
+ content_video->pixel_quanta()
+ ),
_video_container_size,
video.eyes,
video.part,
- piece->content->video->colour_conversion(),
- piece->content->video->range(),
+ content_video->colour_conversion(),
+ content_video->range(),
piece->content,
video.frame,
false
diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc
index c9bc2dcde..4cc536bb7 100644
--- a/src/lib/player_video.cc
+++ b/src/lib/player_video.cc
@@ -345,7 +345,12 @@ PlayerVideo::reset_metadata (shared_ptr<const Film> film, dcp::Size player_video
_crop = content->video->actual_crop();
_fade = content->video->fade(film, _video_frame.get());
- _inter_size = scale_for_display(content->video->scaled_size(film->frame_size()), player_video_container_size, film->frame_size());
+ _inter_size = scale_for_display(
+ content->video->scaled_size(film->frame_size()),
+ player_video_container_size,
+ film->frame_size(),
+ content->video->pixel_quanta()
+ );
_out_size = player_video_container_size;
_colour_conversion = content->video->colour_conversion();
_video_range = content->video->range();
diff --git a/src/lib/util.cc b/src/lib/util.cc
index d3af74376..78ed8da99 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -1111,7 +1111,7 @@ linear_to_db (double linear)
dcp::Size
-scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container)
+scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta)
{
/* Now scale it down if the display container is smaller than the film container */
if (display_container != film_container) {
@@ -1122,6 +1122,7 @@ scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_cont
s.width = lrintf (s.width * scale);
s.height = lrintf (s.height * scale);
+ s = quanta.round (s);
}
return s;
diff --git a/src/lib/util.h b/src/lib/util.h
index 013eabe12..10c5678ff 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -18,16 +18,20 @@
*/
+
/** @file src/util.h
* @brief Some utility functions and classes.
*/
+
#ifndef DCPOMATIC_UTIL_H
#define DCPOMATIC_UTIL_H
-#include "types.h"
-#include "dcpomatic_time.h"
+
#include "audio_mapping.h"
+#include "dcpomatic_time.h"
+#include "pixel_quanta.h"
+#include "types.h"
#include <dcp/atmos_asset.h>
#include <dcp/decrypted_kdm.h>
#include <dcp/util.h>
@@ -41,6 +45,7 @@
#undef check
+
namespace dcp {
class PictureAsset;
class SoundAsset;
@@ -119,7 +124,7 @@ extern std::string day_of_week_to_string (boost::gregorian::greg_weekday d);
extern void emit_subtitle_image (dcpomatic::ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, std::shared_ptr<TextDecoder> decoder);
extern bool show_jobs_on_console (bool progress);
extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)>);
-extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container);
+extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta);
extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm);
extern boost::filesystem::path default_font_file ();
extern std::string to_upper (std::string s);
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 0ef102116..9ff35ffdf 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -655,7 +655,7 @@ VideoContent::scaled_size (dcp::Size film_container)
_legacy_ratio = boost::optional<float>();
}
- return auto_size;
+ return _pixel_quanta.round (auto_size);
}
diff --git a/src/lib/video_content.h b/src/lib/video_content.h
index ce645bb41..2adf941d9 100644
--- a/src/lib/video_content.h
+++ b/src/lib/video_content.h
@@ -183,6 +183,11 @@ public:
return _range;
}
+ PixelQuanta pixel_quanta () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ return _pixel_quanta;
+ }
+
bool use () const {
boost::mutex::scoped_lock lm (_mutex);
return _use;