From patchwork Thu May 2 13:30:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 19983 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 EEDF9C328F for ; Thu, 2 May 2024 13:31:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A892363422; Thu, 2 May 2024 15:31:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="kOhEX2Xl"; 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 936A26340B for ; Thu, 2 May 2024 15:31:14 +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 CEAF563B; Thu, 2 May 2024 15:30:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1714656617; bh=5eAYQCE7T/j+A/S6AnmKfFjKNnyhQifJ5JLK31/JP68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kOhEX2XlkzZhQrCeem3lx4hSp9WuzmT1p2HZCAAOti8HJktXyi/jr816vtj0jyQ4j vtLtVOpzB4QQbjcEj1SnIj1br6kE7c6Y54++jYfLnVos5t+MYfhWLH9N9wzSmsdxac 9P1/LpW0nhVYbs/Ny13XtGJ1Dl7IOUWpFgpJqUKY= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally , Stefan Klug , Paul Elder Subject: [PATCH v4 1/8] ipa: libipa: Allow creation of empty Histogram Date: Thu, 2 May 2024 14:30:39 +0100 Message-Id: <20240502133046.1976565-2-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240502133046.1976565-1-dan.scally@ideasonboard.com> References: <20240502133046.1976565-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 v4: - None 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]; }