From patchwork Mon Jun 21 14:59:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 12668 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 33A2EBE58C for ; Mon, 21 Jun 2021 14:59:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9194568935; Mon, 21 Jun 2021 16:59:53 +0200 (CEST) Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A44A860295 for ; Mon, 21 Jun 2021 16:59:52 +0200 (CEST) Received: from ip5f5aa64a.dynamic.kabel-deutschland.de ([95.90.166.74] helo=phil.lan) by gloria.sntech.de with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lvLOw-0001PG-N3; Mon, 21 Jun 2021 16:59:50 +0200 From: Heiko Stuebner To: libcamera-devel@lists.libcamera.org Date: Mon, 21 Jun 2021 16:59:47 +0200 Message-Id: <20210621145947.53909-1-heiko@sntech.de> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] ipa: rkisp1: Add support for V12 isp blocks 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: , Cc: Heiko Stuebner Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Heiko Stuebner Some values for array sizes differ between v10 and v12, so set them in init() and adjust the auto exposure algorithm to the ae value from there. Signed-off-by: Heiko Stuebner Reviewed-by: Dafna Hirschfeld Reviewed-by: Kieran Bingham --- src/ipa/rkisp1/rkisp1.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index b47ea324..5f529334 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -66,12 +66,31 @@ private: uint32_t gain_; uint32_t minGain_; uint32_t maxGain_; + + /* revision-specific data */ + int hwAeMeanMax_; + int hwHistBinNMax_; + int hwGammaOutMaxSamples_; + int hwHistogramWeightGridsSize_; }; int IPARkISP1::init(unsigned int hwRevision) { /* \todo Add support for other revisions */ - if (hwRevision != RKISP1_V10) { + switch (hwRevision) { + case RKISP1_V10: + hwAeMeanMax_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V10; + hwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10; + hwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10; + hwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10; + break; + case RKISP1_V12: + hwAeMeanMax_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V12; + hwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12; + hwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12; + hwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12; + break; + default: LOG(IPARkISP1, Error) << "Hardware revision " << hwRevision << " is currently not supported"; @@ -236,7 +255,7 @@ void IPARkISP1::updateStatistics(unsigned int frame, unsigned int value = 0; unsigned int num = 0; - for (int i = 0; i < RKISP1_CIF_ISP_AE_MEAN_MAX_V10; i++) { + for (int i = 0; i < hwAeMeanMax_; i++) { if (ae->exp_mean[i] <= 15) continue;