From patchwork Wed Oct 19 11:04:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17634 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 53491C327C for ; Wed, 19 Oct 2022 11:05:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id ECFC662E57; Wed, 19 Oct 2022 13:05:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1666177503; bh=6nurTBtSZIaANKgyuDwAbCr+Xxcu8zjq+5iaqFEwX5A=; 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=ol9uCOuL1mh6d+lwOxyZMj/LrDrO8qHYFH/sduWsxcEA8wX+cHRlOWnABggoNMpC4 lSNdMl/M3ZABHuji8gtMr1Yr2xKGjvTk9YMd/qqNJj7Tez1gdXSFMiFiqK9J5XtDSP Ce0MzJufsitxHR5urUSEhVXq+/6az81wB2M6+L59hdZl4LaAhgdkGrtM3F60WaKnFk bDH7/RcjkewBMP6LDO0cpiiE4ujMWlAiBCnu0q+1loOWhQAGo5V3SCaCtbdZnSrJTH s7ABwxzrcAa3cS1/MHBFZ1jYLMBJTT7imheOtqjDOkt8RHQUSXZvbNvT8bVTCZnjse HW9LCSwyqpjhw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D39DF62E45 for ; Wed, 19 Oct 2022 13:04:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mE81KUxG"; 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 6BE7E5A4 for ; Wed, 19 Oct 2022 13:04:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1666177499; bh=6nurTBtSZIaANKgyuDwAbCr+Xxcu8zjq+5iaqFEwX5A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mE81KUxGYCnEe3og6eoQ6xm7Y0tyyPMqio1gyEdYDkdBG9Pi+m5KvfAJbB7iuzeBc h6Y14eum/UMxXkhrpaQHbFosW9ZKZ9seSNtqVpAMe1vAl2XoiClX/9HIZBT0BbacNL EjSeXtAq5s/atVe+iLxEyyzhTPubgiYUd8zfugMw= To: libcamera-devel@lists.libcamera.org Date: Wed, 19 Oct 2022 14:04:31 +0300 Message-Id: <20221019110434.17767-2-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 1/4] ipa: Drop period at end of \brief or \param 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" A few periods crept in at the end of Doxygen \brief or \param statements in the src/ipa/ directory. Remove them all in one go. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/ipa/ipu3/algorithms/af.cpp | 18 +++++++++--------- src/ipa/ipu3/ipa_context.cpp | 6 +++--- src/ipa/libipa/algorithm.cpp | 2 +- src/ipa/libipa/histogram.cpp | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp index b00a34f9e090..75632aa39d21 100644 --- a/src/ipa/ipu3/algorithms/af.cpp +++ b/src/ipa/ipu3/algorithms/af.cpp @@ -267,9 +267,9 @@ void Af::afReset(IPAContext &context) } /** - * \brief AF variance comparison. + * \brief AF variance comparison * \param[in] context The IPA context - * \param[in] min_step The VCM movement step. + * \param[in] min_step The VCM movement step * * We always pick the largest variance to replace the previous one. The image * with a larger variance also indicates it is a clearer image than previous @@ -322,7 +322,7 @@ bool Af::afScan(IPAContext &context, int min_step) } /** - * \brief Determine the frame to be ignored. + * \brief Determine the frame to be ignored * \return Return True if the frame should be ignored, false otherwise */ bool Af::afNeedIgnoreFrame() @@ -335,7 +335,7 @@ bool Af::afNeedIgnoreFrame() } /** - * \brief Reset frame ignore counter. + * \brief Reset frame ignore counter */ void Af::afIgnoreFrameReset() { @@ -377,8 +377,8 @@ double Af::afEstimateVariance(Span y_items, bool isY1) } /** - * \brief Determine out-of-focus situation. - * \param[in] context The IPA context. + * \brief Determine out-of-focus situation + * \param[in] context The IPA context * * Out-of-focus means that the variance change rate for a focused and a new * variance is greater than a threshold. @@ -404,11 +404,11 @@ bool Af::afIsOutOfFocus(IPAContext &context) } /** - * \brief Determine the max contrast image and lens position. - * \param[in] context The IPA context. + * \brief Determine the max contrast image and lens position + * \param[in] context The IPA context * \param[in] frame The frame context sequence number * \param[in] frameContext The current frame context - * \param[in] stats The statistics buffer of IPU3. + * \param[in] stats The statistics buffer of IPU3 * * Ideally, a clear image also has a relatively higher contrast. So, every * image for each focus step should be tested to find an optimal focus step. diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp index f276227c1ecc..68f017b04751 100644 --- a/src/ipa/ipu3/ipa_context.cpp +++ b/src/ipa/ipu3/ipa_context.cpp @@ -68,7 +68,7 @@ namespace libcamera::ipa::ipu3 { * \brief AF grid configuration of the IPA * * \var IPASessionConfiguration::af.afGrid - * \brief AF scene grid configuration. + * \brief AF scene grid configuration */ /** @@ -79,10 +79,10 @@ namespace libcamera::ipa::ipu3 { * \brief Current position of the lens * * \var IPAActiveState::af.maxVariance - * \brief The maximum variance of the current image. + * \brief The maximum variance of the current image * * \var IPAActiveState::af.stable - * \brief It is set to true, if the best focus is found. + * \brief It is set to true, if the best focus is found */ /** diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp index c152b885aee1..55abddab2b0a 100644 --- a/src/ipa/libipa/algorithm.cpp +++ b/src/ipa/libipa/algorithm.cpp @@ -72,7 +72,7 @@ namespace ipa { * \param[in] context The shared IPA context * \param[in] frame The frame context sequence number * \param[in] frameContext The FrameContext for this frame - * \param[out] params The ISP specific parameters. + * \param[out] params The ISP specific parameters * * This function is called for every frame when the camera is running before it * is processed by the ISP to prepare the ISP processing parameters for that diff --git a/src/ipa/libipa/histogram.cpp b/src/ipa/libipa/histogram.cpp index 69b461779a1f..6b5cde8e0ab3 100644 --- a/src/ipa/libipa/histogram.cpp +++ b/src/ipa/libipa/histogram.cpp @@ -53,7 +53,7 @@ Histogram::Histogram(Span data) */ /** - * \brief Cumulative frequency up to a (fractional) point in a bin. + * \brief Cumulative frequency up to a (fractional) point in a bin * \param[in] bin The bin up to which to cumulate * * With F(p) the cumulative frequency of the histogram, the value is 0 at From patchwork Wed Oct 19 11:04:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17635 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 70571BD16B for ; Wed, 19 Oct 2022 11:05:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B155662E59; Wed, 19 Oct 2022 13:05:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1666177503; bh=I0pSobrHpsk5LfES/QvWcPKwDxBmazYuDuK3ZzGhAB8=; 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=Ql0aefxxSxEuAbdMgpr5/SLIuzDw3zcf8gn77lsUcVz2L2oZRv12Lmkt2lQipJbx9 9reUjBzimnCHbDJ03Xm69aWG3Vpt1UtKLqiAEl1vrBQ0uA/iNx9u2h+Tib5s/iTIcS sGJUg6Lz3GTf9DJ4XuAubRImlgmKVhlDmouQIf8/Df3a2G5OFQs6kpHbNYwICfh+pw PWmD4hiNdDY+pj73ZtyjzYRaGB3mZxtx0q9imCsuAdDFnX1MBRLyhSgTFBaqJF4x2C aErxYQ5oJhL21zT0TQLFe76tBfRRKNynrO0Yn6ZfTvgG9j8FkeDEYzcizKT2x7UEbR ZMmQaX8drXFYg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 148A162E45 for ; Wed, 19 Oct 2022 13:05:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="I1V0lrU+"; 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 A38A05A4 for ; Wed, 19 Oct 2022 13:05:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1666177500; bh=I0pSobrHpsk5LfES/QvWcPKwDxBmazYuDuK3ZzGhAB8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=I1V0lrU+D9K6cBzuTMMlnoWVk9OYFHeW8VDJB8JRQAj9N8l5ojMkTe9ZecozftD58 /CGNyAgX1Ucwvf8CWuciwkSkKIz3MAUgjfriaXGATuUm4UytyGj4dQREE0XAhnv5Gk wuhAFhzbKIKt0PycruB8SlBtYQafSgZfJztes1ns= To: libcamera-devel@lists.libcamera.org Date: Wed, 19 Oct 2022 14:04:32 +0300 Message-Id: <20221019110434.17767-3-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 2/4] ipa: Pass metadata to Algorithm::process() 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: , 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" Extend the Algorithm::process() function with a metadata control list, to be filled by individual algorithms with frame metadata. Update the rkisp1 and ipu3 IPA modules accordingly, and drop the dead code in the IPARkISP1::prepareMetadata() function while at it. This only creates the infrastructure, filling metadata in individual algorithms will be handled separately. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/ipa/ipu3/algorithms/af.cpp | 2 ++ src/ipa/ipu3/algorithms/af.h | 2 +- src/ipa/ipu3/algorithms/agc.cpp | 2 ++ src/ipa/ipu3/algorithms/agc.h | 2 +- src/ipa/ipu3/algorithms/awb.cpp | 1 + src/ipa/ipu3/algorithms/awb.h | 2 +- src/ipa/ipu3/algorithms/tone_mapping.cpp | 2 ++ src/ipa/ipu3/algorithms/tone_mapping.h | 2 +- src/ipa/ipu3/ipu3.cpp | 3 ++- src/ipa/libipa/algorithm.cpp | 5 +++-- src/ipa/libipa/algorithm.h | 1 + src/ipa/rkisp1/algorithms/agc.cpp | 4 +++- src/ipa/rkisp1/algorithms/agc.h | 2 +- src/ipa/rkisp1/algorithms/awb.cpp | 1 + src/ipa/rkisp1/algorithms/awb.h | 2 +- src/ipa/rkisp1/rkisp1.cpp | 17 +++-------------- 16 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp index 75632aa39d21..2d728871a63b 100644 --- a/src/ipa/ipu3/algorithms/af.cpp +++ b/src/ipa/ipu3/algorithms/af.cpp @@ -408,6 +408,7 @@ bool Af::afIsOutOfFocus(IPAContext &context) * \param[in] context The IPA context * \param[in] frame The frame context sequence number * \param[in] frameContext The current frame context + * \param[out] metadata Metadata for the frame, to be filled by the algorithm * \param[in] stats The statistics buffer of IPU3 * * Ideally, a clear image also has a relatively higher contrast. So, every @@ -423,6 +424,7 @@ bool Af::afIsOutOfFocus(IPAContext &context) */ void Af::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, + [[maybe_unused]] ControlList &metadata, const ipu3_uapi_stats_3a *stats) { /* Evaluate the AF buffer length */ diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h index 89d37ac18615..ea7ca647df12 100644 --- a/src/ipa/ipu3/algorithms/af.h +++ b/src/ipa/ipu3/algorithms/af.h @@ -35,7 +35,7 @@ public: IPAFrameContext &frameContext, ipu3_uapi_params *params) override; void process(IPAContext &context, const uint32_t frame, - IPAFrameContext &frameContext, + IPAFrameContext &frameContext, ControlList &metadata, const ipu3_uapi_stats_3a *stats) override; private: diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp index a1a3c38ffe84..44dd5c809e26 100644 --- a/src/ipa/ipu3/algorithms/agc.cpp +++ b/src/ipa/ipu3/algorithms/agc.cpp @@ -319,6 +319,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState, * \param[in] context The shared IPA context * \param[in] frame The current frame sequence number * \param[in] frameContext The current frame context + * \param[out] metadata Metadata for the frame, to be filled by the algorithm * \param[in] stats The IPU3 statistics and ISP results * * Identify the current image brightness, and use that to estimate the optimal @@ -326,6 +327,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState, */ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, IPAFrameContext &frameContext, + [[maybe_unused]] ControlList &metadata, const ipu3_uapi_stats_3a *stats) { /* diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h index 59b4b9843c2f..9106cbefe87a 100644 --- a/src/ipa/ipu3/algorithms/agc.h +++ b/src/ipa/ipu3/algorithms/agc.h @@ -29,7 +29,7 @@ public: int configure(IPAContext &context, const IPAConfigInfo &configInfo) override; void process(IPAContext &context, const uint32_t frame, - IPAFrameContext &frameContext, + IPAFrameContext &frameContext, ControlList &metadata, const ipu3_uapi_stats_3a *stats) override; private: diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp index 0dbd7d4c374f..836eb0687181 100644 --- a/src/ipa/ipu3/algorithms/awb.cpp +++ b/src/ipa/ipu3/algorithms/awb.cpp @@ -389,6 +389,7 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats) */ void Awb::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, + [[maybe_unused]] ControlList &metadata, const ipu3_uapi_stats_3a *stats) { calculateWBGains(stats); diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h index 28e2d38a711c..c38c425c3654 100644 --- a/src/ipa/ipu3/algorithms/awb.h +++ b/src/ipa/ipu3/algorithms/awb.h @@ -43,7 +43,7 @@ public: IPAFrameContext &frameContext, ipu3_uapi_params *params) override; void process(IPAContext &context, const uint32_t frame, - IPAFrameContext &frameContext, + IPAFrameContext &frameContext, ControlList &metadata, const ipu3_uapi_stats_3a *stats) override; private: diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp index eac3d4064443..6fcc03f3fcf7 100644 --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp @@ -78,6 +78,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context, * \param[in] context The shared IPA context * \param[in] frame The current frame sequence number * \param[in] frameContext The current frame context + * \param[out] metadata Metadata for the frame, to be filled by the algorithm * \param[in] stats The IPU3 statistics and ISP results * * The tone mapping look up table is generated as an inverse power curve from @@ -85,6 +86,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context, */ void ToneMapping::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, + [[maybe_unused]] ControlList &metadata, [[maybe_unused]] const ipu3_uapi_stats_3a *stats) { /* diff --git a/src/ipa/ipu3/algorithms/tone_mapping.h b/src/ipa/ipu3/algorithms/tone_mapping.h index 822e5168df82..ab2a1c000f2f 100644 --- a/src/ipa/ipu3/algorithms/tone_mapping.h +++ b/src/ipa/ipu3/algorithms/tone_mapping.h @@ -22,7 +22,7 @@ public: void prepare(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, ipu3_uapi_params *params) override; void process(IPAContext &context, const uint32_t frame, - IPAFrameContext &frameContext, + IPAFrameContext &frameContext, ControlList &metadata, const ipu3_uapi_stats_3a *stats) override; private: diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 891643e057b8..0ccc6bf5c8af 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -631,9 +631,10 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame, double lineDuration = context_.configuration.sensor.lineDuration.get(); int32_t vBlank = context_.configuration.sensor.defVBlank; ControlList ctrls(controls::controls); + ControlList metadata(controls::controls); for (auto const &algo : algorithms()) - algo->process(context_, frame, frameContext, stats); + algo->process(context_, frame, frameContext, metadata, stats); setControls(frame); diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp index 55abddab2b0a..a34c583d947e 100644 --- a/src/ipa/libipa/algorithm.cpp +++ b/src/ipa/libipa/algorithm.cpp @@ -106,12 +106,13 @@ namespace ipa { * \param[in] context The shared IPA context * \param[in] frame The frame context sequence number * \param[in] frameContext The current frame's context + * \param[out] metadata Metadata for the frame, to be filled by the algorithm * \param[in] stats The IPA statistics and ISP results * * This function is called while camera is running for every frame processed by * the ISP, to process statistics generated from that frame by the ISP. - * Algorithms shall use this data to run calculations and update their state - * accordingly. + * Algorithms shall use this data to run calculations, update their state + * accordingly, and fill the frame metadata. * * Processing shall not take an undue amount of time, and any extended or * computationally expensive calculations or operations must be handled diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h index d8601f9ccaff..793247be8129 100644 --- a/src/ipa/libipa/algorithm.h +++ b/src/ipa/libipa/algorithm.h @@ -55,6 +55,7 @@ public: virtual void process([[maybe_unused]] typename Module::Context &context, [[maybe_unused]] const uint32_t frame, [[maybe_unused]] typename Module::FrameContext &frameContext, + [[maybe_unused]] ControlList &metadata, [[maybe_unused]] const typename Module::Stats *stats) { } diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 04062a364e7f..9de11a2a3bca 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -288,7 +288,9 @@ double Agc::measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const * new exposure and gain for the scene. */ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, - IPAFrameContext &frameContext, const rkisp1_stat_buffer *stats) + IPAFrameContext &frameContext, + [[maybe_unused]] ControlList &metadata, + const rkisp1_stat_buffer *stats) { /* * \todo Verify that the exposure and gain applied by the sensor for diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h index 9ad5c32fd6f6..99af09167331 100644 --- a/src/ipa/rkisp1/algorithms/agc.h +++ b/src/ipa/rkisp1/algorithms/agc.h @@ -30,7 +30,7 @@ public: IPAFrameContext &frameContext, rkisp1_params_cfg *params) override; void process(IPAContext &context, const uint32_t frame, - IPAFrameContext &frameContext, + IPAFrameContext &frameContext, ControlList &metadata, const rkisp1_stat_buffer *stats) override; private: diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index 3349948a3acf..9b97db7d5c5a 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -208,6 +208,7 @@ void Awb::queueRequest(IPAContext &context, void Awb::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, IPAFrameContext &frameContext, + [[maybe_unused]] ControlList &metadata, const rkisp1_stat_buffer *stats) { const rkisp1_cif_isp_stat *params = &stats->params; diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h index d76b538288ec..3659b2d5405f 100644 --- a/src/ipa/rkisp1/algorithms/awb.h +++ b/src/ipa/rkisp1/algorithms/awb.h @@ -27,7 +27,7 @@ public: IPAFrameContext &frameContext, const ControlList &controls) override; void process(IPAContext &context, const uint32_t frame, - IPAFrameContext &frameCtx, + IPAFrameContext &frameContext, ControlList &metadata, const rkisp1_stat_buffer *stats) override; private: diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 3f5c1a58695c..bef5211d5c34 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -69,7 +69,6 @@ protected: private: void setControls(unsigned int frame); - void prepareMetadata(unsigned int frame, unsigned int aeState); std::map buffers_; std::map mappedBuffers_; @@ -338,14 +337,14 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId frameContext.sensor.gain = camHelper_->gain(sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get()); - unsigned int aeState = 0; + ControlList metadata(controls::controls); for (auto const &algo : algorithms()) - algo->process(context_, frame, frameContext, stats); + algo->process(context_, frame, frameContext, metadata, stats); setControls(frame); - prepareMetadata(frame, aeState); + metadataReady.emit(frame, metadata); } void IPARkISP1::setControls(unsigned int frame) @@ -366,16 +365,6 @@ void IPARkISP1::setControls(unsigned int frame) setSensorControls.emit(frame, ctrls); } -void IPARkISP1::prepareMetadata(unsigned int frame, unsigned int aeState) -{ - ControlList ctrls(controls::controls); - - if (aeState) - ctrls.set(controls::AeLocked, aeState == 2); - - metadataReady.emit(frame, ctrls); -} - } /* namespace ipa::rkisp1 */ /* 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 << ", " From patchwork Wed Oct 19 11:04:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17637 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 1A033C327C for ; Wed, 19 Oct 2022 11:05:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A1FC962E54; 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=w/uO32TPgyrtOMKEmrhtHB3yy+UoiiaVEGSrKbYpN9c=; 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=OjPbb6kp8oJl7cxXdnQPzZqyAmDbXpKH4oQXyTOuQ2ClVrLoV5uAeaiQA/JLAM3ZA OXN1nEBVXecBOPKN195izHgpgOpH07bhvicEhD7gvxQzMdJNh0vAww145P9lC7/O1V JSR2IzNxPWQwDXLY4+LrFF5lnkU7I9S0Ab3mSwUcppDiVMnBCR0YCL4rCDNdJZNpJZ OaZ2vM6S/9qwQc47J5MGl75SFeMd3GPEESokRP+wvPDjF6iFpAmCJa45t+JsO05Wi7 rIw46nMqgRBkis1l5E9aG3kJ/X6JDu2bJV0WuQCSD30IenzqUkvyL3Z/nsDsZbuQ0H tdj6mwj3yNVow== 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 99F1862E4F for ; Wed, 19 Oct 2022 13:05:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ebBJMrT+"; 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 051EE5A4 for ; Wed, 19 Oct 2022 13:05:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1666177503; bh=w/uO32TPgyrtOMKEmrhtHB3yy+UoiiaVEGSrKbYpN9c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ebBJMrT+WLyct+igdHBDusSl/ENFcHqhXLj2DTAtGlzM2h4QR1kY1Wn4t+mlTWIpb FPjVyXQiXyBwJL4UbMrMI7hy/VTD67sBUv/A+lrnRCOb6nwomt2L6+P/N/2T0DIKRZ HDWCuRy7SPkfYSu4PPOZhD4OnMvX+6LdTEdybnyI= To: libcamera-devel@lists.libcamera.org Date: Wed, 19 Oct 2022 14:04:34 +0300 Message-Id: <20221019110434.17767-5-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 4/4] ipa: rkisp1: Downgrade sensor controls range message to Debug 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" There's no need to print the exposure and gain control ranges as an Info message. Downgrade it to Debug. While at it, print the ranges using the "[min, max]" syntax. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/ipa/rkisp1/rkisp1.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index bef5211d5c34..7dd340cf50af 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -232,9 +232,9 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info, int32_t minGain = itGain->second.min().get(); int32_t maxGain = itGain->second.max().get(); - LOG(IPARkISP1, Info) - << "Exposure: " << minExposure << "-" << maxExposure - << " Gain: " << minGain << "-" << maxGain; + LOG(IPARkISP1, Debug) + << "Exposure: [" << minExposure << ", " << maxExposure + << "], gain: [" << minGain << ", " << maxGain << "]"; /* Clear the IPA context before the streaming session. */ context_.configuration = {};