use frames directly

This commit is contained in:
mazzol_a committed 2026-10-27 14:09:17 +01:00
1 parent 8fa2dfd0b3
commit 5678828fd5
2 files changed
+5 -8

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ static void DatasetAggregation_MeanOverDataset(benchmark::State &st) {
for (auto _ : st) {
aare::NDArray<uint16_t, 3> res =
aare::block_mean<uint16_t>(file_path, 220, 10, 16);
aare::block_mean<uint16_t>(file_path, 220, 100, 16);
benchmark::DoNotOptimize(res);
}
+4 -7
View File
@@ -70,16 +70,13 @@ block_mean(const std::filesystem::path &path, const size_t num_samples,
std::fill(sum.begin(), sum.end(), 0.0);
const FRAME_TYPE *src =
frames.data(); // using the pointer seems to be much faster than
// using the NDArray
for (size_t f = 0; f < mean_over_num_frames; ++f) {
const size_t f_off = f * rows * cols;
// const size_t f_off = f * rows * cols;
for (size_t r = 0; r < rows; ++r) {
const size_t off = f_off + r * cols;
// const size_t off = f_off + r * cols;
for (size_t c = 0; c < cols; ++c) {
sum[r * cols + c] += static_cast<double>(src[off + c]);
sum[r * cols + c] += static_cast<double>(frames(
f, r, c)); // static_cast<double>(src[off + c]);
}
}
}