From patchwork Thu Oct 2 13:26:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 24550 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 3B544C328C for ; Thu, 2 Oct 2025 13:35:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 95C246B5AA; Thu, 2 Oct 2025 15:35:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="lbGrknTJ"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A59D06B5F8 for ; Thu, 2 Oct 2025 15:35:31 +0200 (CEST) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-46e310e64f4so1319185e9.3 for ; Thu, 02 Oct 2025 06:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1759412131; x=1760016931; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2FLUPxtStom9sPnXBOfr3PHqylq/XtMY5MS9+dCgLKk=; b=lbGrknTJ3fhbwOkirRJUn7fnB3MbAxLn1JK8CxzfRjb+txvR4+QfJ7Vnk3vvPSu+qg n+QDqE9YHdL734YRdBN/+b8WWmBGopiOzLCF5bQwIywFGlbDInUzopXI9KkwTjNAOHtK HjToB38CoAMRO9wWwCAfJo+Ef7tyJiS9F9Je257kXNdkWfMiEQ281Ba3nzgpN3Hfruyj vPKV4YWT1UpKHyUhn4R4qIpN7ApuUhTwFtK+hzFXFXwb4yEQD97xGKBCOEao8Vg2K68g g5x4gLGQdqIio8ppf/mpcTG++YtLtEUxwE3CA94/esFUnBYbzenpAc4KtVTRlVT2zyqP /mOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759412131; x=1760016931; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2FLUPxtStom9sPnXBOfr3PHqylq/XtMY5MS9+dCgLKk=; b=bjoUfn90ScblH56gMekuSI30uxNoAeCf6x/K3wRYLY0w5jwcT56pHLNu4bl+AlddQY XmgZreWCfK8FTWx9WdyTNeBJvf6EFjw8o6RyVMFfGdAWRkkwuIVgQoIpvhJoFyc0WgvN c7j+kMnLou54JhGaSZ/2h8Ub/94pvEgyxgL+mul1dGD6ZVCG7SuWTOzNdPq/5D0u6iDU tzE1AguJzFy26bPSkef5ChaAWopL+wlSnrW/P8TAxv02rvnTsb2nCIk1vlF8KZ3Jpm0H WtKokZgcAnwcClSrv+vaN3yhasub2TdNYjyiHd8JFQkyc7POlaWC/TvN1qIGtUjXgwa7 EIzQ== X-Gm-Message-State: AOJu0YzMNJs8IKxAKXMLD4QlIoBRzfUxbad7dk5qF4orwr0Hh7jPjqbT 6990wtpZij2LmJOCEOtuUWJCEAY185eULv1A43MlFOE2aNHk/iWK4gXShTcdRJaZOGhLvNrDzUU kuXUD X-Gm-Gg: ASbGnctgEIteECbsL/hjnAaYVIT/d/vHdyxBcfvX1Gv0VgQstsbALW48FWs1f1hyuH5 o+Av1C9DOlJ8HPX2UiV0CdWLrQm90GrP5nBt52gpx8KmQ5z8QDEvMAPzdwOhzgdGkY/wrUijHD1 73eEtwtoZWq9jpoU+gxgXstdxVW/2DzfBmslWC0TBdx5nluO7flm9T8A8oI8l2Y+S2/VE8o7teB 7USR3lop6sj6m1H8HVDCYHyuhRfOeRM6vmZICAfHudhpiAuSbq8t2yGNIa0wWGkn5s8sXSecfi3 OG9zjb0qDUGlVrC61k9bwXNt4ktQsX9D3+sUoNOxWqaBZG1DQQkHo134nWhegHEfZwUl9uZw8SQ DGKE/KJg22VBiTNgrapPs01icXITm6VUDa8xnMPiPpfzxACkOTOIZRLcuDljTcNpU6ggDfjdr3M uf X-Google-Smtp-Source: AGHT+IHtHbD2B8EKUQGTyXSdgExtDHZWw/bMZlNXKu7ag58MoRm94aZ5+XQYFWndEzacHwYJ6JWRPA== X-Received: by 2002:a05:600c:4511:b0:46e:3d3d:ea92 with SMTP id 5b1f17b1804b1-46e61294dc2mr32208605e9.5.1759412130938; Thu, 02 Oct 2025 06:35:30 -0700 (PDT) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46e6918bdebsm40396015e9.9.2025.10.02.06.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Oct 2025 06:35:30 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: David Plowman , Nick Hollinghurst , Naushir Patuck Subject: [PATCH v1 2/4] ipa: rpi: Add FE globals as a parameter to applyDecompand() Date: Thu, 2 Oct 2025 14:26:05 +0100 Message-ID: <20251002133523.293413-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251002133523.293413-1-naush@raspberrypi.com> References: <20251002133523.293413-1-naush@raspberrypi.com> MIME-Version: 1.0 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" Don't let applyDecompand() directly change the FE global enables. Instead pass the global mask into the function and set it in the caller. This will be needed when a future commit will add setting the decompand initial values. Signed-off-by: Naushir Patuck --- src/ipa/rpi/pisp/pisp.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ipa/rpi/pisp/pisp.cpp b/src/ipa/rpi/pisp/pisp.cpp index e75c87df1924..03c6c47c1bd9 100644 --- a/src/ipa/rpi/pisp/pisp.cpp +++ b/src/ipa/rpi/pisp/pisp.cpp @@ -256,7 +256,7 @@ private: void applyLensShading(const AlscStatus *alscStatus, pisp_be_global_config &global); void applyDPC(const DpcStatus *dpcStatus, pisp_be_global_config &global); - void applyDecompand(const DecompandStatus *decompandStatus); + void applyDecompand(const DecompandStatus *decompandStatus, pisp_fe_global_config &feGlobal); void applySdn(const SdnStatus *sdnStatus, pisp_be_global_config &global); void applyTdn(const TdnStatus *tdnStatus, const DeviceStatus *deviceStatus, pisp_be_global_config &global); @@ -368,6 +368,9 @@ void IpaPiSP::platformPrepareIsp([[maybe_unused]] const PrepareParams ¶ms, { /* All Frontend config goes first, we do not want to hold the FE lock for long! */ std::scoped_lock lf(*fe_); + pisp_fe_global_config feGlobal; + + fe_->GetGlobal(feGlobal); if (noiseStatus) applyFocusStats(noiseStatus); @@ -375,13 +378,14 @@ void IpaPiSP::platformPrepareIsp([[maybe_unused]] const PrepareParams ¶ms, DecompandStatus *decompandStatus = rpiMetadata.getLocked("decompand.status"); if (decompandStatus) - applyDecompand(decompandStatus); + applyDecompand(decompandStatus, feGlobal); BlackLevelStatus *blackLevelStatus = rpiMetadata.getLocked("black_level.status"); if (blackLevelStatus) applyBlackLevel(blackLevelStatus, global); + fe_->SetGlobal(feGlobal); } CacStatus *cacStatus = rpiMetadata.getLocked("cac.status"); @@ -728,18 +732,15 @@ void IpaPiSP::applyDPC(const DpcStatus *dpcStatus, pisp_be_global_config &global be_->SetDpc(dpc); } -void IpaPiSP::applyDecompand(const DecompandStatus *decompandStatus) +void IpaPiSP::applyDecompand(const DecompandStatus *decompandStatus, pisp_fe_global_config &feGlobal) { - pisp_fe_global_config feGlobal; pisp_fe_decompand_config decompand = {}; - fe_->GetGlobal(feGlobal); - if (!generateDecompandLut(decompandStatus->decompandCurve, decompand.lut, PISP_FE_DECOMPAND_LUT_SIZE)) { fe_->SetDecompand(decompand); feGlobal.enables |= PISP_FE_ENABLE_DECOMPAND; - fe_->SetGlobal(feGlobal); - } + } else + feGlobal.enables &= ~PISP_FE_ENABLE_DECOMPAND; } void IpaPiSP::applySdn(const SdnStatus *sdnStatus, pisp_be_global_config &global)