From patchwork Mon May 4 18:26:51 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 26617 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 2DB54BE173 for ; Mon, 4 May 2026 18:27:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CED5A62FEC; Mon, 4 May 2026 20:27:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="YnM3Qnu/"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9BDB662FE8 for ; Mon, 4 May 2026 20:27:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777919239; 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: in-reply-to:in-reply-to:references:references; bh=GMpTRJkAeYb5u4p7zVG3zTLovAUt5iXhXpZDwDhZzFI=; b=YnM3Qnu/nJ6QJPlq01r9u9/Y2ThC3EqzD7MGRDN/Zz6QrKcuggNjIRfKeaZg7jDsB5G1rQ zyzIpITXX4dms/b8VdRyvIalvyRTHzC6qkIhwV0plqT9T7D2cK6xZANIvE4CkKBaodgJGl YIai1RQtOooKLtl7UvRQClgwau4j0Xo= 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-547--0QIuDOzPC6u6D39-L9m8Q-1; Mon, 04 May 2026 14:27:16 -0400 X-MC-Unique: -0QIuDOzPC6u6D39-L9m8Q-1 X-Mimecast-MFC-AGG-ID: -0QIuDOzPC6u6D39-L9m8Q_1777919234 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 6E96A1800348; Mon, 4 May 2026 18:27:14 +0000 (UTC) Received: from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.32.69]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4C07A180154B; Mon, 4 May 2026 18:27:11 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Xander Pronk , Bryan O'Donoghue , Hans de Goede , Laurent Pinchart , Rick ten Wolde , Milan Zamazal Subject: [RFC PATCH v4 2/7] libcamera: software_isp: Add LSC data to DebayerParams Date: Mon, 4 May 2026 20:26:51 +0200 Message-ID: <20260504182658.590233-3-mzamazal@redhat.com> In-Reply-To: <20260504182658.590233-1-mzamazal@redhat.com> References: <20260504182658.590233-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: N9TIk51VznXRz8UY-MqqznJM3IljFINLK-PGV0hu0go_1777919234 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true 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" From: Xander Pronk Add a lookup table for grid-based lens shading correction to debayer params. The lookup table is in the format of an RGB texture to be passed to debayering. The parameter is filled in by LSC algorithm implemented in a followup patch. If the algorithm is not enabled, the parameter content is arbitrary and the parameter may not be used. The parameter is currently unused, its handling is implemented in a followup patch. There is no special meaning about the selected grid size, it's just one of the smaller common sizes. Co-developed-by: Rick ten Wolde Signed-off-by: Rick ten Wolde Signed-off-by: Xander Pronk Signed-off-by: Milan Zamazal --- .../internal/software_isp/debayer_params.h | 8 ++++++ src/libcamera/software_isp/debayer.cpp | 28 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index 6772b43bc..47f2c3ac2 100644 --- a/include/libcamera/internal/software_isp/debayer_params.h +++ b/include/libcamera/internal/software_isp/debayer_params.h @@ -10,6 +10,7 @@ #pragma once +#include #include #include "libcamera/internal/matrix.h" @@ -25,6 +26,13 @@ struct DebayerParams { float gamma = 1.0; float contrastExp = 1.0; RGB gains = RGB({ 1.0, 1.0, 1.0 }); + + static constexpr unsigned int kLscGridSize = 16; + static constexpr unsigned int kLscValuesPerCell = 3; + using LscValueType = float; + using LscLookupTable = + std::array; + LscLookupTable lscLut{}; }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 2d7abfb83..d91a7aff5 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -43,6 +43,34 @@ namespace libcamera { * \brief Contrast value to be used as an exponent */ +/** + * \var DebayerParams::kLscGridSize + * \brief Number of lens shading grid areas in one direction + */ + +/** + * \var DebayerParams::kLscValuesPerCell + * \brief Number of pixel values per each of the lens shading grid areas + */ + +/** + * \typedef DebayerParams::LscValueType + * \brief Type of LSC grid values + */ + +/** + * \typedef DebayerParams::LscLookupTable + * \brief Lookup table for lens shading correction + * + * It's an array of values to be later used as a texture. + * The values are in row - column - RGB order. + */ + +/** + * \var DebayerParams::lscLut + * \brief Lens shading lookup table + */ + /** * \class Debayer * \brief Base debayering class