From patchwork Thu Sep 30 09:55:03 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: 14004 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 82BB8C3243 for ; Thu, 30 Sep 2021 09:55:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 54A47691AF; Thu, 30 Sep 2021 11:55:33 +0200 (CEST) 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="nbZK1Mq5"; 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 02E6A691AA for ; Thu, 30 Sep 2021 11:55:19 +0200 (CEST) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:bab4:22c5:662d:e478]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A552A2A8; Thu, 30 Sep 2021 11:55:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1632995718; bh=LFh8BNmwrDEmjBPspaawQKvWN2mk1Rd89f6qorKcmug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nbZK1Mq5EJmOQNmEv6qALE5V6lthaEsOp8tnCa6r/rCZ8U9wNwtDhcnOGYYA0E54i 4BDPsGmpSS3+r6XX5Oo73ArwQ0AVu70w658bAnizYtAsgbBkZ+hE5GhC6pJMxHvVjp KK/YfZ77rTJ4yC2Oj+cbQ6lmUsYjPUXyLXCzqIss= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Sep 2021 11:55:03 +0200 Message-Id: <20210930095513.76213-9-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210930095513.76213-1-jeanmichel.hautbois@ideasonboard.com> References: <20210930095513.76213-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 08/18] ipa: ipu3: tonemapping: Add the documentation for ToneMapping 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 Tonemapping algorithm is currently undocumented. Provide an introduction and overview to the implementation as the class definition and document how the algorithm operates in the process and prepare methods. Signed-off-by: Jean-Michel Hautbois Signed-off-by: Kieran Bingham --- src/ipa/ipu3/algorithms/tone_mapping.cpp | 35 +++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp index 40337f9d..15e9ab3f 100644 --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp @@ -10,15 +10,40 @@ #include #include +/** + * \file tone_mapping.h + */ + namespace libcamera { namespace ipa::ipu3::algorithms { +/** + * \class ToneMapping + * \brief A class to handle tone mapping based on gamma + * + * This algorithm improves the image dynamic using a look-up table which is + * generated based on a gamma parameter. + * + * Gamma values less than one have the effect of compressing the image histogram + * while values over 1 will expand it. + * + * Expanding the histogram has the effect of providing better overall contrast. + */ + ToneMapping::ToneMapping() : gamma_(1.0) { } +/** + * \brief Fill in the parameter structure, and enable gamma control + * \param context The shared IPA context + * \param params The IPU3 parameters + * + * Populate the IPU3 parameter structure with our gamma correction table, and + * enable the gamma control module in the accelerator cluster. + */ void ToneMapping::prepare([[maybe_unused]] IPAContext &context, ipu3_uapi_params *params) { @@ -33,7 +58,15 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context, params->acc_param.gamma.gc_ctrl.enable = 1; } -void ToneMapping::process([[maybe_unused]] IPAContext &context, +/** + * \brief Calculate the Gamma curve + * \param context The shared IPA context + * \param stats The IPU3 statistics and ISP results + * + * The gamma correction look up table is generated as an inverse power curve + * from our gamma setting. + */ +void ToneMapping::process(IPAContext &context, [[maybe_unused]] const ipu3_uapi_stats_3a *stats) { /*