summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2018-05-23 16:02:50 +0200
committerSzabolcs David <davidsz@inf.u-szeged.hu>2018-05-23 14:54:55 +0000
commit3fd1031c425204b8d92c69528277bfbd7912e8e7 (patch)
tree4a57665a9e82ab6f7dd950030cc2f0c588df9447
parent8c58226c05785151455a046b7a2737e032fbe70f (diff)
Fix color space conversion of YUV video nodes
YUV to RGB color conversion was not working, because the provided ColorSpace object was invalid. According to gl_renderer.cc, invalid color spaces should be treated as REC709. Task-number: QTBUG-68174 Change-Id: I1ad3b74ced4734e048256c075c953e9218ca6b6c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/core/yuv_video_node.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/yuv_video_node.cpp b/src/core/yuv_video_node.cpp
index ebde2e005..4a436d952 100644
--- a/src/core/yuv_video_node.cpp
+++ b/src/core/yuv_video_node.cpp
@@ -56,7 +56,7 @@ namespace QtWebEngineCore {
class YUVVideoMaterialShader : public QSGMaterialShader
{
public:
- YUVVideoMaterialShader(const gfx::ColorSpace &colorSpace) : m_colorSpace(colorSpace)
+ YUVVideoMaterialShader(const gfx::ColorSpace &colorSpace)
{
static const char *shaderHead =
"varying mediump vec2 v_yaTexCoord;\n"
@@ -80,9 +80,11 @@ public:
" mediump vec3 rgb = DoColorConversion(yuv);\n"
" gl_FragColor = vec4(rgb, 1.0) * alpha;\n"
"}";
+ // Invalid or unspecified color spaces should be treated as REC709.
+ gfx::ColorSpace src = colorSpace.IsValid() ? colorSpace : gfx::ColorSpace::CreateREC709();
gfx::ColorSpace dst = gfx::ColorSpace::CreateSRGB();
std::unique_ptr<gfx::ColorTransform> transform =
- gfx::ColorTransform::NewColorTransform(m_colorSpace, dst, gfx::ColorTransform::Intent::INTENT_PERCEPTUAL);
+ gfx::ColorTransform::NewColorTransform(src, dst, gfx::ColorTransform::Intent::INTENT_PERCEPTUAL);
QByteArray header(shaderHead);
if (QOpenGLContext::currentContext()->isOpenGLES())
@@ -143,7 +145,6 @@ protected:
m_id_opacity = program()->uniformLocation("alpha");
}
- gfx::ColorSpace m_colorSpace;
int m_id_matrix;
int m_id_yaTexScale;
int m_id_uvTexScale;