From patchwork Wed Oct 19 11:04:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17636 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 927E9C3285 for ; Wed, 19 Oct 2022 11:05:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3628262E5C; Wed, 19 Oct 2022 13:05:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1666177505; bh=ksLRF+d+U1IaqKh+ZvDg/oD+8BpMphLwSqknnYgGhKw=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=UOG/5I2KMaDb4i56WHdC4smHlFHOCt0TYKrNIKBBbOjH5QNWUqHMU4QNdcklwTw2w G4/TagzVnpPRIi2mav3yt7IKGX/gkjCEeZph0bwknlUxgQk8/wR4dukb2RvbcRQxg0 M/ONZBhGbYY5A87Fw0vK72ac4xI2g1Kg9IAg9RL01+wBzrEeDHZ3uL3vmBSoPLkdWW rqb3V5KAvtV9lCwl8x+oZIiymiQFnIm2wfLw20xF6edDYliPQ3j+hW+gslcYYy17IX 056hTUxdT9yCOTS9V2GRbfz+bTrz45AiCOCJUEBW2bKT5NuLo1LULmekXTEJzR1+Wq hxXqbk/eRY7qw== 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 4586662E4D for ; Wed, 19 Oct 2022 13:05:02 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="i419UL1W"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D1894903 for ; Wed, 19 Oct 2022 13:05:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1666177502; bh=ksLRF+d+U1IaqKh+ZvDg/oD+8BpMphLwSqknnYgGhKw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=i419UL1WAlyUO/mgejSyDKLm8hfyiYK/MQiij+mpRQuIXkpeVq4W/8HtgbvoAd1v5 fcr8vzDLC1wD07mqCHW0g6SKTgBnTQVLeVsJ+jI77n9EhbKkyJi25onBT+oNZQrYrj 5dlQYQHzWHf4DhkUYczKhK1zSK7mGII5HOuLJ1Kg= To: libcamera-devel@lists.libcamera.org Date: Wed, 19 Oct 2022 14:04:33 +0300 Message-Id: <20221019110434.17767-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221019110434.17767-1-laurent.pinchart@ideasonboard.com> References: <20221019110434.17767-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 3/4] ipa: rkisp1: Fill AGC and AWB metadata 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: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Fill the frame metadata in the AGC and AWB algorithm's prepare() function. Additional metadata for other algorithms will be addressed later. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/ipa/rkisp1/algorithms/agc.cpp | 9 ++++++++- src/ipa/rkisp1/algorithms/awb.cpp | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 9de11a2a3bca..a909d8aa59ea 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -16,6 +16,8 @@ #include +#include + #include "libipa/histogram.h" /** @@ -289,7 +291,7 @@ double Agc::measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const */ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, IPAFrameContext &frameContext, - [[maybe_unused]] ControlList &metadata, + ControlList &metadata, const rkisp1_stat_buffer *stats) { /* @@ -333,6 +335,11 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, computeExposure(context, frameContext, yGain, iqMeanGain); frameCount_++; + + utils::Duration exposureTime = context.configuration.sensor.lineDuration + * frameContext.sensor.exposure; + metadata.set(controls::AnalogueGain, frameContext.sensor.gain); + metadata.set(controls::ExposureTime, exposureTime.get()); } /** diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index 9b97db7d5c5a..93888a8e7412 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -208,7 +208,7 @@ void Awb::queueRequest(IPAContext &context, void Awb::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, IPAFrameContext &frameContext, - [[maybe_unused]] ControlList &metadata, + ControlList &metadata, const rkisp1_stat_buffer *stats) { const rkisp1_cif_isp_stat *params = &stats->params; @@ -307,6 +307,12 @@ void Awb::process(IPAContext &context, frameContext.awb.temperatureK = activeState.awb.temperatureK; + metadata.set(controls::AwbEnable, frameContext.awb.autoEnabled); + metadata.set(controls::ColourGains, { + static_cast(frameContext.awb.gains.red), + static_cast(frameContext.awb.gains.blue) + }); + LOG(RkISP1Awb, Debug) << std::showpoint << "Means [" << redMean << ", " << greenMean << ", " << blueMean << "], gains [" << activeState.awb.gains.automatic.red << ", "