@@ -31,13 +31,14 @@ namespace ipa {
/**
* \brief Create a cumulative histogram
* \param[in] data A pre-sorted histogram to be passed
+ * \param[in] rshift Number of bits to right shift the values by
*/
-Histogram::Histogram(Span<const uint32_t> data)
+Histogram::Histogram(Span<const uint32_t> data, uint8_t rshift)
{
cumulative_.reserve(data.size());
cumulative_.push_back(0);
for (const uint32_t &value : data)
- cumulative_.push_back(cumulative_.back() + value);
+ cumulative_.push_back(cumulative_.back() + (value >> rshift));
}
/**
@@ -22,7 +22,7 @@ namespace ipa {
class Histogram
{
public:
- Histogram(Span<const uint32_t> data);
+ Histogram(Span<const uint32_t> data, uint8_t rshift = 0);
size_t bins() const { return cumulative_.size() - 1; }
uint64_t total() const { return cumulative_[cumulative_.size() - 1]; }
uint64_t cumulativeFrequency(double bin) const;
Add an parameter for right-shifting the values during construction of the histogram. This is necessary notably for the rkisp1, as the values reported from the hardware are 20 bits where the upper 16-bits are meaningful integer values and the lower 4 bits are fractional and meant to be discarded. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> --- src/ipa/libipa/histogram.cpp | 5 +++-- src/ipa/libipa/histogram.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)