[PATCH v2 1/8] ipa: libipa: Allow creation of empty Histogram
Daniel Scally
dan.scally at ideasonboard.com
Wed Apr 17 15:15:29 CEST 2024
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 <stefan.klug at ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
Signed-off-by: Daniel Scally <dan.scally at ideasonboard.com>
---
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<const uint32_t> data);
size_t bins() const { return cumulative_.size() - 1; }
uint64_t total() const { return cumulative_[cumulative_.size() - 1]; }
--
2.34.1
More information about the libcamera-devel
mailing list