[{"id":39761,"web_url":"https://patchwork.libcamera.org/comment/39761/","msgid":"<d89acb81-7c89-4fd7-84fc-bd61c8b3de6b@collabora.com>","date":"2026-07-20T12:19:31","subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"Hi Milan, thanks a lot for updating and rebasing the series!\n\nOn 20.07.26 11:59, Milan Zamazal wrote:\n> Lens shading correction for software GPU ISP.  Based on the initial work\n> by Hans’s students, taken over and significantly modified and eventually\n> reworked to use LSC from libipa (the ongoing work by Jacopo and others).\n>\n> The LSC is not implemented for CPU ISP within this series; it may be\n> added later if needed.\n>\n> It’s RFC because:\n>\n> - It’s not yet completely tested although it seems to be working in my\n>    environment.\n> - It’s based on the libipa patches not yet merged.\n> - Further changes will be needed once GPU ISP multipass is merged.\n>\n> Example YAML for grid based LSC, no-op values, place it after Awb:\n>\n>    - Lsc:\n>        sets:\n>          - ct: 6500\n>            r: [\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n>            ]\n>            g: [\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n>            ]\n>            b: [\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n>            ]\n\nI wonder how compatible this implementation is with the RPi alsc \nalgorithm - which would be great as it'd allow us to reuse the tuning \ndata for e.g. the IMX355.\n\nInstead of RGB the values are stored as luminance_lut, calibrations_Cr \nand calibrations_Cb - and only the later two using ct. Further more it \nuses 32x32 instead of 16x16 values - and finally it uses floats (1.0 \ninstead of 64).\n\nIt *looks* to me like we could add a script to convert those values, \nassuming the algorithms work similar in the end. What do you think / do \nyou think that should work? Would it possibly even make sense to adopt \nthe RPi format?\n\nBest regards,\n\nRobert\n\n>\n> Example YAML for polynomial based LSC, no-op values, place it after Awb:\n>\n>   - Lsc:\n>       type: \"polynomial\"\n>       sets:\n>         - ct: 6500\n>           r:\n>             cx: 0.0\n>             cy: 0.0\n>             k0: 0.0\n>             k1: 0.0\n>             k2: 0.0\n>             k3: 0.0\n>             k4: 0.0\n>           g:\n>             cx: 0.0\n>             cy: 0.0\n>             k0: 0.0\n>             k1: 0.0\n>             k2: 0.0\n>             k3: 0.0\n>             k4: 0.0\n>           b:\n>             cx: 0.0\n>             cy: 0.0\n>             k0: 0.0\n>             k1: 0.0\n>             k2: 0.0\n>             k3: 0.0\n>             k4: 0.0\n>\n> Changes in v9:\n> - Rebased on the latest master.\n>\n> Changes in v8:\n> - LscValueType removed.\n> - A named constant introduced for minimum temperature change.\n> - A clarification comment added to the LUT value computation.\n> - lsc-enabled shader flag and the related variables removed.\n> - Wording corrections suggested by Bryan.\n>\n> Changes in v7:\n> - Updated for libipa patches v5 (temperature access).\n>\n> Changes in v6:\n> - Rebased on Jacopo’s libipa patches (v3).\n> - Not updating LSC tables on small or no temperature changes.\n> - Using libipa LSC algorithms; the implementation in ‘simple’ IPA\n>    algorithm reduced to the minimum needed.\n> - Grid tables are defined using integers rather than floats, because\n>    libipa LSC supports only quantised values and not floats.\n> - New boolean uniform to enable or disable LSC dynamically, rather than\n>    only in shaders compile time; to be able to honour the LSC control.\n> - Specific handling of polynomial LSC removed.  Polynomial LSC is\n>    already handled by libipa, by making a grid-based LSC from it.  While\n>    a direct polynomial computation may be a bit faster with a minimum\n>    number of the polynomial coefficients, the simplicity wins.  If we\n>    liked to have direct polynomial LSC computation, it should be\n>    implemented with help of libipa.\n>\n> Changes in v5:\n> - ‘grids’ tuning file item renamed to ‘sets’ for consistency with rkisp1.\n> - Underscores appended to Lsc::lsc* names.\n> - Other minor stylistic changes.\n> - Proof-of-concept polynomial LSC implemented.\n>\n> Changes in v4:\n> - glFilterParam -> param\n> - Indentation changes in the shaders.\n> - A commit message part about temperature reworded.\n> - Updated for YamlObject -> ValueNode.\n> - New constant kLscValuesPerCell to distinguish between the constants\n>    for the params array size (values) and for the stride (bytes).\n> - The lookup array switched to floats and the texture to half-floats.\n>\n> Changes in v3:\n> - LSC scripts patch dropped due to missing licences.\n> - DO_LSC -> APPLY_LSC\n> - textureUniformLsc_ is assigned unconditionally now.\n> - New constant DebayerParams::kLscBytesPerCell.\n> - LSC values in the tuning file are floats now and converted to bytes internally.\n> - Source code comments added to clarify the usage of the byte LUTs.\n>\n> Changes in v2:\n> - Remaining issues from the reviews (hopefully) addressed.\n> - Especially there is only a single texture now and LSC is fully\n>    conditional.\n> - Major cleanup, hacks removed or replaced, typo fixes, cosmetic\n>    changes, making linters happy, etc.\n> - See\n>    https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056883.html\n>    for an example how to add the grid data.\n>\n> Milan Zamazal (1):\n>    libcamera: software_isp: Pass LSC availability to debayering\n>\n> Xander Pronk (5):\n>    libcamera: software_isp: egl: Add filter parameter to\n>      createTexture2D()\n>    libcamera: software_isp: Add LSC data to DebayerParams\n>    ipa: simple: Add LSC algorithm\n>    libcamera: shaders: Add LSC support\n>    libcamera: software_isp: debayer_egl: Add LSC support\n>\n>   include/libcamera/internal/egl.h              |   6 +-\n>   .../internal/software_isp/debayer_params.h    |   9 ++\n>   .../internal/software_isp/software_isp.h      |   1 +\n>   include/libcamera/ipa/soft.mojom              |   4 +-\n>   src/ipa/simple/algorithms/lsc.cpp             | 100 ++++++++++++++++++\n>   src/ipa/simple/algorithms/lsc.h               |  50 +++++++++\n>   src/ipa/simple/algorithms/meson.build         |   1 +\n>   src/ipa/simple/ipa_context.h                  |   6 ++\n>   src/ipa/simple/soft_simple.cpp                |   7 +-\n>   src/libcamera/egl.cpp                         |  19 ++--\n>   src/libcamera/shaders/bayer_1x_packed.frag    |   8 ++\n>   src/libcamera/shaders/bayer_unpacked.frag     |   8 ++\n>   src/libcamera/software_isp/debayer.cpp        |  29 +++++\n>   src/libcamera/software_isp/debayer.h          |   3 +-\n>   src/libcamera/software_isp/debayer_cpu.cpp    |   3 +-\n>   src/libcamera/software_isp/debayer_cpu.h      |   3 +-\n>   src/libcamera/software_isp/debayer_egl.cpp    |  37 ++++++-\n>   src/libcamera/software_isp/debayer_egl.h      |  10 +-\n>   src/libcamera/software_isp/software_isp.cpp   |   5 +-\n>   19 files changed, 290 insertions(+), 19 deletions(-)\n>   create mode 100644 src/ipa/simple/algorithms/lsc.cpp\n>   create mode 100644 src/ipa/simple/algorithms/lsc.h\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 AC74CBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jul 2026 12:19:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D90E067E3F;\n\tMon, 20 Jul 2026 14:19:40 +0200 (CEST)","from sender4-op-o11.zoho.com (sender4-op-o11.zoho.com\n\t[136.143.188.11])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E0B7966177\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jul 2026 14:19:38 +0200 (CEST)","by mx.zohomail.com with SMTPS id 1784549974815297.1709366925851;\n\tMon, 20 Jul 2026 05:19:34 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"jS9WTY+T\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1784549975; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=B0mLDlvlvTn+72Tjua4qU1gUUxfysUH4tmPEPlW3PZiumjosRGUON7xlWYfBQRjW77d7QqfEvkgfU2nVZYC6uw+ma8LSIBmVTVnunySCspBt9ukAZn+2VcIkvvE/o2QtnQ3wRqIQBBUzWjkmjGXjE+cdYlRPhMo04gPvV6eWO30=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1784549975;\n\th=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To;\n\tbh=onhNMjpKG4Xn40GvbtZZPtCmBgHdeMsfrBMRTYPIzB4=; \n\tb=Jmcwtb/S8ndvxJ3kk9YR7305S4L34uY5fK9KiVefQdZM4qzM2d0DHZOt3Tu4iTL8lIEJTe3OO7R0NV37FRDjaup6DtRnT4iwZoSwvDvmWlipsVxjJQPYTNUT7XHf7APAHMkPCbL5ljS82j5GslIz5x177rj5q5Gj20WQKrTcqoY=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1784549975;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:Cc:Cc:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To;\n\tbh=onhNMjpKG4Xn40GvbtZZPtCmBgHdeMsfrBMRTYPIzB4=;\n\tb=jS9WTY+TpZwXlDi0wwq+a71DRuCeuybOEns/WzpKJ1oP0VDLHgyJB6GQv85gx276\n\td3On9tKSigHgjsvgQHKtmcU/muPMT7Ro3FINgKxzPBrv1gjloAGMr728GFIamvULtd1\n\tXn6J7zOq1+xVj2ZdvoYNOK+9310I4fxMDgMhAGB4=","Message-ID":"<d89acb81-7c89-4fd7-84fc-bd61c8b3de6b@collabora.com>","Date":"Mon, 20 Jul 2026 14:19:31 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Cc":"Bryan O'Donoghue <bod.linux@nxsw.ie>,\n\tHans de Goede <johannes.goede@oss.qualcomm.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20260720095951.49979-1-mzamazal@redhat.com>","Content-Language":"en-US, de-DE","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<20260720095951.49979-1-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","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>"}},{"id":39762,"web_url":"https://patchwork.libcamera.org/comment/39762/","msgid":"<CAHW6GYK+edwSvJ4xuO2Tfc6WZozB8DqQQy+cMbYg6R9eZVAFAQ@mail.gmail.com>","date":"2026-07-20T12:52:55","subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi everyone\n\nOn Mon, 20 Jul 2026 at 13:19, Robert Mader <robert.mader@collabora.com> wrote:\n>\n> Hi Milan, thanks a lot for updating and rebasing the series!\n>\n> On 20.07.26 11:59, Milan Zamazal wrote:\n> > Lens shading correction for software GPU ISP.  Based on the initial work\n> > by Hans’s students, taken over and significantly modified and eventually\n> > reworked to use LSC from libipa (the ongoing work by Jacopo and others).\n> >\n> > The LSC is not implemented for CPU ISP within this series; it may be\n> > added later if needed.\n> >\n> > It’s RFC because:\n> >\n> > - It’s not yet completely tested although it seems to be working in my\n> >    environment.\n> > - It’s based on the libipa patches not yet merged.\n> > - Further changes will be needed once GPU ISP multipass is merged.\n> >\n> > Example YAML for grid based LSC, no-op values, place it after Awb:\n> >\n> >    - Lsc:\n> >        sets:\n> >          - ct: 6500\n> >            r: [\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n> >            ]\n> >            g: [\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n> >            ]\n> >            b: [\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n> >            ]\n>\n> I wonder how compatible this implementation is with the RPi alsc\n> algorithm - which would be great as it'd allow us to reuse the tuning\n> data for e.g. the IMX355.\n>\n> Instead of RGB the values are stored as luminance_lut, calibrations_Cr\n> and calibrations_Cb - and only the later two using ct. Further more it\n> uses 32x32 instead of 16x16 values - and finally it uses floats (1.0\n> instead of 64).\n>\n> It *looks* to me like we could add a script to convert those values,\n> assuming the algorithms work similar in the end. What do you think / do\n> you think that should work? Would it possibly even make sense to adopt\n> the RPi format?\n\nTo use the Pi format tables I would:\n\nScale all three tables down to 16x16 (or you could do this at the\nend). You might worry about about whether to preserve the corner\nvalues or not, but realistically, any sensible scheme is likely to be\n\"good enough\".\n\nUse the luminance table for the green channel. We've never bothered\nvarying luminance correction according to colour temperature as we've\nnever noticed much effect, but there's no reason that one couldn't.\n\nMultiply the Cr and Cb tables elementwise by the luminance table.\nNormalise the resulting tables so that that the minimum gain in each\ntable is 1.0. These will be the red and blue correction tables.\n\n(If anyone wonders why we separate Cr/Cb and luminance tables, it's so\nthat you can do less luminance correction without sacrificing the\ncolour correction.)\n\nHope that clarifies things a bit!\n\nDavid\n\n>\n> Best regards,\n>\n> Robert\n>\n> >\n> > Example YAML for polynomial based LSC, no-op values, place it after Awb:\n> >\n> >   - Lsc:\n> >       type: \"polynomial\"\n> >       sets:\n> >         - ct: 6500\n> >           r:\n> >             cx: 0.0\n> >             cy: 0.0\n> >             k0: 0.0\n> >             k1: 0.0\n> >             k2: 0.0\n> >             k3: 0.0\n> >             k4: 0.0\n> >           g:\n> >             cx: 0.0\n> >             cy: 0.0\n> >             k0: 0.0\n> >             k1: 0.0\n> >             k2: 0.0\n> >             k3: 0.0\n> >             k4: 0.0\n> >           b:\n> >             cx: 0.0\n> >             cy: 0.0\n> >             k0: 0.0\n> >             k1: 0.0\n> >             k2: 0.0\n> >             k3: 0.0\n> >             k4: 0.0\n> >\n> > Changes in v9:\n> > - Rebased on the latest master.\n> >\n> > Changes in v8:\n> > - LscValueType removed.\n> > - A named constant introduced for minimum temperature change.\n> > - A clarification comment added to the LUT value computation.\n> > - lsc-enabled shader flag and the related variables removed.\n> > - Wording corrections suggested by Bryan.\n> >\n> > Changes in v7:\n> > - Updated for libipa patches v5 (temperature access).\n> >\n> > Changes in v6:\n> > - Rebased on Jacopo’s libipa patches (v3).\n> > - Not updating LSC tables on small or no temperature changes.\n> > - Using libipa LSC algorithms; the implementation in ‘simple’ IPA\n> >    algorithm reduced to the minimum needed.\n> > - Grid tables are defined using integers rather than floats, because\n> >    libipa LSC supports only quantised values and not floats.\n> > - New boolean uniform to enable or disable LSC dynamically, rather than\n> >    only in shaders compile time; to be able to honour the LSC control.\n> > - Specific handling of polynomial LSC removed.  Polynomial LSC is\n> >    already handled by libipa, by making a grid-based LSC from it.  While\n> >    a direct polynomial computation may be a bit faster with a minimum\n> >    number of the polynomial coefficients, the simplicity wins.  If we\n> >    liked to have direct polynomial LSC computation, it should be\n> >    implemented with help of libipa.\n> >\n> > Changes in v5:\n> > - ‘grids’ tuning file item renamed to ‘sets’ for consistency with rkisp1.\n> > - Underscores appended to Lsc::lsc* names.\n> > - Other minor stylistic changes.\n> > - Proof-of-concept polynomial LSC implemented.\n> >\n> > Changes in v4:\n> > - glFilterParam -> param\n> > - Indentation changes in the shaders.\n> > - A commit message part about temperature reworded.\n> > - Updated for YamlObject -> ValueNode.\n> > - New constant kLscValuesPerCell to distinguish between the constants\n> >    for the params array size (values) and for the stride (bytes).\n> > - The lookup array switched to floats and the texture to half-floats.\n> >\n> > Changes in v3:\n> > - LSC scripts patch dropped due to missing licences.\n> > - DO_LSC -> APPLY_LSC\n> > - textureUniformLsc_ is assigned unconditionally now.\n> > - New constant DebayerParams::kLscBytesPerCell.\n> > - LSC values in the tuning file are floats now and converted to bytes internally.\n> > - Source code comments added to clarify the usage of the byte LUTs.\n> >\n> > Changes in v2:\n> > - Remaining issues from the reviews (hopefully) addressed.\n> > - Especially there is only a single texture now and LSC is fully\n> >    conditional.\n> > - Major cleanup, hacks removed or replaced, typo fixes, cosmetic\n> >    changes, making linters happy, etc.\n> > - See\n> >    https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056883.html\n> >    for an example how to add the grid data.\n> >\n> > Milan Zamazal (1):\n> >    libcamera: software_isp: Pass LSC availability to debayering\n> >\n> > Xander Pronk (5):\n> >    libcamera: software_isp: egl: Add filter parameter to\n> >      createTexture2D()\n> >    libcamera: software_isp: Add LSC data to DebayerParams\n> >    ipa: simple: Add LSC algorithm\n> >    libcamera: shaders: Add LSC support\n> >    libcamera: software_isp: debayer_egl: Add LSC support\n> >\n> >   include/libcamera/internal/egl.h              |   6 +-\n> >   .../internal/software_isp/debayer_params.h    |   9 ++\n> >   .../internal/software_isp/software_isp.h      |   1 +\n> >   include/libcamera/ipa/soft.mojom              |   4 +-\n> >   src/ipa/simple/algorithms/lsc.cpp             | 100 ++++++++++++++++++\n> >   src/ipa/simple/algorithms/lsc.h               |  50 +++++++++\n> >   src/ipa/simple/algorithms/meson.build         |   1 +\n> >   src/ipa/simple/ipa_context.h                  |   6 ++\n> >   src/ipa/simple/soft_simple.cpp                |   7 +-\n> >   src/libcamera/egl.cpp                         |  19 ++--\n> >   src/libcamera/shaders/bayer_1x_packed.frag    |   8 ++\n> >   src/libcamera/shaders/bayer_unpacked.frag     |   8 ++\n> >   src/libcamera/software_isp/debayer.cpp        |  29 +++++\n> >   src/libcamera/software_isp/debayer.h          |   3 +-\n> >   src/libcamera/software_isp/debayer_cpu.cpp    |   3 +-\n> >   src/libcamera/software_isp/debayer_cpu.h      |   3 +-\n> >   src/libcamera/software_isp/debayer_egl.cpp    |  37 ++++++-\n> >   src/libcamera/software_isp/debayer_egl.h      |  10 +-\n> >   src/libcamera/software_isp/software_isp.cpp   |   5 +-\n> >   19 files changed, 290 insertions(+), 19 deletions(-)\n> >   create mode 100644 src/ipa/simple/algorithms/lsc.cpp\n> >   create mode 100644 src/ipa/simple/algorithms/lsc.h\n> >\n> --\n> Robert Mader\n> Consultant Software Developer\n>\n> Collabora Ltd.\n> Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK\n> Registered in England & Wales, no. 5513718\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 9A938BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jul 2026 12:53:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D331F67E42;\n\tMon, 20 Jul 2026 14:53:08 +0200 (CEST)","from mail-ed1-x530.google.com (mail-ed1-x530.google.com\n\t[IPv6:2a00:1450:4864:20::530])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 657CE66177\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jul 2026 14:53:07 +0200 (CEST)","by mail-ed1-x530.google.com with SMTP id\n\t4fb4d7f45d1cf-698ae09e356so14048697a12.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jul 2026 05:53:07 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"UX0a88DR\"; dkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1784551987; cv=none;\n\td=google.com; s=arc-20260327;\n\tb=jNNIMSQjuN2RtkDc38xUMLMg61vN/f+X+Qa7378Zx4w0ayh5s/7dhHwD5la+nPEPnS\n\tHPyIexjeDuOxAX0a2AWgqpHpm+6I+7aF0aacnuJbTIPcmjvAcPJY5wE3KYZim90b2Fwi\n\txPPTKMMXxngC6CjrDpzK1+uHyjuCPPg5LQ885otoKldANHFflYAxjAvhQGXJBvRRZRNm\n\txzMgzflTZn3zeE4gjf4zpUfa8iQig0dLx4rI1RJEnHaccEBSQDhWUoIPXJDeJJTF0afB\n\t+DZvdA9gy6nZCM6669J2JJWMjsrkhJF0fvHoyS5HRioYL1Zm5RTvpxDcrpz3sE+YZSTl\n\tJiDw==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20260327; \n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:dkim-signature;\n\tbh=jGF1E54rxd0DFNQvMbpClLLJ6i5+tSZdVmVIiiM8E30=;\n\tfh=icBZEOAAfZIU/SN423dazhaejSBWEK++mnJZxEISBAM=;\n\tb=hrPA5b7Qzsh13m+os3DuEVHRVXuGdsbAfTa397p0RshbyxFWRzt/cD91k4zyHW+Q92\n\tKhPtIW8P/2SPHS3xr/lI+jJfmtcz14FnyaFptiQ3IkWg78Qz/lEtmi3oxApaYGC82Cs6\n\tN+yBmjm6MP6IPR5932asi8yM/90ARvLbeT6vCxCPkzEQbhS0PjX/ENp1mTkOVRfJr7jm\n\tHRKjrFATOrL+nWD0yZWuAQ4aGlQb8NdR3mz9Tz4C+Hej8ZvOsyPv+N14zrE/eYDsLY40\n\tKmIBc3QkXcvjixc+6g4zp6H+4EQtRxwwoELT+RjLXGeS6nP+r9G7tOxO//Jb+IUx2St4\n\tgLpA==; darn=lists.libcamera.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1784551987; x=1785156787;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:content-type:cc:to:subject:message-id\n\t:date:from:in-reply-to:references:mime-version:from:to:cc:subject\n\t:date:message-id:reply-to:content-type;\n\tbh=jGF1E54rxd0DFNQvMbpClLLJ6i5+tSZdVmVIiiM8E30=;\n\tb=UX0a88DRJzKORLKadtGDWK2cM4AQM8HOMy4JKG8rMEF3aVY1kSfPgxmmZx2fcvrqt2\n\t1Gfgakb6syK9WPYNG/8Ift7ll1hGuDCaUhAfYcvYUPDeurr0cjDLCtyMdp87StWpeqCc\n\tka5gzdY90Oeyc6tWQhqHi0oWZe5VbSqKLT4Rr7vjqCNDsI9iK2bMtY7j83KtEkPg6HiH\n\tFzWow6mZM22xpkU9isKPhYfECHkcFEaN17Lpsad0usWW9QYO/5/+GtHN0dtuCLacyFYN\n\tktq7q/AIP3ElTM3aoAVnmBzWKFEBdHfdIrzO1aT60cqgLxAdYCsuAgaoc8KlCcTP3uTy\n\tgAnA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1784551987; x=1785156787;\n\th=content-transfer-encoding:content-type:cc:to:subject:message-id\n\t:date:from:in-reply-to:references:mime-version:x-gm-gg\n\t:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to\n\t:content-type;\n\tbh=jGF1E54rxd0DFNQvMbpClLLJ6i5+tSZdVmVIiiM8E30=;\n\tb=NLYnilw3iYnrF8ytxZxwT/4XAUZxEqT/zbD39Vx+e0FRBcA0Wq6lWuPyq40LpZWAf2\n\tYIj/OJFho9Iorc7NSqus0e18njzgLdwAl2IBNHTz0rwbz+4wLZ5Yw5dbs7is2je/gt32\n\tqYlaj0EzXY75rkZVXjVzWMK96cjiDzoactEhEo8Oji0mjwd/TvCDYTpxNdY7LavavI63\n\tKK1PSTl1/QHigHuyM1N5akxPqn62tTR+Lz9GSxEj2bVcSu2HMig+wT11FGgTRfcxvpjH\n\tx1dy3eK5RreSG+eURQJvFB2pkZkiBW22ZbwHEKaD1ZL/A8tOoSX/LWlDufwuDYXH+yfM\n\tX3jA==","X-Forwarded-Encrypted":"i=1;\n\tAHgh+Roe571uP9jmT4UTI5bdKy3j7AlLRJMJCyaTSl2kDcAmYLOEOlCotfiiQW+z8hz7Hz35mbeY1GSeqHsaDIKWwbc=@lists.libcamera.org","X-Gm-Message-State":"AOJu0YzN3t5vgBAWUy6/j8Ew+HpauiljeW3PAIqx+3mRqVkh1elsslWC\n\th28WB2RlB7q34K9mNAPZyEOtJu40FQbvHWj80QlgdaTvLpsQ1jUJyX+HZiDIyTcrt6k2iRVNqvG\n\tMkHzoF6sheh2ifLQMVzmLzy07DV5js5Yut5KStl1S78HJYx3atFUCPSE=","X-Gm-Gg":"AfdE7clG1iLet75caAsyIIVqYOnmy5ZtRBRB2CTymppMUjf2M4nJ2YkjnqPamBfhjiP\n\tWTo8eOevf2d1Vfli+nDNiLBz33xISZLspXCAfP2xw7RxMHTNlE815VPoNZD4DeGRJ1pfYQ027xD\n\t7VJ43VVNWYlcZOD9E5xryG14PaM+GW+CgMOVXnIs/RbNEVrJthzdP6zFpjq4C+7SrukxFd4luLo\n\tZQaCGrJ20SzxrbHFcQyEAkGv4psyURCIWAwctDOaDEdFJfBl1LR2ei3z/O6KGFlyRrqb6AWtSPE\n\tr9I8y4nkk4RlxXn32DabHmDfRRm2s9/4rqfKqBoo2Mi6+84venp173civLsLPg9UorwFyFIAhZo\n\tB0k0=","X-Received":"by 2002:a05:6402:40c8:b0:698:be4d:ca2a with SMTP id\n\t4fb4d7f45d1cf-69e652895f1mr5003707a12.15.1784551986635;\n\tMon, 20 Jul 2026 05:53:06 -0700 (PDT)","MIME-Version":"1.0","References":"<20260720095951.49979-1-mzamazal@redhat.com>\n\t<d89acb81-7c89-4fd7-84fc-bd61c8b3de6b@collabora.com>","In-Reply-To":"<d89acb81-7c89-4fd7-84fc-bd61c8b3de6b@collabora.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Mon, 20 Jul 2026 13:52:55 +0100","X-Gm-Features":"AUfX_mxLkXPS6kTaf-UJThvrXKVi7gQIDb25xjyQw2DFgpgyFtZqKx9yhEI88co","Message-ID":"<CAHW6GYK+edwSvJ4xuO2Tfc6WZozB8DqQQy+cMbYg6R9eZVAFAQ@mail.gmail.com>","Subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","To":"Robert Mader <robert.mader@collabora.com>","Cc":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org,\n\t\"Bryan O'Donoghue\" <bod.linux@nxsw.ie>,\n\tHans de Goede <johannes.goede@oss.qualcomm.com>, \n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","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>"}},{"id":39767,"web_url":"https://patchwork.libcamera.org/comment/39767/","msgid":"<858q75kbjs.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2026-07-20T13:58:31","subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"David Plowman <david.plowman@raspberrypi.com> writes:\n\n> Hi everyone\n>\n> On Mon, 20 Jul 2026 at 13:19, Robert Mader <robert.mader@collabora.com> wrote:\n>>\n>> Hi Milan, thanks a lot for updating and rebasing the series!\n>>\n>> On 20.07.26 11:59, Milan Zamazal wrote:\n>> > Lens shading correction for software GPU ISP.  Based on the initial work\n>> > by Hans’s students, taken over and significantly modified and eventually\n>> > reworked to use LSC from libipa (the ongoing work by Jacopo and others).\n>> >\n>> > The LSC is not implemented for CPU ISP within this series; it may be\n>> > added later if needed.\n>> >\n>> > It’s RFC because:\n>> >\n>> > - It’s not yet completely tested although it seems to be working in my\n>> >    environment.\n>> > - It’s based on the libipa patches not yet merged.\n>> > - Further changes will be needed once GPU ISP multipass is merged.\n>> >\n>> > Example YAML for grid based LSC, no-op values, place it after Awb:\n>> >\n>> >    - Lsc:\n>> >        sets:\n>> >          - ct: 6500\n>> >            r: [\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n>> >            ]\n>> >            g: [\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n>> >            ]\n>> >            b: [\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n>> >            ]\n>>\n>> I wonder how compatible this implementation is with the RPi alsc\n>> algorithm - which would be great as it'd allow us to reuse the tuning\n>> data for e.g. the IMX355.\n>>\n>> Instead of RGB the values are stored as luminance_lut, calibrations_Cr\n>> and calibrations_Cb - and only the later two using ct. Further more it\n>> uses 32x32 instead of 16x16 values - and finally it uses floats (1.0\n>> instead of 64).\n>>\n>> It *looks* to me like we could add a script to convert those values,\n>> assuming the algorithms work similar in the end. What do you think / do\n>> you think that should work? Would it possibly even make sense to adopt\n>> the RPi format?\n>\n> To use the Pi format tables I would:\n>\n> Scale all three tables down to 16x16 (or you could do this at the\n> end). You might worry about about whether to preserve the corner\n> values or not, but realistically, any sensible scheme is likely to be\n> \"good enough\".\n\n32x32 can be used in software ISP if preferred, I don't see any obvious\npenalty.\n\nThe other stuff should be either addressed in libipa or subject to the\nconversion.\n\n> Use the luminance table for the green channel. We've never bothered\n> varying luminance correction according to colour temperature as we've\n> never noticed much effect, but there's no reason that one couldn't.\n>\n> Multiply the Cr and Cb tables elementwise by the luminance table.\n> Normalise the resulting tables so that that the minimum gain in each\n> table is 1.0. These will be the red and blue correction tables.\n>\n> (If anyone wonders why we separate Cr/Cb and luminance tables, it's so\n> that you can do less luminance correction without sacrificing the\n> colour correction.)\n>\n> Hope that clarifies things a bit!\n\nThank you for clarification!\n\n> David\n>\n>>\n>> Best regards,\n>>\n>> Robert\n>>\n>> >\n>> > Example YAML for polynomial based LSC, no-op values, place it after Awb:\n>> >\n>> >   - Lsc:\n>> >       type: \"polynomial\"\n>> >       sets:\n>> >         - ct: 6500\n>> >           r:\n>> >             cx: 0.0\n>> >             cy: 0.0\n>> >             k0: 0.0\n>> >             k1: 0.0\n>> >             k2: 0.0\n>> >             k3: 0.0\n>> >             k4: 0.0\n>> >           g:\n>> >             cx: 0.0\n>> >             cy: 0.0\n>> >             k0: 0.0\n>> >             k1: 0.0\n>> >             k2: 0.0\n>> >             k3: 0.0\n>> >             k4: 0.0\n>> >           b:\n>> >             cx: 0.0\n>> >             cy: 0.0\n>> >             k0: 0.0\n>> >             k1: 0.0\n>> >             k2: 0.0\n>> >             k3: 0.0\n>> >             k4: 0.0\n>> >\n>> > Changes in v9:\n>> > - Rebased on the latest master.\n>> >\n>> > Changes in v8:\n>> > - LscValueType removed.\n>> > - A named constant introduced for minimum temperature change.\n>> > - A clarification comment added to the LUT value computation.\n>> > - lsc-enabled shader flag and the related variables removed.\n>> > - Wording corrections suggested by Bryan.\n>> >\n>> > Changes in v7:\n>> > - Updated for libipa patches v5 (temperature access).\n>> >\n>> > Changes in v6:\n>> > - Rebased on Jacopo’s libipa patches (v3).\n>> > - Not updating LSC tables on small or no temperature changes.\n>> > - Using libipa LSC algorithms; the implementation in ‘simple’ IPA\n>> >    algorithm reduced to the minimum needed.\n>> > - Grid tables are defined using integers rather than floats, because\n>> >    libipa LSC supports only quantised values and not floats.\n>> > - New boolean uniform to enable or disable LSC dynamically, rather than\n>> >    only in shaders compile time; to be able to honour the LSC control.\n>> > - Specific handling of polynomial LSC removed.  Polynomial LSC is\n>> >    already handled by libipa, by making a grid-based LSC from it.  While\n>> >    a direct polynomial computation may be a bit faster with a minimum\n>> >    number of the polynomial coefficients, the simplicity wins.  If we\n>> >    liked to have direct polynomial LSC computation, it should be\n>> >    implemented with help of libipa.\n>> >\n>> > Changes in v5:\n>> > - ‘grids’ tuning file item renamed to ‘sets’ for consistency with rkisp1.\n>> > - Underscores appended to Lsc::lsc* names.\n>> > - Other minor stylistic changes.\n>> > - Proof-of-concept polynomial LSC implemented.\n>> >\n>> > Changes in v4:\n>> > - glFilterParam -> param\n>> > - Indentation changes in the shaders.\n>> > - A commit message part about temperature reworded.\n>> > - Updated for YamlObject -> ValueNode.\n>> > - New constant kLscValuesPerCell to distinguish between the constants\n>> >    for the params array size (values) and for the stride (bytes).\n>> > - The lookup array switched to floats and the texture to half-floats.\n>> >\n>> > Changes in v3:\n>> > - LSC scripts patch dropped due to missing licences.\n>> > - DO_LSC -> APPLY_LSC\n>> > - textureUniformLsc_ is assigned unconditionally now.\n>> > - New constant DebayerParams::kLscBytesPerCell.\n>> > - LSC values in the tuning file are floats now and converted to bytes internally.\n>> > - Source code comments added to clarify the usage of the byte LUTs.\n>> >\n>> > Changes in v2:\n>> > - Remaining issues from the reviews (hopefully) addressed.\n>> > - Especially there is only a single texture now and LSC is fully\n>> >    conditional.\n>> > - Major cleanup, hacks removed or replaced, typo fixes, cosmetic\n>> >    changes, making linters happy, etc.\n>> > - See\n>> >    https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056883.html\n>> >    for an example how to add the grid data.\n>> >\n>> > Milan Zamazal (1):\n>> >    libcamera: software_isp: Pass LSC availability to debayering\n>> >\n>> > Xander Pronk (5):\n>> >    libcamera: software_isp: egl: Add filter parameter to\n>> >      createTexture2D()\n>> >    libcamera: software_isp: Add LSC data to DebayerParams\n>> >    ipa: simple: Add LSC algorithm\n>> >    libcamera: shaders: Add LSC support\n>> >    libcamera: software_isp: debayer_egl: Add LSC support\n>> >\n>> >   include/libcamera/internal/egl.h              |   6 +-\n>> >   .../internal/software_isp/debayer_params.h    |   9 ++\n>> >   .../internal/software_isp/software_isp.h      |   1 +\n>> >   include/libcamera/ipa/soft.mojom              |   4 +-\n>> >   src/ipa/simple/algorithms/lsc.cpp             | 100 ++++++++++++++++++\n>> >   src/ipa/simple/algorithms/lsc.h               |  50 +++++++++\n>> >   src/ipa/simple/algorithms/meson.build         |   1 +\n>> >   src/ipa/simple/ipa_context.h                  |   6 ++\n>> >   src/ipa/simple/soft_simple.cpp                |   7 +-\n>> >   src/libcamera/egl.cpp                         |  19 ++--\n>> >   src/libcamera/shaders/bayer_1x_packed.frag    |   8 ++\n>> >   src/libcamera/shaders/bayer_unpacked.frag     |   8 ++\n>> >   src/libcamera/software_isp/debayer.cpp        |  29 +++++\n>> >   src/libcamera/software_isp/debayer.h          |   3 +-\n>> >   src/libcamera/software_isp/debayer_cpu.cpp    |   3 +-\n>> >   src/libcamera/software_isp/debayer_cpu.h      |   3 +-\n>> >   src/libcamera/software_isp/debayer_egl.cpp    |  37 ++++++-\n>> >   src/libcamera/software_isp/debayer_egl.h      |  10 +-\n>> >   src/libcamera/software_isp/software_isp.cpp   |   5 +-\n>> >   19 files changed, 290 insertions(+), 19 deletions(-)\n>> >   create mode 100644 src/ipa/simple/algorithms/lsc.cpp\n>> >   create mode 100644 src/ipa/simple/algorithms/lsc.h\n>> >\n>> --\n>> Robert Mader\n>> Consultant Software Developer\n>>\n>> Collabora Ltd.\n>> Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK\n>> Registered in England & Wales, no. 5513718\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 DFD3ABDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jul 2026 13:58:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED0D667E44;\n\tMon, 20 Jul 2026 15:58:42 +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 F14BE66177\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jul 2026 15:58:40 +0200 (CEST)","from mail-wm1-f72.google.com (mail-wm1-f72.google.com\n\t[209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-632-98mRR-wJNQ2dsdoP3yN-Bw-1; Mon, 20 Jul 2026 09:58:37 -0400","by mail-wm1-f72.google.com with SMTP id\n\t5b1f17b1804b1-4955843c6cdso14777595e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jul 2026 06:58:37 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-4.net.vodafone.cz. [77.48.47.4])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4954995b78dsm184891565e9.0.2026.07.20.06.58.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 20 Jul 2026 06:58:34 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"JO6oJePo\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1784555919;\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=ILjH8oOAW9caL1980IhrZpRrmz/CmauiF5nsCamsHgQ=;\n\tb=JO6oJePoPsdAK7+9dtnE5MRHIq9mRd1jAycx7pexGJq/lgXv9OUIeL0CAXj0S5b0DAoKod\n\trnnJpGecUDN5Tlwv61xxHWDQtCwUfXs9xKY3feY43m+X0+PwiPdK5pRCjOiNN+Cv+pc98b\n\tytikmz6TeogFMiYXj1+HZGqDvtq7Mwc=","X-MC-Unique":"98mRR-wJNQ2dsdoP3yN-Bw-1","X-Mimecast-MFC-AGG-ID":"98mRR-wJNQ2dsdoP3yN-Bw_1784555916","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1784555916; x=1785160716;\n\th=content-transfer-encoding:content-type:mime-version:user-agent\n\t:message-id:date:references:in-reply-to:subject:cc:to:from:x-gm-gg\n\t:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to\n\t:content-type;\n\tbh=lPxYncIVl8nKMhgvXHxJbtjji61SpPJnIo1EQMBtAzg=;\n\tb=b+oZtQAVrzi+mfaLZIA7edFSDmNRFqpsnGXytEHm+XiBTLRiJnnFMAJdOMeAC8jcaK\n\tf3yY8Q4CNsco1LQXSyHMRnREWX2M1R3AN5TM/IMMDbdXaEM+Zny/CC33Pc6XfLgE756Y\n\tafMcHoiKZ9WoD+4HJOzEivXdhbnZVGLN4vbLug4eP+5zbXx5pfd1T6mIP3UOGAfFyRqo\n\tNOXRL4Yn7qWD1s/y2UpzdW88urSfGpenDqxMeoaOaxI22mOKNjSCc27LkEy9trbtpP6g\n\trK61YOwmuWBEUqW59V5wmPuOk/BZ5mqgvbggv72ZJtPcLKdSq9e5nuDHIdmWuVe0u6Ye\n\tVN5A==","X-Forwarded-Encrypted":"i=1;\n\tAHgh+RqFxMKJsPCdE/cKFzuep3WyGVm0X04ZyX1CiX6cRt6CgQ7V9B7EvsHZT6FroCzQlX7DeaxXGkKpTTuPxqPNbLU=@lists.libcamera.org","X-Gm-Message-State":"AOJu0Yw6c5HzIMIOoJW/jwMxT1n/Higz3PjIl0ZaDsPk55jfuJtaz0nZ\n\tjiAqESnRgWlpGdQ5SV82DAxJ2ohFGAdT37nMy+RHomwdT6P7zXg9lT7LfDPPwA+azxXkPF8jdzf\n\tk/+SSmHjmT9vNf+QSYCOgNgtj3M7dbvkQ36KaxqKtTN/NOw8gjF6CleMoK0f+KsJqZBWBrEx2Sx\n\tU=","X-Gm-Gg":"AfdE7cl3XxhpQ/G0s1EPj2guxsi5T7OjfiA8G1IbrnTtTaqkHsZG7sRroluXmBP2I4N\n\trLoFQQjCX68A6TarLj5NgmBwr90PK1VgRjqkJMb+4dyiiBeIPnHaVEVv+e3c+MwUHAVaJgEahcF\n\tqX271ejOpmfN5HJQqpwGMzkbDSm8aYYU6cECu0f4c/z1kZKOnJWilGPEX/xKdP3mN06npp92OTf\n\tYXc0+3LCyvICxOZ7htWUNt9Qs8x/Pk9Bxj0Yi4R0ZN2kHvYKkX3paZ/cnUhluf7vgLzFDd/ctTx\n\tEy62ITXrltHMRNIxX/3WYGCx3SWd6CqHKQv3vwJfnBj4mIjPlcN4vllx0pKbHI3pLuSs3dmPqfP\n\tUcAh4SJKetV124U/llrQ2RfR9CErpyUXKhfQcfIE9L5YVbFlOV+PUvQ==","X-Received":["by 2002:a05:600c:4fc3:b0:495:4a22:d684 with SMTP id\n\t5b1f17b1804b1-4954a3db781mr144394015e9.10.1784555915953; \n\tMon, 20 Jul 2026 06:58:35 -0700 (PDT)","by 2002:a05:600c:4fc3:b0:495:4a22:d684 with SMTP id\n\t5b1f17b1804b1-4954a3db781mr144393615e9.10.1784555915387; \n\tMon, 20 Jul 2026 06:58:35 -0700 (PDT)"],"From":"Milan Zamazal <mzamazal@redhat.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"Robert Mader <robert.mader@collabora.com>,\n\tlibcamera-devel@lists.libcamera.org,  \"Bryan O'Donoghue\"\n\t<bod.linux@nxsw.ie>, Hans de Goede <johannes.goede@oss.qualcomm.com>, \n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","In-Reply-To":"<CAHW6GYK+edwSvJ4xuO2Tfc6WZozB8DqQQy+cMbYg6R9eZVAFAQ@mail.gmail.com>\n\t(David Plowman's message of \"Mon, 20 Jul 2026 13:52:55 +0100\")","References":"<20260720095951.49979-1-mzamazal@redhat.com>\n\t<d89acb81-7c89-4fd7-84fc-bd61c8b3de6b@collabora.com>\n\t<CAHW6GYK+edwSvJ4xuO2Tfc6WZozB8DqQQy+cMbYg6R9eZVAFAQ@mail.gmail.com>","Date":"Mon, 20 Jul 2026 15:58:31 +0200","Message-ID":"<858q75kbjs.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"ke14bbQ6kG9zw5TF6T90M9G04WzzHXaaYkSsrl-u9HU_1784555916","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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>"}},{"id":39768,"web_url":"https://patchwork.libcamera.org/comment/39768/","msgid":"<al41sbXaMdkDfihb@zed>","date":"2026-07-20T14:57:51","subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Robert, Milan\n\nOn Mon, Jul 20, 2026 at 02:19:31PM +0200, Robert Mader wrote:\n> Hi Milan, thanks a lot for updating and rebasing the series!\n\nMilan, just an heads-up.\n\nI am about to send out v6 and I had to change the LscAlgorithm\ninterface, so this will need a rebase\n\nI largely prefer the implementation in v5 for what is worth, your\ninput would be valuable there.\n\n>\n> On 20.07.26 11:59, Milan Zamazal wrote:\n> > Lens shading correction for software GPU ISP.  Based on the initial work\n> > by Hans’s students, taken over and significantly modified and eventually\n> > reworked to use LSC from libipa (the ongoing work by Jacopo and others).\n> >\n> > The LSC is not implemented for CPU ISP within this series; it may be\n> > added later if needed.\n> >\n> > It’s RFC because:\n> >\n> > - It’s not yet completely tested although it seems to be working in my\n> >    environment.\n> > - It’s based on the libipa patches not yet merged.\n> > - Further changes will be needed once GPU ISP multipass is merged.\n> >\n> > Example YAML for grid based LSC, no-op values, place it after Awb:\n> >\n> >    - Lsc:\n> >        sets:\n> >          - ct: 6500\n> >            r: [\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n> >            ]\n> >            g: [\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n> >            ]\n> >            b: [\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n> >            ]\n>\n> I wonder how compatible this implementation is with the RPi alsc algorithm -\n> which would be great as it'd allow us to reuse the tuning data for e.g. the\n> IMX355.\n>\n> Instead of RGB the values are stored as luminance_lut, calibrations_Cr and\n> calibrations_Cb - and only the later two using ct. Further more it uses\n> 32x32 instead of 16x16 values - and finally it uses floats (1.0 instead of\n> 64).\n\nI guess the direction where we want to go for platforms using libIPA\nis to define a platform independent LSC tables format, where gains are\nexpressed as floats in the tuning file.\n\nLet's keep in mind compatibility with rpi when we'll get there.\n\n>\n> It *looks* to me like we could add a script to convert those values,\n\nThat's what we did in the past\n\n> assuming the algorithms work similar in the end. What do you think / do you\n> think that should work? Would it possibly even make sense to adopt the RPi\n> format?\n\nIt seems to me the rpi format is organized as\n\n        - Calibration_Cr\n           - ct: xxx\n             table: []\n           - ct: yyy\n             table: []\n        - Calibration_Cb\n           - ct: xxx\n             table: []\n           - ct: yyy\n             table: []\n        - luminance_lut:\n           - ct: xxx\n             table: []\n           - ct: yyy\n             table: []\n\nWhile we have tables in\n\n        - ct: xxx\n          r: []\n          b: []\n          g: []\n\n        - ct: yyy\n          r: []\n          b: []\n          g: []\n\nI don't think there are specific merits in any of the two formats, but\nthey're quiet different at the moment\n\n>\n> Best regards,\n>\n> Robert\n>\n> >\n> > Example YAML for polynomial based LSC, no-op values, place it after Awb:\n> >\n> >   - Lsc:\n> >       type: \"polynomial\"\n> >       sets:\n> >         - ct: 6500\n> >           r:\n> >             cx: 0.0\n> >             cy: 0.0\n> >             k0: 0.0\n> >             k1: 0.0\n> >             k2: 0.0\n> >             k3: 0.0\n> >             k4: 0.0\n> >           g:\n> >             cx: 0.0\n> >             cy: 0.0\n> >             k0: 0.0\n> >             k1: 0.0\n> >             k2: 0.0\n> >             k3: 0.0\n> >             k4: 0.0\n> >           b:\n> >             cx: 0.0\n> >             cy: 0.0\n> >             k0: 0.0\n> >             k1: 0.0\n> >             k2: 0.0\n> >             k3: 0.0\n> >             k4: 0.0\n> >\n> > Changes in v9:\n> > - Rebased on the latest master.\n> >\n> > Changes in v8:\n> > - LscValueType removed.\n> > - A named constant introduced for minimum temperature change.\n> > - A clarification comment added to the LUT value computation.\n> > - lsc-enabled shader flag and the related variables removed.\n> > - Wording corrections suggested by Bryan.\n> >\n> > Changes in v7:\n> > - Updated for libipa patches v5 (temperature access).\n> >\n> > Changes in v6:\n> > - Rebased on Jacopo’s libipa patches (v3).\n> > - Not updating LSC tables on small or no temperature changes.\n> > - Using libipa LSC algorithms; the implementation in ‘simple’ IPA\n> >    algorithm reduced to the minimum needed.\n> > - Grid tables are defined using integers rather than floats, because\n> >    libipa LSC supports only quantised values and not floats.\n> > - New boolean uniform to enable or disable LSC dynamically, rather than\n> >    only in shaders compile time; to be able to honour the LSC control.\n> > - Specific handling of polynomial LSC removed.  Polynomial LSC is\n> >    already handled by libipa, by making a grid-based LSC from it.  While\n> >    a direct polynomial computation may be a bit faster with a minimum\n> >    number of the polynomial coefficients, the simplicity wins.  If we\n> >    liked to have direct polynomial LSC computation, it should be\n> >    implemented with help of libipa.\n> >\n> > Changes in v5:\n> > - ‘grids’ tuning file item renamed to ‘sets’ for consistency with rkisp1.\n> > - Underscores appended to Lsc::lsc* names.\n> > - Other minor stylistic changes.\n> > - Proof-of-concept polynomial LSC implemented.\n> >\n> > Changes in v4:\n> > - glFilterParam -> param\n> > - Indentation changes in the shaders.\n> > - A commit message part about temperature reworded.\n> > - Updated for YamlObject -> ValueNode.\n> > - New constant kLscValuesPerCell to distinguish between the constants\n> >    for the params array size (values) and for the stride (bytes).\n> > - The lookup array switched to floats and the texture to half-floats.\n> >\n> > Changes in v3:\n> > - LSC scripts patch dropped due to missing licences.\n> > - DO_LSC -> APPLY_LSC\n> > - textureUniformLsc_ is assigned unconditionally now.\n> > - New constant DebayerParams::kLscBytesPerCell.\n> > - LSC values in the tuning file are floats now and converted to bytes internally.\n> > - Source code comments added to clarify the usage of the byte LUTs.\n> >\n> > Changes in v2:\n> > - Remaining issues from the reviews (hopefully) addressed.\n> > - Especially there is only a single texture now and LSC is fully\n> >    conditional.\n> > - Major cleanup, hacks removed or replaced, typo fixes, cosmetic\n> >    changes, making linters happy, etc.\n> > - See\n> >    https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056883.html\n> >    for an example how to add the grid data.\n> >\n> > Milan Zamazal (1):\n> >    libcamera: software_isp: Pass LSC availability to debayering\n> >\n> > Xander Pronk (5):\n> >    libcamera: software_isp: egl: Add filter parameter to\n> >      createTexture2D()\n> >    libcamera: software_isp: Add LSC data to DebayerParams\n> >    ipa: simple: Add LSC algorithm\n> >    libcamera: shaders: Add LSC support\n> >    libcamera: software_isp: debayer_egl: Add LSC support\n> >\n> >   include/libcamera/internal/egl.h              |   6 +-\n> >   .../internal/software_isp/debayer_params.h    |   9 ++\n> >   .../internal/software_isp/software_isp.h      |   1 +\n> >   include/libcamera/ipa/soft.mojom              |   4 +-\n> >   src/ipa/simple/algorithms/lsc.cpp             | 100 ++++++++++++++++++\n> >   src/ipa/simple/algorithms/lsc.h               |  50 +++++++++\n> >   src/ipa/simple/algorithms/meson.build         |   1 +\n> >   src/ipa/simple/ipa_context.h                  |   6 ++\n> >   src/ipa/simple/soft_simple.cpp                |   7 +-\n> >   src/libcamera/egl.cpp                         |  19 ++--\n> >   src/libcamera/shaders/bayer_1x_packed.frag    |   8 ++\n> >   src/libcamera/shaders/bayer_unpacked.frag     |   8 ++\n> >   src/libcamera/software_isp/debayer.cpp        |  29 +++++\n> >   src/libcamera/software_isp/debayer.h          |   3 +-\n> >   src/libcamera/software_isp/debayer_cpu.cpp    |   3 +-\n> >   src/libcamera/software_isp/debayer_cpu.h      |   3 +-\n> >   src/libcamera/software_isp/debayer_egl.cpp    |  37 ++++++-\n> >   src/libcamera/software_isp/debayer_egl.h      |  10 +-\n> >   src/libcamera/software_isp/software_isp.cpp   |   5 +-\n> >   19 files changed, 290 insertions(+), 19 deletions(-)\n> >   create mode 100644 src/ipa/simple/algorithms/lsc.cpp\n> >   create mode 100644 src/ipa/simple/algorithms/lsc.h\n> >\n> --\n> Robert Mader\n> Consultant Software Developer\n>\n> Collabora Ltd.\n> Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK\n> Registered in England & Wales, no. 5513718\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 2F624BDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jul 2026 14:57:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3212167E52;\n\tMon, 20 Jul 2026 16:57:57 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D89B66177\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jul 2026 16:57:55 +0200 (CEST)","from ideasonboard.com (mob-5-90-63-152.net.vodafone.it\n\t[5.90.63.152])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5A782270;\n\tMon, 20 Jul 2026 16:56:56 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"jYITDnix\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784559416;\n\tbh=O1fa162SNcpn2lTDWd4QH1+lastx7gB7gl7QObLNSnc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=jYITDnixCWkO9RPxHPuByU7/lHkKzeBiFZv9OGDaumPik3dHM6mYF4SK0Emjb/cpd\n\tnAA8RtinW14oRYB/SlBaD+aoz5XiPZlaoAnleR0objKPFn6LiMvOQMI822z8yii9tm\n\t7C8k7vMmWQWKgbaJuIF7ph5sDquBDKXgu193NIPg=","Date":"Mon, 20 Jul 2026 16:57:51 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Robert Mader <robert.mader@collabora.com>","Cc":"Milan Zamazal <mzamazal@redhat.com>, \n\tlibcamera-devel@lists.libcamera.org,\n\tBryan O'Donoghue <bod.linux@nxsw.ie>, \n\tHans de Goede <johannes.goede@oss.qualcomm.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","Message-ID":"<al41sbXaMdkDfihb@zed>","References":"<20260720095951.49979-1-mzamazal@redhat.com>\n\t<d89acb81-7c89-4fd7-84fc-bd61c8b3de6b@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<d89acb81-7c89-4fd7-84fc-bd61c8b3de6b@collabora.com>","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>"}},{"id":39770,"web_url":"https://patchwork.libcamera.org/comment/39770/","msgid":"<20260720164609.GD9442@killaraus.ideasonboard.com>","date":"2026-07-20T16:46:09","subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Jul 20, 2026 at 04:57:51PM +0200, Jacopo Mondi wrote:\n> Hi Robert, Milan\n> \n> On Mon, Jul 20, 2026 at 02:19:31PM +0200, Robert Mader wrote:\n> > Hi Milan, thanks a lot for updating and rebasing the series!\n> \n> Milan, just an heads-up.\n> \n> I am about to send out v6 and I had to change the LscAlgorithm\n> interface, so this will need a rebase\n> \n> I largely prefer the implementation in v5 for what is worth, your\n> input would be valuable there.\n> \n> > On 20.07.26 11:59, Milan Zamazal wrote:\n> > > Lens shading correction for software GPU ISP.  Based on the initial work\n> > > by Hans’s students, taken over and significantly modified and eventually\n> > > reworked to use LSC from libipa (the ongoing work by Jacopo and others).\n> > >\n> > > The LSC is not implemented for CPU ISP within this series; it may be\n> > > added later if needed.\n> > >\n> > > It’s RFC because:\n> > >\n> > > - It’s not yet completely tested although it seems to be working in my\n> > >    environment.\n> > > - It’s based on the libipa patches not yet merged.\n> > > - Further changes will be needed once GPU ISP multipass is merged.\n> > >\n> > > Example YAML for grid based LSC, no-op values, place it after Awb:\n> > >\n> > >    - Lsc:\n> > >        sets:\n> > >          - ct: 6500\n> > >            r: [\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n> > >            ]\n> > >            g: [\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n> > >            ]\n> > >            b: [\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n> > >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n> > >            ]\n> >\n> > I wonder how compatible this implementation is with the RPi alsc algorithm -\n> > which would be great as it'd allow us to reuse the tuning data for e.g. the\n> > IMX355.\n> >\n> > Instead of RGB the values are stored as luminance_lut, calibrations_Cr and\n> > calibrations_Cb - and only the later two using ct. Further more it uses\n> > 32x32 instead of 16x16 values - and finally it uses floats (1.0 instead of\n> > 64).\n> \n> I guess the direction where we want to go for platforms using libIPA\n> is to define a platform independent LSC tables format, where gains are\n> expressed as floats in the tuning file.\n> \n> Let's keep in mind compatibility with rpi when we'll get there.\n> \n> > It *looks* to me like we could add a script to convert those values,\n> \n> That's what we did in the past\n> \n> > assuming the algorithms work similar in the end. What do you think / do you\n> > think that should work? Would it possibly even make sense to adopt the RPi\n> > format?\n> \n> It seems to me the rpi format is organized as\n> \n>         - Calibration_Cr\n>            - ct: xxx\n>              table: []\n>            - ct: yyy\n>              table: []\n>         - Calibration_Cb\n>            - ct: xxx\n>              table: []\n>            - ct: yyy\n>              table: []\n>         - luminance_lut:\n>            - ct: xxx\n>              table: []\n>            - ct: yyy\n>              table: []\n> \n> While we have tables in\n> \n>         - ct: xxx\n>           r: []\n>           b: []\n>           g: []\n> \n>         - ct: yyy\n>           r: []\n>           b: []\n>           g: []\n> \n> I don't think there are specific merits in any of the two formats, but\n> they're quiet different at the moment\n\nIt probably doesn't matter too much indeed as all the data is parsed in\none go and stored in ad-hoc data structures. All other things being\nequal, I'd pick the format that results in the YAML file being easier to\nmanually read and edit.\n\nRGB vs. YCbCr on the other hand matters more. Do we want to support\nYCbCr in libipa ? Can we do so later while preserving backward\ncompatibility with RGB and keeping the code clean ?\n\n> > > Example YAML for polynomial based LSC, no-op values, place it after Awb:\n> > >\n> > >   - Lsc:\n> > >       type: \"polynomial\"\n> > >       sets:\n> > >         - ct: 6500\n> > >           r:\n> > >             cx: 0.0\n> > >             cy: 0.0\n> > >             k0: 0.0\n> > >             k1: 0.0\n> > >             k2: 0.0\n> > >             k3: 0.0\n> > >             k4: 0.0\n> > >           g:\n> > >             cx: 0.0\n> > >             cy: 0.0\n> > >             k0: 0.0\n> > >             k1: 0.0\n> > >             k2: 0.0\n> > >             k3: 0.0\n> > >             k4: 0.0\n> > >           b:\n> > >             cx: 0.0\n> > >             cy: 0.0\n> > >             k0: 0.0\n> > >             k1: 0.0\n> > >             k2: 0.0\n> > >             k3: 0.0\n> > >             k4: 0.0\n> > >\n> > > Changes in v9:\n> > > - Rebased on the latest master.\n> > >\n> > > Changes in v8:\n> > > - LscValueType removed.\n> > > - A named constant introduced for minimum temperature change.\n> > > - A clarification comment added to the LUT value computation.\n> > > - lsc-enabled shader flag and the related variables removed.\n> > > - Wording corrections suggested by Bryan.\n> > >\n> > > Changes in v7:\n> > > - Updated for libipa patches v5 (temperature access).\n> > >\n> > > Changes in v6:\n> > > - Rebased on Jacopo’s libipa patches (v3).\n> > > - Not updating LSC tables on small or no temperature changes.\n> > > - Using libipa LSC algorithms; the implementation in ‘simple’ IPA\n> > >    algorithm reduced to the minimum needed.\n> > > - Grid tables are defined using integers rather than floats, because\n> > >    libipa LSC supports only quantised values and not floats.\n> > > - New boolean uniform to enable or disable LSC dynamically, rather than\n> > >    only in shaders compile time; to be able to honour the LSC control.\n> > > - Specific handling of polynomial LSC removed.  Polynomial LSC is\n> > >    already handled by libipa, by making a grid-based LSC from it.  While\n> > >    a direct polynomial computation may be a bit faster with a minimum\n> > >    number of the polynomial coefficients, the simplicity wins.  If we\n> > >    liked to have direct polynomial LSC computation, it should be\n> > >    implemented with help of libipa.\n> > >\n> > > Changes in v5:\n> > > - ‘grids’ tuning file item renamed to ‘sets’ for consistency with rkisp1.\n> > > - Underscores appended to Lsc::lsc* names.\n> > > - Other minor stylistic changes.\n> > > - Proof-of-concept polynomial LSC implemented.\n> > >\n> > > Changes in v4:\n> > > - glFilterParam -> param\n> > > - Indentation changes in the shaders.\n> > > - A commit message part about temperature reworded.\n> > > - Updated for YamlObject -> ValueNode.\n> > > - New constant kLscValuesPerCell to distinguish between the constants\n> > >    for the params array size (values) and for the stride (bytes).\n> > > - The lookup array switched to floats and the texture to half-floats.\n> > >\n> > > Changes in v3:\n> > > - LSC scripts patch dropped due to missing licences.\n> > > - DO_LSC -> APPLY_LSC\n> > > - textureUniformLsc_ is assigned unconditionally now.\n> > > - New constant DebayerParams::kLscBytesPerCell.\n> > > - LSC values in the tuning file are floats now and converted to bytes internally.\n> > > - Source code comments added to clarify the usage of the byte LUTs.\n> > >\n> > > Changes in v2:\n> > > - Remaining issues from the reviews (hopefully) addressed.\n> > > - Especially there is only a single texture now and LSC is fully\n> > >    conditional.\n> > > - Major cleanup, hacks removed or replaced, typo fixes, cosmetic\n> > >    changes, making linters happy, etc.\n> > > - See\n> > >    https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056883.html\n> > >    for an example how to add the grid data.\n> > >\n> > > Milan Zamazal (1):\n> > >    libcamera: software_isp: Pass LSC availability to debayering\n> > >\n> > > Xander Pronk (5):\n> > >    libcamera: software_isp: egl: Add filter parameter to\n> > >      createTexture2D()\n> > >    libcamera: software_isp: Add LSC data to DebayerParams\n> > >    ipa: simple: Add LSC algorithm\n> > >    libcamera: shaders: Add LSC support\n> > >    libcamera: software_isp: debayer_egl: Add LSC support\n> > >\n> > >   include/libcamera/internal/egl.h              |   6 +-\n> > >   .../internal/software_isp/debayer_params.h    |   9 ++\n> > >   .../internal/software_isp/software_isp.h      |   1 +\n> > >   include/libcamera/ipa/soft.mojom              |   4 +-\n> > >   src/ipa/simple/algorithms/lsc.cpp             | 100 ++++++++++++++++++\n> > >   src/ipa/simple/algorithms/lsc.h               |  50 +++++++++\n> > >   src/ipa/simple/algorithms/meson.build         |   1 +\n> > >   src/ipa/simple/ipa_context.h                  |   6 ++\n> > >   src/ipa/simple/soft_simple.cpp                |   7 +-\n> > >   src/libcamera/egl.cpp                         |  19 ++--\n> > >   src/libcamera/shaders/bayer_1x_packed.frag    |   8 ++\n> > >   src/libcamera/shaders/bayer_unpacked.frag     |   8 ++\n> > >   src/libcamera/software_isp/debayer.cpp        |  29 +++++\n> > >   src/libcamera/software_isp/debayer.h          |   3 +-\n> > >   src/libcamera/software_isp/debayer_cpu.cpp    |   3 +-\n> > >   src/libcamera/software_isp/debayer_cpu.h      |   3 +-\n> > >   src/libcamera/software_isp/debayer_egl.cpp    |  37 ++++++-\n> > >   src/libcamera/software_isp/debayer_egl.h      |  10 +-\n> > >   src/libcamera/software_isp/software_isp.cpp   |   5 +-\n> > >   19 files changed, 290 insertions(+), 19 deletions(-)\n> > >   create mode 100644 src/ipa/simple/algorithms/lsc.cpp\n> > >   create mode 100644 src/ipa/simple/algorithms/lsc.h\n> > >\n> > --\n> > Robert Mader\n> > Consultant Software Developer\n> >\n> > Collabora Ltd.\n> > Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK\n> > Registered in England & Wales, no. 5513718\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 1B4D8C32FE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jul 2026 16:46:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3DAAA67E57;\n\tMon, 20 Jul 2026 18:46:13 +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 CC61E67E44\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jul 2026 18:46:10 +0200 (CEST)","from killaraus.ideasonboard.com\n\t(2001-14ba-70f3-e800--a06.rev.dnainternet.fi\n\t[IPv6:2001:14ba:70f3:e800::a06])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B92D2270;\n\tMon, 20 Jul 2026 18:45:11 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"SbSf0hKO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784565911;\n\tbh=l8GihSSESlDGapZnAIT1Sf33VRVNHbCw990kRJhaFaY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=SbSf0hKOwUuZ7ZAY90CuafUC8Ri7/+pCzSzvX9J8GP4FlHloqOUOOUAuwvBBW6/KA\n\tzWfAXXbgjg26cWq1Yy8n+6+ZZyUqU4T/fqbgs2H1sOwj+RKqBXUYSp4TnoiBWi5CG4\n\tlc3E7T/R8NjQJdFMQ49/8CQxDKgrXVgTsL3g/vfs=","Date":"Mon, 20 Jul 2026 19:46:09 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"Robert Mader <robert.mader@collabora.com>,\n\tMilan Zamazal <mzamazal@redhat.com>,\n\tlibcamera-devel@lists.libcamera.org, \n\tBryan O'Donoghue <bod.linux@nxsw.ie>,\n\tHans de Goede <johannes.goede@oss.qualcomm.com>","Subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","Message-ID":"<20260720164609.GD9442@killaraus.ideasonboard.com>","References":"<20260720095951.49979-1-mzamazal@redhat.com>\n\t<d89acb81-7c89-4fd7-84fc-bd61c8b3de6b@collabora.com>\n\t<al41sbXaMdkDfihb@zed>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<al41sbXaMdkDfihb@zed>","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>"}},{"id":39774,"web_url":"https://patchwork.libcamera.org/comment/39774/","msgid":"<85qzkwzfrp.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2026-07-21T12:30:34","subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Jacopo,\n\nJacopo Mondi <jacopo.mondi@ideasonboard.com> writes:\n\n> Hi Robert, Milan\n>\n> On Mon, Jul 20, 2026 at 02:19:31PM +0200, Robert Mader wrote:\n>> Hi Milan, thanks a lot for updating and rebasing the series!\n>\n> Milan, just an heads-up.\n>\n> I am about to send out v6 and I had to change the LscAlgorithm\n> interface, so this will need a rebase\n\nOK, I rebased successfully but waiting with posting v10 for now.\n\n> I largely prefer the implementation in v5 for what is worth, your\n> input would be valuable there.\n\nI feel a bit uncomfortable with the changes I had to do in `simple' IPA\nfor libipa v6; I commented in the corresponding thread.\n\n>>\n>> On 20.07.26 11:59, Milan Zamazal wrote:\n>> > Lens shading correction for software GPU ISP.  Based on the initial work\n>> > by Hans’s students, taken over and significantly modified and eventually\n>> > reworked to use LSC from libipa (the ongoing work by Jacopo and others).\n>> >\n>> > The LSC is not implemented for CPU ISP within this series; it may be\n>> > added later if needed.\n>> >\n>> > It’s RFC because:\n>> >\n>> > - It’s not yet completely tested although it seems to be working in my\n>> >    environment.\n>> > - It’s based on the libipa patches not yet merged.\n>> > - Further changes will be needed once GPU ISP multipass is merged.\n>> >\n>> > Example YAML for grid based LSC, no-op values, place it after Awb:\n>> >\n>> >    - Lsc:\n>> >        sets:\n>> >          - ct: 6500\n>> >            r: [\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n>> >            ]\n>> >            g: [\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n>> >            ]\n>> >            b: [\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,\n>> >              64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64\n>> >            ]\n>>\n>> I wonder how compatible this implementation is with the RPi alsc algorithm -\n>> which would be great as it'd allow us to reuse the tuning data for e.g. the\n>> IMX355.\n>>\n>> Instead of RGB the values are stored as luminance_lut, calibrations_Cr and\n>> calibrations_Cb - and only the later two using ct. Further more it uses\n>> 32x32 instead of 16x16 values - and finally it uses floats (1.0 instead of\n>> 64).\n>\n> I guess the direction where we want to go for platforms using libIPA\n> is to define a platform independent LSC tables format, where gains are\n> expressed as floats in the tuning file.\n>\n> Let's keep in mind compatibility with rpi when we'll get there.\n>\n>>\n>> It *looks* to me like we could add a script to convert those values,\n>\n> That's what we did in the past\n>\n>> assuming the algorithms work similar in the end. What do you think / do you\n>> think that should work? Would it possibly even make sense to adopt the RPi\n>> format?\n>\n> It seems to me the rpi format is organized as\n>\n>         - Calibration_Cr\n>            - ct: xxx\n>              table: []\n>            - ct: yyy\n>              table: []\n>         - Calibration_Cb\n>            - ct: xxx\n>              table: []\n>            - ct: yyy\n>              table: []\n>         - luminance_lut:\n>            - ct: xxx\n>              table: []\n>            - ct: yyy\n>              table: []\n>\n> While we have tables in\n>\n>         - ct: xxx\n>           r: []\n>           b: []\n>           g: []\n>\n>         - ct: yyy\n>           r: []\n>           b: []\n>           g: []\n>\n> I don't think there are specific merits in any of the two formats, but\n> they're quiet different at the moment\n>\n>>\n>> Best regards,\n>>\n>> Robert\n>>\n>> >\n>> > Example YAML for polynomial based LSC, no-op values, place it after Awb:\n>> >\n>> >   - Lsc:\n>> >       type: \"polynomial\"\n>> >       sets:\n>> >         - ct: 6500\n>> >           r:\n>> >             cx: 0.0\n>> >             cy: 0.0\n>> >             k0: 0.0\n>> >             k1: 0.0\n>> >             k2: 0.0\n>> >             k3: 0.0\n>> >             k4: 0.0\n>> >           g:\n>> >             cx: 0.0\n>> >             cy: 0.0\n>> >             k0: 0.0\n>> >             k1: 0.0\n>> >             k2: 0.0\n>> >             k3: 0.0\n>> >             k4: 0.0\n>> >           b:\n>> >             cx: 0.0\n>> >             cy: 0.0\n>> >             k0: 0.0\n>> >             k1: 0.0\n>> >             k2: 0.0\n>> >             k3: 0.0\n>> >             k4: 0.0\n>> >\n>> > Changes in v9:\n>> > - Rebased on the latest master.\n>> >\n>> > Changes in v8:\n>> > - LscValueType removed.\n>> > - A named constant introduced for minimum temperature change.\n>> > - A clarification comment added to the LUT value computation.\n>> > - lsc-enabled shader flag and the related variables removed.\n>> > - Wording corrections suggested by Bryan.\n>> >\n>> > Changes in v7:\n>> > - Updated for libipa patches v5 (temperature access).\n>> >\n>> > Changes in v6:\n>> > - Rebased on Jacopo’s libipa patches (v3).\n>> > - Not updating LSC tables on small or no temperature changes.\n>> > - Using libipa LSC algorithms; the implementation in ‘simple’ IPA\n>> >    algorithm reduced to the minimum needed.\n>> > - Grid tables are defined using integers rather than floats, because\n>> >    libipa LSC supports only quantised values and not floats.\n>> > - New boolean uniform to enable or disable LSC dynamically, rather than\n>> >    only in shaders compile time; to be able to honour the LSC control.\n>> > - Specific handling of polynomial LSC removed.  Polynomial LSC is\n>> >    already handled by libipa, by making a grid-based LSC from it.  While\n>> >    a direct polynomial computation may be a bit faster with a minimum\n>> >    number of the polynomial coefficients, the simplicity wins.  If we\n>> >    liked to have direct polynomial LSC computation, it should be\n>> >    implemented with help of libipa.\n>> >\n>> > Changes in v5:\n>> > - ‘grids’ tuning file item renamed to ‘sets’ for consistency with rkisp1.\n>> > - Underscores appended to Lsc::lsc* names.\n>> > - Other minor stylistic changes.\n>> > - Proof-of-concept polynomial LSC implemented.\n>> >\n>> > Changes in v4:\n>> > - glFilterParam -> param\n>> > - Indentation changes in the shaders.\n>> > - A commit message part about temperature reworded.\n>> > - Updated for YamlObject -> ValueNode.\n>> > - New constant kLscValuesPerCell to distinguish between the constants\n>> >    for the params array size (values) and for the stride (bytes).\n>> > - The lookup array switched to floats and the texture to half-floats.\n>> >\n>> > Changes in v3:\n>> > - LSC scripts patch dropped due to missing licences.\n>> > - DO_LSC -> APPLY_LSC\n>> > - textureUniformLsc_ is assigned unconditionally now.\n>> > - New constant DebayerParams::kLscBytesPerCell.\n>> > - LSC values in the tuning file are floats now and converted to bytes internally.\n>> > - Source code comments added to clarify the usage of the byte LUTs.\n>> >\n>> > Changes in v2:\n>> > - Remaining issues from the reviews (hopefully) addressed.\n>> > - Especially there is only a single texture now and LSC is fully\n>> >    conditional.\n>> > - Major cleanup, hacks removed or replaced, typo fixes, cosmetic\n>> >    changes, making linters happy, etc.\n>> > - See\n>> >    https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056883.html\n>> >    for an example how to add the grid data.\n>> >\n>> > Milan Zamazal (1):\n>> >    libcamera: software_isp: Pass LSC availability to debayering\n>> >\n>> > Xander Pronk (5):\n>> >    libcamera: software_isp: egl: Add filter parameter to\n>> >      createTexture2D()\n>> >    libcamera: software_isp: Add LSC data to DebayerParams\n>> >    ipa: simple: Add LSC algorithm\n>> >    libcamera: shaders: Add LSC support\n>> >    libcamera: software_isp: debayer_egl: Add LSC support\n>> >\n>> >   include/libcamera/internal/egl.h              |   6 +-\n>> >   .../internal/software_isp/debayer_params.h    |   9 ++\n>> >   .../internal/software_isp/software_isp.h      |   1 +\n>> >   include/libcamera/ipa/soft.mojom              |   4 +-\n>> >   src/ipa/simple/algorithms/lsc.cpp             | 100 ++++++++++++++++++\n>> >   src/ipa/simple/algorithms/lsc.h               |  50 +++++++++\n>> >   src/ipa/simple/algorithms/meson.build         |   1 +\n>> >   src/ipa/simple/ipa_context.h                  |   6 ++\n>> >   src/ipa/simple/soft_simple.cpp                |   7 +-\n>> >   src/libcamera/egl.cpp                         |  19 ++--\n>> >   src/libcamera/shaders/bayer_1x_packed.frag    |   8 ++\n>> >   src/libcamera/shaders/bayer_unpacked.frag     |   8 ++\n>> >   src/libcamera/software_isp/debayer.cpp        |  29 +++++\n>> >   src/libcamera/software_isp/debayer.h          |   3 +-\n>> >   src/libcamera/software_isp/debayer_cpu.cpp    |   3 +-\n>> >   src/libcamera/software_isp/debayer_cpu.h      |   3 +-\n>> >   src/libcamera/software_isp/debayer_egl.cpp    |  37 ++++++-\n>> >   src/libcamera/software_isp/debayer_egl.h      |  10 +-\n>> >   src/libcamera/software_isp/software_isp.cpp   |   5 +-\n>> >   19 files changed, 290 insertions(+), 19 deletions(-)\n>> >   create mode 100644 src/ipa/simple/algorithms/lsc.cpp\n>> >   create mode 100644 src/ipa/simple/algorithms/lsc.h\n>> >\n>> --\n>> Robert Mader\n>> Consultant Software Developer\n>>\n>> Collabora Ltd.\n>> Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK\n>> Registered in England & Wales, no. 5513718\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 EDFEBBDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 21 Jul 2026 12:30:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5236567E63;\n\tTue, 21 Jul 2026 14:30:42 +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 1D33C6601C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Jul 2026 14:30:41 +0200 (CEST)","from mail-wm1-f72.google.com (mail-wm1-f72.google.com\n\t[209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-168-p57hAvHUODWy89S9Dl8Dnw-1; Tue, 21 Jul 2026 08:30:38 -0400","by mail-wm1-f72.google.com with SMTP id\n\t5b1f17b1804b1-4955edc851aso11060655e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Jul 2026 05:30:38 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb ([213.175.46.86])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-49565482c5asm98741755e9.10.2026.07.21.05.30.35\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 21 Jul 2026 05:30:35 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"gIXa7zIv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1784637039;\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=kEIasjU+caBPOVAF2Xs9qe0+5MhaqpjVcXvqqMVspHI=;\n\tb=gIXa7zIvr4X6gAzu2jGqYgxTCgx6JpEGIG55lNjWzhC250wLfb+IDYf/UFJf6bRB1pzlcs\n\tHOi/zzIgmPQWRhWSdVFtIZwdWBST3iD6wblbNsZdZevI1GEfAYQ0Dr6b+bfKPoSECn0gaW\n\tYrGaB1NFZafUXVbeaYKWkC0C8SirEfM=","X-MC-Unique":"p57hAvHUODWy89S9Dl8Dnw-1","X-Mimecast-MFC-AGG-ID":"p57hAvHUODWy89S9Dl8Dnw_1784637037","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1784637037; x=1785241837;\n\th=content-transfer-encoding:content-type:mime-version:user-agent\n\t:message-id:date:references:in-reply-to:subject:cc:to:from:x-gm-gg\n\t:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to\n\t:content-type;\n\tbh=ow1G/PIuquKF5WVJ8M8yxYBfO/7Ax1Qh9XFwsb0piMc=;\n\tb=e7/seqLl3PXd4TlcW9IAh4tZiWSaoYdG0qKCYgKOEBy1f67INS4JT/DEmGvqm2k///\n\t4jjaJCp9tA1g/MY7mLyDQjPVNqwjSmAj2dqAkWq7CZrBU3PKAAnXU+q9uR9gKdAjt5by\n\tOcEi8KOG7h2SagmTxdQbCRtYM1nwtTVvmoBUs6wBQvOgFhcGUMOcTTw6yCT2BvNJbW/V\n\taKqWtwovN5u/VQoPa3IT8clBKWmktV43ojTaxe3K2sTTAe1CMEIkK2dHUIE9LZ+pePYn\n\tRZFMD2s8sbR1/b7QRYnBgoJBjSFcT7p6ayu8BVIx39eXNRz8Ynjt98F9BSQC9XfG+1sD\n\tQpWA==","X-Forwarded-Encrypted":"i=1;\n\tAHgh+RquozddVZ0vDCywypekkZrd4EFV3PaBPoutqGm5ovNzU9+6suWwFjSGocHRW7SVyRrTKFuSBeQPC14SeXXesVw=@lists.libcamera.org","X-Gm-Message-State":"AOJu0YypF3pN98KC+KPrujPndlHtahp/JIMkgr2QRHzo0h8eL6i2u4Xs\n\tpIPcgzdizUhiewPFWYgtE3fIRYylFMDr3NexPWkWKQbfvV/cTf6ufXIh9SZGYFkcy28e/42NWVK\n\tYbHaL3KrMg3xtPifQOoX6Lq+z9x/OQqBt29LvvZSnJ9wNPbRh4q0HRa91VQtDdfkZCQGIb10m4o\n\tQ=","X-Gm-Gg":"AfdE7cnKlbqWfpsQZqAqiRR5G3tDm6E7IpvEaeKq8K/UeYlY01k6g0PKl8tu1Tgf+Ow\n\tQa6v3yG9h0OF3tOg7+Me9hxP5D1KFu1odmMpip/0YlglGTDrPcQ9QotY92GhkGTQjZGsHmYYaBS\n\tnl/izWEOnSRTY/i2fh0sPeAo/bDJNaltegSR3ZVsFYzil8Q0DvlnQu6s7GozSgzO5qZsmoKrQhd\n\t/HD7+VmgzDzUTXc4tPRRsIVbx2NtHlCZl+jFqE9skWYaKU3y3wbuiHeKK1LLUtDomwqZZZoVLzO\n\t2vOy44O/P19htTZr2z8al0GLjhKbck8p+v1caLxN1gmSa3Sz5+n1QMFnbaHPfSZrDipBoE5LVI2\n\tlp6qHMuZd5lRna5h7","X-Received":["by 2002:a05:600c:470a:b0:495:69bd:17f7 with SMTP id\n\t5b1f17b1804b1-49569bd1862mr1806585e9.32.1784637037083; \n\tTue, 21 Jul 2026 05:30:37 -0700 (PDT)","by 2002:a05:600c:470a:b0:495:69bd:17f7 with SMTP id\n\t5b1f17b1804b1-49569bd1862mr1805815e9.32.1784637036493; \n\tTue, 21 Jul 2026 05:30:36 -0700 (PDT)"],"From":"Milan Zamazal <mzamazal@redhat.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"Robert Mader <robert.mader@collabora.com>,\n\tlibcamera-devel@lists.libcamera.org,  Bryan O'Donoghue\n\t<bod.linux@nxsw.ie>, Hans de Goede <johannes.goede@oss.qualcomm.com>, \n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [RFC PATCH v9 0/6] LSC for SoftISP simple pipeline","In-Reply-To":"<al41sbXaMdkDfihb@zed> (Jacopo Mondi's message of \"Mon, 20 Jul\n\t2026 16:57:51 +0200\")","References":"<20260720095951.49979-1-mzamazal@redhat.com>\n\t<d89acb81-7c89-4fd7-84fc-bd61c8b3de6b@collabora.com>\n\t<al41sbXaMdkDfihb@zed>","Date":"Tue, 21 Jul 2026 14:30:34 +0200","Message-ID":"<85qzkwzfrp.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"Dn_ZbBU-e_tW839eOafcqLDDUoH3alkM1HXWWpIqRnE_1784637037","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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>"}}]