From 615e227f9ada534bf8947a9769f2e4e80024203f Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sat, 4 Apr 2020 14:15:18 +1100 Subject: [PATCH] renderer: convert footage frames to reference pixel format Due to an oversight, incoming footage frames were NOT converted to the working pixel format (usually half or float). For most frames, this meant the OCIO conversion would occur on frames while they were still in their source format (usually either RGB8 or RGB16). This leads to rounding error inaccuracies, but even worse GLSL will clamp integer textures to 1.0 potentially losing a lot of data. While later nodes would correctly convert to the appropriate format, by then it would be too late. This commit corrects this issue, converting the frames to float during the OCIO shader pass. --- app/render/backend/opengl/openglproxy.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/render/backend/opengl/openglproxy.cpp b/app/render/backend/opengl/openglproxy.cpp index c16d1b40c..3653a14bb 100644 --- a/app/render/backend/opengl/openglproxy.cpp +++ b/app/render/backend/opengl/openglproxy.cpp @@ -115,7 +115,7 @@ void OpenGLProxy::FrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeR } } - VideoRenderingParams footage_params(frame->width(), frame->height(), stream->timebase(), frame->format(), video_params_.mode()); + VideoRenderingParams footage_params(frame->width(), frame->height(), frame->format()); footage_tex_ref = texture_cache_.Get(ctx_, footage_params, frame->data()); @@ -140,13 +140,15 @@ void OpenGLProxy::FrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeR footage_params = VideoRenderingParams(new_width, new_height, - footage_params.time_base(), - footage_params.format(), - footage_params.mode()); + footage_params.format()); } + VideoRenderingParams dest_params(footage_params.width(), + footage_params.height(), + video_params_.format()); + // Create destination texture - OpenGLTextureCache::ReferencePtr associated_tex_ref = texture_cache_.Get(ctx_, footage_params); + OpenGLTextureCache::ReferencePtr associated_tex_ref = texture_cache_.Get(ctx_, dest_params); buffer_.Attach(associated_tex_ref->texture(), true); buffer_.Bind();