[PATCH v3 6/7] ipa: libipa: Add data accessor to Histogram

Stefan Klug stefan.klug at ideasonboard.com
Tue Oct 8 17:29:44 CEST 2024


For debugging purposes it is helpful to access the internal data of the
histogram.  Add an accessor for that.

Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

---
Changes in v2:
- return Span instead of reference to std::vector
---
 src/ipa/libipa/histogram.cpp | 6 ++++++
 src/ipa/libipa/histogram.h   | 1 +
 2 files changed, 7 insertions(+)

diff --git a/src/ipa/libipa/histogram.cpp b/src/ipa/libipa/histogram.cpp
index 5fbfadf5e4e1..10e44b54a0cf 100644
--- a/src/ipa/libipa/histogram.cpp
+++ b/src/ipa/libipa/histogram.cpp
@@ -62,6 +62,12 @@ Histogram::Histogram(Span<const uint32_t> data)
  * \return Number of bins
  */
 
+/**
+ * \fn Histogram::data()
+ * \brief Retrieve the internal data
+ * \return The data
+ */
+
 /**
  * \fn Histogram::total()
  * \brief Retrieve the total number of values in the data set
diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h
index 6fd641683694..a926002c8cf0 100644
--- a/src/ipa/libipa/histogram.h
+++ b/src/ipa/libipa/histogram.h
@@ -36,6 +36,7 @@ public:
 	}
 
 	size_t bins() const { return cumulative_.size() - 1; }
+	const Span<const uint64_t> data() const { return cumulative_; }
 	uint64_t total() const { return cumulative_[cumulative_.size() - 1]; }
 	uint64_t cumulativeFrequency(double bin) const;
 	double quantile(double q, uint32_t first = 0, uint32_t last = UINT_MAX) const;
-- 
2.43.0



More information about the libcamera-devel mailing list