From patchwork Fri Oct 15 01:58:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 14154 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 D7976C323E for ; Fri, 15 Oct 2021 01:58:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2CD3768F51; Fri, 15 Oct 2021 03:58:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="vPlr1sGm"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 801B260239 for ; Fri, 15 Oct 2021 03:58:24 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E93BB2E3; Fri, 15 Oct 2021 03:58:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1634263104; bh=oS+gY3HueFaTt5SMq6wXV9jkYcj0dkJInj/JhMDChBY=; h=From:To:Cc:Subject:Date:From; b=vPlr1sGml8jylSlcpTOzV4C9Ktp7mDAOZbmbAVQJNTDFS9ISqjTepMuSaWi+29t++ AeCft/MezXZlKRJZ/A0ORG9YS04NaEO+nWM75OnsOapSIrFsb/WqRypaR7+0bDUlCm YeAJ7okjcful4OGyc4u5YjQnMHmn3ca2neWWFkpM= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Oct 2021 04:58:03 +0300 Message-Id: <20211015015804.11758-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] ipa: ipu3: awb: Don't pass member variable to member function 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 Awb::generateZones() member function fills the zones vector passed as an argument, which is actually a member variable. Use it directly in the function. Signed-off-by: Laurent Pinchart Reviewed-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- src/ipa/ipu3/algorithms/awb.cpp | 12 ++++++++---- src/ipa/ipu3/algorithms/awb.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) base-commit: ccec150589a177654b9039d21163c36ccff85cff diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp index e2b18336d582..809de66aa7fa 100644 --- a/src/ipa/ipu3/algorithms/awb.cpp +++ b/src/ipa/ipu3/algorithms/awb.cpp @@ -196,8 +196,10 @@ uint32_t Awb::estimateCCT(double red, double green, double blue) } /* Generate an RGB vector with the average values for each zone */ -void Awb::generateZones(std::vector &zones) +void Awb::generateZones() { + zones_.clear(); + for (unsigned int i = 0; i < kAwbStatsSizeX * kAwbStatsSizeY; i++) { RGB zone; double counted = awbStats_[i].counted; @@ -206,7 +208,7 @@ void Awb::generateZones(std::vector &zones) if (zone.G >= kMinGreenLevelInZone) { zone.R = awbStats_[i].sum.red / counted; zone.B = awbStats_[i].sum.blue / counted; - zones.push_back(zone); + zones_.push_back(zone); } } } @@ -298,11 +300,13 @@ void Awb::awbGreyWorld() void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats) { ASSERT(stats->stats_3a_status.awb_en); - zones_.clear(); + clearAwbStats(); generateAwbStats(stats); - generateZones(zones_); + generateZones(); + LOG(IPU3Awb, Debug) << "Valid zones: " << zones_.size(); + if (zones_.size() > 10) { awbGreyWorld(); LOG(IPU3Awb, Debug) << "Gain found for red: " << asyncResults_.redGain diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h index 677384eda54a..3b81f600aa02 100644 --- a/src/ipa/ipu3/algorithms/awb.h +++ b/src/ipa/ipu3/algorithms/awb.h @@ -65,7 +65,7 @@ public: private: void calculateWBGains(const ipu3_uapi_stats_3a *stats); - void generateZones(std::vector &zones); + void generateZones(); void generateAwbStats(const ipu3_uapi_stats_3a *stats); void clearAwbStats(); void awbGreyWorld();