{"id":27301,"url":"https://patchwork.libcamera.org/api/covers/27301/?format=json","web_url":"https://patchwork.libcamera.org/cover/27301/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260708141436.119165-1-mzamazal@redhat.com>","date":"2026-07-08T14:14:28","name":"[RFC,v6,0/6] LSC for SoftISP simple pipeline","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/?format=json","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"mbox":"https://patchwork.libcamera.org/cover/27301/mbox/","series":[{"id":6047,"url":"https://patchwork.libcamera.org/api/series/6047/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6047","date":"2026-07-08T14:14:28","name":"LSC for SoftISP simple pipeline","version":6,"mbox":"https://patchwork.libcamera.org/series/6047/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/27301/comments/","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 4F35BC3306\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Jul 2026 14:14:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 12CDE66089;\n\tWed,  8 Jul 2026 16:14:50 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CCF4765FF1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Jul 2026 16:14:47 +0200 (CEST)","from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-125-YzajMsMjPyeB_jDUVLI-DQ-1;\n\tWed, 08 Jul 2026 10:14:45 -0400","from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.95])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id 57BD41955D87; Wed,  8 Jul 2026 14:14:43 +0000 (UTC)","from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.48.228])\n\tby mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id D3BC13EEDE; Wed,  8 Jul 2026 14:14:40 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"YP87j+B6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1783520086;\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\tbh=fLXqOU7RmRd0+PY3n/eGW5KC/m6P5LSAPnJxhGVgQTk=;\n\tb=YP87j+B6/20Kmn6xrq22t4PHzFt7+9SyNGdN/uin/DBYYNi5XVq65FOU7r0mhhYE9kgyFO\n\tIusTR77dQDbIXmsfzn0HIDKSCHc/EQURrtTrd0BabF5toOdjFHsBUpUiITblHnjE+4i7rs\n\tNZmc98GbL6hwdLY8K5x9b6wrWcJsOCE=","X-MC-Unique":"YzajMsMjPyeB_jDUVLI-DQ-1","X-Mimecast-MFC-AGG-ID":"YzajMsMjPyeB_jDUVLI-DQ_1783520084","From":"Milan Zamazal <mzamazal@redhat.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Milan Zamazal <mzamazal@redhat.com>, Bryan O'Donoghue <bod.linux@nxsw.ie>,\n\tHans de Goede <johannes.goede@oss.qualcomm.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"[RFC PATCH v6 0/6] LSC for SoftISP simple pipeline","Date":"Wed,  8 Jul 2026 16:14:28 +0200","Message-ID":"<20260708141436.119165-1-mzamazal@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.6 on 10.30.177.95","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"hPKdx3cMKmBjsxyNngyAbkeRa9s-iCxyqbnL5nI6ARo_1783520084","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Lens shading correction for software GPU ISP.  Based on the initial work\nby Hans’s students, taken over and significantly modified and eventually\nreworked to use LSC from libipa (the ongoing work by Jacopo and others).\n\nThe LSC is not implemented for CPU ISP within this series; it may be\nadded later if needed.\n\nIt’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\nChanges 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\nChanges 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\nChanges 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\nChanges 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\nChanges 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\nMilan Zamazal (1):\n  libcamera: software_isp: Pass LSC availability to debayering\n\nXander 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    | 11 +++\n .../internal/software_isp/software_isp.h      |  1 +\n include/libcamera/ipa/soft.mojom              |  4 +-\n src/ipa/simple/algorithms/lsc.cpp             | 93 +++++++++++++++++++\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                         | 17 +++-\n src/libcamera/shaders/bayer_1x_packed.frag    | 10 ++\n src/libcamera/shaders/bayer_unpacked.frag     | 10 ++\n src/libcamera/software_isp/debayer.cpp        | 39 ++++++++\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      | 11 ++-\n src/libcamera/software_isp/software_isp.cpp   |  5 +-\n 19 files changed, 299 insertions(+), 18 deletions(-)\n create mode 100644 src/ipa/simple/algorithms/lsc.cpp\n create mode 100644 src/ipa/simple/algorithms/lsc.h"}