[PATCH v1 6/8] ipa: libipa: Add data accessor to Histogram

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Oct 3 18:49:06 CEST 2024


Hi Stefan,

Thank you for the patch.

On Wed, Oct 02, 2024 at 06:19:24PM +0200, Stefan Klug wrote:
> For debugging purposes it is helpful to access the internal data of the
> histogram.  Add an accessor for that.

I wondered if we should return a span instead of a vector to be more
independent of the internal representation, but it's an internal API
anyway, it can easily change.

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
> ---
>  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..91ce05f17d9f 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 std::vector<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;

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list