From patchwork Mon Jan 26 10:42:48 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rick ten Wolde X-Patchwork-Id: 25958 Return-Path: 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 749E3C3200 for ; Mon, 26 Jan 2026 10:48:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2A71A61FD9; Mon, 26 Jan 2026 11:48:07 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hcOXDS6E"; dkim-atps=neutral Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E42DF61A35 for ; Mon, 26 Jan 2026 11:43:02 +0100 (CET) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-b885e8c6700so504143466b.0 for ; Mon, 26 Jan 2026 02:43:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769424182; x=1770028982; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wt8wFcqQpdezmh62fqUPfgm0pFUVCM5UUbZZp+VcTtE=; b=hcOXDS6E8QPC3pQvNr0uhp6lkPdmd4nYnFlLkFOAXpX0SeI19O/aIr8eCdf7lfrkDu uA7oUkTPoS8G20jzVCPUP592ZoZyVxv5eQ8w/JNaJSPXFC2+/R7HuLpifY1q8ycDgDn9 vCC/0CH7DpgQOPKn42TYbO9NC3nmtgOSz6mGDYNHKq/xSPvDXH/iNwoAIaZlFjTMs7fU btVm1P7+FrWQNrCpk0BIaVCot2NlNbXbrqnyH2KEuLZROiOKBZUNrw+PrKWERPsWZcpZ 8lB2nzRcOla+3AZAZ1MKt/7KY6eeCFft6sK3X7c+i/MQx45mtj3oXyKC8WKJn6coOPsA S72g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769424182; x=1770028982; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wt8wFcqQpdezmh62fqUPfgm0pFUVCM5UUbZZp+VcTtE=; b=nKkcQbYmVEO1/xLleFzQmQUrC2faW7+6e4ri79vgfjUPCLz4iNHdefdSXkdsJS5KSi 5bbK5bIfUu7iSUo+WYDocWrZxeqvUy1g/kyQL3Lj7+hKKbHqONNiQA1k+91Bz/N9Qyqs oxBdr9PajIt2r9D7FP9uh0o09IoBZZBjH4e2hnhxONTjgl5XPzijXIirNGSUmWccfJ2j TaPC37vSHZDze5SxGYgPy8O6uqUIBGr1BdVVLU/PLYn4p+bRrZ7wyiQqT1xGIQIbpjcb qsEzLiZ5nEyGI3rSIVdbDLo6RDQt9EQPj9NMTCymLp8SerQzlqhH35mCi1zy6KuyJjMt BEEg== X-Gm-Message-State: AOJu0YwBRXbeGzd6JUWwbrLnPAzd/gSOl3Tq6UUfBrqVkvOsr4ZO2h+E 6BcyU/aAp0OCHIEEno2LtMCHEQV/HOrtsLYTgACTvq4Lopy6wMqkBDigBFxHEA== X-Gm-Gg: AZuq6aKdVw+zgtY0LWVJtwD9xIyWosVFf1U7RHbxsIK7ubO7DhVH3fSUDTfwNn3yy+H UMM2DaniiGxJy24SYMD4deqr8OUBAYWzYuQji3w7BZnEUKZcn87ikH9P3aSJ2FrZ6IpsAiHYCC4 8cWfhxnrg65GRnUYg9cei6pVufJMSm+cMROIlZfude1cl0pPerrC9MzZHTAVwLd379ePZJgEnyN PCjBRBI6076W6zSZ0mMb4cx5DxOnsctjhAJgQ3zcw4P5aAO2pduVdvY6ey+5yzqZ3lAqEMQ7Adh puqpr65YjAK+EdI+d/J1/5kOrWHFc3cy128dD9Z756RbBwXo/r4jkrMtRup9a2PW4jZXQfQxOal 5QybCnZdS1W5TMTRI50nkJ/ODb9LfRYWqWVcUFiKBD2mwO3Y0s2ujNvmFfYlL2rPWkL8DwI6njv kUzKaoUkP0AA9suWmXDDsUQeKhPPEjjgAx/MP0JhYqSDXhYKtVxo0ECDZ2nQgqVhI= X-Received: by 2002:a17:907:d1b:b0:b88:5b35:914a with SMTP id a640c23a62f3a-b8d2e8368d9mr296653266b.57.1769424181691; Mon, 26 Jan 2026 02:43:01 -0800 (PST) Received: from castortop.wolde.loc (195-240-110-192.fixed.kpn.net. [195.240.110.192]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b885b7661f7sm599220366b.54.2026.01.26.02.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jan 2026 02:43:01 -0800 (PST) From: Rick ten Wolde To: libcamera-devel@lists.libcamera.org Cc: xander.c.pronk@gmail.com, derekgielen@outlook.com, 22012540@student.hhs.nl, rick.w.ten.wolde@gmail.com, johannes.goede@oss.qualcomm.com Subject: [PATCH 0/7] LSC for SoftISP simple pipeline Date: Mon, 26 Jan 2026 11:42:48 +0100 Message-ID: <20260126104256.119697-1-rick.w.ten.wolde@gmail.com> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 26 Jan 2026 11:48:05 +0100 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi everyone, Over the last few months we (students from THUAS) have been working on adding LSC support to the SoftISP simple pipline. These patches are the result of those efforts. The project was under the supervision of Hans de Goede. There are patches to both the GpuISP and some scrips for generating the corrections tables. The changes to the GpuISP are integrated as an algorithm, including automatically choosing a correction table based on the measured colour temperature. The current version of the LSC textures make use of the type GLubyte instead of float. This is because we could not get floating points values to play nice with the shader. The result is that the LSC factors ranging from 1.0 to 4.0 are maped to 0 to 255. The last patch (HACK: Add test LSC to src/ipa/simple/data/uncalibrated.yaml) adds sample data to uncalibrated.yaml file for testing, and is a reference of how the tables should (currently) be structured. Regards, Xander Pronk, Rick ten Wolde, Derek Gielen, Aron Dosti. Derek Gielen (1): utils/tuning: Add LSC scripts Xander Pronk (6): libcamera: software_isp: egl: Add gl_scale_param 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 HACK: Add test LSC to src/ipa/simple/data/uncalibrated.yaml include/libcamera/internal/egl.h | 2 +- .../internal/software_isp/debayer_params.h | 6 + src/ipa/simple/algorithms/lsc.cpp | 69 +++++++ src/ipa/simple/algorithms/lsc.h | 49 +++++ src/ipa/simple/algorithms/meson.build | 1 + src/ipa/simple/data/uncalibrated.yaml | 183 +++++++++++++++++- src/libcamera/egl.cpp | 7 +- src/libcamera/shaders/bayer_1x_packed.frag | 10 + src/libcamera/shaders/bayer_unpacked.frag | 10 + src/libcamera/software_isp/debayer.cpp | 18 ++ src/libcamera/software_isp/debayer_egl.cpp | 21 ++ src/libcamera/software_isp/debayer_egl.h | 9 + utils/tuning/exportTuningToLscShader.py | 120 ++++++++++++ utils/tuning/generate_lsc_map_plot.py | 76 ++++++++ 14 files changed, 573 insertions(+), 8 deletions(-) create mode 100644 src/ipa/simple/algorithms/lsc.cpp create mode 100644 src/ipa/simple/algorithms/lsc.h create mode 100644 utils/tuning/exportTuningToLscShader.py create mode 100644 utils/tuning/generate_lsc_map_plot.py