TIMING ("adding to queue of %1", _queue.size ());
_queue.push_back (shared_ptr<DCPVideoFrame> (
new DCPVideoFrame (
- image->image(), _video_frames_out, eyes, conversion, _film->video_frame_rate(),
+ image->image(PIX_FMT_RGB24, false), _video_frames_out, eyes, conversion, _film->video_frame_rate(),
_film->j2k_bandwidth(), _film->log()
)
));
#include "image.h"
#include "exceptions.h"
#include "scaler.h"
+#include "timer.h"
using std::string;
using std::min;
libdcp::Size cropped_size = crop.apply (size ());
struct SwsContext* scale_context = sws_getContext (
- cropped_size.width, cropped_size.height, pixel_format(),
- inter_size.width, inter_size.height, out_format,
- scaler->ffmpeg_id (), 0, 0, 0
+ cropped_size.width, cropped_size.height, pixel_format(),
+ inter_size.width, inter_size.height, out_format,
+ scaler->ffmpeg_id (), 0, 0, 0
);
uint8_t* scale_in_data[components()];
, _audio_merger (f->audio_channels(), bind (&Film::time_to_audio_frames, f.get(), _1), bind (&Film::audio_frames_to_time, f.get(), _1))
, _last_emit_was_black (false)
, _just_did_inaccurate_seek (false)
+ , _approximate_size (false)
{
_playlist_changed_connection = _playlist->Changed.connect (bind (&Player::playlist_changed, this));
_playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Player::content_changed, this, _1, _2, _3));
}
float const ratio = content->ratio() ? content->ratio()->ratio() : content->video_size_after_crop().ratio();
- libdcp::Size const image_size = fit_ratio_within (ratio, _video_container_size);
+ libdcp::Size image_size = fit_ratio_within (ratio, _video_container_size);
+ if (_approximate_size) {
+ image_size.width &= ~3;
+ image_size.height &= ~3;
+ }
shared_ptr<PlayerImage> pi (
new PlayerImage (
return true;
}
+void
+Player::set_approximate_size ()
+{
+ _approximate_size = true;
+}
+
+
PlayerImage::PlayerImage (
shared_ptr<const Image> in,
Crop crop,
}
shared_ptr<Image>
-PlayerImage::image ()
+PlayerImage::image (AVPixelFormat format, bool aligned)
{
- shared_ptr<Image> out = _in->crop_scale_window (_crop, _inter_size, _out_size, _scaler, PIX_FMT_RGB24, false);
-
+ shared_ptr<Image> out = _in->crop_scale_window (_crop, _inter_size, _out_size, _scaler, format, aligned);
+
Position<int> const container_offset ((_out_size.width - _inter_size.width) / 2, (_out_size.height - _inter_size.width) / 2);
if (_subtitle_image) {
return out;
}
+
void set_subtitle (boost::shared_ptr<const Image>, Position<int>);
- boost::shared_ptr<Image> image ();
+ boost::shared_ptr<Image> image (AVPixelFormat, bool);
private:
boost::shared_ptr<const Image> _in;
}
void set_video_container_size (libdcp::Size);
+ void set_approximate_size ();
bool repeat_last_video ();
} _last_incoming_video;
bool _just_did_inaccurate_seek;
+ bool _approximate_size;
boost::signals2::scoped_connection _playlist_changed_connection;
boost::signals2::scoped_connection _playlist_content_changed_connection;
void
process_video (shared_ptr<PlayerImage> image, Eyes eyes, ColourConversion conversion, DCPTime)
{
- shared_ptr<DCPVideoFrame> local (new DCPVideoFrame (image->image(), frame, eyes, conversion, film->video_frame_rate(), 250000000, log_));
- shared_ptr<DCPVideoFrame> remote (new DCPVideoFrame (image->image(), frame, eyes, conversion, film->video_frame_rate(), 250000000, log_));
+ shared_ptr<DCPVideoFrame> local (
+ new DCPVideoFrame (image->image (PIX_FMT_RGB24, false), frame, eyes, conversion, film->video_frame_rate(), 250000000, log_)
+ );
+
+ shared_ptr<DCPVideoFrame> remote (
+ new DCPVideoFrame (image->image (PIX_FMT_RGB24, false), frame, eyes, conversion, film->video_frame_rate(), 250000000, log_)
+ );
cout << "Frame " << frame << ": ";
cout.flush ();
#include "lib/player.h"
#include "lib/video_content.h"
#include "lib/video_decoder.h"
+#include "lib/timer.h"
#include "film_viewer.h"
#include "wx_util.h"
_player = f->make_player ();
_player->disable_audio ();
+ _player->set_approximate_size ();
_player->Video.connect (boost::bind (&FilmViewer::process_video, this, _1, _2, _5));
_player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1));
if (eyes == EYES_RIGHT) {
return;
}
-
- _frame = image->image ();
+
+ /* Going via BGRA here makes the scaler faster then using RGB24 directly (about
+ twice on x86 Linux).
+ */
+ shared_ptr<Image> im = image->image (PIX_FMT_BGRA, true);
+ _frame = im->scale (im->size(), Scaler::from_id ("fastbilinear"), PIX_FMT_RGB24, false);
_got_frame = true;
set_position_text (t);
{
Video v;
v.content = _player->_last_video;
- v.image = i->image ();
+ v.image = i->image (PIX_FMT_RGB24, false);
v.time = t;
_queue.push_front (v);
}