[{"id":17884,"web_url":"https://patchwork.libcamera.org/comment/17884/","msgid":"<20210628102158.GA2624@pyrite.rasen.tech>","date":"2021-06-28T10:21:58","subject":"Re: [libcamera-devel] [PATCH v5 1/9] qcam: viewfinder_gl: change\n\tuniform float tex_stepx to vec2 tex_step","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Andrey,\n\nOn Tue, Jun 22, 2021 at 04:46:44PM +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: Paul Elder <paul.elder@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>  \n> -- \n> 2.25.1\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 94185C321F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Jun 2021 10:22:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7F61F684D4;\n\tMon, 28 Jun 2021 12:22: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 0E8F86028C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Jun 2021 12:22:08 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AD159CC;\n\tMon, 28 Jun 2021 12:22:05 +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=\"uObC+mZT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1624875727;\n\tbh=8rYvVr02NbUs95t1NQdfrsDAi9yH+2GTUsi87J4GGIk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=uObC+mZTeW6nod+9/oL3C8mhOpJPKnc0n4NRi2v4d0ubcU/57t8Ba08qNpCJaDNXg\n\tZ0sAuUehuqfMRYDjd5gpnYumuXTLbXx0IoJD4R911NKTCn7kWno47DflwIa/bNeZdM\n\trc+fpk+XXqCuduJackl60uWPTVOr3sW9qkrQzD64=","Date":"Mon, 28 Jun 2021 19:21:58 +0900","From":"paul.elder@ideasonboard.com","To":"Andrey Konovalov <andrey.konovalov@linaro.org>","Message-ID":"<20210628102158.GA2624@pyrite.rasen.tech>","References":"<20210622134652.1279260-1-andrey.konovalov@linaro.org>\n\t<20210622134652.1279260-2-andrey.konovalov@linaro.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20210622134652.1279260-2-andrey.konovalov@linaro.org>","Subject":"Re: [libcamera-devel] [PATCH v5 1/9] 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>"}},{"id":17926,"web_url":"https://patchwork.libcamera.org/comment/17926/","msgid":"<YNu7Mh0bKiwkLOU0@pendragon.ideasonboard.com>","date":"2021-06-30T00:30:42","subject":"Re: [libcamera-devel] [PATCH v5 1/9] 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 Tue, Jun 22, 2021 at 04:46:44PM +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 B3106C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 30 Jun 2021 00:31:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1059C684E8;\n\tWed, 30 Jun 2021 02:31:22 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 844506028A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 30 Jun 2021 02:31:20 +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 E41F23F2;\n\tWed, 30 Jun 2021 02:31:19 +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=\"tuW2pKEx\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1625013080;\n\tbh=7jS5d2xl74LX0LZAk3dR4pRBZO3yqs+F9XrhTQTkGI8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=tuW2pKExyLCDgoRfyT/C3UI+YGVXnQ/iVehxQHM68JCC9j+agQgfcokSf0ph5jXQ5\n\tSpXMHlJmTCR03HkFFBQjNBqcgh5vSFTxEIHiWXMVdxgX7MgM9oThrxgv850FYIVjpq\n\tluU6rm+jWYvs1FnqYGYju+ZirlVAzfwKm4zbUmKw=","Date":"Wed, 30 Jun 2021 03:30:42 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Andrey Konovalov <andrey.konovalov@linaro.org>","Message-ID":"<YNu7Mh0bKiwkLOU0@pendragon.ideasonboard.com>","References":"<20210622134652.1279260-1-andrey.konovalov@linaro.org>\n\t<20210622134652.1279260-2-andrey.konovalov@linaro.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210622134652.1279260-2-andrey.konovalov@linaro.org>","Subject":"Re: [libcamera-devel] [PATCH v5 1/9] 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>"}}]