From patchwork Thu Nov 5 09:01:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 28770 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 54E6EC3307 for ; Thu, 5 Nov 2026 09:02:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 23B226914A; Thu, 5 Nov 2026 10:02:01 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="D32V5Ba6"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C429769113 for ; Thu, 5 Nov 2026 10:01:59 +0100 (CET) Received: from pb-laptop.local (185.221.143.99.nat.pool.zt.hu [185.221.143.99]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 272E933D for ; Thu, 5 Nov 2026 09:59:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1793869181; bh=V56scLtE/GASWtxm7CFA6FYFrhIPKMC+3d8oeJPoz6o=; h=From:To:Subject:Date:From; b=D32V5Ba619/Xc7dNI6LIHm0l41tMAMn/StjPYWm3glycUs2CbvLSTmLfwibVTw/EX TtamL/lRw2b1WkRVNEsD7rcV+nKnjMlkS0bZh6FuhqsXuTVI882qeT1CrCV5ZbAjVq KntLwqkMDHb/vT74P9JG4ja9q9sI7SipyhRVQ1qI= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [RFC PATCH v1 1/2] ipa: libipa: histogram: Add `empty()` Date: Thu, 5 Nov 2026 10:01:55 +0100 Message-ID: <20261105090156.527585-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.56.0 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" Empty histograms are usually of little use, so add a function that checks if the histogram contains any data points. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- src/ipa/libipa/histogram.cpp | 10 ++++++++++ src/ipa/libipa/histogram.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/ipa/libipa/histogram.cpp b/src/ipa/libipa/histogram.cpp index 9e46a05a90..c516ace7da 100644 --- a/src/ipa/libipa/histogram.cpp +++ b/src/ipa/libipa/histogram.cpp @@ -74,6 +74,16 @@ Histogram::Histogram(std::span data) * \return Number of values */ +/** + * \fn Histogram::empty() + * \brief Determine if the histogram is empty + * + * An empty histogram is one which has only empty bins, + * that is, bins with a count of 0. + * + * \return True if the histogram is empty + */ + /** * \fn Histogram::operator[](size_t bin) const * \brief Retrieve the value for \a bin diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h index b50868ab4d..cbc34e8c70 100644 --- a/src/ipa/libipa/histogram.h +++ b/src/ipa/libipa/histogram.h @@ -41,6 +41,7 @@ public: uint64_t cumulativeFrequency(double bin) const; double quantile(double q, uint32_t first = 0, uint32_t last = UINT_MAX) const; double interQuantileMean(double lowQuantile, double hiQuantile) const; + bool empty() const { return total() == 0; } uint32_t operator[](size_t bin) const {