From patchwork Tue Mar 19 10:54:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 19739 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 3FEADBD160 for ; Tue, 19 Mar 2024 10:54:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 73DBA62CA8; Tue, 19 Mar 2024 11:54:33 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Ji/KpOHd"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FD0B61C61 for ; Tue, 19 Mar 2024 11:54:31 +0100 (CET) Received: from pyrite.hamster-moth.ts.net (h175-177-049-156.catv02.itscom.jp [175.177.49.156]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D3C3216F9; Tue, 19 Mar 2024 11:54:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1710845644; bh=hmyiyluaTru7FETWqIyVy4DT/sC1/kVnyoXatr5Jqy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ji/KpOHdFiwNib1sNbKBxgf9sX36tZFzc5TcLi+LXd2WdMv+odv106P5SEEOJuG+n pmH5WasDG8/FqdAeBcVkEIO/e15Looxq9jtGpT8jmg+f3a7h1E22dJSYcdSjLfmaGU hV0dmRtp5O13CqzmV3rU8gBMFZ0Yf7fOSVhIri3M= From: Paul Elder To: libcamera-devel@lists.libcamera.org Cc: Paul Elder Subject: [PATCH 2/2] ipa: rkisp1: agc: Fix histogram construction Date: Tue, 19 Mar 2024 19:54:03 +0900 Message-Id: <20240319105403.4045592-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240319105403.4045592-1-paul.elder@ideasonboard.com> References: <20240319105403.4045592-1-paul.elder@ideasonboard.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" The histogram reported by the rkisp1 hardware is 20 bits, where the upper 16 bits are meaningful integer data and the lower 4 bits are fractional and meant to be discarded. Remove these 4 bits when constructing the histogram. Signed-off-by: Paul Elder --- src/ipa/rkisp1/algorithms/agc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 47a6f7b2..278903a5 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -352,7 +352,7 @@ double Agc::estimateLuminance(Span expMeans, double gain) */ double Agc::measureBrightness(Span hist) const { - Histogram histogram{ hist }; + Histogram histogram{ hist, 4 }; /* Estimate the quantile mean of the top 2% of the histogram. */ return histogram.interQuantileMean(0.98, 1.0); }