[{"id":17492,"web_url":"https://patchwork.libcamera.org/comment/17492/","msgid":"<YMDI3AlxxnO4+ISR@pendragon.ideasonboard.com>","date":"2021-06-09T13:57:48","subject":"Re: [libcamera-devel] [PATCH v2 1/5] qcam: viewfinder_gl: change\n\tuniform float tex_stepx to vec2 tex_step","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Andrey,\n\nThank you for the patch.\n\nOn Thu, May 27, 2021 at 01:55:07PM +0300, Andrey Konovalov wrote:\n> In preparation to extend the supported formats, extend the tex_stepx\n> uniform to cover the steps between texels in both horizontal and\n> vertical directions.\n> \n> Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/qcam/assets/shader/YUV_packed.frag | 8 ++++----\n>  src/qcam/viewfinder_gl.cpp             | 7 ++++---\n>  src/qcam/viewfinder_gl.h               | 2 +-\n>  3 files changed, 9 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/qcam/assets/shader/YUV_packed.frag b/src/qcam/assets/shader/YUV_packed.frag\n> index 224dfafe..d6efd4ce 100644\n> --- a/src/qcam/assets/shader/YUV_packed.frag\n> +++ b/src/qcam/assets/shader/YUV_packed.frag\n> @@ -12,7 +12,7 @@ precision mediump float;\n>  varying vec2 textureOut;\n>  \n>  uniform sampler2D tex_y;\n> -uniform float tex_stepx;\n> +uniform vec2 tex_step;\n>  \n>  void main(void)\n>  {\n> @@ -49,10 +49,10 @@ void main(void)\n>  \t * a = fract(x) * 2 - 1\t\t\tif fract(x) >= 0.5\n>  \t */\n>  \tvec2 pos = textureOut;\n> -\tfloat f_x = fract(pos.x / tex_stepx);\n> +\tfloat f_x = fract(pos.x / tex_step.x);\n>  \n> -\tvec4 left = texture2D(tex_y, vec2(pos.x - f_x * tex_stepx, pos.y));\n> -\tvec4 right = texture2D(tex_y, vec2(pos.x + (1.0 - f_x) * tex_stepx , pos.y));\n> +\tvec4 left = texture2D(tex_y, vec2(pos.x - f_x * tex_step.x, pos.y));\n> +\tvec4 right = texture2D(tex_y, vec2(pos.x + (1.0 - f_x) * tex_step.x , pos.y));\n>  \n>  #if defined(YUV_PATTERN_UYVY)\n>  \tfloat y_left = mix(left.g, left.a, f_x * 2.0);\n> diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp\n> index 5d9b442e..ff719418 100644\n> --- a/src/qcam/viewfinder_gl.cpp\n> +++ b/src/qcam/viewfinder_gl.cpp\n> @@ -289,7 +289,7 @@ bool ViewFinderGL::createFragmentShader()\n>  \ttextureUniformY_ = shaderProgram_.uniformLocation(\"tex_y\");\n>  \ttextureUniformU_ = shaderProgram_.uniformLocation(\"tex_u\");\n>  \ttextureUniformV_ = shaderProgram_.uniformLocation(\"tex_v\");\n> -\ttextureUniformStepX_ = shaderProgram_.uniformLocation(\"tex_stepx\");\n> +\ttextureUniformStep_ = shaderProgram_.uniformLocation(\"tex_step\");\n>  \n>  \t/* Create the textures. */\n>  \tfor (std::unique_ptr<QOpenGLTexture> &texture : textures_) {\n> @@ -508,8 +508,9 @@ void ViewFinderGL::doRender()\n>  \t\t * ([0, 1]). There are exactly width - 1 steps between the\n>  \t\t * leftmost and rightmost texels.\n>  \t\t */\n> -\t\tshaderProgram_.setUniformValue(textureUniformStepX_,\n> -\t\t\t\t\t       1.0f / (size_.width() / 2 - 1));\n> +\t\tshaderProgram_.setUniformValue(textureUniformStep_,\n> +\t\t\t\t\t       1.0f / (size_.width() / 2 - 1),\n> +\t\t\t\t\t       1.0f /* not used */);\n>  \t\tbreak;\n>  \n>  \tcase libcamera::formats::ABGR8888:\n> diff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h\n> index 150fa4ae..1b1faa91 100644\n> --- a/src/qcam/viewfinder_gl.h\n> +++ b/src/qcam/viewfinder_gl.h\n> @@ -85,7 +85,7 @@ private:\n>  \tGLuint textureUniformU_;\n>  \tGLuint textureUniformV_;\n>  \tGLuint textureUniformY_;\n> -\tGLuint textureUniformStepX_;\n> +\tGLuint textureUniformStep_;\n>  \tunsigned int horzSubSample_;\n>  \tunsigned int vertSubSample_;\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C8F4EC320B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Jun 2021 13:58:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2BB40602A0;\n\tWed,  9 Jun 2021 15:58:09 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E5E4D6029C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Jun 2021 15:58:06 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4F6FD46E;\n\tWed,  9 Jun 2021 15:58:06 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"l/a1lVod\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1623247086;\n\tbh=UNElEw4cgOR1C+UVURgzffpSh6PEHhUrW3QqVnScI0A=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=l/a1lVodWN8m0TDkP4OkjahioCZUR15zFvXqOuE8nkxw98vyBycx/A9pzXeYVm5V5\n\ty0nRl6Is+ty5f1lb7/MZGFhEQXQOOT4zK+5euJVCzv8cTyD6zGcwwGlsc4Pj2yIkEA\n\t24UISdwMWDctTsVUP3jRFtTt251SNsDlgh9GfyRI=","Date":"Wed, 9 Jun 2021 16:57:48 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Andrey Konovalov <andrey.konovalov@linaro.org>","Message-ID":"<YMDI3AlxxnO4+ISR@pendragon.ideasonboard.com>","References":"<20210527105511.447089-1-andrey.konovalov@linaro.org>\n\t<20210527105511.447089-2-andrey.konovalov@linaro.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210527105511.447089-2-andrey.konovalov@linaro.org>","Subject":"Re: [libcamera-devel] [PATCH v2 1/5] qcam: viewfinder_gl: change\n\tuniform float tex_stepx to vec2 tex_step","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"morgan@casual-effects.com, libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]