diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-05-02 20:20:32 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-05-02 20:20:32 +0100 |
| commit | ae15eeca8588c6928d7671894db98c2e289fa601 (patch) | |
| tree | d284aff5b975d57c3a69926634f2259a8828583e /src | |
| parent | a38095fc533b2620e375695024beca5f5540b10d (diff) | |
Remove approximate size stuff where playback viewer would round
down to nearest 4 pixels to try and speed up scaling. It didn't
work as the two estimates of what would be scaled didn't always
agree. It could probably be resurrected.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/film.cc | 2 | ||||
| -rw-r--r-- | src/lib/image_filename_sorter.cc | 1 | ||||
| -rw-r--r-- | src/lib/player.cc | 9 | ||||
| -rw-r--r-- | src/lib/player.h | 2 | ||||
| -rw-r--r-- | src/lib/util.cc | 6 | ||||
| -rw-r--r-- | src/lib/util.h | 2 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/video_content_scale.cc | 10 | ||||
| -rw-r--r-- | src/lib/video_content_scale.h | 2 | ||||
| -rw-r--r-- | src/wx/film_viewer.cc | 8 |
10 files changed, 13 insertions, 31 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 3cdaeb48a..80755a4cb 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1041,7 +1041,7 @@ Film::full_frame () const dcp::Size Film::frame_size () const { - return fit_ratio_within (container()->ratio(), full_frame (), 1); + return fit_ratio_within (container()->ratio(), full_frame ()); } dcp::EncryptedKDM diff --git a/src/lib/image_filename_sorter.cc b/src/lib/image_filename_sorter.cc index 805c469b0..0cb6adc6b 100644 --- a/src/lib/image_filename_sorter.cc +++ b/src/lib/image_filename_sorter.cc @@ -30,7 +30,6 @@ public: boost::optional<int> na = extract_number (a); boost::optional<int> nb = extract_number (b); if (!na || !nb) { - std::cout << a << " " << b << " " << (a.string() < b.string()) << "\n"; return a.string() < b.string(); } diff --git a/src/lib/player.cc b/src/lib/player.cc index 495d20533..436ae3fe8 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -71,7 +71,6 @@ Player::Player (shared_ptr<const Film> f, shared_ptr<const Playlist> p) : _film (f) , _playlist (p) , _have_valid_pieces (false) - , _approximate_size (false) , _ignore_video (false) { _playlist_changed_connection = _playlist->Changed.connect (bind (&Player::playlist_changed, this)); @@ -295,12 +294,6 @@ Player::transform_image_subtitles (list<ImageSubtitle> subs) const return all; } -void -Player::set_approximate_size () -{ - _approximate_size = true; -} - shared_ptr<PlayerVideo> Player::black_player_video_frame (DCPTime time) const { @@ -352,7 +345,7 @@ Player::get_video (DCPTime time, bool accurate) return pvf; } - dcp::Size image_size = content->scale().size (content, _video_container_size, _film->frame_size (), _approximate_size ? 4 : 1); + dcp::Size image_size = content->scale().size (content, _video_container_size, _film->frame_size ()); for (list<ContentVideo>::const_iterator i = content_video.begin(); i != content_video.end(); ++i) { pvf.push_back ( diff --git a/src/lib/player.h b/src/lib/player.h index 01439a26f..d8b13ee7b 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -92,7 +92,6 @@ public: std::list<boost::shared_ptr<Font> > get_subtitle_fonts (); void set_video_container_size (dcp::Size); - void set_approximate_size (); void set_ignore_video (); PlayerStatistics const & statistics () const; @@ -157,7 +156,6 @@ private: dcp::Size _video_container_size; boost::shared_ptr<Image> _black_image; - bool _approximate_size; /** true if the player should ignore all video; i.e. never produce any */ bool _ignore_video; diff --git a/src/lib/util.cc b/src/lib/util.cc index 08683fb7e..bffbe90d4 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -546,13 +546,13 @@ tidy_for_filename (string f) } dcp::Size -fit_ratio_within (float ratio, dcp::Size full_frame, int round) +fit_ratio_within (float ratio, dcp::Size full_frame) { if (ratio < full_frame.ratio ()) { - return dcp::Size (round_to (full_frame.height * ratio, round), full_frame.height); + return dcp::Size (rint (full_frame.height * ratio), full_frame.height); } - return dcp::Size (full_frame.width, round_to (full_frame.width / ratio, round)); + return dcp::Size (full_frame.width, rint (full_frame.width / ratio)); } void * diff --git a/src/lib/util.h b/src/lib/util.h index bf1d0265b..c1f7a78c7 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -69,7 +69,7 @@ extern bool valid_j2k_file (boost::filesystem::path); extern boost::filesystem::path mo_path (); #endif extern std::string tidy_for_filename (std::string); -extern dcp::Size fit_ratio_within (float ratio, dcp::Size, int); +extern dcp::Size fit_ratio_within (float ratio, dcp::Size); extern int dcp_audio_frame_rate (int); extern int stride_round_up (int, int const *, int); extern int round_to (float n, int r); diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index bfbcef9bf..68db672f1 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -540,7 +540,7 @@ VideoContent::processing_description () const DCPOMATIC_ASSERT (film); dcp::Size const container_size = film->frame_size (); - dcp::Size const scaled = scale().size (dynamic_pointer_cast<const VideoContent> (shared_from_this ()), container_size, container_size, 1); + dcp::Size const scaled = scale().size (dynamic_pointer_cast<const VideoContent> (shared_from_this ()), container_size, container_size); if (scaled != video_size_after_crop ()) { d << String::compose ( diff --git a/src/lib/video_content_scale.cc b/src/lib/video_content_scale.cc index 14db7b02f..59ff4bd9b 100644 --- a/src/lib/video_content_scale.cc +++ b/src/lib/video_content_scale.cc @@ -127,22 +127,22 @@ VideoContentScale::from_id (string id) * @param film_container The size of the film's image. */ dcp::Size -VideoContentScale::size (shared_ptr<const VideoContent> c, dcp::Size display_container, dcp::Size film_container, int round) const +VideoContentScale::size (shared_ptr<const VideoContent> c, dcp::Size display_container, dcp::Size film_container) const { /* Work out the size of the content if it were put inside film_container */ - dcp::Size video_size_after_crop = c->video_size_after_crop (); - + dcp::Size const video_size_after_crop = c->video_size_after_crop (); + dcp::Size size; if (_ratio) { /* Stretch to fit the requested ratio */ - size = fit_ratio_within (_ratio->ratio (), film_container, round); + size = fit_ratio_within (_ratio->ratio (), film_container); } else if (_scale || video_size_after_crop.width > film_container.width || video_size_after_crop.height > film_container.height) { /* Scale, preserving aspect ratio; this is either if we have been asked to scale with no stretch or if the unscaled content is too big for film_container. */ - size = fit_ratio_within (video_size_after_crop.ratio(), film_container, round); + size = fit_ratio_within (video_size_after_crop.ratio(), film_container); } else { /* No stretch nor scale */ size = video_size_after_crop; diff --git a/src/lib/video_content_scale.h b/src/lib/video_content_scale.h index 3053dda43..74e91e78f 100644 --- a/src/lib/video_content_scale.h +++ b/src/lib/video_content_scale.h @@ -43,7 +43,7 @@ public: VideoContentScale (bool); VideoContentScale (boost::shared_ptr<cxml::Node>); - dcp::Size size (boost::shared_ptr<const VideoContent>, dcp::Size display_container, dcp::Size film_container, int round) const; + dcp::Size size (boost::shared_ptr<const VideoContent>, dcp::Size display_container, dcp::Size film_container) const; std::string id () const; std::string name () const; void as_xml (xmlpp::Node *) const; diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index a1cc5dfc4..311ec734c 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -147,7 +147,6 @@ FilmViewer::set_film (shared_ptr<Film> f) _film_connection = _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1)); - _player->set_approximate_size (); _player_connection = _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1)); calculate_sizes (); @@ -320,13 +319,6 @@ FilmViewer::calculate_sizes () _out_size.width = max (64, _out_size.width); _out_size.height = max (64, _out_size.height); - /* The player will round its image size down to the next lowest 4 pixels - to speed up its scale, so do similar here to avoid black borders - around things. This is a bit of a hack. - */ - _out_size.width &= ~3; - _out_size.height &= ~3; - _player->set_video_container_size (_out_size); } |
