From patchwork Tue Nov 16 08:09:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 14614 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 D51A2BDB1C for ; Tue, 16 Nov 2021 08:10:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3C66B60376; Tue, 16 Nov 2021 09:10:03 +0100 (CET) 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="KHCHxakW"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B667A60231 for ; Tue, 16 Nov 2021 09:10:01 +0100 (CET) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:c966:1d53:a935:70a0]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 638C1466; Tue, 16 Nov 2021 09:10:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1637050201; bh=7n5C0bCFO0L5s/x9qZWf79mrDGsMWqbzZSR/DyqsPbw=; h=From:To:Cc:Subject:Date:From; b=KHCHxakWILAKErtMi5wXoRNDpDajU6KbYz7QrtO5qYk6fQ/thPwDweISx8HP6P74f NLQoRwKynnTgqwpa0IkUaROgdkDcv/CLqBBZs3Dlt3nC13SrTTrvkTKGuPUGk8VAPO zBlfCvs+PKeTLPawFB6UiTqZbV7awrEWhGm4wtV0= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Nov 2021 09:09:56 +0100 Message-Id: <20211116080956.21373-1-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] ipa: ipu3: agc: Remove the threshold for the histogram calculation 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" Until f8f07f94 (ipa: ipu3: agc: Improve gain calculation, 2021-11-04) the gain to apply on the exposure value was only using the histogram. Now that the global brightness of the frame is estimated too, we don't need to remove part of the saturated pixels from the equation anymore. Signed-off-by: Jean-Michel Hautbois Tested-by: Kieran Bingham Reviewed-by: Kieran Bingham --- src/ipa/ipu3/algorithms/agc.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp index 4e424857..f67a79d3 100644 --- a/src/ipa/ipu3/algorithms/agc.cpp +++ b/src/ipa/ipu3/algorithms/agc.cpp @@ -58,12 +58,6 @@ static constexpr uint32_t knumHistogramBins = 256; /* Target value to reach for the top 2% of the histogram */ static constexpr double kEvGainTarget = 0.5; -/* - * Maximum ratio of saturated pixels in a cell for the cell to be considered - * non-saturated and counted by the AGC algorithm. - */ -static constexpr uint32_t kMinCellsPerZoneRatio = 255 * 20 / 100; - /* Number of frames to wait before calculating stats on minimum exposure */ static constexpr uint32_t kNumStartupFrames = 10; @@ -133,16 +127,14 @@ void Agc::measureBrightness(const ipu3_uapi_stats_3a *stats, &stats->awb_raw_buffer.meta_data[cellPosition] ); - if (cell->sat_ratio <= kMinCellsPerZoneRatio) { - uint8_t gr = cell->Gr_avg; - uint8_t gb = cell->Gb_avg; - /* - * Store the average green value to estimate the - * brightness. Even the overexposed pixels are - * taken into account. - */ - hist[(gr + gb) / 2]++; - } + uint8_t gr = cell->Gr_avg; + uint8_t gb = cell->Gb_avg; + /* + * Store the average green value to estimate the + * brightness. Even the overexposed pixels are + * taken into account. + */ + hist[(gr + gb) / 2]++; } }