Patch Detail
Show a patch.
GET /api/patches/27350/?format=api
{ "id": 27350, "url": "https://patchwork.libcamera.org/api/patches/27350/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27350/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260708201816.299983-5-mzamazal@redhat.com>", "date": "2026-07-08T20:18:12", "name": "[RFC,v7,4/6] libcamera: shaders: Add LSC support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "19f1b05e281f6d4cfbf30c428530b2ea019ba284", "submitter": { "id": 177, "url": "https://patchwork.libcamera.org/api/people/177/?format=api", "name": "Milan Zamazal", "email": "mzamazal@redhat.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/27350/mbox/", "series": [ { "id": 6049, "url": "https://patchwork.libcamera.org/api/series/6049/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6049", "date": "2026-07-08T20:18:08", "name": "LSC for SoftISP simple pipeline", "version": 7, "mbox": "https://patchwork.libcamera.org/series/6049/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27350/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27350/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 33CA3C3318\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 8 Jul 2026 20:19:01 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E25D6660CF;\n\tWed, 8 Jul 2026 22:19:00 +0200 (CEST)", "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 946F9660B8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 8 Jul 2026 22:18:58 +0200 (CEST)", "from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-122-kUUWWl0DM7Kg7uWiSZaU-g-1;\n\tWed, 08 Jul 2026 16:18:52 -0400", "from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.93])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id CE98319560A5; Wed, 8 Jul 2026 20:18:49 +0000 (UTC)", "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.48.228])\n\tby mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id B5CBB180059F; Wed, 8 Jul 2026 20:18:46 +0000 (UTC)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"ElXZhIrr\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1783541936;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=T/s94o5jHpgg4urdBGoB/gYa0GSqmeLwtQWVWj7i6PM=;\n\tb=ElXZhIrrx3mdF2iuXD+tNsF6xbKPeCGR60hhzeEdL9pMeQitcfRHq8N4vYQ6PM1bybK6hH\n\tUEAoko4PHCOR9yT+/O+gn+yKFaodf0MXyd7l4+j/IB9ygjDWVlynEebNHNgJ4LW7Uw9d3E\n\tSlTkWBauQx4AJvJcuT0+/Dr5bAgkt10=", "X-MC-Unique": "kUUWWl0DM7Kg7uWiSZaU-g-1", "X-Mimecast-MFC-AGG-ID": "kUUWWl0DM7Kg7uWiSZaU-g_1783541930", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Xander Pronk <xander.c.pronk@gmail.com>,\n\tBryan O'Donoghue <bod.linux@nxsw.ie>,\n\tHans de Goede <johannes.goede@oss.qualcomm.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tRick ten Wolde <rick_libcamera@wolde.info>,\n\tMilan Zamazal <mzamazal@redhat.com>", "Subject": "[RFC PATCH v7 4/6] libcamera: shaders: Add LSC support", "Date": "Wed, 8 Jul 2026 22:18:12 +0200", "Message-ID": "<20260708201816.299983-5-mzamazal@redhat.com>", "In-Reply-To": "<20260708201816.299983-1-mzamazal@redhat.com>", "References": "<20260708201816.299983-1-mzamazal@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.93", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "8Xl8hVy4Z5x86EuVByVnkrF2k0vhbwkZYtZ8PmEfP2s_1783541930", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "content-type": "text/plain; charset=\"US-ASCII\"; x-default=true", "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: Xander Pronk <xander.c.pronk@gmail.com>\n\nLens shading correction should be applied after black level\nsubtraction (in order to make the computations with meaningful values)\nand before white balance (especially before white balance stats are\ncomputed).\n\nNote that lens shading correction depends on temperature, which is\ncomputed from the preceding, rather than current, frame (this is due to\nhow white balance is currently computed).\n\nThe shaders are compiled on initialisation, while lens shading\ncorrection can be enabled or disabled dynamically, using the\ncorresponding control. The whole correction in the shader is wrapped by\na conditional macro to be able to disable it and all the related\noverheads if Lsc algorithm is not enabled at all. The correction\ncomputation itself is conditional based on a flag that can be changed\nfor each processed image.\n\nCo-developed-by: Rick ten Wolde <rick_libcamera@wolde.info>\nSigned-off-by: Rick ten Wolde <rick_libcamera@wolde.info>\nSigned-off-by: Xander Pronk <xander.c.pronk@gmail.com>\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n src/libcamera/shaders/bayer_1x_packed.frag | 10 ++++++++++\n src/libcamera/shaders/bayer_unpacked.frag | 10 ++++++++++\n 2 files changed, 20 insertions(+)", "diff": "diff --git a/src/libcamera/shaders/bayer_1x_packed.frag b/src/libcamera/shaders/bayer_1x_packed.frag\nindex 0b641a5f3..33f5c1fde 100644\n--- a/src/libcamera/shaders/bayer_1x_packed.frag\n+++ b/src/libcamera/shaders/bayer_1x_packed.frag\n@@ -71,6 +71,11 @@ uniform vec3 blacklevel;\n uniform float gamma;\n uniform float contrastExp;\n \n+#if defined(APPLY_LSC)\n+uniform bool lsc_enabled;\n+uniform sampler2D lsc_tex;\n+#endif\n+\n float apply_contrast(float value)\n {\n \t// Apply simple S-curve\n@@ -232,6 +237,11 @@ void main(void)\n \t */\n \trgb = (rgb - blacklevel) / (1.0 - blacklevel);\n \n+#if defined(APPLY_LSC)\n+ if (lsc_enabled)\n+ rgb = rgb * texture2D(lsc_tex, textureOut).rgb;\n+#endif\n+\n \t/* Apply AWB gains, and saturate each channel at sensor range */\n \trgb = clamp(rgb * awb, vec3(0.0), vec3(1.0));\n \ndiff --git a/src/libcamera/shaders/bayer_unpacked.frag b/src/libcamera/shaders/bayer_unpacked.frag\nindex 10c5e941b..64649777e 100644\n--- a/src/libcamera/shaders/bayer_unpacked.frag\n+++ b/src/libcamera/shaders/bayer_unpacked.frag\n@@ -30,6 +30,11 @@ uniform vec3 blacklevel;\n uniform float gamma;\n uniform float contrastExp;\n \n+#if defined(APPLY_LSC)\n+uniform bool lsc_enabled;\n+uniform sampler2D lsc_tex;\n+#endif\n+\n float apply_contrast(float value)\n {\n // Apply simple S-curve\n@@ -135,6 +140,11 @@ void main(void) {\n */\n rgb = (rgb - blacklevel) / (1.0 - blacklevel);\n \n+#if defined(APPLY_LSC)\n+ if (lsc_enabled)\n+ rgb = rgb * texture2D(lsc_tex, center.xy).rgb;\n+#endif\n+\n /* Apply AWB gains, and saturate each channel at sensor range */\n rgb = clamp(rgb * awb, vec3(0.0), vec3(1.0));\n \n", "prefixes": [ "RFC", "v7", "4/6" ] }