summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-10-08 21:32:05 +0200
committerCarl Hetherington <cth@carlh.net>2022-10-18 20:25:57 +0200
commit8293be30989a5fc02e54622b7c9b5c5ff6d7644b (patch)
tree84c698bb114d03fd68b671161e26662c5236c98c
parentef32f407557e22662b41f9852f68523952360e4b (diff)
Use a colorspace filter when previewing Rec.2020 content with the simple viewer.
-rw-r--r--src/wx/simple_video_view.cc10
-rw-r--r--src/wx/simple_video_view.h7
2 files changed, 16 insertions, 1 deletions
diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc
index 00d81ab47..09c172171 100644
--- a/src/wx/simple_video_view.cc
+++ b/src/wx/simple_video_view.cc
@@ -26,6 +26,8 @@
#include "lib/butler.h"
#include "lib/dcpomatic_log.h"
#include "lib/image.h"
+#include "lib/video_filter_graph.h"
+#include "lib/video_filter_graph_set.h"
#include <dcp/util.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
@@ -46,6 +48,8 @@ using namespace dcpomatic;
SimpleVideoView::SimpleVideoView (FilmViewer* viewer, wxWindow* parent)
: VideoView (viewer)
+ , _rec2020_filter("convert", "convert", "", "colorspace=all=bt709:iall=bt2020")
+ , _rec2020_filter_graph({ &_rec2020_filter }, dcp::Fraction(24, 1))
{
_panel = new wxPanel (parent);
@@ -241,7 +245,11 @@ SimpleVideoView::update ()
_state_timer.set ("get image");
- _image = player_video().first->image(boost::bind(&PlayerVideo::force, AV_PIX_FMT_RGB24), VideoRange::FULL, true);
+ auto const pv = player_video();
+ _image = pv.first->image(boost::bind(&PlayerVideo::force, AV_PIX_FMT_RGB24), VideoRange::FULL, true);
+ if (pv.first->colour_conversion() && pv.first->colour_conversion()->about_equal(dcp::ColourConversion::rec2020_to_xyz(), 1e-6)) {
+ _image = Image::ensure_alignment(_rec2020_filter_graph.get(_image->size(), _image->pixel_format())->process(_image).front(), Image::Alignment::COMPACT);
+ }
_state_timer.set ("ImageChanged");
_viewer->image_changed (player_video().first);
diff --git a/src/wx/simple_video_view.h b/src/wx/simple_video_view.h
index 7a48f8ef8..e19068979 100644
--- a/src/wx/simple_video_view.h
+++ b/src/wx/simple_video_view.h
@@ -20,14 +20,18 @@
#include "video_view.h"
+#include "lib/filter.h"
#include "lib/position.h"
+#include "lib/video_filter_graph_set.h"
#include <dcp/types.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/wx.h>
LIBDCP_ENABLE_WARNINGS
+
class FilmViewer;
+class Filter;
class SimpleVideoView : public VideoView
@@ -53,4 +57,7 @@ private:
wxTimer _timer;
Position<int> _inter_position;
dcp::Size _inter_size;
+
+ Filter _rec2020_filter;
+ VideoFilterGraphSet _rec2020_filter_graph;
};