| Message ID | 20260805183517.228901-1-mzamazal@redhat.com |
|---|---|
| Headers | show
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 [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9F965C3303 for <parsemail@patchwork.libcamera.org>; Wed, 5 Aug 2026 18:35:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9C24B6812E; Wed, 5 Aug 2026 20:35:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="P4YtVt/U"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1DAD568124 for <libcamera-devel@lists.libcamera.org>; Wed, 5 Aug 2026 20:35:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1785954928; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qQZLMVejMMbumKeIUFR/QLZGEEm+Gs4hCgNXyjPCBVo=; b=P4YtVt/U70OWljiygwfwcWOfTpbEgRwi5xYjjMTXz0urrqlMzngEX/tTDlqsPnwt5PYZep TGpgwXSIwjXYHMguNW57k37H+MixM8zDcW+aPqYn6MGR4rVjxJmAmWrEGkCuoosbyg/lQU 9Z+ve7AR7VHAShqPf9uJ90EnrxfmCRQ= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-562-Jw40leJdNOeOa7tR7a63yg-1; Wed, 05 Aug 2026 14:35:25 -0400 X-MC-Unique: Jw40leJdNOeOa7tR7a63yg-1 X-Mimecast-MFC-AGG-ID: Jw40leJdNOeOa7tR7a63yg_1785954924 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8EC7F18001D7; Wed, 5 Aug 2026 18:35:23 +0000 (UTC) Received: from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.48.68]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1399A180034C; Wed, 5 Aug 2026 18:35:20 +0000 (UTC) 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>, Hans de Goede <johannes.goede@oss.qualcomm.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Robert Mader <robert.mader@collabora.com> Subject: [RFC PATCH v11 0/6] LSC for SoftISP simple pipeline Date: Wed, 5 Aug 2026 20:35:10 +0200 Message-ID: <20260805183517.228901-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 8JqRqocsBuAg2ei6pxNESrtmuw57hf0FosTCTMi7pF4_1785954924 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>, <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>, <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> |
| Series |
|
| Related |
show
|
Lens shading correction for software GPU ISP. Based on the initial work by Hans’s students, taken over and significantly modified and eventually reworked to use LSC from libipa (the ongoing work by Jacopo and others). The LSC is not implemented for CPU ISP within this series; it may be added later if needed. It’s RFC because: - It’s not yet completely tested although it seems to be working in my environment. - It’s based on the libipa patches not yet merged. - Further changes will be needed once GPU ISP multipass is merged. Example YAML for grid based LSC, no-op values, place it after Awb: - Lsc: sets: - ct: 6500 r: [ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 ] g: [ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 ] b: [ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 ] Example YAML for polynomial based LSC, no-op values, place it after Awb: - Lsc: type: "polynomial" sets: - ct: 6500 r: cx: 0.5 cy: 0.5 k0: 0.0 k1: 0.0 k2: 0.0 k3: 0.0 k4: 0.0 g: cx: 0.5 cy: 0.5 k0: 0.0 k1: 0.0 k2: 0.0 k3: 0.0 k4: 0.0 b: cx: 0.5 cy: 0.5 k0: 0.0 k1: 0.0 k2: 0.0 k3: 0.0 k4: 0.0 Changes in v11: - Updated for Jacopo’s libipa patches v7. Changes in v10: - Rebased on Jacopo’s libipa v6. - Quantized uint8_t texture used instead of float, for a better GPU compatibility. - The texture is updated, rather than created each time, and only if the underlying data changes. - A forgotten statement, previously inserted and removed in intermediate patches, removed. - The grid size changed to 17 to be the same as in rkisp1 tuning files. - RGBA is used instead of RGB to prevent OpenGL alignment issues. - cx & cy set to 0.5 in the cover letter polynomial example, to centre the pattern. Changes in v9: - Rebased on the latest master. Changes in v8: - LscValueType removed. - A named constant introduced for minimum temperature change. - A clarification comment added to the LUT value computation. - lsc-enabled shader flag and the related variables removed. - Wording corrections suggested by Bryan. Changes in v7: - Updated for libipa patches v5 (temperature access). Changes in v6: - Rebased on Jacopo’s libipa patches (v3). - Not updating LSC tables on small or no temperature changes. - Using libipa LSC algorithms; the implementation in ‘simple’ IPA algorithm reduced to the minimum needed. - Grid tables are defined using integers rather than floats, because libipa LSC supports only quantised values and not floats. - New boolean uniform to enable or disable LSC dynamically, rather than only in shaders compile time; to be able to honour the LSC control. - Specific handling of polynomial LSC removed. Polynomial LSC is already handled by libipa, by making a grid-based LSC from it. While a direct polynomial computation may be a bit faster with a minimum number of the polynomial coefficients, the simplicity wins. If we liked to have direct polynomial LSC computation, it should be implemented with help of libipa. Changes in v5: - ‘grids’ tuning file item renamed to ‘sets’ for consistency with rkisp1. - Underscores appended to Lsc::lsc* names. - Other minor stylistic changes. - Proof-of-concept polynomial LSC implemented. Changes in v4: - glFilterParam -> param - Indentation changes in the shaders. - A commit message part about temperature reworded. - Updated for YamlObject -> ValueNode. - New constant kLscValuesPerCell to distinguish between the constants for the params array size (values) and for the stride (bytes). - The lookup array switched to floats and the texture to half-floats. Changes in v3: - LSC scripts patch dropped due to missing licences. - DO_LSC -> APPLY_LSC - textureUniformLsc_ is assigned unconditionally now. - New constant DebayerParams::kLscBytesPerCell. - LSC values in the tuning file are floats now and converted to bytes internally. - Source code comments added to clarify the usage of the byte LUTs. Changes in v2: - Remaining issues from the reviews (hopefully) addressed. - Especially there is only a single texture now and LSC is fully conditional. - Major cleanup, hacks removed or replaced, typo fixes, cosmetic changes, making linters happy, etc. - See https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056883.html for an example how to add the grid data. Milan Zamazal (1): libcamera: software_isp: Pass LSC availability to debayering Xander Pronk (5): libcamera: software_isp: egl: Add filter parameter to createTexture2D() libcamera: software_isp: Add LSC data to DebayerParams ipa: simple: Add LSC algorithm libcamera: shaders: Add LSC support libcamera: software_isp: debayer_egl: Add LSC support include/libcamera/internal/egl.h | 8 +- .../internal/software_isp/debayer_params.h | 14 +++ .../internal/software_isp/software_isp.h | 1 + include/libcamera/ipa/soft.mojom | 4 +- src/ipa/simple/algorithms/lsc.cpp | 104 ++++++++++++++++++ src/ipa/simple/algorithms/lsc.h | 55 +++++++++ src/ipa/simple/algorithms/meson.build | 1 + src/ipa/simple/ipa_context.h | 6 + src/ipa/simple/soft_simple.cpp | 7 +- src/libcamera/egl.cpp | 21 ++-- src/libcamera/shaders/bayer_1x_packed.frag | 9 ++ src/libcamera/shaders/bayer_unpacked.frag | 9 ++ src/libcamera/software_isp/debayer.cpp | 34 ++++++ src/libcamera/software_isp/debayer.h | 3 +- src/libcamera/software_isp/debayer_cpu.cpp | 3 +- src/libcamera/software_isp/debayer_cpu.h | 3 +- src/libcamera/software_isp/debayer_egl.cpp | 47 +++++++- src/libcamera/software_isp/debayer_egl.h | 12 +- src/libcamera/software_isp/software_isp.cpp | 5 +- 19 files changed, 325 insertions(+), 21 deletions(-) create mode 100644 src/ipa/simple/algorithms/lsc.cpp create mode 100644 src/ipa/simple/algorithms/lsc.h