From 1bb320bd0e2f1913943736fc63f3f43d132b7098 Mon Sep 17 00:00:00 2001 From: Denes Tarjan Date: Mon, 17 Mar 2025 14:02:21 +0000 Subject: [PATCH] Reduce runtime of test_gaussian_blur --- test/api/test_gaussian_blur.cpp | 21 +++++++++++++-------- test/framework/utils.cpp | 6 +++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/test/api/test_gaussian_blur.cpp b/test/api/test_gaussian_blur.cpp index 559301f8d..4656bdbc4 100644 --- a/test/api/test_gaussian_blur.cpp +++ b/test/api/test_gaussian_blur.cpp @@ -10,7 +10,6 @@ #include "framework/utils.h" #include "kleidicv/filters/sigma.h" #include "kleidicv/kleidicv.h" -#include "test_config.h" #define KLEIDICV_GAUSSIAN_BLUR(type, type_suffix) \ KLEIDICV_API(gaussian_blur, kleidicv_gaussian_blur_##type_suffix, type) @@ -101,14 +100,20 @@ class GaussianBlurTest : public test::KernelTest { } // Apply rounding to nearest integer division. - IntermediateType scale_result(const test::Kernel &kernel, + IntermediateType scale_result(const test::Kernel &, IntermediateType result) override { - // NOLINTBEGIN(readability-avoid-nested-conditional-operator) - return kernel.width() == 3 ? ((result + 8) / 16) - : kernel.width() == 5 ? ((result + 128) / 256) - : kernel.width() == 7 ? ((result + 2048) / 4096) - : ((result + 524288) / 1048576); - // NOLINTEND(readability-avoid-nested-conditional-operator) + if constexpr (KernelTestParams::kKernelSize == 3) { + return (result + 8) / 16; + } + if constexpr (KernelTestParams::kKernelSize == 5) { + return (result + 128) / 256; + } + if constexpr (KernelTestParams::kKernelSize == 7) { + return (result + 2048) / 4096; + } + if constexpr (KernelTestParams::kKernelSize == 15) { + return (result + 524288) / 1048576; + } } const ArrayContainerType array_layouts_; diff --git a/test/framework/utils.cpp b/test/framework/utils.cpp index d7bb5c78f..ef5316034 100644 --- a/test/framework/utils.cpp +++ b/test/framework/utils.cpp @@ -69,12 +69,12 @@ std::array small_array_layouts(size_t min_width, // width, height, padding, channels { min_width, min_height, 0, 1}, { min_width + 1, min_height + 1, 0, 1}, - { min_width * 2, min_height, 0, 2}, + { min_width * 2, min_height, 1, 2}, { min_width * 3, min_height, vl, 3}, { min_width * 3, min_height, 0, 1}, { width + 1, min_height, 0, 1}, - { 2 * width, min_height, vl, 1}, - { 4 * width, min_height, vl, 1}, + { width + 4, min_height, vl, 1}, + { width + 7, min_height, 4, 1}, // clang-format on }}; } -- GitLab