blob: e06f1884395e5f669288babaeb95f393fb01a312 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* 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/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__ */
|