}
+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)
{
#include "warnings.h"
#include <libcxml/cxml.h>
+#include <dcp/types.h>
DCPOMATIC_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
DCPOMATIC_ENABLE_WARNINGS
int round_x (int x_) const;
int round_y (int y_) const;
+ dcp::Size round (dcp::Size size) const;
int x;
int y;
}
}
+ 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
_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();
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) {
s.width = lrintf (s.width * scale);
s.height = lrintf (s.height * scale);
+ s = quanta.round (s);
}
return s;
*/
+
/** @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>
#undef check
+
namespace dcp {
class PictureAsset;
class SoundAsset;
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);
_legacy_ratio = boost::optional<float>();
}
- return auto_size;
+ return _pixel_quanta.round (auto_size);
}
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;