[{"id":39688,"web_url":"https://patchwork.libcamera.org/comment/39688/","msgid":"<178401074921.3603632.15233355903490424065@localhost>","date":"2026-07-14T06:32:29","subject":"Re: [PATCH v5 27/36] ipa: libipa: lsc: Document Components parsing","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Jacopo,\n\nQuoting Jacopo Mondi (2026-07-08 17:51:09)\n> Document with examples how different IPA modules parse the tuning\n> file depending on the number of colour channels they support.\n> \n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> ---\n>  src/ipa/libipa/lsc.cpp | 111 +++++++++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 111 insertions(+)\n> \n> diff --git a/src/ipa/libipa/lsc.cpp b/src/ipa/libipa/lsc.cpp\n> index 796c75f6d729..26c3e9968072 100644\n> --- a/src/ipa/libipa/lsc.cpp\n> +++ b/src/ipa/libipa/lsc.cpp\n> @@ -68,6 +68,117 @@ namespace lsc {\n>   * tables are organized per-colour temperature with per-colour components gain\n>   * vectors or polynomial coefficients.\n>   *\n> + * The colour components names are IPA-implementation specific and depend on the\n> + * ISP LSC engine design. Some LSC engine support 4 colour components (r, gr,\n> + * gb, b), some only support 3 colour components (r, g, b). The name (and\n> + * number) of the expected colour components shall be provided to\n> + * LscAlgorithm::init() using the LscDescriptor::keys field.\n> + *\n> + * Example of a tabular lens shading tuning file with 'r', 'g' and 'b' colour\n> + * components. The gain table has been here omitted, but the expected number\n\nnit: s/here omitted/omitted here/\n\n> + * of entries has to be equal to\n> + * LscDescriptor::numHCells * LscDescriptor::numVCells.\n\nThis needs to be updated depending on the changes in the previous patch.\n\nWith that fixed:\nReviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> \n\nBest regards,\nStefan\n\n> + *\n> + * \\code{.yaml}\n> + * - Lsc:\n> + *    sets:\n> + *      - ct: 2500\n> + *        r: [\n> + *             .. gains table omitted..\n> + *        ]\n> + *        g: [\n> + *             .. gains table omitted..\n> + *        ]\n> + *        b: [\n> + *             .. gains table omitted..\n> + *        ]\n> + *      - ct: 6500\n> + *        r: [\n> + *             .. gains table omitted..\n> + *        ]\n> + *        g: [\n> + *             .. gains table omitted..\n> + *        ]\n> + *        b: [\n> + *             .. gains table omitted..\n> + *        ]\n> + * \\endcode\n> + *\n> + * Example of a polynomial lens shading tuning file with 'r', 'gr', 'gb' and 'b'\n> + * colour components:\n> + *\n> + * \\code{.yaml}\n> + * - Lsc:\n> + *    type: \"polynomial\"\n> + *    sets:\n> + *      - ct: 2500\n> + *        r:\n> + *          cx: 0.5006571711950275\n> + *          cy: 0.510093737499277\n> + *          k0: 1.5393282208428813\n> + *          k1: -1.1434559757908016\n> + *          k2: 4.332602305814554\n> + *          k3: 0.0\n> + *          k4: 0.0\n> + *        gr:\n> + *          cx: 0.5009320529087338\n> + *          cy: 0.511208038949085\n> + *          k0: 1.5634738574805407\n> + *          k1: -1.5623484259968348\n> + *          k2: 4.846686073656501\n> + *          k3: 0.0\n> + *          k4: 0.0\n> + *        gb:\n> + *          cx: 0.5012013290343839\n> + *          cy: 0.5128251541578288\n> + *          k0: 1.526147944919103\n> + *          k1: -1.4316976083689723\n> + *          k2: 4.792604063222728\n> + *          k3: 0.0\n> + *          k4: 0.0\n> + *        b:\n> + *          cx: 0.49864139511067784\n> + *          cy: 0.5162095081739346\n> + *          k0: 1.0405245474038738\n> + *          k1: 0.05618339879447103\n> + *          k2: 1.8792813594001752\n> + *          k3: 0.0\n> + *          k4: 0.0\n> + *      - ct: 6000\n> + *        r:\n> + *          cx: 0.5006202239353942\n> + *          cy: 0.5099531318307661\n> + *          k0: 1.4702946023945032\n> + *          k1: -0.8893767547927631\n> + *          k2: 3.920547732201387\n> + *          k3: 0.0\n> + *          k4: 0.0\n> + *        gr:\n> + *          cx: 0.500907874178317\n> + *          cy: 0.511084916024106\n> + *          k0: 1.5336172760559457\n> + *          k1: -1.39964026514435\n> + *          k2: 4.565487728954618\n> + *          k3: 0.0\n> + *          k4: 0.0\n> + *        gb:\n> + *          cx: 0.5011898608900477\n> + *          cy: 0.5126797906745105\n> + *          k0: 1.5013145790354843\n> + *          k1: -1.2747407173754124\n> + *          k2: 4.514682876897286\n> + *          k3: 0.0\n> + *          k4: 0.0\n> + *        b:\n> + *          cx: 0.4987561413116136\n> + *          cy: 0.5159619420778772\n> + *          k0: 1.0102986422191802\n> + *          k1: 0.13263449763985727\n> + *          k2: 1.686556107316064\n> + *          k3: 0.0\n> + *          k4: 0.0\n> + * \\endcode\n> + *\n>   * At LscAlgorithm::configure() time the LSC tables are re-sampled on the\n>   * sensor's crop rectangle in use to adapt them to the configuration in use for\n>   * a streaming session. Polynomial LSC tables support re-sampling and can be\n> \n> -- \n> 2.54.0\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 A3A2EC328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Jul 2026 06:32:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 47F5C66122;\n\tTue, 14 Jul 2026 08:32:32 +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 9ACF5660E3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jul 2026 08:32:31 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:6c1f:355d:1c19:aba6])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8D5887CA;\n\tTue, 14 Jul 2026 08:31:37 +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=\"EP7tUviR\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784010697;\n\tbh=FoNPVvhtBOEHcEVpxiOsWcgPtt0UC6tVxRRrsLw68Vk=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=EP7tUviRn0eRAFpoA4GPnODuVWt2UOWsOEW/Vc/tq2NMuTxQvmT7mZDZI5mG9Eyfc\n\tRr5k9IVxfZ96WsnrRepyukHF6JTk3bzFx2OSLf4OSGG2WkT574BzdvUlxn3PTBZarj\n\t4Pq1w2ZelitUyjajENPX4g08WEQyzjjy04z+tMms=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260708-libipa-algorithms-v5-27-0759d0359f52@ideasonboard.com>","References":"<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>\n\t<20260708-libipa-algorithms-v5-27-0759d0359f52@ideasonboard.com>","Subject":"Re: [PATCH v5 27/36] ipa: libipa: lsc: Document Components parsing","From":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 14 Jul 2026 08:32:29 +0200","Message-ID":"<178401074921.3603632.15233355903490424065@localhost>","User-Agent":"alot/0.12.dev43+g2cacc0d03","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":39703,"web_url":"https://patchwork.libcamera.org/comment/39703/","msgid":"<178404974997.3931061.13068127638720837582@ping.linuxembedded.co.uk>","date":"2026-07-14T17:22:29","subject":"Re: [PATCH v5 27/36] ipa: libipa: lsc: Document Components parsing","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2026-07-14 07:32:29)\n> Hi Jacopo,\n> \n> Quoting Jacopo Mondi (2026-07-08 17:51:09)\n> > Document with examples how different IPA modules parse the tuning\n> > file depending on the number of colour channels they support.\n> > \n> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> > ---\n> >  src/ipa/libipa/lsc.cpp | 111 +++++++++++++++++++++++++++++++++++++++++++++++++\n> >  1 file changed, 111 insertions(+)\n> > \n> > diff --git a/src/ipa/libipa/lsc.cpp b/src/ipa/libipa/lsc.cpp\n> > index 796c75f6d729..26c3e9968072 100644\n> > --- a/src/ipa/libipa/lsc.cpp\n> > +++ b/src/ipa/libipa/lsc.cpp\n> > @@ -68,6 +68,117 @@ namespace lsc {\n> >   * tables are organized per-colour temperature with per-colour components gain\n> >   * vectors or polynomial coefficients.\n> >   *\n> > + * The colour components names are IPA-implementation specific and depend on the\n> > + * ISP LSC engine design. Some LSC engine support 4 colour components (r, gr,\n> > + * gb, b), some only support 3 colour components (r, g, b). The name (and\n> > + * number) of the expected colour components shall be provided to\n> > + * LscAlgorithm::init() using the LscDescriptor::keys field.\n> > + *\n> > + * Example of a tabular lens shading tuning file with 'r', 'g' and 'b' colour\n> > + * components. The gain table has been here omitted, but the expected number\n> \n> nit: s/here omitted/omitted here/\n> \n> > + * of entries has to be equal to\n> > + * LscDescriptor::numHCells * LscDescriptor::numVCells.\n> \n> This needs to be updated depending on the changes in the previous patch.\n> \n> With that fixed:\n> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> \n> \n\nReading below, I still look forward to being able to simplify the\nspecificition of the polynomials to a single line or two lines - but\nthat's yak shaving for later on top.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Best regards,\n> Stefan\n> \n> > + *\n> > + * \\code{.yaml}\n> > + * - Lsc:\n> > + *    sets:\n> > + *      - ct: 2500\n> > + *        r: [\n> > + *             .. gains table omitted..\n> > + *        ]\n> > + *        g: [\n> > + *             .. gains table omitted..\n> > + *        ]\n> > + *        b: [\n> > + *             .. gains table omitted..\n> > + *        ]\n> > + *      - ct: 6500\n> > + *        r: [\n> > + *             .. gains table omitted..\n> > + *        ]\n> > + *        g: [\n> > + *             .. gains table omitted..\n> > + *        ]\n> > + *        b: [\n> > + *             .. gains table omitted..\n> > + *        ]\n> > + * \\endcode\n> > + *\n> > + * Example of a polynomial lens shading tuning file with 'r', 'gr', 'gb' and 'b'\n> > + * colour components:\n> > + *\n> > + * \\code{.yaml}\n> > + * - Lsc:\n> > + *    type: \"polynomial\"\n> > + *    sets:\n> > + *      - ct: 2500\n> > + *        r:\n> > + *          cx: 0.5006571711950275\n> > + *          cy: 0.510093737499277\n> > + *          k0: 1.5393282208428813\n> > + *          k1: -1.1434559757908016\n> > + *          k2: 4.332602305814554\n> > + *          k3: 0.0\n> > + *          k4: 0.0\n> > + *        gr:\n> > + *          cx: 0.5009320529087338\n> > + *          cy: 0.511208038949085\n> > + *          k0: 1.5634738574805407\n> > + *          k1: -1.5623484259968348\n> > + *          k2: 4.846686073656501\n> > + *          k3: 0.0\n> > + *          k4: 0.0\n> > + *        gb:\n> > + *          cx: 0.5012013290343839\n> > + *          cy: 0.5128251541578288\n> > + *          k0: 1.526147944919103\n> > + *          k1: -1.4316976083689723\n> > + *          k2: 4.792604063222728\n> > + *          k3: 0.0\n> > + *          k4: 0.0\n> > + *        b:\n> > + *          cx: 0.49864139511067784\n> > + *          cy: 0.5162095081739346\n> > + *          k0: 1.0405245474038738\n> > + *          k1: 0.05618339879447103\n> > + *          k2: 1.8792813594001752\n> > + *          k3: 0.0\n> > + *          k4: 0.0\n> > + *      - ct: 6000\n> > + *        r:\n> > + *          cx: 0.5006202239353942\n> > + *          cy: 0.5099531318307661\n> > + *          k0: 1.4702946023945032\n> > + *          k1: -0.8893767547927631\n> > + *          k2: 3.920547732201387\n> > + *          k3: 0.0\n> > + *          k4: 0.0\n> > + *        gr:\n> > + *          cx: 0.500907874178317\n> > + *          cy: 0.511084916024106\n> > + *          k0: 1.5336172760559457\n> > + *          k1: -1.39964026514435\n> > + *          k2: 4.565487728954618\n> > + *          k3: 0.0\n> > + *          k4: 0.0\n> > + *        gb:\n> > + *          cx: 0.5011898608900477\n> > + *          cy: 0.5126797906745105\n> > + *          k0: 1.5013145790354843\n> > + *          k1: -1.2747407173754124\n> > + *          k2: 4.514682876897286\n> > + *          k3: 0.0\n> > + *          k4: 0.0\n> > + *        b:\n> > + *          cx: 0.4987561413116136\n> > + *          cy: 0.5159619420778772\n> > + *          k0: 1.0102986422191802\n> > + *          k1: 0.13263449763985727\n> > + *          k2: 1.686556107316064\n> > + *          k3: 0.0\n> > + *          k4: 0.0\n> > + * \\endcode\n> > + *\n> >   * At LscAlgorithm::configure() time the LSC tables are re-sampled on the\n> >   * sensor's crop rectangle in use to adapt them to the configuration in use for\n> >   * a streaming session. Polynomial LSC tables support re-sampling and can be\n> > \n> > -- \n> > 2.54.0\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 63155C32CE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Jul 2026 17:22:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9D9F766151;\n\tTue, 14 Jul 2026 19:22:33 +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 47AC46613C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jul 2026 19:22:32 +0200 (CEST)","from monstersaurus.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D3F13558;\n\tTue, 14 Jul 2026 19:21:37 +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=\"rQsiLiP8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784049697;\n\tbh=zkmhmu3yAOF62shmu8mdFCWarvvHJGvYkdaJGn1lnYE=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=rQsiLiP8xkB3QQ0ie6OubVlXg0pJgs5Se6Rlv8LTnjQx1E7RmAy4DbzOlGY9OJG9G\n\tKwUYKT7FwgTmRLWaX/2HDemT3HExdVT/aRPwb0VJP0h0hakctFyc/9UrKKZkRwXKKX\n\t73mQFUm5bB2JqyK7aZ8Jvy0DPXru6KvAwa5H++ew=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<178401074921.3603632.15233355903490424065@localhost>","References":"<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>\n\t<20260708-libipa-algorithms-v5-27-0759d0359f52@ideasonboard.com>\n\t<178401074921.3603632.15233355903490424065@localhost>","Subject":"Re: [PATCH v5 27/36] ipa: libipa: lsc: Document Components parsing","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tStefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 14 Jul 2026 18:22:29 +0100","Message-ID":"<178404974997.3931061.13068127638720837582@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}}]