From patchwork Wed Jan 14 11:30:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 25777 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 DBACAC3226 for ; Wed, 14 Jan 2026 11:31:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9075361FC6; Wed, 14 Jan 2026 12:31:10 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="N+V3PXHL"; 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 002BF61FC6 for ; Wed, 14 Jan 2026 12:31:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768390266; 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=qJgJTB2HiOkuixBdsTyHC2h6ZWieXCDCI2ZpXS5airY=; b=N+V3PXHLPPaI80oRd7iIvQD/K/gW/KcmwYaOpcaOzp6mptPFTaNQo1qTtWWzX/CXnqTzz1 GlvItlFjeQr+en/lDxg64rZ8jBUU5m9xCtDHLLadUxZUfsFcoX0etGu1X0vlJQTNPCsQ/m KQt35hJjZnNzEmwqYserKwaco7snr6Y= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-519-J_Fm8qYmP-GtKwQ25SoczQ-1; Wed, 14 Jan 2026 06:31:03 -0500 X-MC-Unique: J_Fm8qYmP-GtKwQ25SoczQ-1 X-Mimecast-MFC-AGG-ID: J_Fm8qYmP-GtKwQ25SoczQ_1768390262 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B89881954B06; Wed, 14 Jan 2026 11:31:02 +0000 (UTC) Received: from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.32.217]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F3DD11800665; Wed, 14 Jan 2026 11:31:00 +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?= Subject: [PATCH v3 12/14] libcamera: ipa: simple: Use symbolic constants for adjust defaults Date: Wed, 14 Jan 2026 12:30:14 +0100 Message-ID: <20260114113016.25162-13-mzamazal@redhat.com> In-Reply-To: <20260114113016.25162-1-mzamazal@redhat.com> References: <20260114113016.25162-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: mUiEOv_YGasniyMI8mQDiuXwRnU6bqWfHUrP-dWuobI_1768390262 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" The adjust algorithm already uses a symbolic constant for gamma. Let's introduce similar constants for contrast and saturation to prevent copying the numeric defaults to multiple places. Signed-off-by: Milan Zamazal --- src/ipa/simple/algorithms/adjust.cpp | 11 +++++++---- src/ipa/simple/algorithms/adjust.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ipa/simple/algorithms/adjust.cpp b/src/ipa/simple/algorithms/adjust.cpp index 95032799f..60a191380 100644 --- a/src/ipa/simple/algorithms/adjust.cpp +++ b/src/ipa/simple/algorithms/adjust.cpp @@ -23,10 +23,13 @@ LOG_DEFINE_CATEGORY(IPASoftAdjust) int Adjust::init(IPAContext &context, [[maybe_unused]] const YamlObject &tuningData) { - context.ctrlMap[&controls::Gamma] = ControlInfo(0.1f, 10.0f, kDefaultGamma); - context.ctrlMap[&controls::Contrast] = ControlInfo(0.0f, 2.0f, 1.0f); + context.ctrlMap[&controls::Gamma] = + ControlInfo(0.1f, 10.0f, kDefaultGamma); + context.ctrlMap[&controls::Contrast] = + ControlInfo(0.0f, 2.0f, kDefaultContrast); if (context.ccmEnabled) - context.ctrlMap[&controls::Saturation] = ControlInfo(0.0f, 2.0f, 1.0f); + context.ctrlMap[&controls::Saturation] = + ControlInfo(0.0f, 2.0f, kDefaultSaturation); return 0; } @@ -118,7 +121,7 @@ void Adjust::process([[maybe_unused]] IPAContext &context, metadata.set(controls::Contrast, contrast.value()); const auto &saturation = frameContext.saturation; - metadata.set(controls::Saturation, saturation.value_or(1.0)); + metadata.set(controls::Saturation, saturation.value_or(kDefaultSaturation)); } REGISTER_IPA_ALGORITHM(Adjust, "Adjust") diff --git a/src/ipa/simple/algorithms/adjust.h b/src/ipa/simple/algorithms/adjust.h index 190d2079f..11d8297ca 100644 --- a/src/ipa/simple/algorithms/adjust.h +++ b/src/ipa/simple/algorithms/adjust.h @@ -20,6 +20,8 @@ namespace libcamera { namespace ipa::soft::algorithms { const float kDefaultGamma = 2.2f; +const float kDefaultContrast = 1.0f; +const float kDefaultSaturation = 1.0f; class Adjust : public Algorithm {