Krita Source Code Documentation
Loading...
Searching...
No Matches
KisRollingSumAccumulatorWrapper.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7
9
10#include <boost/accumulators/accumulators.hpp>
11#include <boost/accumulators/statistics/stats.hpp>
12#include <boost/accumulators/statistics/rolling_sum.hpp>
13#include <boost/accumulators/statistics/rolling_count.hpp>
14
15using namespace boost::accumulators;
16
18 Private(int windowSize)
19 : accumulator(tag::rolling_window::window_size = windowSize)
20 {
21 }
22
23 accumulator_set<qreal, stats<tag::rolling_sum, tag::rolling_count> > accumulator;
24};
25
26
28 : m_d(new Private(windowSize))
29{
30}
31
35
37{
38 m_d->accumulator(value);
39}
40
42{
43 return boost::accumulators::rolling_sum(m_d->accumulator);
44}
45
47{
48 return boost::accumulators::rolling_count(m_d->accumulator);
49}
50
52{
53 m_d->accumulator =
54 accumulator_set<qreal, stats<tag::rolling_sum, tag::rolling_count>>(
55 tag::rolling_window::window_size = windowSize);
56}
57
float value(const T *src, size_t ch)
accumulator_set< qreal, stats< tag::rolling_sum, tag::rolling_count > > accumulator