From: Carl Hetherington Date: Sat, 8 Oct 2022 19:32:05 +0000 (+0200) Subject: Use a colorspace filter when previewing Rec.2020 content with the simple viewer. X-Git-Tag: v2.16.31~8^2~5 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=8293be30989a5fc02e54622b7c9b5c5ff6d7644b Use a colorspace filter when previewing Rec.2020 content with the simple viewer. --- 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 #include 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 #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS + class FilmViewer; +class Filter; class SimpleVideoView : public VideoView @@ -53,4 +57,7 @@ private: wxTimer _timer; Position _inter_position; dcp::Size _inter_size; + + Filter _rec2020_filter; + VideoFilterGraphSet _rec2020_filter_graph; };