Files
external_libcamera/src/ipa/libipa/histogram.h
T
Kieran Bingham b71e8c2f39 libcamera/base: Move span to base library
Move span, and adjust the Doxygen exclusion as well.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:11 +01:00

41 lines
942 B
C++

/* SPDX-License-Identifier: BSD-2-Clause */
/*
* Copyright (C) 2019, Raspberry Pi (Trading) Limited
*
* histogram.h - histogram calculation interface
*/
#ifndef __LIBCAMERA_IPA_LIBIPA_HISTOGRAM_H__
#define __LIBCAMERA_IPA_LIBIPA_HISTOGRAM_H__
#include <assert.h>
#include <limits.h>
#include <stdint.h>
#include <vector>
#include <libcamera/base/span.h>
namespace libcamera {
namespace ipa {
class Histogram
{
public:
Histogram(Span<uint32_t> data);
size_t bins() const { return cumulative_.size() - 1; }
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;
double interQuantileMean(double lowQuantile, double hiQuantile) const;
private:
std::vector<uint64_t> cumulative_;
};
} /* namespace ipa */
} /* namespace libcamera */
#endif /* __LIBCAMERA_IPA_LIBIPA_HISTOGRAM_H__ */