From patchwork Wed Jan 28 11:43:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 26004 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 AD99CC3200 for ; Wed, 28 Jan 2026 11:44:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5A3D561FE8; Wed, 28 Jan 2026 12:44:46 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="NViHXuMY"; 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 6866061FC9 for ; Wed, 28 Jan 2026 12:44:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769600679; 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=HnF5trqWh4bDvEDa7fhd6lKrtjjkabTJkPGY/KeAxQo=; b=NViHXuMY6aTmYvf30MatGmsOlNwBNaa1rYgFi70LbSq4B3NHY5Om1irxvqVwGxTBbTXtAx q+NwdKivTPLtsOLO4qV7dy3Q6KMQ77tU5aj5r9n4TLTDYsc1E+v8O1uIlF68BqiEyKMhWc uYxIP8ZcKVPMBWDEd4O5UMtI7EhNbSM= 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-62-HHQd9VidPQG-Gj8lMV36Yg-1; Wed, 28 Jan 2026 06:44:35 -0500 X-MC-Unique: HHQd9VidPQG-Gj8lMV36Yg-1 X-Mimecast-MFC-AGG-ID: HHQd9VidPQG-Gj8lMV36Yg_1769600674 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 8E70F1800371; Wed, 28 Jan 2026 11:44:34 +0000 (UTC) Received: from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.34.236]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E424A19560B4; Wed, 28 Jan 2026 11:44:32 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Kieran Bingham , =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= , Robert Mader Subject: [PATCH v5 11/15] libcamera: ipa: simple: Use float type for adjustment controls Date: Wed, 28 Jan 2026 12:43:58 +0100 Message-ID: <20260128114402.31570-12-mzamazal@redhat.com> In-Reply-To: <20260128114402.31570-1-mzamazal@redhat.com> References: <20260128114402.31570-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: -USwjvYnHGPn3zcWDgi5NuybpprOdB4U_r98dUFAyvY_1769600674 X-Mimecast-Originator: redhat.com 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" control_ids.h defines the contrast type as float, let's use the same in simple IPA, instead of double. Saturation and gamma already use float, except for the knobs initializers, let's use float for the knobs too. Reviewed-by: Barnabás Pőcze Reviewed-by: Robert Mader Signed-off-by: Milan Zamazal --- include/libcamera/internal/software_isp/debayer_params.h | 2 +- src/ipa/simple/algorithms/adjust.cpp | 4 ++-- src/ipa/simple/algorithms/lut.cpp | 2 +- src/ipa/simple/ipa_context.h | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index 256c7d43d..2d69bd295 100644 --- a/include/libcamera/internal/software_isp/debayer_params.h +++ b/include/libcamera/internal/software_isp/debayer_params.h @@ -59,7 +59,7 @@ struct DebayerParams { Matrix ccm; RGB blackLevel; float gamma; - double contrastExp; + float contrastExp; }; } /* namespace libcamera */ diff --git a/src/ipa/simple/algorithms/adjust.cpp b/src/ipa/simple/algorithms/adjust.cpp index a067f7b84..a8b7c5ab6 100644 --- a/src/ipa/simple/algorithms/adjust.cpp +++ b/src/ipa/simple/algorithms/adjust.cpp @@ -34,8 +34,8 @@ int Adjust::configure(IPAContext &context, [[maybe_unused]] const IPAConfigInfo &configInfo) { context.activeState.knobs.gamma = kDefaultGamma; - context.activeState.knobs.contrast = std::optional(); - context.activeState.knobs.saturation = std::optional(); + context.activeState.knobs.contrast = std::optional(); + context.activeState.knobs.saturation = std::optional(); return 0; } diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp index d8e92c613..fd442259a 100644 --- a/src/ipa/simple/algorithms/lut.cpp +++ b/src/ipa/simple/algorithms/lut.cpp @@ -40,7 +40,7 @@ void Lut::updateGammaTable(IPAContext &context) const auto gamma = 1.0 / context.activeState.knobs.gamma; const auto contrast = context.activeState.knobs.contrast.value_or(1.0); /* Convert 0..2 to 0..infinity; avoid actual inifinity at tan(pi/2) */ - double contrastExp = tan(std::clamp(contrast * M_PI_4, 0.0, M_PI_2 - 0.00001)); + float contrastExp = tan(std::clamp(contrast * M_PI_4, 0.0, M_PI_2 - 0.00001)); if (!context.gpuIspEnabled) { auto &gammaTable = context.activeState.gamma.gammaTable; diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h index eeade9d35..293e35b71 100644 --- a/src/ipa/simple/ipa_context.h +++ b/src/ipa/simple/ipa_context.h @@ -58,8 +58,8 @@ struct IPAActiveState { std::array gammaTable; uint8_t blackLevel; float gamma; - double contrast; - double contrastExp; + float contrast; + float contrastExp; } gamma; Matrix combinedMatrix; @@ -68,7 +68,7 @@ struct IPAActiveState { struct { float gamma; /* 0..2 range, 1.0 = normal */ - std::optional contrast; + std::optional contrast; std::optional saturation; } knobs; }; @@ -87,7 +87,7 @@ struct IPAFrameContext : public FrameContext { } gains; float gamma; - std::optional contrast; + std::optional contrast; std::optional saturation; };