From patchwork Wed Apr 24 12:49:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 19937 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 BBBF9C3200 for ; Wed, 24 Apr 2024 12:49:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 50A7663408; Wed, 24 Apr 2024 14:49:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Jc47R/hL"; 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 E6D82633EC for ; Wed, 24 Apr 2024 14:49:34 +0200 (CEST) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C001E7E9; Wed, 24 Apr 2024 14:48:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713962922; bh=gWcdBPI+pLxGTihk5wyi1Tu4BUUfoChnbIvfitaZsQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jc47R/hL11+68DhFAgbhGpJAjnVw+HnQRt5oNk4HYvpmYGCAac16hTXnkwSgJ776J YYee1gnPDvmDx6nM25rqxYwOhrW41dwSbOL9FdhUJiqbgd4v4iL5jhBZ6N7V8nhNiu 18zZnnV2BiuTAsvqqOZXm8twMvYUMZmOADqC9h4U= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally , Stefan Klug , Paul Elder Subject: [PATCH v3 1/8] ipa: libipa: Allow creation of empty Histogram Date: Wed, 24 Apr 2024 13:49:10 +0100 Message-Id: <20240424124917.1250837-2-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424124917.1250837-1-dan.scally@ideasonboard.com> References: <20240424124917.1250837-1-dan.scally@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" For convenience's sake allow the creation of empty Histograms so they can be embedded within other Classes and filled out with data at some later point in time. Reviewed-by: Stefan Klug Reviewed-by: Paul Elder Signed-off-by: Daniel Scally --- Changes in v3: - None Changes in v2: - Added documentation src/ipa/libipa/histogram.cpp | 9 +++++++++ src/ipa/libipa/histogram.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/ipa/libipa/histogram.cpp b/src/ipa/libipa/histogram.cpp index 6b5cde8e..c1aac59b 100644 --- a/src/ipa/libipa/histogram.cpp +++ b/src/ipa/libipa/histogram.cpp @@ -28,6 +28,15 @@ namespace ipa { * specified bin. It can be used to find quantiles and averages between quantiles. */ +/** + * \fn Histogram::Histogram() + * \brief Construct an empty Histogram + * + * This empty constructor exists largely to allow Histograms to be embedded in + * other classes which may be created before the contents of the Histogram are + * known. + */ + /** * \brief Create a cumulative histogram * \param[in] data A pre-sorted histogram to be passed diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h index 05bb4b80..54bb2a19 100644 --- a/src/ipa/libipa/histogram.h +++ b/src/ipa/libipa/histogram.h @@ -22,6 +22,7 @@ namespace ipa { class Histogram { public: + Histogram() { cumulative_.push_back(0); } Histogram(Span data); size_t bins() const { return cumulative_.size() - 1; } uint64_t total() const { return cumulative_[cumulative_.size() - 1]; }