{"id":24676,"url":"https://patchwork.libcamera.org/api/1.1/patches/24676/?format=json","web_url":"https://patchwork.libcamera.org/patch/24676/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251015012251.17508-32-bryan.odonoghue@linaro.org>","date":"2025-10-15T01:22:43","name":"[v3,31/39] libcamera: shaders: Fix neighbouring positions in 8-bit debayering","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"20143daea4fad684409546da0b70e882fce6d8ce","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/1.1/people/175/?format=json","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24676/mbox/","series":[{"id":5503,"url":"https://patchwork.libcamera.org/api/1.1/series/5503/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5503","date":"2025-10-15T01:22:12","name":"Add GLES 2.0 GPUISP to libcamera","version":3,"mbox":"https://patchwork.libcamera.org/series/5503/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24676/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24676/checks/","tags":{},"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 A0609BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Oct 2025 01:23:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0F7156067F;\n\tWed, 15 Oct 2025 03:23:42 +0200 (CEST)","from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com\n\t[IPv6:2a00:1450:4864:20::62e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DDAFF60648\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Oct 2025 03:23:26 +0200 (CEST)","by mail-ej1-x62e.google.com with SMTP id\n\ta640c23a62f3a-b403bb7843eso1253493166b.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Oct 2025 18:23:26 -0700 (PDT)","from inspiron14p-linux.nxsw.local (188-141-3-146.dynamic.upc.ie.\n\t[188.141.3.146]) by smtp.gmail.com with ESMTPSA id\n\ta640c23a62f3a-b5ccd7b202dsm98348466b.82.2025.10.14.18.23.25\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 14 Oct 2025 18:23:25 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"NagJ5X/M\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1760491406; x=1761096206;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=3pLj5P6YPZYgBGgXFC8NMxiBkk93rrF9W+BqVEKVjMU=;\n\tb=NagJ5X/MG0kR8fwnmhFSZ/ha5G15EHSKDvZZYG1PcdBnwPiaGFBf1mxgx8pXccuGQ+\n\traw1aRRwTi4xbWUFkw1SAqk8y2kssj1sfhz/YZvvmUnpvLco8PRBXi9AMyzXyYvIxLwr\n\tWnUIjIP+XFsctGOfqOC17LspzJ9RuleiWXPjcd9Klfpmc5lKc0BeYbUSPAVtsoDzF6Zj\n\tW1j37FaGMnaCOdhEcESmzCD9/E0Mbu9FswTShWUnjmsJBobAYLg6r9ikWtvw7yT948ih\n\tkg/oNdA61lH1kstcfYF2xUPc1fIWq3eU258tdq1jwaRV39gj/suk4Davb3dEFO9XtUz1\n\t7loA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1760491406; x=1761096206;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=3pLj5P6YPZYgBGgXFC8NMxiBkk93rrF9W+BqVEKVjMU=;\n\tb=OwOO+/eYGiLpvlLTkucPVJXSlL+8je0xzjB0Xv1Ii5XJIH4mD7JXgq9wjapKtplQl0\n\t8CTWz9q0MhbbHdhMCGfm5BJKQp4KlmPzC3jwEW7xctpgs0AUvQ76ssZsJa/9cOwMZg5S\n\tt5j4jxqn8Mqcd1IagfQ8S0SZRiKTWfbCO0vAXXaHyW3rzgQEAHYF2e84DIZQv2NcN/Pk\n\tKFxzgnIjUFNHG+mEQPRVbo9z+fOIXQuMcGZ6zc666+J6QXiy8Bramc6i99J9stR7GGCq\n\tQnr2lb0DZlsd3VlhjHZwkDisno3BWMATcdcXjgUIWmfAEXpvRfekZfF5J+NsFZLFRw+w\n\t7ZbQ==","X-Gm-Message-State":"AOJu0YzdHq3KbkLDmSakwFD25c/bnAUCbn4hOwlQObMyCwH5V6s3L2/s\n\t730rOQJnWPVphhM4PIUaXs5Ht0CayYVVsnhBSHaIec8dZ84NMqvMT/7x+l3TqeqN6UwAn1PzBW/\n\ty0ssn","X-Gm-Gg":"ASbGncujXLIrjhMkSVpNSU1gOTKBd9eezmMvrhi7ro1o5cOOLbmwqkFDrl/WTTDbA8z\n\t/9oaQnlJZl2YUnn2RZ3l53JcHpSuwBqB5CUSezEULUERHNGFdpqONSzy6Y/3X+UXAo+HgfEx7hA\n\tqbjdMwxQyQtBMVz31O+M9SI2Ev3wtEDBBWDv9gKC6tEfFmo6z32QW702hDw5+tiPQ3ohLqfDlqN\n\tjzmyr+XB4qhKoZQz9khpnQzWv1Iu4MSNO2o+nW+mGZEDa38Xc5tvxV3hDkpIuSqT/LwYnpLDtdh\n\t3tgAEEbaGzFwcGV+js97pDbEn0DDAwCFcnDzuPZBmBzpdrAvE8wBzwg7CmruvaW3xtLpQ31Gl+m\n\tbDvoMAkBPmjDoVLXKzyt9fzBxLMh0G1pqJ1LHCsXZ0Froi/vISs0eE++kPelKALz9/raKDctXJr\n\tGR3Ob67S0aF1A85TZ2ZLrM3gFZNjEAl6hMVnGwtSAQ","X-Google-Smtp-Source":"AGHT+IFifMKAX2rD3sBzL7INia4PQrpoG4UoWxv/0uLFcpQHI3ea7BAml0xfEZUJkhOQJH6cGBDZ8A==","X-Received":"by 2002:a17:907:1c0f:b0:b4b:dd7e:65f2 with SMTP id\n\ta640c23a62f3a-b50aa48d34fmr2549706366b.5.1760491406039; \n\tTue, 14 Oct 2025 18:23:26 -0700 (PDT)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"hdegoede@redhat.com, mzamazal@redhat.com, bryan.odonoghue@linaro.org,\n\tbod.linux@nxsw.ie","Subject":"[PATCH v3 31/39] libcamera: shaders: Fix neighbouring positions in\n\t8-bit debayering","Date":"Wed, 15 Oct 2025 02:22:43 +0100","Message-ID":"<20251015012251.17508-32-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>","References":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Milan Zamazal <mzamazal@redhat.com>\n\nWhen accessing a texture position in a shader, the pixel with the\nnearest centre to the specified texture coordinates (as mandated by\nspecifying GL_NEAREST parameter) is taken.  The current vertex shader\ndetermines the positions of the neighbouring pixels by adding the\nprovided texture steps to the exact centre pixel coordinates.  But this\nplaces the computed coordinates, from the point of view of GL_NEAREST,\nexactly between the pixels and is thus prone to floating point\ninaccuracies.  Wrong neighbouring pixel coordinates may be used,\nresulting in artefacts in the output image.\n\nLet's fix the problem by shifting the initial coordinates a bit from the\npixel border.\n\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n include/libcamera/internal/shaders/bayer_unpacked.vert | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)","diff":"diff --git a/include/libcamera/internal/shaders/bayer_unpacked.vert b/include/libcamera/internal/shaders/bayer_unpacked.vert\nindex fb5109ee..fc1cf89f 100644\n--- a/include/libcamera/internal/shaders/bayer_unpacked.vert\n+++ b/include/libcamera/internal/shaders/bayer_unpacked.vert\n@@ -44,10 +44,10 @@ void main(void) {\n     center.xy = textureIn;\n     center.zw = textureIn * tex_size + tex_bayer_first_red;\n \n-    xCoord = center.x + vec4(-2.0 * tex_step.x,\n-                             -tex_step.x, tex_step.x, 2.0 * tex_step.x);\n-    yCoord = center.y + vec4(-2.0 * tex_step.y,\n-                              -tex_step.y, tex_step.y, 2.0 * tex_step.y);\n+    xCoord = center.x + 0.1 * tex_step.x +\n+      vec4(-2.0 * tex_step.x, -tex_step.x, tex_step.x, 2.0 * tex_step.x);\n+    yCoord = center.y + 0.1 * tex_step.y +\n+      vec4(-2.0 * tex_step.y, -tex_step.y, tex_step.y, 2.0 * tex_step.y);\n \n     gl_Position = proj_matrix * vertexIn;\n }\n","prefixes":["v3","31/39"]}