2 #include <benchmark/benchmark.h>
5 unsigned get_size(
unsigned requested,
unsigned levels) {
6 auto const N = (1u << levels);
7 return requested %
N == 0 ? requested : requested +
N - requested %
N;
10 std::ostringstream sstr;
15 template <
typename TYPE,
unsigned DB = 1,
unsigned LEVEL = 1>
17 auto const Nx =
get_size(state.range_x(), LEVEL);
18 auto const Ny =
get_size(state.range_y(), LEVEL);
22 while (state.KeepRunning()) wavelet.direct(output, input);
23 state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(Nx) * int64_t(Ny) *
sizeof(TYPE));
26 template <
typename TYPE,
unsigned DB = 1,
unsigned LEVEL = 1>
28 auto const Nx =
get_size(state.range_x(), LEVEL);
29 auto const Ny =
get_size(state.range_y(), LEVEL);
33 while (state.KeepRunning()) wavelet.indirect(input, output);
34 state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(Nx) * int64_t(Ny) *
sizeof(TYPE));
37 template <
typename TYPE,
unsigned DB = 1,
unsigned LEVEL = 1>
39 auto const Nx =
get_size(state.range_x(), LEVEL);
43 while (state.KeepRunning()) wavelet.direct(output, input);
44 state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(Nx) *
sizeof(TYPE));
46 template <
typename TYPE,
unsigned DB = 1,
unsigned LEVEL = 1>
48 auto const Nx =
get_size(state.range_x(), LEVEL);
52 while (state.KeepRunning()) wavelet.indirect(input, output);
53 state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(Nx) *
sizeof(TYPE));
56 auto constexpr
n = 64;
57 auto constexpr
N = 256 * 3;
unsigned get_size(unsigned requested, unsigned levels)
BENCHMARK_TEMPLATE(direct_matrix, sopt::t_complex, 1, 1) -> RangePair(n, N, n, N) ->UseRealTime()
void direct_vector(benchmark::State &state)
void direct_matrix(benchmark::State &state)
void indirect_vector(benchmark::State &state)
void indirect_matrix(benchmark::State &state)
std::string get_name(unsigned db)
Wavelet factory(const std::string &name, t_uint nlevels)
Creates a wavelet transform object.
double t_real
Root of the type hierarchy for real numbers.
Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic > Image
A 2-dimensional list of elements of given type.
Eigen::Array< T, Eigen::Dynamic, 1 > Array
A 1-dimensional list of elements of given type.
std::complex< t_real > t_complex
Root of the type hierarchy for (real) complex numbers.