From 71e36fcc75dbf4db92276dd7f2ca25d0db996cc4 Mon Sep 17 00:00:00 2001 From: follower Date: Wed, 1 May 2019 22:27:49 +1200 Subject: [PATCH 1/3] Remove `makeCurrent()` call that sometimes causes blank previewers. See: --- ui/viewerwidget.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui/viewerwidget.cpp b/ui/viewerwidget.cpp index fa95624cf..05d43e50e 100644 --- a/ui/viewerwidget.cpp +++ b/ui/viewerwidget.cpp @@ -545,8 +545,6 @@ void ViewerWidget::paintGL() { tex_lock->lock(); - makeCurrent(); - // clear to solid black glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); From ddb57dcb6a9ea9146cd773fc2d1ad1f0d5005f2c Mon Sep 17 00:00:00 2001 From: follower Date: Wed, 1 May 2019 22:31:17 +1200 Subject: [PATCH 2/3] Fix to work w/ Qt 5.6+ removes non-critical `setDesktopFileName()`. --- main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.cpp b/main.cpp index 2cf002480..18b1adb67 100644 --- a/main.cpp +++ b/main.cpp @@ -125,7 +125,10 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("olivevideoeditor.org"); QCoreApplication::setOrganizationDomain("olivevideoeditor.org"); QCoreApplication::setApplicationName("Olive"); + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) QGuiApplication::setDesktopFileName("org.olivevideoeditor.Olive"); +#endif MainWindow w(nullptr); From f1ff4a90472e2c920b326fd1a2a562f674c30082 Mon Sep 17 00:00:00 2001 From: Troy James Sobotka Date: Wed, 1 May 2019 21:31:54 -0700 Subject: [PATCH 3/3] Update coefficients to use REC.709 While still not colour managed, and grossly assuming REC.709 display referred buffers, the effect as it currently stands can be improved to use the proper coefficients for REC.709, as opposed to legacy REC.601. Ideally there'd be a flag somewhere to flip between the two coefficient sets. --- effects/shaders/chromakey.frag | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/effects/shaders/chromakey.frag b/effects/shaders/chromakey.frag index 4f57d8b1e..ea062307f 100644 --- a/effects/shaders/chromakey.frag +++ b/effects/shaders/chromakey.frag @@ -12,22 +12,26 @@ uniform float tola; uniform float tolb; uniform bool opt; uniform int mode; - -float rgb2y (vec3 c) { - /*a utility function to convert colors in RGB into YCbCr*/ - return (0.299*c.r + 0.587*c.g + 0.114*c.b); -} - + +// This isn’t colour managed and is a huge mess, but in the +// short term, using correct weights will give significantly +// more ideal results. The correct weights for REC.709 are +// 0.2126 R, 0.7152 G, and 0.722 B. Easy change. +// The coefficients for YCbCr are calculated off of the +// REC.709 values. + return (0.2126*c.r + 0.7152*c.g + 0.0722*c.b); +} + float rgb2cb (vec3 c) { /*a utility function to convert colors in RGB into YCbCr*/ - return (0.5 + -0.168736*c.r - 0.331264*c.g + 0.5*c.b); -} - + return (0.5 + -0.1145721061*c.r - 0.3854278939*c.g + 0.5*c.b); +} + float rgb2cr (vec3 c) { /*a utility function to convert colors in RGB into YCbCr*/ - return (0.5 + 0.5*c.r - 0.418688*c.g - 0.081312*c.b); -} - + return (0.5 + 0.5*c.r - 0.4541529083*c.g - 0.0458470917*c.b); +} + float colorclose(float Cb_p,float Cr_p,float Cb_key,float Cr_key,float tola,float tolb) { /*decides if a color is close to the specified hue*/ float temp = sqrt(((Cb_key-Cb_p)*(Cb_key-Cb_p))+((Cr_key-Cr_p)*(Cr_key-Cr_p))); @@ -35,7 +39,7 @@ float colorclose(float Cb_p,float Cr_p,float Cb_key,float Cr_key,float tola,floa if (temp < tolb) {return ((temp-tola)/(tolb-tola));} return (1.0); } - + void main(void) { float cb_key = rgb2cb(key_color); float cr_key = rgb2cr(key_color); @@ -62,4 +66,4 @@ void main(void) { } gl_FragColor = texture_color; -} \ No newline at end of file +}