From 9dc3314a73fd9ab016d8fb3de6e06f0805974d39 Mon Sep 17 00:00:00 2001 From: Denes Tarjan Date: Fri, 12 Apr 2024 10:00:23 +0000 Subject: [PATCH 1/3] Rename: INTRINSICCV -> KLEIDICV --- .vscode/tasks.json | 4 +- README.md | 6 +- adapters/opencv/CMakeLists.txt | 12 +- adapters/opencv/intrinsiccv_hal.cpp | 40 +- adapters/opencv/intrinsiccv_hal.h | 74 +-- adapters/opencv/opencv-4.9.patch | 48 +- adapters/opencv/opencv-5.x.patch | 48 +- benchmark/CMakeLists.txt | 22 +- conformity/opencv/common.h | 15 +- conformity/opencv/manager.cpp | 8 +- conformity/opencv/subordinate.cpp | 8 +- conformity/opencv/test_float_conv.h | 6 +- conformity/opencv/test_gaussian_blur.h | 6 +- conformity/opencv/test_sobel.h | 6 +- conformity/opencv/tests.h | 6 +- intrinsiccv/CMakeLists.txt | 124 ++--- .../intrinsiccv/arithmetics/transpose.h | 6 +- intrinsiccv/include/intrinsiccv/config.h.in | 88 ++-- .../include/intrinsiccv/containers/stack.h | 12 +- .../intrinsiccv/conversions/gray_to_rgb.h | 6 +- .../include/intrinsiccv/conversions/merge.h | 6 +- .../intrinsiccv/conversions/rgb_to_rgb.h | 6 +- .../include/intrinsiccv/conversions/split.h | 6 +- .../intrinsiccv/conversions/yuv_to_rgb.h | 6 +- intrinsiccv/include/intrinsiccv/ctypes.h | 38 +- intrinsiccv/include/intrinsiccv/debug.h | 18 +- intrinsiccv/include/intrinsiccv/dispatch.h | 86 ++- .../intrinsiccv/filters/gaussian_blur.h | 6 +- .../include/intrinsiccv/filters/sobel.h | 6 +- intrinsiccv/include/intrinsiccv/intrinsiccv.h | 496 +++++++++--------- .../intrinsiccv/morphology/workspace.h | 44 +- intrinsiccv/include/intrinsiccv/neon.h | 10 +- .../include/intrinsiccv/neon_intrinsics.h | 8 +- intrinsiccv/include/intrinsiccv/operations.h | 248 +++++---- .../include/intrinsiccv/resize/resize.h | 6 +- .../intrinsiccv/resize/resize_linear.h | 6 +- intrinsiccv/include/intrinsiccv/sve2.h | 177 +++---- intrinsiccv/include/intrinsiccv/traits.h | 14 +- intrinsiccv/include/intrinsiccv/types.h | 207 ++++---- intrinsiccv/include/intrinsiccv/unsafe.h | 6 +- intrinsiccv/include/intrinsiccv/utils.h | 154 +++--- .../include/intrinsiccv/workspace/borders.h | 36 +- .../include/intrinsiccv/workspace/separable.h | 25 +- intrinsiccv/src/analysis/canny_neon.cpp | 20 +- .../src/analysis/count_nonzeros_neon.cpp | 4 +- intrinsiccv/src/analysis/min_max_api.cpp | 24 +- intrinsiccv/src/analysis/min_max_loc_neon.cpp | 14 +- intrinsiccv/src/analysis/min_max_neon.cpp | 22 +- intrinsiccv/src/arithmetics/absdiff_api.cpp | 18 +- intrinsiccv/src/arithmetics/absdiff_neon.cpp | 16 +- intrinsiccv/src/arithmetics/absdiff_sme2.cpp | 26 +- intrinsiccv/src/arithmetics/absdiff_sve2.cpp | 18 +- .../add_abs_with_threshold_api.cpp | 10 +- .../add_abs_with_threshold_neon.cpp | 8 +- .../arithmetics/add_abs_with_threshold_sc.h | 20 +- .../add_abs_with_threshold_sme2.cpp | 8 +- .../add_abs_with_threshold_sve2.cpp | 14 +- intrinsiccv/src/arithmetics/add_api.cpp | 24 +- intrinsiccv/src/arithmetics/add_neon.cpp | 28 +- intrinsiccv/src/arithmetics/add_sme2.cpp | 36 +- intrinsiccv/src/arithmetics/add_sve2.cpp | 32 +- intrinsiccv/src/arithmetics/multiply_api.cpp | 18 +- intrinsiccv/src/arithmetics/multiply_neon.cpp | 16 +- intrinsiccv/src/arithmetics/multiply_sve2.cpp | 18 +- intrinsiccv/src/arithmetics/scale_api.cpp | 18 +- intrinsiccv/src/arithmetics/scale_neon.cpp | 16 +- intrinsiccv/src/arithmetics/sub_api.cpp | 24 +- intrinsiccv/src/arithmetics/sub_neon.cpp | 28 +- intrinsiccv/src/arithmetics/sub_sme2.cpp | 36 +- intrinsiccv/src/arithmetics/sub_sve2.cpp | 32 +- intrinsiccv/src/arithmetics/threshold_api.cpp | 10 +- .../src/arithmetics/threshold_neon.cpp | 8 +- intrinsiccv/src/arithmetics/threshold_sc.h | 25 +- .../src/arithmetics/threshold_sme2.cpp | 8 +- .../src/arithmetics/threshold_sve2.cpp | 8 +- intrinsiccv/src/arithmetics/transpose_api.cpp | 4 +- .../src/arithmetics/transpose_neon.cpp | 18 +- .../src/conversions/float_conv_api.cpp | 32 +- .../src/conversions/float_conv_neon.cpp | 14 +- intrinsiccv/src/conversions/float_conv_sc.h | 38 +- .../src/conversions/float_conv_sme2.cpp | 14 +- .../src/conversions/float_conv_sve2.cpp | 14 +- .../src/conversions/gray_to_rgb_api.cpp | 12 +- .../src/conversions/gray_to_rgb_neon.cpp | 20 +- intrinsiccv/src/conversions/gray_to_rgb_sc.h | 70 +-- .../src/conversions/gray_to_rgb_sme2.cpp | 4 +- .../src/conversions/gray_to_rgb_sve2.cpp | 4 +- intrinsiccv/src/conversions/merge_api.cpp | 4 +- intrinsiccv/src/conversions/merge_neon.cpp | 42 +- .../src/conversions/rgb_to_rgb_api.cpp | 30 +- .../src/conversions/rgb_to_rgb_neon.cpp | 30 +- intrinsiccv/src/conversions/rgb_to_rgb_sc.h | 97 ++-- .../src/conversions/rgb_to_rgb_sme2.cpp | 12 +- .../src/conversions/rgb_to_rgb_sve2.cpp | 12 +- intrinsiccv/src/conversions/split_api.cpp | 4 +- intrinsiccv/src/conversions/split_neon.cpp | 22 +- .../src/conversions/yuv_to_rgb_api.cpp | 16 +- .../src/conversions/yuv_to_rgb_neon.cpp | 10 +- intrinsiccv/src/conversions/yuv_to_rgb_sc.h | 38 +- .../src/conversions/yuv_to_rgb_sme2.cpp | 8 +- .../src/conversions/yuv_to_rgb_sve2.cpp | 8 +- intrinsiccv/src/filters/gaussian_blur_api.cpp | 28 +- .../src/filters/gaussian_blur_neon.cpp | 20 +- intrinsiccv/src/filters/gaussian_blur_sc.h | 34 +- .../src/filters/gaussian_blur_sme2.cpp | 2 +- .../src/filters/gaussian_blur_sve2.cpp | 2 +- intrinsiccv/src/filters/sobel_api.cpp | 16 +- intrinsiccv/src/filters/sobel_neon.cpp | 24 +- intrinsiccv/src/filters/sobel_sc.h | 50 +- intrinsiccv/src/filters/sobel_sme2.cpp | 4 +- intrinsiccv/src/filters/sobel_sve2.cpp | 4 +- intrinsiccv/src/morphology/morphology_api.cpp | 28 +- .../src/morphology/morphology_neon.cpp | 38 +- intrinsiccv/src/morphology/morphology_sc.h | 134 +++-- .../src/morphology/morphology_sme2.cpp | 12 +- .../src/morphology/morphology_sve2.cpp | 12 +- intrinsiccv/src/resize/resize_api.cpp | 4 +- intrinsiccv/src/resize/resize_linear_api.cpp | 4 +- intrinsiccv/src/resize/resize_linear_neon.cpp | 14 +- intrinsiccv/src/resize/resize_linear_sc.h | 49 +- intrinsiccv/src/resize/resize_linear_sme2.cpp | 2 +- intrinsiccv/src/resize/resize_linear_sve2.cpp | 2 +- intrinsiccv/src/resize/resize_neon.cpp | 12 +- intrinsiccv/src/resize/resize_sc.h | 64 ++- intrinsiccv/src/resize/resize_sme2.cpp | 2 +- intrinsiccv/src/resize/resize_sve2.cpp | 2 +- scripts/ci.sh | 14 +- scripts/format.sh | 12 +- scripts/run_opencv_conformity_checks.sh | 24 +- test/CMakeLists.txt | 18 +- test/api/CMakeLists.txt | 10 +- test/api/test_add_abs_with_threshold.cpp | 28 +- test/api/test_canny.cpp | 34 +- test/api/test_count_nonzeros.cpp | 24 +- test/api/test_float_conv.cpp | 57 +- test/api/test_gaussian_blur.cpp | 351 ++++++------- test/api/test_merge.cpp | 33 +- test/api/test_min_max.cpp | 66 +-- test/api/test_morphology.cpp | 263 +++++----- test/api/test_resize_linear.cpp | 38 +- test/api/test_resize_to_quarter.cpp | 32 +- test/api/test_rgb_and_gray.cpp | 28 +- test/api/test_saturating_absdiff.cpp | 44 +- test/api/test_saturating_add.cpp | 50 +- test/api/test_saturating_multiply.cpp | 44 +- test/api/test_saturating_sub.cpp | 50 +- test/api/test_scale.cpp | 30 +- test/api/test_sobel.cpp | 110 ++-- test/api/test_split.cpp | 33 +- test/api/test_threshold_binary.cpp | 27 +- test/api/test_transpose.cpp | 34 +- test/api/test_yuv_to_rgb.cpp | 32 +- test/framework/CMakeLists.txt | 10 +- test/framework/abstract.h | 6 +- test/framework/array.h | 6 +- test/framework/border.cpp | 10 +- test/framework/border.h | 6 +- test/framework/generator.h | 6 +- test/framework/kernel.h | 8 +- test/framework/operation.h | 8 +- test/framework/test_border.cpp | 8 +- test/framework/test_kernel.cpp | 4 +- test/framework/types.h | 6 +- test/framework/utils.h | 14 +- test/test_config.h.in | 18 +- 165 files changed, 2707 insertions(+), 2796 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 8f841d47b..fed196ecc 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -13,7 +13,7 @@ "env": { "CMAKE_CXX_FLAGS": "--target=aarch64-linux-gnu", "CMAKE_EXE_LINKER_FLAGS": "--rtlib=compiler-rt -static -fuse-ld=lld", - "EXTRA_CMAKE_ARGS": "-DINTRINSICCV_ENABLE_SVE2=ON -DINTRINSICCV_ENABLE_SVE2_SELECTIVELY=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1" + "EXTRA_CMAKE_ARGS": "-DKLEIDICV_ENABLE_SVE2=ON -DKLEIDICV_ENABLE_SVE2_SELECTIVELY=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1" } }, "group": { @@ -35,7 +35,7 @@ "CMAKE_BUILD_TYPE" : "Debug", "CMAKE_CXX_FLAGS": "--target=aarch64-linux-gnu", "CMAKE_EXE_LINKER_FLAGS": "--rtlib=compiler-rt -static -fuse-ld=lld", - "EXTRA_CMAKE_ARGS": "-DINTRINSICCV_ENABLE_SVE2=ON -DINTRINSICCV_ENABLE_SVE2_SELECTIVELY=OFF" + "EXTRA_CMAKE_ARGS": "-DKLEIDICV_ENABLE_SVE2=ON -DKLEIDICV_ENABLE_SVE2_SELECTIVELY=OFF" } }, "group": { diff --git a/README.md b/README.md index 2d0fbdabe..6822e2867 100644 --- a/README.md +++ b/README.md @@ -116,8 +116,8 @@ The project can be built using standard cmake. cmake \ -S /path/to/opencv \ -B build-opencv \ --DWITH_INTRINSICCV=ON \ --DINTRINSICCV_SOURCE_PATH=/path/to/intrinsiccv \ +-DWITH_KLEIDICV=ON \ +-DKLEIDICV_SOURCE_PATH=/path/to/intrinsiccv \ -DCMAKE_CXX_STANDARD=14 \ -DBUILD_ANDROID_EXAMPLE=OFF \ -DBUILD_ANDROID_PROJECTS=OFF \ @@ -135,7 +135,7 @@ To target Android devices the following CMake flags are required here as well: # Benchmarking -Benchmarks can be enabled with the `cmake` argument `-DINTRINSICCV_BENCHMARK=ON`. +Benchmarks can be enabled with the `cmake` argument `-DKLEIDICV_BENCHMARK=ON`. The benchmarks are based on [Google Benchmark](https://github.com/google/benchmark). All the standard Google Benchmark command line arguments can be used. In addition, the image size on which the tests will be run can be set with the command line diff --git a/adapters/opencv/CMakeLists.txt b/adapters/opencv/CMakeLists.txt index 7ee1ff39d..b1ecee028 100644 --- a/adapters/opencv/CMakeLists.txt +++ b/adapters/opencv/CMakeLists.txt @@ -6,10 +6,10 @@ include("${CMAKE_CURRENT_LIST_DIR}/../../intrinsiccv/CMakeLists.txt") project("IntrinsicCV OpenCV HAL") -set(INTRINSICCV_HAL_VERSION "0.0.0" CACHE INTERNAL "") -set(INTRINSICCV_HAL_LIBRARIES "intrinsiccv_hal" CACHE INTERNAL "") -set(INTRINSICCV_HAL_HEADERS "${CMAKE_CURRENT_LIST_DIR}/intrinsiccv_hal.h" CACHE INTERNAL "") -set(INTRINSICCV_HAL_INCLUDE_DIRS "$" CACHE INTERNAL "") +set(KLEIDICV_HAL_VERSION "0.0.0" CACHE INTERNAL "") +set(KLEIDICV_HAL_LIBRARIES "intrinsiccv_hal" CACHE INTERNAL "") +set(KLEIDICV_HAL_HEADERS "${CMAKE_CURRENT_LIST_DIR}/intrinsiccv_hal.h" CACHE INTERNAL "") +set(KLEIDICV_HAL_INCLUDE_DIRS "$" CACHE INTERNAL "") add_library(intrinsiccv_hal STATIC "${CMAKE_CURRENT_LIST_DIR}/intrinsiccv_hal.cpp") target_link_libraries(intrinsiccv_hal PUBLIC intrinsiccv) @@ -29,7 +29,7 @@ if(NOT BUILD_SHARED_LIBS) DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev ) - if(INTRINSICCV_BUILD_SVE2) + if(KLEIDICV_BUILD_SVE2) ocv_install_target(intrinsiccv_sve2 EXPORT OpenCVModules ARCHIVE @@ -37,7 +37,7 @@ if(NOT BUILD_SHARED_LIBS) COMPONENT dev ) endif() - if(INTRINSICCV_BUILD_SME2) + if(KLEIDICV_BUILD_SME2) ocv_install_target(intrinsiccv_sme2 EXPORT OpenCVModules ARCHIVE diff --git a/adapters/opencv/intrinsiccv_hal.cpp b/adapters/opencv/intrinsiccv_hal.cpp index ea9d27fa8..84f626847 100644 --- a/adapters/opencv/intrinsiccv_hal.cpp +++ b/adapters/opencv/intrinsiccv_hal.cpp @@ -16,13 +16,13 @@ namespace intrinsiccv::hal { static int convert_error(intrinsiccv_error_t e) { switch (e) { - case INTRINSICCV_OK: + case KLEIDICV_OK: return CV_HAL_ERROR_OK; - case INTRINSICCV_ERROR_NOT_IMPLEMENTED: + case KLEIDICV_ERROR_NOT_IMPLEMENTED: return CV_HAL_ERROR_NOT_IMPLEMENTED; // Even if IntrinsicCV returns this error it's possible that another // implementation could handle the misalignment. - case INTRINSICCV_ERROR_ALIGNMENT: + case KLEIDICV_ERROR_ALIGNMENT: return CV_HAL_ERROR_NOT_IMPLEMENTED; default: return CV_HAL_ERROR_UNKNOWN; @@ -48,7 +48,7 @@ static size_t get_type_size(int depth) { // Note: 'dcn' is already accounted for in 'dst_step'. int gray_to_bgr(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int depth, int dcn) { - if (INTRINSICCV_UNLIKELY((dcn != 3) && (dcn != 4))) { + if (KLEIDICV_UNLIKELY((dcn != 3) && (dcn != 4))) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } @@ -69,8 +69,8 @@ int gray_to_bgr(const uchar *src_data, size_t src_step, uchar *dst_data, int bgr_to_bgr(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int depth, int scn, int dcn, bool swapBlue) { - if (INTRINSICCV_UNLIKELY(((scn != 3) && (scn != 4)) || - ((dcn != 3) && (dcn != 4)))) { + if (KLEIDICV_UNLIKELY(((scn != 3) && (scn != 4)) || + ((dcn != 3) && (dcn != 4)))) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } @@ -193,27 +193,25 @@ static int from_opencv(int opencv_border_type, default: return 1; case CV_HAL_BORDER_CONSTANT: - border_type = intrinsiccv_border_type_t::INTRINSICCV_BORDER_TYPE_CONSTANT; + border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_CONSTANT; break; case CV_HAL_BORDER_REPLICATE: - border_type = - intrinsiccv_border_type_t::INTRINSICCV_BORDER_TYPE_REPLICATE; + border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_REPLICATE; break; case CV_HAL_BORDER_REFLECT: - border_type = intrinsiccv_border_type_t::INTRINSICCV_BORDER_TYPE_REFLECT; + border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_REFLECT; break; case CV_HAL_BORDER_REFLECT_101: - border_type = intrinsiccv_border_type_t::INTRINSICCV_BORDER_TYPE_REVERSE; + border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_REVERSE; break; case CV_HAL_BORDER_WRAP: - border_type = intrinsiccv_border_type_t::INTRINSICCV_BORDER_TYPE_WRAP; + border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_WRAP; break; case CV_HAL_BORDER_TRANSPARENT: - border_type = - intrinsiccv_border_type_t::INTRINSICCV_BORDER_TYPE_TRANSPARENT; + border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_TRANSPARENT; break; case CV_HAL_BORDER_ISOLATED: - border_type = intrinsiccv_border_type_t::INTRINSICCV_BORDER_TYPE_NONE; + border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_NONE; break; } @@ -319,10 +317,9 @@ int morphology_init(cvhalFilter2D **cvcontext, int operation, int src_type, return CV_HAL_ERROR_NOT_IMPLEMENTED; } - if (border_type != - intrinsiccv_border_type_t::INTRINSICCV_BORDER_TYPE_CONSTANT && + if (border_type != intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_CONSTANT && border_type != - intrinsiccv_border_type_t::INTRINSICCV_BORDER_TYPE_REPLICATE) { + intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_REPLICATE) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } @@ -360,8 +357,7 @@ int morphology_init(cvhalFilter2D **cvcontext, int operation, int src_type, } intrinsiccv_border_values_t border_values = {}; - if (border_type == - intrinsiccv_border_type_t::INTRINSICCV_BORDER_TYPE_CONSTANT) { + if (border_type == intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_CONSTANT) { border_values.top = cvborder_values[0]; border_values.left = cvborder_values[1]; border_values.bottom = cvborder_values[2]; @@ -525,7 +521,7 @@ int sobel(const uchar *src_data, size_t src_step, uchar *dst_data, return CV_HAL_ERROR_NOT_IMPLEMENTED; } -#if INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#if KLEIDICV_EXPERIMENTAL_FEATURE_CANNY int canny(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int cn, double lowThreshold, double highThreshold, int ksize, bool L2gradient) { @@ -551,7 +547,7 @@ int canny(const uchar *src_data, size_t src_step, uchar *dst_data, static_cast(width), static_cast(height), lowThreshold, highThreshold)); } -#endif // INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#endif // KLEIDICV_EXPERIMENTAL_FEATURE_CANNY int transpose(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int src_width, int src_height, diff --git a/adapters/opencv/intrinsiccv_hal.h b/adapters/opencv/intrinsiccv_hal.h index 150fd34ed..e17ea035f 100644 --- a/adapters/opencv/intrinsiccv_hal.h +++ b/adapters/opencv/intrinsiccv_hal.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_OPENCV_HAL_H -#define INTRINSICCV_OPENCV_HAL_H +#ifndef KLEIDICV_OPENCV_HAL_H +#define KLEIDICV_OPENCV_HAL_H #include #include @@ -19,7 +19,7 @@ namespace intrinsiccv { namespace hal { // Macros to shorten repeated code. -#define INTRINSICCV_HAL_API(api) (intrinsiccv::hal::api) +#define KLEIDICV_HAL_API(api) (intrinsiccv::hal::api) int gray_to_bgr(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int depth, int dcn); @@ -75,11 +75,11 @@ int sobel(const uchar *src_data, size_t src_step, uchar *dst_data, int margin_bottom, int dx, int dy, int ksize, double scale, double delta, int border_type); -#if INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#if KLEIDICV_EXPERIMENTAL_FEATURE_CANNY int canny(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int cn, double lowThreshold, double highThreshold, int ksize, bool L2gradient); -#endif // INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#endif // KLEIDICV_EXPERIMENTAL_FEATURE_CANNY int transpose(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int src_width, int src_height, int element_size); @@ -98,10 +98,10 @@ int convertTo(const uchar *src_data, size_t src_step, int src_depth, // Other HAL implementations might require the cv namespace namespace cv { -#define INTRINSICCV_HAL_FALLBACK_FORWARD(intrinsiccv_impl, fallback_hal_impl, \ - ...) \ - (INTRINSICCV_HAL_API(intrinsiccv_impl)(__VA_ARGS__) == CV_HAL_ERROR_OK \ - ? CV_HAL_ERROR_OK \ +#define KLEIDICV_HAL_FALLBACK_FORWARD(intrinsiccv_impl, fallback_hal_impl, \ + ...) \ + (KLEIDICV_HAL_API(intrinsiccv_impl)(__VA_ARGS__) == CV_HAL_ERROR_OK \ + ? CV_HAL_ERROR_OK \ : fallback_hal_impl(__VA_ARGS__)) #ifdef OPENCV_IMGPROC_HAL_REPLACEMENT_HPP @@ -110,9 +110,9 @@ namespace cv { static inline int intrinsiccv_gray_to_bgr_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int depth, int dcn) { - return INTRINSICCV_HAL_FALLBACK_FORWARD(gray_to_bgr, cv_hal_cvtGraytoBGR, - src_data, src_step, dst_data, - dst_step, width, height, depth, dcn); + return KLEIDICV_HAL_FALLBACK_FORWARD(gray_to_bgr, cv_hal_cvtGraytoBGR, + src_data, src_step, dst_data, dst_step, + width, height, depth, dcn); } #undef cv_hal_cvtGraytoBGR #define cv_hal_cvtGraytoBGR intrinsiccv_gray_to_bgr_with_fallback @@ -121,9 +121,9 @@ static inline int intrinsiccv_gray_to_bgr_with_fallback( static inline int intrinsiccv_bgr_to_bgr_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int depth, int scn, int dcn, bool swapBlue) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( - bgr_to_bgr, cv_hal_cvtBGRtoBGR, src_data, src_step, dst_data, dst_step, - width, height, depth, scn, dcn, swapBlue); + return KLEIDICV_HAL_FALLBACK_FORWARD(bgr_to_bgr, cv_hal_cvtBGRtoBGR, src_data, + src_step, dst_data, dst_step, width, + height, depth, scn, dcn, swapBlue); } #undef cv_hal_cvtBGRtoBGR #define cv_hal_cvtBGRtoBGR intrinsiccv_bgr_to_bgr_with_fallback @@ -132,7 +132,7 @@ static inline int intrinsiccv_bgr_to_bgr_with_fallback( static inline int intrinsiccv_yuv_to_bgr_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int dst_width, int dst_height, int dcn, bool swapBlue, int uIdx) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( + return KLEIDICV_HAL_FALLBACK_FORWARD( yuv_to_bgr, cv_hal_cvtTwoPlaneYUVtoBGR, src_data, src_step, dst_data, dst_step, dst_width, dst_height, dcn, swapBlue, uIdx); } @@ -144,7 +144,7 @@ static inline int intrinsiccv_yuv_to_bgr_ex_with_fallback( const uchar *y_data, size_t y_step, const uchar *uv_data, size_t uv_step, uchar *dst_data, size_t dst_step, int dst_width, int dst_height, int dcn, bool swapBlue, int uIdx) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( + return KLEIDICV_HAL_FALLBACK_FORWARD( yuv_to_bgr_ex, cv_hal_cvtTwoPlaneYUVtoBGREx, y_data, y_step, uv_data, uv_step, dst_data, dst_step, dst_width, dst_height, dcn, swapBlue, uIdx); } @@ -156,7 +156,7 @@ static inline int intrinsiccv_threshold_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int depth, int cn, double thresh, double maxValue, int thresholdType) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( + return KLEIDICV_HAL_FALLBACK_FORWARD( threshold, cv_hal_threshold, src_data, src_step, dst_data, dst_step, width, height, depth, cn, thresh, maxValue, thresholdType); } @@ -170,7 +170,7 @@ static inline int intrinsiccv_gaussian_blur_with_fallback( size_t margin_top, size_t margin_right, size_t margin_bottom, size_t ksize_width, size_t ksize_height, double sigmaX, double sigmaY, int border_type) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( + return KLEIDICV_HAL_FALLBACK_FORWARD( gaussian_blur, cv_hal_gaussianBlur, src_data, src_step, dst_data, dst_step, width, height, depth, cn, margin_left, margin_top, margin_right, margin_bottom, ksize_width, ksize_height, sigmaX, sigmaY, border_type); @@ -185,7 +185,7 @@ static inline int intrinsiccv_morphology_init_with_fallback( size_t kernel_step, int kernel_width, int kernel_height, int anchor_x, int anchor_y, int border_type, const double border_values[4], int iterations, bool allow_submatrix, bool allow_in_place) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( + return KLEIDICV_HAL_FALLBACK_FORWARD( morphology_init, cv_hal_morphInit, context, operation, src_type, dst_type, max_width, max_height, kernel_type, kernel_data, kernel_step, kernel_width, kernel_height, anchor_x, anchor_y, border_type, @@ -200,7 +200,7 @@ static inline int intrinsiccv_morphology_operation_with_fallback( size_t dst_step, int width, int height, int src_full_width, int src_full_height, int src_roi_x, int src_roi_y, int dst_full_width, int dst_full_height, int dst_roi_x, int dst_roi_y) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( + return KLEIDICV_HAL_FALLBACK_FORWARD( morphology_operation, cv_hal_morph, context, src_data, src_step, dst_data, dst_step, width, height, src_full_width, src_full_height, src_roi_x, src_roi_y, dst_full_width, dst_full_height, dst_roi_x, dst_roi_y); @@ -211,8 +211,8 @@ static inline int intrinsiccv_morphology_operation_with_fallback( // morphology_free static inline int intrinsiccv_morphology_free_with_fallback( cvhalFilter2D *context) { - return INTRINSICCV_HAL_FALLBACK_FORWARD(morphology_free, cv_hal_morphFree, - context); + return KLEIDICV_HAL_FALLBACK_FORWARD(morphology_free, cv_hal_morphFree, + context); } #undef cv_hal_morphFree #define cv_hal_morphFree intrinsiccv_morphology_free_with_fallback @@ -222,7 +222,7 @@ static inline int intrinsiccv_resize_with_fallback( int src_type, const uchar *src_data, size_t src_step, int src_width, int src_height, uchar *dst_data, size_t dst_step, int dst_width, int dst_height, double inv_scale_x, double inv_scale_y, int interpolation) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( + return KLEIDICV_HAL_FALLBACK_FORWARD( resize, cv_hal_resize, src_type, src_data, src_step, src_width, src_height, dst_data, dst_step, dst_width, dst_height, inv_scale_x, inv_scale_y, interpolation); @@ -236,7 +236,7 @@ static inline int intrinsiccv_sobel_with_fallback( int width, int height, int src_depth, int dst_depth, int cn, int margin_left, int margin_top, int margin_right, int margin_bottom, int dx, int dy, int ksize, double scale, double delta, int border_type) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( + return KLEIDICV_HAL_FALLBACK_FORWARD( sobel, cv_hal_sobel, src_data, src_step, dst_data, dst_step, width, height, src_depth, dst_depth, cn, margin_left, margin_top, margin_right, margin_bottom, dx, dy, ksize, scale, delta, border_type); @@ -244,19 +244,19 @@ static inline int intrinsiccv_sobel_with_fallback( #undef cv_hal_sobel #define cv_hal_sobel intrinsiccv_sobel_with_fallback -#if INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#if KLEIDICV_EXPERIMENTAL_FEATURE_CANNY // canny static inline int intrinsiccv_canny_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int cn, double lowThreshold, double highThreshold, int ksize, bool L2gradient) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( + return KLEIDICV_HAL_FALLBACK_FORWARD( canny, cv_hal_canny, src_data, src_step, dst_data, dst_step, width, height, cn, lowThreshold, highThreshold, ksize, L2gradient); } #undef cv_hal_canny #define cv_hal_canny intrinsiccv_canny_with_fallback -#endif // INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#endif // KLEIDICV_EXPERIMENTAL_FEATURE_CANNY #endif // OPENCV_IMGPROC_HAL_REPLACEMENT_HPP @@ -266,9 +266,9 @@ static inline int intrinsiccv_canny_with_fallback( static inline int intrinsiccv_transpose_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int src_width, int src_height, int element_size) { - return INTRINSICCV_HAL_FALLBACK_FORWARD(transpose, cv_hal_transpose, src_data, - src_step, dst_data, dst_step, - src_width, src_height, element_size); + return KLEIDICV_HAL_FALLBACK_FORWARD(transpose, cv_hal_transpose, src_data, + src_step, dst_data, dst_step, src_width, + src_height, element_size); } #undef cv_hal_transpose #define cv_hal_transpose intrinsiccv_transpose_with_fallback @@ -278,7 +278,7 @@ static inline int intrinsiccv_min_max_idx_with_fallback( const uchar *src_data, size_t src_stride, int width, int height, int depth, double *min_value, double *max_value, int *min_index, int *max_index, uchar *mask) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( + return KLEIDICV_HAL_FALLBACK_FORWARD( min_max_idx, cv_hal_minMaxIdx, src_data, src_stride, width, height, depth, min_value, max_value, min_index, max_index, mask); } @@ -289,9 +289,9 @@ static inline int intrinsiccv_convertTo_with_fallback( const uchar *src_data, size_t src_step, int src_depth, uchar *dst_data, size_t dst_step, int dst_depth, int width, int height, double scale, double shift) { - return INTRINSICCV_HAL_FALLBACK_FORWARD( - convertTo, cv_hal_convertTo, src_data, src_step, src_depth, dst_data, - dst_step, dst_depth, width, height, scale, shift); + return KLEIDICV_HAL_FALLBACK_FORWARD(convertTo, cv_hal_convertTo, src_data, + src_step, src_depth, dst_data, dst_step, + dst_depth, width, height, scale, shift); } #undef cv_hal_convertTo #define cv_hal_convertTo intrinsiccv_convertTo_with_fallback @@ -299,8 +299,8 @@ static inline int intrinsiccv_convertTo_with_fallback( #endif // OPENCV_CORE_HAL_REPLACEMENT_HPP // Remove no longer needed macro definitions. -#undef INTRINSICCV_HAL_FALLBACK_FORWARD +#undef KLEIDICV_HAL_FALLBACK_FORWARD } // namespace cv -#endif // INTRINSICCV_OPENCV_HAL_H +#endif // KLEIDICV_OPENCV_HAL_H diff --git a/adapters/opencv/opencv-4.9.patch b/adapters/opencv/opencv-4.9.patch index 85eecfc63..ccd407b3a 100644 --- a/adapters/opencv/opencv-4.9.patch +++ b/adapters/opencv/opencv-4.9.patch @@ -8,9 +8,9 @@ index 0000000000..c0ffb73ad7 --- /dev/null +++ b/3rdparty/intrinsiccv/CMakeLists.txt @@ -0,0 +1,3 @@ -+set(INTRINSICCV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/intrinsiccv" CACHE PATH "Directory containing IntrinsicCV sources") ++set(KLEIDICV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/intrinsiccv" CACHE PATH "Directory containing IntrinsicCV sources") + -+include("${INTRINSICCV_SOURCE_PATH}/adapters/opencv/CMakeLists.txt") ++include("${KLEIDICV_SOURCE_PATH}/adapters/opencv/CMakeLists.txt") diff --git a/CMakeLists.txt b/CMakeLists.txt index 5da9c2a695..3f1a2c7e38 100644 --- a/CMakeLists.txt @@ -18,17 +18,17 @@ index 5da9c2a695..3f1a2c7e38 100644 @@ -13,6 +13,8 @@ FATAL: In-source builds are not allowed. ") endif() - + +# Useful for HALs if built as a CMake submodule +set(OPENCV_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - + include(cmake/OpenCVMinDepVersions.cmake) - + @@ -254,6 +256,8 @@ OCV_OPTION(WITH_CAP_IOS "Enable iOS video capture" ON VERIFY HAVE_CAP_IOS) OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" (NOT CV_DISABLE_OPTIMIZATION) VISIBLE_IF (ARM OR AARCH64) AND NOT IOS AND NOT XROS) -+OCV_OPTION(WITH_INTRINSICCV "Use IntrinsicCV library for ARM platforms" OFF ++OCV_OPTION(WITH_KLEIDICV "Use IntrinsicCV library for ARM platforms" OFF + VISIBLE_IF (AARCH64)) OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON VISIBLE_IF ANDROID @@ -36,8 +36,8 @@ index 5da9c2a695..3f1a2c7e38 100644 @@ -955,6 +959,13 @@ if(HAVE_OPENVX) endif() endif() - -+if(WITH_INTRINSICCV) + ++if(WITH_KLEIDICV) + ocv_debug_message(STATUS "Enable IntrinsicCV acceleration") + if(NOT ";${OpenCV_HAL};" MATCHES ";intrinsiccv;") + set(OpenCV_HAL "intrinsiccv;${OpenCV_HAL}") @@ -53,8 +53,8 @@ index 5da9c2a695..3f1a2c7e38 100644 endif() + elseif(hal STREQUAL "intrinsiccv") + add_subdirectory(3rdparty/intrinsiccv) -+ ocv_hal_register(INTRINSICCV_HAL_LIBRARIES INTRINSICCV_HAL_HEADERS INTRINSICCV_HAL_INCLUDE_DIRS) -+ list(APPEND OpenCV_USED_HAL "IntrinsicCV (ver ${INTRINSICCV_HAL_VERSION})") ++ ocv_hal_register(KLEIDICV_HAL_LIBRARIES KLEIDICV_HAL_HEADERS KLEIDICV_HAL_INCLUDE_DIRS) ++ list(APPEND OpenCV_USED_HAL "IntrinsicCV (ver ${KLEIDICV_HAL_VERSION})") elseif(hal STREQUAL "openvx") add_subdirectory(3rdparty/openvx) ocv_hal_register(OPENVX_HAL_LIBRARIES OPENVX_HAL_HEADERS OPENVX_HAL_INCLUDE_DIRS) @@ -64,9 +64,9 @@ index dba280485f..963628ee0d 100644 +++ b/doc/tutorials/introduction/config_reference/config_reference.markdown @@ -623,6 +623,7 @@ Following build options are utilized in `opencv_contrib` modules, as stated [pre `CMAKE_TOOLCHAIN_FILE` - + `WITH_CAROTENE` -+`WITH_INTRINSICCV` ++`WITH_KLEIDICV` `WITH_CPUFEATURES` `WITH_EIGEN` `WITH_OPENVX` @@ -75,12 +75,12 @@ index 6f0a83d359..4c294962ca 100644 --- a/modules/core/include/opencv2/core/hal/interface.h +++ b/modules/core/include/opencv2/core/hal/interface.h @@ -81,6 +81,8 @@ typedef signed char schar; - + #define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1) #define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK) +#define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT) +#define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1) - + #define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT)) #define CV_MAKE_TYPE CV_MAKETYPE diff --git a/modules/core/src/convert.dispatch.cpp b/modules/core/src/convert.dispatch.cpp @@ -97,12 +97,12 @@ index 345b4624cb..8698cc64bf 100644 + int width_in_elements = src.cols * cn; + CALL_HAL(convertTo, cv_hal_convertTo, src.data, src.step, src.depth(), dst.data, dst.step, dst.depth(), width_in_elements, src.rows, alpha, beta); + } - + BinaryFunc func = noScale ? getConvertFunc(sdepth, ddepth) : getConvertScaleFunc(sdepth, ddepth); double scale[] = {alpha, beta}; - int cn = channels(); CV_Assert( func != 0 ); - + if( dims <= 2 ) diff --git a/modules/core/src/hal_replacement.hpp b/modules/core/src/hal_replacement.hpp index 1f2b259920..b0e5db024d 100644 @@ -111,7 +111,7 @@ index 1f2b259920..b0e5db024d 100644 @@ -818,6 +818,35 @@ inline int hal_ni_rotate90(int src_type, const uchar* src_data, size_t src_step, #define cv_hal_rotate90 hal_ni_rotate90 //! @endcond - + +/** + @brief Transpose + @param src_data,src_step Source image @@ -142,8 +142,8 @@ index 1f2b259920..b0e5db024d 100644 +//! @endcond + //! @} - - + + diff --git a/modules/core/src/matrix_transform.cpp b/modules/core/src/matrix_transform.cpp index 5a80ac8ca7..2e79f0772a 100644 --- a/modules/core/src/matrix_transform.cpp @@ -151,11 +151,11 @@ index 5a80ac8ca7..2e79f0772a 100644 @@ -269,6 +269,8 @@ void transpose( InputArray _src, OutputArray _dst ) return; } - + + CALL_HAL(transpose, cv_hal_transpose, src.data, src.step, dst.data, dst.step, src.cols, src.rows, esz); + CV_IPP_RUN_FAST(ipp_transpose(src, dst)) - + if( dst.data == src.data ) diff --git a/modules/imgproc/src/smooth.dispatch.cpp b/modules/imgproc/src/smooth.dispatch.cpp index 8a521d6df3..186335b121 100644 @@ -164,7 +164,7 @@ index 8a521d6df3..186335b121 100644 @@ -654,6 +654,20 @@ void GaussianBlur(InputArray _src, OutputArray _dst, Size ksize, ocl_GaussianBlur_8UC1(_src, _dst, ksize, CV_MAT_DEPTH(type), kx, ky, borderType) ); - + + { + Mat src = _src.getMat(); + Mat dst = _dst.getMat(); @@ -185,11 +185,11 @@ index 8a521d6df3..186335b121 100644 @@ -742,10 +756,6 @@ void GaussianBlur(InputArray _src, OutputArray _dst, Size ksize, if(!(borderType & BORDER_ISOLATED)) src.locateROI( wsz, ofs ); - + - CALL_HAL(gaussianBlur, cv_hal_gaussianBlur, src.ptr(), src.step, dst.ptr(), dst.step, src.cols, src.rows, sdepth, cn, - ofs.x, ofs.y, wsz.width - src.cols - ofs.x, wsz.height - src.rows - ofs.y, ksize.width, ksize.height, - sigma1, sigma2, borderType&~BORDER_ISOLATED); - CV_OVX_RUN(true, openvx_gaussianBlur(src, dst, ksize, sigma1, sigma2, borderType)) - + diff --git a/adapters/opencv/opencv-5.x.patch b/adapters/opencv/opencv-5.x.patch index 6bbc8a8e9..01e97cc2e 100644 --- a/adapters/opencv/opencv-5.x.patch +++ b/adapters/opencv/opencv-5.x.patch @@ -8,9 +8,9 @@ index 0000000000..c0ffb73ad7 --- /dev/null +++ b/3rdparty/intrinsiccv/CMakeLists.txt @@ -0,0 +1,3 @@ -+set(INTRINSICCV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/intrinsiccv" CACHE PATH "Directory containing IntrinsicCV sources") ++set(KLEIDICV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/intrinsiccv" CACHE PATH "Directory containing IntrinsicCV sources") + -+include("${INTRINSICCV_SOURCE_PATH}/adapters/opencv/CMakeLists.txt") ++include("${KLEIDICV_SOURCE_PATH}/adapters/opencv/CMakeLists.txt") diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a628c1a6a..999df2657d 100644 --- a/CMakeLists.txt @@ -18,17 +18,17 @@ index 4a628c1a6a..999df2657d 100644 @@ -13,6 +13,8 @@ FATAL: In-source builds are not allowed. ") endif() - + +# Useful for HALs if built as a CMake submodule +set(OPENCV_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - + include(cmake/OpenCVMinDepVersions.cmake) - + @@ -259,6 +261,8 @@ OCV_OPTION(WITH_CAP_IOS "Enable iOS video capture" ON VERIFY HAVE_CAP_IOS) OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" (NOT CV_DISABLE_OPTIMIZATION) VISIBLE_IF (ARM OR AARCH64) AND NOT IOS AND NOT XROS) -+OCV_OPTION(WITH_INTRINSICCV "Use IntrinsicCV library for ARM platforms" OFF ++OCV_OPTION(WITH_KLEIDICV "Use IntrinsicCV library for ARM platforms" OFF + VISIBLE_IF (AARCH64)) OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON VISIBLE_IF ANDROID @@ -36,8 +36,8 @@ index 4a628c1a6a..999df2657d 100644 @@ -956,6 +960,13 @@ if(HAVE_OPENVX) endif() endif() - -+if(WITH_INTRINSICCV) + ++if(WITH_KLEIDICV) + ocv_debug_message(STATUS "Enable IntrinsicCV acceleration") + if(NOT ";${OpenCV_HAL};" MATCHES ";intrinsiccv;") + set(OpenCV_HAL "intrinsiccv;${OpenCV_HAL}") @@ -53,8 +53,8 @@ index 4a628c1a6a..999df2657d 100644 endif() + elseif(hal STREQUAL "intrinsiccv") + add_subdirectory(3rdparty/intrinsiccv) -+ ocv_hal_register(INTRINSICCV_HAL_LIBRARIES INTRINSICCV_HAL_HEADERS INTRINSICCV_HAL_INCLUDE_DIRS) -+ list(APPEND OpenCV_USED_HAL "IntrinsicCV (ver ${INTRINSICCV_HAL_VERSION})") ++ ocv_hal_register(KLEIDICV_HAL_LIBRARIES KLEIDICV_HAL_HEADERS KLEIDICV_HAL_INCLUDE_DIRS) ++ list(APPEND OpenCV_USED_HAL "IntrinsicCV (ver ${KLEIDICV_HAL_VERSION})") elseif(hal STREQUAL "openvx") add_subdirectory(3rdparty/openvx) ocv_hal_register(OPENVX_HAL_LIBRARIES OPENVX_HAL_HEADERS OPENVX_HAL_INCLUDE_DIRS) @@ -64,9 +64,9 @@ index 09742ca9ba..209d6aa34a 100644 +++ b/doc/tutorials/introduction/config_reference/config_reference.markdown @@ -621,6 +621,7 @@ Following build options are utilized in `opencv_contrib` modules, as stated [pre `CMAKE_TOOLCHAIN_FILE` - + `WITH_CAROTENE` -+`WITH_INTRINSICCV` ++`WITH_KLEIDICV` `WITH_CPUFEATURES` `WITH_EIGEN` `WITH_OPENVX` @@ -75,14 +75,14 @@ index c7445a4de4..49a459597b 100644 --- a/modules/core/include/opencv2/core/hal/interface.h +++ b/modules/core/include/opencv2/core/hal/interface.h @@ -90,6 +90,8 @@ typedef short cv_hal_bf16; - + #define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1) #define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK) +#define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT) +#define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1) #define CV_IS_INT_TYPE(flags) (((1 << CV_MAT_DEPTH(flags)) & 0x1e1f) != 0) #define CV_IS_FLOAT_TYPE(flags) (((1 << CV_MAT_DEPTH(flags)) & 0x1e0) != 0) - + diff --git a/modules/core/src/convert.dispatch.cpp b/modules/core/src/convert.dispatch.cpp index 7418b696bc..4bf4d863ab 100644 --- a/modules/core/src/convert.dispatch.cpp @@ -90,7 +90,7 @@ index 7418b696bc..4bf4d863ab 100644 @@ -195,6 +195,11 @@ void Mat::convertTo(OutputArray dst, int type_, double alpha, double beta) const dst.create( dims, size, dtype, -1, allowTransposed ); Mat dstMat = dst.getMat(); - + + if( dims <= 2 ) { + int width_in_elements = src.cols * cn; + CALL_HAL(convertTo, cv_hal_convertTo, src.data, src.step, src.depth(), dstMat.data, dstMat.step, dstMat.depth(), width_in_elements, src.rows, alpha, beta); @@ -106,7 +106,7 @@ index 19ac6de746..9c1a821bed 100644 @@ -919,6 +919,35 @@ inline int hal_ni_rotate90(int src_type, const uchar* src_data, size_t src_step, #define cv_hal_rotate90 hal_ni_rotate90 //! @endcond - + +/** + @brief Transpose + @param src_data,src_step Source image @@ -137,8 +137,8 @@ index 19ac6de746..9c1a821bed 100644 +//! @endcond + //! @} - - + + diff --git a/modules/core/src/matrix_transform.cpp b/modules/core/src/matrix_transform.cpp index 5a80ac8ca7..00c19589b8 100644 --- a/modules/core/src/matrix_transform.cpp @@ -148,17 +148,17 @@ index 5a80ac8ca7..00c19589b8 100644 #include "hal_replacement.hpp" #include "opencv2/core/detail/dispatch_helper.impl.hpp" +#include "hal_replacement.hpp" - + #include // std::swap_ranges #include // std::accumulate @@ -269,6 +270,8 @@ void transpose( InputArray _src, OutputArray _dst ) return; } - + + CALL_HAL(transpose, cv_hal_transpose, src.data, src.step, dst.data, dst.step, src.cols, src.rows, esz); + CV_IPP_RUN_FAST(ipp_transpose(src, dst)) - + if( dst.data == src.data ) diff --git a/modules/imgproc/src/smooth.dispatch.cpp b/modules/imgproc/src/smooth.dispatch.cpp index 3ab8501601..8bb2e8d497 100644 @@ -167,7 +167,7 @@ index 3ab8501601..8bb2e8d497 100644 @@ -654,6 +654,20 @@ void GaussianBlur(InputArray _src, OutputArray _dst, Size ksize, ocl_GaussianBlur_8UC1(_src, _dst, ksize, CV_MAT_DEPTH(type), kx, ky, borderType) ); - + + { + Mat src = _src.getMat(); + Mat dst = _dst.getMat(); @@ -188,11 +188,11 @@ index 3ab8501601..8bb2e8d497 100644 @@ -742,10 +756,6 @@ void GaussianBlur(InputArray _src, OutputArray _dst, Size ksize, if(!(borderType & BORDER_ISOLATED)) src.locateROI( wsz, ofs ); - + - CALL_HAL(gaussianBlur, cv_hal_gaussianBlur, src.ptr(), src.step, dst.ptr(), dst.step, src.cols, src.rows, sdepth, cn, - ofs.x, ofs.y, wsz.width - src.cols - ofs.x, wsz.height - src.rows - ofs.y, ksize.width, ksize.height, - sigma1, sigma2, borderType&~BORDER_ISOLATED); - CV_OVX_RUN(true, openvx_gaussianBlur(src, dst, ksize, sigma1, sigma2, borderType)) - + diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 8550be738..f5bac0f23 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -8,9 +8,9 @@ cmake_minimum_required(VERSION 3.16) # rest of the project so disable benchmarks by default. # Another reason to disable it by default is that the configure time # for Google Benchmark is quite noticeable. -option(INTRINSICCV_BENCHMARK "Enable IntrinsicCV benchmarks" OFF) +option(KLEIDICV_BENCHMARK "Enable IntrinsicCV benchmarks" OFF) -if(INTRINSICCV_BENCHMARK) +if(KLEIDICV_BENCHMARK) include(FetchContent) @@ -23,13 +23,13 @@ FetchContent_Declare( FetchContent_MakeAvailable(benchmark) -set(INTRINSICCV_INCLUDE_DIR +set(KLEIDICV_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../intrinsiccv/include ${CMAKE_CURRENT_BINARY_DIR}/../intrinsiccv/include ) -set(INTRINSICCV_BENCHMARK_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(KLEIDICV_BENCHMARK_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(INTRINSICCV_BENCHMARK_CXX_FLAGS +set(KLEIDICV_BENCHMARK_CXX_FLAGS "-Werror" "-Wall" "-Wextra" @@ -37,16 +37,16 @@ set(INTRINSICCV_BENCHMARK_CXX_FLAGS ) if (CMAKE_BUILD_TYPE STREQUAL "Debug") - list(APPEND INTRINSICCV_BENCHMARK_CXX_FLAGS "-O0" "-g") + list(APPEND KLEIDICV_BENCHMARK_CXX_FLAGS "-O0" "-g") else() - list(APPEND INTRINSICCV_BENCHMARK_CXX_FLAGS "-O2" "-g0") + list(APPEND KLEIDICV_BENCHMARK_CXX_FLAGS "-O2" "-g0") endif() file(GLOB intrinsiccv_benchmark_sources CONFIGURE_DEPENDS "*.h" "*.cpp") set_source_files_properties( ${intrinsiccv_benchmark_sources} - PROPERTIES COMPILE_OPTIONS "${INTRINSICCV_BENCHMARK_CXX_FLAGS}" + PROPERTIES COMPILE_OPTIONS "${KLEIDICV_BENCHMARK_CXX_FLAGS}" ) add_executable( @@ -61,8 +61,8 @@ set_target_properties( target_include_directories( intrinsiccv-benchmark - PRIVATE ${INTRINSICCV_INCLUDE_DIR} - PRIVATE ${INTRINSICCV_BENCHMARK_INCLUDE_DIR} + PRIVATE ${KLEIDICV_INCLUDE_DIR} + PRIVATE ${KLEIDICV_BENCHMARK_INCLUDE_DIR} ) target_link_libraries( @@ -71,4 +71,4 @@ target_link_libraries( benchmark::benchmark ) -endif(INTRINSICCV_BENCHMARK) +endif(KLEIDICV_BENCHMARK) diff --git a/conformity/opencv/common.h b/conformity/opencv/common.h index 612b48283..49544581a 100644 --- a/conformity/opencv/common.h +++ b/conformity/opencv/common.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_OPENCV_CONFORMITY_COMMON_H_ -#define INTRINSICCV_OPENCV_CONFORMITY_COMMON_H_ +#ifndef KLEIDICV_OPENCV_CONFORMITY_COMMON_H_ +#define KLEIDICV_OPENCV_CONFORMITY_COMMON_H_ #include #include @@ -21,13 +21,12 @@ #include "opencv2/core.hpp" #include "opencv2/imgproc.hpp" -#define INTRINSICCV_CONFORMITY_SHM_ID \ - "/opencv_intrinisiccv_conformity_check_shm" -#define INTRINSICCV_CONFORMITY_SHM_SIZE (1024 * 1024) +#define KLEIDICV_CONFORMITY_SHM_ID "/opencv_intrinisiccv_conformity_check_shm" +#define KLEIDICV_CONFORMITY_SHM_SIZE (1024 * 1024) -#define INTRINSICCV_CONFORMITY_REQUEST_MQ_ID \ +#define KLEIDICV_CONFORMITY_REQUEST_MQ_ID \ "/opencv_intrinisiccv_conformity_request_queue" -#define INTRINSICCV_CONFORMITY_REPLY_MQ_ID \ +#define KLEIDICV_CONFORMITY_REPLY_MQ_ID \ "/opencv_intrinisiccv_conformity_reply_queue" class ExceptionWithErrno : public std::exception { @@ -273,4 +272,4 @@ class RecreatedMessageQueue : public MessageQueue { : MessageQueue{id, sm} {} }; // end of class RecreatedMessageQueue -#endif // INTRINSICCV_OPENCV_CONFORMITY_COMMON_H_ +#endif // KLEIDICV_OPENCV_CONFORMITY_COMMON_H_ diff --git a/conformity/opencv/manager.cpp b/conformity/opencv/manager.cpp index 116845dd9..99bc18c4c 100644 --- a/conformity/opencv/manager.cpp +++ b/conformity/opencv/manager.cpp @@ -40,10 +40,10 @@ int main(int argc, char** argv) { throw ExceptionWithErrno("Cannot start subordinate executable"); } - RecreatedSharedMemory sm{INTRINSICCV_CONFORMITY_SHM_ID, - INTRINSICCV_CONFORMITY_SHM_SIZE}; - RecreatedMessageQueue request_queue{INTRINSICCV_CONFORMITY_REQUEST_MQ_ID, sm}; - RecreatedMessageQueue reply_queue{INTRINSICCV_CONFORMITY_REPLY_MQ_ID, sm}; + RecreatedSharedMemory sm{KLEIDICV_CONFORMITY_SHM_ID, + KLEIDICV_CONFORMITY_SHM_SIZE}; + RecreatedMessageQueue request_queue{KLEIDICV_CONFORMITY_REQUEST_MQ_ID, sm}; + RecreatedMessageQueue reply_queue{KLEIDICV_CONFORMITY_REPLY_MQ_ID, sm}; // Let subordinate know that init is done kill(child_pid, SIGUSR1); diff --git a/conformity/opencv/subordinate.cpp b/conformity/opencv/subordinate.cpp index 4018c0f79..4291aaa48 100644 --- a/conformity/opencv/subordinate.cpp +++ b/conformity/opencv/subordinate.cpp @@ -8,10 +8,10 @@ #include "tests.h" int main(void) { - OpenedSharedMemory sm{INTRINSICCV_CONFORMITY_SHM_ID, - INTRINSICCV_CONFORMITY_SHM_SIZE}; - OpenedMessageQueue request_queue{INTRINSICCV_CONFORMITY_REQUEST_MQ_ID, sm}; - OpenedMessageQueue reply_queue{INTRINSICCV_CONFORMITY_REPLY_MQ_ID, sm}; + OpenedSharedMemory sm{KLEIDICV_CONFORMITY_SHM_ID, + KLEIDICV_CONFORMITY_SHM_SIZE}; + OpenedMessageQueue request_queue{KLEIDICV_CONFORMITY_REQUEST_MQ_ID, sm}; + OpenedMessageQueue reply_queue{KLEIDICV_CONFORMITY_REPLY_MQ_ID, sm}; wait_for_requests(request_queue, reply_queue); diff --git a/conformity/opencv/test_float_conv.h b/conformity/opencv/test_float_conv.h index ab7a6d8a1..1b98d9820 100644 --- a/conformity/opencv/test_float_conv.h +++ b/conformity/opencv/test_float_conv.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_OPENCV_CONFORMITY_TEST_FLOAT_CONV_H_ -#define INTRINSICCV_OPENCV_CONFORMITY_TEST_FLOAT_CONV_H_ +#ifndef KLEIDICV_OPENCV_CONFORMITY_TEST_FLOAT_CONV_H_ +#define KLEIDICV_OPENCV_CONFORMITY_TEST_FLOAT_CONV_H_ #include @@ -11,4 +11,4 @@ std::vector& float_conversion_tests_singleton(); -#endif // INTRINSICCV_OPENCV_CONFORMITY_TEST_FLOAT_CONV_H_ +#endif // KLEIDICV_OPENCV_CONFORMITY_TEST_FLOAT_CONV_H_ diff --git a/conformity/opencv/test_gaussian_blur.h b/conformity/opencv/test_gaussian_blur.h index 45ee18a6c..0756ca4fd 100644 --- a/conformity/opencv/test_gaussian_blur.h +++ b/conformity/opencv/test_gaussian_blur.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_OPENCV_CONFORMITY_TEST_GAUSSIAN_BLUR_H_ -#define INTRINSICCV_OPENCV_CONFORMITY_TEST_GAUSSIAN_BLUR_H_ +#ifndef KLEIDICV_OPENCV_CONFORMITY_TEST_GAUSSIAN_BLUR_H_ +#define KLEIDICV_OPENCV_CONFORMITY_TEST_GAUSSIAN_BLUR_H_ #include @@ -11,4 +11,4 @@ std::vector& gaussian_blur_tests_singleton(); -#endif // INTRINSICCV_OPENCV_CONFORMITY_TEST_GAUSSIAN_BLUR_H_ +#endif // KLEIDICV_OPENCV_CONFORMITY_TEST_GAUSSIAN_BLUR_H_ diff --git a/conformity/opencv/test_sobel.h b/conformity/opencv/test_sobel.h index 399945c61..6c2bb8b45 100644 --- a/conformity/opencv/test_sobel.h +++ b/conformity/opencv/test_sobel.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_OPENCV_CONFORMITY_TEST_SOBEL_H_ -#define INTRINSICCV_OPENCV_CONFORMITY_TEST_SOBEL_H_ +#ifndef KLEIDICV_OPENCV_CONFORMITY_TEST_SOBEL_H_ +#define KLEIDICV_OPENCV_CONFORMITY_TEST_SOBEL_H_ #include @@ -11,4 +11,4 @@ std::vector& sobel_tests_singleton(); -#endif // INTRINSICCV_OPENCV_CONFORMITY_TEST_SOBEL_H_ +#endif // KLEIDICV_OPENCV_CONFORMITY_TEST_SOBEL_H_ diff --git a/conformity/opencv/tests.h b/conformity/opencv/tests.h index 164ba5c7c..073ee6999 100644 --- a/conformity/opencv/tests.h +++ b/conformity/opencv/tests.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_OPENCV_CONFORMITY_TESTS_H_ -#define INTRINSICCV_OPENCV_CONFORMITY_TESTS_H_ +#ifndef KLEIDICV_OPENCV_CONFORMITY_TESTS_H_ +#define KLEIDICV_OPENCV_CONFORMITY_TESTS_H_ #include #include @@ -63,4 +63,4 @@ using test = std::pair; { name, exec_func } #endif -#endif // INTRINSICCV_OPENCV_CONFORMITY_TESTS_H_ +#endif // KLEIDICV_OPENCV_CONFORMITY_TESTS_H_ diff --git a/intrinsiccv/CMakeLists.txt b/intrinsiccv/CMakeLists.txt index 47fb59603..9e74761ef 100644 --- a/intrinsiccv/CMakeLists.txt +++ b/intrinsiccv/CMakeLists.txt @@ -9,84 +9,84 @@ project("IntrinsicCV") include(CheckCXXCompilerFlag) if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Android)$") - option(INTRINSICCV_ENABLE_SVE2 "Explicitly enables or disables SVE2 code paths for all supported algorithms" OFF) - option(INTRINSICCV_ENABLE_SVE2_SELECTIVELY "Explicitly enables or disables SVE2 code paths for selected algorithms" ON) - option(INTRINSICCV_ENABLE_SME2 "Explicitly enables or disables SME2 code paths for all supported algorithms" ON) + option(KLEIDICV_ENABLE_SVE2 "Explicitly enables or disables SVE2 code paths for all supported algorithms" OFF) + option(KLEIDICV_ENABLE_SVE2_SELECTIVELY "Explicitly enables or disables SVE2 code paths for selected algorithms" ON) + option(KLEIDICV_ENABLE_SME2 "Explicitly enables or disables SME2 code paths for all supported algorithms" ON) else() - set(INTRINSICCV_ENABLE_SVE2 OFF) - set(INTRINSICCV_ENABLE_SVE2_SELECTIVELY OFF) - set(INTRINSICCV_ENABLE_SME2 OFF) + set(KLEIDICV_ENABLE_SVE2 OFF) + set(KLEIDICV_ENABLE_SVE2_SELECTIVELY OFF) + set(KLEIDICV_ENABLE_SME2 OFF) endif() -option(INTRINSICCV_CHECK_BANNED_FUNCTIONS "Check source for deprecated or obsolescent functions" OFF) -option(INTRINSICCV_ASSUME_128BIT_SVE2 "Internal - If turned ON 128-bit SVE2 vector length is assumed" OFF) -option(INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE "Internal - If turned ON interleaving loads and stores are preferred instead of continuous loads and stores" OFF) -option(INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY "Internal - Enable experimental Canny algorithm" OFF) -option(INTRINSICCV_CANNY_ALGORITHM_CONFORM_OPENCV "Internal - If turned ON Canny algorithm creates bit exact result compared to OpenCV's original implementation" ON) - -if (INTRINSICCV_ENABLE_SVE2 AND INTRINSICCV_ENABLE_SVE2_SELECTIVELY) - message(FATAL_ERROR "[IntrinsicCV] INTRINSICCV_ENABLE_SVE2 and INTRINSICCV_ENABLE_SVE2_SELECTIVELY cannot be set at the same time") +option(KLEIDICV_CHECK_BANNED_FUNCTIONS "Check source for deprecated or obsolescent functions" OFF) +option(KLEIDICV_ASSUME_128BIT_SVE2 "Internal - If turned ON 128-bit SVE2 vector length is assumed" OFF) +option(KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE "Internal - If turned ON interleaving loads and stores are preferred instead of continuous loads and stores" OFF) +option(KLEIDICV_EXPERIMENTAL_FEATURE_CANNY "Internal - Enable experimental Canny algorithm" OFF) +option(KLEIDICV_CANNY_ALGORITHM_CONFORM_OPENCV "Internal - If turned ON Canny algorithm creates bit exact result compared to OpenCV's original implementation" ON) + +if (KLEIDICV_ENABLE_SVE2 AND KLEIDICV_ENABLE_SVE2_SELECTIVELY) + message(FATAL_ERROR "[IntrinsicCV] KLEIDICV_ENABLE_SVE2 and KLEIDICV_ENABLE_SVE2_SELECTIVELY cannot be set at the same time") endif() # Compiler feature check for SVE2. -set(INTRINSICCV_BUILD_SVE2 OFF) -if (INTRINSICCV_ENABLE_SVE2 OR INTRINSICCV_ENABLE_SVE2_SELECTIVELY) - check_cxx_compiler_flag("-march=armv8-a+sve2" INTRINSICCV_COMPILER_SUPPORTS_SVE2) - if (INTRINSICCV_COMPILER_SUPPORTS_SVE2) - set(INTRINSICCV_BUILD_SVE2 ON) +set(KLEIDICV_BUILD_SVE2 OFF) +if (KLEIDICV_ENABLE_SVE2 OR KLEIDICV_ENABLE_SVE2_SELECTIVELY) + check_cxx_compiler_flag("-march=armv8-a+sve2" KLEIDICV_COMPILER_SUPPORTS_SVE2) + if (KLEIDICV_COMPILER_SUPPORTS_SVE2) + set(KLEIDICV_BUILD_SVE2 ON) else() message(STATUS "[IntrinsicCV] Compiler does not support SVE2") endif() endif() # Compiler feature check for SME2. -set(INTRINSICCV_BUILD_SME2 OFF) -if (INTRINSICCV_ENABLE_SME2) +set(KLEIDICV_BUILD_SME2 OFF) +if (KLEIDICV_ENABLE_SME2) # Assuming clang if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18) - set(INTRINSICCV_COMPILER_SUPPORTS_SME2 OFF) + set(KLEIDICV_COMPILER_SUPPORTS_SME2 OFF) else() - check_cxx_compiler_flag("-march=armv9-a+sme2" INTRINSICCV_COMPILER_SUPPORTS_SME2) + check_cxx_compiler_flag("-march=armv9-a+sme2" KLEIDICV_COMPILER_SUPPORTS_SME2) endif() - if (INTRINSICCV_COMPILER_SUPPORTS_SME2) - set(INTRINSICCV_BUILD_SME2 ON) + if (KLEIDICV_COMPILER_SUPPORTS_SME2) + set(KLEIDICV_BUILD_SME2 ON) else() message(STATUS "[IntrinsicCV] Compiler does not support SME2") endif() endif() -if(INTRINSICCV_BUILD_SVE2 AND INTRINSICCV_ENABLE_SVE2) - set(INTRINSICCV_ALWAYS_ENABLE_SVE2 ON) +if(KLEIDICV_BUILD_SVE2 AND KLEIDICV_ENABLE_SVE2) + set(KLEIDICV_ALWAYS_ENABLE_SVE2 ON) endif() configure_file("${CMAKE_CURRENT_LIST_DIR}/include/intrinsiccv/config.h.in" "include/intrinsiccv/config.h") -file(GLOB INTRINSICCV_API_SOURCES +file(GLOB KLEIDICV_API_SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/*_api.cpp" "${CMAKE_CURRENT_LIST_DIR}/src/**/*_api.cpp" ) -file(GLOB INTRINSICCV_NEON_SOURCES +file(GLOB KLEIDICV_NEON_SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/*_neon.cpp" "${CMAKE_CURRENT_LIST_DIR}/src/**/*_neon.cpp" ) -file(GLOB INTRINSICCV_SVE2_SOURCES +file(GLOB KLEIDICV_SVE2_SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/*_sve2.cpp" "${CMAKE_CURRENT_LIST_DIR}/src/**/*_sve2.cpp" ) -file(GLOB INTRINSICCV_SME2_SOURCES +file(GLOB KLEIDICV_SME2_SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/*_sme2.cpp" "${CMAKE_CURRENT_LIST_DIR}/src/**/*_sme2.cpp" ) -set(INTRINSICCV_INCLUDE_DIRS +set(KLEIDICV_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" ) -set(INTRINSICCV_WARNING_FLAGS +set(KLEIDICV_WARNING_FLAGS "-Werror" "-Wall" "-Wextra" @@ -94,7 +94,7 @@ set(INTRINSICCV_WARNING_FLAGS "-Wno-shadow" # GCC's shadow declaration check is too sensitive for the library ) -set(INTRINSICCV_CXX_FLAGS +set(KLEIDICV_CXX_FLAGS "-O2" "-g0" "-fomit-frame-pointer" @@ -102,77 +102,77 @@ set(INTRINSICCV_CXX_FLAGS "-fno-exceptions" "-fno-rtti" "-fno-unroll-loops" - ${INTRINSICCV_WARNING_FLAGS} + ${KLEIDICV_WARNING_FLAGS} ) if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") - list(APPEND INTRINSICCV_CXX_FLAGS + list(APPEND KLEIDICV_CXX_FLAGS "-mllvm" "-inline-threshold=10000" ) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - list(APPEND INTRINSICCV_CXX_FLAGS + list(APPEND KLEIDICV_CXX_FLAGS "-flax-vector-conversions" "-Wno-unused-label" ) endif() -if (INTRINSICCV_CHECK_BANNED_FUNCTIONS) +if (KLEIDICV_CHECK_BANNED_FUNCTIONS) # The `SHELL:` prefix is used to turn off de-duplication of compiler flags, # it is necessary if other headers are need to be force included. # https://cmake.org/cmake/help/latest/command/target_compile_options.html#option-de-duplication - list(APPEND INTRINSICCV_CXX_FLAGS "SHELL:-include intrinsiccv/unsafe.h") + list(APPEND KLEIDICV_CXX_FLAGS "SHELL:-include intrinsiccv/unsafe.h") endif() if (CMAKE_BUILD_TYPE STREQUAL "Debug") - list(APPEND INTRINSICCV_CXX_FLAGS "-O0" "-g") + list(APPEND KLEIDICV_CXX_FLAGS "-O0" "-g") else() - list(APPEND INTRINSICCV_CXX_FLAGS "-O2" "-g0") + list(APPEND KLEIDICV_CXX_FLAGS "-O2" "-g0") endif() -add_library(intrinsiccv_neon OBJECT ${INTRINSICCV_NEON_SOURCES}) -target_include_directories(intrinsiccv_neon PRIVATE ${INTRINSICCV_INCLUDE_DIRS}) +add_library(intrinsiccv_neon OBJECT ${KLEIDICV_NEON_SOURCES}) +target_include_directories(intrinsiccv_neon PRIVATE ${KLEIDICV_INCLUDE_DIRS}) set_target_properties(intrinsiccv_neon PROPERTIES CXX_STANDARD 17) target_compile_options(intrinsiccv_neon PRIVATE - ${INTRINSICCV_CXX_FLAGS} + ${KLEIDICV_CXX_FLAGS} "-march=armv8-a" - "-DINTRINSICCV_TARGET_NEON=1" + "-DKLEIDICV_TARGET_NEON=1" ) -if(INTRINSICCV_BUILD_SVE2) - add_library(intrinsiccv_sve2 OBJECT ${INTRINSICCV_SVE2_SOURCES}) - target_include_directories(intrinsiccv_sve2 PRIVATE ${INTRINSICCV_INCLUDE_DIRS}) +if(KLEIDICV_BUILD_SVE2) + add_library(intrinsiccv_sve2 OBJECT ${KLEIDICV_SVE2_SOURCES}) + target_include_directories(intrinsiccv_sve2 PRIVATE ${KLEIDICV_INCLUDE_DIRS}) set_target_properties(intrinsiccv_sve2 PROPERTIES CXX_STANDARD 17) target_compile_options(intrinsiccv_sve2 PRIVATE - ${INTRINSICCV_CXX_FLAGS} + ${KLEIDICV_CXX_FLAGS} "-march=armv8-a+sve2" - "-DINTRINSICCV_TARGET_SVE2=1" + "-DKLEIDICV_TARGET_SVE2=1" ) endif() -if(INTRINSICCV_BUILD_SME2) - add_library(intrinsiccv_sme2 OBJECT ${INTRINSICCV_SME2_SOURCES}) - target_include_directories(intrinsiccv_sme2 PRIVATE ${INTRINSICCV_INCLUDE_DIRS}) +if(KLEIDICV_BUILD_SME2) + add_library(intrinsiccv_sme2 OBJECT ${KLEIDICV_SME2_SOURCES}) + target_include_directories(intrinsiccv_sme2 PRIVATE ${KLEIDICV_INCLUDE_DIRS}) set_target_properties(intrinsiccv_sme2 PROPERTIES CXX_STANDARD 17) target_compile_options(intrinsiccv_sme2 PRIVATE - ${INTRINSICCV_CXX_FLAGS} + ${KLEIDICV_CXX_FLAGS} "-march=armv9-a+sve2+sme2" - "-DINTRINSICCV_TARGET_SME2=1" + "-DKLEIDICV_TARGET_SME2=1" ) endif() -add_library(intrinsiccv STATIC ${INTRINSICCV_API_SOURCES}) -target_include_directories(intrinsiccv PRIVATE ${INTRINSICCV_INCLUDE_DIRS}) +add_library(intrinsiccv STATIC ${KLEIDICV_API_SOURCES}) +target_include_directories(intrinsiccv PRIVATE ${KLEIDICV_INCLUDE_DIRS}) set_target_properties(intrinsiccv PROPERTIES CXX_STANDARD 17) -target_compile_options(intrinsiccv PRIVATE ${INTRINSICCV_CXX_FLAGS}) +target_compile_options(intrinsiccv PRIVATE ${KLEIDICV_CXX_FLAGS}) target_link_libraries(intrinsiccv PRIVATE intrinsiccv_neon) -if(INTRINSICCV_BUILD_SVE2) - target_compile_definitions(intrinsiccv PRIVATE INTRINSICCV_HAVE_SVE2) +if(KLEIDICV_BUILD_SVE2) + target_compile_definitions(intrinsiccv PRIVATE KLEIDICV_HAVE_SVE2) target_link_libraries(intrinsiccv PRIVATE intrinsiccv_sve2) endif() -if(INTRINSICCV_BUILD_SME2) - target_compile_definitions(intrinsiccv PRIVATE INTRINSICCV_HAVE_SME2) +if(KLEIDICV_BUILD_SME2) + target_compile_definitions(intrinsiccv PRIVATE KLEIDICV_HAVE_SME2) target_link_libraries(intrinsiccv PRIVATE intrinsiccv_sme2) endif() diff --git a/intrinsiccv/include/intrinsiccv/arithmetics/transpose.h b/intrinsiccv/include/intrinsiccv/arithmetics/transpose.h index 8b3d2b135..846350f0a 100644 --- a/intrinsiccv/include/intrinsiccv/arithmetics/transpose.h +++ b/intrinsiccv/include/intrinsiccv/arithmetics/transpose.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_ARITHMETICS_TRANSPOSE_H -#define INTRINSICCV_ARITHMETICS_TRANSPOSE_H +#ifndef KLEIDICV_ARITHMETICS_TRANSPOSE_H +#define KLEIDICV_ARITHMETICS_TRANSPOSE_H #include #include @@ -24,4 +24,4 @@ namespace sme2 {} // namespace sme2 } // namespace intrinsiccv -#endif // INTRINSICCV_ARITHMETICS_TRANSPOSE_H +#endif // KLEIDICV_ARITHMETICS_TRANSPOSE_H diff --git a/intrinsiccv/include/intrinsiccv/config.h.in b/intrinsiccv/include/intrinsiccv/config.h.in index 068c88b66..743b20262 100644 --- a/intrinsiccv/include/intrinsiccv/config.h.in +++ b/intrinsiccv/include/intrinsiccv/config.h.in @@ -2,92 +2,92 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_CONFIG_H -#define INTRINSICCV_CONFIG_H +#ifndef KLEIDICV_CONFIG_H +#define KLEIDICV_CONFIG_H // Main configuration switches. -#cmakedefine01 INTRINSICCV_ALWAYS_ENABLE_SVE2 +#cmakedefine01 KLEIDICV_ALWAYS_ENABLE_SVE2 -#cmakedefine01 INTRINSICCV_ASSUME_128BIT_SVE2 +#cmakedefine01 KLEIDICV_ASSUME_128BIT_SVE2 -#cmakedefine01 INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#cmakedefine01 KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE -#cmakedefine01 INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#cmakedefine01 KLEIDICV_EXPERIMENTAL_FEATURE_CANNY -#cmakedefine01 INTRINSICCV_CANNY_ALGORITHM_CONFORM_OPENCV +#cmakedefine01 KLEIDICV_CANNY_ALGORITHM_CONFORM_OPENCV -#cmakedefine01 INTRINSICCV_COMPILER_SUPPORTS_SME2 +#cmakedefine01 KLEIDICV_COMPILER_SUPPORTS_SME2 // Set to '1' if compiling NEON code paths, otherwise it is set to '0'. -#ifndef INTRINSICCV_TARGET_NEON -#define INTRINSICCV_TARGET_NEON 0 +#ifndef KLEIDICV_TARGET_NEON +#define KLEIDICV_TARGET_NEON 0 #endif // Set to '1' if compiling SVE2 code paths, otherwise it is set to '0'. -#ifndef INTRINSICCV_TARGET_SVE2 -#define INTRINSICCV_TARGET_SVE2 0 +#ifndef KLEIDICV_TARGET_SVE2 +#define KLEIDICV_TARGET_SVE2 0 #endif // Set to '1' if compiling SME2 code paths, otherwise it is set to '0'. -#ifndef INTRINSICCV_TARGET_SME2 -#define INTRINSICCV_TARGET_SME2 0 +#ifndef KLEIDICV_TARGET_SME2 +#define KLEIDICV_TARGET_SME2 0 #endif // Derived configuration switches and macros below. -#define INTRINSICCV_TARGET_NAMESPACE intrinsiccv +#define KLEIDICV_TARGET_NAMESPACE intrinsiccv -#if INTRINSICCV_TARGET_NEON -#define INTRINSICCV_TARGET_FN_ATTRS INTRINSICCV_ATTR_SECTION(".text.neon") -#undef INTRINSICCV_TARGET_NAMESPACE -#define INTRINSICCV_TARGET_NAMESPACE intrinsiccv::neon +#if KLEIDICV_TARGET_NEON +#define KLEIDICV_TARGET_FN_ATTRS KLEIDICV_ATTR_SECTION(".text.neon") +#undef KLEIDICV_TARGET_NAMESPACE +#define KLEIDICV_TARGET_NAMESPACE intrinsiccv::neon #endif -#if INTRINSICCV_TARGET_SVE2 -#define INTRINSICCV_TARGET_FN_ATTRS INTRINSICCV_ATTR_SECTION(".text.sve2") -#undef INTRINSICCV_TARGET_NAMESPACE -#define INTRINSICCV_TARGET_NAMESPACE intrinsiccv::sve2 +#if KLEIDICV_TARGET_SVE2 +#define KLEIDICV_TARGET_FN_ATTRS KLEIDICV_ATTR_SECTION(".text.sve2") +#undef KLEIDICV_TARGET_NAMESPACE +#define KLEIDICV_TARGET_NAMESPACE intrinsiccv::sve2 #endif -#if INTRINSICCV_TARGET_SME2 -#undef INTRINSICCV_ASSUME_128BIT_SVE2 -#define INTRINSICCV_ASSUME_128BIT_SVE2 0 -#define INTRINSICCV_TARGET_FN_ATTRS INTRINSICCV_ATTR_SECTION(".text.sme2") -#undef INTRINSICCV_TARGET_NAMESPACE -#define INTRINSICCV_TARGET_NAMESPACE intrinsiccv::sme2 -#define INTRINSICCV_LOCALLY_STREAMING __arm_locally_streaming -#define INTRINSICCV_STREAMING_COMPATIBLE __arm_streaming_compatible +#if KLEIDICV_TARGET_SME2 +#undef KLEIDICV_ASSUME_128BIT_SVE2 +#define KLEIDICV_ASSUME_128BIT_SVE2 0 +#define KLEIDICV_TARGET_FN_ATTRS KLEIDICV_ATTR_SECTION(".text.sme2") +#undef KLEIDICV_TARGET_NAMESPACE +#define KLEIDICV_TARGET_NAMESPACE intrinsiccv::sme2 +#define KLEIDICV_LOCALLY_STREAMING __arm_locally_streaming +#define KLEIDICV_STREAMING_COMPATIBLE __arm_streaming_compatible #else -#define INTRINSICCV_LOCALLY_STREAMING -#define INTRINSICCV_STREAMING_COMPATIBLE +#define KLEIDICV_LOCALLY_STREAMING +#define KLEIDICV_STREAMING_COMPATIBLE #endif #ifdef __linux__ -#define INTRINSICCV_ATTR_SECTION(section_to_use) \ +#define KLEIDICV_ATTR_SECTION(section_to_use) \ __attribute__((section(section_to_use))) #else -#define INTRINSICCV_ATTR_SECTION(x) +#define KLEIDICV_ATTR_SECTION(x) #endif -#define INTRINSICCV_ATTR_NOINLINE __attribute__((noinline)) -#define INTRINSICCV_ATTR_ALIGNED(alignment) __attribute__((aligned(alignment))) +#define KLEIDICV_ATTR_NOINLINE __attribute__((noinline)) +#define KLEIDICV_ATTR_ALIGNED(alignment) __attribute__((aligned(alignment))) -#define INTRINSICCV_LIKELY(cond) __builtin_expect((cond), 1) -#define INTRINSICCV_UNLIKELY(cond) __builtin_expect((cond), 0) +#define KLEIDICV_LIKELY(cond) __builtin_expect((cond), 1) +#define KLEIDICV_UNLIKELY(cond) __builtin_expect((cond), 0) #ifdef __clang__ -#define INTRINSICCV_FORCE_LOOP_UNROLL _Pragma("clang loop unroll(full)") +#define KLEIDICV_FORCE_LOOP_UNROLL _Pragma("clang loop unroll(full)") #else // GCC doesn't have clang's unroll(full). 16 is typically plenty. -#define INTRINSICCV_FORCE_LOOP_UNROLL _Pragma("GCC unroll 16") +#define KLEIDICV_FORCE_LOOP_UNROLL _Pragma("GCC unroll 16") #endif #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \ (defined(__cplusplus) && __cplusplus >= 201703L) -#define INTRINSICCV_NODISCARD [[nodiscard]] +#define KLEIDICV_NODISCARD [[nodiscard]] #else -#define INTRINSICCV_NODISCARD +#define KLEIDICV_NODISCARD #endif -#endif // INTRINSICCV_CONFIG_H +#endif // KLEIDICV_CONFIG_H diff --git a/intrinsiccv/include/intrinsiccv/containers/stack.h b/intrinsiccv/include/intrinsiccv/containers/stack.h index 60d0ebbed..39b696b7d 100644 --- a/intrinsiccv/include/intrinsiccv/containers/stack.h +++ b/intrinsiccv/include/intrinsiccv/containers/stack.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_CONTAINERS_STACK_H -#define INTRINSICCV_CONTAINERS_STACK_H +#ifndef KLEIDICV_CONTAINERS_STACK_H +#define KLEIDICV_CONTAINERS_STACK_H #include #include @@ -13,7 +13,7 @@ #include "intrinsiccv/traits.h" #include "intrinsiccv/utils.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { // A simple last-in first-out container. template @@ -108,7 +108,7 @@ class Stack final : public NonCopyable { // Allocates and initializes a new block. [[nodiscard]] static Block *make_block(Block *prev) noexcept { uint8_t *block_data = new (std::nothrow) uint8_t[kBlockGranule]; - if (INTRINSICCV_UNLIKELY(!block_data)) { + if (KLEIDICV_UNLIKELY(!block_data)) { __builtin_trap(); } @@ -171,6 +171,6 @@ class Stack final : public NonCopyable { Block *first_block_; }; // end of class Stack -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_CONTAINERS_STACK_H +#endif // KLEIDICV_CONTAINERS_STACK_H diff --git a/intrinsiccv/include/intrinsiccv/conversions/gray_to_rgb.h b/intrinsiccv/include/intrinsiccv/conversions/gray_to_rgb.h index 38293be88..a9644c05d 100644 --- a/intrinsiccv/include/intrinsiccv/conversions/gray_to_rgb.h +++ b/intrinsiccv/include/intrinsiccv/conversions/gray_to_rgb.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_CONVERSIONS_GRAY_TO_RGB_H -#define INTRINSICCV_CONVERSIONS_GRAY_TO_RGB_H +#ifndef KLEIDICV_CONVERSIONS_GRAY_TO_RGB_H +#define KLEIDICV_CONVERSIONS_GRAY_TO_RGB_H #include "intrinsiccv/intrinsiccv.h" @@ -47,4 +47,4 @@ intrinsiccv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, } // namespace intrinsiccv -#endif // INTRINSICCV_CONVERSIONS_GRAY_TO_RGB_H +#endif // KLEIDICV_CONVERSIONS_GRAY_TO_RGB_H diff --git a/intrinsiccv/include/intrinsiccv/conversions/merge.h b/intrinsiccv/include/intrinsiccv/conversions/merge.h index 6c46dfab9..26729df5f 100644 --- a/intrinsiccv/include/intrinsiccv/conversions/merge.h +++ b/intrinsiccv/include/intrinsiccv/conversions/merge.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_CONVERSIONS_MERGE_H -#define INTRINSICCV_CONVERSIONS_MERGE_H +#ifndef KLEIDICV_CONVERSIONS_MERGE_H +#define KLEIDICV_CONVERSIONS_MERGE_H #include "intrinsiccv/intrinsiccv.h" @@ -19,4 +19,4 @@ intrinsiccv_error_t merge(const void **srcs, const size_t *src_strides, } // namespace intrinsiccv -#endif // INTRINSICCV_CONVERSIONS_MERGE_H +#endif // KLEIDICV_CONVERSIONS_MERGE_H diff --git a/intrinsiccv/include/intrinsiccv/conversions/rgb_to_rgb.h b/intrinsiccv/include/intrinsiccv/conversions/rgb_to_rgb.h index 4930a6d61..b06387800 100644 --- a/intrinsiccv/include/intrinsiccv/conversions/rgb_to_rgb.h +++ b/intrinsiccv/include/intrinsiccv/conversions/rgb_to_rgb.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_CONVERSIONS_RGB_TO_RGB_H -#define INTRINSICCV_CONVERSIONS_RGB_TO_RGB_H +#ifndef KLEIDICV_CONVERSIONS_RGB_TO_RGB_H +#define KLEIDICV_CONVERSIONS_RGB_TO_RGB_H #include "intrinsiccv/intrinsiccv.h" @@ -85,4 +85,4 @@ intrinsiccv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, } // namespace intrinsiccv -#endif // INTRINSICCV_CONVERSIONS_RGB_TO_RGB_H +#endif // KLEIDICV_CONVERSIONS_RGB_TO_RGB_H diff --git a/intrinsiccv/include/intrinsiccv/conversions/split.h b/intrinsiccv/include/intrinsiccv/conversions/split.h index 16f5761e5..bbff67777 100644 --- a/intrinsiccv/include/intrinsiccv/conversions/split.h +++ b/intrinsiccv/include/intrinsiccv/conversions/split.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_CONVERSIONS_SPLIT_H -#define INTRINSICCV_CONVERSIONS_SPLIT_H +#ifndef KLEIDICV_CONVERSIONS_SPLIT_H +#define KLEIDICV_CONVERSIONS_SPLIT_H #include @@ -22,4 +22,4 @@ intrinsiccv_error_t split(const void *src_data, size_t src_stride, } // namespace intrinsiccv -#endif // INTRINSICCV_CONVERSIONS_SPLIT_H +#endif // KLEIDICV_CONVERSIONS_SPLIT_H diff --git a/intrinsiccv/include/intrinsiccv/conversions/yuv_to_rgb.h b/intrinsiccv/include/intrinsiccv/conversions/yuv_to_rgb.h index 935bd9ee0..89e311859 100644 --- a/intrinsiccv/include/intrinsiccv/conversions/yuv_to_rgb.h +++ b/intrinsiccv/include/intrinsiccv/conversions/yuv_to_rgb.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_CONVERSIONS_YUV_TO_RGB_H -#define INTRINSICCV_CONVERSIONS_YUV_TO_RGB_H +#ifndef KLEIDICV_CONVERSIONS_YUV_TO_RGB_H +#define KLEIDICV_CONVERSIONS_YUV_TO_RGB_H #include "intrinsiccv/intrinsiccv.h" @@ -166,4 +166,4 @@ intrinsiccv_error_t yuv_sp_to_bgra_u8(const uint8_t *src_y, size_t src_y_stride, } // namespace intrinsiccv -#endif // INTRINSICCV_CONVERSIONS_YUV_TO_RGB_H +#endif // KLEIDICV_CONVERSIONS_YUV_TO_RGB_H diff --git a/intrinsiccv/include/intrinsiccv/ctypes.h b/intrinsiccv/include/intrinsiccv/ctypes.h index 22be39c1a..339b9cd1c 100644 --- a/intrinsiccv/include/intrinsiccv/ctypes.h +++ b/intrinsiccv/include/intrinsiccv/ctypes.h @@ -5,8 +5,8 @@ /// @file ctypes.h /// @brief Helper type definitions -#ifndef INTRINSICCV_CTYPES_H -#define INTRINSICCV_CTYPES_H +#ifndef KLEIDICV_CTYPES_H +#define KLEIDICV_CTYPES_H #ifdef __cplusplus #include @@ -19,22 +19,22 @@ #include "intrinsiccv/config.h" /// Error values reported by IntrinsicCV -typedef enum INTRINSICCV_NODISCARD { +typedef enum KLEIDICV_NODISCARD { /// Success. - INTRINSICCV_OK = 0, + KLEIDICV_OK = 0, /// Requested operation is not implemented. - INTRINSICCV_ERROR_NOT_IMPLEMENTED, + KLEIDICV_ERROR_NOT_IMPLEMENTED, /// Null pointer was passed as an argument. - INTRINSICCV_ERROR_NULL_POINTER, + KLEIDICV_ERROR_NULL_POINTER, /// A value was encountered outside the representable or valid range. - INTRINSICCV_ERROR_RANGE, + KLEIDICV_ERROR_RANGE, /// Could not allocate memory. - INTRINSICCV_ERROR_ALLOCATION, + KLEIDICV_ERROR_ALLOCATION, /// A value did not meet alignment requirements. - INTRINSICCV_ERROR_ALIGNMENT, + KLEIDICV_ERROR_ALIGNMENT, /// The provided context (like @ref intrinsiccv_morphology_context_t) is not /// compatible with the operation. - INTRINSICCV_ERROR_CONTEXT_MISMATCH, + KLEIDICV_ERROR_CONTEXT_MISMATCH, } intrinsiccv_error_t; /// Struct to represent a point @@ -68,23 +68,23 @@ typedef struct { /// IntrinsicCV border types typedef enum { /// The border is a constant value. - INTRINSICCV_BORDER_TYPE_CONSTANT, + KLEIDICV_BORDER_TYPE_CONSTANT, /// The border is the value of the first/last element. - INTRINSICCV_BORDER_TYPE_REPLICATE, + KLEIDICV_BORDER_TYPE_REPLICATE, /// The border is the mirrored value of the first/last elements. - INTRINSICCV_BORDER_TYPE_REFLECT, + KLEIDICV_BORDER_TYPE_REFLECT, /// The border simply acts as a "wrap around" to the beginning/end. - INTRINSICCV_BORDER_TYPE_WRAP, - /// Like INTRINSICCV_BORDER_TYPE_REFLECT, but the first/last elements are + KLEIDICV_BORDER_TYPE_WRAP, + /// Like KLEIDICV_BORDER_TYPE_REFLECT, but the first/last elements are /// ignored. - INTRINSICCV_BORDER_TYPE_REVERSE, + KLEIDICV_BORDER_TYPE_REVERSE, /// The border is the "continuation" of the input rows. It is the caller's /// responsibility to provide the input data (and an appropriate stride value) /// in a way that the rows can be under and over read. E.g. can be used when /// executing an operation on a region of a picture. - INTRINSICCV_BORDER_TYPE_TRANSPARENT, + KLEIDICV_BORDER_TYPE_TRANSPARENT, /// The border is a hard border, there are no additional values to use. - INTRINSICCV_BORDER_TYPE_NONE, + KLEIDICV_BORDER_TYPE_NONE, } intrinsiccv_border_type_t; /// Internal structure where morphology operations store their state @@ -94,4 +94,4 @@ typedef struct intrinsiccv_morphology_context_t_ /// Internal structure where filter operations store their state typedef struct intrinsiccv_filter_context_t_ intrinsiccv_filter_context_t; -#endif // INTRINSICCV_CTYPES_H +#endif // KLEIDICV_CTYPES_H diff --git a/intrinsiccv/include/intrinsiccv/debug.h b/intrinsiccv/include/intrinsiccv/debug.h index e3994aa07..bdb2cdc26 100644 --- a/intrinsiccv/include/intrinsiccv/debug.h +++ b/intrinsiccv/include/intrinsiccv/debug.h @@ -2,20 +2,20 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_DEBUG_H -#define INTRINSICCV_DEBUG_H +#ifndef KLEIDICV_DEBUG_H +#define KLEIDICV_DEBUG_H #include "intrinsiccv/config.h" -#if INTRINSICCV_TARGET_NEON +#if KLEIDICV_TARGET_NEON #include "intrinsiccv/neon.h" -#elif INTRINSICCV_TARGET_SVE2 +#elif KLEIDICV_TARGET_SVE2 #include "intrinsiccv/sve2.h" #endif #include namespace intrinsiccv { -#if INTRINSICCV_TARGET_NEON +#if KLEIDICV_TARGET_NEON namespace neon { @@ -39,9 +39,9 @@ template } // namespace neon -#endif // INTRINSICCV_TARGET_NEON +#endif // KLEIDICV_TARGET_NEON -#if INTRINSICCV_TARGET_SVE2 +#if KLEIDICV_TARGET_SVE2 namespace sve2 { @@ -65,8 +65,8 @@ template } // namespace sve2 -#endif // INTRINSICCV_TARGET_SVE2 +#endif // KLEIDICV_TARGET_SVE2 } // namespace intrinsiccv -#endif // INTRINSICCV_DEBUG_H +#endif // KLEIDICV_DEBUG_H diff --git a/intrinsiccv/include/intrinsiccv/dispatch.h b/intrinsiccv/include/intrinsiccv/dispatch.h index c85b14198..cee3eb673 100644 --- a/intrinsiccv/include/intrinsiccv/dispatch.h +++ b/intrinsiccv/include/intrinsiccv/dispatch.h @@ -2,17 +2,17 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_DISPATCH_H -#define INTRINSICCV_DISPATCH_H +#ifndef KLEIDICV_DISPATCH_H +#define KLEIDICV_DISPATCH_H #include "intrinsiccv/config.h" -#if INTRINSICCV_HAVE_SVE2 || INTRINSICCV_HAVE_SME2 +#if KLEIDICV_HAVE_SVE2 || KLEIDICV_HAVE_SME2 #include #include -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { using HwCapTy = uint64_t; @@ -25,21 +25,21 @@ static inline HwCaps get_hwcaps() { return HwCaps{getauxval(AT_HWCAP), getauxval(AT_HWCAP2)}; } -#ifdef INTRINSICCV_HAVE_SVE2 +#ifdef KLEIDICV_HAVE_SVE2 static inline bool hwcaps_has_sve2(HwCaps hwcaps) { return hwcaps.hwcap2 & (1 << 1); } -#define INTRINSICCV_SVE2_RESOLVE(sve2_impl) \ - if (!std::is_null_pointer_v && \ - INTRINSICCV_TARGET_NAMESPACE::hwcaps_has_sve2(hwcaps)) { \ - return sve2_impl; \ +#define KLEIDICV_SVE2_RESOLVE(sve2_impl) \ + if (!std::is_null_pointer_v && \ + KLEIDICV_TARGET_NAMESPACE::hwcaps_has_sve2(hwcaps)) { \ + return sve2_impl; \ } #else -#define INTRINSICCV_SVE2_RESOLVE(x) -#endif // INTRINSICCV_HAVE_SVE2 +#define KLEIDICV_SVE2_RESOLVE(x) +#endif // KLEIDICV_HAVE_SVE2 -#ifdef INTRINSICCV_HAVE_SME2 +#ifdef KLEIDICV_HAVE_SME2 static inline bool hwcaps_has_sme2(HwCaps hwcaps) { // Actually checks for SME, not SME2, but this will be changed to check for // SME2 in future. @@ -47,45 +47,43 @@ static inline bool hwcaps_has_sme2(HwCaps hwcaps) { return hwcaps.hwcap2 & (1UL << kSMEBit); } -#define INTRINSICCV_SME2_RESOLVE(sme2_impl) \ - if (!std::is_null_pointer_v && \ - INTRINSICCV_TARGET_NAMESPACE::hwcaps_has_sme2(hwcaps)) { \ - return sme2_impl; \ +#define KLEIDICV_SME2_RESOLVE(sme2_impl) \ + if (!std::is_null_pointer_v && \ + KLEIDICV_TARGET_NAMESPACE::hwcaps_has_sme2(hwcaps)) { \ + return sme2_impl; \ } #else -#define INTRINSICCV_SME2_RESOLVE(x) -#endif // INTRINSICCV_HAVE_SME2 - -} // namespace INTRINSICCV_TARGET_NAMESPACE - -#define INTRINSICCV_MULTIVERSION_C_API(api_name, neon_impl, sve2_impl, \ - sme2_impl) \ - static decltype(neon_impl) api_name##_resolver() { \ - [[maybe_unused]] INTRINSICCV_TARGET_NAMESPACE::HwCaps hwcaps = \ - INTRINSICCV_TARGET_NAMESPACE::get_hwcaps(); \ - INTRINSICCV_SME2_RESOLVE(sme2_impl); \ - INTRINSICCV_SVE2_RESOLVE(sve2_impl); \ - return neon_impl; \ - } \ - extern "C" { \ - decltype(neon_impl) api_name = api_name##_resolver(); \ +#define KLEIDICV_SME2_RESOLVE(x) +#endif // KLEIDICV_HAVE_SME2 + +} // namespace KLEIDICV_TARGET_NAMESPACE + +#define KLEIDICV_MULTIVERSION_C_API(api_name, neon_impl, sve2_impl, sme2_impl) \ + static decltype(neon_impl) api_name##_resolver() { \ + [[maybe_unused]] KLEIDICV_TARGET_NAMESPACE::HwCaps hwcaps = \ + KLEIDICV_TARGET_NAMESPACE::get_hwcaps(); \ + KLEIDICV_SME2_RESOLVE(sme2_impl); \ + KLEIDICV_SVE2_RESOLVE(sve2_impl); \ + return neon_impl; \ + } \ + extern "C" { \ + decltype(neon_impl) api_name = api_name##_resolver(); \ } -#else // INTRINSICCV_HAVE_SVE2 || INTRINSICCV_HAVE_SME2 +#else // KLEIDICV_HAVE_SVE2 || KLEIDICV_HAVE_SME2 -#define INTRINSICCV_MULTIVERSION_C_API(api_name, neon_impl, sve2_impl, \ - sme2_impl) \ - \ - extern "C" { \ - decltype(neon_impl) api_name = neon_impl; \ +#define KLEIDICV_MULTIVERSION_C_API(api_name, neon_impl, sve2_impl, sme2_impl) \ + \ + extern "C" { \ + decltype(neon_impl) api_name = neon_impl; \ } -#endif // INTRINSICCV_HAVE_SVE2 || INTRINSICCV_HAVE_SME2 +#endif // KLEIDICV_HAVE_SVE2 || KLEIDICV_HAVE_SME2 -#if INTRINSICCV_ALWAYS_ENABLE_SVE2 -#define INTRINSICCV_SVE2_IMPL_IF(func) func +#if KLEIDICV_ALWAYS_ENABLE_SVE2 +#define KLEIDICV_SVE2_IMPL_IF(func) func #else -#define INTRINSICCV_SVE2_IMPL_IF(func) nullptr -#endif // INTRINSICCV_ALWAYS_ENABLE_SVE2 +#define KLEIDICV_SVE2_IMPL_IF(func) nullptr +#endif // KLEIDICV_ALWAYS_ENABLE_SVE2 -#endif // INTRINSICCV_DISPATCH_H +#endif // KLEIDICV_DISPATCH_H diff --git a/intrinsiccv/include/intrinsiccv/filters/gaussian_blur.h b/intrinsiccv/include/intrinsiccv/filters/gaussian_blur.h index a459fe91c..4a3840639 100644 --- a/intrinsiccv/include/intrinsiccv/filters/gaussian_blur.h +++ b/intrinsiccv/include/intrinsiccv/filters/gaussian_blur.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_FILTERS_GAUSSIAN_BLUR_H -#define INTRINSICCV_FILTERS_GAUSSIAN_BLUR_H +#ifndef KLEIDICV_FILTERS_GAUSSIAN_BLUR_H +#define KLEIDICV_FILTERS_GAUSSIAN_BLUR_H #include "intrinsiccv/config.h" #include "intrinsiccv/types.h" @@ -52,4 +52,4 @@ intrinsiccv_error_t gaussian_blur_5x5_u8(const uint8_t *src, size_t src_stride, } // namespace intrinsiccv -#endif // INTRINSICCV_FILTERS_GAUSSIAN_BLUR_H +#endif // KLEIDICV_FILTERS_GAUSSIAN_BLUR_H diff --git a/intrinsiccv/include/intrinsiccv/filters/sobel.h b/intrinsiccv/include/intrinsiccv/filters/sobel.h index 238679aa3..73d8e06aa 100644 --- a/intrinsiccv/include/intrinsiccv/filters/sobel.h +++ b/intrinsiccv/include/intrinsiccv/filters/sobel.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_FILTERS_SOBEL_H -#define INTRINSICCV_FILTERS_SOBEL_H +#ifndef KLEIDICV_FILTERS_SOBEL_H +#define KLEIDICV_FILTERS_SOBEL_H #include "intrinsiccv/intrinsiccv.h" @@ -44,4 +44,4 @@ intrinsiccv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, } // namespace intrinsiccv -#endif // INTRINSICCV_FILTERS_SOBEL_H +#endif // KLEIDICV_FILTERS_SOBEL_H diff --git a/intrinsiccv/include/intrinsiccv/intrinsiccv.h b/intrinsiccv/include/intrinsiccv/intrinsiccv.h index bc8a02fd6..65be4498c 100644 --- a/intrinsiccv/include/intrinsiccv/intrinsiccv.h +++ b/intrinsiccv/include/intrinsiccv/intrinsiccv.h @@ -20,8 +20,8 @@ /// @brief For an overview of the functions and their supported types see /// @ref intrinsiccv/src/supported-types.md. -#ifndef INTRINSICCV_H -#define INTRINSICCV_H +#ifndef KLEIDICV_H +#define KLEIDICV_H #include "intrinsiccv/config.h" #include "intrinsiccv/ctypes.h" @@ -35,38 +35,37 @@ /// /// In case of AArch64 it is limited to (almost) 256 terapixels. This way 16 bit /// is left for any arithmetic operations around image size or width or height. -#define INTRINSICCV_MAX_IMAGE_PIXELS ((1ULL << 48) - 1) +#define KLEIDICV_MAX_IMAGE_PIXELS ((1ULL << 48) - 1) #endif /// Size in bytes of the largest possible element type -#define INTRINSICCV_MAXIMUM_TYPE_SIZE (8) +#define KLEIDICV_MAXIMUM_TYPE_SIZE (8) /// Maximum number of channels -#define INTRINSICCV_MAXIMUM_CHANNEL_COUNT (8) +#define KLEIDICV_MAXIMUM_CHANNEL_COUNT (8) #ifdef __cplusplus extern "C" { #endif // __cplusplus #ifdef DOXYGEN -#define INTRINSICCV_API_DECLARATION(name, ...) \ +#define KLEIDICV_API_DECLARATION(name, ...) \ intrinsiccv_error_t name(__VA_ARGS__) #else -#define INTRINSICCV_API_DECLARATION(name, ...) \ +#define KLEIDICV_API_DECLARATION(name, ...) \ extern intrinsiccv_error_t (*name)(__VA_ARGS__) #endif -#define INTRINSICCV_BINARY_OP(name, type) \ - INTRINSICCV_API_DECLARATION(name, const type *src_a, size_t src_a_stride, \ - const type *src_b, size_t src_b_stride, \ - type *dst, size_t dst_stride, size_t width, \ - size_t height) +#define KLEIDICV_BINARY_OP(name, type) \ + KLEIDICV_API_DECLARATION(name, const type *src_a, size_t src_a_stride, \ + const type *src_b, size_t src_b_stride, type *dst, \ + size_t dst_stride, size_t width, size_t height) -#define INTRINSICCV_BINARY_OP_SCALE(name, type, scaletype) \ - INTRINSICCV_API_DECLARATION(name, const type *src_a, size_t src_a_stride, \ - const type *src_b, size_t src_b_stride, \ - type *dst, size_t dst_stride, size_t width, \ - size_t height, scaletype scale) +#define KLEIDICV_BINARY_OP_SCALE(name, type, scaletype) \ + KLEIDICV_API_DECLARATION(name, const type *src_a, size_t src_a_stride, \ + const type *src_b, size_t src_b_stride, type *dst, \ + size_t dst_stride, size_t width, size_t height, \ + scaletype scale) /// Adds the values of the corresponding elements in `src_a` and `src_b`, and /// puts the result into `dst`. @@ -75,7 +74,7 @@ extern "C" { /// type of the element if the addition result would overflow. Source data /// length (in bytes) is `stride` * `height`. Width and height are the same /// for the two sources and for the destination. Number of elements is limited -/// to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_b Pointer to the second source data. Must be non-null. @@ -95,21 +94,21 @@ extern "C" { /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_add_s8, int8_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_s8, int8_t); /// @copydoc intrinsiccv_saturating_add_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_add_u8, uint8_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_u8, uint8_t); /// @copydoc intrinsiccv_saturating_add_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_add_s16, int16_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_s16, int16_t); /// @copydoc intrinsiccv_saturating_add_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_add_u16, uint16_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_u16, uint16_t); /// @copydoc intrinsiccv_saturating_add_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_add_s32, int32_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_s32, int32_t); /// @copydoc intrinsiccv_saturating_add_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_add_u32, uint32_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_u32, uint32_t); /// @copydoc intrinsiccv_saturating_add_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_add_s64, int64_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_s64, int64_t); /// @copydoc intrinsiccv_saturating_add_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_add_u64, uint64_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_u64, uint64_t); /// Subtracts the value of the corresponding element in `src_b` from `src_a`, /// and puts the result into `dst`. @@ -118,7 +117,7 @@ INTRINSICCV_BINARY_OP(intrinsiccv_saturating_add_u64, uint64_t); /// smallest possible value of the type of the element if the subtraction result /// would underflow. Source data length (in bytes) is `stride` * `height`. /// Width and height are the same for the two sources and for the destination. -/// Number of elements is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// Number of elements is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_b Pointer to the second source data. Must be non-null. @@ -138,21 +137,21 @@ INTRINSICCV_BINARY_OP(intrinsiccv_saturating_add_u64, uint64_t); /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_sub_s8, int8_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_s8, int8_t); /// @copydoc intrinsiccv_saturating_sub_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_sub_u8, uint8_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_u8, uint8_t); /// @copydoc intrinsiccv_saturating_sub_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_sub_s16, int16_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_s16, int16_t); /// @copydoc intrinsiccv_saturating_sub_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_sub_u16, uint16_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_u16, uint16_t); /// @copydoc intrinsiccv_saturating_sub_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_sub_s32, int32_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_s32, int32_t); /// @copydoc intrinsiccv_saturating_sub_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_sub_u32, uint32_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_u32, uint32_t); /// @copydoc intrinsiccv_saturating_sub_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_sub_s64, int64_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_s64, int64_t); /// @copydoc intrinsiccv_saturating_sub_s8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_sub_u64, uint64_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_u64, uint64_t); /// From the corresponding elements in `src_a` and `src_b`, subtracts the lower /// one from the higher one, and puts the result into `dst`. @@ -161,7 +160,7 @@ INTRINSICCV_BINARY_OP(intrinsiccv_saturating_sub_u64, uint64_t); /// type of the element if the result would overflow (it is only possible with /// signed types). Source data length (in bytes) is `stride` * `height`. Width /// and height are the same for the two sources and for the destination. Number -/// of elements is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of elements is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_b Pointer to the second source data. Must be non-null. @@ -181,15 +180,15 @@ INTRINSICCV_BINARY_OP(intrinsiccv_saturating_sub_u64, uint64_t); /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_absdiff_u8, uint8_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_absdiff_u8, uint8_t); /// @copydoc intrinsiccv_saturating_absdiff_u8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_absdiff_s8, int8_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_absdiff_s8, int8_t); /// @copydoc intrinsiccv_saturating_absdiff_u8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_absdiff_u16, uint16_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_absdiff_u16, uint16_t); /// @copydoc intrinsiccv_saturating_absdiff_u8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_absdiff_s16, int16_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_absdiff_s16, int16_t); /// @copydoc intrinsiccv_saturating_absdiff_u8 -INTRINSICCV_BINARY_OP(intrinsiccv_saturating_absdiff_s32, int32_t); +KLEIDICV_BINARY_OP(intrinsiccv_saturating_absdiff_s32, int32_t); /// Multiplies the values of the corresponding elements in `src_a` and `src_b`, /// and puts the result into `dst`. @@ -198,7 +197,7 @@ INTRINSICCV_BINARY_OP(intrinsiccv_saturating_absdiff_s32, int32_t); /// the type of the element if the multiplication result would overflow. Source /// data length (in bytes) is `stride` * `height`. Width and height are the /// same for the two sources and for the destination. Number of elements is -/// limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_b Pointer to the second source data. Must be non-null. @@ -219,19 +218,15 @@ INTRINSICCV_BINARY_OP(intrinsiccv_saturating_absdiff_s32, int32_t); /// @param height Number of rows in the data. /// @param scale Currently unused parameter. /// -INTRINSICCV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_u8, uint8_t, - double); +KLEIDICV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_u8, uint8_t, double); /// @copydoc intrinsiccv_saturating_multiply_u8 -INTRINSICCV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s8, int8_t, double); +KLEIDICV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s8, int8_t, double); /// @copydoc intrinsiccv_saturating_multiply_u8 -INTRINSICCV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_u16, uint16_t, - double); +KLEIDICV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_u16, uint16_t, double); /// @copydoc intrinsiccv_saturating_multiply_u8 -INTRINSICCV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s16, int16_t, - double); +KLEIDICV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s16, int16_t, double); /// @copydoc intrinsiccv_saturating_multiply_u8 -INTRINSICCV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s32, int32_t, - double); +KLEIDICV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s32, int32_t, double); /// Adds the absolute values of the corresponding elements in `src_a` and /// `src_b`. Then, performs a comparison of each element's value in the result @@ -242,7 +237,7 @@ INTRINSICCV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s32, int32_t, /// type of the element if the addition result would overflow. Source data /// length (in bytes) is `stride` * `height`. Width and height are the same /// for the two sources and for the destination. Number of elements is limited -/// to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_b Pointer to the second source data. Must be non-null. @@ -264,11 +259,11 @@ INTRINSICCV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s32, int32_t, /// @param threshold The value that the elements of the addition result /// are compared to. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_saturating_add_abs_with_threshold_s16, - const int16_t *src_a, size_t src_a_stride, - const int16_t *src_b, size_t src_b_stride, - int16_t *dst, size_t dst_stride, size_t width, - size_t height, int16_t threshold); +KLEIDICV_API_DECLARATION(intrinsiccv_saturating_add_abs_with_threshold_s16, + const int16_t *src_a, size_t src_a_stride, + const int16_t *src_b, size_t src_b_stride, + int16_t *dst, size_t dst_stride, size_t width, + size_t height, int16_t threshold); /// Converts a grayscale image to RGB. All channels are 8-bit wide. /// @@ -278,7 +273,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_saturating_add_abs_with_threshold_s16, /// by 3 bytes. There is no padding between the pixels. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -291,9 +286,9 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_saturating_add_abs_with_threshold_s16, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_gray_to_rgb_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_gray_to_rgb_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height); /// Converts a grayscale image to RGBA. All channels are 8-bit wide. /// @@ -303,7 +298,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_gray_to_rgb_u8, const uint8_t *src, /// by 4 bytes. There is no padding between the pixels. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -316,9 +311,9 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_gray_to_rgb_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_gray_to_rgba_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_gray_to_rgba_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height); /// Converts an RGB image to BGR. All channels are 8-bit wide. /// @@ -328,7 +323,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_gray_to_rgba_u8, const uint8_t *src, /// by 3 bytes. There is no padding between the pixels. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -341,15 +336,15 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_gray_to_rgba_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_rgb_to_bgr_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_bgr_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height); /// Copies a source RBG image to destination buffer. /// All channels are 8-bit wide. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -362,9 +357,9 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgb_to_bgr_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_rgb_to_rgb_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_rgb_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height); /// Converts an RGBA image to BGRA. All channels are 8-bit wide. /// @@ -374,7 +369,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgb_to_rgb_u8, const uint8_t *src, /// by 4 bytes. There is no padding between the pixels. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -387,15 +382,15 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgb_to_rgb_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_rgba_to_bgra_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_bgra_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height); /// Copies a source RBGA image to destination buffer. /// All channels are 8-bit wide. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -408,9 +403,9 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgba_to_bgra_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_rgba_to_rgba_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_rgba_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height); /// Converts an RGB image to BGRA. All channels are 8-bit wide. /// @@ -421,7 +416,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgba_to_rgba_u8, const uint8_t *src, /// by 4 bytes. There is no padding between the pixels. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -434,9 +429,9 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgba_to_rgba_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_rgb_to_bgra_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_bgra_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height); /// Converts an RGB image to RGBA. All channels are 8-bit wide. /// @@ -447,7 +442,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgb_to_bgra_u8, const uint8_t *src, /// by 4 bytes. There is no padding between the pixels. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -460,9 +455,9 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgb_to_bgra_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_rgb_to_rgba_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_rgba_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height); /// Converts an RGBA image to BGR. All channels are 8-bit wide. /// @@ -473,7 +468,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgb_to_rgba_u8, const uint8_t *src, /// by 3 bytes. There is no padding between the pixels. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -486,9 +481,9 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgb_to_rgba_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_rgba_to_bgr_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_bgr_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height); /// Converts an RGBA image to RGB. All channels are 8-bit wide. /// @@ -499,7 +494,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgba_to_bgr_u8, const uint8_t *src, /// by 3 bytes. There is no padding between the pixels. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -512,9 +507,9 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgba_to_bgr_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_rgba_to_rgb_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_rgb_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height); /// Converts an NV12 or NV21 YUV image to RGB. All channels are 8-bit wide. /// @@ -526,7 +521,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgba_to_rgb_u8, const uint8_t *src, /// used. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src_y Pointer to the input's Y component. Must be non-null. /// @param src_y_stride Distance in bytes from the start of one row to the @@ -548,11 +543,10 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_rgba_to_rgb_u8, const uint8_t *src, /// @param is_nv21 If true, input is treated as NV21, otherwise treated /// as NV12. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgb_u8, const uint8_t *src_y, - size_t src_y_stride, const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, size_t height, - bool is_nv21); +KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgb_u8, const uint8_t *src_y, + size_t src_y_stride, const uint8_t *src_uv, + size_t src_uv_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21); /// Converts an NV12 or NV21 YUV image to BGR. All channels are 8-bit wide. /// @@ -564,7 +558,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgb_u8, const uint8_t *src_y, /// used. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src_y Pointer to the input's Y component. Must be non-null. /// @param src_y_stride Distance in bytes from the start of one row to the @@ -586,11 +580,10 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgb_u8, const uint8_t *src_y, /// @param is_nv21 If true, input is treated as NV21, otherwise treated /// as NV12. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_yuv_sp_to_bgr_u8, const uint8_t *src_y, - size_t src_y_stride, const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, size_t height, - bool is_nv21); +KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_bgr_u8, const uint8_t *src_y, + size_t src_y_stride, const uint8_t *src_uv, + size_t src_uv_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21); /// Converts an NV12 or NV21 YUV image to RGBA. All channels are 8-bit wide. /// Alpha channel is set to 0xFF. @@ -601,7 +594,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_yuv_sp_to_bgr_u8, const uint8_t *src_y, /// by 4 bytes. There is no padding between the pixels. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src_y Pointer to the input's Y component. Must be non-null. /// @param src_y_stride Distance in bytes from the start of one row to the @@ -623,11 +616,10 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_yuv_sp_to_bgr_u8, const uint8_t *src_y, /// @param is_nv21 If true, input is treated as NV21, otherwise treated /// as NV12. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgba_u8, const uint8_t *src_y, - size_t src_y_stride, const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, size_t height, - bool is_nv21); +KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgba_u8, const uint8_t *src_y, + size_t src_y_stride, const uint8_t *src_uv, + size_t src_uv_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21); /// Converts an NV12 or NV21 YUV image to BGRA. All channels are 8-bit wide. /// Alpha channel is set to 0xFF. @@ -638,7 +630,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgba_u8, const uint8_t *src_y, /// by 4 bytes. There is no padding between the pixels. /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src_y Pointer to the input's Y component. Must be non-null. /// @param src_y_stride Distance in bytes from the start of one row to the @@ -660,18 +652,17 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgba_u8, const uint8_t *src_y, /// @param is_nv21 If true, input is treated as NV21, otherwise treated /// as NV12. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_yuv_sp_to_bgra_u8, const uint8_t *src_y, - size_t src_y_stride, const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, size_t height, - bool is_nv21); +KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_bgra_u8, const uint8_t *src_y, + size_t src_y_stride, const uint8_t *src_uv, + size_t src_uv_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21); /// Performs a comparison of each element's value in `src` with respect to a /// caller defined threshold. The strictly larger elements are set to /// `value` and the rest to 0. /// /// Width and height are the same for the source and for the destination. Number -/// of elements is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of elements is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -689,10 +680,10 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_yuv_sp_to_bgra_u8, const uint8_t *src_y, /// compared to. /// @param value The value that the larger elements are set to. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_threshold_binary_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height, uint8_t threshold, - uint8_t value); +KLEIDICV_API_DECLARATION(intrinsiccv_threshold_binary_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height, uint8_t threshold, + uint8_t value); /// Creates a morphology context according to the parameters. /// @@ -703,23 +694,23 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_threshold_binary_u8, const uint8_t *src, /// /// @param context Pointer where to return the created context's address. /// @param kernel Width and height of the kernel. Its size must not be -/// more than @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// more than @ref KLEIDICV_MAX_IMAGE_PIXELS. /// @param anchor Location in the kernel which is aligned to the actual /// point in the source data. Must not point out of the /// kernel. /// @param border_type Way of handling the border. The supported border types /// are: \n -/// - @ref INTRINSICCV_BORDER_TYPE_CONSTANT \n -/// - @ref INTRINSICCV_BORDER_TYPE_REPLICATE +/// - @ref KLEIDICV_BORDER_TYPE_CONSTANT \n +/// - @ref KLEIDICV_BORDER_TYPE_REPLICATE /// @param border_values Border values if the border_type is -/// @ref INTRINSICCV_BORDER_TYPE_CONSTANT. +/// @ref KLEIDICV_BORDER_TYPE_CONSTANT. /// @param channels Number of channels in the data. Must be not more than -/// @ref INTRINSICCV_MAXIMUM_CHANNEL_COUNT. +/// @ref KLEIDICV_MAXIMUM_CHANNEL_COUNT. /// @param iterations Number of times to do the morphology operation. /// @param type_size Element size in bytes. Must not be more than -/// @ref INTRINSICCV_MAXIMUM_TYPE_SIZE. +/// @ref KLEIDICV_MAXIMUM_TYPE_SIZE. /// @param image Image dimensions. Its size must not be more than -/// @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// @ref KLEIDICV_MAX_IMAGE_PIXELS. /// intrinsiccv_error_t intrinsiccv_morphology_create( intrinsiccv_morphology_context_t **context, intrinsiccv_rectangle_t kernel, @@ -740,7 +731,7 @@ intrinsiccv_error_t intrinsiccv_morphology_release( /// result into `dst`. /// /// Width and height are the same for the source and the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// The kernel has an anchor point, it is usually the center of the kernel. /// The algorithm takes a rectangle from the source data using the kernel and @@ -774,20 +765,20 @@ intrinsiccv_error_t intrinsiccv_morphology_release( /// @param height Number of rows in the data. /// @param context Pointer to morphology context. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_dilate_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height, - intrinsiccv_morphology_context_t *context); +KLEIDICV_API_DECLARATION(intrinsiccv_dilate_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height, + intrinsiccv_morphology_context_t *context); /// @copydoc intrinsiccv_dilate_u8 /// -INTRINSICCV_API_DECLARATION(intrinsiccv_erode_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height, - intrinsiccv_morphology_context_t *context); +KLEIDICV_API_DECLARATION(intrinsiccv_erode_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height, + intrinsiccv_morphology_context_t *context); /// Counts how many nonzero elements are in the source data. Number of elements -/// is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -798,9 +789,9 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_erode_u8, const uint8_t *src, /// @param height Number of rows in the data. /// @param count Pointer to variable to store result. Must be non-null. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_count_nonzeros_u8, const uint8_t *src, - size_t src_stride, size_t width, size_t height, - size_t *count); +KLEIDICV_API_DECLARATION(intrinsiccv_count_nonzeros_u8, const uint8_t *src, + size_t src_stride, size_t width, size_t height, + size_t *count); /// Resizes source data by averaging 4 elements to one. /// @@ -810,7 +801,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_count_nonzeros_u8, const uint8_t *src, /// dimensions could be either `(N+1, M+1)` or `(N, M)` or combination of both. /// For later cases last respective row or column of source data will not be /// processed. Currently only supports single-channel data. Number of pixels in -/// the source is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// the source is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// Even dimension example of 2x2 to 1x1 conversion: /// ``` @@ -845,19 +836,18 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_count_nonzeros_u8, const uint8_t *src, /// For odd src_height it must be either src_height / 2 /// or (src_height / 2) + 1. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_resize_to_quarter_u8, - const uint8_t *src, size_t src_stride, - size_t src_width, size_t src_height, uint8_t *dst, - size_t dst_stride, size_t dst_width, - size_t dst_height); +KLEIDICV_API_DECLARATION(intrinsiccv_resize_to_quarter_u8, const uint8_t *src, + size_t src_stride, size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, size_t dst_width, + size_t dst_height); /// Resize image using linear interpolation. /// /// At present only 2*2 upsizing is supported. -/// For other ratios INTRINSICCV_ERROR_NOT_IMPLEMENTED +/// For other ratios KLEIDICV_ERROR_NOT_IMPLEMENTED /// will be returned. /// The total number of pixels in the destination is limited to -/// @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -876,10 +866,10 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_resize_to_quarter_u8, /// @param dst_height Number of rows in the destination data. /// Must be src_height * 2. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_resize_linear_u8, const uint8_t *src, - size_t src_stride, size_t src_width, - size_t src_height, uint8_t *dst, size_t dst_stride, - size_t dst_width, size_t dst_height); +KLEIDICV_API_DECLARATION(intrinsiccv_resize_linear_u8, const uint8_t *src, + size_t src_stride, size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, size_t dst_width, + size_t dst_height); /// Calculates vertical derivative approximation with Sobel filter. /// @@ -892,10 +882,10 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_resize_linear_u8, const uint8_t *src, /// Note, that the kernel is mirrored both vertically and horizontally during /// the convolution. /// -/// The only supported border type is @ref INTRINSICCV_BORDER_TYPE_REPLICATE +/// The only supported border type is @ref KLEIDICV_BORDER_TYPE_REPLICATE /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -911,12 +901,12 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_resize_linear_u8, const uint8_t *src, /// 'channels' number of elements.) /// @param height Number of rows in the data. /// @param channels Number of channels in the data. Must be not more than -/// @ref INTRINSICCV_MAXIMUM_CHANNEL_COUNT. +/// @ref KLEIDICV_MAXIMUM_CHANNEL_COUNT. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_sobel_3x3_vertical_s16_u8, - const uint8_t *src, size_t src_stride, int16_t *dst, - size_t dst_stride, size_t width, size_t height, - size_t channels); +KLEIDICV_API_DECLARATION(intrinsiccv_sobel_3x3_vertical_s16_u8, + const uint8_t *src, size_t src_stride, int16_t *dst, + size_t dst_stride, size_t width, size_t height, + size_t channels); /// Calculates horizontal derivative approximation with Sobel filter. /// @@ -929,10 +919,10 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_sobel_3x3_vertical_s16_u8, /// Note, that the kernel is mirrored both vertically and horizontally during /// the convolution. /// -/// The only supported border type is @ref INTRINSICCV_BORDER_TYPE_REPLICATE +/// The only supported border type is @ref KLEIDICV_BORDER_TYPE_REPLICATE /// /// Width and height are the same for the source and for the destination. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -948,17 +938,17 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_sobel_3x3_vertical_s16_u8, /// 'channels' number of elements.) /// @param height Number of rows in the data. /// @param channels Number of channels in the data. Must be not more than -/// @ref INTRINSICCV_MAXIMUM_CHANNEL_COUNT. +/// @ref KLEIDICV_MAXIMUM_CHANNEL_COUNT. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_sobel_3x3_horizontal_s16_u8, - const uint8_t *src, size_t src_stride, int16_t *dst, - size_t dst_stride, size_t width, size_t height, - size_t channels); +KLEIDICV_API_DECLARATION(intrinsiccv_sobel_3x3_horizontal_s16_u8, + const uint8_t *src, size_t src_stride, int16_t *dst, + size_t dst_stride, size_t width, size_t height, + size_t channels); -#if INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#if KLEIDICV_EXPERIMENTAL_FEATURE_CANNY /// Canny edge detector for uint8_t grayscale input. Output is also a uint8_t /// grayscale image. Width and height are the same for input and output. Number -/// of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// The steps: /// - Execute horizontal and vertical Sobel filtering with 3*3 kernels to @@ -983,11 +973,11 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_sobel_3x3_horizontal_s16_u8, /// @param low_threshold Low threshold for the edge detector algorithm. /// @param high_threshold High threshold for the edge detector algorithm. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_canny_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height, double low_threshold, - double high_threshold); -#endif // INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +KLEIDICV_API_DECLARATION(intrinsiccv_canny_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height, double low_threshold, + double high_threshold); +#endif // KLEIDICV_EXPERIMENTAL_FEATURE_CANNY /// Creates a filter context according to the parameters. /// @@ -997,11 +987,11 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_canny_u8, const uint8_t *src, /// /// @param context Pointer where to return the created context's address. /// @param channels Number of channels in the data. Must be not more than -/// @ref INTRINSICCV_MAXIMUM_CHANNEL_COUNT. +/// @ref KLEIDICV_MAXIMUM_CHANNEL_COUNT. /// @param type_size Size of buffer element in bytes. It must be double the /// size of the type the filter operation is executed on. /// @param image Image dimensions. Its size must not be more than -/// @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// @ref KLEIDICV_MAX_IMAGE_PIXELS. /// intrinsiccv_error_t intrinsiccv_filter_create( intrinsiccv_filter_context_t **context, size_t channels, size_t type_size, @@ -1034,7 +1024,7 @@ intrinsiccv_error_t intrinsiccv_filter_release( /// ``` /// /// Width and height are the same for the source and for the destination. Number -/// of elements is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of elements is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// Usage: \n /// Before using this function, a context must be created using @@ -1043,10 +1033,10 @@ intrinsiccv_error_t intrinsiccv_filter_release( /// image dimensions as width and height parameters, with sizeof(uint8) as /// size_type, and with the channel number of the data as channels. \n /// Note, from the border types only these are supported: \n -/// - @ref INTRINSICCV_BORDER_TYPE_REPLICATE \n -/// - @ref INTRINSICCV_BORDER_TYPE_REFLECT \n -/// - @ref INTRINSICCV_BORDER_TYPE_WRAP \n -/// - @ref INTRINSICCV_BORDER_TYPE_REVERSE +/// - @ref KLEIDICV_BORDER_TYPE_REPLICATE \n +/// - @ref KLEIDICV_BORDER_TYPE_REFLECT \n +/// - @ref KLEIDICV_BORDER_TYPE_WRAP \n +/// - @ref KLEIDICV_BORDER_TYPE_REVERSE /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -1062,29 +1052,27 @@ intrinsiccv_error_t intrinsiccv_filter_release( /// 'channels' number of elements.) /// @param height Number of rows in the data. /// @param channels Number of channels in the data. Must be not more than -/// @ref INTRINSICCV_MAXIMUM_CHANNEL_COUNT. +/// @ref KLEIDICV_MAXIMUM_CHANNEL_COUNT. /// @param border_type Way of handling the border. /// @param context Pointer to filter context. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_gaussian_blur_3x3_u8, - const uint8_t *src, size_t src_stride, uint8_t *dst, - size_t dst_stride, size_t width, size_t height, - size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context); +KLEIDICV_API_DECLARATION(intrinsiccv_gaussian_blur_3x3_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height, size_t channels, + intrinsiccv_border_type_t border_type, + intrinsiccv_filter_context_t *context); /// @copydoc intrinsiccv_gaussian_blur_3x3_u8 /// -INTRINSICCV_API_DECLARATION(intrinsiccv_gaussian_blur_5x5_u8, - const uint8_t *src, size_t src_stride, uint8_t *dst, - size_t dst_stride, size_t width, size_t height, - size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context); +KLEIDICV_API_DECLARATION(intrinsiccv_gaussian_blur_5x5_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height, size_t channels, + intrinsiccv_border_type_t border_type, + intrinsiccv_filter_context_t *context); /// Splits a multi channel source stream into separate 1-channel streams. Width /// and height are the same for the source stream and for all the destination -/// streams. Number of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// streams. Number of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src_data Pointer to the source data. Must be non-null. /// Must be aligned to element_size. @@ -1110,11 +1098,10 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_gaussian_blur_5x5_u8, /// 4. /// @param element_size Size of one element in bytes. Must be 1, 2, 4 or 8. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_split, const void *src_data, - size_t src_stride, void **dst_data, - const size_t *dst_strides, size_t width, - size_t height, size_t channels, - size_t element_size); +KLEIDICV_API_DECLARATION(intrinsiccv_split, const void *src_data, + size_t src_stride, void **dst_data, + const size_t *dst_strides, size_t width, size_t height, + size_t channels, size_t element_size); /// Matrix transpose operation. /// Inplace transpose ('src == dst') is only supported for @@ -1128,7 +1115,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_split, const void *src_data, /// | 2 | 2 | 2 | /// ``` /// -/// Number of elements is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// Number of elements is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// Must be aligned to element_size. @@ -1147,14 +1134,14 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_split, const void *src_data, /// @param src_height Number of rows in the data. /// @param element_size Size of one element in bytes. Must be 1, 2, 4 or 8. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_transpose, const void *src, - size_t src_stride, void *dst, size_t dst_stride, - size_t src_width, size_t src_height, - size_t element_size); +KLEIDICV_API_DECLARATION(intrinsiccv_transpose, const void *src, + size_t src_stride, void *dst, size_t dst_stride, + size_t src_width, size_t src_height, + size_t element_size); /// Merges separate 1-channel source streams to one multi channel stream. Width /// and height are the same for all the source streams and for the destination. -/// Number of pixels is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// Number of pixels is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param srcs A C style array of pointers to the source data. /// Number of pointers in the array must be the same as the @@ -1180,13 +1167,13 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_transpose, const void *src, /// 3 or 4. /// @param element_size Size of one element in bytes. Must be 1, 2, 4 or 8. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_merge, const void **srcs, - const size_t *src_strides, void *dst, - size_t dst_stride, size_t width, size_t height, - size_t channels, size_t element_size); +KLEIDICV_API_DECLARATION(intrinsiccv_merge, const void **srcs, + const size_t *src_strides, void *dst, + size_t dst_stride, size_t width, size_t height, + size_t channels, size_t element_size); /// Calculates minimum and maximum element value across the source data. Number -/// of elements is limited to @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// of elements is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -1200,30 +1187,30 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_merge, const void **srcs, /// @param max_value Pointer to save result maximum value to, or nullptr if /// maximum is not to be calculated. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_min_max_u8, const uint8_t *src, - size_t src_stride, size_t width, size_t height, - uint8_t *min_value, uint8_t *max_value); +KLEIDICV_API_DECLARATION(intrinsiccv_min_max_u8, const uint8_t *src, + size_t src_stride, size_t width, size_t height, + uint8_t *min_value, uint8_t *max_value); /// @copydoc intrinsiccv_min_max_u8 -INTRINSICCV_API_DECLARATION(intrinsiccv_min_max_s8, const int8_t *src, - size_t src_stride, size_t width, size_t height, - int8_t *min_value, int8_t *max_value); +KLEIDICV_API_DECLARATION(intrinsiccv_min_max_s8, const int8_t *src, + size_t src_stride, size_t width, size_t height, + int8_t *min_value, int8_t *max_value); /// @copydoc intrinsiccv_min_max_u8 -INTRINSICCV_API_DECLARATION(intrinsiccv_min_max_u16, const uint16_t *src, - size_t src_stride, size_t width, size_t height, - uint16_t *min_value, uint16_t *max_value); +KLEIDICV_API_DECLARATION(intrinsiccv_min_max_u16, const uint16_t *src, + size_t src_stride, size_t width, size_t height, + uint16_t *min_value, uint16_t *max_value); /// @copydoc intrinsiccv_min_max_u8 -INTRINSICCV_API_DECLARATION(intrinsiccv_min_max_s16, const int16_t *src, - size_t src_stride, size_t width, size_t height, - int16_t *min_value, int16_t *max_value); +KLEIDICV_API_DECLARATION(intrinsiccv_min_max_s16, const int16_t *src, + size_t src_stride, size_t width, size_t height, + int16_t *min_value, int16_t *max_value); /// @copydoc intrinsiccv_min_max_u8 -INTRINSICCV_API_DECLARATION(intrinsiccv_min_max_s32, const int32_t *src, - size_t src_stride, size_t width, size_t height, - int32_t *min_value, int32_t *max_value); +KLEIDICV_API_DECLARATION(intrinsiccv_min_max_s32, const int32_t *src, + size_t src_stride, size_t width, size_t height, + int32_t *min_value, int32_t *max_value); /// Finds minimum and maximum element value across the source data, /// and returns their location in the source data as offset in bytes /// from the source beginning. Number of elements is limited to -/// @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -1237,9 +1224,9 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_min_max_s32, const int32_t *src, /// @param max_offset Pointer to save result offset of maximum value to, or /// nullptr if maximum is not to be calculated. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_min_max_loc_u8, const uint8_t *src, - size_t src_stride, size_t width, size_t height, - size_t *min_offset, size_t *max_offset); +KLEIDICV_API_DECLARATION(intrinsiccv_min_max_loc_u8, const uint8_t *src, + size_t src_stride, size_t width, size_t height, + size_t *min_offset, size_t *max_offset); /// Multiplies the elements in `src` by `scale`, then adds `shift` to the /// result and stores it in `dst`. @@ -1248,7 +1235,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_min_max_loc_u8, const uint8_t *src, /// type of the element if the result would underflow/overflow. Source data /// length (in bytes) is `stride` * `height`. Width and height are the same /// for the source and destination. Number of elements is limited to -/// @ref INTRINSICCV_MAX_IMAGE_PIXELS. +/// @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -1263,10 +1250,9 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_min_max_loc_u8, const uint8_t *src, /// @param scale Value to multiply the input by. /// @param shift Value to add to the result. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_scale_u8, const uint8_t *src, - size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height, float scale, - float shift); +KLEIDICV_API_DECLARATION(intrinsiccv_scale_u8, const uint8_t *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height, float scale, float shift); /// Converts the elements in `src` from a floating-point type to an integer /// type, then stores the result in `dst`. @@ -1276,7 +1262,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_scale_u8, const uint8_t *src, /// represented as the `dst` type. In case of special values, such as the /// different variations of `NaN`, the result is `0`. Source and destination /// data length is `width` * `height`. Number of elements is limited to @ref -/// INTRINSICCV_MAX_IMAGE_PIXELS. +/// KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -1289,13 +1275,13 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_scale_u8, const uint8_t *src, /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_float_conversion_f32_s8, - const float *src, size_t src_stride, int8_t *dst, - size_t dst_stride, size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_float_conversion_f32_s8, const float *src, + size_t src_stride, int8_t *dst, size_t dst_stride, + size_t width, size_t height); /// @copydoc intrinsiccv_float_conversion_f32_s8 -INTRINSICCV_API_DECLARATION(intrinsiccv_float_conversion_f32_u8, - const float *src, size_t src_stride, uint8_t *dst, - size_t dst_stride, size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_float_conversion_f32_u8, const float *src, + size_t src_stride, uint8_t *dst, size_t dst_stride, + size_t width, size_t height); /// Converts the elements in `src` from an integer type to a floating-point /// type, then stores the result in `dst`. @@ -1304,7 +1290,7 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_float_conversion_f32_u8, /// number of the type of the element if the `src` data type cannot be /// represented as the `dst` type. Source and destination data length is `width` /// * `height`. Number of elements is limited to @ref -/// INTRINSICCV_MAX_IMAGE_PIXELS. +/// KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the @@ -1319,16 +1305,16 @@ INTRINSICCV_API_DECLARATION(intrinsiccv_float_conversion_f32_u8, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -INTRINSICCV_API_DECLARATION(intrinsiccv_float_conversion_s8_f32, - const int8_t *src, size_t src_stride, float *dst, - size_t dst_stride, size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_float_conversion_s8_f32, const int8_t *src, + size_t src_stride, float *dst, size_t dst_stride, + size_t width, size_t height); /// @copydoc intrinsiccv_float_conversion_s8_f32 -INTRINSICCV_API_DECLARATION(intrinsiccv_float_conversion_u8_f32, - const uint8_t *src, size_t src_stride, float *dst, - size_t dst_stride, size_t width, size_t height); +KLEIDICV_API_DECLARATION(intrinsiccv_float_conversion_u8_f32, + const uint8_t *src, size_t src_stride, float *dst, + size_t dst_stride, size_t width, size_t height); #ifdef __cplusplus } // extern "C" #endif // __cplusplus -#endif // INTRINSICCV_H +#endif // KLEIDICV_H diff --git a/intrinsiccv/include/intrinsiccv/morphology/workspace.h b/intrinsiccv/include/intrinsiccv/morphology/workspace.h index 9980bebfe..c83ff422e 100644 --- a/intrinsiccv/include/intrinsiccv/morphology/workspace.h +++ b/intrinsiccv/include/intrinsiccv/morphology/workspace.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_MORPHOLOGY_WORKSPACE_H -#define INTRINSICCV_MORPHOLOGY_WORKSPACE_H +#ifndef KLEIDICV_MORPHOLOGY_WORKSPACE_H +#define KLEIDICV_MORPHOLOGY_WORKSPACE_H #include #include @@ -13,7 +13,7 @@ #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/types.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { // Forward declarations. class MorphologyWorkspace; @@ -22,7 +22,7 @@ class MorphologyWorkspace; class MorphologyWorkspaceDeleter { public: void operator()(MorphologyWorkspace *ptr) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { std::free(ptr); }; }; @@ -40,11 +40,11 @@ class MorphologyWorkspace final { }; static std::optional get_border_type( - intrinsiccv_border_type_t border_type) INTRINSICCV_STREAMING_COMPATIBLE { + intrinsiccv_border_type_t border_type) KLEIDICV_STREAMING_COMPATIBLE { switch (border_type) { - case INTRINSICCV_BORDER_TYPE_REPLICATE: + case KLEIDICV_BORDER_TYPE_REPLICATE: return BorderType::REPLICATE; - case INTRINSICCV_BORDER_TYPE_CONSTANT: + case KLEIDICV_BORDER_TYPE_CONSTANT: return BorderType::CONSTANT; default: return std::optional(); @@ -56,7 +56,7 @@ class MorphologyWorkspace final { public: constexpr void operator()(Rows src_rows, Rows dst_rows, size_t length) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { std::memcpy(static_cast(&dst_rows[0]), static_cast(&src_rows[0]), length * sizeof(T) * dst_rows.channels()); @@ -72,14 +72,14 @@ class MorphologyWorkspace final { intrinsiccv_point_t anchor, BorderType border_type, intrinsiccv_border_values_t border_values, size_t channels, size_t iterations, size_t type_size, - intrinsiccv_rectangle_t image) INTRINSICCV_STREAMING_COMPATIBLE { + intrinsiccv_rectangle_t image) KLEIDICV_STREAMING_COMPATIBLE { // These values are arbitrarily choosen. const size_t rows_per_iteration = std::max(2 * kernel.height, 32UL); // To avoid load/store penalties. const size_t kAlignment = 16; if (anchor.x >= kernel.width || anchor.y >= kernel.height) { - return INTRINSICCV_ERROR_RANGE; + return KLEIDICV_ERROR_RANGE; } Rectangle image_size{image}; @@ -103,7 +103,7 @@ class MorphologyWorkspace final { size_t buffer_rows_size = 0UL; if (__builtin_mul_overflow(buffer_rows_stride, buffer_rows_height, &buffer_rows_size)) { - return INTRINSICCV_ERROR_RANGE; + return KLEIDICV_ERROR_RANGE; } buffer_rows_size += kAlignment - 1; @@ -118,7 +118,7 @@ class MorphologyWorkspace final { workspace = MorphologyWorkspace::Pointer{ reinterpret_cast(allocation)}; if (!workspace) { - return INTRINSICCV_ERROR_ALLOCATION; + return KLEIDICV_ERROR_ALLOCATION; } workspace->rows_per_iteration_ = rows_per_iteration; @@ -147,7 +147,7 @@ class MorphologyWorkspace final { workspace->type_size_ = type_size; workspace->image_size_ = image_size; - return INTRINSICCV_OK; + return KLEIDICV_OK; } intrinsiccv_rectangle_t kernel() const { return kernel_; } @@ -165,12 +165,12 @@ class MorphologyWorkspace final { void process(Rectangle rect, Rows src_rows, Rows dst_rows, Margin margin, Border border, BorderType border_type, - O operation) INTRINSICCV_STREAMING_COMPATIBLE { + O operation) KLEIDICV_STREAMING_COMPATIBLE { using S = typename O::SourceType; using B = typename O::BufferType; typename O::CopyData copy_data{}; - if (INTRINSICCV_UNLIKELY(rect.width() == 0 || rect.height() == 0)) { + if (KLEIDICV_UNLIKELY(rect.width() == 0 || rect.height() == 0)) { return; } @@ -318,7 +318,7 @@ class MorphologyWorkspace final { private: // The number of wide rows to process in the next iteration. [[nodiscard]] size_t get_next_horizontal_height() - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { size_t height = std::min(horizontal_height_, rows_per_iteration_); horizontal_height_ -= height; return height; @@ -326,7 +326,7 @@ class MorphologyWorkspace final { // The number of indirect rows to process in the next iteration. [[nodiscard]] size_t get_next_vertical_height() - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { size_t height = std::min(vertical_height_, rows_per_iteration_); vertical_height_ -= height; return height; @@ -334,7 +334,7 @@ class MorphologyWorkspace final { template void make_constant_border(Rows dst_rows, size_t dst_index, size_t count, - BorderType value) INTRINSICCV_STREAMING_COMPATIBLE { + BorderType value) KLEIDICV_STREAMING_COMPATIBLE { auto dst = &dst_rows.at(0, dst_index)[0]; for (size_t index = 0; index < count * dst_rows.channels(); ++index) { dst[index] = value; @@ -344,7 +344,7 @@ class MorphologyWorkspace final { template void replicate_border(Rows src_rows, Rows dst_rows, size_t src_index, size_t dst_index, - size_t count) INTRINSICCV_STREAMING_COMPATIBLE { + size_t count) KLEIDICV_STREAMING_COMPATIBLE { if (!count) { return; } @@ -387,9 +387,9 @@ class MorphologyWorkspace final { // Stride of the wide rows. size_t wide_rows_stride_; // Workspace area begins here. - uint8_t data_[0] INTRINSICCV_ATTR_ALIGNED(sizeof(void *)); + uint8_t data_[0] KLEIDICV_ATTR_ALIGNED(sizeof(void *)); }; // end of class MorphologyWorkspace -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_MORPHOLOGY_WORKSPACE_H +#endif // KLEIDICV_MORPHOLOGY_WORKSPACE_H diff --git a/intrinsiccv/include/intrinsiccv/neon.h b/intrinsiccv/include/intrinsiccv/neon.h index 1742ed841..00ea66e24 100644 --- a/intrinsiccv/include/intrinsiccv/neon.h +++ b/intrinsiccv/include/intrinsiccv/neon.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_NEON_H -#define INTRINSICCV_NEON_H +#ifndef KLEIDICV_NEON_H +#define KLEIDICV_NEON_H #include @@ -331,7 +331,7 @@ class SeparableFilter { using BufferVecTraits = typename neon::VecTraits; using BufferVectorType = typename BufferVecTraits::VectorType; using BorderInfoType = - typename ::INTRINSICCV_TARGET_NAMESPACE::FixedBorderInfo3x3; + typename ::KLEIDICV_TARGET_NAMESPACE::FixedBorderInfo3x3; using BorderType = FixedBorderType; using BorderOffsets = typename BorderInfoType::Offsets; @@ -461,7 +461,7 @@ class SeparableFilter { using BufferVecTraits = typename neon::VecTraits; using BufferVectorType = typename BufferVecTraits::VectorType; using BorderInfoType = - typename ::INTRINSICCV_TARGET_NAMESPACE::FixedBorderInfo5x5; + typename ::KLEIDICV_TARGET_NAMESPACE::FixedBorderInfo5x5; using BorderType = FixedBorderType; using BorderOffsets = typename BorderInfoType::Offsets; @@ -577,4 +577,4 @@ using SeparableFilter5x5 = SeparableFilter; } // namespace intrinsiccv::neon -#endif // INTRINSICCV_NEON_H +#endif // KLEIDICV_NEON_H diff --git a/intrinsiccv/include/intrinsiccv/neon_intrinsics.h b/intrinsiccv/include/intrinsiccv/neon_intrinsics.h index bea4058a8..825191ef7 100644 --- a/intrinsiccv/include/intrinsiccv/neon_intrinsics.h +++ b/intrinsiccv/include/intrinsiccv/neon_intrinsics.h @@ -2,10 +2,10 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_NEON_INTRINSICS_H -#define INTRINSICCV_NEON_INTRINSICS_H +#ifndef KLEIDICV_NEON_INTRINSICS_H +#define KLEIDICV_NEON_INTRINSICS_H -#ifndef INTRINSICCV_NEON_H +#ifndef KLEIDICV_NEON_H #error "Please include neon.h instead." #endif @@ -411,4 +411,4 @@ static inline uint64x2_t vreinterpretq_u64(uint64x2_t vec) { return vec; } } // namespace intrinsiccv::neon -#endif // INTRINSICCV_NEON_INTRINSICS_H +#endif // KLEIDICV_NEON_INTRINSICS_H diff --git a/intrinsiccv/include/intrinsiccv/operations.h b/intrinsiccv/include/intrinsiccv/operations.h index e369f6f92..7b86d079e 100644 --- a/intrinsiccv/include/intrinsiccv/operations.h +++ b/intrinsiccv/include/intrinsiccv/operations.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_OPERATIONS_H -#define INTRINSICCV_OPERATIONS_H +#ifndef KLEIDICV_OPERATIONS_H +#define KLEIDICV_OPERATIONS_H #include #include @@ -11,7 +11,7 @@ #include "intrinsiccv/traits.h" #include "intrinsiccv/types.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { // Base for classes that change the behaviour or extend the interface of an // operation. @@ -31,113 +31,109 @@ class OperationBase { using ContextType = context_type_t; // Returns a reference to the inner operation. - OperationType &operation() INTRINSICCV_STREAMING_COMPATIBLE { + OperationType &operation() KLEIDICV_STREAMING_COMPATIBLE { return operation_; } // Forwards num_lanes() calls to the inner operation. - static size_t num_lanes() INTRINSICCV_STREAMING_COMPATIBLE { + static size_t num_lanes() KLEIDICV_STREAMING_COMPATIBLE { return VecTraits::num_lanes(); } // Forwards vector_path_2x() calls to the inner operation. template decltype(auto) vector_path_2x(ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return operation().vector_path_2x(std::forward(args)...); } // Forwards vector_path() calls to the inner operation. template - decltype(auto) vector_path(ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + decltype(auto) vector_path(ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { return operation().vector_path(std::forward(args)...); } // Forwards remaining_path() calls to the inner operation. template decltype(auto) remaining_path(ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return operation().remaining_path(std::forward(args)...); } // Forwards tail_path() calls to the inner operation. template - decltype(auto) tail_path(ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + decltype(auto) tail_path(ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { return operation().tail_path(std::forward(args)...); } // Forwards scalar_path() calls to the inner operation. template - decltype(auto) scalar_path(ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + decltype(auto) scalar_path(ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { return operation().scalar_path(std::forward(args)...); } template - decltype(auto) load(ArgTypes &&...args) INTRINSICCV_STREAMING_COMPATIBLE { + decltype(auto) load(ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { return VecTraits::load(std::forward(args)...); } template decltype(auto) load_consecutive(ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return VecTraits::load_consecutive(std::forward(args)...); } template - decltype(auto) store(ArgTypes &&...args) INTRINSICCV_STREAMING_COMPATIBLE { + decltype(auto) store(ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { return VecTraits::store(std::forward(args)...); } template decltype(auto) store_consecutive(ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return VecTraits::store_consecutive(std::forward(args)...); } // Forwards max_vectors_per_block() calls to the inner operation. - size_t max_vectors_per_block() INTRINSICCV_STREAMING_COMPATIBLE { + size_t max_vectors_per_block() KLEIDICV_STREAMING_COMPATIBLE { return operation_.max_vectors_per_block(); } // Forwards on_block_finished() calls to the inner operation. void on_block_finished(size_t vectors_in_block) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return operation_.on_block_finished(vectors_in_block); } // Returns true if the innermost operation is unrolled twice, otherwise false. - static constexpr bool is_unrolled_twice() INTRINSICCV_STREAMING_COMPATIBLE { - return ::INTRINSICCV_TARGET_NAMESPACE::is_unrolled_twice< + static constexpr bool is_unrolled_twice() KLEIDICV_STREAMING_COMPATIBLE { + return ::KLEIDICV_TARGET_NAMESPACE::is_unrolled_twice< concrete_operation_type_t>; } // Returns true if the innermost operation is unrolled once, otherwise false. - static constexpr bool is_unrolled_once() INTRINSICCV_STREAMING_COMPATIBLE { - return ::INTRINSICCV_TARGET_NAMESPACE::is_unrolled_once< + static constexpr bool is_unrolled_once() KLEIDICV_STREAMING_COMPATIBLE { + return ::KLEIDICV_TARGET_NAMESPACE::is_unrolled_once< concrete_operation_type_t>; } // Returns true if the innermost operation uses tail path, otherwise false. - static constexpr bool uses_tail_path() INTRINSICCV_STREAMING_COMPATIBLE { - return ::INTRINSICCV_TARGET_NAMESPACE::uses_tail_path< + static constexpr bool uses_tail_path() KLEIDICV_STREAMING_COMPATIBLE { + return ::KLEIDICV_TARGET_NAMESPACE::uses_tail_path< concrete_operation_type_t>; } // Returns true if the innermost operation tries to avoid tail loop, otherwise // false. - static constexpr bool try_to_avoid_tail_loop() - INTRINSICCV_STREAMING_COMPATIBLE { - return ::INTRINSICCV_TARGET_NAMESPACE::try_to_avoid_tail_loop< + static constexpr bool try_to_avoid_tail_loop() KLEIDICV_STREAMING_COMPATIBLE { + return ::KLEIDICV_TARGET_NAMESPACE::try_to_avoid_tail_loop< concrete_operation_type_t>; } protected: // Constructor is protected so that only derived classes can instantiate. - explicit OperationBase(OperationType &operation) - INTRINSICCV_STREAMING_COMPATIBLE : operation_{operation} {} + explicit OperationBase(OperationType &operation) KLEIDICV_STREAMING_COMPATIBLE + : operation_{operation} {} private: // Reference to the inner operation. @@ -149,8 +145,7 @@ template class ForwardingOperation : public OperationBase { public: explicit ForwardingOperation(OperationType &operation) - INTRINSICCV_STREAMING_COMPATIBLE - : OperationBase(operation) {} + KLEIDICV_STREAMING_COMPATIBLE : OperationBase(operation) {} }; // end of class ForwardingOperation // Facade to offer a simplified row-based operation interface. @@ -166,19 +161,18 @@ template class RowBasedOperation : public OperationBase { public: explicit RowBasedOperation(OperationType &operation) - INTRINSICCV_STREAMING_COMPATIBLE - : OperationBase(operation) {} + KLEIDICV_STREAMING_COMPATIBLE : OperationBase(operation) {} // NOLINTBEGIN(cppcoreguidelines-avoid-goto, hicpp-avoid-goto) template void process_row(size_t length, - ColumnTypes... columns) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnTypes... columns) KLEIDICV_STREAMING_COMPATIBLE { LoopUnroll loop{length, this->num_lanes()}; // clang-format off loop.unroll_twice_if( - [&](size_t step) INTRINSICCV_STREAMING_COMPATIBLE { + [&](size_t step) KLEIDICV_STREAMING_COMPATIBLE { this->operation().vector_path_2x(columns...); ((columns += step), ...); }); @@ -186,7 +180,7 @@ class RowBasedOperation : public OperationBase { avoid_tail_loop: loop.unroll_once_if( - [&](size_t step) INTRINSICCV_STREAMING_COMPATIBLE { + [&](size_t step) KLEIDICV_STREAMING_COMPATIBLE { this->operation().vector_path(columns...); ((columns += step), ...); }); @@ -195,7 +189,7 @@ class RowBasedOperation : public OperationBase { // possible. if constexpr (OperationType::is_unrolled_once() && OperationType::try_to_avoid_tail_loop()) { if (loop.try_avoid_tail_loop( - [&](size_t backward_step) INTRINSICCV_STREAMING_COMPATIBLE { + [&](size_t backward_step) KLEIDICV_STREAMING_COMPATIBLE { // Adjust pointers backwards to include // the leftover bytes. ((columns -= backward_step), ...); @@ -205,7 +199,7 @@ class RowBasedOperation : public OperationBase { } loop.remaining( - [&](size_t length, size_t /* step */) INTRINSICCV_STREAMING_COMPATIBLE { + [&](size_t length, size_t /* step */) KLEIDICV_STREAMING_COMPATIBLE { this->operation().remaining_path(length, columns...); }); @@ -230,32 +224,29 @@ template class RowBasedBlockOperation : public OperationBase { public: explicit RowBasedBlockOperation(OperationType &operation) - INTRINSICCV_STREAMING_COMPATIBLE - : OperationBase(operation) {} + KLEIDICV_STREAMING_COMPATIBLE : OperationBase(operation) {} template void process_row(size_t length, - ColumnTypes... columns) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnTypes... columns) KLEIDICV_STREAMING_COMPATIBLE { if constexpr (OperationType::is_unrolled_twice()) { - process_blocks<2>(length, - [&](size_t step) INTRINSICCV_STREAMING_COMPATIBLE { - this->operation().vector_path_2x(columns...); - ((columns += step), ...); - }); + process_blocks<2>(length, [&](size_t step) KLEIDICV_STREAMING_COMPATIBLE { + this->operation().vector_path_2x(columns...); + ((columns += step), ...); + }); } if constexpr (OperationType::is_unrolled_once()) { - process_blocks<1>(length, - [&](size_t step) INTRINSICCV_STREAMING_COMPATIBLE { - this->operation().vector_path(columns...); - ((columns += step), ...); - }); + process_blocks<1>(length, [&](size_t step) KLEIDICV_STREAMING_COMPATIBLE { + this->operation().vector_path(columns...); + ((columns += step), ...); + }); } // clang-format off LoopUnroll loop{length, this->num_lanes()}; loop.remaining( - [&](size_t length, size_t /* step */) INTRINSICCV_STREAMING_COMPATIBLE { + [&](size_t length, size_t /* step */) KLEIDICV_STREAMING_COMPATIBLE { this->operation().remaining_path(length, columns...); }); // clang-format on @@ -264,7 +255,7 @@ class RowBasedBlockOperation : public OperationBase { private: template void process_blocks(size_t &length, - CallbackType callback) INTRINSICCV_STREAMING_COMPATIBLE { + CallbackType callback) KLEIDICV_STREAMING_COMPATIBLE { // The number of elements a single iteration would process. const size_t elements_per_iteration = UnrollFactor * this->num_lanes(); // The number of elements which will be processed when this method returns. @@ -289,7 +280,7 @@ class RowBasedBlockOperation : public OperationBase { // Process data with the appropriate unroll factor. LoopUnroll loop{block_length, this->num_lanes()}; loop.unroll_n_times( - [&](size_t step) INTRINSICCV_STREAMING_COMPATIBLE { + [&](size_t step) KLEIDICV_STREAMING_COMPATIBLE { callback(step); // Adjust remaining length here. // This improves generated code. @@ -315,13 +306,12 @@ class ParallelRowsAdapter : public OperationBase { using ConstColumnType = Columns; explicit ParallelRowsAdapter(OperationType &operation) - INTRINSICCV_STREAMING_COMPATIBLE - : OperationBase(operation) {} + KLEIDICV_STREAMING_COMPATIBLE : OperationBase(operation) {} // Forwards vector_path_2x() calls to the inner operation with one source and // destination parallel columns. void vector_path_2x(ConstParallelColumnType src_a, ConstColumnType src_b, - ParallelColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ParallelColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { this->operation().vector_path_2x(src_a.first(), src_a.second(), src_b, dst.first(), dst.second()); } @@ -329,7 +319,7 @@ class ParallelRowsAdapter : public OperationBase { // Forwards vector_path() calls to the inner operation with one source and // destination parallel columns. void vector_path(ConstParallelColumnType src_a, ConstColumnType src_b, - ParallelColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ParallelColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { this->operation().vector_path(src_a.first(), src_a.second(), src_b, dst.first(), dst.second()); } @@ -338,7 +328,7 @@ class ParallelRowsAdapter : public OperationBase { // destination parallel columns. void remaining_path(size_t length, ConstParallelColumnType src_a, ConstColumnType src_b, - ParallelColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ParallelColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { this->operation().remaining_path(length, src_a.first(), src_a.second(), src_b, dst.first(), dst.second()); } @@ -378,8 +368,7 @@ class OperationAdapter : public OperationBase { using ColumnType = Columns; explicit OperationAdapter(OperationType &operation) - INTRINSICCV_STREAMING_COMPATIBLE - : OperationBase(operation) {} + KLEIDICV_STREAMING_COMPATIBLE : OperationBase(operation) {} // --------------------------------------------------------------------------- // Forwarding implementations for vector_path_2x(). @@ -389,7 +378,7 @@ class OperationAdapter : public OperationBase { // void T::vector_path([ContextType,] VectorType); template enable_if_has_vector_path_t vector_path_2x( - ContextType ctx, ConstColumnType src) INTRINSICCV_STREAMING_COMPATIBLE { + ContextType ctx, ConstColumnType src) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_0, src_1; operation().load_consecutive(ctx, &src[0], src_0, src_1); operation().vector_path(ctx, src_0); @@ -401,7 +390,7 @@ class OperationAdapter : public OperationBase { template enable_if_has_vector_path_t vector_path_2x(ContextType ctx, ConstColumnType src, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_0, src_1; operation().load_consecutive(ctx, &src[0], src_0, src_1); VectorType res_0 = operation().vector_path(ctx, src_0); @@ -415,7 +404,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path_2x(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_a_0, src_a_1, src_b_0, src_b_1; operation().load_consecutive(ctx, &src_a[0], src_a_0, src_a_1); operation().load_consecutive(ctx, &src_b[0], src_b_0, src_b_1); @@ -429,7 +418,7 @@ class OperationAdapter : public OperationBase { template enable_if_has_vector_path_t vector_path_2x(ContextType ctx, ConstColumnType src, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_0, src_1; operation().load_consecutive(ctx, &src[0], src_0, src_1); operation().vector_path(ctx, src_0, &dst[0]); @@ -442,7 +431,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path_2x(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_a_0, src_a_1, src_b_0, src_b_1; operation().load_consecutive(ctx, &src_a[0], src_a_0, src_a_1); operation().load_consecutive(ctx, &src_b[0], src_b_0, src_b_1); @@ -458,7 +447,7 @@ class OperationAdapter : public OperationBase { VectorType, ScalarType *> vector_path_2x(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, ConstColumnType src_c, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_a_0, src_a_1, src_b_0, src_b_1, src_c_0, src_c_1; operation().load_consecutive(ctx, &src_a[0], src_a_0, src_a_1); operation().load_consecutive(ctx, &src_b[0], src_b_0, src_b_1); @@ -477,7 +466,7 @@ class OperationAdapter : public OperationBase { VectorType, ScalarType *, ScalarType *> vector_path_2x(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, ConstColumnType src_c, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_a_0, src_a_1, src_b_0, src_b_1, src_c_0, src_c_1; operation().load_consecutive(ctx, &src_a[0], src_a_0, src_a_1); operation().load_consecutive(ctx, &src_b[0], src_b_0, src_b_1); @@ -498,7 +487,7 @@ class OperationAdapter : public OperationBase { VectorType, VectorType, ScalarType *> vector_path_2x(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, ConstColumnType src_c, ConstColumnType src_d, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_a_0, src_a_1, src_b_0, src_b_1; VectorType src_c_0, src_c_1, src_d_0, src_d_1; operation().load_consecutive(ctx, &src_a[0], src_a_0, src_a_1); @@ -516,7 +505,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path_2x(ContextType ctx, ConstColumnType src, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src[0], &dst[0]); operation().vector_path(ctx, &src.at(num_lanes())[0], &dst.at(num_lanes())[0]); @@ -528,7 +517,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path_2x(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src_a[0], &src_b[0], &dst[0]); operation().vector_path(ctx, &src_a.at(num_lanes())[0], &src_b.at(num_lanes())[0], &dst.at(num_lanes())[0]); @@ -543,7 +532,7 @@ class OperationAdapter : public OperationBase { ScalarType *, ScalarType *> vector_path_2x(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, ConstColumnType src_c, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src_a[0], &src_b[0], &src_c[0], &dst_a[0], &dst_b[0]); operation().vector_path( @@ -559,7 +548,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path_2x(ContextType ctx, ConstColumnType src, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src[0], &dst_a[0], &dst_b[0]); operation().vector_path(ctx, &src.at(num_lanes())[0], &dst_a.at(num_lanes())[0], @@ -573,7 +562,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path_2x(ContextType ctx, ConstColumnType src, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { Vector2Type vdst_a, vdst_b; operation().vector_path(ctx, &src[0], vdst_a.val[0], vdst_b.val[0]); @@ -591,7 +580,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path_2x(ContextType ctx, ConstColumnType src, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { Vector2Type vsrc_0, vsrc_1; Vector2Type vdst_a, vdst_b; @@ -612,7 +601,7 @@ class OperationAdapter : public OperationBase { ScalarType *, ScalarType *, ScalarType *> vector_path_2x(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, - ColumnType dst_c) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_c) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src[0], &dst_a[0], &dst_b[0], &dst_c[0]); operation().vector_path( ctx, &src.at(num_lanes() * 3)[0], &dst_a.at(num_lanes())[0], @@ -627,7 +616,7 @@ class OperationAdapter : public OperationBase { VectorType &, VectorType &, VectorType &> vector_path_2x(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, - ColumnType dst_c) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_c) KLEIDICV_STREAMING_COMPATIBLE { Vector2Type vdst_a, vdst_b, vdst_c; operation().vector_path(ctx, &src[0], vdst_a.val[0], vdst_b.val[0], @@ -648,7 +637,7 @@ class OperationAdapter : public OperationBase { VectorType &, VectorType &> vector_path_2x(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, - ColumnType dst_c) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_c) KLEIDICV_STREAMING_COMPATIBLE { Vector3Type vsrc_0, vsrc_1; Vector2Type vdst_a, vdst_b, vdst_c; @@ -673,7 +662,7 @@ class OperationAdapter : public OperationBase { ScalarType *> vector_path_2x(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, ColumnType dst_c, - ColumnType dst_d) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_d) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src[0], &dst_a[0], &dst_b[0], &dst_c[0], &dst_d[0]); operation().vector_path( @@ -694,7 +683,7 @@ class OperationAdapter : public OperationBase { VectorType &> vector_path_2x(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, ColumnType dst_c, - ColumnType dst_d) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_d) KLEIDICV_STREAMING_COMPATIBLE { Vector2Type vdst_a, vdst_b, vdst_c, vdst_d; operation().vector_path(ctx, &src[0], vdst_a.val[0], vdst_b.val[0], @@ -722,7 +711,7 @@ class OperationAdapter : public OperationBase { VectorType &> vector_path_2x(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, ColumnType dst_c, - ColumnType dst_d) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_d) KLEIDICV_STREAMING_COMPATIBLE { Vector4Type vsrc_0, vsrc_1; Vector2Type vdst_a, vdst_b, vdst_c, vdst_d; @@ -748,7 +737,7 @@ class OperationAdapter : public OperationBase { // void T::vector_path([ContextType,] VectorType); template enable_if_has_vector_path_t vector_path( - ContextType ctx, ConstColumnType src) INTRINSICCV_STREAMING_COMPATIBLE { + ContextType ctx, ConstColumnType src) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_0; operation().load(ctx, &src[0], src_0); operation().vector_path(ctx, src_0); @@ -759,7 +748,7 @@ class OperationAdapter : public OperationBase { template enable_if_has_vector_path_t vector_path(ContextType ctx, ConstColumnType src, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_0; operation().load(ctx, &src[0], src_0); VectorType res_0 = operation().vector_path(ctx, src_0); @@ -772,7 +761,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_a_0, src_b_0; operation().load(ctx, &src_a[0], src_a_0); operation().load(ctx, &src_b[0], src_b_0); @@ -785,7 +774,7 @@ class OperationAdapter : public OperationBase { template enable_if_has_vector_path_t vector_path(ContextType ctx, ConstColumnType src, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_0; operation().load(ctx, &src[0], src_0); operation().vector_path(ctx, src_0, &dst[0]); @@ -797,7 +786,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_a_0, src_b_0; operation().load(ctx, &src_a[0], src_a_0); operation().load(ctx, &src_b[0], src_b_0); @@ -812,7 +801,7 @@ class OperationAdapter : public OperationBase { VectorType, ScalarType *> vector_path(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, ConstColumnType src_c, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_a_0, src_b_0, src_c_0; operation().load(ctx, &src_a[0], src_a_0); operation().load(ctx, &src_b[0], src_b_0); @@ -828,7 +817,7 @@ class OperationAdapter : public OperationBase { VectorType, ScalarType *, ScalarType *> vector_path(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, ConstColumnType src_c, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_a_0, src_b_0, src_c_0; operation().load(ctx, &src_a[0], src_a_0); operation().load(ctx, &src_b[0], src_b_0); @@ -845,7 +834,7 @@ class OperationAdapter : public OperationBase { VectorType, VectorType, ScalarType *> vector_path(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, ConstColumnType src_c, ConstColumnType src_d, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_a_0, src_b_0, src_c_0, src_d_0; operation().load(ctx, &src_a[0], src_a_0); operation().load(ctx, &src_b[0], src_b_0); @@ -860,7 +849,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path(ContextType ctx, ConstColumnType src, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src[0], &dst[0]); } @@ -871,7 +860,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src_a[0], &src_b[0], &dst[0]); } @@ -884,7 +873,7 @@ class OperationAdapter : public OperationBase { ScalarType *, ScalarType *> vector_path(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, ConstColumnType src_c, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src_a[0], &src_b[0], &src_c[0], &dst_a[0], &dst_b[0]); } @@ -896,7 +885,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src[0], &dst_a[0], &dst_b[0]); } @@ -907,7 +896,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { VectorType vdst_a, vdst_b; operation().vector_path(ctx, &src[0], vdst_a, vdst_b); @@ -923,7 +912,7 @@ class OperationAdapter : public OperationBase { enable_if_has_vector_path_t vector_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { VectorType vdst_a, vdst_b; Vector2Type vsrc; @@ -943,7 +932,7 @@ class OperationAdapter : public OperationBase { ScalarType *, ScalarType *, ScalarType *> vector_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, - ColumnType dst_c) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_c) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src[0], &dst_a[0], &dst_b[0], &dst_c[0]); } @@ -955,7 +944,7 @@ class OperationAdapter : public OperationBase { VectorType &, VectorType &, VectorType &> vector_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, - ColumnType dst_c) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_c) KLEIDICV_STREAMING_COMPATIBLE { VectorType vdst_a, vdst_b, vdst_c; operation().vector_path(ctx, &src[0], vdst_a, vdst_b, vdst_c); @@ -973,7 +962,7 @@ class OperationAdapter : public OperationBase { VectorType &, VectorType &> vector_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, - ColumnType dst_c) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_c) KLEIDICV_STREAMING_COMPATIBLE { VectorType vdst_a, vdst_b, vdst_c; Vector3Type vsrc; @@ -996,7 +985,7 @@ class OperationAdapter : public OperationBase { ScalarType *> vector_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, ColumnType dst_c, - ColumnType dst_d) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_d) KLEIDICV_STREAMING_COMPATIBLE { operation().vector_path(ctx, &src[0], &dst_a[0], &dst_b[0], &dst_c[0], &dst_d[0]); } @@ -1012,7 +1001,7 @@ class OperationAdapter : public OperationBase { VectorType &> vector_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, ColumnType dst_c, - ColumnType dst_d) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_d) KLEIDICV_STREAMING_COMPATIBLE { VectorType vdst_a, vdst_b, vdst_c, vdst_d; operation().vector_path(ctx, &src[0], vdst_a, vdst_b, vdst_c, vdst_d); @@ -1034,7 +1023,7 @@ class OperationAdapter : public OperationBase { VectorType &> vector_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, ColumnType dst_c, - ColumnType dst_d) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_d) KLEIDICV_STREAMING_COMPATIBLE { VectorType vdst_a, vdst_b, vdst_c, vdst_d; Vector4Type vsrc; @@ -1057,7 +1046,7 @@ class OperationAdapter : public OperationBase { template enable_if_has_tail_path_t tail_path(ContextType ctx, ConstColumnType src, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_0; operation().load(ctx, &src[0], src_0); operation().tail_path(ctx, src_0, &dst[0]); @@ -1069,7 +1058,7 @@ class OperationAdapter : public OperationBase { enable_if_has_tail_path_t tail_path(ContextType ctx, ConstColumnType src, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { operation().tail_path(ctx, &src[0], &dst[0]); } @@ -1081,7 +1070,7 @@ class OperationAdapter : public OperationBase { // void T::scalar_path([ContextType,] ScalarType); template enable_if_has_scalar_path_t scalar_path( - ContextType ctx, ConstColumnType src) INTRINSICCV_STREAMING_COMPATIBLE { + ContextType ctx, ConstColumnType src) KLEIDICV_STREAMING_COMPATIBLE { operation().scalar_path(ctx, src[0]); } @@ -1090,7 +1079,7 @@ class OperationAdapter : public OperationBase { template enable_if_has_scalar_path_t scalar_path(ContextType ctx, ConstColumnType src, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { dst[0] = operation().scalar_path(ctx, src[0]); } @@ -1100,7 +1089,7 @@ class OperationAdapter : public OperationBase { enable_if_has_scalar_path_t scalar_path(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { dst[0] = operation().scalar_path(ctx, src_a[0], src_b[0]); } @@ -1110,7 +1099,7 @@ class OperationAdapter : public OperationBase { enable_if_has_scalar_path_t scalar_path(ContextType ctx, ConstColumnType src, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { operation().scalar_path(ctx, &src[0], &dst[0]); } @@ -1121,7 +1110,7 @@ class OperationAdapter : public OperationBase { enable_if_has_scalar_path_t scalar_path(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { operation().scalar_path(ctx, &src_a[0], &src_b[0], &dst[0]); } @@ -1134,7 +1123,7 @@ class OperationAdapter : public OperationBase { ScalarType *> scalar_path(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, ConstColumnType src_c, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { operation().scalar_path(ctx, &src_a[0], &src_b[0], &src_c[0], &dst[0]); } @@ -1147,7 +1136,7 @@ class OperationAdapter : public OperationBase { const ScalarType *, ScalarType *> scalar_path(ContextType ctx, ConstColumnType src_a, ConstColumnType src_b, ConstColumnType src_c, ConstColumnType src_d, - ColumnType dst) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst) KLEIDICV_STREAMING_COMPATIBLE { operation().scalar_path(ctx, &src_a[0], &src_b[0], &src_c[0], &src_d[0], &dst[0]); } @@ -1162,7 +1151,7 @@ class OperationAdapter : public OperationBase { ScalarType *, ScalarType *> scalar_path(ContextType ctx, size_t length, ConstColumnType src_a, ConstColumnType src_b, ConstColumnType src_c, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { operation().scalar_path(ctx, length, &src_a[0], &src_b[0], &src_c[0], &dst_a[0], &dst_b[0]); } @@ -1174,7 +1163,7 @@ class OperationAdapter : public OperationBase { enable_if_has_scalar_path_t scalar_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, - ColumnType dst_b) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_b) KLEIDICV_STREAMING_COMPATIBLE { operation().scalar_path(ctx, &src[0], &dst_a[0], &dst_b[0]); } @@ -1186,7 +1175,7 @@ class OperationAdapter : public OperationBase { ScalarType *, ScalarType *, ScalarType *> scalar_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, - ColumnType dst_c) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_c) KLEIDICV_STREAMING_COMPATIBLE { operation().scalar_path(ctx, &src[0], &dst_a[0], &dst_b[0], &dst_c[0]); } @@ -1199,7 +1188,7 @@ class OperationAdapter : public OperationBase { ScalarType *> scalar_path(ContextType ctx, ConstColumnType src, ColumnType dst_a, ColumnType dst_b, ColumnType dst_c, - ColumnType dst_d) INTRINSICCV_STREAMING_COMPATIBLE { + ColumnType dst_d) KLEIDICV_STREAMING_COMPATIBLE { operation().scalar_path(ctx, &src[0], &dst_a[0], &dst_b[0], &dst_c[0], &dst_d[0]); } @@ -1212,61 +1201,60 @@ class RemoveContextAdapter : public OperationBase { using ContextType = typename OperationBase::ContextType; explicit RemoveContextAdapter(OperationType &operation) - INTRINSICCV_STREAMING_COMPATIBLE - : OperationBase(operation) {} + KLEIDICV_STREAMING_COMPATIBLE : OperationBase(operation) {} template decltype(auto) load(ContextType, - ArgTypes &&...args) INTRINSICCV_STREAMING_COMPATIBLE { + ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { return OperationBase::load(std::forward(args)...); } template decltype(auto) load_consecutive(ContextType, ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return OperationBase::load_consecutive( std::forward(args)...); } template decltype(auto) store(ContextType, - ArgTypes &&...args) INTRINSICCV_STREAMING_COMPATIBLE { + ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { return OperationBase::store(std::forward(args)...); } template decltype(auto) store_consecutive(ContextType, ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return OperationBase::store_consecutive( std::forward(args)...); } template - decltype(auto) vector_path(ContextType, ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + decltype(auto) vector_path(ContextType, + ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { return this->operation().vector_path(std::forward(args)...); } // Forwards remaining_path() calls to the inner operation. template decltype(auto) remaining_path(ContextType, ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return this->operation().remaining_path(std::forward(args)...); } template - decltype(auto) tail_path(ContextType, ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + decltype(auto) tail_path(ContextType, + ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { return this->operation().tail_path(std::forward(args)...); } template - decltype(auto) scalar_path(ContextType, ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { + decltype(auto) scalar_path(ContextType, + ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { return this->operation().scalar_path(std::forward(args)...); } }; // end of class RemoveContextAdapter -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_OPERATIONS_H +#endif // KLEIDICV_OPERATIONS_H diff --git a/intrinsiccv/include/intrinsiccv/resize/resize.h b/intrinsiccv/include/intrinsiccv/resize/resize.h index 74f1d71ba..14a5d2493 100644 --- a/intrinsiccv/include/intrinsiccv/resize/resize.h +++ b/intrinsiccv/include/intrinsiccv/resize/resize.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_RESIZE_RESIZE_H -#define INTRINSICCV_RESIZE_RESIZE_H +#ifndef KLEIDICV_RESIZE_RESIZE_H +#define KLEIDICV_RESIZE_RESIZE_H #include "intrinsiccv/intrinsiccv.h" @@ -32,4 +32,4 @@ intrinsiccv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, } // namespace intrinsiccv -#endif // INTRINSICCV_RESIZE_RESIZE_H +#endif // KLEIDICV_RESIZE_RESIZE_H diff --git a/intrinsiccv/include/intrinsiccv/resize/resize_linear.h b/intrinsiccv/include/intrinsiccv/resize/resize_linear.h index d5dcff866..837ce834f 100644 --- a/intrinsiccv/include/intrinsiccv/resize/resize_linear.h +++ b/intrinsiccv/include/intrinsiccv/resize/resize_linear.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_RESIZE_RESIZE_LINEAR_H -#define INTRINSICCV_RESIZE_RESIZE_LINEAR_H +#ifndef KLEIDICV_RESIZE_RESIZE_LINEAR_H +#define KLEIDICV_RESIZE_RESIZE_LINEAR_H #include "intrinsiccv/intrinsiccv.h" @@ -32,4 +32,4 @@ intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, } // namespace intrinsiccv -#endif // INTRINSICCV_RESIZE_RESIZE_H +#endif // KLEIDICV_RESIZE_RESIZE_H diff --git a/intrinsiccv/include/intrinsiccv/sve2.h b/intrinsiccv/include/intrinsiccv/sve2.h index df7b4f3e9..6b83d0e12 100644 --- a/intrinsiccv/include/intrinsiccv/sve2.h +++ b/intrinsiccv/include/intrinsiccv/sve2.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_SVE2_H -#define INTRINSICCV_SVE2_H +#ifndef KLEIDICV_SVE2_H +#define KLEIDICV_SVE2_H #include @@ -14,18 +14,18 @@ #include "intrinsiccv/workspace/separable.h" // It is used by SVE2 and SME2, the actual namespace will reflect it. -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { // Context associated with SVE operations. class Context { public: - explicit Context(svbool_t &pg) INTRINSICCV_STREAMING_COMPATIBLE : pg_{pg} {} + explicit Context(svbool_t &pg) KLEIDICV_STREAMING_COMPATIBLE : pg_{pg} {} // Sets the predicate associated with the context to a given predicate. - void set_predicate(svbool_t pg) INTRINSICCV_STREAMING_COMPATIBLE { pg_ = pg; } + void set_predicate(svbool_t pg) KLEIDICV_STREAMING_COMPATIBLE { pg_ = pg; } // Returns predicate associated with the context. - svbool_t predicate() const INTRINSICCV_STREAMING_COMPATIBLE { return pg_; } + svbool_t predicate() const KLEIDICV_STREAMING_COMPATIBLE { return pg_; } protected: // Hold a reference to an svbool_t because a sizeless type cannot be a member. @@ -143,131 +143,131 @@ class VecTraitsBase : public VectorTypes { using typename VectorTypes::VectorType; // Number of lanes in a vector. - static inline size_t num_lanes() INTRINSICCV_STREAMING_COMPATIBLE { + static inline size_t num_lanes() KLEIDICV_STREAMING_COMPATIBLE { return static_cast(svcnt()); } // Loads a single vector from 'src'. static inline void load(Context ctx, const ScalarType *src, - VectorType &vec) INTRINSICCV_STREAMING_COMPATIBLE { + VectorType &vec) KLEIDICV_STREAMING_COMPATIBLE { vec = svld1(ctx.predicate(), &src[0]); } // Loads two consecutive vectors from 'src'. static inline void load_consecutive(Context ctx, const ScalarType *src, VectorType &vec_0, VectorType &vec_1) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { vec_0 = svld1(ctx.predicate(), &src[0]); vec_1 = svld1_vnum(ctx.predicate(), &src[0], 1); } // Stores a single vector to 'dst'. static inline void store(Context ctx, VectorType vec, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { svst1(ctx.predicate(), &dst[0], vec); } // Stores two consecutive vectors to 'dst'. static inline void store_consecutive(Context ctx, VectorType vec_0, VectorType vec_1, ScalarType *dst) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { svst1(ctx.predicate(), &dst[0], vec_0); svst1_vnum(ctx.predicate(), &dst[0], 1, vec_1); } template static std::enable_if_t svcnt() - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return svcntb(); } template static std::enable_if_t svcnt() - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return svcnth(); } template static std::enable_if_t svcnt() - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return svcntw(); } template static std::enable_if_t svcnt() - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return svcntd(); } template static std::enable_if_t svcntp( - svbool_t pg) INTRINSICCV_STREAMING_COMPATIBLE { + svbool_t pg) KLEIDICV_STREAMING_COMPATIBLE { return svcntp_b8(pg, pg); } template static std::enable_if_t svcntp( - svbool_t pg) INTRINSICCV_STREAMING_COMPATIBLE { + svbool_t pg) KLEIDICV_STREAMING_COMPATIBLE { return svcntp_b16(pg, pg); } template static std::enable_if_t svcntp( - svbool_t pg) INTRINSICCV_STREAMING_COMPATIBLE { + svbool_t pg) KLEIDICV_STREAMING_COMPATIBLE { return svcntp_b32(pg, pg); } template static std::enable_if_t svcntp( - svbool_t pg) INTRINSICCV_STREAMING_COMPATIBLE { + svbool_t pg) KLEIDICV_STREAMING_COMPATIBLE { return svcntp_b64(pg, pg); } template static std::enable_if_t svptrue() - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return svptrue_b8(); } template static std::enable_if_t svptrue() - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return svptrue_b16(); } template static std::enable_if_t svptrue() - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return svptrue_b32(); } template static std::enable_if_t svptrue() - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return svptrue_b64(); } template static std::enable_if_t svwhilelt( - IndexType index, IndexType max_index) INTRINSICCV_STREAMING_COMPATIBLE { + IndexType index, IndexType max_index) KLEIDICV_STREAMING_COMPATIBLE { return svwhilelt_b8(index, max_index); } template static std::enable_if_t svwhilelt( - IndexType index, IndexType max_index) INTRINSICCV_STREAMING_COMPATIBLE { + IndexType index, IndexType max_index) KLEIDICV_STREAMING_COMPATIBLE { return svwhilelt_b16(index, max_index); } template static std::enable_if_t svwhilelt( - IndexType index, IndexType max_index) INTRINSICCV_STREAMING_COMPATIBLE { + IndexType index, IndexType max_index) KLEIDICV_STREAMING_COMPATIBLE { return svwhilelt_b32(index, max_index); } template static std::enable_if_t svwhilelt( - IndexType index, IndexType max_index) INTRINSICCV_STREAMING_COMPATIBLE { + IndexType index, IndexType max_index) KLEIDICV_STREAMING_COMPATIBLE { return svwhilelt_b64(index, max_index); } @@ -276,7 +276,7 @@ class VecTraitsBase : public VectorTypes { // consecutive ones starting at the lowest element. static void make_consecutive_predicates(svbool_t pg, svbool_t &pg_0, svbool_t &pg_1, svbool_t &pg_2) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { // Length of data. Must be signed because of the unconditional subtraction // of fixed values. int64_t length = 3 * svcntp(pg); @@ -298,7 +298,7 @@ class VecTraitsBase : public VectorTypes { // consecutive ones starting at the lowest element. static void make_consecutive_predicates( svbool_t pg, svbool_t &pg_0, svbool_t &pg_1, svbool_t &pg_2, - svbool_t &pg_3) INTRINSICCV_STREAMING_COMPATIBLE { + svbool_t &pg_3) KLEIDICV_STREAMING_COMPATIBLE { // Length of data. Must be signed because of the unconditional subtraction // of fixed values. int64_t length = 4 * svcntp(pg); @@ -328,7 +328,7 @@ class VecTraits : public VecTraitsBase {}; template <> class VecTraits : public VecTraitsBase { public: - static inline svint8_t svdup(int8_t v) INTRINSICCV_STREAMING_COMPATIBLE { + static inline svint8_t svdup(int8_t v) KLEIDICV_STREAMING_COMPATIBLE { return svdup_s8(v); } }; // end of class VecTraits @@ -336,7 +336,7 @@ class VecTraits : public VecTraitsBase { template <> class VecTraits : public VecTraitsBase { public: - static inline svuint8_t svdup(uint8_t v) INTRINSICCV_STREAMING_COMPATIBLE { + static inline svuint8_t svdup(uint8_t v) KLEIDICV_STREAMING_COMPATIBLE { return svdup_u8(v); } }; // end of class VecTraits @@ -344,7 +344,7 @@ class VecTraits : public VecTraitsBase { template <> class VecTraits : public VecTraitsBase { public: - static inline svint16_t svdup(int16_t v) INTRINSICCV_STREAMING_COMPATIBLE { + static inline svint16_t svdup(int16_t v) KLEIDICV_STREAMING_COMPATIBLE { return svdup_s16(v); } }; // end of class VecTraits @@ -352,7 +352,7 @@ class VecTraits : public VecTraitsBase { template <> class VecTraits : public VecTraitsBase { public: - static inline svuint16_t svdup(uint16_t v) INTRINSICCV_STREAMING_COMPATIBLE { + static inline svuint16_t svdup(uint16_t v) KLEIDICV_STREAMING_COMPATIBLE { return svdup_u16(v); } }; // end of class VecTraits @@ -360,7 +360,7 @@ class VecTraits : public VecTraitsBase { template <> class VecTraits : public VecTraitsBase { public: - static inline svint32_t svdup(int32_t v) INTRINSICCV_STREAMING_COMPATIBLE { + static inline svint32_t svdup(int32_t v) KLEIDICV_STREAMING_COMPATIBLE { return svdup_s32(v); } }; // end of class VecTraits @@ -368,7 +368,7 @@ class VecTraits : public VecTraitsBase { template <> class VecTraits : public VecTraitsBase { public: - static inline svuint32_t svdup(uint32_t v) INTRINSICCV_STREAMING_COMPATIBLE { + static inline svuint32_t svdup(uint32_t v) KLEIDICV_STREAMING_COMPATIBLE { return svdup_u32(v); } }; // end of class VecTraits @@ -376,7 +376,7 @@ class VecTraits : public VecTraitsBase { template <> class VecTraits : public VecTraitsBase { public: - static inline svint64_t svdup(int64_t v) INTRINSICCV_STREAMING_COMPATIBLE { + static inline svint64_t svdup(int64_t v) KLEIDICV_STREAMING_COMPATIBLE { return svdup_s64(v); } }; // end of class VecTraits @@ -384,7 +384,7 @@ class VecTraits : public VecTraitsBase { template <> class VecTraits : public VecTraitsBase { public: - static inline svuint64_t svdup(uint64_t v) INTRINSICCV_STREAMING_COMPATIBLE { + static inline svuint64_t svdup(uint64_t v) KLEIDICV_STREAMING_COMPATIBLE { return svdup_u64(v); } }; // end of class VecTraits @@ -392,7 +392,7 @@ class VecTraits : public VecTraitsBase { template <> class VecTraits : public VecTraitsBase { public: - static inline svfloat32_t svdup(float v) INTRINSICCV_STREAMING_COMPATIBLE { + static inline svfloat32_t svdup(float v) KLEIDICV_STREAMING_COMPATIBLE { return svdup_f32(v); } }; // end of class VecTraits @@ -400,7 +400,7 @@ class VecTraits : public VecTraitsBase { template <> class VecTraits : public VecTraitsBase { public: - static inline svfloat64_t svdup(double v) INTRINSICCV_STREAMING_COMPATIBLE { + static inline svfloat64_t svdup(double v) KLEIDICV_STREAMING_COMPATIBLE { return svdup_f64(v); } }; // end of class VecTraits @@ -417,12 +417,11 @@ class OperationContextAdapter : public OperationBase { using VecTraits = typename OperationBase::VecTraits; explicit OperationContextAdapter(OperationType &operation) - INTRINSICCV_STREAMING_COMPATIBLE - : OperationBase(operation) {} + KLEIDICV_STREAMING_COMPATIBLE : OperationBase(operation) {} // Forwards vector_path_2x() calls to the inner operation. template - void vector_path_2x(ArgTypes &&...args) INTRINSICCV_STREAMING_COMPATIBLE { + void vector_path_2x(ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { svbool_t ctx_pg; ContextType ctx{ctx_pg}; ctx.set_predicate(VecTraits::svptrue()); @@ -431,7 +430,7 @@ class OperationContextAdapter : public OperationBase { // Forwards vector_path() calls to the inner operation. template - void vector_path(ArgTypes &&...args) INTRINSICCV_STREAMING_COMPATIBLE { + void vector_path(ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { svbool_t ctx_pg; ContextType ctx{ctx_pg}; ctx.set_predicate(VecTraits::svptrue()); @@ -442,8 +441,7 @@ class OperationContextAdapter : public OperationBase { // operation is unrolled once. template std::enable_if_t remaining_path( - size_t length, - ColumnTypes &&...columns) INTRINSICCV_STREAMING_COMPATIBLE { + size_t length, ColumnTypes &&...columns) KLEIDICV_STREAMING_COMPATIBLE { svbool_t ctx_pg; ContextType ctx{ctx_pg}; ctx.set_predicate(VecTraits::svwhilelt(size_t{0}, length)); @@ -454,7 +452,7 @@ class OperationContextAdapter : public OperationBase { // operation is not unrolled once. template std::enable_if_t remaining_path( - size_t length, ColumnTypes... columns) INTRINSICCV_STREAMING_COMPATIBLE { + size_t length, ColumnTypes... columns) KLEIDICV_STREAMING_COMPATIBLE { svbool_t ctx_pg; ContextType ctx{ctx_pg}; @@ -476,13 +474,12 @@ class RemainingPathAdapter : public OperationBase { using ContextType = Context; explicit RemainingPathAdapter(OperationType &operation) - INTRINSICCV_STREAMING_COMPATIBLE - : OperationBase(operation) {} + KLEIDICV_STREAMING_COMPATIBLE : OperationBase(operation) {} // Forwards remaining_path() to either vector_path() or tail_path() of the // inner operation depending on what is requested by the innermost operation. template - void remaining_path(ArgTypes... args) INTRINSICCV_STREAMING_COMPATIBLE { + void remaining_path(ArgTypes... args) KLEIDICV_STREAMING_COMPATIBLE { if constexpr (OperationType::uses_tail_path()) { this->operation().tail_path(std::forward(args)...); } else { @@ -493,8 +490,8 @@ class RemainingPathAdapter : public OperationBase { // Shorthand for applying a generic unrolled SVE2 operation. template -void apply_operation_by_rows(OperationType &operation, ArgTypes &&...args) - INTRINSICCV_STREAMING_COMPATIBLE { +void apply_operation_by_rows(OperationType &operation, + ArgTypes &&...args) KLEIDICV_STREAMING_COMPATIBLE { ForwardingOperation forwarding_operation{operation}; OperationAdapter operation_adapter{forwarding_operation}; RemainingPathAdapter remaining_path_adapter{operation_adapter}; @@ -515,35 +512,35 @@ class SeparableFilter { using BufferType = typename FilterType::BufferType; using DestinationType = typename FilterType::DestinationType; using SourceVecTraits = - typename ::INTRINSICCV_TARGET_NAMESPACE::VecTraits; + typename ::KLEIDICV_TARGET_NAMESPACE::VecTraits; using SourceVectorType = typename SourceVecTraits::VectorType; using BufferVecTraits = - typename ::INTRINSICCV_TARGET_NAMESPACE::VecTraits; + typename ::KLEIDICV_TARGET_NAMESPACE::VecTraits; using BufferVectorType = typename BufferVecTraits::VectorType; using BorderInfoType = - typename ::INTRINSICCV_TARGET_NAMESPACE::FixedBorderInfo3x3; + typename ::KLEIDICV_TARGET_NAMESPACE::FixedBorderInfo3x3; using BorderType = FixedBorderType; using BorderOffsets = typename BorderInfoType::Offsets; - explicit SeparableFilter(FilterType filter) INTRINSICCV_STREAMING_COMPATIBLE + explicit SeparableFilter(FilterType filter) KLEIDICV_STREAMING_COMPATIBLE : filter_{filter} {} - static constexpr Margin margin() INTRINSICCV_STREAMING_COMPATIBLE { + static constexpr Margin margin() KLEIDICV_STREAMING_COMPATIBLE { return Margin{1UL}; } void process_vertical( size_t width, Rows src_rows, Rows dst_rows, - BorderOffsets border_offsets) const INTRINSICCV_STREAMING_COMPATIBLE { + BorderOffsets border_offsets) const KLEIDICV_STREAMING_COMPATIBLE { LoopUnroll2 loop{width * src_rows.channels(), SourceVecTraits::num_lanes()}; - loop.unroll_once([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + loop.unroll_once([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg_all = SourceVecTraits::svptrue(); vertical_vector_path(pg_all, src_rows, dst_rows, border_offsets, index); }); loop.remaining( - [&](size_t index, size_t length) INTRINSICCV_STREAMING_COMPATIBLE { + [&](size_t index, size_t length) KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg = SourceVecTraits::svwhilelt(index, length); vertical_vector_path(pg, src_rows, dst_rows, border_offsets, index); }); @@ -552,21 +549,21 @@ class SeparableFilter { void process_horizontal(size_t width, Rows src_rows, Rows dst_rows, BorderOffsets border_offsets) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg_all = BufferVecTraits::svptrue(); LoopUnroll2 loop{width * src_rows.channels(), BufferVecTraits::num_lanes()}; - loop.unroll_twice([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + loop.unroll_twice([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { horizontal_vector_path_2x(pg_all, src_rows, dst_rows, border_offsets, index); }); - loop.unroll_once([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + loop.unroll_once([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { horizontal_vector_path(pg_all, src_rows, dst_rows, border_offsets, index); }); loop.remaining( - [&](size_t index, size_t length) INTRINSICCV_STREAMING_COMPATIBLE { + [&](size_t index, size_t length) KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg = BufferVecTraits::svwhilelt(index, length); horizontal_vector_path(pg, src_rows, dst_rows, border_offsets, index); }); @@ -576,7 +573,7 @@ class SeparableFilter { // change for each and every element in the border. void process_horizontal_borders( Rows src_rows, Rows dst_rows, - BorderOffsets border_offsets) const INTRINSICCV_STREAMING_COMPATIBLE { + BorderOffsets border_offsets) const KLEIDICV_STREAMING_COMPATIBLE { for (size_t index = 0; index < src_rows.channels(); ++index) { disable_loop_vectorization(); process_horizontal_border(src_rows, dst_rows, border_offsets, index); @@ -586,8 +583,8 @@ class SeparableFilter { private: void vertical_vector_path(svbool_t pg, Rows src_rows, Rows dst_rows, - BorderOffsets border_offsets, size_t index) const - INTRINSICCV_STREAMING_COMPATIBLE { + BorderOffsets border_offsets, + size_t index) const KLEIDICV_STREAMING_COMPATIBLE { SourceVectorType src_0 = svld1(pg, &src_rows.at(border_offsets.c0())[index]); SourceVectorType src_1 = @@ -600,7 +597,7 @@ class SeparableFilter { void horizontal_vector_path_2x( svbool_t pg, Rows src_rows, Rows dst_rows, BorderOffsets border_offsets, - size_t index) const INTRINSICCV_STREAMING_COMPATIBLE { + size_t index) const KLEIDICV_STREAMING_COMPATIBLE { auto src_0 = &src_rows.at(0, border_offsets.c0())[index]; auto src_1 = &src_rows.at(0, border_offsets.c1())[index]; auto src_2 = &src_rows.at(0, border_offsets.c2())[index]; @@ -622,7 +619,7 @@ class SeparableFilter { void horizontal_vector_path(svbool_t pg, Rows src_rows, Rows dst_rows, BorderOffsets border_offsets, size_t index) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { BufferVectorType src_0 = svld1(pg, &src_rows.at(0, border_offsets.c0())[index]); BufferVectorType src_1 = @@ -635,7 +632,7 @@ class SeparableFilter { void process_horizontal_border( Rows src_rows, Rows dst_rows, BorderOffsets border_offsets, - size_t index) const INTRINSICCV_STREAMING_COMPATIBLE { + size_t index) const KLEIDICV_STREAMING_COMPATIBLE { BufferType src[3]; src[0] = src_rows.at(0, border_offsets.c0())[index]; src[1] = src_rows.at(0, border_offsets.c1())[index]; @@ -654,35 +651,35 @@ class SeparableFilter { using BufferType = typename FilterType::BufferType; using DestinationType = typename FilterType::DestinationType; using SourceVecTraits = - typename ::INTRINSICCV_TARGET_NAMESPACE::VecTraits; + typename ::KLEIDICV_TARGET_NAMESPACE::VecTraits; using SourceVectorType = typename SourceVecTraits::VectorType; using BufferVecTraits = - typename ::INTRINSICCV_TARGET_NAMESPACE::VecTraits; + typename ::KLEIDICV_TARGET_NAMESPACE::VecTraits; using BufferVectorType = typename BufferVecTraits::VectorType; using BorderInfoType = - typename ::INTRINSICCV_TARGET_NAMESPACE::FixedBorderInfo5x5; + typename ::KLEIDICV_TARGET_NAMESPACE::FixedBorderInfo5x5; using BorderType = FixedBorderType; using BorderOffsets = typename BorderInfoType::Offsets; - explicit SeparableFilter(FilterType filter) INTRINSICCV_STREAMING_COMPATIBLE + explicit SeparableFilter(FilterType filter) KLEIDICV_STREAMING_COMPATIBLE : filter_{filter} {} - static constexpr Margin margin() INTRINSICCV_STREAMING_COMPATIBLE { + static constexpr Margin margin() KLEIDICV_STREAMING_COMPATIBLE { return Margin{2UL}; } void process_vertical( size_t width, Rows src_rows, Rows dst_rows, - BorderOffsets border_offsets) const INTRINSICCV_STREAMING_COMPATIBLE { + BorderOffsets border_offsets) const KLEIDICV_STREAMING_COMPATIBLE { LoopUnroll2 loop{width * src_rows.channels(), SourceVecTraits::num_lanes()}; - loop.unroll_once([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + loop.unroll_once([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg_all = SourceVecTraits::svptrue(); vertical_vector_path(pg_all, src_rows, dst_rows, border_offsets, index); }); loop.remaining( - [&](size_t index, size_t length) INTRINSICCV_STREAMING_COMPATIBLE { + [&](size_t index, size_t length) KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg = SourceVecTraits::svwhilelt(index, length); vertical_vector_path(pg, src_rows, dst_rows, border_offsets, index); }); @@ -691,21 +688,21 @@ class SeparableFilter { void process_horizontal(size_t width, Rows src_rows, Rows dst_rows, BorderOffsets border_offsets) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg_all = BufferVecTraits::svptrue(); LoopUnroll2 loop{width * src_rows.channels(), BufferVecTraits::num_lanes()}; - loop.unroll_twice([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + loop.unroll_twice([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { horizontal_vector_path_2x(pg_all, src_rows, dst_rows, border_offsets, index); }); - loop.unroll_once([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + loop.unroll_once([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { horizontal_vector_path(pg_all, src_rows, dst_rows, border_offsets, index); }); loop.remaining( - [&](size_t index, size_t length) INTRINSICCV_STREAMING_COMPATIBLE { + [&](size_t index, size_t length) KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg = BufferVecTraits::svwhilelt(index, length); horizontal_vector_path(pg, src_rows, dst_rows, border_offsets, index); }); @@ -715,7 +712,7 @@ class SeparableFilter { // change for each and every element in the border. void process_horizontal_borders( Rows src_rows, Rows dst_rows, - BorderOffsets border_offsets) const INTRINSICCV_STREAMING_COMPATIBLE { + BorderOffsets border_offsets) const KLEIDICV_STREAMING_COMPATIBLE { for (size_t index = 0; index < src_rows.channels(); ++index) { disable_loop_vectorization(); process_horizontal_border(src_rows, dst_rows, border_offsets, index); @@ -725,8 +722,8 @@ class SeparableFilter { private: void vertical_vector_path(svbool_t pg, Rows src_rows, Rows dst_rows, - BorderOffsets border_offsets, size_t index) const - INTRINSICCV_STREAMING_COMPATIBLE { + BorderOffsets border_offsets, + size_t index) const KLEIDICV_STREAMING_COMPATIBLE { SourceVectorType src_0 = svld1(pg, &src_rows.at(border_offsets.c0())[index]); SourceVectorType src_1 = @@ -744,7 +741,7 @@ class SeparableFilter { void horizontal_vector_path_2x( svbool_t pg, Rows src_rows, Rows dst_rows, BorderOffsets border_offsets, - size_t index) const INTRINSICCV_STREAMING_COMPATIBLE { + size_t index) const KLEIDICV_STREAMING_COMPATIBLE { auto src_0 = &src_rows.at(0, border_offsets.c0())[index]; auto src_1 = &src_rows.at(0, border_offsets.c1())[index]; auto src_2 = &src_rows.at(0, border_offsets.c2())[index]; @@ -772,7 +769,7 @@ class SeparableFilter { void horizontal_vector_path(svbool_t pg, Rows src_rows, Rows dst_rows, BorderOffsets border_offsets, size_t index) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { BufferVectorType src_0 = svld1(pg, &src_rows.at(0, border_offsets.c0())[index]); BufferVectorType src_1 = @@ -790,7 +787,7 @@ class SeparableFilter { void process_horizontal_border( Rows src_rows, Rows dst_rows, BorderOffsets border_offsets, - size_t index) const INTRINSICCV_STREAMING_COMPATIBLE { + size_t index) const KLEIDICV_STREAMING_COMPATIBLE { BufferType src[5]; src[0] = src_rows.at(0, border_offsets.c0())[index]; src[1] = src_rows.at(0, border_offsets.c1())[index]; @@ -814,12 +811,12 @@ using SeparableFilter5x5 = SeparableFilter; // Swap two variables, since some C++ Standard Library implementations do not // allow using std::swap for SVE vectors. template -static inline void swap_scalable(T &a, T &b) INTRINSICCV_STREAMING_COMPATIBLE { +static inline void swap_scalable(T &a, T &b) KLEIDICV_STREAMING_COMPATIBLE { T tmp = a; a = b; b = tmp; } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_SVE2_H +#endif // KLEIDICV_SVE2_H diff --git a/intrinsiccv/include/intrinsiccv/traits.h b/intrinsiccv/include/intrinsiccv/traits.h index 2a32ebc9b..0102f4770 100644 --- a/intrinsiccv/include/intrinsiccv/traits.h +++ b/intrinsiccv/include/intrinsiccv/traits.h @@ -2,14 +2,14 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_TYPE_TRAITS_H -#define INTRINSICCV_TYPE_TRAITS_H +#ifndef KLEIDICV_TYPE_TRAITS_H +#define KLEIDICV_TYPE_TRAITS_H #include #include "intrinsiccv/config.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { // An empty class. class Monostate {}; @@ -17,10 +17,10 @@ class Monostate {}; template class remove_streaming_compatible; -#if INTRINSICCV_TARGET_SME2 +#if KLEIDICV_TARGET_SME2 template class remove_streaming_compatible { + KLEIDICV_STREAMING_COMPATIBLE> { public: using type = Ret (Impl::*)(Args...); }; @@ -200,6 +200,6 @@ class NonCopyable { NonCopyable &operator=(const NonCopyable &) = delete; }; // end of class NonCopyable -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_TYPE_TRAITS_H +#endif // KLEIDICV_TYPE_TRAITS_H diff --git a/intrinsiccv/include/intrinsiccv/types.h b/intrinsiccv/include/intrinsiccv/types.h index 829f921f6..2d3e1bfc1 100644 --- a/intrinsiccv/include/intrinsiccv/types.h +++ b/intrinsiccv/include/intrinsiccv/types.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_TYPES_H -#define INTRINSICCV_TYPES_H +#ifndef KLEIDICV_TYPES_H +#define KLEIDICV_TYPES_H #include #include @@ -13,16 +13,16 @@ #include "intrinsiccv/ctypes.h" #include "intrinsiccv/utils.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { // Represents a point on a 2D plane. class Point final { public: - explicit Point(size_t x, size_t y) INTRINSICCV_STREAMING_COMPATIBLE : x_{x}, - y_{y} {} + explicit Point(size_t x, size_t y) KLEIDICV_STREAMING_COMPATIBLE : x_{x}, + y_{y} {} - size_t x() const INTRINSICCV_STREAMING_COMPATIBLE { return x_; } - size_t y() const INTRINSICCV_STREAMING_COMPATIBLE { return y_; } + size_t x() const KLEIDICV_STREAMING_COMPATIBLE { return x_; } + size_t y() const KLEIDICV_STREAMING_COMPATIBLE { return y_; } private: size_t x_; @@ -32,33 +32,32 @@ class Point final { // Represents an area given by its width and height. class Rectangle final { public: - explicit Rectangle(size_t width, - size_t height) INTRINSICCV_STREAMING_COMPATIBLE + explicit Rectangle(size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE : width_(width), height_(height) {} - explicit Rectangle(int width, int height) INTRINSICCV_STREAMING_COMPATIBLE + explicit Rectangle(int width, int height) KLEIDICV_STREAMING_COMPATIBLE : Rectangle(static_cast(width), static_cast(height)) {} - explicit Rectangle(intrinsiccv_rectangle_t rect) - INTRINSICCV_STREAMING_COMPATIBLE : Rectangle(rect.width, rect.height) {} + explicit Rectangle(intrinsiccv_rectangle_t rect) KLEIDICV_STREAMING_COMPATIBLE + : Rectangle(rect.width, rect.height) {} - size_t width() const INTRINSICCV_STREAMING_COMPATIBLE { return width_; } - size_t height() const INTRINSICCV_STREAMING_COMPATIBLE { return height_; } - size_t area() const INTRINSICCV_STREAMING_COMPATIBLE { + size_t width() const KLEIDICV_STREAMING_COMPATIBLE { return width_; } + size_t height() const KLEIDICV_STREAMING_COMPATIBLE { return height_; } + size_t area() const KLEIDICV_STREAMING_COMPATIBLE { return width() * height(); } - void flatten() INTRINSICCV_STREAMING_COMPATIBLE { + void flatten() KLEIDICV_STREAMING_COMPATIBLE { width_ = area(); height_ = 1; } - bool operator==(const Rectangle &rhs) const INTRINSICCV_STREAMING_COMPATIBLE { + bool operator==(const Rectangle &rhs) const KLEIDICV_STREAMING_COMPATIBLE { return width() == rhs.width() && height() == rhs.height(); } - bool operator!=(const Rectangle &rhs) const INTRINSICCV_STREAMING_COMPATIBLE { + bool operator!=(const Rectangle &rhs) const KLEIDICV_STREAMING_COMPATIBLE { return !operator==(rhs); } @@ -71,32 +70,31 @@ class Rectangle final { class Margin final { public: explicit constexpr Margin(size_t left, size_t top, size_t right, - size_t bottom) INTRINSICCV_STREAMING_COMPATIBLE + size_t bottom) KLEIDICV_STREAMING_COMPATIBLE : left_(left), top_(top), right_(right), bottom_(bottom) {} - explicit constexpr Margin(size_t margin) INTRINSICCV_STREAMING_COMPATIBLE + explicit constexpr Margin(size_t margin) KLEIDICV_STREAMING_COMPATIBLE : left_(margin), top_(margin), right_(margin), bottom_(margin) {} explicit Margin(intrinsiccv_rectangle_t kernel, - intrinsiccv_point_t anchor) INTRINSICCV_STREAMING_COMPATIBLE + intrinsiccv_point_t anchor) KLEIDICV_STREAMING_COMPATIBLE : Margin(anchor.x, anchor.y, kernel.width - anchor.x - 1, kernel.height - anchor.y - 1) {} - explicit Margin(Rectangle kernel, - Point anchor) INTRINSICCV_STREAMING_COMPATIBLE + explicit Margin(Rectangle kernel, Point anchor) KLEIDICV_STREAMING_COMPATIBLE : Margin(anchor.x(), anchor.y(), kernel.width() - anchor.x() - 1, kernel.height() - anchor.y() - 1) {} - size_t left() const INTRINSICCV_STREAMING_COMPATIBLE { return left_; } - size_t top() const INTRINSICCV_STREAMING_COMPATIBLE { return top_; } - size_t right() const INTRINSICCV_STREAMING_COMPATIBLE { return right_; } - size_t bottom() const INTRINSICCV_STREAMING_COMPATIBLE { return bottom_; } + size_t left() const KLEIDICV_STREAMING_COMPATIBLE { return left_; } + size_t top() const KLEIDICV_STREAMING_COMPATIBLE { return top_; } + size_t right() const KLEIDICV_STREAMING_COMPATIBLE { return right_; } + size_t bottom() const KLEIDICV_STREAMING_COMPATIBLE { return bottom_; } private: size_t left_; @@ -109,24 +107,24 @@ class Margin final { template class Border final { public: - Border() INTRINSICCV_STREAMING_COMPATIBLE = default; + Border() KLEIDICV_STREAMING_COMPATIBLE = default; Border(double left, double top, double right, - double bottom) INTRINSICCV_STREAMING_COMPATIBLE + double bottom) KLEIDICV_STREAMING_COMPATIBLE : left_{saturating_cast(left)}, top_{saturating_cast(top)}, right_{saturating_cast(right)}, bottom_{saturating_cast(bottom)} {} explicit Border(intrinsiccv_border_values_t border_values) - INTRINSICCV_STREAMING_COMPATIBLE + KLEIDICV_STREAMING_COMPATIBLE : Border(border_values.left, border_values.top, border_values.right, border_values.bottom) {} - T left() const INTRINSICCV_STREAMING_COMPATIBLE { return left_; } - T top() const INTRINSICCV_STREAMING_COMPATIBLE { return top_; } - T right() const INTRINSICCV_STREAMING_COMPATIBLE { return right_; } - T bottom() const INTRINSICCV_STREAMING_COMPATIBLE { return bottom_; } + T left() const KLEIDICV_STREAMING_COMPATIBLE { return left_; } + T top() const KLEIDICV_STREAMING_COMPATIBLE { return top_; } + T right() const KLEIDICV_STREAMING_COMPATIBLE { return right_; } + T bottom() const KLEIDICV_STREAMING_COMPATIBLE { return bottom_; } private: T left_; @@ -139,50 +137,47 @@ class Border final { template class Columns final { public: - explicit Columns(T *ptr, size_t channels) INTRINSICCV_STREAMING_COMPATIBLE + explicit Columns(T *ptr, size_t channels) KLEIDICV_STREAMING_COMPATIBLE : ptr_{ptr}, channels_{channels} {} // Subscript operator to return an arbitrary column at an index. To account // for channel count use at() method. - T &operator[](ptrdiff_t index) INTRINSICCV_STREAMING_COMPATIBLE { + T &operator[](ptrdiff_t index) KLEIDICV_STREAMING_COMPATIBLE { return ptr_[index]; } // Addition assignment operator to step across the columns. - Columns &operator+=(ptrdiff_t diff) INTRINSICCV_STREAMING_COMPATIBLE { + Columns &operator+=(ptrdiff_t diff) KLEIDICV_STREAMING_COMPATIBLE { ptr_ += static_cast(channels()) * diff; return *this; } // Subtraction assignment operator to step across the columns. - Columns &operator-=(ptrdiff_t diff) INTRINSICCV_STREAMING_COMPATIBLE { + Columns &operator-=(ptrdiff_t diff) KLEIDICV_STREAMING_COMPATIBLE { ptr_ -= static_cast(channels()) * diff; return *this; } // Prefix increment operator to advance to the next column. - Columns &operator++() INTRINSICCV_STREAMING_COMPATIBLE { - return operator+=(1); - } + Columns &operator++() KLEIDICV_STREAMING_COMPATIBLE { return operator+=(1); } // NOLINTBEGIN(hicpp-explicit-conversions) // Implicit conversion operator from Columns to Columns. [[nodiscard]] operator Columns() const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return Columns{ptr_, channels()}; } // NOLINTEND(hicpp-explicit-conversions) // Returns a new instance at a given column. - [[nodiscard]] Columns at(ptrdiff_t column) - INTRINSICCV_STREAMING_COMPATIBLE { + [[nodiscard]] Columns at(ptrdiff_t column) KLEIDICV_STREAMING_COMPATIBLE { return Columns{&ptr_[column * static_cast(channels())], channels()}; } // Returns the number of channels in a row. - size_t channels() const INTRINSICCV_STREAMING_COMPATIBLE { return channels_; } + size_t channels() const KLEIDICV_STREAMING_COMPATIBLE { return channels_; } private: // Pointer to the current position. @@ -195,33 +190,34 @@ class Columns final { template class ParallelColumns final { public: - explicit ParallelColumns(Columns columns_0, Columns columns_1) - INTRINSICCV_STREAMING_COMPATIBLE : columns_{columns_0, columns_1} {} + explicit ParallelColumns(Columns columns_0, + Columns columns_1) KLEIDICV_STREAMING_COMPATIBLE + : columns_{columns_0, columns_1} {} // Addition assignment operator to step across the columns. - ParallelColumns &operator+=(ptrdiff_t diff) INTRINSICCV_STREAMING_COMPATIBLE { + ParallelColumns &operator+=(ptrdiff_t diff) KLEIDICV_STREAMING_COMPATIBLE { columns_[0] += diff; columns_[1] += diff; return *this; } // Subtraction assignment operator to navigate among rows. - ParallelColumns &operator-=(ptrdiff_t diff) INTRINSICCV_STREAMING_COMPATIBLE { + ParallelColumns &operator-=(ptrdiff_t diff) KLEIDICV_STREAMING_COMPATIBLE { return operator+=(-1 * diff); } // Prefix increment operator to advance to the next column. - ParallelColumns &operator++() INTRINSICCV_STREAMING_COMPATIBLE { + ParallelColumns &operator++() KLEIDICV_STREAMING_COMPATIBLE { return operator+=(1); } // Returns the columns belonging to the first row. - [[nodiscard]] Columns first() const INTRINSICCV_STREAMING_COMPATIBLE { + [[nodiscard]] Columns first() const KLEIDICV_STREAMING_COMPATIBLE { return columns_[0]; } // Returns the columns belonging to the second row. - [[nodiscard]] Columns second() const INTRINSICCV_STREAMING_COMPATIBLE { + [[nodiscard]] Columns second() const KLEIDICV_STREAMING_COMPATIBLE { return columns_[1]; } @@ -235,22 +231,22 @@ template class RowBase { public: // Returns the distance in bytes between two consecutive rows. - size_t stride() const INTRINSICCV_STREAMING_COMPATIBLE { return stride_; } + size_t stride() const KLEIDICV_STREAMING_COMPATIBLE { return stride_; } // Returns the number of channels in a row. - size_t channels() const INTRINSICCV_STREAMING_COMPATIBLE { return channels_; } + size_t channels() const KLEIDICV_STREAMING_COMPATIBLE { return channels_; } // Returns true if rows are continuous for a given length, otherwise false. - bool is_continuous(size_t length) const INTRINSICCV_STREAMING_COMPATIBLE { + bool is_continuous(size_t length) const KLEIDICV_STREAMING_COMPATIBLE { return stride() == (length * channels() * sizeof(T)); } // When handling multiple rows this switches to a single row in an // implementation defined way. - void make_single_row() const INTRINSICCV_STREAMING_COMPATIBLE {} + void make_single_row() const KLEIDICV_STREAMING_COMPATIBLE {} // Returns false if is_continuous() always returns false, otherwise true. - static constexpr bool maybe_continuous() INTRINSICCV_STREAMING_COMPATIBLE { + static constexpr bool maybe_continuous() KLEIDICV_STREAMING_COMPATIBLE { return true; } @@ -258,17 +254,17 @@ class RowBase { // TODO: default initialise members. // NOLINTBEGIN(hicpp-member-init) // The default constructor creates an uninitialized instance. - RowBase() INTRINSICCV_STREAMING_COMPATIBLE = default; + RowBase() KLEIDICV_STREAMING_COMPATIBLE = default; // NOLINTEND(hicpp-member-init) - RowBase(size_t stride, size_t channels) INTRINSICCV_STREAMING_COMPATIBLE + RowBase(size_t stride, size_t channels) KLEIDICV_STREAMING_COMPATIBLE : stride_(stride), channels_(channels) {} // Adds a stride to a pointer, and returns the new pointer. template [[nodiscard]] static P *add_stride(P *ptr, ptrdiff_t stride) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { uintptr_t intptr = reinterpret_cast(ptr); intptr += stride; // NOLINTBEGIN(performance-no-int-to-ptr) @@ -279,7 +275,7 @@ class RowBase { // Subtracts a stride to a pointer, and returns the new pointer. template [[nodiscard]] static P *subtract_stride(P *ptr, ptrdiff_t stride) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { uintptr_t intptr = reinterpret_cast(ptr); intptr -= stride; // NOLINTBEGIN(performance-no-int-to-ptr) @@ -304,57 +300,55 @@ class Rows final : public RowBase { using RowBase::stride; // The default constructor creates an uninitialized instance. - Rows() INTRINSICCV_STREAMING_COMPATIBLE : RowBase() {} + Rows() KLEIDICV_STREAMING_COMPATIBLE : RowBase() {} explicit Rows(T *ptr, size_t stride, - size_t channels) INTRINSICCV_STREAMING_COMPATIBLE + size_t channels) KLEIDICV_STREAMING_COMPATIBLE : RowBase(stride, channels), ptr_{ptr} {} - explicit Rows(T *ptr, size_t stride) INTRINSICCV_STREAMING_COMPATIBLE + explicit Rows(T *ptr, size_t stride) KLEIDICV_STREAMING_COMPATIBLE : Rows(ptr, stride, 1) {} - explicit Rows(T *ptr) INTRINSICCV_STREAMING_COMPATIBLE : Rows(ptr, 0, 0) {} + explicit Rows(T *ptr) KLEIDICV_STREAMING_COMPATIBLE : Rows(ptr, 0, 0) {} // Subscript operator to return an arbitrary position within the current row. // To account for stride and channel count use at() method. - T &operator[](ptrdiff_t index) INTRINSICCV_STREAMING_COMPATIBLE { + T &operator[](ptrdiff_t index) KLEIDICV_STREAMING_COMPATIBLE { return ptr_[index]; } // Addition assignment operator to navigate among rows. - Rows &operator+=(ptrdiff_t diff) INTRINSICCV_STREAMING_COMPATIBLE { + Rows &operator+=(ptrdiff_t diff) KLEIDICV_STREAMING_COMPATIBLE { ptr_ = get_pointer_at(diff); return *this; } // Prefix increment operator to advance to the next row. - Rows &operator++() INTRINSICCV_STREAMING_COMPATIBLE { - return operator+=(1); - } + Rows &operator++() KLEIDICV_STREAMING_COMPATIBLE { return operator+=(1); } // NOLINTBEGIN(hicpp-explicit-conversions) // Returns a const variant of this instance. - [[nodiscard]] operator Rows() INTRINSICCV_STREAMING_COMPATIBLE { + [[nodiscard]] operator Rows() KLEIDICV_STREAMING_COMPATIBLE { return Rows{ptr_, stride(), channels()}; } // NOLINTEND(hicpp-explicit-conversions) // Returns a new instance at a given row and column. - [[nodiscard]] Rows at(ptrdiff_t row, ptrdiff_t column = 0) - INTRINSICCV_STREAMING_COMPATIBLE { + [[nodiscard]] Rows at(ptrdiff_t row, + ptrdiff_t column = 0) KLEIDICV_STREAMING_COMPATIBLE { return Rows{get_pointer_at(row, column), stride(), channels()}; } // Returns a view on columns within the current row. - [[nodiscard]] Columns as_columns() const INTRINSICCV_STREAMING_COMPATIBLE { + [[nodiscard]] Columns as_columns() const KLEIDICV_STREAMING_COMPATIBLE { return Columns{ptr_, channels()}; } // Translates a logical one-dimensional element index into physical byte // offset for that element with a given row width. [[nodiscard]] size_t offset_for_index(size_t index, size_t width) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { size_t row = index / width; size_t column = index % width; return row * stride() + column * sizeof(T); @@ -364,7 +358,7 @@ class Rows final : public RowBase { // Returns a column in a row at a given index taking stride and channels into // account. [[nodiscard]] T *get_pointer_at(ptrdiff_t row, ptrdiff_t column = 0) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { T *ptr = RowBase::add_stride(ptr_, row * static_cast(stride())); return &ptr[column * static_cast(channels())]; @@ -383,15 +377,15 @@ class IndirectRows : public RowBase { using RowBase::stride; // The default constructor creates an uninitialized instance. - IndirectRows() INTRINSICCV_STREAMING_COMPATIBLE : RowBase() {} + IndirectRows() KLEIDICV_STREAMING_COMPATIBLE : RowBase() {} explicit IndirectRows(T **ptr_storage, size_t stride, - size_t channels) INTRINSICCV_STREAMING_COMPATIBLE + size_t channels) KLEIDICV_STREAMING_COMPATIBLE : RowBase(stride, channels), ptr_storage_(ptr_storage) {} explicit IndirectRows(T **ptr_storage, size_t depth, - Rows rows) INTRINSICCV_STREAMING_COMPATIBLE + Rows rows) KLEIDICV_STREAMING_COMPATIBLE : RowBase(rows.stride(), rows.channels()), ptr_storage_(ptr_storage) { for (size_t index = 0; index < depth; ++index) { @@ -401,30 +395,30 @@ class IndirectRows : public RowBase { // Subscript operator to return a position within the current row. To account // for stride and channel count use at() method. - T &operator[](ptrdiff_t index) INTRINSICCV_STREAMING_COMPATIBLE { + T &operator[](ptrdiff_t index) KLEIDICV_STREAMING_COMPATIBLE { return ptr_storage_[0][index]; } // Addition assignment operator to navigate among rows. - IndirectRows &operator+=(ptrdiff_t diff) INTRINSICCV_STREAMING_COMPATIBLE { + IndirectRows &operator+=(ptrdiff_t diff) KLEIDICV_STREAMING_COMPATIBLE { ptr_storage_ += diff; return *this; } // Prefix increment operator to advance to the next row. - IndirectRows &operator++() INTRINSICCV_STREAMING_COMPATIBLE { + IndirectRows &operator++() KLEIDICV_STREAMING_COMPATIBLE { return this->operator+=(1); } // Returns a new instance at a given row and column. - [[nodiscard]] Rows at(ptrdiff_t row, ptrdiff_t column = 0) - INTRINSICCV_STREAMING_COMPATIBLE { + [[nodiscard]] Rows at(ptrdiff_t row, + ptrdiff_t column = 0) KLEIDICV_STREAMING_COMPATIBLE { auto rows = Rows{ptr_storage_[row], stride(), channels()}; return rows.at(0, column); } // Returns a view on columns within the current row. - [[nodiscard]] Columns as_columns() const INTRINSICCV_STREAMING_COMPATIBLE { + [[nodiscard]] Columns as_columns() const KLEIDICV_STREAMING_COMPATIBLE { return Columns{ptr_storage_[0], channels()}; } @@ -442,9 +436,8 @@ class DoubleBufferedIndirectRows final : public IndirectRows { using IndirectRows::channels; using IndirectRows::stride; - explicit DoubleBufferedIndirectRows(T **ptr_storage, size_t depth, - Rows rows) - INTRINSICCV_STREAMING_COMPATIBLE + explicit DoubleBufferedIndirectRows( + T **ptr_storage, size_t depth, Rows rows) KLEIDICV_STREAMING_COMPATIBLE : IndirectRows(ptr_storage, 2 * depth, rows) { // Fill the second half of the pointer storage. for (size_t index = 0; index < 2 * depth; ++index) { @@ -456,17 +449,17 @@ class DoubleBufferedIndirectRows final : public IndirectRows { } // Swaps the double buffered indirect rows. - void swap() INTRINSICCV_STREAMING_COMPATIBLE { + void swap() KLEIDICV_STREAMING_COMPATIBLE { std::swap(db_ptr_storage_[0], db_ptr_storage_[1]); } // Retuns indirect rows where write is allowed. - [[nodiscard]] IndirectRows write_at() INTRINSICCV_STREAMING_COMPATIBLE { + [[nodiscard]] IndirectRows write_at() KLEIDICV_STREAMING_COMPATIBLE { return IndirectRows{db_ptr_storage_[0], stride(), channels()}; } // Retuns indirect rows where read is allowed. - [[nodiscard]] IndirectRows read_at() INTRINSICCV_STREAMING_COMPATIBLE { + [[nodiscard]] IndirectRows read_at() KLEIDICV_STREAMING_COMPATIBLE { return IndirectRows{db_ptr_storage_[1], stride(), channels()}; } @@ -484,37 +477,35 @@ class ParallelRows final : public RowBase { using RowBase::stride; explicit ParallelRows(T *ptr, size_t stride, - size_t channels) INTRINSICCV_STREAMING_COMPATIBLE + size_t channels) KLEIDICV_STREAMING_COMPATIBLE : RowBase(2 * stride, channels), ptrs_{ptr, RowBase::add_stride(ptr, stride)} {} - explicit ParallelRows(T *ptr, size_t stride) INTRINSICCV_STREAMING_COMPATIBLE + explicit ParallelRows(T *ptr, size_t stride) KLEIDICV_STREAMING_COMPATIBLE : ParallelRows(ptr, stride, 1) {} // Addition assignment operator to navigate among rows. - ParallelRows &operator+=(ptrdiff_t diff) INTRINSICCV_STREAMING_COMPATIBLE { + ParallelRows &operator+=(ptrdiff_t diff) KLEIDICV_STREAMING_COMPATIBLE { ptrs_[0] = RowBase::add_stride(ptrs_[0], diff * stride()); ptrs_[1] = RowBase::add_stride(ptrs_[1], diff * stride()); return *this; } // Prefix increment operator to advance to the next row. - ParallelRows &operator++() INTRINSICCV_STREAMING_COMPATIBLE { + ParallelRows &operator++() KLEIDICV_STREAMING_COMPATIBLE { return operator+=(1); } // Returns views on columns within the current rows. [[nodiscard]] ParallelColumns as_columns() const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { Columns columns_0{ptrs_[0], channels()}; Columns columns_1{ptrs_[1], channels()}; return ParallelColumns{columns_0, columns_1}; } // Instructs the logic to drop the second row. - void make_single_row() INTRINSICCV_STREAMING_COMPATIBLE { - ptrs_[1] = ptrs_[0]; - } + void make_single_row() KLEIDICV_STREAMING_COMPATIBLE { ptrs_[1] = ptrs_[0]; } private: // Pointers to the two parallel rows. @@ -523,7 +514,7 @@ class ParallelRows final : public RowBase { template void zip_rows(OperationType &operation, Rectangle rect, - RowTypes... rows) INTRINSICCV_STREAMING_COMPATIBLE { + RowTypes... rows) KLEIDICV_STREAMING_COMPATIBLE { // Unary left fold. Evaluates the expression for every part of the unexpanded // parameter pack 'rows'. if ((... && (rows.is_continuous(rect.width())))) { @@ -539,10 +530,10 @@ void zip_rows(OperationType &operation, Rectangle rect, template void zip_parallel_rows(OperationType &operation, Rectangle rect, - RowTypes... rows) INTRINSICCV_STREAMING_COMPATIBLE { + RowTypes... rows) KLEIDICV_STREAMING_COMPATIBLE { for (size_t row_index = 0; row_index < rect.height(); row_index += 2) { // Handle the last odd row in a special way. - if (INTRINSICCV_UNLIKELY(row_index == (rect.height() - 1))) { + if (KLEIDICV_UNLIKELY(row_index == (rect.height() - 1))) { ((rows.make_single_row(), ...)); } @@ -557,14 +548,14 @@ template class CopyRows final { public: void process_row(size_t length, Columns src, - Columns dst) INTRINSICCV_STREAMING_COMPATIBLE { + Columns dst) KLEIDICV_STREAMING_COMPATIBLE { memmove(static_cast(&dst[0]), static_cast(&src[0]), length * sizeof(T) * dst.channels()); } template static void copy_rows(Rectangle rect, S src, - D dst) INTRINSICCV_STREAMING_COMPATIBLE { + D dst) KLEIDICV_STREAMING_COMPATIBLE { CopyRows operation; zip_rows(operation, rect, src, dst); } @@ -575,13 +566,13 @@ template class CopyNonOverlappingRows final { public: void process_row(size_t length, Columns src, - Columns dst) INTRINSICCV_STREAMING_COMPATIBLE { + Columns dst) KLEIDICV_STREAMING_COMPATIBLE { memcpy(static_cast(&dst[0]), static_cast(&src[0]), length * sizeof(T) * dst.channels()); } static void copy_rows(Rectangle rect, Rows src, - Rows dst) INTRINSICCV_STREAMING_COMPATIBLE { + Rows dst) KLEIDICV_STREAMING_COMPATIBLE { CopyNonOverlappingRows operation; zip_rows(operation, rect, src, dst); } @@ -668,6 +659,6 @@ class RowsOverUniquePtr { std::unique_ptr data_; }; -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_TYPES_H +#endif // KLEIDICV_TYPES_H diff --git a/intrinsiccv/include/intrinsiccv/unsafe.h b/intrinsiccv/include/intrinsiccv/unsafe.h index dd9d4efc5..638be341a 100644 --- a/intrinsiccv/include/intrinsiccv/unsafe.h +++ b/intrinsiccv/include/intrinsiccv/unsafe.h @@ -9,8 +9,8 @@ // Mellon University. // ----------------------------------------------------------------------------- -#ifndef INTRINSICCV_INCLUDE_UNSAFE_H_ -#define INTRINSICCV_INCLUDE_UNSAFE_H_ +#ifndef KLEIDICV_INCLUDE_UNSAFE_H_ +#define KLEIDICV_INCLUDE_UNSAFE_H_ // Inclusion of standard library headers where the banned functions are // declared. @@ -73,4 +73,4 @@ #endif // __GNUC__ -#endif // INTRINSICCV_INCLUDE_UNSAFE_H_ +#endif // KLEIDICV_INCLUDE_UNSAFE_H_ diff --git a/intrinsiccv/include/intrinsiccv/utils.h b/intrinsiccv/include/intrinsiccv/utils.h index fb3a1ed66..05a6e1887 100644 --- a/intrinsiccv/include/intrinsiccv/utils.h +++ b/intrinsiccv/include/intrinsiccv/utils.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_UTILS_H -#define INTRINSICCV_UTILS_H +#ifndef KLEIDICV_UTILS_H +#define KLEIDICV_UTILS_H #include #include @@ -14,13 +14,13 @@ #include "intrinsiccv/ctypes.h" #include "intrinsiccv/traits.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { // Saturating cast from signed to unsigned type. template ::is_signed, bool> = true, std::enable_if_t::is_signed, bool> = true> -static U saturating_cast(S value) INTRINSICCV_STREAMING_COMPATIBLE { +static U saturating_cast(S value) KLEIDICV_STREAMING_COMPATIBLE { if (value > std::numeric_limits::max()) { return std::numeric_limits::max(); } @@ -36,7 +36,7 @@ template < typename SrcType, typename DstType, std::enable_if_t && std::is_unsigned_v, bool> = true> -static DstType saturating_cast(SrcType value) INTRINSICCV_STREAMING_COMPATIBLE { +static DstType saturating_cast(SrcType value) KLEIDICV_STREAMING_COMPATIBLE { return static_cast(value); } @@ -45,7 +45,7 @@ template < typename SrcType, typename DstType, std::enable_if_t && std::is_unsigned_v, bool> = true> -static DstType saturating_cast(SrcType value) INTRINSICCV_STREAMING_COMPATIBLE { +static DstType saturating_cast(SrcType value) KLEIDICV_STREAMING_COMPATIBLE { DstType max_value = std::numeric_limits::max(); if (value > static_cast(max_value)) { @@ -58,21 +58,19 @@ static DstType saturating_cast(SrcType value) INTRINSICCV_STREAMING_COMPATIBLE { // Rounding shift right. template static T rounding_shift_right(T value, - size_t shift) INTRINSICCV_STREAMING_COMPATIBLE { + size_t shift) KLEIDICV_STREAMING_COMPATIBLE { return (value + (1UL << (shift - 1))) >> shift; } // When placed in a loop, it effectively disables loop vectorization. -static inline void disable_loop_vectorization() - INTRINSICCV_STREAMING_COMPATIBLE { +static inline void disable_loop_vectorization() KLEIDICV_STREAMING_COMPATIBLE { __asm__(""); } // Helper class to unroll a loop as needed. class LoopUnroll final { public: - explicit LoopUnroll(size_t length, - size_t step) INTRINSICCV_STREAMING_COMPATIBLE + explicit LoopUnroll(size_t length, size_t step) KLEIDICV_STREAMING_COMPATIBLE : length_(length), step_(step), index_(0), @@ -81,21 +79,21 @@ class LoopUnroll final { // Loop unrolled four times. template LoopUnroll &unroll_four_times(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return unroll_n_times<4>(callback); } // Loop unrolled twice. template LoopUnroll &unroll_twice(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return unroll_n_times<2>(callback); } // Unrolls the loop twice, if enabled. template LoopUnroll &unroll_twice_if(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { if constexpr (Enable) { return unroll_twice(callback); } @@ -105,15 +103,14 @@ class LoopUnroll final { // Loop unrolled once. template - LoopUnroll &unroll_once(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + LoopUnroll &unroll_once(CallbackType callback) KLEIDICV_STREAMING_COMPATIBLE { return unroll_n_times<1>(callback); } // Unrolls the loop once, if enabled. template LoopUnroll &unroll_once_if(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { if constexpr (Enable) { return unroll_once(callback); } @@ -123,7 +120,7 @@ class LoopUnroll final { // Processes trailing data. template - LoopUnroll &tail(CallbackType callback) INTRINSICCV_STREAMING_COMPATIBLE { + LoopUnroll &tail(CallbackType callback) KLEIDICV_STREAMING_COMPATIBLE { for (index_ = 0; index_ < remaining_length(); ++index_) { disable_loop_vectorization(); callback(index_); @@ -135,8 +132,7 @@ class LoopUnroll final { // Processes all remaining data at once. template - LoopUnroll &remaining(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + LoopUnroll &remaining(CallbackType callback) KLEIDICV_STREAMING_COMPATIBLE { if (length_) { callback(length_, step_); length_ = 0; @@ -146,27 +142,27 @@ class LoopUnroll final { } // Returns true if there is nothing left to process. - bool empty() const INTRINSICCV_STREAMING_COMPATIBLE { return length_ == 0; } + bool empty() const KLEIDICV_STREAMING_COMPATIBLE { return length_ == 0; } // Returns the step value. - size_t step() const INTRINSICCV_STREAMING_COMPATIBLE { return step_; } + size_t step() const KLEIDICV_STREAMING_COMPATIBLE { return step_; } // Returns the remaining length. - size_t remaining_length() const INTRINSICCV_STREAMING_COMPATIBLE { + size_t remaining_length() const KLEIDICV_STREAMING_COMPATIBLE { return length_; } // Returns true if it is possible to avoid the tail loop. - bool can_avoid_tail() const INTRINSICCV_STREAMING_COMPATIBLE { + bool can_avoid_tail() const KLEIDICV_STREAMING_COMPATIBLE { return can_avoid_tail_; } // Instructs the loop logic to prepare to avoid the tail loop. - void avoid_tail() INTRINSICCV_STREAMING_COMPATIBLE { length_ = step(); } + void avoid_tail() KLEIDICV_STREAMING_COMPATIBLE { length_ = step(); } template LoopUnroll &unroll_n_times(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { const size_t step = UnrollFactor * step_; // In practice step will never be zero and we don't want to spend // instructions on checking that. @@ -186,12 +182,12 @@ class LoopUnroll final { // Instructs the loop logic to avoid the tail loop. template bool try_avoid_tail_loop(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { - if (INTRINSICCV_UNLIKELY(!can_avoid_tail_)) { + KLEIDICV_STREAMING_COMPATIBLE { + if (KLEIDICV_UNLIKELY(!can_avoid_tail_)) { return false; } - if (INTRINSICCV_UNLIKELY(!remaining_length())) { + if (KLEIDICV_UNLIKELY(!remaining_length())) { return false; } @@ -211,14 +207,13 @@ class LoopUnroll final { template class LoopUnroll2 final { public: - explicit LoopUnroll2(size_t length, - size_t step) INTRINSICCV_STREAMING_COMPATIBLE + explicit LoopUnroll2(size_t length, size_t step) KLEIDICV_STREAMING_COMPATIBLE : length_(length), step_(step), index_(0) {} explicit LoopUnroll2(size_t start_index, size_t length, - size_t step) INTRINSICCV_STREAMING_COMPATIBLE + size_t step) KLEIDICV_STREAMING_COMPATIBLE : length_(length), step_(step), index_(std::min(start_index, length)) {} @@ -226,21 +221,21 @@ class LoopUnroll2 final { // Loop unrolled four times. template LoopUnroll2 &unroll_four_times(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return unroll_n_times<4>(callback); } // Loop unrolled twice. template LoopUnroll2 &unroll_twice(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return unroll_n_times<2>(callback); } // Unrolls the loop twice, if enabled. template LoopUnroll2 &unroll_twice_if(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { if constexpr (Enable) { return unroll_twice(callback); } @@ -251,14 +246,14 @@ class LoopUnroll2 final { // Loop unrolled once. template LoopUnroll2 &unroll_once(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return unroll_n_times<1>(callback); } // Unrolls the loop once, if enabled. template LoopUnroll2 &unroll_once_if(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { if constexpr (Enable) { return unroll_once(callback); } @@ -268,7 +263,7 @@ class LoopUnroll2 final { // Processes trailing data. template - LoopUnroll2 &tail(CallbackType callback) INTRINSICCV_STREAMING_COMPATIBLE { + LoopUnroll2 &tail(CallbackType callback) KLEIDICV_STREAMING_COMPATIBLE { while (index_ < length_) { disable_loop_vectorization(); callback(index_++); @@ -279,8 +274,7 @@ class LoopUnroll2 final { // Processes all remaining data at once. template - LoopUnroll2 &remaining(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + LoopUnroll2 &remaining(CallbackType callback) KLEIDICV_STREAMING_COMPATIBLE { if (remaining_length()) { callback(index_, length_); index_ = length_; @@ -290,22 +284,20 @@ class LoopUnroll2 final { } // Returns true if there is nothing left to process. - bool empty() const INTRINSICCV_STREAMING_COMPATIBLE { - return length_ == index_; - } + bool empty() const KLEIDICV_STREAMING_COMPATIBLE { return length_ == index_; } // Returns the step value. - size_t step() const INTRINSICCV_STREAMING_COMPATIBLE { return step_; } + size_t step() const KLEIDICV_STREAMING_COMPATIBLE { return step_; } // Returns the remaining length. - size_t remaining_length() const INTRINSICCV_STREAMING_COMPATIBLE { + size_t remaining_length() const KLEIDICV_STREAMING_COMPATIBLE { return length_ - index_; } private: template LoopUnroll2 &unroll_n_times(CallbackType callback) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { const size_t n_step = UnrollFactor * step(); size_t max_index = index_ + (remaining_length() / n_step) * n_step; @@ -338,19 +330,19 @@ class LoopUnroll2 final { // Check whether any of the arguments are null pointers. template -bool any_null(Pointers... pointers) INTRINSICCV_STREAMING_COMPATIBLE { +bool any_null(Pointers... pointers) KLEIDICV_STREAMING_COMPATIBLE { return (... || (pointers == nullptr)); } -#define CHECK_POINTERS(...) \ - do { \ - if (INTRINSICCV_TARGET_NAMESPACE::any_null(__VA_ARGS__)) { \ - return INTRINSICCV_ERROR_NULL_POINTER; \ - } \ +#define CHECK_POINTERS(...) \ + do { \ + if (KLEIDICV_TARGET_NAMESPACE::any_null(__VA_ARGS__)) { \ + return KLEIDICV_ERROR_NULL_POINTER; \ + } \ } while (false) template -bool is_misaligned(Value v) INTRINSICCV_STREAMING_COMPATIBLE { +bool is_misaligned(Value v) KLEIDICV_STREAMING_COMPATIBLE { constexpr size_t kMask = alignof(AlignType) - 1; static_assert(kMask == 0b0001 || kMask == 0b0011 || kMask == 0b0111 || kMask == 0b1111); @@ -360,12 +352,12 @@ bool is_misaligned(Value v) INTRINSICCV_STREAMING_COMPATIBLE { // Return value aligned up to the next multiple of alignment // Assumes alignment is a power of two. template -T align_up(T value, size_t alignment) INTRINSICCV_STREAMING_COMPATIBLE { +T align_up(T value, size_t alignment) KLEIDICV_STREAMING_COMPATIBLE { return (value + alignment - 1) & ~(alignment - 1); } template -T *align_up(T *value, size_t alignment) INTRINSICCV_STREAMING_COMPATIBLE { +T *align_up(T *value, size_t alignment) KLEIDICV_STREAMING_COMPATIBLE { // NOLINTBEGIN(performance-no-int-to-ptr) return reinterpret_cast( align_up(reinterpret_cast(value), alignment)); @@ -375,42 +367,42 @@ T *align_up(T *value, size_t alignment) INTRINSICCV_STREAMING_COMPATIBLE { // Specialisation for when stride misalignment is possible. template std::enable_if_t check_pointer_and_stride( - T *pointer, size_t stride) INTRINSICCV_STREAMING_COMPATIBLE { + T *pointer, size_t stride) KLEIDICV_STREAMING_COMPATIBLE { if (pointer == nullptr) { - return INTRINSICCV_ERROR_NULL_POINTER; + return KLEIDICV_ERROR_NULL_POINTER; } if (is_misaligned(stride)) { - return INTRINSICCV_ERROR_ALIGNMENT; + return KLEIDICV_ERROR_ALIGNMENT; } - return INTRINSICCV_OK; + return KLEIDICV_OK; } // Specialisation for when stride misalignment is impossible. template std::enable_if_t check_pointer_and_stride( - T *pointer, size_t /*stride*/) INTRINSICCV_STREAMING_COMPATIBLE { + T *pointer, size_t /*stride*/) KLEIDICV_STREAMING_COMPATIBLE { if (pointer == nullptr) { - return INTRINSICCV_ERROR_NULL_POINTER; + return KLEIDICV_ERROR_NULL_POINTER; } - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define CHECK_POINTER_AND_STRIDE(pointer, stride) \ - do { \ - if (intrinsiccv_error_t ptr_stride_err = \ - INTRINSICCV_TARGET_NAMESPACE::check_pointer_and_stride(pointer, \ - stride)) { \ - return ptr_stride_err; \ - } \ +#define CHECK_POINTER_AND_STRIDE(pointer, stride) \ + do { \ + if (intrinsiccv_error_t ptr_stride_err = \ + KLEIDICV_TARGET_NAMESPACE::check_pointer_and_stride(pointer, \ + stride)) { \ + return ptr_stride_err; \ + } \ } while (false) -#define MAKE_POINTER_CHECK_ALIGNMENT(ElementType, name, from) \ - if constexpr (alignof(ElementType) > 1) { \ - if (INTRINSICCV_TARGET_NAMESPACE::is_misaligned( \ - reinterpret_cast(from))) { \ - return INTRINSICCV_ERROR_ALIGNMENT; \ - } \ - } \ +#define MAKE_POINTER_CHECK_ALIGNMENT(ElementType, name, from) \ + if constexpr (alignof(ElementType) > 1) { \ + if (KLEIDICV_TARGET_NAMESPACE::is_misaligned( \ + reinterpret_cast(from))) { \ + return KLEIDICV_ERROR_ALIGNMENT; \ + } \ + } \ ElementType *name = reinterpret_cast(from) // Check whether the image size is acceptable by limiting it. @@ -418,17 +410,17 @@ std::enable_if_t check_pointer_and_stride( do { \ size_t image_size = 0; \ if (__builtin_mul_overflow(width, height, &image_size)) { \ - return INTRINSICCV_ERROR_RANGE; \ + return KLEIDICV_ERROR_RANGE; \ } \ \ - if (image_size > INTRINSICCV_MAX_IMAGE_PIXELS) { \ - return INTRINSICCV_ERROR_RANGE; \ + if (image_size > KLEIDICV_MAX_IMAGE_PIXELS) { \ + return KLEIDICV_ERROR_RANGE; \ } \ } while (false) // Check whether the rectangle size is acceptable by limiting it. #define CHECK_RECTANGLE_SIZE(rect) CHECK_IMAGE_SIZE(rect.width, rect.height) -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_UTILS_H +#endif // KLEIDICV_UTILS_H diff --git a/intrinsiccv/include/intrinsiccv/workspace/borders.h b/intrinsiccv/include/intrinsiccv/workspace/borders.h index 857f86f47..ef0d285a7 100644 --- a/intrinsiccv/include/intrinsiccv/workspace/borders.h +++ b/intrinsiccv/include/intrinsiccv/workspace/borders.h @@ -2,14 +2,14 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_WORKSPACE_BORDERS_H -#define INTRINSICCV_WORKSPACE_BORDERS_H +#ifndef KLEIDICV_WORKSPACE_BORDERS_H +#define KLEIDICV_WORKSPACE_BORDERS_H #include #include "intrinsiccv/intrinsiccv.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { enum class FixedBorderType { REPLICATE, @@ -19,15 +19,15 @@ enum class FixedBorderType { }; inline std::optional get_fixed_border_type( - intrinsiccv_border_type_t border_type) INTRINSICCV_STREAMING_COMPATIBLE { + intrinsiccv_border_type_t border_type) KLEIDICV_STREAMING_COMPATIBLE { switch (border_type) { - case INTRINSICCV_BORDER_TYPE_REPLICATE: + case KLEIDICV_BORDER_TYPE_REPLICATE: return FixedBorderType::REPLICATE; - case INTRINSICCV_BORDER_TYPE_REFLECT: + case KLEIDICV_BORDER_TYPE_REFLECT: return FixedBorderType::REFLECT; - case INTRINSICCV_BORDER_TYPE_WRAP: + case KLEIDICV_BORDER_TYPE_WRAP: return FixedBorderType::WRAP; - case INTRINSICCV_BORDER_TYPE_REVERSE: + case KLEIDICV_BORDER_TYPE_REVERSE: return FixedBorderType::REVERSE; default: return std::optional(); @@ -65,7 +65,7 @@ class FixedBorderInfo final { // Retuns offsets for columns affected by left border. Offsets offsets_with_left_border(size_t /* column_index */) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { switch (border_type_) { case FixedBorderType::REPLICATE: case FixedBorderType::REFLECT: @@ -87,7 +87,7 @@ class FixedBorderInfo final { // Retuns offsets for columns affected by right border. Offsets offsets_with_right_border(size_t /* column_index */) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { switch (border_type_) { case FixedBorderType::REPLICATE: case FixedBorderType::REFLECT: @@ -109,7 +109,7 @@ class FixedBorderInfo final { // Retuns offsets for rows or columns affected by any border. Offsets offsets_with_border(size_t row_or_column_index) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { if (row_or_column_index == 0U) { // Rows and columns have the same offsets. return offsets_with_left_border(row_or_column_index); @@ -159,13 +159,13 @@ class FixedBorderInfo final { : height_(height), border_type_(border_type) {} // Retuns offsets without the influence of any border. - Offsets offsets_without_border() const INTRINSICCV_STREAMING_COMPATIBLE { + Offsets offsets_without_border() const KLEIDICV_STREAMING_COMPATIBLE { return get(-2, -1, 0, 1, 2); } // Retuns offsets for columns affected by left border. Offsets offsets_with_left_border(size_t column_index) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { switch (border_type_) { case FixedBorderType::REPLICATE: if (column_index == 0) { @@ -206,7 +206,7 @@ class FixedBorderInfo final { // Retuns offsets for columns affected by right border. Offsets offsets_with_right_border(size_t column_index) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { switch (border_type_) { case FixedBorderType::REPLICATE: if (column_index == (height_ - 2)) { @@ -247,7 +247,7 @@ class FixedBorderInfo final { // Retuns offsets for rows or columns affected by any border. Offsets offsets_with_border(size_t row_or_column_index) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { if (row_or_column_index <= 1U) { // Rows and columns have the same offsets. return offsets_with_left_border(row_or_column_index); @@ -262,7 +262,7 @@ class FixedBorderInfo final { private: // Takes care of static signed to unsigned casts. Offsets get(size_t o0, size_t o1, size_t o2, size_t o3, - size_t o4) const INTRINSICCV_STREAMING_COMPATIBLE { + size_t o4) const KLEIDICV_STREAMING_COMPATIBLE { return Offsets{o0, o1, o2, o3, o4}; } @@ -278,6 +278,6 @@ using FixedBorderInfo3x3 = FixedBorderInfo; template using FixedBorderInfo5x5 = FixedBorderInfo; -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_WORKSPACE_BORDERS_H +#endif // KLEIDICV_WORKSPACE_BORDERS_H diff --git a/intrinsiccv/include/intrinsiccv/workspace/separable.h b/intrinsiccv/include/intrinsiccv/workspace/separable.h index 4013cbf5b..fae62dda9 100644 --- a/intrinsiccv/include/intrinsiccv/workspace/separable.h +++ b/intrinsiccv/include/intrinsiccv/workspace/separable.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_WORKSPACE_SEPARABLE_H -#define INTRINSICCV_WORKSPACE_SEPARABLE_H +#ifndef KLEIDICV_WORKSPACE_SEPARABLE_H +#define KLEIDICV_WORKSPACE_SEPARABLE_H #include #include @@ -12,7 +12,7 @@ #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/types.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { // Forward declarations. class SeparableFilterWorkspace; @@ -21,7 +21,7 @@ class SeparableFilterWorkspace; class SeparableFilterWorkspaceDeleter { public: void operator()(SeparableFilterWorkspace *ptr) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { std::free(ptr); }; }; @@ -81,8 +81,7 @@ class SeparableFilterWorkspace final { // Creates a workspace on the heap. static Pointer create(Rectangle rect, size_t channels, - size_t buffer_type_size) - INTRINSICCV_STREAMING_COMPATIBLE { + size_t buffer_type_size) KLEIDICV_STREAMING_COMPATIBLE { size_t buffer_rows_width = buffer_type_size * rect.width(); // Adding more elements because of SVE, where interleaving stores are // governed by one predicate. For example, if a predicate requires 7 uint8_t @@ -126,7 +125,7 @@ class SeparableFilterWorkspace final { Rows src_rows, Rows dst_rows, size_t channels, typename FilterType::BorderType border_type, - FilterType filter) INTRINSICCV_STREAMING_COMPATIBLE { + FilterType filter) KLEIDICV_STREAMING_COMPATIBLE { // Border helper which calculates border offsets. typename FilterType::BorderInfoType vertical_border{rect.height(), border_type}; @@ -162,10 +161,10 @@ class SeparableFilterWorkspace final { Rows dst_rows, Margin margin, FilterType filter, typename FilterType::BorderInfoType horizontal_border) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { // Process data affected by left border. #ifdef __clang__ // GCC is unable to unroll the loop - INTRINSICCV_FORCE_LOOP_UNROLL + KLEIDICV_FORCE_LOOP_UNROLL #endif for (size_t horizontal_index = 0; horizontal_index < margin.left(); ++horizontal_index) { @@ -187,7 +186,7 @@ class SeparableFilterWorkspace final { // Process data affected by right border. #ifdef __clang__ // GCC is unable to unroll the loop - INTRINSICCV_FORCE_LOOP_UNROLL + KLEIDICV_FORCE_LOOP_UNROLL #endif for (size_t horizontal_index = 0; horizontal_index < margin.right(); ++horizontal_index) { @@ -208,9 +207,9 @@ class SeparableFilterWorkspace final { size_t buffer_type_size_; // Workspace area begins here. - uint8_t data_[0] INTRINSICCV_ATTR_ALIGNED(kAlignment); + uint8_t data_[0] KLEIDICV_ATTR_ALIGNED(kAlignment); }; // end of class SeparableFilterWorkspace -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_WORKSPACE_SEPARABLE_H +#endif // KLEIDICV_WORKSPACE_SEPARABLE_H diff --git a/intrinsiccv/src/analysis/canny_neon.cpp b/intrinsiccv/src/analysis/canny_neon.cpp index e733f8974..ba3f22145 100644 --- a/intrinsiccv/src/analysis/canny_neon.cpp +++ b/intrinsiccv/src/analysis/canny_neon.cpp @@ -6,7 +6,7 @@ #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/neon.h" -#if INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#if KLEIDICV_EXPERIMENTAL_FEATURE_CANNY namespace intrinsiccv::neon { @@ -237,7 +237,7 @@ T *remove_constant_pool_usage(T *ptr) { // bottom-left} and {left, right} neighbouring values as governed by the // associated directions. // -// If INTRINSICCV_CANNY_ALGORITHM_CONFORM_OPENCV is set to 1: +// If KLEIDICV_CANNY_ALGORITHM_CONFORM_OPENCV is set to 1: // - diagonal directions are swapped // - diagonal non-maxima-suppressions are calculated as: // curr > prev && curr > next @@ -258,7 +258,7 @@ static void directional_masking(const int16_t *prev_rows, static constexpr int8_t kIndices[4 * kNumLanesS8] = { /* Lane offsets holding 'lane number + VL' */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, -#if INTRINSICCV_CANNY_ALGORITHM_CONFORM_OPENCV +#if KLEIDICV_CANNY_ALGORITHM_CONFORM_OPENCV /* Table lookup indices for previous row */ 32, 32, -2, 2, 0, 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* Table lookup indices for next row */ @@ -318,7 +318,7 @@ static void directional_masking(const int16_t *prev_rows, // 2.1 tmp_indices_0 = vqtbl1q_s8(next_row_table, dir); -#if INTRINSICCV_CANNY_ALGORITHM_CONFORM_OPENCV +#if KLEIDICV_CANNY_ALGORITHM_CONFORM_OPENCV int8x16_t opencv_tmp_indices_0 = tmp_indices_0; #endif // 2.2 @@ -354,7 +354,7 @@ static void directional_masking(const int16_t *prev_rows, curr_row_by_directions = vreinterpretq_s16_s8(curr_row.val[1]); next_row_by_directions = vreinterpretq_s16_s8(next_row_by_dir); -#if INTRINSICCV_CANNY_ALGORITHM_CONFORM_OPENCV +#if KLEIDICV_CANNY_ALGORITHM_CONFORM_OPENCV // Reuse temporary indexing values from step 2.1 to saturating add one to // diagonal values in the next row. This works only because of the domain of // input values is restricted. @@ -472,7 +472,7 @@ static void perform_hysteresis(StrongEdgeStack &strong_edge_pixels, } } -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t canny_u8( +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t canny_u8( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, double low_threshold, double high_threshold) { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -485,17 +485,17 @@ INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t canny_u8( SobelBuffer horizontal_gradient{dst_rect}; SobelBuffer vertical_gradient{dst_rect}; if (!horizontal_gradient.data() || !vertical_gradient.data()) { - return INTRINSICCV_ERROR_ALLOCATION; + return KLEIDICV_ERROR_ALLOCATION; } MagnitudeBuffer magnitudes{horizontal_gradient.rect()}; if (!magnitudes.data()) { - return INTRINSICCV_ERROR_ALLOCATION; + return KLEIDICV_ERROR_ALLOCATION; } HysteresisBuffer hysteresis{horizontal_gradient.rect()}; if (!hysteresis.data()) { - return INTRINSICCV_ERROR_ALLOCATION; + return KLEIDICV_ERROR_ALLOCATION; } // Calculate horizontal dervatives using 3x3 Sobel operator. @@ -553,4 +553,4 @@ decltype(intrinsiccv::neon::canny_u8) *intrinsiccv_canny_u8 = } // extern "C" -#endif // INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#endif // KLEIDICV_EXPERIMENTAL_FEATURE_CANNY diff --git a/intrinsiccv/src/analysis/count_nonzeros_neon.cpp b/intrinsiccv/src/analysis/count_nonzeros_neon.cpp index 17bfa26b1..27f0d0a69 100644 --- a/intrinsiccv/src/analysis/count_nonzeros_neon.cpp +++ b/intrinsiccv/src/analysis/count_nonzeros_neon.cpp @@ -41,7 +41,7 @@ class CountNonZeros final : public UnrollTwice { }; // end of class CountNonZeros template -INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t count_nonzeros( +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t count_nonzeros( const T *src, size_t src_stride, size_t width, size_t height, size_t *count) { CHECK_POINTERS(count); @@ -55,7 +55,7 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t count_nonzeros( apply_block_operation_by_rows(operation, rect, src_rows); *count = operation.result(); - return INTRINSICCV_OK; + return KLEIDICV_OK; } } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/analysis/min_max_api.cpp b/intrinsiccv/src/analysis/min_max_api.cpp index 513fe4916..12d2ffcfb 100644 --- a/intrinsiccv/src/analysis/min_max_api.cpp +++ b/intrinsiccv/src/analysis/min_max_api.cpp @@ -27,18 +27,18 @@ namespace sme2 {} // namespace sme2 } // namespace intrinsiccv -#define INTRINSICCV_DEFINE_MINMAX_API(name, type) \ - INTRINSICCV_MULTIVERSION_C_API(name, &intrinsiccv::neon::min_max, \ - nullptr, nullptr) +#define KLEIDICV_DEFINE_MINMAX_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API(name, &intrinsiccv::neon::min_max, \ + nullptr, nullptr) -INTRINSICCV_DEFINE_MINMAX_API(intrinsiccv_min_max_u8, uint8_t); -INTRINSICCV_DEFINE_MINMAX_API(intrinsiccv_min_max_s8, int8_t); -INTRINSICCV_DEFINE_MINMAX_API(intrinsiccv_min_max_u16, uint16_t); -INTRINSICCV_DEFINE_MINMAX_API(intrinsiccv_min_max_s16, int16_t); -INTRINSICCV_DEFINE_MINMAX_API(intrinsiccv_min_max_s32, int32_t); +KLEIDICV_DEFINE_MINMAX_API(intrinsiccv_min_max_u8, uint8_t); +KLEIDICV_DEFINE_MINMAX_API(intrinsiccv_min_max_s8, int8_t); +KLEIDICV_DEFINE_MINMAX_API(intrinsiccv_min_max_u16, uint16_t); +KLEIDICV_DEFINE_MINMAX_API(intrinsiccv_min_max_s16, int16_t); +KLEIDICV_DEFINE_MINMAX_API(intrinsiccv_min_max_s32, int32_t); -#define INTRINSICCV_DEFINE_MINMAXLOC_API(name, type) \ - INTRINSICCV_MULTIVERSION_C_API(name, &intrinsiccv::neon::min_max_loc, \ - nullptr, nullptr) +#define KLEIDICV_DEFINE_MINMAXLOC_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API(name, &intrinsiccv::neon::min_max_loc, \ + nullptr, nullptr) -INTRINSICCV_DEFINE_MINMAXLOC_API(intrinsiccv_min_max_loc_u8, uint8_t); +KLEIDICV_DEFINE_MINMAXLOC_API(intrinsiccv_min_max_loc_u8, uint8_t); diff --git a/intrinsiccv/src/analysis/min_max_loc_neon.cpp b/intrinsiccv/src/analysis/min_max_loc_neon.cpp index 4c28b4b15..4f2c8869c 100644 --- a/intrinsiccv/src/analysis/min_max_loc_neon.cpp +++ b/intrinsiccv/src/analysis/min_max_loc_neon.cpp @@ -313,8 +313,8 @@ intrinsiccv_error_t min_max_loc(const ScalarType *src, size_t src_stride, CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_IMAGE_SIZE(width, height); - if (INTRINSICCV_UNLIKELY(width == 0 || height == 0)) { - return INTRINSICCV_ERROR_RANGE; + if (KLEIDICV_UNLIKELY(width == 0 || height == 0)) { + return KLEIDICV_ERROR_RANGE; } Rectangle rect{width, height}; @@ -328,14 +328,14 @@ intrinsiccv_error_t min_max_loc(const ScalarType *src, size_t src_stride, if (max_offset) { *max_offset = src_rows.offset_for_index(operation.max_index(), width); } - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t min_max_loc( \ - const type *src, size_t src_stride, size_t width, size_t height, \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t min_max_loc( \ + const type *src, size_t src_stride, size_t width, size_t height, \ size_t *min_offset, size_t *max_offset) -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/analysis/min_max_neon.cpp b/intrinsiccv/src/analysis/min_max_neon.cpp index 82af0e523..cf7f1f262 100644 --- a/intrinsiccv/src/analysis/min_max_neon.cpp +++ b/intrinsiccv/src/analysis/min_max_neon.cpp @@ -51,8 +51,8 @@ intrinsiccv_error_t min_max(const ScalarType *src, size_t src_stride, CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_IMAGE_SIZE(width, height); - if (INTRINSICCV_UNLIKELY(width == 0 || height == 0)) { - return INTRINSICCV_ERROR_RANGE; + if (KLEIDICV_UNLIKELY(width == 0 || height == 0)) { + return KLEIDICV_ERROR_RANGE; } Rectangle rect{width, height}; @@ -65,18 +65,18 @@ intrinsiccv_error_t min_max(const ScalarType *src, size_t src_stride, if (max_value) { *max_value = operation.get_max(); } - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t min_max( \ - const type *src, size_t src_stride, size_t width, size_t height, \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t min_max( \ + const type *src, size_t src_stride, size_t width, size_t height, \ type *min_value, type *max_value) -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/arithmetics/absdiff_api.cpp b/intrinsiccv/src/arithmetics/absdiff_api.cpp index 86fa56fc4..8848faab7 100644 --- a/intrinsiccv/src/arithmetics/absdiff_api.cpp +++ b/intrinsiccv/src/arithmetics/absdiff_api.cpp @@ -39,14 +39,14 @@ intrinsiccv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, } // namespace intrinsiccv -#define INTRINSICCV_DEFINE_C_API(name, type) \ - INTRINSICCV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::saturating_absdiff, \ - INTRINSICCV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_absdiff), \ +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &intrinsiccv::neon::saturating_absdiff, \ + KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_absdiff), \ &intrinsiccv::sme2::saturating_absdiff) -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_absdiff_u8, uint8_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_absdiff_s8, int8_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_absdiff_u16, uint16_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_absdiff_s16, int16_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_absdiff_s32, int32_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_absdiff_u8, uint8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_absdiff_s8, int8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_absdiff_u16, uint16_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_absdiff_s16, int16_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_absdiff_s32, int32_t); diff --git a/intrinsiccv/src/arithmetics/absdiff_neon.cpp b/intrinsiccv/src/arithmetics/absdiff_neon.cpp index 43d3e7cd8..494a12c55 100644 --- a/intrinsiccv/src/arithmetics/absdiff_neon.cpp +++ b/intrinsiccv/src/arithmetics/absdiff_neon.cpp @@ -52,19 +52,19 @@ intrinsiccv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, Rows dst_rows{dst, dst_stride}; neon::apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ saturating_absdiff(const type *src_a, size_t src_a_stride, \ const type *src_b, size_t src_b_stride, type *dst, \ size_t dst_stride, size_t width, size_t height) -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/arithmetics/absdiff_sme2.cpp b/intrinsiccv/src/arithmetics/absdiff_sme2.cpp index d59c8a1f5..1a4d6568b 100644 --- a/intrinsiccv/src/arithmetics/absdiff_sme2.cpp +++ b/intrinsiccv/src/arithmetics/absdiff_sme2.cpp @@ -10,7 +10,7 @@ namespace intrinsiccv::sme2 { template ::value, bool> = true> VectorType vector_path_impl(svbool_t pg, VectorType src_a, - VectorType src_b) INTRINSICCV_STREAMING_COMPATIBLE { + VectorType src_b) KLEIDICV_STREAMING_COMPATIBLE { // Results of SABD may be outside the signed range so use two // saturating instructions instead. return svqabs_x(pg, svqsub_m(pg, src_a, src_b)); @@ -19,7 +19,7 @@ VectorType vector_path_impl(svbool_t pg, VectorType src_a, template ::value, bool> = true> VectorType vector_path_impl(svbool_t pg, VectorType src_a, - VectorType src_b) INTRINSICCV_STREAMING_COMPATIBLE { + VectorType src_b) KLEIDICV_STREAMING_COMPATIBLE { return svabd_m(pg, src_a, src_b); } @@ -27,17 +27,17 @@ template class SaturatingAbsDiff final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; VectorType vector_path(ContextType ctx, VectorType src_a, - VectorType src_b) INTRINSICCV_STREAMING_COMPATIBLE { + VectorType src_b) KLEIDICV_STREAMING_COMPATIBLE { return vector_path_impl(ctx.predicate(), src_a, src_b); } }; // end of class SaturatingAbsDiff template -INTRINSICCV_LOCALLY_STREAMING intrinsiccv_error_t saturating_absdiff( +KLEIDICV_LOCALLY_STREAMING intrinsiccv_error_t saturating_absdiff( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); @@ -51,19 +51,19 @@ INTRINSICCV_LOCALLY_STREAMING intrinsiccv_error_t saturating_absdiff( Rows src_b_rows{src_b, src_b_stride}; Rows dst_rows{dst, dst_stride}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ saturating_absdiff(const type *src_a, size_t src_a_stride, \ const type *src_b, size_t src_b_stride, type *dst, \ size_t dst_stride, size_t width, size_t height) -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); } // namespace intrinsiccv::sme2 diff --git a/intrinsiccv/src/arithmetics/absdiff_sve2.cpp b/intrinsiccv/src/arithmetics/absdiff_sve2.cpp index 185d14465..973761823 100644 --- a/intrinsiccv/src/arithmetics/absdiff_sve2.cpp +++ b/intrinsiccv/src/arithmetics/absdiff_sve2.cpp @@ -25,7 +25,7 @@ template class SaturatingAbsDiff final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; VectorType vector_path(ContextType ctx, VectorType src_a, VectorType src_b) { @@ -49,19 +49,19 @@ intrinsiccv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, Rows src_b_rows{src_b, src_b_stride}; Rows dst_rows{dst, dst_stride}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ saturating_absdiff(const type *src_a, size_t src_a_stride, \ const type *src_b, size_t src_b_stride, type *dst, \ size_t dst_stride, size_t width, size_t height) -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); } // namespace intrinsiccv::sve2 diff --git a/intrinsiccv/src/arithmetics/add_abs_with_threshold_api.cpp b/intrinsiccv/src/arithmetics/add_abs_with_threshold_api.cpp index d9bc53e77..b6dca9409 100644 --- a/intrinsiccv/src/arithmetics/add_abs_with_threshold_api.cpp +++ b/intrinsiccv/src/arithmetics/add_abs_with_threshold_api.cpp @@ -34,12 +34,12 @@ intrinsiccv_error_t saturating_add_abs_with_threshold( } // namespace intrinsiccv -#define INTRINSICCV_DEFINE_C_API(name, type) \ - INTRINSICCV_MULTIVERSION_C_API( \ +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ name, &intrinsiccv::neon::saturating_add_abs_with_threshold, \ - INTRINSICCV_SVE2_IMPL_IF( \ + KLEIDICV_SVE2_IMPL_IF( \ &intrinsiccv::sve2::saturating_add_abs_with_threshold), \ &intrinsiccv::sme2::saturating_add_abs_with_threshold) -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_add_abs_with_threshold_s16, - int16_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_abs_with_threshold_s16, + int16_t); diff --git a/intrinsiccv/src/arithmetics/add_abs_with_threshold_neon.cpp b/intrinsiccv/src/arithmetics/add_abs_with_threshold_neon.cpp index 8f67f467d..9f1a9f54e 100644 --- a/intrinsiccv/src/arithmetics/add_abs_with_threshold_neon.cpp +++ b/intrinsiccv/src/arithmetics/add_abs_with_threshold_neon.cpp @@ -63,16 +63,16 @@ intrinsiccv_error_t saturating_add_abs_with_threshold( Rows src_b_rows{src_b, src_b_stride}; Rows dst_rows{dst, dst_stride}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ saturating_add_abs_with_threshold( \ const type *src_a, size_t src_a_stride, const type *src_b, \ size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ size_t height, type threshold) -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sc.h b/intrinsiccv/src/arithmetics/add_abs_with_threshold_sc.h index d188db244..3e55c567d 100644 --- a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sc.h +++ b/intrinsiccv/src/arithmetics/add_abs_with_threshold_sc.h @@ -2,28 +2,28 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_SATURATING_ADD_ABS_WITH_THRESHOLD_SC_H -#define INTRINSICCV_SATURATING_ADD_ABS_WITH_THRESHOLD_SC_H +#ifndef KLEIDICV_SATURATING_ADD_ABS_WITH_THRESHOLD_SC_H +#define KLEIDICV_SATURATING_ADD_ABS_WITH_THRESHOLD_SC_H #include #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/sve2.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { template class SaturatingAddAbsWithThreshold final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; explicit SaturatingAddAbsWithThreshold(ScalarType threshold) - INTRINSICCV_STREAMING_COMPATIBLE : threshold_(threshold) {} + KLEIDICV_STREAMING_COMPATIBLE : threshold_(threshold) {} VectorType vector_path(ContextType ctx, VectorType src_a, - VectorType src_b) INTRINSICCV_STREAMING_COMPATIBLE { + VectorType src_b) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); VectorType add_abs = svqadd_x(pg, svqabs_x(pg, src_a), svqabs_x(pg, src_b)); svbool_t predicate = svcmpgt(pg, add_abs, threshold_); @@ -38,7 +38,7 @@ template intrinsiccv_error_t saturating_add_abs_with_threshold_sc( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height, - T threshold) INTRINSICCV_STREAMING_COMPATIBLE { + T threshold) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -50,9 +50,9 @@ intrinsiccv_error_t saturating_add_abs_with_threshold_sc( Rows src_b_rows{src_b, src_b_stride}; Rows dst_rows{dst, dst_stride}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_SATURATING_ADD_ABS_WITH_THRESHOLD_SC_H +#endif // KLEIDICV_SATURATING_ADD_ABS_WITH_THRESHOLD_SC_H diff --git a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sme2.cpp b/intrinsiccv/src/arithmetics/add_abs_with_threshold_sme2.cpp index a8e5636a3..dff653140 100644 --- a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sme2.cpp +++ b/intrinsiccv/src/arithmetics/add_abs_with_threshold_sme2.cpp @@ -7,7 +7,7 @@ namespace intrinsiccv::sme2 { template -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_add_abs_with_threshold(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, @@ -17,13 +17,13 @@ saturating_add_abs_with_threshold(const T *src_a, size_t src_a_stride, width, height, threshold); } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ saturating_add_abs_with_threshold( \ const type *src_a, size_t src_a_stride, const type *src_b, \ size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ size_t height, type threshold) -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); } // namespace intrinsiccv::sme2 diff --git a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sve2.cpp b/intrinsiccv/src/arithmetics/add_abs_with_threshold_sve2.cpp index 7779c8541..87204191d 100644 --- a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sve2.cpp +++ b/intrinsiccv/src/arithmetics/add_abs_with_threshold_sve2.cpp @@ -7,23 +7,21 @@ namespace intrinsiccv::sve2 { template -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t -saturating_add_abs_with_threshold(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, T *dst, - size_t dst_stride, size_t width, - size_t height, T threshold) { +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_add_abs_with_threshold( + const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, + T *dst, size_t dst_stride, size_t width, size_t height, T threshold) { return saturating_add_abs_with_threshold_sc(src_a, src_a_stride, src_b, src_b_stride, dst, dst_stride, width, height, threshold); } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ saturating_add_abs_with_threshold( \ const type *src_a, size_t src_a_stride, const type *src_b, \ size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ size_t height, type threshold) -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); } // namespace intrinsiccv::sve2 diff --git a/intrinsiccv/src/arithmetics/add_api.cpp b/intrinsiccv/src/arithmetics/add_api.cpp index 355e065b0..0b0ebdeff 100644 --- a/intrinsiccv/src/arithmetics/add_api.cpp +++ b/intrinsiccv/src/arithmetics/add_api.cpp @@ -39,17 +39,17 @@ intrinsiccv_error_t saturating_add(const T *src_a, size_t src_a_stride, } // namespace intrinsiccv -#define INTRINSICCV_DEFINE_C_API(name, type) \ - INTRINSICCV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::saturating_add, \ - INTRINSICCV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_add), \ +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &intrinsiccv::neon::saturating_add, \ + KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_add), \ &intrinsiccv::sme2::saturating_add) -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_add_s8, int8_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_add_u8, uint8_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_add_s16, int16_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_add_u16, uint16_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_add_s32, int32_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_add_u32, uint32_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_add_s64, int64_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_add_u64, uint64_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_s8, int8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_u8, uint8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_s16, int16_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_u16, uint16_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_s32, int32_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_u32, uint32_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_s64, int64_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_u64, uint64_t); diff --git a/intrinsiccv/src/arithmetics/add_neon.cpp b/intrinsiccv/src/arithmetics/add_neon.cpp index c78ad5a89..ed98fa91d 100644 --- a/intrinsiccv/src/arithmetics/add_neon.cpp +++ b/intrinsiccv/src/arithmetics/add_neon.cpp @@ -50,22 +50,22 @@ intrinsiccv_error_t saturating_add(const T *src_a, size_t src_a_stride, Rows src_b_rows{src_b, src_b_stride}; Rows dst_rows{dst, dst_stride}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ - saturating_add(const type *src_a, size_t src_a_stride, \ - const type *src_b, size_t src_b_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height) +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_add( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ + size_t height) -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int64_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint64_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/arithmetics/add_sme2.cpp b/intrinsiccv/src/arithmetics/add_sme2.cpp index cdca993e4..ea3523ccd 100644 --- a/intrinsiccv/src/arithmetics/add_sme2.cpp +++ b/intrinsiccv/src/arithmetics/add_sme2.cpp @@ -13,17 +13,17 @@ template class SaturatingAdd final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; VectorType vector_path(ContextType ctx, VectorType src_a, - VectorType src_b) INTRINSICCV_STREAMING_COMPATIBLE { + VectorType src_b) KLEIDICV_STREAMING_COMPATIBLE { return svqadd_m(ctx.predicate(), src_a, src_b); } }; // end of class SaturatingAdd template -INTRINSICCV_LOCALLY_STREAMING intrinsiccv_error_t saturating_add( +KLEIDICV_LOCALLY_STREAMING intrinsiccv_error_t saturating_add( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); @@ -37,22 +37,22 @@ INTRINSICCV_LOCALLY_STREAMING intrinsiccv_error_t saturating_add( Rows src_b_rows{src_b, src_b_stride}; Rows dst_rows{dst, dst_stride}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ - saturating_add(const type *src_a, size_t src_a_stride, \ - const type *src_b, size_t src_b_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height) - -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int64_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint64_t); +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_add( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ + size_t height) + +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); } // namespace intrinsiccv::sme2 diff --git a/intrinsiccv/src/arithmetics/add_sve2.cpp b/intrinsiccv/src/arithmetics/add_sve2.cpp index 1309ea11a..9950130f0 100644 --- a/intrinsiccv/src/arithmetics/add_sve2.cpp +++ b/intrinsiccv/src/arithmetics/add_sve2.cpp @@ -13,7 +13,7 @@ template class SaturatingAdd final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; VectorType vector_path(ContextType ctx, VectorType src_a, VectorType src_b) { @@ -37,22 +37,22 @@ intrinsiccv_error_t saturating_add(const T *src_a, size_t src_a_stride, Rows src_b_rows{src_b, src_b_stride}; Rows dst_rows{dst, dst_stride}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ - saturating_add(const type *src_a, size_t src_a_stride, \ - const type *src_b, size_t src_b_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height) - -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int64_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint64_t); +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_add( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ + size_t height) + +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); } // namespace intrinsiccv::sve2 diff --git a/intrinsiccv/src/arithmetics/multiply_api.cpp b/intrinsiccv/src/arithmetics/multiply_api.cpp index d68b18afb..256c9fbf7 100644 --- a/intrinsiccv/src/arithmetics/multiply_api.cpp +++ b/intrinsiccv/src/arithmetics/multiply_api.cpp @@ -40,14 +40,14 @@ intrinsiccv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, } // namespace intrinsiccv -#define INTRINSICCV_DEFINE_C_API(name, type) \ - INTRINSICCV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::saturating_multiply, \ - INTRINSICCV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_multiply), \ +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &intrinsiccv::neon::saturating_multiply, \ + KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_multiply), \ nullptr) -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_multiply_u8, uint8_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_multiply_s8, int8_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_multiply_u16, uint16_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_multiply_s16, int16_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_multiply_s32, int32_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_multiply_u8, uint8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_multiply_s8, int8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_multiply_u16, uint16_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_multiply_s16, int16_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_multiply_s32, int32_t); diff --git a/intrinsiccv/src/arithmetics/multiply_neon.cpp b/intrinsiccv/src/arithmetics/multiply_neon.cpp index 431e13716..469b832c7 100644 --- a/intrinsiccv/src/arithmetics/multiply_neon.cpp +++ b/intrinsiccv/src/arithmetics/multiply_neon.cpp @@ -80,20 +80,20 @@ intrinsiccv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, Rows dst_rows{dst, dst_stride}; neon::apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ saturating_multiply(const type *src_a, size_t src_a_stride, \ const type *src_b, size_t src_b_stride, type *dst, \ size_t dst_stride, size_t width, size_t height, \ double scale) -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/arithmetics/multiply_sve2.cpp b/intrinsiccv/src/arithmetics/multiply_sve2.cpp index 1dda4eb90..b8a53767d 100644 --- a/intrinsiccv/src/arithmetics/multiply_sve2.cpp +++ b/intrinsiccv/src/arithmetics/multiply_sve2.cpp @@ -11,7 +11,7 @@ template class SaturatingMultiply final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; explicit SaturatingMultiply(double scale = 1.0) : scale_{scale} {}; @@ -57,20 +57,20 @@ intrinsiccv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, Rows src_b_rows{src_b, src_b_stride}; Rows dst_rows{dst, dst_stride}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ saturating_multiply(const type *src_a, size_t src_a_stride, \ const type *src_b, size_t src_b_stride, type *dst, \ size_t dst_stride, size_t width, size_t height, \ double scale) -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); } // namespace intrinsiccv::sve2 diff --git a/intrinsiccv/src/arithmetics/scale_api.cpp b/intrinsiccv/src/arithmetics/scale_api.cpp index 0af9b97be..77ffca7be 100644 --- a/intrinsiccv/src/arithmetics/scale_api.cpp +++ b/intrinsiccv/src/arithmetics/scale_api.cpp @@ -22,12 +22,12 @@ namespace sme2 {} // namespace sme2 } // namespace intrinsiccv -#define INTRINSICCV_DEFINE_SCALE_API(name, type) \ - INTRINSICCV_MULTIVERSION_C_API(name, &intrinsiccv::neon::scale, \ - nullptr, nullptr) - -INTRINSICCV_DEFINE_SCALE_API(intrinsiccv_scale_u8, uint8_t); -// INTRINSICCV_DEFINE_SCALE_API(intrinsiccv_scale_s8, int8_t); -// INTRINSICCV_DEFINE_SCALE_API(intrinsiccv_scale_u16, uint16_t); -// INTRINSICCV_DEFINE_SCALE_API(intrinsiccv_scale_s16, int16_t); -// INTRINSICCV_DEFINE_SCALE_API(intrinsiccv_scale_s32, int32_t); +#define KLEIDICV_DEFINE_SCALE_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API(name, &intrinsiccv::neon::scale, nullptr, \ + nullptr) + +KLEIDICV_DEFINE_SCALE_API(intrinsiccv_scale_u8, uint8_t); +// KLEIDICV_DEFINE_SCALE_API(intrinsiccv_scale_s8, int8_t); +// KLEIDICV_DEFINE_SCALE_API(intrinsiccv_scale_u16, uint16_t); +// KLEIDICV_DEFINE_SCALE_API(intrinsiccv_scale_s16, int16_t); +// KLEIDICV_DEFINE_SCALE_API(intrinsiccv_scale_s32, int32_t); diff --git a/intrinsiccv/src/arithmetics/scale_neon.cpp b/intrinsiccv/src/arithmetics/scale_neon.cpp index abc00b964..d14258f4b 100644 --- a/intrinsiccv/src/arithmetics/scale_neon.cpp +++ b/intrinsiccv/src/arithmetics/scale_neon.cpp @@ -189,18 +189,18 @@ intrinsiccv_error_t scale(const T *src, size_t src_stride, T *dst, ScaleTbx operation(scale, shift); apply_operation_by_rows(operation, rect, src_rows, dst_rows); } - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t scale( \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t scale( \ const type *src, size_t src_stride, type *dst, size_t dst_stride, \ size_t width, size_t height, float scale, float shift) -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -// INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -// INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -// INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -// INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +// KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +// KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +// KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +// KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/arithmetics/sub_api.cpp b/intrinsiccv/src/arithmetics/sub_api.cpp index 9b451636d..7bd0dc295 100644 --- a/intrinsiccv/src/arithmetics/sub_api.cpp +++ b/intrinsiccv/src/arithmetics/sub_api.cpp @@ -38,17 +38,17 @@ intrinsiccv_error_t saturating_sub(const T *src_a, size_t src_a_stride, } // namespace intrinsiccv -#define INTRINSICCV_DEFINE_C_API(name, type) \ - INTRINSICCV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::saturating_sub, \ - INTRINSICCV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_sub), \ +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &intrinsiccv::neon::saturating_sub, \ + KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_sub), \ &intrinsiccv::sme2::saturating_sub) -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_sub_s8, int8_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_sub_u8, uint8_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_sub_s16, int16_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_sub_u16, uint16_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_sub_s32, int32_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_sub_u32, uint32_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_sub_s64, int64_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_saturating_sub_u64, uint64_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_s8, int8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_u8, uint8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_s16, int16_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_u16, uint16_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_s32, int32_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_u32, uint32_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_s64, int64_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_u64, uint64_t); diff --git a/intrinsiccv/src/arithmetics/sub_neon.cpp b/intrinsiccv/src/arithmetics/sub_neon.cpp index 1310a28d1..e73fca6f3 100644 --- a/intrinsiccv/src/arithmetics/sub_neon.cpp +++ b/intrinsiccv/src/arithmetics/sub_neon.cpp @@ -50,22 +50,22 @@ intrinsiccv_error_t saturating_sub(const T *src_a, size_t src_a_stride, Rows src_b_rows{src_b, src_b_stride}; Rows dst_rows{dst, dst_stride}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ - saturating_sub(const type *src_a, size_t src_a_stride, \ - const type *src_b, size_t src_b_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height) +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_sub( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ + size_t height) -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int64_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint64_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/arithmetics/sub_sme2.cpp b/intrinsiccv/src/arithmetics/sub_sme2.cpp index b987fbfa4..c744765a2 100644 --- a/intrinsiccv/src/arithmetics/sub_sme2.cpp +++ b/intrinsiccv/src/arithmetics/sub_sme2.cpp @@ -13,17 +13,17 @@ template class SaturatingSub final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; VectorType vector_path(ContextType ctx, VectorType src_a, - VectorType src_b) INTRINSICCV_STREAMING_COMPATIBLE { + VectorType src_b) KLEIDICV_STREAMING_COMPATIBLE { return svqsub_m(ctx.predicate(), src_a, src_b); } }; // end of class SaturatingSub template -INTRINSICCV_LOCALLY_STREAMING intrinsiccv_error_t saturating_sub( +KLEIDICV_LOCALLY_STREAMING intrinsiccv_error_t saturating_sub( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); @@ -37,22 +37,22 @@ INTRINSICCV_LOCALLY_STREAMING intrinsiccv_error_t saturating_sub( Rows src_b_rows{src_b, src_b_stride}; Rows dst_rows{dst, dst_stride}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ - saturating_sub(const type *src_a, size_t src_a_stride, \ - const type *src_b, size_t src_b_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height) - -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int64_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint64_t); +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_sub( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ + size_t height) + +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); } // namespace intrinsiccv::sme2 diff --git a/intrinsiccv/src/arithmetics/sub_sve2.cpp b/intrinsiccv/src/arithmetics/sub_sve2.cpp index 312a92ac2..134df3d2f 100644 --- a/intrinsiccv/src/arithmetics/sub_sve2.cpp +++ b/intrinsiccv/src/arithmetics/sub_sve2.cpp @@ -13,7 +13,7 @@ template class SaturatingSub final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; VectorType vector_path(ContextType ctx, VectorType src_a, VectorType src_b) { @@ -37,22 +37,22 @@ intrinsiccv_error_t saturating_sub(const T *src_a, size_t src_a_stride, Rows src_b_rows{src_b, src_b_stride}; Rows dst_rows{dst, dst_stride}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ - saturating_sub(const type *src_a, size_t src_a_stride, \ - const type *src_b, size_t src_b_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height) - -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint16_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint32_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int64_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint64_t); +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_sub( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ + size_t height) + +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); } // namespace intrinsiccv::sve2 diff --git a/intrinsiccv/src/arithmetics/threshold_api.cpp b/intrinsiccv/src/arithmetics/threshold_api.cpp index f7e70fa68..ec4000d21 100644 --- a/intrinsiccv/src/arithmetics/threshold_api.cpp +++ b/intrinsiccv/src/arithmetics/threshold_api.cpp @@ -30,10 +30,10 @@ intrinsiccv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, } // namespace intrinsiccv -#define INTRINSICCV_DEFINE_C_API(name, type) \ - INTRINSICCV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::threshold_binary, \ - INTRINSICCV_SVE2_IMPL_IF(&intrinsiccv::sve2::threshold_binary), \ +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &intrinsiccv::neon::threshold_binary, \ + KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::threshold_binary), \ &intrinsiccv::sme2::threshold_binary) -INTRINSICCV_DEFINE_C_API(intrinsiccv_threshold_binary_u8, uint8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_threshold_binary_u8, uint8_t); diff --git a/intrinsiccv/src/arithmetics/threshold_neon.cpp b/intrinsiccv/src/arithmetics/threshold_neon.cpp index ceb8b0bb2..989bddead 100644 --- a/intrinsiccv/src/arithmetics/threshold_neon.cpp +++ b/intrinsiccv/src/arithmetics/threshold_neon.cpp @@ -50,15 +50,15 @@ intrinsiccv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, Rows dst_rows{dst, dst_stride}; BinaryThreshold operation{threshold, value}; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ threshold_binary(const type *src, size_t src_stride, type *dst, \ size_t dst_stride, size_t width, size_t height, \ type threshold, type value) -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/arithmetics/threshold_sc.h b/intrinsiccv/src/arithmetics/threshold_sc.h index 494a0f72a..a380eef17 100644 --- a/intrinsiccv/src/arithmetics/threshold_sc.h +++ b/intrinsiccv/src/arithmetics/threshold_sc.h @@ -2,28 +2,28 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_THRESHOLD_SC_H -#define INTRINSICCV_THRESHOLD_SC_H +#ifndef KLEIDICV_THRESHOLD_SC_H +#define KLEIDICV_THRESHOLD_SC_H #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/sve2.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { template class BinaryThreshold final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; BinaryThreshold(ScalarType threshold, - ScalarType value) INTRINSICCV_STREAMING_COMPATIBLE + ScalarType value) KLEIDICV_STREAMING_COMPATIBLE : threshold_(threshold), value_(value) {} VectorType vector_path(ContextType ctx, - VectorType src) INTRINSICCV_STREAMING_COMPATIBLE { + VectorType src) KLEIDICV_STREAMING_COMPATIBLE { svbool_t predicate = svcmpgt(ctx.predicate(), src, threshold_); return svsel_u8(predicate, svdup_u8(value_), svdup_u8(0)); } @@ -34,9 +34,10 @@ class BinaryThreshold final : public UnrollTwice { }; // end of class BinaryThreshold template -intrinsiccv_error_t threshold_binary_sc( - const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, - size_t height, T threshold, T value) INTRINSICCV_STREAMING_COMPATIBLE { +intrinsiccv_error_t threshold_binary_sc(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, + size_t height, T threshold, + T value) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -46,9 +47,9 @@ intrinsiccv_error_t threshold_binary_sc( Rows dst_rows{dst, dst_stride}; BinaryThreshold operation{threshold, value}; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_THRESHOLD_SC_H +#endif // KLEIDICV_THRESHOLD_SC_H diff --git a/intrinsiccv/src/arithmetics/threshold_sme2.cpp b/intrinsiccv/src/arithmetics/threshold_sme2.cpp index 768e272d7..5f17c5867 100644 --- a/intrinsiccv/src/arithmetics/threshold_sme2.cpp +++ b/intrinsiccv/src/arithmetics/threshold_sme2.cpp @@ -7,19 +7,19 @@ namespace intrinsiccv::sme2 { template -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold, T value) { return threshold_binary_sc(src, src_stride, dst, dst_stride, width, height, threshold, value); } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ threshold_binary(const type *src, size_t src_stride, type *dst, \ size_t dst_stride, size_t width, size_t height, \ type threshold, type value) -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); } // namespace intrinsiccv::sme2 diff --git a/intrinsiccv/src/arithmetics/threshold_sve2.cpp b/intrinsiccv/src/arithmetics/threshold_sve2.cpp index 0fb55bc60..24e2032b5 100644 --- a/intrinsiccv/src/arithmetics/threshold_sve2.cpp +++ b/intrinsiccv/src/arithmetics/threshold_sve2.cpp @@ -7,19 +7,19 @@ namespace intrinsiccv::sve2 { template -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold, T value) { return threshold_binary_sc(src, src_stride, dst, dst_stride, width, height, threshold, value); } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ threshold_binary(const type *src, size_t src_stride, type *dst, \ size_t dst_stride, size_t width, size_t height, \ type threshold, type value) -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); } // namespace intrinsiccv::sve2 diff --git a/intrinsiccv/src/arithmetics/transpose_api.cpp b/intrinsiccv/src/arithmetics/transpose_api.cpp index 7fab64663..925e05b13 100644 --- a/intrinsiccv/src/arithmetics/transpose_api.cpp +++ b/intrinsiccv/src/arithmetics/transpose_api.cpp @@ -6,5 +6,5 @@ #include "intrinsiccv/dispatch.h" #include "intrinsiccv/intrinsiccv.h" -INTRINSICCV_MULTIVERSION_C_API(intrinsiccv_transpose, - &intrinsiccv::neon::transpose, nullptr, nullptr); +KLEIDICV_MULTIVERSION_C_API(intrinsiccv_transpose, + &intrinsiccv::neon::transpose, nullptr, nullptr); diff --git a/intrinsiccv/src/arithmetics/transpose_neon.cpp b/intrinsiccv/src/arithmetics/transpose_neon.cpp index 90b903ef9..f8400ac4e 100644 --- a/intrinsiccv/src/arithmetics/transpose_neon.cpp +++ b/intrinsiccv/src/arithmetics/transpose_neon.cpp @@ -15,7 +15,7 @@ static void transpose_vectors_recursively(DstVectorType *dst_vectors, // order is halved at every recursive call, once it is 2 the recursion should // stop and the input data needs to be read. if constexpr (Order == 2) { - INTRINSICCV_FORCE_LOOP_UNROLL + KLEIDICV_FORCE_LOOP_UNROLL for (size_t index = 0; index < BufferSize; index += Order) { using SrcVectorType = typename VecTraits::VectorType; SrcVectorType src_vector[2]; @@ -39,9 +39,9 @@ static void transpose_vectors_recursively(DstVectorType *dst_vectors, constexpr size_t half_order = Order / 2; - INTRINSICCV_FORCE_LOOP_UNROLL + KLEIDICV_FORCE_LOOP_UNROLL for (size_t outer_i = 0; outer_i < BufferSize; outer_i += Order) { - INTRINSICCV_FORCE_LOOP_UNROLL + KLEIDICV_FORCE_LOOP_UNROLL for (size_t inner_i = 0; inner_i < half_order; ++inner_i) { dst_vectors[outer_i + inner_i] = vtrn1q(reinterpret_cast(input[outer_i + inner_i]), @@ -78,7 +78,7 @@ static void vector_path(Rows src_rows, transpose_vectors_recursively( trn_result_b64, src_rows); - INTRINSICCV_FORCE_LOOP_UNROLL + KLEIDICV_FORCE_LOOP_UNROLL for (size_t index = 0; index < buffer_size; ++index) { vst1q(&dst_rows.at(index)[0], trn_result_b64[index]); } @@ -126,7 +126,7 @@ static intrinsiccv_error_t transpose(Rectangle rect, scalar_path(src_rows.at(hindex), dst_rows.at(0, hindex), final_hindex - hindex, rect.width()); }); - return INTRINSICCV_OK; + return KLEIDICV_OK; } template @@ -191,7 +191,7 @@ static intrinsiccv_error_t transpose(Rectangle rect, } } }); - return INTRINSICCV_OK; + return KLEIDICV_OK; } template @@ -210,7 +210,7 @@ static intrinsiccv_error_t transpose(const void *src_void, size_t src_stride, if (src == dst) { if (src_width != src_height) { // Inplace transpose only implemented if width and height are the same - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } return transpose(rect, dst_rows); } @@ -218,7 +218,7 @@ static intrinsiccv_error_t transpose(const void *src_void, size_t src_stride, return transpose(rect, src_rows, dst_rows); } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t transpose(const void *src, size_t src_stride, void *dst, size_t dst_stride, size_t src_width, size_t src_height, size_t element_size) { @@ -236,7 +236,7 @@ intrinsiccv_error_t transpose(const void *src, size_t src_stride, void *dst, return transpose(src, src_stride, dst, dst_stride, src_width, src_height); default: - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } } diff --git a/intrinsiccv/src/conversions/float_conv_api.cpp b/intrinsiccv/src/conversions/float_conv_api.cpp index 165fa72c3..08c3c9287 100644 --- a/intrinsiccv/src/conversions/float_conv_api.cpp +++ b/intrinsiccv/src/conversions/float_conv_api.cpp @@ -35,37 +35,37 @@ intrinsiccv_error_t float_conversion(const InputType* src, size_t src_stride, } // namespace sme2 -#ifdef INTRINSICCV_HAVE_SVE2 +#ifdef KLEIDICV_HAVE_SVE2 #define SVE2_FUNC_POINTER(name, itype, otype) \ [[maybe_unused]] static auto sve2_func_##itype##_##otype = \ intrinsiccv::sve2::float_conversion; #else #define SVE2_FUNC_POINTER(name, itype, otype) -#endif // INTRINSICCV_HAVE_SVE2 +#endif // KLEIDICV_HAVE_SVE2 -#ifdef INTRINSICCV_HAVE_SME2 +#ifdef KLEIDICV_HAVE_SME2 #define SME2_FUNC_POINTER(name, itype, otype) \ static auto sme2_func_##itype##_##otype = \ intrinsiccv::sme2::float_conversion; #else #define SME2_FUNC_POINTER(name, itype, otype) -#endif // INTRINSICCV_HAVE_SME2 +#endif // KLEIDICV_HAVE_SME2 // NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables) -#define INTRINSICCV_DEFINE_C_API(name, itype, otype) \ - static auto neon_func_##itype##_##otype = \ - intrinsiccv::neon::float_conversion; \ - SVE2_FUNC_POINTER(name, itype, otype); \ - SME2_FUNC_POINTER(name, itype, otype); \ - INTRINSICCV_MULTIVERSION_C_API( \ - name, neon_func_##itype##_##otype, \ - INTRINSICCV_SVE2_IMPL_IF(sve2_func_##itype##_##otype), \ +#define KLEIDICV_DEFINE_C_API(name, itype, otype) \ + static auto neon_func_##itype##_##otype = \ + intrinsiccv::neon::float_conversion; \ + SVE2_FUNC_POINTER(name, itype, otype); \ + SME2_FUNC_POINTER(name, itype, otype); \ + KLEIDICV_MULTIVERSION_C_API( \ + name, neon_func_##itype##_##otype, \ + KLEIDICV_SVE2_IMPL_IF(sve2_func_##itype##_##otype), \ sme2_func_##itype##_##otype) // NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables) -INTRINSICCV_DEFINE_C_API(intrinsiccv_float_conversion_f32_s8, float, int8_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_float_conversion_f32_u8, float, uint8_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_float_conversion_s8_f32, int8_t, float); -INTRINSICCV_DEFINE_C_API(intrinsiccv_float_conversion_u8_f32, uint8_t, float); +KLEIDICV_DEFINE_C_API(intrinsiccv_float_conversion_f32_s8, float, int8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_float_conversion_f32_u8, float, uint8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_float_conversion_s8_f32, int8_t, float); +KLEIDICV_DEFINE_C_API(intrinsiccv_float_conversion_u8_f32, uint8_t, float); } // namespace intrinsiccv diff --git a/intrinsiccv/src/conversions/float_conv_neon.cpp b/intrinsiccv/src/conversions/float_conv_neon.cpp index d500d8334..74448c719 100644 --- a/intrinsiccv/src/conversions/float_conv_neon.cpp +++ b/intrinsiccv/src/conversions/float_conv_neon.cpp @@ -10,18 +10,18 @@ namespace intrinsiccv::neon { template intrinsiccv_error_t float_conversion(const InputType*, size_t, OutputType*, size_t, size_t, size_t) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(itype, otype) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(itype, otype) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ float_conversion(const itype* src, size_t src_stride, \ otype* dst, size_t dst_stride, size_t width, \ size_t height) -INTRINSICCV_INSTANTIATE_TEMPLATE(float, int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(float, uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t, float); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t, float); +KLEIDICV_INSTANTIATE_TEMPLATE(float, int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(float, uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t, float); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t, float); } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/conversions/float_conv_sc.h b/intrinsiccv/src/conversions/float_conv_sc.h index b2190b0a2..bfb9bd919 100644 --- a/intrinsiccv/src/conversions/float_conv_sc.h +++ b/intrinsiccv/src/conversions/float_conv_sc.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_FLOAT_CONV_SC_H -#define INTRINSICCV_FLOAT_CONV_SC_H +#ifndef KLEIDICV_FLOAT_CONV_SC_H +#define KLEIDICV_FLOAT_CONV_SC_H #include #include @@ -11,7 +11,7 @@ #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/sve2.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { template class float_conversion_operation; @@ -19,16 +19,16 @@ class float_conversion_operation; template class float_conversion_operation { public: - using SrcVecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using SrcVecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using SrcVectorType = typename SrcVecTraits::VectorType; - using IntermediateVecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits< + using IntermediateVecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits< std::conditional_t, int32_t, uint32_t>>; using IntermediateVectorType = typename IntermediateVecTraits::VectorType; void process_row(size_t width, Columns src, - Columns dst) INTRINSICCV_STREAMING_COMPATIBLE { + Columns dst) KLEIDICV_STREAMING_COMPATIBLE { LoopUnroll{width, SrcVecTraits::num_lanes()} - .unroll_twice([&](size_t step) INTRINSICCV_STREAMING_COMPATIBLE { + .unroll_twice([&](size_t step) KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg = SrcVecTraits::svptrue(); SrcVectorType src_vector1 = svld1(pg, &src[0]); SrcVectorType src_vector2 = svld1_vnum(pg, &src[0], 1); @@ -41,7 +41,7 @@ class float_conversion_operation { src += ptrdiff_t(step); dst += ptrdiff_t(step); }) - .remaining([&](size_t length, size_t) INTRINSICCV_STREAMING_COMPATIBLE { + .remaining([&](size_t length, size_t) KLEIDICV_STREAMING_COMPATIBLE { size_t index = 0; svbool_t pg = SrcVecTraits::svwhilelt(index, length); while (svptest_first(SrcVecTraits::svptrue(), pg)) { @@ -61,7 +61,7 @@ class float_conversion_operation { typename O, std::enable_if_t && std::is_signed_v, int> = 0> IntermediateVectorType vector_path(svbool_t& pg, SrcVectorType src) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { constexpr float min_val = std::numeric_limits::min(); constexpr float max_val = std::numeric_limits::max(); @@ -80,7 +80,7 @@ class float_conversion_operation { typename O, std::enable_if_t && !std::is_signed_v, int> = 0> IntermediateVectorType vector_path(svbool_t& pg, SrcVectorType src) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { constexpr float max_val = std::numeric_limits::max(); src = svrinti_f32_x(pg, src); @@ -95,12 +95,12 @@ class float_conversion_operation { template class float_conversion_operation { public: - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; void process_row(size_t width, Columns src, Columns dst) { LoopUnroll{width, VecTraits::num_lanes()} - .unroll_twice([&](size_t step) INTRINSICCV_STREAMING_COMPATIBLE { + .unroll_twice([&](size_t step) KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg = VecTraits::svptrue(); VectorType dst_vector1 = vector_path(pg, &src[0]); VectorType dst_vector2 = vector_path( @@ -110,7 +110,7 @@ class float_conversion_operation { src += ptrdiff_t(step); dst += ptrdiff_t(step); }) - .remaining([&](size_t length, size_t) INTRINSICCV_STREAMING_COMPATIBLE { + .remaining([&](size_t length, size_t) KLEIDICV_STREAMING_COMPATIBLE { size_t index = 0; svbool_t pg = VecTraits::svwhilelt(index, length); while (svptest_first(VecTraits::svptrue(), pg)) { @@ -129,7 +129,7 @@ class float_conversion_operation { typename I, std::enable_if_t && std::is_signed_v, int> = 0> VectorType vector_path(svbool_t& pg, - const I* src) INTRINSICCV_STREAMING_COMPATIBLE { + const I* src) KLEIDICV_STREAMING_COMPATIBLE { svint32_t src_vector = svld1sb_s32(pg, src); return svcvt_f32_s32_x(pg, src_vector); } @@ -138,7 +138,7 @@ class float_conversion_operation { typename I, std::enable_if_t && !std::is_signed_v, int> = 0> VectorType vector_path(svbool_t& pg, - const I* src) INTRINSICCV_STREAMING_COMPATIBLE { + const I* src) KLEIDICV_STREAMING_COMPATIBLE { svuint32_t src_vector = svld1ub_u32(pg, src); return svcvt_f32_u32_x(pg, src_vector); } @@ -147,7 +147,7 @@ class float_conversion_operation { template static intrinsiccv_error_t float_conversion_sc( const I* src, size_t src_stride, O* dst, size_t dst_stride, size_t width, - size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -158,9 +158,9 @@ static intrinsiccv_error_t float_conversion_sc( Rows dst_rows{dst, dst_stride}; zip_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_FLOAT_CONV_SC_H +#endif // KLEIDICV_FLOAT_CONV_SC_H diff --git a/intrinsiccv/src/conversions/float_conv_sme2.cpp b/intrinsiccv/src/conversions/float_conv_sme2.cpp index c44fd8d5c..6c3eeead2 100644 --- a/intrinsiccv/src/conversions/float_conv_sme2.cpp +++ b/intrinsiccv/src/conversions/float_conv_sme2.cpp @@ -7,22 +7,22 @@ namespace intrinsiccv::sme2 { template -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t float_conversion(const InputType* src, size_t src_stride, OutputType* dst, size_t dst_stride, size_t width, size_t height) { return float_conversion_sc(src, src_stride, dst, dst_stride, width, height); } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(itype, otype) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(itype, otype) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ float_conversion(const itype* src, size_t src_stride, \ otype* dst, size_t dst_stride, size_t width, \ size_t height) -INTRINSICCV_INSTANTIATE_TEMPLATE(float, int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(float, uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t, float); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t, float); +KLEIDICV_INSTANTIATE_TEMPLATE(float, int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(float, uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t, float); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t, float); } // namespace intrinsiccv::sme2 diff --git a/intrinsiccv/src/conversions/float_conv_sve2.cpp b/intrinsiccv/src/conversions/float_conv_sve2.cpp index 7005f18a5..794aa88f6 100644 --- a/intrinsiccv/src/conversions/float_conv_sve2.cpp +++ b/intrinsiccv/src/conversions/float_conv_sve2.cpp @@ -7,22 +7,22 @@ namespace intrinsiccv::sve2 { template -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t float_conversion(const InputType* src, size_t src_stride, OutputType* dst, size_t dst_stride, size_t width, size_t height) { return float_conversion_sc(src, src_stride, dst, dst_stride, width, height); } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(itype, otype) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(itype, otype) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ float_conversion(const itype* src, size_t src_stride, \ otype* dst, size_t dst_stride, size_t width, \ size_t height) -INTRINSICCV_INSTANTIATE_TEMPLATE(float, int8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(float, uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(int8_t, float); -INTRINSICCV_INSTANTIATE_TEMPLATE(uint8_t, float); +KLEIDICV_INSTANTIATE_TEMPLATE(float, int8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(float, uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(int8_t, float); +KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t, float); } // namespace intrinsiccv::sve2 diff --git a/intrinsiccv/src/conversions/gray_to_rgb_api.cpp b/intrinsiccv/src/conversions/gray_to_rgb_api.cpp index 14e49476b..da40a2377 100644 --- a/intrinsiccv/src/conversions/gray_to_rgb_api.cpp +++ b/intrinsiccv/src/conversions/gray_to_rgb_api.cpp @@ -6,11 +6,11 @@ #include "intrinsiccv/dispatch.h" #include "intrinsiccv/intrinsiccv.h" -#define INTRINSICCV_DEFINE_C_API(name, partialname) \ - INTRINSICCV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::partialname, \ - INTRINSICCV_SVE2_IMPL_IF(&intrinsiccv::sve2::partialname), \ +#define KLEIDICV_DEFINE_C_API(name, partialname) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &intrinsiccv::neon::partialname, \ + KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::partialname), \ &intrinsiccv::sme2::partialname) -INTRINSICCV_DEFINE_C_API(intrinsiccv_gray_to_rgb_u8, gray_to_rgb_u8); -INTRINSICCV_DEFINE_C_API(intrinsiccv_gray_to_rgba_u8, gray_to_rgba_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_gray_to_rgb_u8, gray_to_rgb_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_gray_to_rgba_u8, gray_to_rgba_u8); diff --git a/intrinsiccv/src/conversions/gray_to_rgb_neon.cpp b/intrinsiccv/src/conversions/gray_to_rgb_neon.cpp index 235836a51..418d69be3 100644 --- a/intrinsiccv/src/conversions/gray_to_rgb_neon.cpp +++ b/intrinsiccv/src/conversions/gray_to_rgb_neon.cpp @@ -14,7 +14,7 @@ class GrayToRGB final : public UnrollTwice { using VecTraits = neon::VecTraits; using VectorType = typename VecTraits::VectorType; -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE GrayToRGB() : indices_{vld1q_u8_x3(kGrayToRGBTableIndices)} {} #else GrayToRGB() = default; @@ -22,7 +22,7 @@ class GrayToRGB final : public UnrollTwice { void vector_path(VectorType src_vect, ScalarType *dst) { uint8x16x3_t dst_vect; -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE dst_vect.val[0] = src_vect; dst_vect.val[1] = src_vect; dst_vect.val[2] = src_vect; @@ -40,7 +40,7 @@ class GrayToRGB final : public UnrollTwice { } private: -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE static constexpr uint8_t kGrayToRGBTableIndices[48] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, @@ -56,7 +56,7 @@ class GrayToRGBA final : public UnrollTwice { using VecTraits = neon::VecTraits; using VectorType = typename VecTraits::VectorType; -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE GrayToRGBA() : alpha_{vdupq_n_u8(0xff)} {} #else // NOLINTBEGIN(hicpp-member-init) @@ -68,7 +68,7 @@ class GrayToRGBA final : public UnrollTwice { void vector_path(VectorType src_vect, ScalarType *dst) { uint8x16x4_t dst_vect; -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE dst_vect.val[0] = src_vect; dst_vect.val[1] = src_vect; dst_vect.val[2] = src_vect; @@ -90,7 +90,7 @@ class GrayToRGBA final : public UnrollTwice { } private: -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE uint8x16_t alpha_; #else uint8x16x4_t indices_; @@ -104,7 +104,7 @@ class GrayToRGBA final : public UnrollTwice { #endif }; // end of class GrayToRGBA -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { @@ -117,10 +117,10 @@ intrinsiccv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, Rows dst_rows{dst, dst_stride, 3 /* RGB */}; GrayToRGB operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { @@ -133,7 +133,7 @@ intrinsiccv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, Rows dst_rows{dst, dst_stride, 4 /* RGBA */}; GrayToRGBA operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/conversions/gray_to_rgb_sc.h b/intrinsiccv/src/conversions/gray_to_rgb_sc.h index 4613a55f0..a026a35b9 100644 --- a/intrinsiccv/src/conversions/gray_to_rgb_sc.h +++ b/intrinsiccv/src/conversions/gray_to_rgb_sc.h @@ -2,48 +2,48 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_GRAY_TO_RGB_SC_H -#define INTRINSICCV_GRAY_TO_RGB_SC_H +#ifndef KLEIDICV_GRAY_TO_RGB_SC_H +#define KLEIDICV_GRAY_TO_RGB_SC_H #include "intrinsiccv/conversions/gray_to_rgb.h" #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/sve2.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { template class GrayToRGB final : -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE public UsesTailPath, #endif public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE void vector_path(ContextType ctx, VectorType src_vect, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); svuint8x3_t dst_vect = svcreate3(src_vect, src_vect, src_vect); svst3(pg, dst, dst_vect); } -#else // INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE - explicit GrayToRGB(svuint8x3_t &indices) INTRINSICCV_STREAMING_COMPATIBLE +#else // KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE + explicit GrayToRGB(svuint8x3_t &indices) KLEIDICV_STREAMING_COMPATIBLE : indices_{indices} { initialize_indices(); } void vector_path(ContextType ctx, VectorType src_vect, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { // Call the common vector path. auto pg = ctx.predicate(); common_vector_path(pg, pg, pg, src_vect, dst); } void tail_path(ContextType ctx, VectorType src_vect, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); // Predicates for consecutive stores. svbool_t pg_0, pg_1, pg_2; @@ -55,7 +55,7 @@ class GrayToRGB final : private: void common_vector_path(svbool_t pg_0, svbool_t pg_1, svbool_t pg_2, VectorType src_vect, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { // Convert from gray to RGB using table-lookups. VectorType dst_vec_0 = svtbl(src_vect, svget3(indices_, 0)); VectorType dst_vec_1 = svtbl(src_vect, svget3(indices_, 1)); @@ -66,7 +66,7 @@ class GrayToRGB final : svst1_vnum(pg_2, &dst[0], 2, dst_vec_2); } - void initialize_indices() INTRINSICCV_STREAMING_COMPATIBLE { + void initialize_indices() KLEIDICV_STREAMING_COMPATIBLE { // All-true predicate to shorten code. svbool_t pg_all = VecTraits::svptrue(); // Constant used for division by 3. @@ -76,7 +76,7 @@ class GrayToRGB final : indices_0 = svindex_u8(0, 1); - if (INTRINSICCV_UNLIKELY(svcntb() == 256)) { + if (KLEIDICV_UNLIKELY(svcntb() == 256)) { indices_1 = svext( svdup_u8(0), svqadd(svindex_u8(svcntb() % 3, 1), static_cast(2)), 254); @@ -99,17 +99,17 @@ class GrayToRGB final : } svuint8x3_t &indices_; -#endif // INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#endif // KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE }; // end of class GrayToRGB template class GrayToRGBAWithInterleaving final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; void vector_path(ContextType ctx, VectorType src_vect, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); svuint8_t alpha = svdup_u8(0xff); svuint8x4_t dst_vect = svcreate4(src_vect, src_vect, src_vect, alpha); @@ -118,28 +118,28 @@ class GrayToRGBAWithInterleaving final : public UnrollTwice { } }; // end of class GrayToRGBAWithInterleaving -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE template class GrayToRGBAWithLookUpTable final : public UnrollTwice, public UsesTailPath { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; explicit GrayToRGBAWithLookUpTable(svuint8x4_t &indices) - INTRINSICCV_STREAMING_COMPATIBLE : indices_{indices} { + KLEIDICV_STREAMING_COMPATIBLE : indices_{indices} { initialize_indices(); } void vector_path(ContextType ctx, VectorType src_vect, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { // Call the common vector path. auto pg = ctx.predicate(); common_vector_path(pg, pg, pg, pg, src_vect, dst); } void tail_path(ContextType ctx, VectorType src_vect, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); // Predicates for consecutive stores. svbool_t pg_0, pg_1, pg_2, pg_3; @@ -151,7 +151,7 @@ class GrayToRGBAWithLookUpTable final : public UnrollTwice, private: void common_vector_path(svbool_t pg_0, svbool_t pg_1, svbool_t pg_2, svbool_t pg_3, VectorType src_vect, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { svuint8x2_t src_and_alpha = svcreate2(src_vect, VecTraits::svdup(-1)); // Convert from gray to RGBA using table-lookups. @@ -166,7 +166,7 @@ class GrayToRGBAWithLookUpTable final : public UnrollTwice, svst1_vnum(pg_3, &dst[0], 3, dst_vec_3); } - void initialize_indices() INTRINSICCV_STREAMING_COMPATIBLE { + void initialize_indices() KLEIDICV_STREAMING_COMPATIBLE { // Number of four-tuple elements. uint64_t num_four_tuples = VecTraits::num_lanes() / 4; // Index of alpha. @@ -199,11 +199,11 @@ class GrayToRGBAWithLookUpTable final : public UnrollTwice, svuint8x4_t &indices_; }; // end of class GrayToRGBAWithLookUpTable -#endif // !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#endif // !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE -INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t gray_to_rgb_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t gray_to_rgb_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -211,19 +211,19 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t gray_to_rgb_u8_sc( Rectangle rect{width, height}; Rows src_rows{src, src_stride}; Rows dst_rows{dst, dst_stride, 3 /* RGB */}; -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE GrayToRGB operation; #else svuint8x3_t table_indices; GrayToRGB operation{table_indices}; #endif apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t gray_to_rgba_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t gray_to_rgba_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -232,7 +232,7 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t gray_to_rgba_u8_sc( Rows src_rows{src, src_stride}; Rows dst_rows{dst, dst_stride, 4 /* RGBA */}; -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE GrayToRGBAWithInterleaving operation{}; apply_operation_by_rows(operation, rect, src_rows, dst_rows); #else @@ -245,9 +245,9 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t gray_to_rgba_u8_sc( apply_operation_by_rows(operation, rect, src_rows, dst_rows); } #endif - return INTRINSICCV_OK; + return KLEIDICV_OK; } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_GRAY_TO_RGB_SC_H +#endif // KLEIDICV_GRAY_TO_RGB_SC_H diff --git a/intrinsiccv/src/conversions/gray_to_rgb_sme2.cpp b/intrinsiccv/src/conversions/gray_to_rgb_sme2.cpp index 4703f261c..07735f84a 100644 --- a/intrinsiccv/src/conversions/gray_to_rgb_sme2.cpp +++ b/intrinsiccv/src/conversions/gray_to_rgb_sme2.cpp @@ -6,13 +6,13 @@ namespace intrinsiccv::sme2 { -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return gray_to_rgb_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return gray_to_rgba_u8_sc(src, src_stride, dst, dst_stride, width, height); diff --git a/intrinsiccv/src/conversions/gray_to_rgb_sve2.cpp b/intrinsiccv/src/conversions/gray_to_rgb_sve2.cpp index 647e36dce..985c53f19 100644 --- a/intrinsiccv/src/conversions/gray_to_rgb_sve2.cpp +++ b/intrinsiccv/src/conversions/gray_to_rgb_sve2.cpp @@ -6,13 +6,13 @@ namespace intrinsiccv::sve2 { -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return gray_to_rgb_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return gray_to_rgba_u8_sc(src, src_stride, dst, dst_stride, width, height); diff --git a/intrinsiccv/src/conversions/merge_api.cpp b/intrinsiccv/src/conversions/merge_api.cpp index d84ce62c9..a6cef3f0f 100644 --- a/intrinsiccv/src/conversions/merge_api.cpp +++ b/intrinsiccv/src/conversions/merge_api.cpp @@ -6,5 +6,5 @@ #include "intrinsiccv/dispatch.h" #include "intrinsiccv/intrinsiccv.h" -INTRINSICCV_MULTIVERSION_C_API(intrinsiccv_merge, &intrinsiccv::neon::merge, - nullptr, nullptr); +KLEIDICV_MULTIVERSION_C_API(intrinsiccv_merge, &intrinsiccv::neon::merge, + nullptr, nullptr); diff --git a/intrinsiccv/src/conversions/merge_neon.cpp b/intrinsiccv/src/conversions/merge_neon.cpp index 19d995b9e..7a5ce325a 100644 --- a/intrinsiccv/src/conversions/merge_neon.cpp +++ b/intrinsiccv/src/conversions/merge_neon.cpp @@ -36,17 +36,17 @@ class Merge2 final : public UnrollTwice { using Vector2Type = typename VecTraits::Vector2Type; void vector_path(VectorType src_a, VectorType src_b, ScalarType *dst) { -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE Vector2Type dst_vect; dst_vect.val[0] = src_a; dst_vect.val[1] = src_b; vst2q(&dst[0], dst_vect); -#else // INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#else // KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE Vector2Type dst_vect; dst_vect.val[0] = vzip1q(src_a, src_b); dst_vect.val[1] = vzip2q(src_a, src_b); vst1q_x2(&dst[0], dst_vect); -#endif // INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#endif // KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE } void scalar_path(const ScalarType *src_a, const ScalarType *src_b, @@ -67,19 +67,19 @@ class Merge3 final : public UnrollTwice { using VectorType = typename VecTraits::VectorType; using Vector3Type = typename VecTraits::Vector3Type; -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE Merge3() : table_indices_{vld1q_u8_x3(lookup_table(ScalarType()))} {} #endif void vector_path(VectorType src_a, VectorType src_b, VectorType src_c, ScalarType *dst) { -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE Vector3Type dst_vect; dst_vect.val[0] = src_a; dst_vect.val[1] = src_b; dst_vect.val[2] = src_c; vst3q(&dst[0], dst_vect); -#else // INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#else // KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE uint8x16x3_t src_vect, dst_vect; src_vect.val[0] = vreinterpretq_u8(src_a); src_vect.val[1] = vreinterpretq_u8(src_b); @@ -88,7 +88,7 @@ class Merge3 final : public UnrollTwice { dst_vect.val[1] = vqtbl3q_u8(src_vect, table_indices_.val[1]); dst_vect.val[2] = vqtbl3q_u8(src_vect, table_indices_.val[2]); vst1q_u8_x3(reinterpret_cast(&dst[0]), dst_vect); -#endif // INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#endif // KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE } void scalar_path(const ScalarType *src_a, const ScalarType *src_b, @@ -99,7 +99,7 @@ class Merge3 final : public UnrollTwice { } private: -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE static const uint8_t *lookup_table(uint8_t) { // clang-format off static constexpr uint8_t kIndices[48] = { @@ -127,7 +127,7 @@ class Merge3 final : public UnrollTwice { #endif }; // end of class Merge3 -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE // Specialized 3-way merge implementation for 32-bit elements. // @@ -226,7 +226,7 @@ class Merge3 final : public UnrollTwice { } }; // end of class Merge3 -#endif // !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#endif // !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE // ---------------------------------------- // ----------- Four-way merge ------------- @@ -266,14 +266,14 @@ class Merge4 final : public UnrollTwice { void vector_path(VectorType src_a, VectorType src_b, VectorType src_c, VectorType src_d, ScalarType *dst) { -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE Vector4Type dst_vect; dst_vect.val[0] = src_a; dst_vect.val[1] = src_b; dst_vect.val[2] = src_c; dst_vect.val[3] = src_d; vst4q(&dst[0], dst_vect); -#else // INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#else // KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE auto zip1_a_b = double_width(vzip1q(src_a, src_b)); auto zip1_c_d = double_width(vzip1q(src_c, src_d)); auto zip2_a_b = double_width(vzip2q(src_a, src_b)); @@ -288,7 +288,7 @@ class Merge4 final : public UnrollTwice { dst_vect.val[2] = vzip1q(zip2_a_b, zip2_c_d); dst_vect.val[3] = vzip2q(zip2_a_b, zip2_c_d); vst1q_x4(reinterpret_cast(&dst[0]), dst_vect); -#endif // INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#endif // KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE } void scalar_path(const ScalarType *src_a, const ScalarType *src_b, @@ -301,7 +301,7 @@ class Merge4 final : public UnrollTwice { } private: -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE // Polymorphic retinterpret_cast<>() between vector types where the element // size is doubled. For example, if 'VectorType' is 'uint8x16_t', this // method returns 'reinterpret_cast(vector)'. @@ -311,7 +311,7 @@ class Merge4 final : public UnrollTwice { #endif }; // end of class Merge4 -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE // Specialized 4-way merge implementation for 64-bit elements. // @@ -359,7 +359,7 @@ class Merge4 final : public UnrollTwice { } }; // end of class Merge4 -#endif // !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#endif // !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE // Most of the complexity comes from parameter checking. // NOLINTBEGIN(readability-function-cognitive-complexity) @@ -368,7 +368,7 @@ intrinsiccv_error_t merge(const void **srcs, const size_t *src_strides, void *dst_void, size_t dst_stride, size_t width, size_t height, size_t channels) { if (channels < 2) { - return INTRINSICCV_ERROR_RANGE; + return KLEIDICV_ERROR_RANGE; } CHECK_POINTERS(srcs, src_strides); MAKE_POINTER_CHECK_ALIGNMENT(const ScalarType, src0, srcs[0]); @@ -413,13 +413,13 @@ intrinsiccv_error_t merge(const void **srcs, const size_t *src_strides, } break; default: - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } - return INTRINSICCV_OK; + return KLEIDICV_OK; } // NOLINTEND(readability-function-cognitive-complexity) -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t merge(const void **srcs, const size_t *src_strides, void *dst, size_t dst_stride, size_t width, size_t height, size_t channels, size_t element_size) { @@ -441,7 +441,7 @@ intrinsiccv_error_t merge(const void **srcs, const size_t *src_strides, channels); default: - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } } diff --git a/intrinsiccv/src/conversions/rgb_to_rgb_api.cpp b/intrinsiccv/src/conversions/rgb_to_rgb_api.cpp index 434ea29b3..8c75992ab 100644 --- a/intrinsiccv/src/conversions/rgb_to_rgb_api.cpp +++ b/intrinsiccv/src/conversions/rgb_to_rgb_api.cpp @@ -7,24 +7,24 @@ #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/types.h" -#define INTRINSICCV_DEFINE_C_API(name, partialname) \ - INTRINSICCV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::partialname, \ - INTRINSICCV_SVE2_IMPL_IF(&intrinsiccv::sve2::partialname), \ +#define KLEIDICV_DEFINE_C_API(name, partialname) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &intrinsiccv::neon::partialname, \ + KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::partialname), \ &intrinsiccv::sme2::partialname) -INTRINSICCV_DEFINE_C_API(intrinsiccv_rgb_to_bgr_u8, rgb_to_bgr_u8); -INTRINSICCV_DEFINE_C_API(intrinsiccv_rgba_to_bgra_u8, rgba_to_bgra_u8); -INTRINSICCV_DEFINE_C_API(intrinsiccv_rgb_to_bgra_u8, rgb_to_bgra_u8); -INTRINSICCV_DEFINE_C_API(intrinsiccv_rgb_to_rgba_u8, rgb_to_rgba_u8); -INTRINSICCV_DEFINE_C_API(intrinsiccv_rgba_to_bgr_u8, rgba_to_bgr_u8); -INTRINSICCV_DEFINE_C_API(intrinsiccv_rgba_to_rgb_u8, rgba_to_rgb_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_rgb_to_bgr_u8, rgb_to_bgr_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_rgba_to_bgra_u8, rgba_to_bgra_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_rgb_to_bgra_u8, rgb_to_bgra_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_rgb_to_rgba_u8, rgb_to_rgba_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_rgba_to_bgr_u8, rgba_to_bgr_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_rgba_to_rgb_u8, rgba_to_rgb_u8); extern "C" { -using INTRINSICCV_TARGET_NAMESPACE::CopyRows; -using INTRINSICCV_TARGET_NAMESPACE::Rectangle; -using INTRINSICCV_TARGET_NAMESPACE::Rows; +using KLEIDICV_TARGET_NAMESPACE::CopyRows; +using KLEIDICV_TARGET_NAMESPACE::Rectangle; +using KLEIDICV_TARGET_NAMESPACE::Rows; static intrinsiccv_error_t intrinsiccv_rgb_to_rgb_u8_impl( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, @@ -37,7 +37,7 @@ static intrinsiccv_error_t intrinsiccv_rgb_to_rgb_u8_impl( Rows src_rows{src, src_stride, 3 /* RGB */}; Rows dst_rows{dst, dst_stride, 3 /* BGR */}; CopyRows::copy_rows(rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } decltype(intrinsiccv_rgb_to_rgb_u8_impl) *intrinsiccv_rgb_to_rgb_u8 = @@ -54,7 +54,7 @@ static intrinsiccv_error_t intrinsiccv_rgba_to_rgba_u8_impl( Rows src_rows{src, src_stride, 4 /* RGBA */}; Rows dst_rows{dst, dst_stride, 4 /* RGBA */}; CopyRows::copy_rows(rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } decltype(intrinsiccv_rgba_to_rgba_u8_impl) *intrinsiccv_rgba_to_rgba_u8 = diff --git a/intrinsiccv/src/conversions/rgb_to_rgb_neon.cpp b/intrinsiccv/src/conversions/rgb_to_rgb_neon.cpp index 401abbc8c..6c4992e92 100644 --- a/intrinsiccv/src/conversions/rgb_to_rgb_neon.cpp +++ b/intrinsiccv/src/conversions/rgb_to_rgb_neon.cpp @@ -13,14 +13,14 @@ class RGBToBGR final : public UnrollTwice { public: using VecTraits = neon::VecTraits; -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE RGBToBGR() : indices_{vld1q_u8_x3(kRGBToBGRTableIndices)} {} #else RGBToBGR() = default; #endif void vector_path(const ScalarType *src, ScalarType *dst) { -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE uint8x16x3_t src_vect = vld3q_u8(src); uint8x16x3_t dst_vect; @@ -57,7 +57,7 @@ class RGBToBGR final : public UnrollTwice { } private: -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE static constexpr uint8_t kRGBToBGRTableIndices[48] = { 2, 1, 0, 5, 4, 3, 8, 7, 6, 11, 10, 9, 14, 13, 12, 17, 16, 15, 20, 19, 18, 23, 22, 21, 26, 25, 24, 29, 28, 27, 32, 31, @@ -187,7 +187,7 @@ class RGBAToRGB final : public UnrollTwice { } }; // end of class RGBAToRGB -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { @@ -200,10 +200,10 @@ intrinsiccv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, Rows dst_rows{dst, dst_stride, 3 /* BGR */}; RGBToBGR operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { @@ -216,10 +216,10 @@ intrinsiccv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, Rows dst_rows{dst, dst_stride, 4 /* BGRA */}; RGBAToBGRA operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -231,10 +231,10 @@ rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, Rows dst_rows{dst, dst_stride, 4 /* BGRA */}; RGBToBGRA operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -246,10 +246,10 @@ rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, Rows dst_rows{dst, dst_stride, 4 /* RGBA */}; RGBToRGBA operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { @@ -262,10 +262,10 @@ intrinsiccv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, Rows dst_rows{dst, dst_stride, 3 /* BGR */}; RGBAToBGR operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { @@ -278,7 +278,7 @@ intrinsiccv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, Rows dst_rows{dst, dst_stride, 3 /* RGB */}; RGBAToRGB operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/conversions/rgb_to_rgb_sc.h b/intrinsiccv/src/conversions/rgb_to_rgb_sc.h index 140ee0cc2..a5785e9cd 100644 --- a/intrinsiccv/src/conversions/rgb_to_rgb_sc.h +++ b/intrinsiccv/src/conversions/rgb_to_rgb_sc.h @@ -2,31 +2,29 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_RGB_TO_RGB_SC_H -#define INTRINSICCV_RGB_TO_RGB_SC_H +#ifndef KLEIDICV_RGB_TO_RGB_SC_H +#define KLEIDICV_RGB_TO_RGB_SC_H #include "intrinsiccv/conversions/rgb_to_rgb.h" #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/sve2.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { template class RGBToBGR final : -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE && \ - INTRINSICCV_ASSUME_128BIT_SVE2 +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE && KLEIDICV_ASSUME_128BIT_SVE2 public UsesTailPath, #endif public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE || \ - !INTRINSICCV_ASSUME_128BIT_SVE2 +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE || !KLEIDICV_ASSUME_128BIT_SVE2 void vector_path(ContextType ctx, const ScalarType *src, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); svuint8x3_t src_vect = svld3(pg, src); svuint8x3_t dst_vect = svcreate3(svget3(src_vect, 2), svget3(src_vect, 1), @@ -34,22 +32,22 @@ class RGBToBGR final : svst3(pg, dst, dst_vect); } -#else // INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE || - // !INTRINSICCV_ASSUME_128BIT_SVE2 - explicit RGBToBGR(svuint8x4_t &indices) INTRINSICCV_STREAMING_COMPATIBLE +#else // KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE || + // !KLEIDICV_ASSUME_128BIT_SVE2 + explicit RGBToBGR(svuint8x4_t &indices) KLEIDICV_STREAMING_COMPATIBLE : indices_{indices} { initialize_indices(); } void vector_path(ContextType ctx, const ScalarType *src, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { // Call the common vector path. auto pg = ctx.predicate(); common_vector_path(pg, pg, pg, src, dst); } void tail_path(ContextType ctx, const ScalarType *src, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); // Predicates for consecutive stores. svbool_t pg_0, pg_1, pg_2; @@ -61,7 +59,7 @@ class RGBToBGR final : private: void common_vector_path(svbool_t pg_0, svbool_t pg_1, svbool_t pg_2, const ScalarType *src, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { VectorType src_0 = svld1(pg_0, &src[0]); VectorType src_1 = svld1_vnum(pg_1, &src[0], 1); VectorType src_2 = svld1_vnum(pg_2, &src[0], 2); @@ -80,7 +78,7 @@ class RGBToBGR final : svst1_vnum(pg_2, &dst[0], 2, dst_vec_2); } - void initialize_indices() INTRINSICCV_STREAMING_COMPATIBLE { + void initialize_indices() KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg = VecTraits::svptrue(); indices_ = svcreate4(svld1(pg, &kTableIndices[0]), svld1_vnum(pg, &kTableIndices[0], 1), @@ -96,18 +94,18 @@ class RGBToBGR final : // Hold a reference because a sizeless types cannot be members. svuint8x4_t &indices_; -#endif // !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE || - // !INTRINSICCV_ASSUME_128BIT_SVE2 +#endif // !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE || + // !KLEIDICV_ASSUME_128BIT_SVE2 }; // end of class RGBToBGR template class RGBAToBGRA final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; void vector_path(ContextType ctx, const ScalarType *src, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); svuint8x4_t src_vect = svld4(pg, src); svuint8x4_t dst_vect = svcreate4(svget4(src_vect, 2), svget4(src_vect, 1), @@ -121,10 +119,10 @@ template class RGBToBGRA final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; void vector_path(ContextType ctx, const ScalarType *src, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); svuint8x3_t src_vect = svld3(pg, src); svuint8x4_t dst_vect = svcreate4(svget3(src_vect, 2), svget3(src_vect, 1), @@ -138,10 +136,10 @@ template class RGBToRGBA final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; void vector_path(ContextType ctx, const ScalarType *src, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); svuint8x3_t src_vect = svld3(pg, src); svuint8x4_t dst_vect = svcreate4(svget3(src_vect, 0), svget3(src_vect, 1), @@ -155,10 +153,10 @@ template class RGBAToBGR final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; void vector_path(ContextType ctx, const ScalarType *src, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); svuint8x4_t src_vect = svld4(pg, src); svuint8x3_t dst_vect = svcreate3(svget4(src_vect, 2), svget4(src_vect, 1), @@ -172,10 +170,10 @@ template class RGBAToRGB final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; void vector_path(ContextType ctx, const ScalarType *src, - ScalarType *dst) INTRINSICCV_STREAMING_COMPATIBLE { + ScalarType *dst) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); svuint8x4_t src_vect = svld4(pg, src); svuint8x3_t dst_vect = svcreate3(svget4(src_vect, 0), svget4(src_vect, 1), @@ -185,9 +183,9 @@ class RGBAToRGB final : public UnrollTwice { } }; // end of class RGBAToRGB -INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t rgb_to_bgr_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t rgb_to_bgr_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -195,21 +193,20 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t rgb_to_bgr_u8_sc( Rectangle rect{width, height}; Rows src_rows{src, src_stride, 3 /* RGB */}; Rows dst_rows{dst, dst_stride, 3 /* BGR */}; -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE || \ - !INTRINSICCV_ASSUME_128BIT_SVE2 +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE || !KLEIDICV_ASSUME_128BIT_SVE2 RGBToBGR operation; #else svuint8x4_t table_indices; RGBToBGR operation{table_indices}; #endif apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t rgba_to_bgra_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -219,13 +216,13 @@ static intrinsiccv_error_t rgba_to_bgra_u8_sc( Rows dst_rows{dst, dst_stride, 4 /* BGRA */}; RGBAToBGRA operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t rgb_to_bgra_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -235,13 +232,13 @@ static intrinsiccv_error_t rgb_to_bgra_u8_sc( Rows dst_rows{dst, dst_stride, 4 /* BGRA */}; RGBToBGRA operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t rgb_to_rgba_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -251,13 +248,13 @@ static intrinsiccv_error_t rgb_to_rgba_u8_sc( Rows dst_rows{dst, dst_stride, 4 /* RGBA */}; RGBToRGBA operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t rgba_to_bgr_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -267,13 +264,13 @@ static intrinsiccv_error_t rgba_to_bgr_u8_sc( Rows dst_rows{dst, dst_stride, 3 /* BGR */}; RGBAToBGR operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t rgba_to_rgb_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -283,9 +280,9 @@ static intrinsiccv_error_t rgba_to_rgb_u8_sc( Rows dst_rows{dst, dst_stride, 3 /* RGB */}; RGBAToRGB operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_RGB_TO_RGB_SC_H +#endif // KLEIDICV_RGB_TO_RGB_SC_H diff --git a/intrinsiccv/src/conversions/rgb_to_rgb_sme2.cpp b/intrinsiccv/src/conversions/rgb_to_rgb_sme2.cpp index 522777474..1e9af255e 100644 --- a/intrinsiccv/src/conversions/rgb_to_rgb_sme2.cpp +++ b/intrinsiccv/src/conversions/rgb_to_rgb_sme2.cpp @@ -6,37 +6,37 @@ namespace intrinsiccv::sme2 { -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgb_to_bgr_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgba_to_bgra_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgb_to_bgra_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgb_to_rgba_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgba_to_bgr_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgba_to_rgb_u8_sc(src, src_stride, dst, dst_stride, width, height); diff --git a/intrinsiccv/src/conversions/rgb_to_rgb_sve2.cpp b/intrinsiccv/src/conversions/rgb_to_rgb_sve2.cpp index 70ddbe506..c107564b5 100644 --- a/intrinsiccv/src/conversions/rgb_to_rgb_sve2.cpp +++ b/intrinsiccv/src/conversions/rgb_to_rgb_sve2.cpp @@ -6,40 +6,40 @@ namespace intrinsiccv::sve2 { -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgb_to_bgr_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgba_to_bgra_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgb_to_bgra_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgb_to_rgba_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgba_to_bgr_u8_sc(src, src_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { diff --git a/intrinsiccv/src/conversions/split_api.cpp b/intrinsiccv/src/conversions/split_api.cpp index 80286c9eb..059e4999e 100644 --- a/intrinsiccv/src/conversions/split_api.cpp +++ b/intrinsiccv/src/conversions/split_api.cpp @@ -6,5 +6,5 @@ #include "intrinsiccv/dispatch.h" #include "intrinsiccv/intrinsiccv.h" -INTRINSICCV_MULTIVERSION_C_API(intrinsiccv_split, &intrinsiccv::neon::split, - nullptr, nullptr); +KLEIDICV_MULTIVERSION_C_API(intrinsiccv_split, &intrinsiccv::neon::split, + nullptr, nullptr); diff --git a/intrinsiccv/src/conversions/split_neon.cpp b/intrinsiccv/src/conversions/split_neon.cpp index 9892266d4..caa24f38e 100644 --- a/intrinsiccv/src/conversions/split_neon.cpp +++ b/intrinsiccv/src/conversions/split_neon.cpp @@ -21,7 +21,7 @@ class Split2 final : public UnrollTwice { using VectorType = typename VecTraits::VectorType; using Vector2Type = typename VecTraits::Vector2Type; -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE void vector_path(const ScalarType *src, ScalarType *dst0, ScalarType *dst1) { Vector2Type vsrc; vsrc = vld2q(src); @@ -56,13 +56,13 @@ class Split3 final : public UnrollTwice { using Vector3Type = typename VecTraits::Vector3Type; using VectorType = typename VecTraits::VectorType; -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE // NOLINTBEGIN(hicpp-member-init) Split3() { Split3Init(ScalarType()); } // NOLINTEND(hicpp-member-init) #endif -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE void vector_path(const ScalarType *src, ScalarType *dst0, ScalarType *dst1, ScalarType *dst2) { Vector3Type vsrc; @@ -92,7 +92,7 @@ class Split3 final : public UnrollTwice { } private: -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE uint8x16_t index1_, index2_, index3_; void Split3Init(uint8_t) { @@ -170,7 +170,7 @@ class Split4 final : public UnrollTwice { using Vector2Type = typename VecTraits::Vector2Type; using Vector4Type = typename VecTraits::Vector4Type; -#if INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE void vector_path(const ScalarType *src, ScalarType *dst0, ScalarType *dst1, ScalarType *dst2, ScalarType *dst3) { Vector4Type vsrc; @@ -219,7 +219,7 @@ class Split4 final : public UnrollTwice { // Specialized split implementation for 4 channels with 64 bits data // As in case of 64 bits we have 2 values in one q-sized vector, // the implementation is simpler, no need for cast to double size -#if !INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE +#if !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE template <> class Split4 final : public UnrollTwice { public: @@ -253,7 +253,7 @@ intrinsiccv_error_t split(const void *src_void, const size_t src_stride, void **dst_data, const size_t *dst_strides, size_t width, size_t height, size_t channels) { if (channels < 2) { - return INTRINSICCV_ERROR_RANGE; + return KLEIDICV_ERROR_RANGE; } CHECK_POINTERS(dst_data, dst_strides); @@ -295,13 +295,13 @@ intrinsiccv_error_t split(const void *src_void, const size_t src_stride, dst_rows2, dst_rows3); } break; default: - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } - return INTRINSICCV_OK; + return KLEIDICV_OK; } // NOLINTEND(readability-function-cognitive-complexity) -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t split(const void *src_data, size_t src_stride, void **dst_data, const size_t *dst_strides, size_t width, size_t height, size_t channels, @@ -324,7 +324,7 @@ intrinsiccv_error_t split(const void *src_data, size_t src_stride, height, channels); default: - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } } } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/conversions/yuv_to_rgb_api.cpp b/intrinsiccv/src/conversions/yuv_to_rgb_api.cpp index 4f051230f..ced78566c 100644 --- a/intrinsiccv/src/conversions/yuv_to_rgb_api.cpp +++ b/intrinsiccv/src/conversions/yuv_to_rgb_api.cpp @@ -6,12 +6,12 @@ #include "intrinsiccv/dispatch.h" #include "intrinsiccv/intrinsiccv.h" -#define INTRINSICCV_DEFINE_C_API(name, partialname) \ - INTRINSICCV_MULTIVERSION_C_API(name, &intrinsiccv::neon::partialname, \ - &intrinsiccv::sve2::partialname, \ - &intrinsiccv::sme2::partialname) +#define KLEIDICV_DEFINE_C_API(name, partialname) \ + KLEIDICV_MULTIVERSION_C_API(name, &intrinsiccv::neon::partialname, \ + &intrinsiccv::sve2::partialname, \ + &intrinsiccv::sme2::partialname) -INTRINSICCV_DEFINE_C_API(intrinsiccv_yuv_sp_to_rgb_u8, yuv_sp_to_rgb_u8); -INTRINSICCV_DEFINE_C_API(intrinsiccv_yuv_sp_to_bgr_u8, yuv_sp_to_bgr_u8); -INTRINSICCV_DEFINE_C_API(intrinsiccv_yuv_sp_to_rgba_u8, yuv_sp_to_rgba_u8); -INTRINSICCV_DEFINE_C_API(intrinsiccv_yuv_sp_to_bgra_u8, yuv_sp_to_bgra_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_yuv_sp_to_rgb_u8, yuv_sp_to_rgb_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_yuv_sp_to_bgr_u8, yuv_sp_to_bgr_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_yuv_sp_to_rgba_u8, yuv_sp_to_rgba_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_yuv_sp_to_bgra_u8, yuv_sp_to_bgra_u8); diff --git a/intrinsiccv/src/conversions/yuv_to_rgb_neon.cpp b/intrinsiccv/src/conversions/yuv_to_rgb_neon.cpp index e2209cb75..dcd07d021 100644 --- a/intrinsiccv/src/conversions/yuv_to_rgb_neon.cpp +++ b/intrinsiccv/src/conversions/yuv_to_rgb_neon.cpp @@ -308,10 +308,10 @@ intrinsiccv_error_t yuv2rgbx_operation( ParallelRowsAdapter parallel_rows_adapter{context_adapter}; RowBasedOperation row_based_operation{parallel_rows_adapter}; zip_parallel_rows(row_based_operation, rect, y_rows, uv_rows, rgbx_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, @@ -322,7 +322,7 @@ intrinsiccv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, src_uv_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, @@ -332,7 +332,7 @@ intrinsiccv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, return yuv2rgbx_operation(operation, src_y, src_y_stride, src_uv, src_uv_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { @@ -341,7 +341,7 @@ yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, src_uv_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgra_u8( +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgra_u8( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { diff --git a/intrinsiccv/src/conversions/yuv_to_rgb_sc.h b/intrinsiccv/src/conversions/yuv_to_rgb_sc.h index a2858648a..a318aa356 100644 --- a/intrinsiccv/src/conversions/yuv_to_rgb_sc.h +++ b/intrinsiccv/src/conversions/yuv_to_rgb_sc.h @@ -2,26 +2,26 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_YUV_TO_RGB_SC_H -#define INTRINSICCV_YUV_TO_RGB_SC_H +#ifndef KLEIDICV_YUV_TO_RGB_SC_H +#define KLEIDICV_YUV_TO_RGB_SC_H #include "intrinsiccv/conversions/yuv_to_rgb.h" #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/sve2.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { template class YUVSpToRGBxOrBGRx final { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; - explicit YUVSpToRGBxOrBGRx(bool is_nv21) INTRINSICCV_STREAMING_COMPATIBLE + explicit YUVSpToRGBxOrBGRx(bool is_nv21) KLEIDICV_STREAMING_COMPATIBLE : is_nv21_(is_nv21) {} // Returns the number of channels in the output image. - static constexpr size_t output_channels() INTRINSICCV_STREAMING_COMPATIBLE { + static constexpr size_t output_channels() KLEIDICV_STREAMING_COMPATIBLE { return ALPHA ? /* RGBA */ 4 : /* RGB */ 3; } @@ -30,7 +30,7 @@ class YUVSpToRGBxOrBGRx final { void vector_path(ContextType ctx, const uint8_t *y_row_0, const uint8_t *y_row_1, const uint8_t *uv_row, uint8_t *rgbx_row_0, - uint8_t *rgbx_row_1) INTRINSICCV_STREAMING_COMPATIBLE { + uint8_t *rgbx_row_1) KLEIDICV_STREAMING_COMPATIBLE { auto pg = ctx.predicate(); // Both the rounding shift right constant and the -128 value are included. @@ -190,7 +190,7 @@ intrinsiccv_error_t yuv2rgbx_operation( OperationType &operation, const ScalarType *src_y, size_t src_y_stride, const ScalarType *src_uv, size_t src_uv_stride, ScalarType *dst, size_t dst_stride, size_t width, - size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src_y, src_y_stride); CHECK_POINTER_AND_STRIDE(src_uv, src_uv_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -208,49 +208,49 @@ intrinsiccv_error_t yuv2rgbx_operation( ParallelRowsAdapter parallel_rows_adapter{context_adapter}; RowBasedOperation row_based_operation{parallel_rows_adapter}; zip_parallel_rows(row_based_operation, rect, y_rows, uv_rows, rgbx_rows); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t yuv_sp_to_rgb_u8_sc( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, - size_t height, bool is_nv21) INTRINSICCV_STREAMING_COMPATIBLE { + size_t height, bool is_nv21) KLEIDICV_STREAMING_COMPATIBLE { YUVSpToRGB operation{is_nv21}; return yuv2rgbx_operation(operation, src_y, src_y_stride, src_uv, src_uv_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t yuv_sp_to_rgba_u8_sc( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, - size_t height, bool is_nv21) INTRINSICCV_STREAMING_COMPATIBLE { + size_t height, bool is_nv21) KLEIDICV_STREAMING_COMPATIBLE { YUVSpToRGBA operation{is_nv21}; return yuv2rgbx_operation(operation, src_y, src_y_stride, src_uv, src_uv_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t yuv_sp_to_bgr_u8_sc( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, - size_t height, bool is_nv21) INTRINSICCV_STREAMING_COMPATIBLE { + size_t height, bool is_nv21) KLEIDICV_STREAMING_COMPATIBLE { YUVSpToBGR operation{is_nv21}; return yuv2rgbx_operation(operation, src_y, src_y_stride, src_uv, src_uv_stride, dst, dst_stride, width, height); } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t yuv_sp_to_bgra_u8_sc( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, - size_t height, bool is_nv21) INTRINSICCV_STREAMING_COMPATIBLE { + size_t height, bool is_nv21) KLEIDICV_STREAMING_COMPATIBLE { YUVSpToBGRA operation{is_nv21}; return yuv2rgbx_operation(operation, src_y, src_y_stride, src_uv, src_uv_stride, dst, dst_stride, width, height); } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_YUV_TO_RGB_SC_H +#endif // KLEIDICV_YUV_TO_RGB_SC_H diff --git a/intrinsiccv/src/conversions/yuv_to_rgb_sme2.cpp b/intrinsiccv/src/conversions/yuv_to_rgb_sme2.cpp index cc1de8861..21468f8d0 100644 --- a/intrinsiccv/src/conversions/yuv_to_rgb_sme2.cpp +++ b/intrinsiccv/src/conversions/yuv_to_rgb_sme2.cpp @@ -6,7 +6,7 @@ namespace intrinsiccv::sme2 { -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { @@ -14,7 +14,7 @@ yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, dst_stride, width, height, is_nv21); } -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, @@ -23,7 +23,7 @@ yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, dst_stride, width, height, is_nv21); } -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { @@ -31,7 +31,7 @@ yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, dst_stride, width, height, is_nv21); } -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgra_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, diff --git a/intrinsiccv/src/conversions/yuv_to_rgb_sve2.cpp b/intrinsiccv/src/conversions/yuv_to_rgb_sve2.cpp index 9a0e22376..edd1cec26 100644 --- a/intrinsiccv/src/conversions/yuv_to_rgb_sve2.cpp +++ b/intrinsiccv/src/conversions/yuv_to_rgb_sve2.cpp @@ -6,7 +6,7 @@ namespace intrinsiccv::sve2 { -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, @@ -16,7 +16,7 @@ intrinsiccv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, dst_stride, width, height, is_nv21); } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, @@ -26,7 +26,7 @@ intrinsiccv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, dst_stride, width, height, is_nv21); } -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { @@ -34,7 +34,7 @@ yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, dst_stride, width, height, is_nv21); } -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgra_u8( +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgra_u8( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { diff --git a/intrinsiccv/src/filters/gaussian_blur_api.cpp b/intrinsiccv/src/filters/gaussian_blur_api.cpp index 39982b6a8..841694de4 100644 --- a/intrinsiccv/src/filters/gaussian_blur_api.cpp +++ b/intrinsiccv/src/filters/gaussian_blur_api.cpp @@ -9,8 +9,8 @@ extern "C" { -using INTRINSICCV_TARGET_NAMESPACE::Rectangle; -using INTRINSICCV_TARGET_NAMESPACE::SeparableFilterWorkspace; +using KLEIDICV_TARGET_NAMESPACE::Rectangle; +using KLEIDICV_TARGET_NAMESPACE::SeparableFilterWorkspace; intrinsiccv_error_t intrinsiccv_filter_create( intrinsiccv_filter_context_t **context, size_t channels, size_t type_size, @@ -18,24 +18,24 @@ intrinsiccv_error_t intrinsiccv_filter_create( CHECK_POINTERS(context); CHECK_RECTANGLE_SIZE(image); - if (type_size > INTRINSICCV_MAXIMUM_TYPE_SIZE) { - return INTRINSICCV_ERROR_RANGE; + if (type_size > KLEIDICV_MAXIMUM_TYPE_SIZE) { + return KLEIDICV_ERROR_RANGE; } - if (channels > INTRINSICCV_MAXIMUM_CHANNEL_COUNT) { - return INTRINSICCV_ERROR_RANGE; + if (channels > KLEIDICV_MAXIMUM_CHANNEL_COUNT) { + return KLEIDICV_ERROR_RANGE; } auto workspace = SeparableFilterWorkspace::create(Rectangle{image}, channels, type_size); if (!workspace) { *context = nullptr; - return INTRINSICCV_ERROR_ALLOCATION; + return KLEIDICV_ERROR_ALLOCATION; } *context = reinterpret_cast(workspace.release()); - return INTRINSICCV_OK; + return KLEIDICV_OK; } intrinsiccv_error_t intrinsiccv_filter_release( @@ -48,16 +48,16 @@ intrinsiccv_error_t intrinsiccv_filter_release( SeparableFilterWorkspace::Pointer{ reinterpret_cast(context)}; // NOLINTEND(bugprone-unused-raii) - return INTRINSICCV_OK; + return KLEIDICV_OK; } } // extern "C" -INTRINSICCV_MULTIVERSION_C_API(intrinsiccv_gaussian_blur_3x3_u8, - &intrinsiccv::neon::gaussian_blur_3x3_u8, - nullptr, nullptr); +KLEIDICV_MULTIVERSION_C_API(intrinsiccv_gaussian_blur_3x3_u8, + &intrinsiccv::neon::gaussian_blur_3x3_u8, nullptr, + nullptr); -INTRINSICCV_MULTIVERSION_C_API( +KLEIDICV_MULTIVERSION_C_API( intrinsiccv_gaussian_blur_5x5_u8, &intrinsiccv::neon::gaussian_blur_5x5_u8, - INTRINSICCV_SVE2_IMPL_IF(intrinsiccv::sve2::gaussian_blur_5x5_u8), + KLEIDICV_SVE2_IMPL_IF(intrinsiccv::sve2::gaussian_blur_5x5_u8), &intrinsiccv::sme2::gaussian_blur_5x5_u8); diff --git a/intrinsiccv/src/filters/gaussian_blur_neon.cpp b/intrinsiccv/src/filters/gaussian_blur_neon.cpp index af3e3dd4a..56fd951f3 100644 --- a/intrinsiccv/src/filters/gaussian_blur_neon.cpp +++ b/intrinsiccv/src/filters/gaussian_blur_neon.cpp @@ -156,11 +156,11 @@ intrinsiccv_error_t discrete_gaussian_blur( CHECK_IMAGE_SIZE(width, height); if (width < KernelSize - 1 || height < KernelSize - 1) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } - if (channels > INTRINSICCV_MAXIMUM_CHANNEL_COUNT) { - return INTRINSICCV_ERROR_RANGE; + if (channels > KLEIDICV_MAXIMUM_CHANNEL_COUNT) { + return KLEIDICV_ERROR_RANGE; } Rectangle rect{width, height}; @@ -170,31 +170,31 @@ intrinsiccv_error_t discrete_gaussian_blur( auto *workspace = reinterpret_cast(context); if (workspace->buffer_type_size() != 2 * sizeof(ScalarType)) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } if (workspace->channels() != channels) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } if (workspace->image_size() != rect) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } auto fixed_border_type = get_fixed_border_type(border_type); if (!fixed_border_type) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } GaussianBlurFilterType blur; SeparableFilter filter{blur}; workspace->process(rect, src_rows, dst_rows, channels, *fixed_border_type, filter); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t gaussian_blur_3x3_u8( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, @@ -205,7 +205,7 @@ intrinsiccv_error_t gaussian_blur_3x3_u8( border_type, context); } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t gaussian_blur_5x5_u8( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, diff --git a/intrinsiccv/src/filters/gaussian_blur_sc.h b/intrinsiccv/src/filters/gaussian_blur_sc.h index c954d0efd..f2ae39d7e 100644 --- a/intrinsiccv/src/filters/gaussian_blur_sc.h +++ b/intrinsiccv/src/filters/gaussian_blur_sc.h @@ -2,15 +2,15 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_GAUSSIAN_BLUR_SC_H -#define INTRINSICCV_GAUSSIAN_BLUR_SC_H +#ifndef KLEIDICV_GAUSSIAN_BLUR_SC_H +#define KLEIDICV_GAUSSIAN_BLUR_SC_H #include #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/sve2.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { // Primary template for Gaussian Blur approximation filters. template @@ -36,7 +36,7 @@ class DiscreteGaussianBlur { void vertical_vector_path(svbool_t pg, svuint8_t src_0, svuint8_t src_1, svuint8_t src_2, svuint8_t src_3, svuint8_t src_4, BufferType *dst) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { svuint8_t const_6_u8 = svdup_n_u8(6); svuint16_t const_4_u16 = svdup_n_u16(4); @@ -60,7 +60,7 @@ class DiscreteGaussianBlur { void horizontal_vector_path(svbool_t pg, svuint16_t src_0, svuint16_t src_1, svuint16_t src_2, svuint16_t src_3, svuint16_t src_4, DestinationType *dst) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { svuint16_t const_4_u16 = svdup_n_u16(4); svuint16_t const_6_u16 = svdup_n_u16(6); @@ -76,7 +76,7 @@ class DiscreteGaussianBlur { // // DST = 1/256 * [ SRC0, SRC1, SRC2, SRC3, SRC4 ] * [ 1, 4, 6, 4, 1 ]T void horizontal_scalar_path(const BufferType src[5], DestinationType *dst) - const INTRINSICCV_STREAMING_COMPATIBLE { + const KLEIDICV_STREAMING_COMPATIBLE { auto acc = src[0] + src[4] + 4 * (src[1] + src[3]) + 6 * src[2]; dst[0] = rounding_shift_right(acc, 8); } @@ -87,7 +87,7 @@ intrinsiccv_error_t discrete_gaussian_blur( const ScalarType *src, size_t src_stride, ScalarType *dst, size_t dst_stride, size_t width, size_t height, size_t channels, intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context) INTRINSICCV_STREAMING_COMPATIBLE { + intrinsiccv_filter_context_t *context) KLEIDICV_STREAMING_COMPATIBLE { using GaussianBlurFilterType = DiscreteGaussianBlur; CHECK_POINTERS(context); @@ -96,11 +96,11 @@ intrinsiccv_error_t discrete_gaussian_blur( CHECK_IMAGE_SIZE(width, height); if (width < KernelSize - 1 || height < KernelSize - 1) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } - if (channels > INTRINSICCV_MAXIMUM_CHANNEL_COUNT) { - return INTRINSICCV_ERROR_RANGE; + if (channels > KLEIDICV_MAXIMUM_CHANNEL_COUNT) { + return KLEIDICV_ERROR_RANGE; } Rectangle rect{width, height}; @@ -110,15 +110,15 @@ intrinsiccv_error_t discrete_gaussian_blur( auto *workspace = reinterpret_cast(context); if (workspace->buffer_type_size() != 2 * sizeof(ScalarType)) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } if (workspace->channels() != channels) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } if (workspace->image_size() != rect) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } GaussianBlurFilterType blur; @@ -127,14 +127,14 @@ intrinsiccv_error_t discrete_gaussian_blur( auto fixed_border_type = get_fixed_border_type(border_type); if (!fixed_border_type) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } workspace->process(rect, src_rows, dst_rows, channels, *fixed_border_type, filter); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_GAUSSIAN_BLUR_SC_H +#endif // KLEIDICV_GAUSSIAN_BLUR_SC_H diff --git a/intrinsiccv/src/filters/gaussian_blur_sme2.cpp b/intrinsiccv/src/filters/gaussian_blur_sme2.cpp index f91d23d34..592385d69 100644 --- a/intrinsiccv/src/filters/gaussian_blur_sme2.cpp +++ b/intrinsiccv/src/filters/gaussian_blur_sme2.cpp @@ -7,7 +7,7 @@ namespace intrinsiccv::sme2 { -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t gaussian_blur_5x5_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, intrinsiccv_border_type_t border_type, diff --git a/intrinsiccv/src/filters/gaussian_blur_sve2.cpp b/intrinsiccv/src/filters/gaussian_blur_sve2.cpp index b3035b0a8..3c83ff8de 100644 --- a/intrinsiccv/src/filters/gaussian_blur_sve2.cpp +++ b/intrinsiccv/src/filters/gaussian_blur_sve2.cpp @@ -7,7 +7,7 @@ namespace intrinsiccv::sve2 { -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t gaussian_blur_5x5_u8( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, diff --git a/intrinsiccv/src/filters/sobel_api.cpp b/intrinsiccv/src/filters/sobel_api.cpp index b7663ca0f..f4a7b1c23 100644 --- a/intrinsiccv/src/filters/sobel_api.cpp +++ b/intrinsiccv/src/filters/sobel_api.cpp @@ -6,13 +6,13 @@ #include "intrinsiccv/filters/sobel.h" #include "intrinsiccv/intrinsiccv.h" -#define INTRINSICCV_DEFINE_C_API(name, partialname) \ - INTRINSICCV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::partialname, \ - INTRINSICCV_SVE2_IMPL_IF(&intrinsiccv::sve2::partialname), \ +#define KLEIDICV_DEFINE_C_API(name, partialname) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &intrinsiccv::neon::partialname, \ + KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::partialname), \ &intrinsiccv::sme2::partialname) -INTRINSICCV_DEFINE_C_API(intrinsiccv_sobel_3x3_horizontal_s16_u8, - sobel_3x3_horizontal_s16_u8); -INTRINSICCV_DEFINE_C_API(intrinsiccv_sobel_3x3_vertical_s16_u8, - sobel_3x3_vertical_s16_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_sobel_3x3_horizontal_s16_u8, + sobel_3x3_horizontal_s16_u8); +KLEIDICV_DEFINE_C_API(intrinsiccv_sobel_3x3_vertical_s16_u8, + sobel_3x3_vertical_s16_u8); diff --git a/intrinsiccv/src/filters/sobel_neon.cpp b/intrinsiccv/src/filters/sobel_neon.cpp index 16b6046e7..16cc58e4b 100644 --- a/intrinsiccv/src/filters/sobel_neon.cpp +++ b/intrinsiccv/src/filters/sobel_neon.cpp @@ -126,7 +126,7 @@ class VerticalSobel3x3 { } }; // end of class VerticalSobel3x3 -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, @@ -139,11 +139,11 @@ intrinsiccv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, const size_t KernelSize = 3; if (width < KernelSize - 1 || height < KernelSize - 1) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } - if (channels > INTRINSICCV_MAXIMUM_CHANNEL_COUNT) { - return INTRINSICCV_ERROR_RANGE; + if (channels > KLEIDICV_MAXIMUM_CHANNEL_COUNT) { + return KLEIDICV_ERROR_RANGE; } Rectangle rect{width, height}; @@ -153,17 +153,17 @@ intrinsiccv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, auto workspace = SeparableFilterWorkspace::create(rect, channels, sizeof(int16_t)); if (!workspace) { - return INTRINSICCV_ERROR_ALLOCATION; + return KLEIDICV_ERROR_ALLOCATION; } HorizontalSobel3x3 horizontal_sobel; SeparableFilter3x3> filter{horizontal_sobel}; workspace->process(rect, src_rows, dst_rows, channels, FixedBorderType::REPLICATE, filter); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, @@ -175,11 +175,11 @@ intrinsiccv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, const size_t KernelSize = 3; if (width < KernelSize - 1 || height < KernelSize - 1) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } - if (channels > INTRINSICCV_MAXIMUM_CHANNEL_COUNT) { - return INTRINSICCV_ERROR_RANGE; + if (channels > KLEIDICV_MAXIMUM_CHANNEL_COUNT) { + return KLEIDICV_ERROR_RANGE; } Rectangle rect{width, height}; @@ -189,14 +189,14 @@ intrinsiccv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, auto workspace = SeparableFilterWorkspace::create(rect, channels, sizeof(int16_t)); if (!workspace) { - return INTRINSICCV_ERROR_ALLOCATION; + return KLEIDICV_ERROR_ALLOCATION; } VerticalSobel3x3 vertical_sobel; SeparableFilter3x3> filter{vertical_sobel}; workspace->process(rect, src_rows, dst_rows, channels, FixedBorderType::REPLICATE, filter); - return INTRINSICCV_OK; + return KLEIDICV_OK; } } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/filters/sobel_sc.h b/intrinsiccv/src/filters/sobel_sc.h index d8d05324e..1bd04691a 100644 --- a/intrinsiccv/src/filters/sobel_sc.h +++ b/intrinsiccv/src/filters/sobel_sc.h @@ -2,14 +2,14 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_SOBEL_SC_H -#define INTRINSICCV_SOBEL_SC_H +#ifndef KLEIDICV_SOBEL_SC_H +#define KLEIDICV_SOBEL_SC_H #include "intrinsiccv/filters/sobel.h" #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/sve2.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { // Template for 3x3 Sobel filters which calculate horizontal derivative // approximations, often denoted as Gx. @@ -34,7 +34,7 @@ class HorizontalSobel3x3 { // DST = [ SRC0, SRC1, SRC2 ] * [ 1, 2, 1 ]T void vertical_vector_path(svbool_t pg, svuint8_t src_0, svuint8_t src_1, svuint8_t src_2, BufferType *dst) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { svuint16_t acc_u16_b = svaddlb(src_0, src_2); svuint16_t acc_u16_t = svaddlt(src_0, src_2); acc_u16_b = svmlalb(acc_u16_b, src_1, svdup_n_u8(2)); @@ -50,7 +50,7 @@ class HorizontalSobel3x3 { // DST = [ SRC0, SRC1, SRC2 ] * [ -1, 0, 1 ]T void horizontal_vector_path( svbool_t pg, svint16_t src_0, svint16_t /* src_1 */, svint16_t src_2, - DestinationType *dst) const INTRINSICCV_STREAMING_COMPATIBLE { + DestinationType *dst) const KLEIDICV_STREAMING_COMPATIBLE { svst1(pg, &dst[0], svsub_x(pg, src_2, src_0)); } @@ -58,7 +58,7 @@ class HorizontalSobel3x3 { // // DST = [ SRC0, SRC1, SRC2 ] * [ -1, 0, 1 ]T void horizontal_scalar_path(const BufferType src[3], DestinationType *dst) - const INTRINSICCV_STREAMING_COMPATIBLE { + const KLEIDICV_STREAMING_COMPATIBLE { // Explicitly narrow. Overflow is permitted. dst[0] = static_cast(src[2] - src[0]); } @@ -87,7 +87,7 @@ class VerticalSobel3x3 { // DST = [ SRC0, SRC1, SRC2 ] * [ -1, 0, 1 ]T void vertical_vector_path(svbool_t pg, svuint8_t src_0, svuint8_t /* src_1 */, svuint8_t src_2, BufferType *dst) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { svuint16_t acc_u16_b = svsublb(src_2, src_0); svuint16_t acc_u16_t = svsublt(src_2, src_0); @@ -101,7 +101,7 @@ class VerticalSobel3x3 { // DST = [ SRC0, SRC1, SRC2 ] * [ 1, 2, 1 ]T void horizontal_vector_path(svbool_t pg, svint16_t src_0, svint16_t src_1, svint16_t src_2, DestinationType *dst) const - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { svint16_t acc = svadd_x(pg, src_0, src_2); acc = svmad_s16_x(pg, src_1, svdup_n_s16(2), acc); svst1(pg, &dst[0], acc); @@ -111,17 +111,17 @@ class VerticalSobel3x3 { // // DST = [ SRC0, SRC1, SRC2 ] * [ 1, 2, 1 ]T void horizontal_scalar_path(const BufferType src[3], DestinationType *dst) - const INTRINSICCV_STREAMING_COMPATIBLE { + const KLEIDICV_STREAMING_COMPATIBLE { // Explicitly narrow. Overflow is permitted. dst[0] = static_cast(src[0] + 2 * src[1] + src[2]); } }; // end of class VerticalSobel3x3 -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t sobel_3x3_horizontal_s16_u8_sc( const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, - size_t channels) INTRINSICCV_STREAMING_COMPATIBLE { + size_t channels) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -129,11 +129,11 @@ static intrinsiccv_error_t sobel_3x3_horizontal_s16_u8_sc( const size_t KernelSize = 3; if (width < KernelSize - 1 || height < KernelSize - 1) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } - if (channels > INTRINSICCV_MAXIMUM_CHANNEL_COUNT) { - return INTRINSICCV_ERROR_RANGE; + if (channels > KLEIDICV_MAXIMUM_CHANNEL_COUNT) { + return KLEIDICV_ERROR_RANGE; } Rectangle rect{width, height}; @@ -143,21 +143,21 @@ static intrinsiccv_error_t sobel_3x3_horizontal_s16_u8_sc( auto workspace = SeparableFilterWorkspace::create(rect, channels, sizeof(int16_t)); if (!workspace) { - return INTRINSICCV_ERROR_ALLOCATION; + return KLEIDICV_ERROR_ALLOCATION; } HorizontalSobel3x3 horizontal_sobel; SeparableFilter3x3> filter{horizontal_sobel}; workspace->process(rect, src_rows, dst_rows, channels, FixedBorderType::REPLICATE, filter); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t sobel_3x3_vertical_s16_u8_sc( const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, - size_t channels) INTRINSICCV_STREAMING_COMPATIBLE { + size_t channels) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -165,11 +165,11 @@ static intrinsiccv_error_t sobel_3x3_vertical_s16_u8_sc( const size_t KernelSize = 3; if (width < KernelSize - 1 || height < KernelSize - 1) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } - if (channels > INTRINSICCV_MAXIMUM_CHANNEL_COUNT) { - return INTRINSICCV_ERROR_RANGE; + if (channels > KLEIDICV_MAXIMUM_CHANNEL_COUNT) { + return KLEIDICV_ERROR_RANGE; } Rectangle rect{width, height}; @@ -179,16 +179,16 @@ static intrinsiccv_error_t sobel_3x3_vertical_s16_u8_sc( auto workspace = SeparableFilterWorkspace::create(rect, channels, sizeof(int16_t)); if (!workspace) { - return INTRINSICCV_ERROR_ALLOCATION; + return KLEIDICV_ERROR_ALLOCATION; } VerticalSobel3x3 vertical_sobel; SeparableFilter3x3> filter{vertical_sobel}; workspace->process(rect, src_rows, dst_rows, channels, FixedBorderType::REPLICATE, filter); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_SOBEL_SC_H +#endif // KLEIDICV_SOBEL_SC_H diff --git a/intrinsiccv/src/filters/sobel_sme2.cpp b/intrinsiccv/src/filters/sobel_sme2.cpp index 0d183f51c..2831babb6 100644 --- a/intrinsiccv/src/filters/sobel_sme2.cpp +++ b/intrinsiccv/src/filters/sobel_sme2.cpp @@ -6,7 +6,7 @@ namespace intrinsiccv::sme2 { -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) { @@ -14,7 +14,7 @@ sobel_3x3_horizontal_s16_u8(const uint8_t *src, size_t src_stride, int16_t *dst, height, channels); } -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) { diff --git a/intrinsiccv/src/filters/sobel_sve2.cpp b/intrinsiccv/src/filters/sobel_sve2.cpp index 7293b8a7c..735851850 100644 --- a/intrinsiccv/src/filters/sobel_sve2.cpp +++ b/intrinsiccv/src/filters/sobel_sve2.cpp @@ -6,14 +6,14 @@ namespace intrinsiccv::sve2 { -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t sobel_3x3_horizontal_s16_u8( +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t sobel_3x3_horizontal_s16_u8( const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) { return sobel_3x3_horizontal_s16_u8_sc(src, src_stride, dst, dst_stride, width, height, channels); } -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t sobel_3x3_vertical_s16_u8( +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t sobel_3x3_vertical_s16_u8( const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) { return sobel_3x3_vertical_s16_u8_sc(src, src_stride, dst, dst_stride, width, diff --git a/intrinsiccv/src/morphology/morphology_api.cpp b/intrinsiccv/src/morphology/morphology_api.cpp index 5fc168e8c..2e3650a7a 100644 --- a/intrinsiccv/src/morphology/morphology_api.cpp +++ b/intrinsiccv/src/morphology/morphology_api.cpp @@ -54,7 +54,7 @@ intrinsiccv_error_t erode(const T *src, size_t src_stride, T *dst, extern "C" { -using INTRINSICCV_TARGET_NAMESPACE::MorphologyWorkspace; +using KLEIDICV_TARGET_NAMESPACE::MorphologyWorkspace; intrinsiccv_error_t intrinsiccv_morphology_create( intrinsiccv_morphology_context_t **context, intrinsiccv_rectangle_t kernel, @@ -66,19 +66,19 @@ intrinsiccv_error_t intrinsiccv_morphology_create( CHECK_RECTANGLE_SIZE(kernel); CHECK_RECTANGLE_SIZE(image); - if (type_size > INTRINSICCV_MAXIMUM_TYPE_SIZE) { - return INTRINSICCV_ERROR_RANGE; + if (type_size > KLEIDICV_MAXIMUM_TYPE_SIZE) { + return KLEIDICV_ERROR_RANGE; } - if (channels > INTRINSICCV_MAXIMUM_CHANNEL_COUNT) { - return INTRINSICCV_ERROR_RANGE; + if (channels > KLEIDICV_MAXIMUM_CHANNEL_COUNT) { + return KLEIDICV_ERROR_RANGE; } auto morphology_border_type = MorphologyWorkspace::get_border_type(border_type); if (!morphology_border_type) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } MorphologyWorkspace::Pointer workspace; @@ -90,7 +90,7 @@ intrinsiccv_error_t intrinsiccv_morphology_create( *context = reinterpret_cast(workspace.release()); - return INTRINSICCV_OK; + return KLEIDICV_OK; } intrinsiccv_error_t intrinsiccv_morphology_release( @@ -103,16 +103,16 @@ intrinsiccv_error_t intrinsiccv_morphology_release( MorphologyWorkspace::Pointer{ reinterpret_cast(context)}; // NOLINTEND(bugprone-unused-raii) - return INTRINSICCV_OK; + return KLEIDICV_OK; } } // extern "C" -#define INTRINSICCV_DEFINE_C_API(name, tname, type) \ - INTRINSICCV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::tname, \ - INTRINSICCV_SVE2_IMPL_IF(&intrinsiccv::sve2::tname), \ +#define KLEIDICV_DEFINE_C_API(name, tname, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &intrinsiccv::neon::tname, \ + KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::tname), \ &intrinsiccv::sme2::tname) -INTRINSICCV_DEFINE_C_API(intrinsiccv_dilate_u8, dilate, uint8_t); -INTRINSICCV_DEFINE_C_API(intrinsiccv_erode_u8, erode, uint8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_dilate_u8, dilate, uint8_t); +KLEIDICV_DEFINE_C_API(intrinsiccv_erode_u8, erode, uint8_t); diff --git a/intrinsiccv/src/morphology/morphology_neon.cpp b/intrinsiccv/src/morphology/morphology_neon.cpp index 326e06589..9e2aef425 100644 --- a/intrinsiccv/src/morphology/morphology_neon.cpp +++ b/intrinsiccv/src/morphology/morphology_neon.cpp @@ -21,7 +21,7 @@ class VerticalOp final { void process_rows(IndirectRows src_rows, Rows dst_rows) { - if (INTRINSICCV_UNLIKELY(kernel_.height()) == 1) { + if (KLEIDICV_UNLIKELY(kernel_.height()) == 1) { CopyRows::copy_rows(rect_, src_rows, dst_rows); return; } @@ -123,7 +123,7 @@ class VerticalOp final { vst1q(&dst_row[3 * VecTraits::num_lanes()], acc3); // Try to process one more row, because it is relatively cheap to do so. - if (INTRINSICCV_UNLIKELY((height + 1) >= rect_.height())) { + if (KLEIDICV_UNLIKELY((height + 1) >= rect_.height())) { return; } @@ -197,7 +197,7 @@ class VerticalOp final { vst1q(&dst_row[VecTraits::num_lanes()], acc1); // Try to process one more row, because it is relatively cheap to do so. - if (INTRINSICCV_UNLIKELY((height + 1) >= rect_.height())) { + if (KLEIDICV_UNLIKELY((height + 1) >= rect_.height())) { return; } @@ -248,7 +248,7 @@ class VerticalOp final { vst1q(&dst_rows[index], acc); // Try to process one more row, because it is relatively cheap to do so. - if (INTRINSICCV_UNLIKELY((height + 1) >= rect_.height())) { + if (KLEIDICV_UNLIKELY((height + 1) >= rect_.height())) { return; } @@ -294,7 +294,7 @@ class VerticalOp final { dst_rows[index] = acc; // Try to process one more row, because it is relatively cheap to do so. - if (INTRINSICCV_UNLIKELY((height + 1) >= rect_.height())) { + if (KLEIDICV_UNLIKELY((height + 1) >= rect_.height())) { return; } @@ -499,19 +499,19 @@ intrinsiccv_error_t dilate(const T *src, size_t src_stride, T *dst, auto *workspace = reinterpret_cast(context); if (workspace->type_size() != sizeof(T)) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } Rectangle rect{width, height}; if (workspace->image_size() != rect) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } // Currently valid, will need to be changed if morphology supports more border - // types, like INTRINSICCV_BORDER_TYPE_REVERSE. + // types, like KLEIDICV_BORDER_TYPE_REVERSE. Rectangle kernel{workspace->kernel()}; if (width < kernel.width() - 1 || height < kernel.height() - 1) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } Rows src_rows{src, src_stride, workspace->channels()}; @@ -528,7 +528,7 @@ intrinsiccv_error_t dilate(const T *src, size_t src_stride, T *dst, // Update source for the next iteration. current_src_rows = dst_rows; } - return INTRINSICCV_OK; + return KLEIDICV_OK; } // Helper structure for erode. @@ -570,19 +570,19 @@ intrinsiccv_error_t erode(const T *src, size_t src_stride, T *dst, auto *workspace = reinterpret_cast(context); if (workspace->type_size() != sizeof(T)) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } Rectangle rect{width, height}; if (workspace->image_size() != rect) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } // Currently valid, will need to be changed if morphology supports more border - // types, like INTRINSICCV_BORDER_TYPE_REVERSE. + // types, like KLEIDICV_BORDER_TYPE_REVERSE. Rectangle kernel{workspace->kernel()}; if (width < kernel.width() - 1 || height < kernel.height() - 1) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } Rows src_rows{src, src_stride, workspace->channels()}; @@ -599,15 +599,15 @@ intrinsiccv_error_t erode(const T *src, size_t src_stride, T *dst, // Update source for the next iteration. current_src_rows = dst_rows; } - return INTRINSICCV_OK; + return KLEIDICV_OK; } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(name, type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t name( \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(name, type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t name( \ const type *src, size_t src_stride, type *dst, size_t dst_stride, \ size_t width, size_t height, intrinsiccv_morphology_context_t *context) -INTRINSICCV_INSTANTIATE_TEMPLATE(dilate, uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(erode, uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(dilate, uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(erode, uint8_t); } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/morphology/morphology_sc.h b/intrinsiccv/src/morphology/morphology_sc.h index f9bf3b83a..7698c92fa 100644 --- a/intrinsiccv/src/morphology/morphology_sc.h +++ b/intrinsiccv/src/morphology/morphology_sc.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_MORPHOLOGY_SC_H -#define INTRINSICCV_MORPHOLOGY_SC_H +#ifndef KLEIDICV_MORPHOLOGY_SC_H +#define KLEIDICV_MORPHOLOGY_SC_H #include #include @@ -13,25 +13,25 @@ #include "intrinsiccv/sve2.h" #include "intrinsiccv/types.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { template class CopyDataSVE2 { class CopyOperation final : public UnrollTwice { public: using ContextType = Context; - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; VectorType vector_path(ContextType, - VectorType src) INTRINSICCV_STREAMING_COMPATIBLE { + VectorType src) KLEIDICV_STREAMING_COMPATIBLE { return src; } }; // end of class CopyOperation public: void operator()(Rows src_rows, Rows dst_rows, - size_t length) const INTRINSICCV_STREAMING_COMPATIBLE { + size_t length) const KLEIDICV_STREAMING_COMPATIBLE { // 'apply_operation_by_rows' can only handle one channel well // so width must be multiplied in order to copy all the data Rectangle rect{length * dst_rows.channels(), std::size_t{1}}; @@ -45,16 +45,15 @@ class CopyDataSVE2 { template class VerticalOp final { public: - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; - VerticalOp(Rectangle rect, Rectangle kernel) INTRINSICCV_STREAMING_COMPATIBLE + VerticalOp(Rectangle rect, Rectangle kernel) KLEIDICV_STREAMING_COMPATIBLE : rect_(rect), kernel_(kernel) {} void process_rows(IndirectRows src_rows, - Rows dst_rows) - INTRINSICCV_STREAMING_COMPATIBLE { - if (INTRINSICCV_UNLIKELY(kernel_.height()) == 1) { + Rows dst_rows) KLEIDICV_STREAMING_COMPATIBLE { + if (KLEIDICV_UNLIKELY(kernel_.height()) == 1) { CopyRows::copy_rows(rect_, src_rows, dst_rows); return; } @@ -66,13 +65,13 @@ class VerticalOp final { LoopUnroll2 loop{rect_.width() * src_rows.channels(), VecTraits::num_lanes()}; // clang-format off - loop.unroll_four_times([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + loop.unroll_four_times([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { vector_path_4x(src_rows, dst_rows, index, height); }) - .unroll_twice([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + .unroll_twice([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { vector_path_2x(src_rows, dst_rows, index, height); }) - .remaining([&](size_t index, size_t length) INTRINSICCV_STREAMING_COMPATIBLE { + .remaining([&](size_t index, size_t length) KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg = VecTraits::svwhilelt(index, length); while (svptest_first(VecTraits::svptrue(), pg)) { vector_path(pg, src_rows, dst_rows, index, height); @@ -89,7 +88,7 @@ class VerticalOp final { private: void vector_path_4x(IndirectRows src_rows, Rows dst_rows, const size_t index, - const size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + const size_t height) KLEIDICV_STREAMING_COMPATIBLE { const ScalarType *src_row = &src_rows[index]; auto first_row0 = svld1(VecTraits::svptrue(), &src_row[0]); auto first_row1 = svld1_vnum(VecTraits::svptrue(), &src_row[0], 1); @@ -106,7 +105,7 @@ class VerticalOp final { LoopUnroll loop{kernel_.height() - 2, 2}; - loop.unroll_once([&](size_t step) INTRINSICCV_STREAMING_COMPATIBLE { + loop.unroll_once([&](size_t step) KLEIDICV_STREAMING_COMPATIBLE { const ScalarType *src_row0 = &src_rows.at(0)[index]; const ScalarType *src_row1 = &src_rows.at(1)[index]; auto row00 = svld1(VecTraits::svptrue(), src_row0); @@ -129,7 +128,7 @@ class VerticalOp final { }); loop.tail([&](size_t /* index */) // NOLINT(readability/casting) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { const ScalarType *src_row = &src_rows[index]; auto row0 = svld1(VecTraits::svptrue(), &src_row[0]); auto row1 = svld1_vnum(VecTraits::svptrue(), &src_row[0], 1); @@ -162,7 +161,7 @@ class VerticalOp final { svst1_vnum(VecTraits::svptrue(), &dst_row[0], 3, acc3); // Try to process one more row, because it is relatively cheap to do so. - if (INTRINSICCV_UNLIKELY((height + 1) >= rect_.height())) { + if (KLEIDICV_UNLIKELY((height + 1) >= rect_.height())) { return; } @@ -189,7 +188,7 @@ class VerticalOp final { void vector_path_2x(IndirectRows src_rows, Rows dst_rows, const size_t index, - const size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + const size_t height) KLEIDICV_STREAMING_COMPATIBLE { const ScalarType *src_row = &src_rows[index]; auto first_row0 = svld1(VecTraits::svptrue(), &src_row[0]); auto first_row1 = svld1_vnum(VecTraits::svptrue(), &src_row[0], 1); @@ -202,7 +201,7 @@ class VerticalOp final { LoopUnroll loop{kernel_.height() - 2, 2}; - loop.unroll_once([&](size_t step) INTRINSICCV_STREAMING_COMPATIBLE { + loop.unroll_once([&](size_t step) KLEIDICV_STREAMING_COMPATIBLE { const ScalarType *src_row0 = &src_rows.at(0)[index]; const ScalarType *src_row1 = &src_rows.at(1)[index]; auto row00 = svld1(VecTraits::svptrue(), src_row0); @@ -217,7 +216,7 @@ class VerticalOp final { }); loop.tail([&](size_t /* index */) // NOLINT(readability/casting) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { const ScalarType *src_row = &src_rows[index]; auto row0 = svld1(VecTraits::svptrue(), &src_row[0]); auto row1 = svld1_vnum(VecTraits::svptrue(), &src_row[0], 1); @@ -240,7 +239,7 @@ class VerticalOp final { svst1_vnum(VecTraits::svptrue(), &dst_row[0], 1, acc1); // Try to process one more row, because it is relatively cheap to do so. - if (INTRINSICCV_UNLIKELY((height + 1) >= rect_.height())) { + if (KLEIDICV_UNLIKELY((height + 1) >= rect_.height())) { return; } @@ -260,7 +259,7 @@ class VerticalOp final { void vector_path(svbool_t pg, IndirectRows src_rows, Rows dst_rows, const size_t index, - const size_t height) INTRINSICCV_STREAMING_COMPATIBLE { + const size_t height) KLEIDICV_STREAMING_COMPATIBLE { auto first_row = svld1(pg, &src_rows[index]); ++src_rows; @@ -269,7 +268,7 @@ class VerticalOp final { LoopUnroll loop{kernel_.height() - 2, 2}; - loop.unroll_once([&](size_t step) INTRINSICCV_STREAMING_COMPATIBLE { + loop.unroll_once([&](size_t step) KLEIDICV_STREAMING_COMPATIBLE { auto row0 = svld1(pg, &src_rows.at(0)[index]); auto row1 = svld1(pg, &src_rows.at(1)[index]); acc = O::operation(pg, acc, O::operation(pg, row0, row1)); @@ -277,7 +276,7 @@ class VerticalOp final { }); loop.tail([&](size_t /* index */) // NOLINT(readability/casting) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { auto row = svld1(pg, &src_rows[index]); acc = O::operation(pg, acc, row); ++src_rows; @@ -293,7 +292,7 @@ class VerticalOp final { svst1(pg, &dst_rows[index], acc); // Try to process one more row, because it is relatively cheap to do so. - if (INTRINSICCV_UNLIKELY((height + 1) >= rect_.height())) { + if (KLEIDICV_UNLIKELY((height + 1) >= rect_.height())) { return; } @@ -311,28 +310,27 @@ class VerticalOp final { template class HorizontalOp final { public: - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; - HorizontalOp(Rectangle rect, - Rectangle kernel) INTRINSICCV_STREAMING_COMPATIBLE + HorizontalOp(Rectangle rect, Rectangle kernel) KLEIDICV_STREAMING_COMPATIBLE : rect_(rect), kernel_(kernel) {} - void process_rows(Rows src_rows, Rows dst_rows) - INTRINSICCV_STREAMING_COMPATIBLE { + void process_rows(Rows src_rows, + Rows dst_rows) KLEIDICV_STREAMING_COMPATIBLE { // Iterate across the rows from top to bottom. for (size_t height = 0; height < rect_.height(); ++height) { // Iterate across the columns from left to right. LoopUnroll2 loop{rect_.width() * src_rows.channels(), VecTraits::num_lanes()}; // clang-format off - loop.unroll_four_times([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + loop.unroll_four_times([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { vector_path_4x(src_rows, dst_rows, index); }) - .unroll_twice([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + .unroll_twice([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { vector_path_2x(src_rows, dst_rows, index); }) - .remaining([&](size_t index, size_t length) INTRINSICCV_STREAMING_COMPATIBLE { + .remaining([&](size_t index, size_t length) KLEIDICV_STREAMING_COMPATIBLE { svbool_t pg = VecTraits::svwhilelt(index, length); while (svptest_first(VecTraits::svptrue(), pg)) { vector_path(pg, src_rows, dst_rows, index); @@ -349,7 +347,7 @@ class HorizontalOp final { private: void vector_path_4x(Rows src_rows, Rows dst_rows, - const size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + const size_t index) KLEIDICV_STREAMING_COMPATIBLE { const auto *src_row = &src_rows[index]; auto acc0 = svld1(VecTraits::svptrue(), &src_row[0]); auto acc1 = svld1_vnum(VecTraits::svptrue(), &src_row[0], 1); @@ -377,7 +375,7 @@ class HorizontalOp final { void vector_path_2x(Rows src_rows, Rows dst_rows, - const size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + const size_t index) KLEIDICV_STREAMING_COMPATIBLE { const auto *src_row = &src_rows[index]; auto acc0 = svld1(VecTraits::svptrue(), &src_row[0]); auto acc1 = svld1_vnum(VecTraits::svptrue(), &src_row[0], 1); @@ -397,7 +395,7 @@ class HorizontalOp final { void vector_path(svbool_t pg, Rows src_rows, Rows dst_rows, - const size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + const size_t index) KLEIDICV_STREAMING_COMPATIBLE { auto acc = svld1(pg, &src_rows[index]); for (size_t width = 1; width < kernel_.width(); ++width) { @@ -415,11 +413,11 @@ class HorizontalOp final { template class Min final { public: - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; static VectorType operation(svbool_t pg, VectorType lhs, - VectorType rhs) INTRINSICCV_STREAMING_COMPATIBLE { + VectorType rhs) KLEIDICV_STREAMING_COMPATIBLE { return svmin_x(pg, lhs, rhs); } }; // end of class Min @@ -427,11 +425,11 @@ class Min final { template class Max final { public: - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; using VectorType = typename VecTraits::VectorType; static VectorType operation(svbool_t pg, VectorType lhs, - VectorType rhs) INTRINSICCV_STREAMING_COMPATIBLE { + VectorType rhs) KLEIDICV_STREAMING_COMPATIBLE { return svmax_x(pg, lhs, rhs); } }; // end of class Max @@ -454,18 +452,18 @@ class DilateOperation final { using DestinationType = ScalarType; using CopyData = CopyDataOperation; - explicit DilateOperation(Rectangle kernel) INTRINSICCV_STREAMING_COMPATIBLE + explicit DilateOperation(Rectangle kernel) KLEIDICV_STREAMING_COMPATIBLE : kernel_{kernel} {} void process_horizontal(Rectangle rect, Rows src_rows, Rows dst_rows) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { HorizontalMax{rect, kernel_}.process_rows(src_rows, dst_rows); } void process_vertical(Rectangle rect, IndirectRows src_rows, Rows dst_rows) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { VerticalMax{rect, kernel_}.process_rows(src_rows, dst_rows); } @@ -474,11 +472,10 @@ class DilateOperation final { }; // end of class DilateOperation template -static intrinsiccv_error_t dilate_sc(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, - size_t height, - intrinsiccv_morphology_context_t *context) - INTRINSICCV_STREAMING_COMPATIBLE { +static intrinsiccv_error_t dilate_sc( + const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, + size_t height, + intrinsiccv_morphology_context_t *context) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTERS(context); CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -487,19 +484,19 @@ static intrinsiccv_error_t dilate_sc(const T *src, size_t src_stride, T *dst, auto *workspace = reinterpret_cast(context); if (workspace->type_size() != sizeof(T)) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } Rectangle rect{width, height}; if (workspace->image_size() != rect) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } // Currently valid, will need to be changed if morphology supports more border - // types, like INTRINSICCV_BORDER_TYPE_REVERSE. + // types, like KLEIDICV_BORDER_TYPE_REVERSE. Rectangle kernel{workspace->kernel()}; if (width < kernel.width() - 1 || height < kernel.height() - 1) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } Rows src_rows{src, src_stride, workspace->channels()}; @@ -516,7 +513,7 @@ static intrinsiccv_error_t dilate_sc(const T *src, size_t src_stride, T *dst, // Update source for the next iteration. current_src_rows = dst_rows; } - return INTRINSICCV_OK; + return KLEIDICV_OK; } // Helper structure for erode. @@ -528,18 +525,18 @@ class ErodeOperation final { using DestinationType = ScalarType; using CopyData = CopyDataOperation; - explicit ErodeOperation(Rectangle kernel) INTRINSICCV_STREAMING_COMPATIBLE + explicit ErodeOperation(Rectangle kernel) KLEIDICV_STREAMING_COMPATIBLE : kernel_{kernel} {} void process_horizontal(Rectangle rect, Rows src_rows, Rows dst_rows) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { HorizontalMin{rect, kernel_}.process_rows(src_rows, dst_rows); } void process_vertical(Rectangle rect, IndirectRows src_rows, Rows dst_rows) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { VerticalMin{rect, kernel_}.process_rows(src_rows, dst_rows); } @@ -548,11 +545,10 @@ class ErodeOperation final { }; // end of class ErodeOperation template -static intrinsiccv_error_t erode_sc(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, - size_t height, - intrinsiccv_morphology_context_t *context) - INTRINSICCV_STREAMING_COMPATIBLE { +static intrinsiccv_error_t erode_sc( + const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, + size_t height, + intrinsiccv_morphology_context_t *context) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTERS(context); CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -561,19 +557,19 @@ static intrinsiccv_error_t erode_sc(const T *src, size_t src_stride, T *dst, auto *workspace = reinterpret_cast(context); if (workspace->type_size() != sizeof(T)) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } Rectangle rect{width, height}; if (workspace->image_size() != rect) { - return INTRINSICCV_ERROR_CONTEXT_MISMATCH; + return KLEIDICV_ERROR_CONTEXT_MISMATCH; } // Currently valid, will need to be changed if morphology supports more border - // types, like INTRINSICCV_BORDER_TYPE_REVERSE. + // types, like KLEIDICV_BORDER_TYPE_REVERSE. Rectangle kernel{workspace->kernel()}; if (width < kernel.width() - 1 || height < kernel.height() - 1) { - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } Rows src_rows{src, src_stride, workspace->channels()}; @@ -590,9 +586,9 @@ static intrinsiccv_error_t erode_sc(const T *src, size_t src_stride, T *dst, // Update source for the next iteration. current_src_rows = dst_rows; } - return INTRINSICCV_OK; + return KLEIDICV_OK; } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_MORPHOLOGY_SC_H +#endif // KLEIDICV_MORPHOLOGY_SC_H diff --git a/intrinsiccv/src/morphology/morphology_sme2.cpp b/intrinsiccv/src/morphology/morphology_sme2.cpp index 91e9446bf..9ac790203 100644 --- a/intrinsiccv/src/morphology/morphology_sme2.cpp +++ b/intrinsiccv/src/morphology/morphology_sme2.cpp @@ -7,7 +7,7 @@ namespace intrinsiccv::sme2 { template -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t dilate(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, intrinsiccv_morphology_context_t *context) { return dilate_sc >(src, src_stride, dst, dst_stride, width, @@ -15,19 +15,19 @@ dilate(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, } template -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t erode(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, intrinsiccv_morphology_context_t *context) { return erode_sc >(src, src_stride, dst, dst_stride, width, height, context); } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(name, type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t name( \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(name, type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t name( \ const type *src, size_t src_stride, type *dst, size_t dst_stride, \ size_t width, size_t height, intrinsiccv_morphology_context_t *context) -INTRINSICCV_INSTANTIATE_TEMPLATE(dilate, uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(erode, uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(dilate, uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(erode, uint8_t); } // namespace intrinsiccv::sme2 diff --git a/intrinsiccv/src/morphology/morphology_sve2.cpp b/intrinsiccv/src/morphology/morphology_sve2.cpp index 6be0cf693..ae821971b 100644 --- a/intrinsiccv/src/morphology/morphology_sve2.cpp +++ b/intrinsiccv/src/morphology/morphology_sve2.cpp @@ -7,7 +7,7 @@ namespace intrinsiccv::sve2 { template -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t dilate(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, intrinsiccv_morphology_context_t *context) { return dilate_sc >( @@ -15,19 +15,19 @@ dilate(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, } template -INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t erode(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, intrinsiccv_morphology_context_t *context) { return erode_sc >( src, src_stride, dst, dst_stride, width, height, context); } -#define INTRINSICCV_INSTANTIATE_TEMPLATE(name, type) \ - template INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t name( \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(name, type) \ + template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t name( \ const type *src, size_t src_stride, type *dst, size_t dst_stride, \ size_t width, size_t height, intrinsiccv_morphology_context_t *context) -INTRINSICCV_INSTANTIATE_TEMPLATE(dilate, uint8_t); -INTRINSICCV_INSTANTIATE_TEMPLATE(erode, uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(dilate, uint8_t); +KLEIDICV_INSTANTIATE_TEMPLATE(erode, uint8_t); } // namespace intrinsiccv::sve2 diff --git a/intrinsiccv/src/resize/resize_api.cpp b/intrinsiccv/src/resize/resize_api.cpp index 00a8d9a44..293696c9a 100644 --- a/intrinsiccv/src/resize/resize_api.cpp +++ b/intrinsiccv/src/resize/resize_api.cpp @@ -6,7 +6,7 @@ #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/resize/resize.h" -INTRINSICCV_MULTIVERSION_C_API( +KLEIDICV_MULTIVERSION_C_API( intrinsiccv_resize_to_quarter_u8, &intrinsiccv::neon::resize_to_quarter_u8, - INTRINSICCV_SVE2_IMPL_IF(&intrinsiccv::sve2::resize_to_quarter_u8), + KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::resize_to_quarter_u8), &intrinsiccv::sme2::resize_to_quarter_u8); diff --git a/intrinsiccv/src/resize/resize_linear_api.cpp b/intrinsiccv/src/resize/resize_linear_api.cpp index d8c1ae8e6..23979e27a 100644 --- a/intrinsiccv/src/resize/resize_linear_api.cpp +++ b/intrinsiccv/src/resize/resize_linear_api.cpp @@ -6,7 +6,7 @@ #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/resize/resize_linear.h" -INTRINSICCV_MULTIVERSION_C_API( +KLEIDICV_MULTIVERSION_C_API( intrinsiccv_resize_linear_u8, &intrinsiccv::neon::resize_linear_u8, - INTRINSICCV_SVE2_IMPL_IF(&intrinsiccv::sve2::resize_linear_u8), + KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::resize_linear_u8), &intrinsiccv::sme2::resize_linear_u8); diff --git a/intrinsiccv/src/resize/resize_linear_neon.cpp b/intrinsiccv/src/resize/resize_linear_neon.cpp index 6969e9378..cedad0fb8 100644 --- a/intrinsiccv/src/resize/resize_linear_neon.cpp +++ b/intrinsiccv/src/resize/resize_linear_neon.cpp @@ -57,7 +57,7 @@ uint8x8_t lerp2d_vector_p_q_q_r(uint8x8_t a, uint8x8_t b, uint8x8_t c, return result; } -INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8( +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride) { size_t dst_width = src_width * 2; @@ -184,10 +184,10 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8( process_edge_row(src + src_stride * (src_height - 1), dst + dst_stride * (src_height * 2 - 1)); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8( +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride) { size_t dst_width = src_width * 4, dst_height = src_height * 4; @@ -405,10 +405,10 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8( memcpy(dst + dst_stride * (dst_height - 1), dst + dst_stride * (dst_height - 2), dst_stride); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, @@ -418,7 +418,7 @@ intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, CHECK_IMAGE_SIZE(dst_width, dst_height); if (src_width == 0 || src_height == 0) { - return INTRINSICCV_OK; + return KLEIDICV_OK; } if (src_width * 2 == dst_width && src_height * 2 == dst_height) { return resize_2x2_u8(src, src_stride, src_width, src_height, dst, @@ -428,7 +428,7 @@ intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, return resize_4x4_u8(src, src_stride, src_width, src_height, dst, dst_stride); } - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } } // namespace intrinsiccv::neon diff --git a/intrinsiccv/src/resize/resize_linear_sc.h b/intrinsiccv/src/resize/resize_linear_sc.h index f83a776a1..26fd6d26f 100644 --- a/intrinsiccv/src/resize/resize_linear_sc.h +++ b/intrinsiccv/src/resize/resize_linear_sc.h @@ -2,27 +2,26 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_RESIZE_LINEAR_SC_H -#define INTRINSICCV_RESIZE_LINEAR_SC_H +#ifndef KLEIDICV_RESIZE_LINEAR_SC_H +#define KLEIDICV_RESIZE_LINEAR_SC_H #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/sve2.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { -INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8_sc( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride) INTRINSICCV_STREAMING_COMPATIBLE { + uint8_t *dst, size_t dst_stride) KLEIDICV_STREAMING_COMPATIBLE { size_t dst_width = src_width * 2; size_t dst_height = src_height * 2; - auto lerp1d_scalar = [](uint8_t near, uint8_t far) - INTRINSICCV_STREAMING_COMPATIBLE { - return (near * 3 + far + 2) >> 2; - }; + auto lerp1d_scalar = + [](uint8_t near, uint8_t far) + KLEIDICV_STREAMING_COMPATIBLE { return (near * 3 + far + 2) >> 2; }; auto lerp1d_vector = [](svuint8_t near, - svuint8_t far) INTRINSICCV_STREAMING_COMPATIBLE { + svuint8_t far) KLEIDICV_STREAMING_COMPATIBLE { // near * 3 svuint16_t near3b = svmullb(near, uint8_t{3}); svuint16_t near3t = svmullt(near, uint8_t{3}); @@ -43,7 +42,7 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8_sc( auto lerp2d_vector = [](svbool_t pg, svuint8_t near, svuint8_t mid_a, svuint8_t mid_b, - svuint8_t far) INTRINSICCV_STREAMING_COMPATIBLE { + svuint8_t far) KLEIDICV_STREAMING_COMPATIBLE { // near * 9 svuint16_t near9b = svmullb(near, uint8_t{9}); svuint16_t near9t = svmullt(near, uint8_t{9}); @@ -72,7 +71,7 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8_sc( }; // Work-around for clang-format oddness. -#define ISC INTRINSICCV_STREAMING_COMPATIBLE +#define ISC KLEIDICV_STREAMING_COMPATIBLE // Handle top or bottom edge auto process_edge_row = [src_width, lerp1d_vector](const uint8_t *src_row, @@ -95,7 +94,7 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8_sc( auto process_row = [src_width, lerp2d_vector]( const uint8_t *src_row0, const uint8_t *src_row1, uint8_t *dst_row0, - uint8_t *dst_row1) INTRINSICCV_STREAMING_COMPATIBLE { + uint8_t *dst_row1) KLEIDICV_STREAMING_COMPATIBLE { // Middle elements for (size_t src_x = 0; src_x + 1 < src_width; src_x += svcntb()) { size_t dst_x = src_x * 2 + 1; @@ -161,18 +160,18 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8_sc( process_edge_row(src + src_stride * (src_height - 1), dst + dst_stride * (dst_height - 1)); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8_sc( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride) INTRINSICCV_STREAMING_COMPATIBLE { + uint8_t *dst, size_t dst_stride) KLEIDICV_STREAMING_COMPATIBLE { size_t dst_width = src_width * 4; size_t dst_height = src_height * 4; auto lerp1d_scalar = [](uint8_t p, uint8_t a, uint8_t q, uint8_t b) - INTRINSICCV_STREAMING_COMPATIBLE { return (p * a + q * b + 4) >> 3; }; + KLEIDICV_STREAMING_COMPATIBLE { return (p * a + q * b + 4) >> 3; }; auto lerp1d_vector = [](uint8_t p, svuint8_t a, uint8_t q, svuint8_t b) ISC { // bias @@ -236,7 +235,7 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8_sc( const uint8_t *src_row0, const uint8_t *src_row1, uint8_t *dst_row0, uint8_t *dst_row1, uint8_t *dst_row2, - uint8_t *dst_row3) INTRINSICCV_STREAMING_COMPATIBLE { + uint8_t *dst_row3) KLEIDICV_STREAMING_COMPATIBLE { // Middle elements for (size_t src_x = 0; src_x + 1 < src_width; src_x += svcntb()) { size_t dst_x = src_x * 4 + 2; @@ -344,19 +343,19 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8_sc( copy_dst_row(dst + dst_stride * (dst_height - 2), dst + dst_stride * (dst_height - 1)); - return INTRINSICCV_OK; + return KLEIDICV_OK; } -INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_linear_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_linear_u8_sc( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, - size_t dst_height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t dst_height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(dst_width, dst_height); if (src_width == 0 || src_height == 0) { - return INTRINSICCV_OK; + return KLEIDICV_OK; } if (src_width * 2 == dst_width && src_height * 2 == dst_height) { return resize_2x2_u8_sc(src, src_stride, src_width, src_height, dst, @@ -366,9 +365,9 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_linear_u8_sc( return resize_4x4_u8_sc(src, src_stride, src_width, src_height, dst, dst_stride); } - return INTRINSICCV_ERROR_NOT_IMPLEMENTED; + return KLEIDICV_ERROR_NOT_IMPLEMENTED; } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_RESIZE_SC_H +#endif // KLEIDICV_RESIZE_SC_H diff --git a/intrinsiccv/src/resize/resize_linear_sme2.cpp b/intrinsiccv/src/resize/resize_linear_sme2.cpp index cb1416e21..6290cd882 100644 --- a/intrinsiccv/src/resize/resize_linear_sme2.cpp +++ b/intrinsiccv/src/resize/resize_linear_sme2.cpp @@ -6,7 +6,7 @@ #include "resize_linear_sc.h" namespace intrinsiccv::sme2 { -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height) { diff --git a/intrinsiccv/src/resize/resize_linear_sve2.cpp b/intrinsiccv/src/resize/resize_linear_sve2.cpp index 06fe619ff..b385da9f8 100644 --- a/intrinsiccv/src/resize/resize_linear_sve2.cpp +++ b/intrinsiccv/src/resize/resize_linear_sve2.cpp @@ -6,7 +6,7 @@ #include "resize_linear_sc.h" namespace intrinsiccv::sve2 { -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, diff --git a/intrinsiccv/src/resize/resize_neon.cpp b/intrinsiccv/src/resize/resize_neon.cpp index 1e18a37fe..8cb00ef15 100644 --- a/intrinsiccv/src/resize/resize_neon.cpp +++ b/intrinsiccv/src/resize/resize_neon.cpp @@ -8,27 +8,27 @@ namespace intrinsiccv::neon { -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t check_dimensions(size_t src_dim, size_t dst_dim) { size_t half_src_dim = src_dim / 2; if ((src_dim % 2) == 0) { if (dst_dim == half_src_dim) { - return INTRINSICCV_OK; + return KLEIDICV_OK; } } else { if (dst_dim == half_src_dim || dst_dim == (half_src_dim + 1)) { - return INTRINSICCV_OK; + return KLEIDICV_OK; } } - return INTRINSICCV_ERROR_RANGE; + return KLEIDICV_ERROR_RANGE; } // Disable the warning, as the complexity is just above the threshold, it's // better to leave it in one piece. // NOLINTBEGIN(readability-function-cognitive-complexity) -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, @@ -117,7 +117,7 @@ intrinsiccv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, *dst = *src; } } - return INTRINSICCV_OK; + return KLEIDICV_OK; } // NOLINTEND(readability-function-cognitive-complexity) diff --git a/intrinsiccv/src/resize/resize_sc.h b/intrinsiccv/src/resize/resize_sc.h index d183ca9c1..6e80bd0d6 100644 --- a/intrinsiccv/src/resize/resize_sc.h +++ b/intrinsiccv/src/resize/resize_sc.h @@ -2,17 +2,17 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_RESIZE_SC_H -#define INTRINSICCV_RESIZE_SC_H +#ifndef KLEIDICV_RESIZE_SC_H +#define KLEIDICV_RESIZE_SC_H #include "intrinsiccv/intrinsiccv.h" #include "intrinsiccv/sve2.h" -namespace INTRINSICCV_TARGET_NAMESPACE { +namespace KLEIDICV_TARGET_NAMESPACE { static inline svuint8_t resize_parallel_vectors(svbool_t pg, svuint8_t top_row, svuint8_t bottom_row) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { svuint16_t result_before_averaging_b = svaddlb(top_row, bottom_row); svuint16_t result_before_averaging_t = svaddlt(top_row, bottom_row); svuint16_t result_before_averaging = @@ -22,7 +22,7 @@ static inline svuint8_t resize_parallel_vectors(svbool_t pg, svuint8_t top_row, static inline void parallel_rows_vectors_path_2x( svbool_t pg, Rows src_rows, - Rows dst_rows) INTRINSICCV_STREAMING_COMPATIBLE { + Rows dst_rows) KLEIDICV_STREAMING_COMPATIBLE { svuint8_t top_line0 = svld1(pg, &src_rows.at(0)[0]); svuint8_t bottom_line0 = svld1(pg, &src_rows.at(1)[0]); svuint8_t top_line1 = svld1_vnum(pg, &src_rows.at(0)[0], 1); @@ -35,7 +35,7 @@ static inline void parallel_rows_vectors_path_2x( static inline void parallel_rows_vectors_path( svbool_t pg, Rows src_rows, - Rows dst_rows) INTRINSICCV_STREAMING_COMPATIBLE { + Rows dst_rows) KLEIDICV_STREAMING_COMPATIBLE { svuint8_t top_line = svld1(pg, &src_rows.at(0)[0]); svuint8_t bottom_line = svld1(pg, &src_rows.at(1)[0]); svuint8_t result = resize_parallel_vectors(pg, top_line, bottom_line); @@ -45,27 +45,26 @@ static inline void parallel_rows_vectors_path( template static inline void process_parallel_rows( Rows src_rows, size_t src_width, - Rows dst_rows, - size_t dst_width) INTRINSICCV_STREAMING_COMPATIBLE { - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + Rows dst_rows, size_t dst_width) KLEIDICV_STREAMING_COMPATIBLE { + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; const size_t size_mask = ~static_cast(1U); // Process rows up to the last even pixel index. LoopUnroll2{src_width & size_mask, VecTraits::num_lanes()} // Process double vector chunks. - .unroll_twice([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + .unroll_twice([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { auto pg = VecTraits::svptrue(); parallel_rows_vectors_path_2x(pg, src_rows.at(0, index), dst_rows.at(0, index / 2)); }) - .unroll_once([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + .unroll_once([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { auto pg = VecTraits::svptrue(); parallel_rows_vectors_path(pg, src_rows.at(0, index), dst_rows.at(0, index / 2)); }) // Process the remaining chunk of the row. .remaining([&](size_t index, size_t length) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { auto pg = VecTraits::svwhilelt(index, length); parallel_rows_vectors_path(pg, src_rows.at(0, index), dst_rows.at(0, index / 2)); @@ -81,13 +80,13 @@ static inline void process_parallel_rows( } static inline svuint8_t resize_single_row(svbool_t pg, svuint8_t row) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { return svrshrnb(svadalp_x(pg, svdup_u16(0), row), 1); } static inline void single_row_vector_path_2x( svbool_t pg, Rows src_rows, - Rows dst_rows) INTRINSICCV_STREAMING_COMPATIBLE { + Rows dst_rows) KLEIDICV_STREAMING_COMPATIBLE { svuint8_t line0 = svld1(pg, &src_rows[0]); svuint8_t line1 = svld1_vnum(pg, &src_rows[0], 1); svuint8_t result0 = svrshrnb(svadalp_x(pg, svdup_u16(0), line0), 1); @@ -98,7 +97,7 @@ static inline void single_row_vector_path_2x( static inline void single_row_vector_path( svbool_t pg, Rows src_rows, - Rows dst_rows) INTRINSICCV_STREAMING_COMPATIBLE { + Rows dst_rows) KLEIDICV_STREAMING_COMPATIBLE { svuint8_t line = svld1(pg, &src_rows.at(0)[0]); svuint8_t result = svrshrnb(svadalp_x(pg, svdup_u16(0), line), 1); svst1b(pg, &dst_rows[0], svreinterpret_u16_u8(result)); @@ -107,27 +106,26 @@ static inline void single_row_vector_path( template static inline void process_single_row( Rows src_rows, size_t src_width, - Rows dst_rows, - size_t dst_width) INTRINSICCV_STREAMING_COMPATIBLE { - using VecTraits = INTRINSICCV_TARGET_NAMESPACE::VecTraits; + Rows dst_rows, size_t dst_width) KLEIDICV_STREAMING_COMPATIBLE { + using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits; const size_t size_mask = ~static_cast(1U); // Process rows up to the last even pixel index. LoopUnroll2{src_width & size_mask, VecTraits::num_lanes()} // Process full vector chunks. - .unroll_twice([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + .unroll_twice([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { auto pg = VecTraits::svptrue(); single_row_vector_path_2x(pg, src_rows.at(0, index), dst_rows.at(0, index / 2)); }) - .unroll_once([&](size_t index) INTRINSICCV_STREAMING_COMPATIBLE { + .unroll_once([&](size_t index) KLEIDICV_STREAMING_COMPATIBLE { auto pg = VecTraits::svptrue(); single_row_vector_path(pg, src_rows.at(0, index), dst_rows.at(0, index / 2)); }) // Process the remaining chunk of the row. .remaining([&](size_t index, size_t length) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { auto pg = VecTraits::svwhilelt(index, length); single_row_vector_path(pg, src_rows.at(0, index), dst_rows.at(0, index / 2)); @@ -139,28 +137,28 @@ static inline void process_single_row( } } -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t check_dimensions(size_t src_dim, size_t dst_dim) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { size_t half_src_dim = src_dim / 2; if ((src_dim % 2) == 0) { if (dst_dim == half_src_dim) { - return INTRINSICCV_OK; + return KLEIDICV_OK; } } else { if (dst_dim == half_src_dim || dst_dim == (half_src_dim + 1)) { - return INTRINSICCV_OK; + return KLEIDICV_OK; } } - return INTRINSICCV_ERROR_RANGE; + return KLEIDICV_ERROR_RANGE; } -INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_to_quarter_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_to_quarter_u8_sc( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, - size_t dst_height) INTRINSICCV_STREAMING_COMPATIBLE { + size_t dst_height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(src_width, src_height); @@ -179,7 +177,7 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_to_quarter_u8_sc( // Process two rows at once. loop.unroll_once([&](size_t) // NOLINT(readability/casting) - INTRINSICCV_STREAMING_COMPATIBLE { + KLEIDICV_STREAMING_COMPATIBLE { process_parallel_rows(src_rows, src_width, dst_rows, dst_width); src_rows += 2; @@ -188,13 +186,13 @@ INTRINSICCV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_to_quarter_u8_sc( // Handle an odd row, if any. if (dst_height > (src_height / 2)) { - loop.remaining([&](size_t, size_t) INTRINSICCV_STREAMING_COMPATIBLE { + loop.remaining([&](size_t, size_t) KLEIDICV_STREAMING_COMPATIBLE { process_single_row(src_rows, src_width, dst_rows, dst_width); }); } - return INTRINSICCV_OK; + return KLEIDICV_OK; } -} // namespace INTRINSICCV_TARGET_NAMESPACE +} // namespace KLEIDICV_TARGET_NAMESPACE -#endif // INTRINSICCV_RESIZE_SC_H +#endif // KLEIDICV_RESIZE_SC_H diff --git a/intrinsiccv/src/resize/resize_sme2.cpp b/intrinsiccv/src/resize/resize_sme2.cpp index 9f527d04e..4d80eae26 100644 --- a/intrinsiccv/src/resize/resize_sme2.cpp +++ b/intrinsiccv/src/resize/resize_sme2.cpp @@ -7,7 +7,7 @@ namespace intrinsiccv::sme2 { -INTRINSICCV_LOCALLY_STREAMING INTRINSICCV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height) { diff --git a/intrinsiccv/src/resize/resize_sve2.cpp b/intrinsiccv/src/resize/resize_sve2.cpp index 93e95f3e6..ab06494d9 100644 --- a/intrinsiccv/src/resize/resize_sve2.cpp +++ b/intrinsiccv/src/resize/resize_sve2.cpp @@ -7,7 +7,7 @@ namespace intrinsiccv::sve2 { -INTRINSICCV_TARGET_FN_ATTRS +KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, diff --git a/scripts/ci.sh b/scripts/ci.sh index 55c0c1839..a1b46fa0d 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -36,9 +36,9 @@ cmake -S . -B build -G Ninja \ -DCMAKE_CXX_CLANG_TIDY=clang-tidy \ -DCMAKE_CXX_FLAGS="--target=aarch64-linux-gnu --coverage" \ -DCMAKE_EXE_LINKER_FLAGS="--rtlib=compiler-rt -static -fuse-ld=lld" \ - -DINTRINSICCV_ENABLE_SVE2=ON \ - -DINTRINSICCV_ENABLE_SVE2_SELECTIVELY=OFF \ - -DINTRINSICCV_CHECK_BANNED_FUNCTIONS=ON + -DKLEIDICV_ENABLE_SVE2=ON \ + -DKLEIDICV_ENABLE_SVE2_SELECTIVELY=OFF \ + -DKLEIDICV_CHECK_BANNED_FUNCTIONS=ON # Workaround to avoid applying clang-tidy to files in build directory echo '{"Checks": "-*,cppcoreguidelines-avoid-goto"}'>build/.clang-tidy @@ -78,7 +78,7 @@ if [[ $(dpkg --print-architecture) = arm64 ]]; then # Clang address & undefined behaviour sanitizers cmake -S . -B build/sanitize -G Ninja \ -DCMAKE_BUILD_TYPE=Debug \ - -DINTRINSICCV_ENABLE_SME2=OFF \ + -DKLEIDICV_ENABLE_SME2=OFF \ -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-sanitize-recover=all -Wno-pass-failed" ninja -C build/sanitize intrinsiccv-api-test build/sanitize/test/api/intrinsiccv-api-test --gtest_filter="${EXCLUDE_FLOAT_CONVERSION_TESTS}" @@ -92,9 +92,9 @@ cmake -S . -B build/build-benchmark -G Ninja \ -DCMAKE_EXE_LINKER_FLAGS="--rtlib=compiler-rt -static -fuse-ld=lld" \ -DCMAKE_SYSTEM_NAME=Linux \ -DCMAKE_SYSTEM_PROCESSOR=aarch64 \ - -DINTRINSICCV_BENCHMARK=ON \ - -DINTRINSICCV_ENABLE_SVE2=ON \ - -DINTRINSICCV_ENABLE_SVE2_SELECTIVELY=OFF + -DKLEIDICV_BENCHMARK=ON \ + -DKLEIDICV_ENABLE_SVE2=ON \ + -DKLEIDICV_ENABLE_SVE2_SELECTIVELY=OFF ninja -C build/build-benchmark intrinsiccv-benchmark # TODO: Cross-build OpenCV diff --git a/scripts/format.sh b/scripts/format.sh index 69953d462..3f64aa335 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -20,7 +20,7 @@ SCRIPT_PATH="$(realpath "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")" # ------------------------------------------------------------------------------ -INTRINSICCV_ROOT_PATH="$(realpath "${SCRIPT_PATH}"/..)" +KLEIDICV_ROOT_PATH="$(realpath "${SCRIPT_PATH}"/..)" : "${CHECK_ONLY:=OFF}" : "${CLANG_FORMAT_BIN_PATH:=clang-format-17}" @@ -29,11 +29,11 @@ INTRINSICCV_ROOT_PATH="$(realpath "${SCRIPT_PATH}"/..)" # ------------------------------------------------------------------------------ SOURCES="$(find \ - "${INTRINSICCV_ROOT_PATH}/adapters" \ - "${INTRINSICCV_ROOT_PATH}/benchmark" \ - "${INTRINSICCV_ROOT_PATH}/intrinsiccv" \ - "${INTRINSICCV_ROOT_PATH}/test" \ - "${INTRINSICCV_ROOT_PATH}/conformity/opencv" \ + "${KLEIDICV_ROOT_PATH}/adapters" \ + "${KLEIDICV_ROOT_PATH}/benchmark" \ + "${KLEIDICV_ROOT_PATH}/intrinsiccv" \ + "${KLEIDICV_ROOT_PATH}/test" \ + "${KLEIDICV_ROOT_PATH}/conformity/opencv" \ \( -name \*.cpp -o -name \*.h -o -name \*.h.in \) \ -print)" diff --git a/scripts/run_opencv_conformity_checks.sh b/scripts/run_opencv_conformity_checks.sh index 12a990810..a1c75793b 100755 --- a/scripts/run_opencv_conformity_checks.sh +++ b/scripts/run_opencv_conformity_checks.sh @@ -13,10 +13,10 @@ set -exu SCRIPT_PATH="$(realpath "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")" SOURCE_PATH="${SCRIPT_PATH}/../conformity/opencv" -INTRINSICCV_SOURCE_PATH="${SCRIPT_PATH}/.." +KLEIDICV_SOURCE_PATH="${SCRIPT_PATH}/.." BUILD_PATH="${SCRIPT_PATH}/../build/conformity" OPENCV_DEFAULT_PATH="${BUILD_PATH}/opencv_default" -OPENCV_INTRINSICCV_PATH="${BUILD_PATH}/opencv_intrinsiccv" +OPENCV_KLEIDICV_PATH="${BUILD_PATH}/opencv_intrinsiccv" if [[ "${CLEAN}" == "ON" ]]; then rm -rf "${BUILD_PATH}" @@ -43,20 +43,20 @@ fi cmake "${common_cmake_args[@]}" \ -B "${OPENCV_DEFAULT_PATH}" \ - -DWITH_INTRINSICCV=OFF + -DWITH_KLEIDICV=OFF ninja -C "${OPENCV_DEFAULT_PATH}" subordinate cmake "${common_cmake_args[@]}" \ - -B "${OPENCV_INTRINSICCV_PATH}" \ - -DWITH_INTRINSICCV=ON \ - -DINTRINSICCV_SOURCE_PATH="${INTRINSICCV_SOURCE_PATH}" \ - -DINTRINSICCV_ENABLE_SVE2=ON \ - -DINTRINSICCV_ENABLE_SVE2_SELECTIVELY=OFF -ninja -C "${OPENCV_INTRINSICCV_PATH}" manager + -B "${OPENCV_KLEIDICV_PATH}" \ + -DWITH_KLEIDICV=ON \ + -DKLEIDICV_SOURCE_PATH="${KLEIDICV_SOURCE_PATH}" \ + -DKLEIDICV_ENABLE_SVE2=ON \ + -DKLEIDICV_ENABLE_SVE2_SELECTIVELY=OFF +ninja -C "${OPENCV_KLEIDICV_PATH}" manager TESTRESULT=0 -qemu-aarch64 -cpu cortex-a35 "${OPENCV_INTRINSICCV_PATH}/bin/manager" "${OPENCV_DEFAULT_PATH}/bin/subordinate" || TESTRESULT=1 -qemu-aarch64 -cpu max,sve128=on,sme=off "${OPENCV_INTRINSICCV_PATH}/bin/manager" "${OPENCV_DEFAULT_PATH}/bin/subordinate" || TESTRESULT=1 -qemu-aarch64 -cpu max,sve128=on,sme512=on "${OPENCV_INTRINSICCV_PATH}/bin/manager" "${OPENCV_DEFAULT_PATH}/bin/subordinate" || TESTRESULT=1 +qemu-aarch64 -cpu cortex-a35 "${OPENCV_KLEIDICV_PATH}/bin/manager" "${OPENCV_DEFAULT_PATH}/bin/subordinate" || TESTRESULT=1 +qemu-aarch64 -cpu max,sve128=on,sme=off "${OPENCV_KLEIDICV_PATH}/bin/manager" "${OPENCV_DEFAULT_PATH}/bin/subordinate" || TESTRESULT=1 +qemu-aarch64 -cpu max,sve128=on,sme512=on "${OPENCV_KLEIDICV_PATH}/bin/manager" "${OPENCV_DEFAULT_PATH}/bin/subordinate" || TESTRESULT=1 exit $TESTRESULT diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a361914d6..eb1c1018e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,16 +4,16 @@ cmake_minimum_required(VERSION 3.16) -set(INTRINSICCV_INCLUDE_DIR +set(KLEIDICV_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../intrinsiccv/include ${CMAKE_CURRENT_BINARY_DIR}/../intrinsiccv/include ) -set(INTRINSICCV_TEST_INCLUDE_DIR +set(KLEIDICV_TEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) -set(INTRINSICCV_TEST_CXX_FLAGS +set(KLEIDICV_TEST_CXX_FLAGS "-Werror" "-Wall" "-Wextra" @@ -21,24 +21,24 @@ set(INTRINSICCV_TEST_CXX_FLAGS ) if (CMAKE_BUILD_TYPE STREQUAL "Debug") - list(APPEND INTRINSICCV_TEST_CXX_FLAGS "-O0" "-g") + list(APPEND KLEIDICV_TEST_CXX_FLAGS "-O0" "-g") else() - list(APPEND INTRINSICCV_TEST_CXX_FLAGS "-O2" "-g0") + list(APPEND KLEIDICV_TEST_CXX_FLAGS "-O2" "-g0") endif() # Only perform allocation tests on Linux and Android if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Android)$") - set(INTRINSICCV_ALLOCATION_TESTS TRUE) + set(KLEIDICV_ALLOCATION_TESTS TRUE) endif() -set(INTRINSICCV_TEST_FRAMEWORK_SOURCES +set(KLEIDICV_TEST_FRAMEWORK_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/framework/border.cpp ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/framework/utils.cpp ) -if (INTRINSICCV_ALLOCATION_TESTS) - list(APPEND INTRINSICCV_TEST_FRAMEWORK_SOURCES +if (KLEIDICV_ALLOCATION_TESTS) + list(APPEND KLEIDICV_TEST_FRAMEWORK_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/framework/wrap_malloc.cpp ) endif() diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt index 22ea34bbc..3622d6a5a 100644 --- a/test/api/CMakeLists.txt +++ b/test/api/CMakeLists.txt @@ -4,11 +4,11 @@ file(GLOB intrinsiccv_api_test_sources CONFIGURE_DEPENDS "*.h" "test_*.cpp") -list(APPEND intrinsiccv_api_test_sources ${INTRINSICCV_TEST_FRAMEWORK_SOURCES}) +list(APPEND intrinsiccv_api_test_sources ${KLEIDICV_TEST_FRAMEWORK_SOURCES}) set_source_files_properties( ${intrinsiccv_api_test_sources} - PROPERTIES COMPILE_OPTIONS "${INTRINSICCV_TEST_CXX_FLAGS}" + PROPERTIES COMPILE_OPTIONS "${KLEIDICV_TEST_CXX_FLAGS}" ) add_executable( @@ -23,11 +23,11 @@ set_target_properties( target_include_directories( intrinsiccv-api-test - PRIVATE ${INTRINSICCV_INCLUDE_DIR} - PRIVATE ${INTRINSICCV_TEST_INCLUDE_DIR} + PRIVATE ${KLEIDICV_INCLUDE_DIR} + PRIVATE ${KLEIDICV_TEST_INCLUDE_DIR} ) -if (INTRINSICCV_ALLOCATION_TESTS) +if (KLEIDICV_ALLOCATION_TESTS) target_link_options( intrinsiccv-api-test PRIVATE -Wl,--wrap,malloc diff --git a/test/api/test_add_abs_with_threshold.cpp b/test/api/test_add_abs_with_threshold.cpp index e2be07688..1ce78fdf5 100644 --- a/test/api/test_add_abs_with_threshold.cpp +++ b/test/api/test_add_abs_with_threshold.cpp @@ -189,15 +189,15 @@ TYPED_TEST(SaturatingAddAbsWithThresholdTest, Misalignment) { return; } TypeParam src[1] = {}, dst[1] = {}; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, intrinsiccv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, intrinsiccv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, intrinsiccv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, 1)); @@ -205,23 +205,23 @@ TYPED_TEST(SaturatingAddAbsWithThresholdTest, Misalignment) { TYPED_TEST(SaturatingAddAbsWithThresholdTest, ZeroImageSize) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_saturating_add_abs_with_threshold_s16( - src, sizeof(TypeParam), src, sizeof(TypeParam), - dst, sizeof(TypeParam), 0, 1, 1)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_saturating_add_abs_with_threshold_s16( - src, sizeof(TypeParam), src, sizeof(TypeParam), - dst, sizeof(TypeParam), 1, 0, 1)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_saturating_add_abs_with_threshold_s16( + src, sizeof(TypeParam), src, sizeof(TypeParam), + dst, sizeof(TypeParam), 0, 1, 1)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_saturating_add_abs_with_threshold_s16( + src, sizeof(TypeParam), src, sizeof(TypeParam), + dst, sizeof(TypeParam), 1, 0, 1)); } TYPED_TEST(SaturatingAddAbsWithThresholdTest, OversizeImage) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, 1)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, 1)); + sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, 1)); } diff --git a/test/api/test_canny.cpp b/test/api/test_canny.cpp index 995846ec4..90315fe04 100644 --- a/test/api/test_canny.cpp +++ b/test/api/test_canny.cpp @@ -8,12 +8,12 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#if INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#if KLEIDICV_EXPERIMENTAL_FEATURE_CANNY -#define INTRINSICCV_CANNY(type, suffix) \ - INTRINSICCV_API(canny, intrinsiccv_canny_##suffix, type) +#define KLEIDICV_CANNY(type, suffix) \ + KLEIDICV_API(canny, intrinsiccv_canny_##suffix, type) -INTRINSICCV_CANNY(uint8_t, u8); +KLEIDICV_CANNY(uint8_t, u8); using ElementTypes = ::testing::Types; @@ -34,33 +34,31 @@ TYPED_TEST(CannyTest, Misalignment) { return; } TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, canny()(src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1, 0.0, 1.0)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, canny()(src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, 0.0, 1.0)); } TYPED_TEST(CannyTest, ZeroImageSize) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_OK, - canny()(src, sizeof(TypeParam), dst, sizeof(TypeParam), - 0, 1, 0.0, 1.0)); - EXPECT_EQ(INTRINSICCV_OK, - canny()(src, sizeof(TypeParam), dst, sizeof(TypeParam), - 1, 0, 0.0, 1.0)); + EXPECT_EQ(KLEIDICV_OK, canny()(src, sizeof(TypeParam), dst, + sizeof(TypeParam), 0, 1, 0.0, 1.0)); + EXPECT_EQ(KLEIDICV_OK, canny()(src, sizeof(TypeParam), dst, + sizeof(TypeParam), 1, 0, 0.0, 1.0)); } TYPED_TEST(CannyTest, OversizeImage) { TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, canny()(src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, 0.0, 1.0)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, 0.0, 1.0)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, canny()(src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, 0.0, 1.0)); + KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, 0.0, 1.0)); } -#endif // INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY +#endif // KLEIDICV_EXPERIMENTAL_FEATURE_CANNY diff --git a/test/api/test_count_nonzeros.cpp b/test/api/test_count_nonzeros.cpp index 6ea26392f..6427ea6fb 100644 --- a/test/api/test_count_nonzeros.cpp +++ b/test/api/test_count_nonzeros.cpp @@ -11,10 +11,10 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_COUNT_NONZEROS(type, suffix) \ - INTRINSICCV_API(count_nonzeros, intrinsiccv_count_nonzeros_##suffix, type) +#define KLEIDICV_COUNT_NONZEROS(type, suffix) \ + KLEIDICV_API(count_nonzeros, intrinsiccv_count_nonzeros_##suffix, type) -INTRINSICCV_COUNT_NONZEROS(uint8_t, u8); +KLEIDICV_COUNT_NONZEROS(uint8_t, u8); template class TestDataAllZeros { @@ -72,7 +72,7 @@ class CountNonZerosTest { size_t expected = data_.calculateExpected(width, height); size_t actual = SIZE_MAX; - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, count_nonzeros()(source.data(), source.stride(), width, height, &actual)); EXPECT_EQ(expected, actual); @@ -128,16 +128,16 @@ TYPED_TEST(CountNonZeros, Misalignment) { TypeParam src[1]; size_t count = 0; EXPECT_EQ( - INTRINSICCV_ERROR_ALIGNMENT, + KLEIDICV_ERROR_ALIGNMENT, count_nonzeros()(src, sizeof(TypeParam) + 1, 1, 1, &count)); } TYPED_TEST(CountNonZeros, ZeroImageSize) { TypeParam src[1] = {}; size_t count = 123; - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, count_nonzeros()(src, sizeof(TypeParam), 0, 1, &count)); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, count_nonzeros()(src, sizeof(TypeParam), 1, 0, &count)); EXPECT_EQ(0, count); } @@ -146,11 +146,11 @@ TYPED_TEST(CountNonZeros, OversizeImage) { TypeParam src[1] = {}; size_t count = 0; EXPECT_EQ( - INTRINSICCV_ERROR_RANGE, + KLEIDICV_ERROR_RANGE, count_nonzeros()(src, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, &count)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, &count)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, count_nonzeros()(src, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, &count)); + KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, &count)); } diff --git a/test/api/test_float_conv.cpp b/test/api/test_float_conv.cpp index 2f7a26137..bdfe6d5c9 100644 --- a/test/api/test_float_conv.cpp +++ b/test/api/test_float_conv.cpp @@ -11,16 +11,16 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_float_conversion(I, input_type_name, O, output_type_name) \ - INTRINSICCV_DIFF_IO_API( \ +#define KLEIDICV_float_conversion(I, input_type_name, O, output_type_name) \ + KLEIDICV_DIFF_IO_API( \ float_conversion, \ intrinsiccv_float_conversion_##input_type_name##_##output_type_name, I, \ O) -INTRINSICCV_float_conversion(float, f32, int8_t, s8); -INTRINSICCV_float_conversion(float, f32, uint8_t, u8); -INTRINSICCV_float_conversion(int8_t, s8, float, f32); -INTRINSICCV_float_conversion(uint8_t, u8, float, f32); +KLEIDICV_float_conversion(float, f32, int8_t, s8); +KLEIDICV_float_conversion(float, f32, uint8_t, u8); +KLEIDICV_float_conversion(int8_t, s8, float, f32); +KLEIDICV_float_conversion(uint8_t, u8, float, f32); template class FloatConversionTest final { @@ -78,9 +78,9 @@ class FloatConversionTest final { static constexpr float _floatval(uint32_t v) { static_assert(sizeof(float) == 4); - INTRINSICCV_NO_STRICT_ALIASING_BEGIN + KLEIDICV_NO_STRICT_ALIASING_BEGIN return *reinterpret_cast(&v); - INTRINSICCV_NO_STRICT_ALIASING_END + KLEIDICV_NO_STRICT_ALIASING_END } template & expected = std::get<1>(arrays); test::Array2D& actual = std::get<2>(arrays); - ASSERT_EQ(INTRINSICCV_OK, (float_conversion()( - source.data(), source.stride(), actual.data(), - actual.stride(), width, height))); + ASSERT_EQ(KLEIDICV_OK, (float_conversion()( + source.data(), source.stride(), actual.data(), + actual.stride(), width, height))); EXPECT_EQ_ARRAY2D(expected, actual); } @@ -311,9 +311,9 @@ class FloatConversionTest final { test::Array2D& expected = std::get<1>(arrays); test::Array2D& actual = std::get<2>(arrays); - ASSERT_EQ(INTRINSICCV_OK, (float_conversion()( - source.data(), source.stride(), actual.data(), - actual.stride(), width, height))); + ASSERT_EQ(KLEIDICV_OK, (float_conversion()( + source.data(), source.stride(), actual.data(), + actual.stride(), width, height))); EXPECT_EQ_ARRAY2D(expected, actual); } @@ -332,9 +332,9 @@ class FloatConversionTest final { expected.set(i, 0, elements_list.expected_rows[i]); } - ASSERT_EQ(INTRINSICCV_OK, (float_conversion()( - source.data(), source.stride(), actual.data(), - actual.stride(), width, height))); + ASSERT_EQ(KLEIDICV_OK, (float_conversion()( + source.data(), source.stride(), actual.data(), + actual.stride(), width, height))); EXPECT_EQ_ARRAY2D(expected, actual); } @@ -353,9 +353,9 @@ class FloatConversionTest final { actual.fill(0); - ASSERT_EQ(INTRINSICCV_OK, (float_conversion()( - source.data(), source.stride(), actual.data(), - actual.stride(), width, height))); + ASSERT_EQ(KLEIDICV_OK, (float_conversion()( + source.data(), source.stride(), actual.data(), + actual.stride(), width, height))); EXPECT_EQ_ARRAY2D(expected, actual); } @@ -385,19 +385,18 @@ TYPED_TEST(FloatConversion, OversizeImage) { using OutputType = typename TypeParam::second_type; InputType src[1] = {}; OutputType dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, (float_conversion()( src, sizeof(InputType), dst, sizeof(OutputType), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1))); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1))); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, (float_conversion()( src, sizeof(InputType), dst, sizeof(OutputType), 1, - INTRINSICCV_MAX_IMAGE_PIXELS + 1))); - EXPECT_EQ( - INTRINSICCV_ERROR_RANGE, - (float_conversion()( - src, sizeof(TypeParam), dst, sizeof(OutputType), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, INTRINSICCV_MAX_IMAGE_PIXELS + 1))); + KLEIDICV_MAX_IMAGE_PIXELS + 1))); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, + (float_conversion()( + src, sizeof(TypeParam), dst, sizeof(OutputType), + KLEIDICV_MAX_IMAGE_PIXELS + 1, KLEIDICV_MAX_IMAGE_PIXELS + 1))); } TYPED_TEST(FloatConversion, Scalar) { diff --git a/test/api/test_gaussian_blur.cpp b/test/api/test_gaussian_blur.cpp index 20c5a1699..521156440 100644 --- a/test/api/test_gaussian_blur.cpp +++ b/test/api/test_gaussian_blur.cpp @@ -11,13 +11,13 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_GAUSSIAN_BLUR(type, kernel_suffix, type_suffix) \ - INTRINSICCV_API(gaussian_blur_##kernel_suffix, \ - intrinsiccv_gaussian_blur_##kernel_suffix##_##type_suffix, \ - type) +#define KLEIDICV_GAUSSIAN_BLUR(type, kernel_suffix, type_suffix) \ + KLEIDICV_API(gaussian_blur_##kernel_suffix, \ + intrinsiccv_gaussian_blur_##kernel_suffix##_##type_suffix, \ + type) -INTRINSICCV_GAUSSIAN_BLUR(uint8_t, 3x3, u8); -INTRINSICCV_GAUSSIAN_BLUR(uint8_t, 5x5, u8); +KLEIDICV_GAUSSIAN_BLUR(uint8_t, 3x3, u8); +KLEIDICV_GAUSSIAN_BLUR(uint8_t, 5x5, u8); // Implements KernelTestParams for Gaussian Blur operators. template @@ -33,16 +33,16 @@ struct GaussianBlurKernelTestParams { }; // end of struct GaussianBlurKernelTestParams static constexpr std::array kDefaultBorder = { - INTRINSICCV_BORDER_TYPE_REPLICATE}; + KLEIDICV_BORDER_TYPE_REPLICATE}; static constexpr std::array kReflectBorder = { - INTRINSICCV_BORDER_TYPE_REFLECT}; + KLEIDICV_BORDER_TYPE_REFLECT}; static constexpr std::array kAllBorders = { - INTRINSICCV_BORDER_TYPE_REPLICATE, - INTRINSICCV_BORDER_TYPE_REFLECT, - INTRINSICCV_BORDER_TYPE_WRAP, - INTRINSICCV_BORDER_TYPE_REVERSE, + KLEIDICV_BORDER_TYPE_REPLICATE, + KLEIDICV_BORDER_TYPE_REFLECT, + KLEIDICV_BORDER_TYPE_WRAP, + KLEIDICV_BORDER_TYPE_REVERSE, }; template @@ -112,7 +112,7 @@ class GaussianBlurTest : public test::KernelTest { &context, input->channels(), sizeof(IntermediateType), intrinsiccv_rectangle_t{input->width() / input->channels(), input->height()}); - if (ret != INTRINSICCV_OK) { + if (ret != KLEIDICV_OK) { return ret; } @@ -120,7 +120,7 @@ class GaussianBlurTest : public test::KernelTest { input->width() / input->channels(), input->height(), input->channels(), border_type, context); auto releaseRet = intrinsiccv_filter_release(context); - if (releaseRet != INTRINSICCV_OK) { + if (releaseRet != KLEIDICV_OK) { return releaseRet; } @@ -195,42 +195,42 @@ TYPED_TEST(GaussianBlur, UnsupportedBorderType3x3) { using KernelTestParams = GaussianBlurKernelTestParams; intrinsiccv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams::kKernelSize - 1; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{validSize, validSize})); TypeParam src[1] = {}, dst[1]; for (intrinsiccv_border_type_t border : { - INTRINSICCV_BORDER_TYPE_CONSTANT, - INTRINSICCV_BORDER_TYPE_TRANSPARENT, - INTRINSICCV_BORDER_TYPE_NONE, + KLEIDICV_BORDER_TYPE_CONSTANT, + KLEIDICV_BORDER_TYPE_TRANSPARENT, + KLEIDICV_BORDER_TYPE_NONE, }) { - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_3x3()(src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, validSize, 1, border, context)); } - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, UnsupportedBorderType5x5) { using KernelTestParams = GaussianBlurKernelTestParams; intrinsiccv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams::kKernelSize - 1; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{validSize, validSize})); TypeParam src[1] = {}, dst[1]; for (intrinsiccv_border_type_t border : { - INTRINSICCV_BORDER_TYPE_CONSTANT, - INTRINSICCV_BORDER_TYPE_TRANSPARENT, - INTRINSICCV_BORDER_TYPE_NONE, + KLEIDICV_BORDER_TYPE_CONSTANT, + KLEIDICV_BORDER_TYPE_TRANSPARENT, + KLEIDICV_BORDER_TYPE_NONE, }) { - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_5x5()(src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, validSize, 1, border, context)); } - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, NullPointer) { @@ -238,18 +238,18 @@ TYPED_TEST(GaussianBlur, NullPointer) { using KernelTestParams5x5 = GaussianBlurKernelTestParams; intrinsiccv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{validSize, validSize})); TypeParam src[1] = {}, dst[1]; test::test_null_args(gaussian_blur_3x3(), src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, validSize, 1, - INTRINSICCV_BORDER_TYPE_REPLICATE, context); + KLEIDICV_BORDER_TYPE_REPLICATE, context); validSize = KernelTestParams5x5::kKernelSize - 1; test::test_null_args(gaussian_blur_5x5(), src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, validSize, 1, - INTRINSICCV_BORDER_TYPE_REPLICATE, context); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + KLEIDICV_BORDER_TYPE_REPLICATE, context); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, Misalignment) { @@ -261,81 +261,81 @@ TYPED_TEST(GaussianBlur, Misalignment) { using KernelTestParams5x5 = GaussianBlurKernelTestParams; intrinsiccv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{validSize, validSize})); TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, gaussian_blur_3x3()( src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), validSize, - validSize, 1, INTRINSICCV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + validSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, validSize, - validSize, 1, INTRINSICCV_BORDER_TYPE_REPLICATE, context)); + validSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); validSize = KernelTestParams5x5::kKernelSize - 1; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, gaussian_blur_5x5()( src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), validSize, - validSize, 1, INTRINSICCV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + validSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, validSize, - validSize, 1, INTRINSICCV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + validSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, ZeroImageSize3x3) { TypeParam src[1] = {}, dst[1]; intrinsiccv_filter_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create(&context, 1, 2 * sizeof(TypeParam), intrinsiccv_rectangle_t{0, 1})); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), 0, 1, 1, - INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); - ASSERT_EQ(INTRINSICCV_OK, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create(&context, 1, 2 * sizeof(TypeParam), intrinsiccv_rectangle_t{1, 0})); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 0, 1, - INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, ZeroImageSize5x5) { TypeParam src[1] = {}, dst[1]; intrinsiccv_filter_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create(&context, 1, 2 * sizeof(TypeParam), intrinsiccv_rectangle_t{0, 1})); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), 0, 1, 1, - INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); - ASSERT_EQ(INTRINSICCV_OK, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create(&context, 1, 2 * sizeof(TypeParam), intrinsiccv_rectangle_t{1, 0})); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 0, 1, - INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, ValidImageSize3x3) { using KernelTestParams = GaussianBlurKernelTestParams; intrinsiccv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams::kKernelSize - 1; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{validSize, validSize})); test::Array2D src{validSize, validSize, test::Options::vector_length()}; src.set(0, 0, {1, 2}); @@ -343,20 +343,20 @@ TYPED_TEST(GaussianBlur, ValidImageSize3x3) { test::Array2D dst{validSize, validSize, test::Options::vector_length()}; - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, gaussian_blur_3x3()( src.data(), src.stride(), dst.data(), dst.stride(), validSize, - validSize, 1, INTRINSICCV_BORDER_TYPE_REVERSE, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + validSize, 1, KLEIDICV_BORDER_TYPE_REVERSE, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, ValidImageSize5x5) { using KernelTestParams = GaussianBlurKernelTestParams; intrinsiccv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams::kKernelSize - 1; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{validSize, validSize})); test::Array2D src{validSize, validSize, test::Options::vector_length()}; src.set(0, 0, {1, 2, 3, 4}); @@ -366,11 +366,11 @@ TYPED_TEST(GaussianBlur, ValidImageSize5x5) { test::Array2D dst{validSize, validSize, test::Options::vector_length()}; - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, gaussian_blur_5x5()( src.data(), src.stride(), dst.data(), dst.stride(), validSize, - validSize, 1, INTRINSICCV_BORDER_TYPE_REVERSE, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + validSize, 1, KLEIDICV_BORDER_TYPE_REVERSE, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, UndersizeImage3x3) { @@ -380,32 +380,30 @@ TYPED_TEST(GaussianBlur, UndersizeImage3x3) { size_t validWidth = KernelTestParams::kKernelSize + 10; size_t validHeight = KernelTestParams::kKernelSize + 5; TypeParam src[1], dst[1]; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{underSize, underSize})); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{underSize, underSize})); + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), underSize, - underSize, 1, INTRINSICCV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); - ASSERT_EQ(INTRINSICCV_OK, - intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{underSize, validHeight})); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + underSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{underSize, validHeight})); + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), underSize, - validHeight, 1, INTRINSICCV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); - ASSERT_EQ(INTRINSICCV_OK, - intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validWidth, underSize})); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + validHeight, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{validWidth, underSize})); + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validWidth, - underSize, 1, INTRINSICCV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + underSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, UndersizeImage5x5) { @@ -415,60 +413,60 @@ TYPED_TEST(GaussianBlur, UndersizeImage5x5) { size_t width = KernelTestParams::kKernelSize + 8; size_t height = KernelTestParams::kKernelSize + 3; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{underSize, underSize})); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{underSize, underSize})); TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), underSize, - underSize, 1, INTRINSICCV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{underSize, height})); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + underSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{underSize, height})); + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), underSize, - height, 1, INTRINSICCV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{width, underSize})); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + height, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{width, underSize})); + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), width, - underSize, 1, INTRINSICCV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + underSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, OversizeImage) { intrinsiccv_filter_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create(&context, 1, 2 * sizeof(TypeParam), intrinsiccv_rectangle_t{1, 1})); TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, 1, - INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, 1, + KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS, INTRINSICCV_MAX_IMAGE_PIXELS, 1, - INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, 1, + KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, 1, - INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, 1, + KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS, INTRINSICCV_MAX_IMAGE_PIXELS, 1, - INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, 1, + KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, ChannelNumber) { @@ -477,23 +475,23 @@ TYPED_TEST(GaussianBlur, ChannelNumber) { intrinsiccv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{validSize, validSize})); TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, - validSize, INTRINSICCV_MAXIMUM_CHANNEL_COUNT + 1, - INTRINSICCV_BORDER_TYPE_REFLECT, context)); + validSize, KLEIDICV_MAXIMUM_CHANNEL_COUNT + 1, + KLEIDICV_BORDER_TYPE_REFLECT, context)); validSize = KernelTestParams5x5::kKernelSize - 1; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, - validSize, INTRINSICCV_MAXIMUM_CHANNEL_COUNT + 1, - INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + validSize, KLEIDICV_MAXIMUM_CHANNEL_COUNT + 1, + KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, InvalidContextSizeType) { @@ -502,20 +500,20 @@ TYPED_TEST(GaussianBlur, InvalidContextSizeType) { intrinsiccv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam) + 1, - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam) + 1, + intrinsiccv_rectangle_t{validSize, validSize})); TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_CONTEXT_MISMATCH, + EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, - validSize, 1, INTRINSICCV_BORDER_TYPE_REFLECT, context)); + validSize, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); validSize = KernelTestParams5x5::kKernelSize - 1; - EXPECT_EQ(INTRINSICCV_ERROR_CONTEXT_MISMATCH, + EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, - validSize, 1, INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + validSize, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, InvalidContextChannelNumber) { @@ -524,21 +522,21 @@ TYPED_TEST(GaussianBlur, InvalidContextChannelNumber) { intrinsiccv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 2, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 2, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{validSize, validSize})); TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_CONTEXT_MISMATCH, + EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, - validSize, 1, INTRINSICCV_BORDER_TYPE_REFLECT, context)); + validSize, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); validSize = KernelTestParams5x5::kKernelSize - 1; - EXPECT_EQ(INTRINSICCV_ERROR_CONTEXT_MISMATCH, + EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, - validSize, 1, INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + validSize, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } TYPED_TEST(GaussianBlur, InvalidContextImageSize) { @@ -547,29 +545,29 @@ TYPED_TEST(GaussianBlur, InvalidContextImageSize) { intrinsiccv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + &context, 1, 2 * sizeof(TypeParam), + intrinsiccv_rectangle_t{validSize, validSize})); TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_CONTEXT_MISMATCH, + EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize + 1, - validSize + 1, 1, INTRINSICCV_BORDER_TYPE_REFLECT, context)); + validSize + 1, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); validSize = KernelTestParams5x5::kKernelSize - 1; - EXPECT_EQ(INTRINSICCV_ERROR_CONTEXT_MISMATCH, + EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize + 1, - validSize + 1, 1, INTRINSICCV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_filter_release(context)); + validSize + 1, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); } -#ifdef INTRINSICCV_ALLOCATION_TESTS +#ifdef KLEIDICV_ALLOCATION_TESTS TEST(FilterCreate, CannotAllocateFilter) { MockMallocToFail::enable(); intrinsiccv_filter_context_t *context = nullptr; - intrinsiccv_rectangle_t rect{INTRINSICCV_MAX_IMAGE_PIXELS, 1}; - EXPECT_EQ(INTRINSICCV_ERROR_ALLOCATION, + intrinsiccv_rectangle_t rect{KLEIDICV_MAX_IMAGE_PIXELS, 1}; + EXPECT_EQ(KLEIDICV_ERROR_ALLOCATION, intrinsiccv_filter_create(&context, 1, 1, rect)); MockMallocToFail::disable(); } @@ -579,11 +577,11 @@ TEST(FilterCreate, OversizeImage) { intrinsiccv_filter_context_t *context = nullptr; for (intrinsiccv_rectangle_t rect : { - intrinsiccv_rectangle_t{INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1}, - intrinsiccv_rectangle_t{INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS}, + intrinsiccv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS + 1, 1}, + intrinsiccv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS}, }) { - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_filter_create(&context, 1, 1, rect)); ASSERT_EQ(nullptr, context); } @@ -593,8 +591,8 @@ TEST(FilterCreate, TypeSize) { intrinsiccv_filter_context_t *context = nullptr; EXPECT_EQ( - INTRINSICCV_ERROR_RANGE, - intrinsiccv_filter_create(&context, 1, INTRINSICCV_MAXIMUM_TYPE_SIZE + 1, + KLEIDICV_ERROR_RANGE, + intrinsiccv_filter_create(&context, 1, KLEIDICV_MAXIMUM_TYPE_SIZE + 1, intrinsiccv_rectangle_t{1, 1})); ASSERT_EQ(nullptr, context); } @@ -603,18 +601,17 @@ TEST(FilterCreate, ChannelNumber) { intrinsiccv_filter_context_t *context = nullptr; EXPECT_EQ( - INTRINSICCV_ERROR_RANGE, - intrinsiccv_filter_create(&context, INTRINSICCV_MAXIMUM_CHANNEL_COUNT + 1, - 1, intrinsiccv_rectangle_t{1, 1})); + KLEIDICV_ERROR_RANGE, + intrinsiccv_filter_create(&context, KLEIDICV_MAXIMUM_CHANNEL_COUNT + 1, 1, + intrinsiccv_rectangle_t{1, 1})); ASSERT_EQ(nullptr, context); } TEST(FilterCreate, NullPointer) { EXPECT_EQ( - INTRINSICCV_ERROR_NULL_POINTER, + KLEIDICV_ERROR_NULL_POINTER, intrinsiccv_filter_create(nullptr, 1, 1, intrinsiccv_rectangle_t{1, 1})); } TEST(FilterRelease, NullPointer) { - EXPECT_EQ(INTRINSICCV_ERROR_NULL_POINTER, - intrinsiccv_filter_release(nullptr)); + EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, intrinsiccv_filter_release(nullptr)); } diff --git a/test/api/test_merge.cpp b/test/api/test_merge.cpp index d19d97e6f..992930356 100644 --- a/test/api/test_merge.cpp +++ b/test/api/test_merge.cpp @@ -88,7 +88,7 @@ class MergeTest final { strides[i] = inputs[i].stride(); } ASSERT_EQ( - INTRINSICCV_OK, + KLEIDICV_OK, intrinsiccv_merge(input_raw_pointers, strides, actual_output.data(), actual_output.stride(), input_width, height, Channels, sizeof(ElementType))); @@ -110,7 +110,7 @@ class MergeTest final { template static void test_not_implemented( - intrinsiccv_error_t expected = INTRINSICCV_ERROR_NOT_IMPLEMENTED) { + intrinsiccv_error_t expected = KLEIDICV_ERROR_NOT_IMPLEMENTED) { const size_t width = 1, height = 1; ElementType src_arrays[kChannels][width * height] = {{234}}; ElementType dst[kChannels * width * height] = {123}; @@ -211,7 +211,7 @@ TYPED_TEST(Merge, FourChannels) { } TYPED_TEST(Merge, OneChannelOutOfRange) { - test_not_implemented(INTRINSICCV_ERROR_RANGE); + test_not_implemented(KLEIDICV_ERROR_RANGE); } TYPED_TEST(Merge, FiveChannelsNotImplemented) { @@ -237,7 +237,7 @@ TYPED_TEST(Merge, NullPointer) { for (int i = 0; i < channels; ++i) { srcs[i] = (i == null_src) ? nullptr : src_arrays + i; } - EXPECT_EQ(INTRINSICCV_ERROR_NULL_POINTER, + EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, intrinsiccv_merge(srcs, src_strides, dst, dst_stride, 1, 1, channels, sizeof(TypeParam))); } @@ -270,7 +270,7 @@ TYPED_TEST(Merge, Misalignment) { auto check_merge = [&](int channels, void* dst_maybe_misaligned, size_t dst_stride_maybe_misaligned) { EXPECT_EQ( - INTRINSICCV_ERROR_ALIGNMENT, + KLEIDICV_ERROR_ALIGNMENT, intrinsiccv_merge(reinterpret_cast(srcs), src_strides, dst_maybe_misaligned, dst_stride_maybe_misaligned, 1, 1, channels, sizeof(TypeParam))); @@ -307,12 +307,10 @@ TYPED_TEST(Merge, ZeroImageSize) { size_t src_strides[kChannels] = {sizeof(TypeParam), sizeof(TypeParam)}; const size_t dst_stride = kChannels * sizeof(TypeParam); - EXPECT_EQ(INTRINSICCV_OK, - intrinsiccv_merge(srcs, src_strides, dst, dst_stride, 0, 1, - kChannels, sizeof(TypeParam))); - EXPECT_EQ(INTRINSICCV_OK, - intrinsiccv_merge(srcs, src_strides, dst, dst_stride, 1, 0, - kChannels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_merge(srcs, src_strides, dst, dst_stride, + 0, 1, kChannels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_merge(srcs, src_strides, dst, dst_stride, + 1, 0, kChannels, sizeof(TypeParam))); } TYPED_TEST(Merge, OversizeImage) { @@ -322,13 +320,12 @@ TYPED_TEST(Merge, OversizeImage) { size_t src_strides[kChannels] = {sizeof(TypeParam), sizeof(TypeParam)}; const size_t dst_stride = kChannels * sizeof(TypeParam); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_merge(srcs, src_strides, dst, dst_stride, - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, kChannels, - sizeof(TypeParam))); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, - intrinsiccv_merge(srcs, src_strides, dst, dst_stride, - INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, kChannels, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, kChannels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, + intrinsiccv_merge( + srcs, src_strides, dst, dst_stride, KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, kChannels, sizeof(TypeParam))); } diff --git a/test/api/test_min_max.cpp b/test/api/test_min_max.cpp index 6d376805c..e7c057ac6 100644 --- a/test/api/test_min_max.cpp +++ b/test/api/test_min_max.cpp @@ -9,19 +9,19 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_MIN_MAX(type, suffix) \ - INTRINSICCV_API(min_max, intrinsiccv_min_max_##suffix, type) +#define KLEIDICV_MIN_MAX(type, suffix) \ + KLEIDICV_API(min_max, intrinsiccv_min_max_##suffix, type) -INTRINSICCV_MIN_MAX(int8_t, s8); -INTRINSICCV_MIN_MAX(uint8_t, u8); -INTRINSICCV_MIN_MAX(int16_t, s16); -INTRINSICCV_MIN_MAX(uint16_t, u16); -INTRINSICCV_MIN_MAX(int32_t, s32); +KLEIDICV_MIN_MAX(int8_t, s8); +KLEIDICV_MIN_MAX(uint8_t, u8); +KLEIDICV_MIN_MAX(int16_t, s16); +KLEIDICV_MIN_MAX(uint16_t, u16); +KLEIDICV_MIN_MAX(int32_t, s32); -#define INTRINSICCV_MIN_MAX_LOC(type, suffix) \ - INTRINSICCV_API(min_max_loc, intrinsiccv_min_max_loc_##suffix, type) +#define KLEIDICV_MIN_MAX_LOC(type, suffix) \ + KLEIDICV_API(min_max_loc, intrinsiccv_min_max_loc_##suffix, type) -INTRINSICCV_MIN_MAX_LOC(uint8_t, u8); +KLEIDICV_MIN_MAX_LOC(uint8_t, u8); template class MinMaxTest { @@ -200,7 +200,7 @@ class MinMaxTest { if (p_max) { *p_max = std::numeric_limits::min(); } - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, min_max()(source.data(), source.stride(), width(), height(), p_min, p_max)); if (p_min) { @@ -220,7 +220,7 @@ class MinMaxTest { setup(source, testData); ElementType actual_min = 2, actual_max = 1; - EXPECT_EQ(INTRINSICCV_ERROR_NULL_POINTER, + EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, min_max()(nullptr, source.stride(), width(), height(), &actual_min, &actual_max)); EXPECT_EQ(2, actual_min); @@ -253,9 +253,9 @@ class MinMaxLocTest : public MinMaxTest { if (p_max_offset) { *p_max_offset = std::numeric_limits::max(); } - EXPECT_EQ(INTRINSICCV_OK, min_max_loc()( - source.data(), source.stride(), width(), - height(), p_min_offset, p_max_offset)); + EXPECT_EQ(KLEIDICV_OK, min_max_loc()( + source.data(), source.stride(), width(), + height(), p_min_offset, p_max_offset)); if (p_min_offset) { EXPECT_EQ(*p_min_offset, expected_min_offset); } @@ -274,7 +274,7 @@ class MinMaxLocTest : public MinMaxTest { size_t min_offset = 2, max_offset = 1; - EXPECT_EQ(INTRINSICCV_ERROR_NULL_POINTER, + EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, min_max_loc()(nullptr, source.stride(), width(), height(), &min_offset, &max_offset)); EXPECT_EQ(2, min_offset); @@ -309,31 +309,31 @@ TYPED_TEST(MinMax, Misalignment) { return; } TypeParam src[1] = {}, min_value, max_value; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, min_max()(src, sizeof(TypeParam) + 1, 1, 1, &min_value, &max_value)); } TYPED_TEST(MinMax, ZeroImageSize) { TypeParam src[1] = {}, min_value, max_value; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, min_max()(src, sizeof(TypeParam), 0, 1, &min_value, &max_value)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, min_max()(src, sizeof(TypeParam), 1, 0, &min_value, &max_value)); } TYPED_TEST(MinMax, OversizeImage) { TypeParam src[1] = {}, min_value, max_value; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, min_max()(src, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, - &min_value, &max_value)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, - min_max()( - src, sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, &min_value, &max_value)); + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, &min_value, + &max_value)); + EXPECT_EQ( + KLEIDICV_ERROR_RANGE, + min_max()(src, sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, &min_value, &max_value)); } template @@ -351,10 +351,10 @@ TYPED_TEST(MinMaxLoc, ZeroImageSize) { TypeParam src[1] = {}; size_t min_offset = 0, max_offset = 0; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, min_max_loc()(src, sizeof(TypeParam), 0, 1, &min_offset, &max_offset)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, min_max_loc()(src, sizeof(TypeParam), 1, 0, &min_offset, &max_offset)); } @@ -363,12 +363,12 @@ TYPED_TEST(MinMaxLoc, OversizeImage) { TypeParam src[1] = {}; size_t min_offset = 0, max_offset = 8; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, min_max_loc()(src, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, &min_offset, &max_offset)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, min_max_loc()( - src, sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, &min_offset, &max_offset)); + src, sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, &min_offset, &max_offset)); } diff --git a/test/api/test_morphology.cpp b/test/api/test_morphology.cpp index ce72b4389..cf3a6e0c2 100644 --- a/test/api/test_morphology.cpp +++ b/test/api/test_morphology.cpp @@ -14,7 +14,7 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_PARAMS(name, impl, type, op) \ +#define KLEIDICV_PARAMS(name, impl, type, op) \ template , bool> = true> \ class name { \ @@ -25,8 +25,8 @@ } \ }; -INTRINSICCV_PARAMS(DilateParams, intrinsiccv_dilate_u8, uint8_t, std::max); -INTRINSICCV_PARAMS(ErodeParams, intrinsiccv_erode_u8, uint8_t, std::min); +KLEIDICV_PARAMS(DilateParams, intrinsiccv_dilate_u8, uint8_t, std::max); +KLEIDICV_PARAMS(ErodeParams, intrinsiccv_erode_u8, uint8_t, std::min); template struct MorphologyKernelTestParams { @@ -36,10 +36,10 @@ struct MorphologyKernelTestParams { }; // end of struct MorphologyKernelTestParams static constexpr std::array kDefaultBorder = { - INTRINSICCV_BORDER_TYPE_REPLICATE}; + KLEIDICV_BORDER_TYPE_REPLICATE}; static constexpr std::array kConstantBorder = { - INTRINSICCV_BORDER_TYPE_CONSTANT}; + KLEIDICV_BORDER_TYPE_CONSTANT}; static constexpr std::array kDefaultBorderValues = {{ @@ -144,7 +144,7 @@ class MorphologyTest input->channels(), iterations_, sizeof(InputType), intrinsiccv_rectangle_t{input->width() / input->channels(), input->height()}); - if (ret != INTRINSICCV_OK) { + if (ret != KLEIDICV_OK) { return ret; } @@ -152,7 +152,7 @@ class MorphologyTest input->data(), input->stride(), output->data(), output->stride(), input->width() / input->channels(), input->height(), context); auto releaseRet = intrinsiccv_morphology_release(context); - if (releaseRet != INTRINSICCV_OK) { + if (releaseRet != KLEIDICV_OK) { return releaseRet; } @@ -310,7 +310,7 @@ TYPED_TEST(Morphology, Anchors) { static intrinsiccv_error_t make_minimal_context( intrinsiccv_morphology_context_t **context, size_t type_size, - intrinsiccv_border_type_t border = INTRINSICCV_BORDER_TYPE_REPLICATE) { + intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE) { return intrinsiccv_morphology_create( context, intrinsiccv_rectangle_t{1, 1}, intrinsiccv_point_t{0, 0}, border, intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, type_size, @@ -331,23 +331,23 @@ static void test_valid_image_size(intrinsiccv_rectangle_t kernel, for (size_t y = 0; y < kernel.width; y += kernel.width - 1) { intrinsiccv_point_t anchor{x, y}; for (intrinsiccv_border_type_t border : { - INTRINSICCV_BORDER_TYPE_REPLICATE, - INTRINSICCV_BORDER_TYPE_CONSTANT, + KLEIDICV_BORDER_TYPE_REPLICATE, + KLEIDICV_BORDER_TYPE_CONSTANT, }) { intrinsiccv_morphology_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create(&context, kernel, anchor, border, border_values, 1, 1, sizeof(ElementType), image)); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, ErodeParams::api()( src.data(), src.stride(), dst.data(), dst.stride(), validSize, validSize, context)); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, DilateParams::api()( src.data(), src.stride(), dst.data(), dst.stride(), validSize, validSize, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } } } @@ -362,58 +362,58 @@ static void test_undersize_image(intrinsiccv_rectangle_t kernel) { intrinsiccv_rectangle_t image{underSize, underSize}; intrinsiccv_rectangle_t imageW{underSize, validHeight}; intrinsiccv_rectangle_t imageH{validWidth, underSize}; - intrinsiccv_border_type_t border = INTRINSICCV_BORDER_TYPE_REPLICATE; + intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; intrinsiccv_border_values_t border_values{0, 0, 1, 1}; intrinsiccv_point_t anchor{1, 1}; ElementType src[1], dst[1]; - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_create( - &context, kernel, anchor, border, border_values, - 1, 1, sizeof(ElementType), image)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( + &context, kernel, anchor, border, border_values, 1, + 1, sizeof(ElementType), image)); + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, ErodeParams::api()(src, sizeof(ElementType), dst, sizeof(ElementType), underSize, underSize, context)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, DilateParams::api()(src, sizeof(ElementType), dst, sizeof(ElementType), underSize, underSize, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_create( - &context, kernel, anchor, border, border_values, - 1, 1, sizeof(ElementType), imageW)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( + &context, kernel, anchor, border, border_values, 1, + 1, sizeof(ElementType), imageW)); + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, ErodeParams::api()(src, sizeof(ElementType), dst, sizeof(ElementType), underSize, validHeight, context)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, DilateParams::api()(src, sizeof(ElementType), dst, sizeof(ElementType), underSize, validHeight, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_create( - &context, kernel, anchor, border, border_values, - 1, 1, sizeof(ElementType), imageH)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( + &context, kernel, anchor, border, border_values, 1, + 1, sizeof(ElementType), imageH)); + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, ErodeParams::api()(src, sizeof(ElementType), dst, sizeof(ElementType), validWidth, underSize, context)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, DilateParams::api()(src, sizeof(ElementType), dst, sizeof(ElementType), validWidth, underSize, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, UnsupportedBorderType) { for (intrinsiccv_border_type_t border : { - INTRINSICCV_BORDER_TYPE_REFLECT, - INTRINSICCV_BORDER_TYPE_WRAP, - INTRINSICCV_BORDER_TYPE_REVERSE, - INTRINSICCV_BORDER_TYPE_TRANSPARENT, - INTRINSICCV_BORDER_TYPE_NONE, + KLEIDICV_BORDER_TYPE_REFLECT, + KLEIDICV_BORDER_TYPE_WRAP, + KLEIDICV_BORDER_TYPE_REVERSE, + KLEIDICV_BORDER_TYPE_TRANSPARENT, + KLEIDICV_BORDER_TYPE_NONE, }) { intrinsiccv_morphology_context_t *context = nullptr; - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, make_minimal_context(&context, sizeof(TypeParam), border)); ASSERT_EQ(nullptr, context); } @@ -423,21 +423,21 @@ TYPED_TEST(Morphology, UnsupportedSize) { intrinsiccv_morphology_context_t *context = nullptr; intrinsiccv_rectangle_t small_rect{1, 1}; intrinsiccv_point_t anchor{0, 0}; - intrinsiccv_border_type_t border = INTRINSICCV_BORDER_TYPE_REPLICATE; + intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; intrinsiccv_border_values_t border_values{0, 0, 1, 1}; for (intrinsiccv_rectangle_t bad_rect : { - intrinsiccv_rectangle_t{INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1}, - intrinsiccv_rectangle_t{INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS}, + intrinsiccv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS + 1, 1}, + intrinsiccv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS}, }) { - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_morphology_create(&context, bad_rect, anchor, border, border_values, 1, 1, sizeof(TypeParam), small_rect)); ASSERT_EQ(nullptr, context); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_morphology_create(&context, small_rect, anchor, border, border_values, 1, 1, sizeof(TypeParam), bad_rect)); @@ -445,16 +445,16 @@ TYPED_TEST(Morphology, UnsupportedSize) { } } -#ifdef INTRINSICCV_ALLOCATION_TESTS +#ifdef KLEIDICV_ALLOCATION_TESTS TYPED_TEST(Morphology, CannotAllocateImage) { MockMallocToFail::enable(); intrinsiccv_morphology_context_t *context = nullptr; intrinsiccv_rectangle_t kernel{3, 3}, image{3072, 2048}; - intrinsiccv_border_type_t border = INTRINSICCV_BORDER_TYPE_REPLICATE; + intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; intrinsiccv_border_values_t border_values{0, 0, 1, 1}; intrinsiccv_point_t anchor{1, 1}; - EXPECT_EQ(INTRINSICCV_ERROR_ALLOCATION, + EXPECT_EQ(KLEIDICV_ERROR_ALLOCATION, intrinsiccv_morphology_create(&context, kernel, anchor, border, border_values, 1, 1, sizeof(TypeParam), image)); @@ -465,11 +465,11 @@ TYPED_TEST(Morphology, CannotAllocateImage) { TYPED_TEST(Morphology, OversizeImage) { intrinsiccv_morphology_context_t *context = nullptr; intrinsiccv_rectangle_t kernel{3, 1UL << 33}, image{1UL << 33, 100}; - intrinsiccv_border_type_t border = INTRINSICCV_BORDER_TYPE_REPLICATE; + intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; intrinsiccv_border_values_t border_values{0, 0, 1, 1}; intrinsiccv_point_t anchor{1, 1}; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_morphology_create(&context, kernel, anchor, border, border_values, 1, 1, sizeof(TypeParam), image)); @@ -478,21 +478,21 @@ TYPED_TEST(Morphology, OversizeImage) { TYPED_TEST(Morphology, InvalidAnchors) { intrinsiccv_morphology_context_t *context = nullptr; intrinsiccv_rectangle_t kernel1{1, 1}, kernel2{6, 4}, image{20, 20}; - intrinsiccv_border_type_t border = INTRINSICCV_BORDER_TYPE_REPLICATE; + intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; intrinsiccv_border_values_t border_values{0, 0, 1, 1}; intrinsiccv_point_t anchor1{1, 0}, anchor2{6, 3}, anchor3{5, 4}; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_morphology_create(&context, kernel1, anchor1, border, border_values, 1, 1, sizeof(TypeParam), image)); ASSERT_EQ(nullptr, context); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_morphology_create(&context, kernel2, anchor2, border, border_values, 1, 1, sizeof(TypeParam), image)); ASSERT_EQ(nullptr, context); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_morphology_create(&context, kernel2, anchor3, border, border_values, 1, 1, sizeof(TypeParam), image)); @@ -502,25 +502,24 @@ TYPED_TEST(Morphology, InvalidAnchors) { TYPED_TEST(Morphology, InvalidTypeSize) { intrinsiccv_morphology_context_t *context = nullptr; - EXPECT_EQ( - INTRINSICCV_ERROR_RANGE, - intrinsiccv_morphology_create( - &context, intrinsiccv_rectangle_t{1, 1}, intrinsiccv_point_t{0, 0}, - INTRINSICCV_BORDER_TYPE_REPLICATE, - intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, - INTRINSICCV_MAXIMUM_TYPE_SIZE + 1, intrinsiccv_rectangle_t{1, 1})); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, + intrinsiccv_morphology_create( + &context, intrinsiccv_rectangle_t{1, 1}, + intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, + intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, + KLEIDICV_MAXIMUM_TYPE_SIZE + 1, intrinsiccv_rectangle_t{1, 1})); ASSERT_EQ(nullptr, context); } TYPED_TEST(Morphology, InvalidChannelNumber) { intrinsiccv_morphology_context_t *context = nullptr; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_morphology_create( &context, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, INTRINSICCV_BORDER_TYPE_REPLICATE, + intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, intrinsiccv_border_values_t{0, 0, 1, 1}, - INTRINSICCV_MAXIMUM_CHANNEL_COUNT + 1, 1, 1, + KLEIDICV_MAXIMUM_CHANNEL_COUNT + 1, 1, 1, intrinsiccv_rectangle_t{1, 1})); ASSERT_EQ(nullptr, context); } @@ -528,42 +527,42 @@ TYPED_TEST(Morphology, InvalidChannelNumber) { TYPED_TEST(Morphology, ImageBiggerThanContext) { intrinsiccv_morphology_context_t *context = nullptr; intrinsiccv_rectangle_t kernel{3, 3}, image{5, 5}; - intrinsiccv_border_type_t border = INTRINSICCV_BORDER_TYPE_REPLICATE; + intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; intrinsiccv_border_values_t border_values{0, 0, 1, 1}; intrinsiccv_point_t anchor{1, 1}; - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_create( - &context, kernel, anchor, border, border_values, - 1, 1, sizeof(TypeParam), image)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( + &context, kernel, anchor, border, border_values, 1, + 1, sizeof(TypeParam), image)); const size_t w = 7, h = 7; TypeParam src[w * h], dst[w * h]; EXPECT_EQ( - INTRINSICCV_ERROR_CONTEXT_MISMATCH, + KLEIDICV_ERROR_CONTEXT_MISMATCH, ErodeParams::api()(src, sizeof(TypeParam) * w, dst, sizeof(TypeParam) * w, w, h, context)); EXPECT_EQ( - INTRINSICCV_ERROR_CONTEXT_MISMATCH, + KLEIDICV_ERROR_CONTEXT_MISMATCH, DilateParams::api()(src, sizeof(TypeParam) * w, dst, sizeof(TypeParam) * w, w, h, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, DilateNullPointer) { intrinsiccv_morphology_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, make_minimal_context(&context, sizeof(TypeParam))); + ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1] = {}, dst[1]; test::test_null_args(DilateParams::api(), src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, context); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeNullPointer) { intrinsiccv_morphology_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, make_minimal_context(&context, sizeof(TypeParam))); + ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1] = {}, dst[1]; test::test_null_args(ErodeParams::api(), src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, context); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, DilateMisalignment) { @@ -572,16 +571,16 @@ TYPED_TEST(Morphology, DilateMisalignment) { return; } intrinsiccv_morphology_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, make_minimal_context(&context, sizeof(TypeParam))); + ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, DilateParams::api()(src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1, context)); EXPECT_EQ( - INTRINSICCV_ERROR_ALIGNMENT, + KLEIDICV_ERROR_ALIGNMENT, DilateParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeMisalignment) { @@ -590,110 +589,108 @@ TYPED_TEST(Morphology, ErodeMisalignment) { return; } intrinsiccv_morphology_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, make_minimal_context(&context, sizeof(TypeParam))); + ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, ErodeParams::api()(src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1, context)); EXPECT_EQ( - INTRINSICCV_ERROR_ALIGNMENT, + KLEIDICV_ERROR_ALIGNMENT, ErodeParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, DilateZeroImageSize) { intrinsiccv_morphology_context_t *context = nullptr; TypeParam src[1], dst[1]; - ASSERT_EQ(INTRINSICCV_OK, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( &context, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, INTRINSICCV_BORDER_TYPE_REPLICATE, + intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, sizeof(TypeParam), intrinsiccv_rectangle_t{0, 1})); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, DilateParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 0, 1, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); - ASSERT_EQ(INTRINSICCV_OK, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( &context, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, INTRINSICCV_BORDER_TYPE_REPLICATE, + intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, sizeof(TypeParam), intrinsiccv_rectangle_t{1, 0})); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, DilateParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 0, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeZeroImageSize) { intrinsiccv_morphology_context_t *context = nullptr; TypeParam src[1], dst[1]; - ASSERT_EQ(INTRINSICCV_OK, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( &context, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, INTRINSICCV_BORDER_TYPE_REPLICATE, + intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, sizeof(TypeParam), intrinsiccv_rectangle_t{0, 1})); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, ErodeParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 0, 1, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); - ASSERT_EQ(INTRINSICCV_OK, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( &context, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, INTRINSICCV_BORDER_TYPE_REPLICATE, + intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, sizeof(TypeParam), intrinsiccv_rectangle_t{1, 0})); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, ErodeParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 0, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, DilateInvalidContextSizeType) { intrinsiccv_morphology_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, - make_minimal_context(&context, sizeof(TypeParam) + 1)); + ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam) + 1)); TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_CONTEXT_MISMATCH, + EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, DilateParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeInvalidContextSizeType) { intrinsiccv_morphology_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, - make_minimal_context(&context, sizeof(TypeParam) + 1)); + ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam) + 1)); TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_CONTEXT_MISMATCH, + EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, ErodeParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, DilateInvalidContextImageSize) { intrinsiccv_morphology_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, make_minimal_context(&context, sizeof(TypeParam))); + ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_CONTEXT_MISMATCH, + EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, DilateParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 2, 1, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeInvalidContextImageSize) { intrinsiccv_morphology_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, make_minimal_context(&context, sizeof(TypeParam))); + ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_CONTEXT_MISMATCH, + EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, ErodeParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 2, 1, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, ValidImageSize) { @@ -722,45 +719,43 @@ TYPED_TEST(Morphology, UndersizeImage) { TYPED_TEST(Morphology, DilateOversizeImage) { intrinsiccv_morphology_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, make_minimal_context(&context, sizeof(TypeParam))); + ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, DilateParams::api()( src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, context)); - EXPECT_EQ( - INTRINSICCV_ERROR_RANGE, - DilateParams::api()( - src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS, INTRINSICCV_MAX_IMAGE_PIXELS, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, context)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, + DilateParams::api()( + src, sizeof(TypeParam), dst, sizeof(TypeParam), + KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeOversizeImage) { intrinsiccv_morphology_context_t *context = nullptr; - ASSERT_EQ(INTRINSICCV_OK, make_minimal_context(&context, sizeof(TypeParam))); + ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1], dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, ErodeParams::api()( src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, context)); - EXPECT_EQ( - INTRINSICCV_ERROR_RANGE, - ErodeParams::api()( - src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS, INTRINSICCV_MAX_IMAGE_PIXELS, context)); - EXPECT_EQ(INTRINSICCV_OK, intrinsiccv_morphology_release(context)); + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, context)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, + ErodeParams::api()( + src, sizeof(TypeParam), dst, sizeof(TypeParam), + KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, context)); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); } TEST(MorphologyCreate, NullPointer) { - EXPECT_EQ(INTRINSICCV_ERROR_NULL_POINTER, + EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, intrinsiccv_morphology_create( nullptr, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, INTRINSICCV_BORDER_TYPE_REPLICATE, + intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, 1, intrinsiccv_rectangle_t{1, 1})); } TEST(MorphologyRelease, NullPointer) { - EXPECT_EQ(INTRINSICCV_ERROR_NULL_POINTER, + EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, intrinsiccv_morphology_release(nullptr)); } diff --git a/test/api/test_resize_linear.cpp b/test/api/test_resize_linear.cpp index a132474ae..af6a3beec 100644 --- a/test/api/test_resize_linear.cpp +++ b/test/api/test_resize_linear.cpp @@ -16,13 +16,13 @@ TEST(ResizeLinear, NotImplemented) { const uint8_t src[1] = {}; uint8_t dst[4]; - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, intrinsiccv_resize_linear_u8(src, 1, 1, 1, dst, 2, 2, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, intrinsiccv_resize_linear_u8(src, 1, 1, 1, dst, 1, 1, 2)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, intrinsiccv_resize_linear_u8(src, 1, 1, 1, dst, 4, 4, 2)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, intrinsiccv_resize_linear_u8(src, 1, 1, 1, dst, 2, 2, 4)); } @@ -37,25 +37,25 @@ TEST(ResizeLinear, InvalidImageSize) { const uint8_t src[1] = {}; uint8_t dst[4]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_resize_linear_u8(src, 1, 1, 1, dst, - INTRINSICCV_MAX_IMAGE_PIXELS + 1, - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1)); + KLEIDICV_MAX_IMAGE_PIXELS + 1, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_resize_linear_u8( - src, 1, 1, 1, dst, INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, INTRINSICCV_MAX_IMAGE_PIXELS)); + src, 1, 1, 1, dst, KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS)); } TEST(ResizeLinear, ZeroImageSize) { const uint8_t src[1] = {}; uint8_t dst[1]; - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_resize_linear_u8(src, 0, 0, 0, dst, 0, 0, 0)); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_resize_linear_u8(src, 1, 1, 0, dst, 2, 2, 0)); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_resize_linear_u8(src, 0, 0, 1, dst, 0, 0, 2)); } @@ -248,9 +248,9 @@ static void do_large_dimensions_test(size_t x_scale, size_t y_scale) { resize_linear_unaccelerated_u8(src.data(), src_stride, src_width, src_height, expected_data.data(), dst_stride, dst_width, dst_height); - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_resize_linear_u8( - src.data(), src_stride, src_width, src_height, - dst.data(), dst_stride, dst_width, dst_height)); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_resize_linear_u8( + src.data(), src_stride, src_width, src_height, + dst.data(), dst_stride, dst_width, dst_height)); for (size_t y = 0; y < dst_height; ++y) { // Compare as int to avoid test framework displaying values as chars. @@ -314,9 +314,9 @@ void do_linear_resize_test(const ResizeTestParams ¶m, size_t src_padding, std::vector src = flatten(param.src, src_padding), dst; dst.resize(dst_stride * dst_height); - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_resize_linear_u8( - src.data(), src_stride, src_width, src_height, - dst.data(), dst_stride, dst_width, dst_height)); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_resize_linear_u8( + src.data(), src_stride, src_width, src_height, + dst.data(), dst_stride, dst_width, dst_height)); for (size_t y = 0; y < dst_height; ++y) { // Compare as int to avoid test framework displaying values as chars. std::vector actual{ diff --git a/test/api/test_resize_to_quarter.cpp b/test/api/test_resize_to_quarter.cpp index 15a319c0c..6b9ee7ecf 100644 --- a/test/api/test_resize_to_quarter.cpp +++ b/test/api/test_resize_to_quarter.cpp @@ -41,11 +41,10 @@ class ResizeToQuarterTest final { calculate_expected(source, expected); - ASSERT_EQ( - INTRINSICCV_OK, - intrinsiccv_resize_to_quarter_u8( - source.data(), source.stride(), source.width(), source.height(), - actual.data(), actual.stride(), actual.width(), actual.height())); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_resize_to_quarter_u8( + source.data(), source.stride(), source.width(), + source.height(), actual.data(), actual.stride(), + actual.width(), actual.height())); EXPECT_EQ_ARRAY2D(actual, expected); } @@ -225,9 +224,9 @@ TEST(ResizeToQuarter, ZeroImageSize) { const uint8_t src[1] = {}; uint8_t dst[1]; - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_resize_to_quarter_u8(src, 1, 0, 1, dst, 1, 0, 1)); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_resize_to_quarter_u8(src, 1, 1, 0, dst, 1, 1, 0)); } @@ -235,24 +234,23 @@ TEST(ResizeToQuarter, InvalidImageSize) { const uint8_t src[1] = {}; uint8_t dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_resize_to_quarter_u8( - src, 1, INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, dst, 1, 1, 1)); + src, 1, KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, dst, 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, - intrinsiccv_resize_to_quarter_u8( - src, 1, INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, dst, 1, 1, 1)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_resize_to_quarter_u8( + src, 1, KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, dst, 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_resize_to_quarter_u8(src, 1, 8, 8, dst, 1, 4, 3)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_resize_to_quarter_u8(src, 1, 8, 8, dst, 1, 3, 4)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_resize_to_quarter_u8(src, 1, 9, 9, dst, 1, 4, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_resize_to_quarter_u8(src, 1, 9, 9, dst, 1, 7, 5)); } diff --git a/test/api/test_rgb_and_gray.cpp b/test/api/test_rgb_and_gray.cpp index e848ae107..83b2071c7 100644 --- a/test/api/test_rgb_and_gray.cpp +++ b/test/api/test_rgb_and_gray.cpp @@ -43,19 +43,19 @@ class GrayTest final { auto err = impl(source.data(), source.stride(), actual.data(), actual.stride(), width_, actual.height()); - ASSERT_EQ(INTRINSICCV_OK, err); + ASSERT_EQ(KLEIDICV_OK, err); EXPECT_EQ_ARRAY2D(actual, expected); test::test_null_args(impl, source.data(), source.stride(), actual.data(), actual.stride(), width_, actual.height()); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, impl(source.data(), source.stride(), actual.data(), - actual.stride(), INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1)); + actual.stride(), KLEIDICV_MAX_IMAGE_PIXELS + 1, 1)); EXPECT_EQ( - INTRINSICCV_ERROR_RANGE, + KLEIDICV_ERROR_RANGE, impl(source.data(), source.stride(), actual.data(), actual.stride(), - INTRINSICCV_MAX_IMAGE_PIXELS, INTRINSICCV_MAX_IMAGE_PIXELS)); + KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS)); } private: @@ -108,24 +108,24 @@ class ColourTest final { auto err = impl(source.data(), source.stride(), actual.data(), actual.stride(), logical_width, actual.height()); - ASSERT_EQ(INTRINSICCV_OK, err); + ASSERT_EQ(KLEIDICV_OK, err); EXPECT_EQ_ARRAY2D(actual, expected); test::test_null_args(impl, source.data(), source.stride(), actual.data(), actual.stride(), logical_width, actual.height()); - EXPECT_EQ(INTRINSICCV_OK, impl(source.data(), source.stride(), - actual.data(), actual.stride(), 0, 1)); - EXPECT_EQ(INTRINSICCV_OK, impl(source.data(), source.stride(), - actual.data(), actual.stride(), 1, 0)); + EXPECT_EQ(KLEIDICV_OK, impl(source.data(), source.stride(), actual.data(), + actual.stride(), 0, 1)); + EXPECT_EQ(KLEIDICV_OK, impl(source.data(), source.stride(), actual.data(), + actual.stride(), 1, 0)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, impl(source.data(), source.stride(), actual.data(), - actual.stride(), INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1)); + actual.stride(), KLEIDICV_MAX_IMAGE_PIXELS + 1, 1)); EXPECT_EQ( - INTRINSICCV_ERROR_RANGE, + KLEIDICV_ERROR_RANGE, impl(source.data(), source.stride(), actual.data(), actual.stride(), - INTRINSICCV_MAX_IMAGE_PIXELS, INTRINSICCV_MAX_IMAGE_PIXELS)); + KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS)); } private: diff --git a/test/api/test_saturating_absdiff.cpp b/test/api/test_saturating_absdiff.cpp index bfa85b79e..3a641561e 100644 --- a/test/api/test_saturating_absdiff.cpp +++ b/test/api/test_saturating_absdiff.cpp @@ -10,15 +10,15 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_SATURATING_ABSDIFF(type, suffix) \ - INTRINSICCV_API(saturating_absdiff, intrinsiccv_saturating_absdiff_##suffix, \ - type) +#define KLEIDICV_SATURATING_ABSDIFF(type, suffix) \ + KLEIDICV_API(saturating_absdiff, intrinsiccv_saturating_absdiff_##suffix, \ + type) -INTRINSICCV_SATURATING_ABSDIFF(int8_t, s8); -INTRINSICCV_SATURATING_ABSDIFF(uint8_t, u8); -INTRINSICCV_SATURATING_ABSDIFF(int16_t, s16); -INTRINSICCV_SATURATING_ABSDIFF(uint16_t, u16); -INTRINSICCV_SATURATING_ABSDIFF(int32_t, s32); +KLEIDICV_SATURATING_ABSDIFF(int8_t, s8); +KLEIDICV_SATURATING_ABSDIFF(uint8_t, u8); +KLEIDICV_SATURATING_ABSDIFF(int16_t, s16); +KLEIDICV_SATURATING_ABSDIFF(uint16_t, u16); +KLEIDICV_SATURATING_ABSDIFF(int32_t, s32); template class SaturatingAbsDiffTest final : public BinaryOperationTest { @@ -110,15 +110,15 @@ TYPED_TEST(SaturatingAbsDiff, Misalignment) { return; } TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_absdiff()(src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_absdiff()(src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_absdiff()(src, sizeof(TypeParam), src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1)); @@ -126,23 +126,23 @@ TYPED_TEST(SaturatingAbsDiff, Misalignment) { TYPED_TEST(SaturatingAbsDiff, ZeroImageSize) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_OK, saturating_absdiff()( - src, sizeof(TypeParam), src, sizeof(TypeParam), - dst, sizeof(TypeParam), 0, 1)); - EXPECT_EQ(INTRINSICCV_OK, saturating_absdiff()( - src, sizeof(TypeParam), src, sizeof(TypeParam), - dst, sizeof(TypeParam), 1, 0)); + EXPECT_EQ(KLEIDICV_OK, saturating_absdiff()( + src, sizeof(TypeParam), src, sizeof(TypeParam), + dst, sizeof(TypeParam), 0, 1)); + EXPECT_EQ(KLEIDICV_OK, saturating_absdiff()( + src, sizeof(TypeParam), src, sizeof(TypeParam), + dst, sizeof(TypeParam), 1, 0)); } TYPED_TEST(SaturatingAbsDiff, OversizeImage) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, saturating_absdiff()( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS + 1, 1)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, saturating_absdiff()( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS)); + sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS)); } diff --git a/test/api/test_saturating_add.cpp b/test/api/test_saturating_add.cpp index 95053f0c2..74ef87a4b 100644 --- a/test/api/test_saturating_add.cpp +++ b/test/api/test_saturating_add.cpp @@ -10,17 +10,17 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_SATURATING_ADD(type, suffix) \ - INTRINSICCV_API(saturating_add, intrinsiccv_saturating_add_##suffix, type) - -INTRINSICCV_SATURATING_ADD(int8_t, s8); -INTRINSICCV_SATURATING_ADD(uint8_t, u8); -INTRINSICCV_SATURATING_ADD(int16_t, s16); -INTRINSICCV_SATURATING_ADD(uint16_t, u16); -INTRINSICCV_SATURATING_ADD(int32_t, s32); -INTRINSICCV_SATURATING_ADD(uint32_t, u32); -INTRINSICCV_SATURATING_ADD(int64_t, s64); -INTRINSICCV_SATURATING_ADD(uint64_t, u64); +#define KLEIDICV_SATURATING_ADD(type, suffix) \ + KLEIDICV_API(saturating_add, intrinsiccv_saturating_add_##suffix, type) + +KLEIDICV_SATURATING_ADD(int8_t, s8); +KLEIDICV_SATURATING_ADD(uint8_t, u8); +KLEIDICV_SATURATING_ADD(int16_t, s16); +KLEIDICV_SATURATING_ADD(uint16_t, u16); +KLEIDICV_SATURATING_ADD(int32_t, s32); +KLEIDICV_SATURATING_ADD(uint32_t, u32); +KLEIDICV_SATURATING_ADD(int64_t, s64); +KLEIDICV_SATURATING_ADD(uint64_t, u64); template class SaturatingAddTest final : public BinaryOperationTest { @@ -114,15 +114,15 @@ TYPED_TEST(SaturatingAdd, Misalignment) { return; } TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_add()(src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_add()(src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_add()(src, sizeof(TypeParam), src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1)); @@ -130,23 +130,23 @@ TYPED_TEST(SaturatingAdd, Misalignment) { TYPED_TEST(SaturatingAdd, ZeroImageSize) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_OK, saturating_add()( - src, sizeof(TypeParam), src, sizeof(TypeParam), - dst, sizeof(TypeParam), 0, 1)); - EXPECT_EQ(INTRINSICCV_OK, saturating_add()( - src, sizeof(TypeParam), src, sizeof(TypeParam), - dst, sizeof(TypeParam), 1, 0)); + EXPECT_EQ(KLEIDICV_OK, saturating_add()( + src, sizeof(TypeParam), src, sizeof(TypeParam), + dst, sizeof(TypeParam), 0, 1)); + EXPECT_EQ(KLEIDICV_OK, saturating_add()( + src, sizeof(TypeParam), src, sizeof(TypeParam), + dst, sizeof(TypeParam), 1, 0)); } TYPED_TEST(SaturatingAdd, OversizeImage) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, saturating_add()( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS + 1, 1)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, saturating_add()( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS)); + sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS)); } diff --git a/test/api/test_saturating_multiply.cpp b/test/api/test_saturating_multiply.cpp index 86d32a2b9..9e6eb40bf 100644 --- a/test/api/test_saturating_multiply.cpp +++ b/test/api/test_saturating_multiply.cpp @@ -10,15 +10,15 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_SATURATING_MULTIPLY(type, suffix) \ - INTRINSICCV_API(saturating_multiply, \ - intrinsiccv_saturating_multiply_##suffix, type) +#define KLEIDICV_SATURATING_MULTIPLY(type, suffix) \ + KLEIDICV_API(saturating_multiply, intrinsiccv_saturating_multiply_##suffix, \ + type) -INTRINSICCV_SATURATING_MULTIPLY(uint8_t, u8); -INTRINSICCV_SATURATING_MULTIPLY(int8_t, s8); -INTRINSICCV_SATURATING_MULTIPLY(uint16_t, u16); -INTRINSICCV_SATURATING_MULTIPLY(int16_t, s16); -INTRINSICCV_SATURATING_MULTIPLY(int32_t, s32); +KLEIDICV_SATURATING_MULTIPLY(uint8_t, u8); +KLEIDICV_SATURATING_MULTIPLY(int8_t, s8); +KLEIDICV_SATURATING_MULTIPLY(uint16_t, u16); +KLEIDICV_SATURATING_MULTIPLY(int16_t, s16); +KLEIDICV_SATURATING_MULTIPLY(int32_t, s32); template class SaturatingMultiplyTest final : public BinaryOperationTest { @@ -110,15 +110,15 @@ TYPED_TEST(SaturatingMultiply, Misalignment) { return; } TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_multiply()(src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_multiply()(src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_multiply()(src, sizeof(TypeParam), src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, 1)); @@ -126,23 +126,23 @@ TYPED_TEST(SaturatingMultiply, Misalignment) { TYPED_TEST(SaturatingMultiply, ZeroImageSize) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_OK, saturating_multiply()( - src, sizeof(TypeParam), src, sizeof(TypeParam), - dst, sizeof(TypeParam), 0, 1, 1)); - EXPECT_EQ(INTRINSICCV_OK, saturating_multiply()( - src, sizeof(TypeParam), src, sizeof(TypeParam), - dst, sizeof(TypeParam), 1, 0, 1)); + EXPECT_EQ(KLEIDICV_OK, saturating_multiply()( + src, sizeof(TypeParam), src, sizeof(TypeParam), + dst, sizeof(TypeParam), 0, 1, 1)); + EXPECT_EQ(KLEIDICV_OK, saturating_multiply()( + src, sizeof(TypeParam), src, sizeof(TypeParam), + dst, sizeof(TypeParam), 1, 0, 1)); } TYPED_TEST(SaturatingMultiply, OversizeImage) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, saturating_multiply()( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, 1)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, saturating_multiply()( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, 1)); + sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, 1)); } diff --git a/test/api/test_saturating_sub.cpp b/test/api/test_saturating_sub.cpp index b7b9957cc..0c8a55f36 100644 --- a/test/api/test_saturating_sub.cpp +++ b/test/api/test_saturating_sub.cpp @@ -10,17 +10,17 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_SATURATING_SUB(type, suffix) \ - INTRINSICCV_API(saturating_sub, intrinsiccv_saturating_sub_##suffix, type) - -INTRINSICCV_SATURATING_SUB(int8_t, s8); -INTRINSICCV_SATURATING_SUB(uint8_t, u8); -INTRINSICCV_SATURATING_SUB(int16_t, s16); -INTRINSICCV_SATURATING_SUB(uint16_t, u16); -INTRINSICCV_SATURATING_SUB(int32_t, s32); -INTRINSICCV_SATURATING_SUB(uint32_t, u32); -INTRINSICCV_SATURATING_SUB(int64_t, s64); -INTRINSICCV_SATURATING_SUB(uint64_t, u64); +#define KLEIDICV_SATURATING_SUB(type, suffix) \ + KLEIDICV_API(saturating_sub, intrinsiccv_saturating_sub_##suffix, type) + +KLEIDICV_SATURATING_SUB(int8_t, s8); +KLEIDICV_SATURATING_SUB(uint8_t, u8); +KLEIDICV_SATURATING_SUB(int16_t, s16); +KLEIDICV_SATURATING_SUB(uint16_t, u16); +KLEIDICV_SATURATING_SUB(int32_t, s32); +KLEIDICV_SATURATING_SUB(uint32_t, u32); +KLEIDICV_SATURATING_SUB(int64_t, s64); +KLEIDICV_SATURATING_SUB(uint64_t, u64); template class SaturatingSubTest final : public BinaryOperationTest { @@ -116,15 +116,15 @@ TYPED_TEST(SaturatingSub, Misalignment) { return; } TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_sub()(src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_sub()(src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_sub()(src, sizeof(TypeParam), src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1)); @@ -132,23 +132,23 @@ TYPED_TEST(SaturatingSub, Misalignment) { TYPED_TEST(SaturatingSub, ZeroImageSize) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_OK, saturating_sub()( - src, sizeof(TypeParam), src, sizeof(TypeParam), - dst, sizeof(TypeParam), 0, 1)); - EXPECT_EQ(INTRINSICCV_OK, saturating_sub()( - src, sizeof(TypeParam), src, sizeof(TypeParam), - dst, sizeof(TypeParam), 1, 0)); + EXPECT_EQ(KLEIDICV_OK, saturating_sub()( + src, sizeof(TypeParam), src, sizeof(TypeParam), + dst, sizeof(TypeParam), 0, 1)); + EXPECT_EQ(KLEIDICV_OK, saturating_sub()( + src, sizeof(TypeParam), src, sizeof(TypeParam), + dst, sizeof(TypeParam), 1, 0)); } TYPED_TEST(SaturatingSub, OversizeImage) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, saturating_sub()( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS + 1, 1)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, saturating_sub()( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam), INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS)); + sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS)); } diff --git a/test/api/test_scale.cpp b/test/api/test_scale.cpp index da6afd23f..21e7bb129 100644 --- a/test/api/test_scale.cpp +++ b/test/api/test_scale.cpp @@ -10,10 +10,10 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_SCALE(type, suffix) \ - INTRINSICCV_API(scale, intrinsiccv_scale_##suffix, type) +#define KLEIDICV_SCALE(type, suffix) \ + KLEIDICV_API(scale, intrinsiccv_scale_##suffix, type) -INTRINSICCV_SCALE(uint8_t, u8); +KLEIDICV_SCALE(uint8_t, u8); template class ScaleTestBase : public UnaryOperationTest { @@ -107,7 +107,7 @@ class ScaleTestLinearBase { calculate_expected(source, expected); ASSERT_EQ( - INTRINSICCV_OK, + KLEIDICV_OK, intrinsiccv_scale_u8(source.data(), source.stride(), actual.data(), actual.stride(), width, height, scale(), shift())); @@ -417,29 +417,29 @@ TYPED_TEST(ScaleTest, Misalignment) { return; } TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, scale()(src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1, 2, 0)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, scale()(src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, 2, 0)); } TYPED_TEST(ScaleTest, ZeroImageSize) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_OK, scale()(src, sizeof(TypeParam), dst, - sizeof(TypeParam), 0, 1, 2, 0)); - EXPECT_EQ(INTRINSICCV_OK, scale()(src, sizeof(TypeParam), dst, - sizeof(TypeParam), 1, 0, 2, 0)); + EXPECT_EQ(KLEIDICV_OK, scale()(src, sizeof(TypeParam), dst, + sizeof(TypeParam), 0, 1, 2, 0)); + EXPECT_EQ(KLEIDICV_OK, scale()(src, sizeof(TypeParam), dst, + sizeof(TypeParam), 1, 0, 2, 0)); } TYPED_TEST(ScaleTest, OversizeImage) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, scale()(src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, 2, 0)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, 2, 0)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, scale()(src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, 2, 0)); + KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, 2, 0)); } diff --git a/test/api/test_sobel.cpp b/test/api/test_sobel.cpp index 62b22171d..a61d05882 100644 --- a/test/api/test_sobel.cpp +++ b/test/api/test_sobel.cpp @@ -12,17 +12,17 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_SOBEL_3X3_HORIZONTAL(type, suffix) \ - INTRINSICCV_API(sobel_3x3_horizontal, \ - intrinsiccv_sobel_3x3_horizontal_##suffix, type) +#define KLEIDICV_SOBEL_3X3_HORIZONTAL(type, suffix) \ + KLEIDICV_API(sobel_3x3_horizontal, \ + intrinsiccv_sobel_3x3_horizontal_##suffix, type) -#define INTRINSICCV_SOBEL_3X3_VERTICAL(type, suffix) \ - INTRINSICCV_API(sobel_3x3_vertical, intrinsiccv_sobel_3x3_vertical_##suffix, \ - type) +#define KLEIDICV_SOBEL_3X3_VERTICAL(type, suffix) \ + KLEIDICV_API(sobel_3x3_vertical, intrinsiccv_sobel_3x3_vertical_##suffix, \ + type) -INTRINSICCV_SOBEL_3X3_HORIZONTAL(uint8_t, s16_u8); +KLEIDICV_SOBEL_3X3_HORIZONTAL(uint8_t, s16_u8); -INTRINSICCV_SOBEL_3X3_VERTICAL(uint8_t, s16_u8); +KLEIDICV_SOBEL_3X3_VERTICAL(uint8_t, s16_u8); // Implements KernelTestParams for Sobel operators. template @@ -38,7 +38,7 @@ struct SobelKernelTestParams { }; // end of struct SobelKernelTestParams static constexpr std::array kSupportedBorders = { - INTRINSICCV_BORDER_TYPE_REPLICATE, + KLEIDICV_BORDER_TYPE_REPLICATE, }; // Test for Sobel 3x3 operator. @@ -124,12 +124,12 @@ TYPED_TEST(Sobel, MisalignmentHorizontal) { typename KernelTestParams::InputType src[1] = {}; typename KernelTestParams::OutputType dst[1]; if (sizeof(typename KernelTestParams::InputType) != 1) { - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, sobel_3x3_horizontal()(src, sizeof(src) + 1, dst, sizeof(dst), 1, 1, 1)); } if (sizeof(typename KernelTestParams::OutputType) != 1) { - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, sobel_3x3_horizontal()(src, sizeof(src), dst, sizeof(dst) + 1, 1, 1, 1)); } @@ -140,12 +140,12 @@ TYPED_TEST(Sobel, MisalignmentVertical) { typename KernelTestParams::InputType src[1] = {}; typename KernelTestParams::OutputType dst[1]; if (sizeof(typename KernelTestParams::InputType) != 1) { - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, sobel_3x3_vertical()(src, sizeof(src) + 1, dst, sizeof(dst), 1, 1, 1)); } if (sizeof(typename KernelTestParams::OutputType) != 1) { - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, sobel_3x3_vertical()(src, sizeof(src), dst, sizeof(dst) + 1, 1, 1, 1)); } @@ -156,10 +156,10 @@ TYPED_TEST(Sobel, ZeroImageSizeHorizontal) { typename KernelTestParams::InputType src[1] = {}; typename KernelTestParams::OutputType dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, sobel_3x3_horizontal()(src, sizeof(src), dst, sizeof(dst), 0, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, sobel_3x3_horizontal()(src, sizeof(src), dst, sizeof(dst), 1, 0, 1)); } @@ -169,10 +169,10 @@ TYPED_TEST(Sobel, ZeroImageSizeVertical) { typename KernelTestParams::InputType src[1] = {}; typename KernelTestParams::OutputType dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, sobel_3x3_vertical()(src, sizeof(src), dst, sizeof(dst), 0, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, sobel_3x3_vertical()(src, sizeof(src), dst, sizeof(dst), 1, 0, 1)); } @@ -188,12 +188,12 @@ TYPED_TEST(Sobel, ValidImageSize) { test::Array2D dst{ validSize, validSize, test::Options::vector_length()}; - EXPECT_EQ(INTRINSICCV_OK, sobel_3x3_horizontal()( - src.data(), src.stride(), dst.data(), - dst.stride(), validSize, validSize, 1)); - EXPECT_EQ(INTRINSICCV_OK, sobel_3x3_vertical()( - src.data(), src.stride(), dst.data(), - dst.stride(), validSize, validSize, 1)); + EXPECT_EQ(KLEIDICV_OK, sobel_3x3_horizontal()( + src.data(), src.stride(), dst.data(), dst.stride(), + validSize, validSize, 1)); + EXPECT_EQ(KLEIDICV_OK, sobel_3x3_vertical()( + src.data(), src.stride(), dst.data(), dst.stride(), + validSize, validSize, 1)); } TYPED_TEST(Sobel, UndersizeImage) { @@ -204,27 +204,27 @@ TYPED_TEST(Sobel, UndersizeImage) { size_t validWidth = 13; size_t validHeight = 8; - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, sobel_3x3_horizontal()( src, sizeof(src), dst, sizeof(dst), underSize, underSize, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, sobel_3x3_vertical()(src, sizeof(src), dst, sizeof(dst), underSize, underSize, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, sobel_3x3_horizontal()( src, sizeof(src), dst, sizeof(dst), underSize, validHeight, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, sobel_3x3_vertical()(src, sizeof(src), dst, sizeof(dst), underSize, validHeight, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, sobel_3x3_horizontal()( src, sizeof(src), dst, sizeof(dst), validWidth, underSize, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, sobel_3x3_vertical()(src, sizeof(src), dst, sizeof(dst), validWidth, underSize, 1)); } -#ifdef INTRINSICCV_ALLOCATION_TESTS +#ifdef KLEIDICV_ALLOCATION_TESTS TYPED_TEST(Sobel, CannotAllocateImageHorizontal) { MockMallocToFail::enable(); using KernelTestParams = SobelKernelTestParams; @@ -233,16 +233,16 @@ TYPED_TEST(Sobel, CannotAllocateImageHorizontal) { size_t validSize = 2; EXPECT_EQ( - INTRINSICCV_ERROR_ALLOCATION, + KLEIDICV_ERROR_ALLOCATION, sobel_3x3_horizontal()( - src, sizeof(src), dst, sizeof(dst), INTRINSICCV_MAX_IMAGE_PIXELS / 2, - validSize, INTRINSICCV_MAXIMUM_CHANNEL_COUNT)); + src, sizeof(src), dst, sizeof(dst), KLEIDICV_MAX_IMAGE_PIXELS / 2, + validSize, KLEIDICV_MAXIMUM_CHANNEL_COUNT)); - EXPECT_EQ(INTRINSICCV_ERROR_ALLOCATION, - sobel_3x3_vertical()(src, sizeof(src), dst, sizeof(dst), - INTRINSICCV_MAX_IMAGE_PIXELS / 2, - validSize, - INTRINSICCV_MAXIMUM_CHANNEL_COUNT)); + EXPECT_EQ( + KLEIDICV_ERROR_ALLOCATION, + sobel_3x3_vertical()(src, sizeof(src), dst, sizeof(dst), + KLEIDICV_MAX_IMAGE_PIXELS / 2, validSize, + KLEIDICV_MAXIMUM_CHANNEL_COUNT)); MockMallocToFail::disable(); } #endif @@ -252,14 +252,13 @@ TYPED_TEST(Sobel, OversizeImageHorizontal) { typename KernelTestParams::InputType src[1] = {}; typename KernelTestParams::OutputType dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, sobel_3x3_horizontal()( + src, sizeof(src), dst, sizeof(dst), + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, 1)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, sobel_3x3_horizontal()( - src, sizeof(src), dst, sizeof(dst), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, - sobel_3x3_horizontal()( - src, sizeof(src), dst, sizeof(dst), - INTRINSICCV_MAX_IMAGE_PIXELS, INTRINSICCV_MAX_IMAGE_PIXELS, 1)); + src, sizeof(src), dst, sizeof(dst), KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, 1)); } TYPED_TEST(Sobel, OversizeImageVertical) { @@ -267,14 +266,13 @@ TYPED_TEST(Sobel, OversizeImageVertical) { typename KernelTestParams::InputType src[1] = {}; typename KernelTestParams::OutputType dst[1]; - EXPECT_EQ( - INTRINSICCV_ERROR_RANGE, - sobel_3x3_vertical()(src, sizeof(src), dst, sizeof(dst), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, sobel_3x3_vertical()( + src, sizeof(src), dst, sizeof(dst), + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, 1)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, sobel_3x3_vertical()(src, sizeof(src), dst, sizeof(dst), - INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, 1)); + KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, 1)); } TYPED_TEST(Sobel, ChannelNumber) { @@ -283,12 +281,12 @@ TYPED_TEST(Sobel, ChannelNumber) { typename KernelTestParams::OutputType dst[1]; size_t validSize = 2; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, sobel_3x3_horizontal()( src, sizeof(src), dst, sizeof(dst), validSize, validSize, - INTRINSICCV_MAXIMUM_CHANNEL_COUNT + 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + KLEIDICV_MAXIMUM_CHANNEL_COUNT + 1)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, sobel_3x3_vertical()( src, sizeof(src), dst, sizeof(dst), validSize, validSize, - INTRINSICCV_MAXIMUM_CHANNEL_COUNT + 1)); + KLEIDICV_MAXIMUM_CHANNEL_COUNT + 1)); } diff --git a/test/api/test_split.cpp b/test/api/test_split.cpp index 374775f21..07a080765 100644 --- a/test/api/test_split.cpp +++ b/test/api/test_split.cpp @@ -88,7 +88,7 @@ class SplitTest final { for (size_t i = 0; i < Channels; ++i) { strides[i] = actual_outputs[i].stride(); } - ASSERT_EQ(INTRINSICCV_OK, + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_split(input.data(), input.stride(), actual_raw_pointers, strides, output_width, height, Channels, sizeof(ElementType))); @@ -110,7 +110,7 @@ class SplitTest final { template static void test_not_implemented( - intrinsiccv_error_t expected = INTRINSICCV_ERROR_NOT_IMPLEMENTED) { + intrinsiccv_error_t expected = KLEIDICV_ERROR_NOT_IMPLEMENTED) { const size_t width = 1, height = 1; ElementType src_data[kChannels * width * height] = {234}; @@ -196,7 +196,7 @@ TYPED_TEST(Split, FourChannels) { } TYPED_TEST(Split, OneChannelOutOfRange) { - test_not_implemented(INTRINSICCV_ERROR_RANGE); + test_not_implemented(KLEIDICV_ERROR_RANGE); } TYPED_TEST(Split, FiveChannelsNotImplemented) { @@ -224,7 +224,7 @@ TYPED_TEST(Split, NullPointer) { for (int i = 0; i < channels; ++i) { dst_data[i] = (i == null_src) ? nullptr : dst_arrays + i; } - EXPECT_EQ(INTRINSICCV_ERROR_NULL_POINTER, + EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, intrinsiccv_split(src_data, src_stride, dst_data, dst_strides, 1, 1, channels, sizeof(TypeParam))); } @@ -257,7 +257,7 @@ TYPED_TEST(Split, Misalignment) { auto check_split = [&](int channels, void* src_maybe_misaligned, size_t src_stride_maybe_misaligned) { EXPECT_EQ( - INTRINSICCV_ERROR_ALIGNMENT, + KLEIDICV_ERROR_ALIGNMENT, intrinsiccv_split(src_maybe_misaligned, src_stride_maybe_misaligned, reinterpret_cast(dst_data), dst_strides, 1, 1, channels, sizeof(TypeParam))); @@ -294,12 +294,10 @@ TYPED_TEST(Split, ZeroImageSize) { void* dsts[kChannels] = {dst1, dst2}; size_t dst_strides[kChannels] = {sizeof(TypeParam), sizeof(TypeParam)}; - EXPECT_EQ(INTRINSICCV_OK, - intrinsiccv_split(src, src_stride, dsts, dst_strides, 0, 1, - kChannels, sizeof(TypeParam))); - EXPECT_EQ(INTRINSICCV_OK, - intrinsiccv_split(src, src_stride, dsts, dst_strides, 1, 0, - kChannels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_split(src, src_stride, dsts, dst_strides, + 0, 1, kChannels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_split(src, src_stride, dsts, dst_strides, + 1, 0, kChannels, sizeof(TypeParam))); } TYPED_TEST(Split, OversizeImage) { @@ -309,13 +307,12 @@ TYPED_TEST(Split, OversizeImage) { void* dsts[kChannels] = {dst1, dst2}; size_t dst_strides[kChannels] = {sizeof(TypeParam), sizeof(TypeParam)}; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_split(src, src_stride, dsts, dst_strides, - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, kChannels, - sizeof(TypeParam))); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, - intrinsiccv_split(src, src_stride, dsts, dst_strides, - INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, kChannels, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, kChannels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, + intrinsiccv_split( + src, src_stride, dsts, dst_strides, KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, kChannels, sizeof(TypeParam))); } diff --git a/test/api/test_threshold_binary.cpp b/test/api/test_threshold_binary.cpp index e790dda05..fd3aad9bf 100644 --- a/test/api/test_threshold_binary.cpp +++ b/test/api/test_threshold_binary.cpp @@ -8,10 +8,10 @@ #include "intrinsiccv/intrinsiccv.h" #include "test_config.h" -#define INTRINSICCV_THRESHOLD_BINARY(type, suffix) \ - INTRINSICCV_API(threshold_binary, intrinsiccv_threshold_binary_##suffix, type) +#define KLEIDICV_THRESHOLD_BINARY(type, suffix) \ + KLEIDICV_API(threshold_binary, intrinsiccv_threshold_binary_##suffix, type) -INTRINSICCV_THRESHOLD_BINARY(uint8_t, u8); +KLEIDICV_THRESHOLD_BINARY(uint8_t, u8); template class ThresholdBinaryTestBase : public UnaryOperationTest { @@ -147,33 +147,32 @@ TYPED_TEST(ThresholdBinary, Misalignment) { return; } TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, threshold_binary()(src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, threshold_binary()(src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, 1, 1)); } TYPED_TEST(ThresholdBinary, ZeroImageSize) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, threshold_binary()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 0, 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, threshold_binary()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 0, 1, 1)); } TYPED_TEST(ThresholdBinary, OversizeImage) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, threshold_binary()( src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, 1, 1)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, - threshold_binary()(src, sizeof(TypeParam), dst, - sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, 1, 1)); + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, 1, 1)); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, + threshold_binary()( + src, sizeof(TypeParam), dst, sizeof(TypeParam), + KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, 1, 1)); } diff --git a/test/api/test_transpose.cpp b/test/api/test_transpose.cpp index 2ae3d88b6..1f52d9001 100644 --- a/test/api/test_transpose.cpp +++ b/test/api/test_transpose.cpp @@ -70,10 +70,10 @@ class TestTranspose final { calculate_expected(source, expected); - ASSERT_EQ(INTRINSICCV_OK, intrinsiccv_transpose( - source.data(), source.stride(), - p_actual->data(), p_actual->stride(), - src_width, src_height, sizeof(ElementType))); + ASSERT_EQ(KLEIDICV_OK, intrinsiccv_transpose( + source.data(), source.stride(), p_actual->data(), + p_actual->stride(), src_width, src_height, + sizeof(ElementType))); EXPECT_EQ_ARRAY2D(expected, *p_actual); } @@ -102,7 +102,7 @@ class TestNotImplemented { ElementType source[width * height] = {0xFF}; - ASSERT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + ASSERT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, intrinsiccv_transpose(source, stride, source, stride, width, height, sizeof(ElementType))); } @@ -114,7 +114,7 @@ class TestNotImplemented { WrongType source[width * height] = {0xFF}; - ASSERT_EQ(INTRINSICCV_ERROR_NOT_IMPLEMENTED, + ASSERT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, intrinsiccv_transpose(source, stride, source, stride, width, height, sizeof(WrongType))); } @@ -209,40 +209,40 @@ TYPED_TEST(Transpose, Misalignment) { const size_t kBufSize = sizeof(TypeParam) * 10; char src[kBufSize] = {}, dst[kBufSize] = {}; - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, intrinsiccv_transpose(src + 1, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, sizeof(TypeParam))); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, intrinsiccv_transpose(src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1, sizeof(TypeParam))); - EXPECT_EQ(INTRINSICCV_ERROR_ALIGNMENT, + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, intrinsiccv_transpose(src, sizeof(TypeParam), dst + 1, sizeof(TypeParam), 1, 1, sizeof(TypeParam))); EXPECT_EQ( - INTRINSICCV_ERROR_ALIGNMENT, + KLEIDICV_ERROR_ALIGNMENT, intrinsiccv_transpose(src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, sizeof(TypeParam))); } TYPED_TEST(Transpose, ZeroImageSize) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_transpose(src, sizeof(TypeParam), dst, sizeof(TypeParam), 0, 1, sizeof(TypeParam))); - EXPECT_EQ(INTRINSICCV_OK, + EXPECT_EQ(KLEIDICV_OK, intrinsiccv_transpose(src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 0, sizeof(TypeParam))); } TYPED_TEST(Transpose, OversizeImage) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_transpose( src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, sizeof(TypeParam))); + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, sizeof(TypeParam))); EXPECT_EQ( - INTRINSICCV_ERROR_RANGE, + KLEIDICV_ERROR_RANGE, intrinsiccv_transpose(src, sizeof(TypeParam), dst, sizeof(TypeParam), - INTRINSICCV_MAX_IMAGE_PIXELS, - INTRINSICCV_MAX_IMAGE_PIXELS, sizeof(TypeParam))); + KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, sizeof(TypeParam))); } diff --git a/test/api/test_yuv_to_rgb.cpp b/test/api/test_yuv_to_rgb.cpp index 5e7bae892..26d69b343 100644 --- a/test/api/test_yuv_to_rgb.cpp +++ b/test/api/test_yuv_to_rgb.cpp @@ -46,7 +46,7 @@ class YuvTest final { // the width of the UV input must be even test::Array2D input_uv{ - INTRINSICCV_TARGET_NAMESPACE::align_up(logical_width, 2), 3, padding}; + KLEIDICV_TARGET_NAMESPACE::align_up(logical_width, 2), 3, padding}; input_uv.fill(0); input_uv.set(0, 0, {100, 130, 255, 255}); input_uv.set(1, 0, {0, 1, 3, 4}); @@ -65,7 +65,7 @@ class YuvTest final { input_uv.stride(), actual.data(), actual.stride(), expected.width() / channel_number_, expected.height(), is_nv21); - ASSERT_EQ(INTRINSICCV_OK, err); + ASSERT_EQ(KLEIDICV_OK, err); EXPECT_EQ_ARRAY2D(expected, actual); test::test_null_args(impl, input_y.data(), input_y.stride(), @@ -73,24 +73,22 @@ class YuvTest final { actual.stride(), expected.width() / channel_number_, expected.height(), is_nv21); - EXPECT_EQ( - INTRINSICCV_OK, - impl(input_y.data(), input_y.stride(), input_uv.data(), - input_uv.stride(), actual.data(), actual.stride(), 0, 1, is_nv21)); - EXPECT_EQ( - INTRINSICCV_OK, - impl(input_y.data(), input_y.stride(), input_uv.data(), - input_uv.stride(), actual.data(), actual.stride(), 1, 0, is_nv21)); + EXPECT_EQ(KLEIDICV_OK, impl(input_y.data(), input_y.stride(), + input_uv.data(), input_uv.stride(), + actual.data(), actual.stride(), 0, 1, is_nv21)); + EXPECT_EQ(KLEIDICV_OK, impl(input_y.data(), input_y.stride(), + input_uv.data(), input_uv.stride(), + actual.data(), actual.stride(), 1, 0, is_nv21)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, + EXPECT_EQ(KLEIDICV_ERROR_RANGE, impl(input_y.data(), input_y.stride(), input_uv.data(), input_uv.stride(), actual.data(), actual.stride(), - INTRINSICCV_MAX_IMAGE_PIXELS + 1, 1, is_nv21)); - EXPECT_EQ(INTRINSICCV_ERROR_RANGE, - impl(input_y.data(), input_y.stride(), input_uv.data(), - input_uv.stride(), actual.data(), actual.stride(), - INTRINSICCV_MAX_IMAGE_PIXELS, INTRINSICCV_MAX_IMAGE_PIXELS, - is_nv21)); + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, is_nv21)); + EXPECT_EQ( + KLEIDICV_ERROR_RANGE, + impl(input_y.data(), input_y.stride(), input_uv.data(), + input_uv.stride(), actual.data(), actual.stride(), + KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, is_nv21)); } void calculate_expected(test::Array2D &y_arr, diff --git a/test/framework/CMakeLists.txt b/test/framework/CMakeLists.txt index f8da3531a..12b8caf65 100644 --- a/test/framework/CMakeLists.txt +++ b/test/framework/CMakeLists.txt @@ -4,11 +4,11 @@ file(GLOB intrinsiccv_framework_test_sources CONFIGURE_DEPENDS "*.h" "test_*.cpp") -list(APPEND intrinsiccv_framework_test_sources ${INTRINSICCV_TEST_FRAMEWORK_SOURCES}) +list(APPEND intrinsiccv_framework_test_sources ${KLEIDICV_TEST_FRAMEWORK_SOURCES}) set_source_files_properties( ${intrinsiccv_framework_test_sources} - PROPERTIES COMPILE_OPTIONS "${INTRINSICCV_TEST_CXX_FLAGS}" + PROPERTIES COMPILE_OPTIONS "${KLEIDICV_TEST_CXX_FLAGS}" ) add_executable( @@ -23,11 +23,11 @@ set_target_properties( target_include_directories( intrinsiccv-framework-test - PRIVATE ${INTRINSICCV_INCLUDE_DIR} - PRIVATE ${INTRINSICCV_TEST_INCLUDE_DIR} + PRIVATE ${KLEIDICV_INCLUDE_DIR} + PRIVATE ${KLEIDICV_TEST_INCLUDE_DIR} ) -if (INTRINSICCV_ALLOCATION_TESTS) +if (KLEIDICV_ALLOCATION_TESTS) target_link_options( intrinsiccv-framework-test PRIVATE -Wl,--wrap,malloc diff --git a/test/framework/abstract.h b/test/framework/abstract.h index 59906c6e6..aa2ff7bcb 100644 --- a/test/framework/abstract.h +++ b/test/framework/abstract.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_TEST_FRAMEWORK_ABSTRACT_H_ -#define INTRINSICCV_TEST_FRAMEWORK_ABSTRACT_H_ +#ifndef KLEIDICV_TEST_FRAMEWORK_ABSTRACT_H_ +#define KLEIDICV_TEST_FRAMEWORK_ABSTRACT_H_ #include #include @@ -67,4 +67,4 @@ class Generator { } // namespace test -#endif // INTRINSICCV_TEST_FRAMEWORK_ABSTRACT_H_ +#endif // KLEIDICV_TEST_FRAMEWORK_ABSTRACT_H_ diff --git a/test/framework/array.h b/test/framework/array.h index 7f010cac6..f166432d3 100644 --- a/test/framework/array.h +++ b/test/framework/array.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_TEST_FRAMEWORK_ARRAY_H_ -#define INTRINSICCV_TEST_FRAMEWORK_ARRAY_H_ +#ifndef KLEIDICV_TEST_FRAMEWORK_ARRAY_H_ +#define KLEIDICV_TEST_FRAMEWORK_ARRAY_H_ #include @@ -382,4 +382,4 @@ class Array2D : public TwoDimensional { } // namespace test -#endif // INTRINSICCV_TEST_FRAMEWORK_ARRAY_H_ +#endif // KLEIDICV_TEST_FRAMEWORK_ARRAY_H_ diff --git a/test/framework/border.cpp b/test/framework/border.cpp index cb88e2ad8..2e46666bb 100644 --- a/test/framework/border.cpp +++ b/test/framework/border.cpp @@ -291,19 +291,19 @@ void prepare_borders(intrinsiccv_border_type_t border_type, default: GTEST_FAIL() << "Border type is not implemented."; - case INTRINSICCV_BORDER_TYPE_REPLICATE: + case KLEIDICV_BORDER_TYPE_REPLICATE: return replicate(bordered, elements); - case INTRINSICCV_BORDER_TYPE_CONSTANT: + case KLEIDICV_BORDER_TYPE_CONSTANT: return constant(bordered, border_values, elements); - case INTRINSICCV_BORDER_TYPE_REFLECT: + case KLEIDICV_BORDER_TYPE_REFLECT: return reflect(bordered, elements); - case INTRINSICCV_BORDER_TYPE_WRAP: + case KLEIDICV_BORDER_TYPE_WRAP: return wrap(bordered, elements); - case INTRINSICCV_BORDER_TYPE_REVERSE: + case KLEIDICV_BORDER_TYPE_REVERSE: return reverse(bordered, elements); } } diff --git a/test/framework/border.h b/test/framework/border.h index f8f1e71f7..e17f28ca9 100644 --- a/test/framework/border.h +++ b/test/framework/border.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_TEST_FRAMEWORK_BORDER_H_ -#define INTRINSICCV_TEST_FRAMEWORK_BORDER_H_ +#ifndef KLEIDICV_TEST_FRAMEWORK_BORDER_H_ +#define KLEIDICV_TEST_FRAMEWORK_BORDER_H_ #include "framework/abstract.h" #include "intrinsiccv/intrinsiccv.h" @@ -19,4 +19,4 @@ void prepare_borders(intrinsiccv_border_type_t border_type, } // namespace test -#endif // INTRINSICCV_TEST_FRAMEWORK_BORDER_H_ +#endif // KLEIDICV_TEST_FRAMEWORK_BORDER_H_ diff --git a/test/framework/generator.h b/test/framework/generator.h index c8321ad78..ced45aaae 100644 --- a/test/framework/generator.h +++ b/test/framework/generator.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_TEST_FRAMEWORK_GENERATOR_H_ -#define INTRINSICCV_TEST_FRAMEWORK_GENERATOR_H_ +#ifndef KLEIDICV_TEST_FRAMEWORK_GENERATOR_H_ +#define KLEIDICV_TEST_FRAMEWORK_GENERATOR_H_ #include @@ -72,4 +72,4 @@ class SequenceGenerator : public Generator { } // namespace test -#endif // INTRINSICCV_TEST_FRAMEWORK_GENERATOR_H_ +#endif // KLEIDICV_TEST_FRAMEWORK_GENERATOR_H_ diff --git a/test/framework/kernel.h b/test/framework/kernel.h index 54917a141..31986ce43 100644 --- a/test/framework/kernel.h +++ b/test/framework/kernel.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_TEST_FRAMEWORK_KERNEL_H_ -#define INTRINSICCV_TEST_FRAMEWORK_KERNEL_H_ +#ifndef KLEIDICV_TEST_FRAMEWORK_KERNEL_H_ +#define KLEIDICV_TEST_FRAMEWORK_KERNEL_H_ #include @@ -268,7 +268,7 @@ class KernelTest { dump(&actual_); } - EXPECT_EQ(INTRINSICCV_OK, err); + EXPECT_EQ(KLEIDICV_OK, err); // Check that the actual result matches the expectation. EXPECT_EQ_ARRAY2D(expected_, actual_); @@ -288,4 +288,4 @@ class KernelTest { } // namespace test -#endif // INTRINSICCV_TEST_FRAMEWORK_KERNEL_H_ +#endif // KLEIDICV_TEST_FRAMEWORK_KERNEL_H_ diff --git a/test/framework/operation.h b/test/framework/operation.h index 7bc5c58e1..edf9fcbf3 100644 --- a/test/framework/operation.h +++ b/test/framework/operation.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_TEST_FRAMEWORK_OPERATION_H_ -#define INTRINSICCV_TEST_FRAMEWORK_OPERATION_H_ +#ifndef KLEIDICV_TEST_FRAMEWORK_OPERATION_H_ +#define KLEIDICV_TEST_FRAMEWORK_OPERATION_H_ #include #include @@ -125,7 +125,7 @@ class OperationTest { // Checks that the result meets the expectations. virtual void check(intrinsiccv_error_t err) { - EXPECT_EQ(INTRINSICCV_OK, err); + EXPECT_EQ(KLEIDICV_OK, err); for (size_t index = 0; index < expected_.size(); ++index) { EXPECT_EQ_ARRAY2D(expected_[index], actual_[index]); } @@ -169,4 +169,4 @@ template class UnaryOperationTest : public OperationTest { }; // end of class UnaryOperationTest -#endif // INTRINSICCV_TEST_FRAMEWORK_OPERATION_H_ +#endif // KLEIDICV_TEST_FRAMEWORK_OPERATION_H_ diff --git a/test/framework/test_border.cpp b/test/framework/test_border.cpp index 3a627d99d..c36431e94 100644 --- a/test/framework/test_border.cpp +++ b/test/framework/test_border.cpp @@ -48,7 +48,7 @@ TEST(Border, Replicate_1Ch_1Element) { expected.set(4, 0, {9, 9, 0, 1, 2, 2}); ImplementsBorder bordered{1, 1, 1, 1}; - test::prepare_borders(INTRINSICCV_BORDER_TYPE_REPLICATE, + test::prepare_borders(KLEIDICV_BORDER_TYPE_REPLICATE, {0, 0, 0, 0}, &bordered, &actual); EXPECT_EQ_ARRAY2D(expected, actual); } @@ -77,7 +77,7 @@ TEST(Border, Replicate_1Ch_2Elements) { expected.set(5, 0, {3, 3, 3, 4, 4, 4}); ImplementsBorder bordered{2, 2, 2, 2}; - test::prepare_borders(INTRINSICCV_BORDER_TYPE_REPLICATE, + test::prepare_borders(KLEIDICV_BORDER_TYPE_REPLICATE, {0, 0, 0, 0}, &bordered, &actual); EXPECT_EQ_ARRAY2D(expected, actual); } @@ -104,7 +104,7 @@ TEST(Border, Replicate_2Ch_1Element) { expected.set(4, 0, {9, 1, 9, 1, 2, 3, 2, 3}); ImplementsBorder bordered{1, 1, 1, 1}; - test::prepare_borders(INTRINSICCV_BORDER_TYPE_REPLICATE, + test::prepare_borders(KLEIDICV_BORDER_TYPE_REPLICATE, {0, 0, 0, 0}, &bordered, &actual); EXPECT_EQ_ARRAY2D(expected, actual); } @@ -133,7 +133,7 @@ TEST(Border, Replicate_2Ch_2Elements) { expected.set(5, 0, {5, 6, 5, 6, 5, 6, 7, 8, 7, 8, 7, 8}); ImplementsBorder bordered{2, 2, 2, 2}; - test::prepare_borders(INTRINSICCV_BORDER_TYPE_REPLICATE, + test::prepare_borders(KLEIDICV_BORDER_TYPE_REPLICATE, {0, 0, 0, 0}, &bordered, &actual); EXPECT_EQ_ARRAY2D(expected, actual); } diff --git a/test/framework/test_kernel.cpp b/test/framework/test_kernel.cpp index c8f6a8127..781a47ff7 100644 --- a/test/framework/test_kernel.cpp +++ b/test/framework/test_kernel.cpp @@ -137,7 +137,7 @@ class ExampleKernelTest : public test::KernelTest { // Fake some result. output->fill(OutputType{0}); - return INTRINSICCV_OK; + return KLEIDICV_OK; } public: @@ -150,7 +150,7 @@ class ExampleKernelTest : public test::KernelTest { }}; static constexpr std::array kBorders = { - INTRINSICCV_BORDER_TYPE_REPLICATE, INTRINSICCV_BORDER_TYPE_CONSTANT}; + KLEIDICV_BORDER_TYPE_REPLICATE, KLEIDICV_BORDER_TYPE_CONSTANT}; static constexpr std::array kBorderValues = { {{0, 0, 0, 0}, {1, 2, 3, 4}}}; diff --git a/test/framework/types.h b/test/framework/types.h index a192b7285..1720324d2 100644 --- a/test/framework/types.h +++ b/test/framework/types.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_TEST_FRAMEWORK_TYPES_H_ -#define INTRINSICCV_TEST_FRAMEWORK_TYPES_H_ +#ifndef KLEIDICV_TEST_FRAMEWORK_TYPES_H_ +#define KLEIDICV_TEST_FRAMEWORK_TYPES_H_ #include @@ -26,4 +26,4 @@ struct ArrayLayout { } // namespace test -#endif // INTRINSICCV_TEST_FRAMEWORK_TYPES_H_ +#endif // KLEIDICV_TEST_FRAMEWORK_TYPES_H_ diff --git a/test/framework/utils.h b/test/framework/utils.h index 83943d0d0..1d1582501 100644 --- a/test/framework/utils.h +++ b/test/framework/utils.h @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_TEST_FRAMEWORK_UTILS_H_ -#define INTRINSICCV_TEST_FRAMEWORK_UTILS_H_ +#ifndef KLEIDICV_TEST_FRAMEWORK_UTILS_H_ +#define KLEIDICV_TEST_FRAMEWORK_UTILS_H_ #include #include @@ -17,14 +17,14 @@ #include "framework/types.h" #include "intrinsiccv/ctypes.h" -#define INTRINSICCV_API(name, impl, type) \ +#define KLEIDICV_API(name, impl, type) \ template , bool> = true> \ static decltype(auto) name() { \ return impl; \ } -#define INTRINSICCV_DIFF_IO_API(name, impl, itype, otype) \ +#define KLEIDICV_DIFF_IO_API(name, impl, itype, otype) \ template , bool> = true, \ std::enable_if_t, bool> = true> \ @@ -119,7 +119,7 @@ class NullPointerTester { static typename std::enable_if>::type test_with_null_arg(Function f, Tuple t) { std::get(t) = nullptr; - EXPECT_EQ(INTRINSICCV_ERROR_NULL_POINTER, std::apply(f, t)); + EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, std::apply(f, t)); } // Skip arguments that aren't pointers. @@ -148,7 +148,7 @@ class ParamsExtractor { }; } // namespace internal -// Tests that the function returns INTRINSICCV_ERROR_NULL_POINTER if any of its +// Tests that the function returns KLEIDICV_ERROR_NULL_POINTER if any of its // pointer arguments are null. template void test_null_args(Function f, Args... args) { @@ -162,4 +162,4 @@ void test_null_args(Function f, Args... args) { } // namespace test -#endif // INTRINSICCV_TEST_FRAMEWORK_UTILS_H_ +#endif // KLEIDICV_TEST_FRAMEWORK_UTILS_H_ diff --git a/test/test_config.h.in b/test/test_config.h.in index 6cc98c850..05f30aad8 100644 --- a/test/test_config.h.in +++ b/test/test_config.h.in @@ -2,22 +2,22 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef INTRINSICCV_TEST_CONFIG_H -#define INTRINSICCV_TEST_CONFIG_H +#ifndef KLEIDICV_TEST_CONFIG_H +#define KLEIDICV_TEST_CONFIG_H // Main test configuration switches. -#cmakedefine INTRINSICCV_ALLOCATION_TESTS +#cmakedefine KLEIDICV_ALLOCATION_TESTS // GCC and clang #ifdef __GNUC__ -#define INTRINSICCV_NO_STRICT_ALIASING_BEGIN \ - _Pragma("GCC diagnostic push") \ +#define KLEIDICV_NO_STRICT_ALIASING_BEGIN \ + _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wstrict-aliasing\"") -#define INTRINSICCV_NO_STRICT_ALIASING_END _Pragma("GCC diagnostic pop") +#define KLEIDICV_NO_STRICT_ALIASING_END _Pragma("GCC diagnostic pop") #else -#define INTRINSICCV_NO_STRICT_ALIASING_BEGIN -#define INTRINSICCV_NO_STRICT_ALIASING_END +#define KLEIDICV_NO_STRICT_ALIASING_BEGIN +#define KLEIDICV_NO_STRICT_ALIASING_END #endif -#endif // INTRINSICCV_TEST_CONFIG_H +#endif // KLEIDICV_TEST_CONFIG_H -- GitLab From 2832ab33c36aa391eec9319f9d00549a71b0dabd Mon Sep 17 00:00:00 2001 From: Denes Tarjan Date: Fri, 12 Apr 2024 10:11:39 +0000 Subject: [PATCH 2/3] Rename: IntrinsicCV -> KleidiCV --- .vscode/launch.json | 10 +++++----- .vscode/tasks.json | 14 +++++++------- CMakeLists.txt | 2 +- Doxyfile | 2 +- README.md | 4 ++-- adapters/opencv/CMakeLists.txt | 2 +- adapters/opencv/intrinsiccv_hal.cpp | 4 ++-- adapters/opencv/opencv-4.9.patch | 8 ++++---- adapters/opencv/opencv-5.x.patch | 8 ++++---- benchmark/CMakeLists.txt | 2 +- benchmark/main.cpp | 2 +- conformity/opencv/README.md | 6 +++--- intrinsiccv/CMakeLists.txt | 8 ++++---- intrinsiccv/include/intrinsiccv/ctypes.h | 4 ++-- intrinsiccv/include/intrinsiccv/intrinsiccv.h | 6 +++--- scripts/build.sh | 2 +- scripts/ci.sh | 2 +- scripts/generate_coverage_report.py | 2 +- test/api/test_saturating_multiply.cpp | 2 +- 19 files changed, 45 insertions(+), 45 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 6375be780..b1be9401f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,7 +13,7 @@ "debugServerPath" : "${workspaceFolder}/.devcontainer/start_qemu.sh", "debugServerArgs": "-g 2345 ${workspaceFolder}/build/intrinsiccv/test/framework/intrinsiccv-framework-test --gtest_filter=*", "cwd": "${workspaceFolder}", - "preLaunchTask": "Build IntrinsicCV for debug", + "preLaunchTask": "Build KleidiCV for debug", }, { "name": "NEON API tests", @@ -27,7 +27,7 @@ "debugServerPath" : "${workspaceFolder}/.devcontainer/start_qemu.sh", "debugServerArgs": "-g 2345 -cpu cortex-a53 ${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test --vector-length=16 --gtest_filter=*", "cwd": "${workspaceFolder}", - "preLaunchTask": "Build IntrinsicCV for debug", + "preLaunchTask": "Build KleidiCV for debug", }, { "name": "SVE2 API tests, 128 bits", @@ -41,7 +41,7 @@ "debugServerPath" : "${workspaceFolder}/.devcontainer/start_qemu.sh", "debugServerArgs": "-g 2345 -cpu max,sve128=on,sme=off ${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test --vector-length=16 --gtest_filter=*", "cwd": "${workspaceFolder}", - "preLaunchTask": "Build IntrinsicCV for debug", + "preLaunchTask": "Build KleidiCV for debug", }, { "name": "SVE2 API tests, 2048 bits", @@ -55,7 +55,7 @@ "debugServerPath" : "${workspaceFolder}/.devcontainer/start_qemu.sh", "debugServerArgs": "-g 2345 -cpu max,sve2048=on,sve-default-vector-length=256,sme=off ${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test --vector-length=256 --gtest_filter=*", "cwd": "${workspaceFolder}", - "preLaunchTask": "Build IntrinsicCV for debug", + "preLaunchTask": "Build KleidiCV for debug", }, { "name": "SME2 API tests", @@ -69,7 +69,7 @@ "debugServerPath" : "${workspaceFolder}/.devcontainer/start_qemu.sh", "debugServerArgs": "-g 2345 -cpu max,sve128=on,sme512=on ${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test --vector-length=64 --gtest_filter=*", "cwd": "${workspaceFolder}", - "preLaunchTask": "Build IntrinsicCV for debug", + "preLaunchTask": "Build KleidiCV for debug", }, ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index fed196ecc..a79884e39 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,7 +2,7 @@ "version": "2.0.0", "tasks": [ { - "label": "Build IntrinsicCV", + "label": "Build KleidiCV", "type": "shell", "command": "${workspaceFolder}/scripts/build.sh", "problemMatcher" :"$gcc", @@ -22,7 +22,7 @@ } }, { - "label": "Build IntrinsicCV for debug", + "label": "Build KleidiCV for debug", "type": "shell", "command": "${workspaceFolder}/scripts/build.sh", "problemMatcher" :"$gcc", @@ -62,7 +62,7 @@ "${workspaceFolder}/build/intrinsiccv/test/framework/intrinsiccv-framework-test" ], "dependsOn": [ - "Build IntrinsicCV" + "Build KleidiCV" ], "group": { "kind": "test" @@ -79,7 +79,7 @@ "--vector-length=16" ], "dependsOn": [ - "Build IntrinsicCV" + "Build KleidiCV" ], "group": { "kind": "test" @@ -96,7 +96,7 @@ "--vector-length=16" ], "dependsOn": [ - "Build IntrinsicCV" + "Build KleidiCV" ], "group": { "kind": "test" @@ -113,7 +113,7 @@ "--vector-length=256" ], "dependsOn": [ - "Build IntrinsicCV" + "Build KleidiCV" ], "group": { "kind": "test" @@ -130,7 +130,7 @@ "--vector-length=64" ], "dependsOn": [ - "Build IntrinsicCV" + "Build KleidiCV" ], "group": { "kind": "test" diff --git a/CMakeLists.txt b/CMakeLists.txt index d5c36161a..dbfafd57d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16) -project("IntrinsicCV" CXX) +project("KleidiCV" CXX) add_subdirectory(intrinsiccv) add_subdirectory(test) diff --git a/Doxyfile b/Doxyfile index 4746ceae8..cd51f3bf0 100644 --- a/Doxyfile +++ b/Doxyfile @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: Apache-2.0 -PROJECT_NAME = "IntrinsicCV" +PROJECT_NAME = "KleidiCV" OUTPUT_DIRECTORY = build HIDE_UNDOC_MEMBERS = YES HIDE_UNDOC_CLASSES = YES diff --git a/README.md b/README.md index 6822e2867..acf7f33c9 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,12 @@ SPDX-License-Identifier: Apache-2.0 **NOT SUITABLE FOR DEPLOYMENT OR PRODUCTION USE** --- -# IntrinsicCV +# KleidiCV This project is in the early stages of development and is not ready for use except as a preview. -IntrinsicCV is a library aiming to give high-performing image +KleidiCV is a library aiming to give high-performing image processing functions on Arm. It is designed to be simple to import into a wide variety of projects. diff --git a/adapters/opencv/CMakeLists.txt b/adapters/opencv/CMakeLists.txt index b1ecee028..8bf93d6f8 100644 --- a/adapters/opencv/CMakeLists.txt +++ b/adapters/opencv/CMakeLists.txt @@ -4,7 +4,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/../../intrinsiccv/CMakeLists.txt") -project("IntrinsicCV OpenCV HAL") +project("KleidiCV OpenCV HAL") set(KLEIDICV_HAL_VERSION "0.0.0" CACHE INTERNAL "") set(KLEIDICV_HAL_LIBRARIES "intrinsiccv_hal" CACHE INTERNAL "") diff --git a/adapters/opencv/intrinsiccv_hal.cpp b/adapters/opencv/intrinsiccv_hal.cpp index 84f626847..f114e8b15 100644 --- a/adapters/opencv/intrinsiccv_hal.cpp +++ b/adapters/opencv/intrinsiccv_hal.cpp @@ -20,7 +20,7 @@ static int convert_error(intrinsiccv_error_t e) { return CV_HAL_ERROR_OK; case KLEIDICV_ERROR_NOT_IMPLEMENTED: return CV_HAL_ERROR_NOT_IMPLEMENTED; - // Even if IntrinsicCV returns this error it's possible that another + // Even if KleidiCV returns this error it's possible that another // implementation could handle the misalignment. case KLEIDICV_ERROR_ALIGNMENT: return CV_HAL_ERROR_NOT_IMPLEMENTED; @@ -186,7 +186,7 @@ int threshold(const uchar *src_data, size_t src_step, uchar *dst_data, return CV_HAL_ERROR_NOT_IMPLEMENTED; } -// Converts an OpenCV border type to an IntrinsicCV border type. +// Converts an OpenCV border type to an KleidiCV border type. static int from_opencv(int opencv_border_type, intrinsiccv_border_type_t &border_type) { switch (opencv_border_type) { diff --git a/adapters/opencv/opencv-4.9.patch b/adapters/opencv/opencv-4.9.patch index ccd407b3a..dc7e3dcb8 100644 --- a/adapters/opencv/opencv-4.9.patch +++ b/adapters/opencv/opencv-4.9.patch @@ -8,7 +8,7 @@ index 0000000000..c0ffb73ad7 --- /dev/null +++ b/3rdparty/intrinsiccv/CMakeLists.txt @@ -0,0 +1,3 @@ -+set(KLEIDICV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/intrinsiccv" CACHE PATH "Directory containing IntrinsicCV sources") ++set(KLEIDICV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/intrinsiccv" CACHE PATH "Directory containing KleidiCV sources") + +include("${KLEIDICV_SOURCE_PATH}/adapters/opencv/CMakeLists.txt") diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -28,7 +28,7 @@ index 5da9c2a695..3f1a2c7e38 100644 VERIFY HAVE_CAP_IOS) OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" (NOT CV_DISABLE_OPTIMIZATION) VISIBLE_IF (ARM OR AARCH64) AND NOT IOS AND NOT XROS) -+OCV_OPTION(WITH_KLEIDICV "Use IntrinsicCV library for ARM platforms" OFF ++OCV_OPTION(WITH_KLEIDICV "Use KleidiCV library for ARM platforms" OFF + VISIBLE_IF (AARCH64)) OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON VISIBLE_IF ANDROID @@ -38,7 +38,7 @@ index 5da9c2a695..3f1a2c7e38 100644 endif() +if(WITH_KLEIDICV) -+ ocv_debug_message(STATUS "Enable IntrinsicCV acceleration") ++ ocv_debug_message(STATUS "Enable KleidiCV acceleration") + if(NOT ";${OpenCV_HAL};" MATCHES ";intrinsiccv;") + set(OpenCV_HAL "intrinsiccv;${OpenCV_HAL}") + endif() @@ -54,7 +54,7 @@ index 5da9c2a695..3f1a2c7e38 100644 + elseif(hal STREQUAL "intrinsiccv") + add_subdirectory(3rdparty/intrinsiccv) + ocv_hal_register(KLEIDICV_HAL_LIBRARIES KLEIDICV_HAL_HEADERS KLEIDICV_HAL_INCLUDE_DIRS) -+ list(APPEND OpenCV_USED_HAL "IntrinsicCV (ver ${KLEIDICV_HAL_VERSION})") ++ list(APPEND OpenCV_USED_HAL "KleidiCV (ver ${KLEIDICV_HAL_VERSION})") elseif(hal STREQUAL "openvx") add_subdirectory(3rdparty/openvx) ocv_hal_register(OPENVX_HAL_LIBRARIES OPENVX_HAL_HEADERS OPENVX_HAL_INCLUDE_DIRS) diff --git a/adapters/opencv/opencv-5.x.patch b/adapters/opencv/opencv-5.x.patch index 01e97cc2e..5b6439657 100644 --- a/adapters/opencv/opencv-5.x.patch +++ b/adapters/opencv/opencv-5.x.patch @@ -8,7 +8,7 @@ index 0000000000..c0ffb73ad7 --- /dev/null +++ b/3rdparty/intrinsiccv/CMakeLists.txt @@ -0,0 +1,3 @@ -+set(KLEIDICV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/intrinsiccv" CACHE PATH "Directory containing IntrinsicCV sources") ++set(KLEIDICV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/intrinsiccv" CACHE PATH "Directory containing KleidiCV sources") + +include("${KLEIDICV_SOURCE_PATH}/adapters/opencv/CMakeLists.txt") diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -28,7 +28,7 @@ index 4a628c1a6a..999df2657d 100644 VERIFY HAVE_CAP_IOS) OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" (NOT CV_DISABLE_OPTIMIZATION) VISIBLE_IF (ARM OR AARCH64) AND NOT IOS AND NOT XROS) -+OCV_OPTION(WITH_KLEIDICV "Use IntrinsicCV library for ARM platforms" OFF ++OCV_OPTION(WITH_KLEIDICV "Use KleidiCV library for ARM platforms" OFF + VISIBLE_IF (AARCH64)) OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON VISIBLE_IF ANDROID @@ -38,7 +38,7 @@ index 4a628c1a6a..999df2657d 100644 endif() +if(WITH_KLEIDICV) -+ ocv_debug_message(STATUS "Enable IntrinsicCV acceleration") ++ ocv_debug_message(STATUS "Enable KleidiCV acceleration") + if(NOT ";${OpenCV_HAL};" MATCHES ";intrinsiccv;") + set(OpenCV_HAL "intrinsiccv;${OpenCV_HAL}") + endif() @@ -54,7 +54,7 @@ index 4a628c1a6a..999df2657d 100644 + elseif(hal STREQUAL "intrinsiccv") + add_subdirectory(3rdparty/intrinsiccv) + ocv_hal_register(KLEIDICV_HAL_LIBRARIES KLEIDICV_HAL_HEADERS KLEIDICV_HAL_INCLUDE_DIRS) -+ list(APPEND OpenCV_USED_HAL "IntrinsicCV (ver ${KLEIDICV_HAL_VERSION})") ++ list(APPEND OpenCV_USED_HAL "KleidiCV (ver ${KLEIDICV_HAL_VERSION})") elseif(hal STREQUAL "openvx") add_subdirectory(3rdparty/openvx) ocv_hal_register(OPENVX_HAL_LIBRARIES OPENVX_HAL_HEADERS OPENVX_HAL_INCLUDE_DIRS) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index f5bac0f23..862a81efb 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.16) # rest of the project so disable benchmarks by default. # Another reason to disable it by default is that the configure time # for Google Benchmark is quite noticeable. -option(KLEIDICV_BENCHMARK "Enable IntrinsicCV benchmarks" OFF) +option(KLEIDICV_BENCHMARK "Enable KleidiCV benchmarks" OFF) if(KLEIDICV_BENCHMARK) diff --git a/benchmark/main.cpp b/benchmark/main.cpp index a91b8500e..daeebdd45 100644 --- a/benchmark/main.cpp +++ b/benchmark/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char** argv) { ::benchmark::Initialize(&argc, argv); if (::benchmark::ReportUnrecognizedArguments(argc, argv)) return 1; - std::cout << "IntrinsicCV: Running benchmarks with:\n"; + std::cout << "KleidiCV: Running benchmarks with:\n"; std::cout << " image_width: " << image_width << "\n"; std::cout << " image_height: " << image_height << std::endl; diff --git a/conformity/opencv/README.md b/conformity/opencv/README.md index a26fc1d4d..c1d0fa480 100644 --- a/conformity/opencv/README.md +++ b/conformity/opencv/README.md @@ -6,11 +6,11 @@ SPDX-License-Identifier: Apache-2.0 # Conformity checks for OpenCV -This CMake project makes it possible to automatically compare IntrinsicCV +This CMake project makes it possible to automatically compare KleidiCV results with vanilla OpenCV for a given operation. To achieve this the project needs to be built twice (vanilla version and -IntrinsicCV one) as the availabilty of IntrinsicCV for a given operation is a +KleidiCV one) as the availabilty of KleidiCV for a given operation is a compile time decision. Then, the built executables (`manager` and `subordinate`, provided by different builds) perform the same operations, and the results are compared. The communication between the executables is implemented with POSIX @@ -21,5 +21,5 @@ The tests can be run from the project's root like: scripts/run_opencv_conformity_checks.sh ``` -The script expects an environment where IntrinsicCV can be built natively with +The script expects an environment where KleidiCV can be built natively with `cmake` and `ninja`, and `qemu-aarch64` is available. diff --git a/intrinsiccv/CMakeLists.txt b/intrinsiccv/CMakeLists.txt index 9e74761ef..d39d72705 100644 --- a/intrinsiccv/CMakeLists.txt +++ b/intrinsiccv/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16) -project("IntrinsicCV") +project("KleidiCV") include(CheckCXXCompilerFlag) @@ -24,7 +24,7 @@ option(KLEIDICV_EXPERIMENTAL_FEATURE_CANNY "Internal - Enable experimental Canny option(KLEIDICV_CANNY_ALGORITHM_CONFORM_OPENCV "Internal - If turned ON Canny algorithm creates bit exact result compared to OpenCV's original implementation" ON) if (KLEIDICV_ENABLE_SVE2 AND KLEIDICV_ENABLE_SVE2_SELECTIVELY) - message(FATAL_ERROR "[IntrinsicCV] KLEIDICV_ENABLE_SVE2 and KLEIDICV_ENABLE_SVE2_SELECTIVELY cannot be set at the same time") + message(FATAL_ERROR "[KleidiCV] KLEIDICV_ENABLE_SVE2 and KLEIDICV_ENABLE_SVE2_SELECTIVELY cannot be set at the same time") endif() # Compiler feature check for SVE2. @@ -34,7 +34,7 @@ if (KLEIDICV_ENABLE_SVE2 OR KLEIDICV_ENABLE_SVE2_SELECTIVELY) if (KLEIDICV_COMPILER_SUPPORTS_SVE2) set(KLEIDICV_BUILD_SVE2 ON) else() - message(STATUS "[IntrinsicCV] Compiler does not support SVE2") + message(STATUS "[KleidiCV] Compiler does not support SVE2") endif() endif() @@ -51,7 +51,7 @@ if (KLEIDICV_ENABLE_SME2) if (KLEIDICV_COMPILER_SUPPORTS_SME2) set(KLEIDICV_BUILD_SME2 ON) else() - message(STATUS "[IntrinsicCV] Compiler does not support SME2") + message(STATUS "[KleidiCV] Compiler does not support SME2") endif() endif() diff --git a/intrinsiccv/include/intrinsiccv/ctypes.h b/intrinsiccv/include/intrinsiccv/ctypes.h index 339b9cd1c..a6beac2f9 100644 --- a/intrinsiccv/include/intrinsiccv/ctypes.h +++ b/intrinsiccv/include/intrinsiccv/ctypes.h @@ -18,7 +18,7 @@ #include "intrinsiccv/config.h" -/// Error values reported by IntrinsicCV +/// Error values reported by KleidiCV typedef enum KLEIDICV_NODISCARD { /// Success. KLEIDICV_OK = 0, @@ -65,7 +65,7 @@ typedef struct { double right; } intrinsiccv_border_values_t; -/// IntrinsicCV border types +/// KleidiCV border types typedef enum { /// The border is a constant value. KLEIDICV_BORDER_TYPE_CONSTANT, diff --git a/intrinsiccv/include/intrinsiccv/intrinsiccv.h b/intrinsiccv/include/intrinsiccv/intrinsiccv.h index 65be4498c..9b001e3f1 100644 --- a/intrinsiccv/include/intrinsiccv/intrinsiccv.h +++ b/intrinsiccv/include/intrinsiccv/intrinsiccv.h @@ -4,11 +4,11 @@ /// @mainpage /// -/// For documentation of the IntrinsicCV C API see @ref intrinsiccv.h +/// For documentation of the KleidiCV C API see @ref intrinsiccv.h /// /// Project page: https://gitlab.arm.com/intrinsiccv/intrinsiccv /// -/// IntrinsicCV shall use Semantic +/// KleidiCV shall use Semantic /// Versioning 2.0.0. The public API is defined according to what is /// included in the Doxygen-generated documentation as well as the content of /// the project's Markdown files. Features without such documentation are not @@ -27,7 +27,7 @@ #include "intrinsiccv/ctypes.h" #ifndef __aarch64__ -#error "IntrinsicCV is only supported for aarch64" +#error "KleidiCV is only supported for aarch64" #endif #ifdef __aarch64__ diff --git a/scripts/build.sh b/scripts/build.sh index 91ef626e2..d6871f468 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -24,7 +24,7 @@ # CMAKE_VERBOSE_MAKEFILE: Enables verbose logs during builds. Defaults to 'OFF'. # COVERAGE: Enables collection of coverage metrics if set to 'ON'. Defaults to 'OFF'. # EXTRA_CMAKE_ARGS: Any additional args to pass to CMake. -# SOURCE_PATH: Path of IntrinsicCV source directory. Defaults to parent directory of this script. +# SOURCE_PATH: Path of KleidiCV source directory. Defaults to parent directory of this script. # ------------------------------------------------------------------------------ set -exu diff --git a/scripts/ci.sh b/scripts/ci.sh index a1b46fa0d..2b5ecb6c2 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -99,7 +99,7 @@ ninja -C build/build-benchmark intrinsiccv-benchmark # TODO: Cross-build OpenCV if [[ $(dpkg --print-architecture) = arm64 ]]; then - # Check OpenCV-IntrinsicCV integration + # Check OpenCV-KleidiCV integration scripts/ci-opencv.sh fi diff --git a/scripts/generate_coverage_report.py b/scripts/generate_coverage_report.py index 9a1e0cef4..edfa60f31 100755 --- a/scripts/generate_coverage_report.py +++ b/scripts/generate_coverage_report.py @@ -56,7 +56,7 @@ the toolchain with which the binaries were built.""" f"--gcov-executable={llvm_cov} gcov", f"--cobertura={cobertura}", f"--html-details={html}", - "--html-title=IntrinsicCV Coverage Report", + "--html-title=KleidiCV Coverage Report", "--html-syntax-highlighting", "--html-tab-size=2", "--exclude-noncode-lines", diff --git a/test/api/test_saturating_multiply.cpp b/test/api/test_saturating_multiply.cpp index 9e6eb40bf..3c998ae8f 100644 --- a/test/api/test_saturating_multiply.cpp +++ b/test/api/test_saturating_multiply.cpp @@ -39,7 +39,7 @@ class SaturatingMultiplyTest final : public BinaryOperationTest { this->height(), this->scale()); } double scale() { - return 1.0; // This is the only parameter IntrinsicCV supports. + return 1.0; // This is the only parameter KleidiCV supports. } // Returns different test data for signed and unsigned element types. const std::vector& test_elements() override { -- GitLab From f6b398c4ca4c0256a945988de5720b233e787c55 Mon Sep 17 00:00:00 2001 From: Denes Tarjan Date: Fri, 12 Apr 2024 12:48:19 +0000 Subject: [PATCH 3/3] Rename: intrinsiccv -> kleidicv --- .clang-tidy | 2 +- .vscode/launch.json | 20 +- .vscode/settings.json | 2 +- .vscode/tasks.json | 16 +- CMakeLists.txt | 2 +- Doxyfile | 2 +- README.md | 24 +- adapters/opencv/CMakeLists.txt | 30 +- .../{intrinsiccv_hal.cpp => kleidicv_hal.cpp} | 198 +++++---- .../{intrinsiccv_hal.h => kleidicv_hal.h} | 75 ++-- adapters/opencv/opencv-4.9.patch | 14 +- adapters/opencv/opencv-5.x.patch | 14 +- benchmark/CMakeLists.txt | 20 +- benchmark/benchmark.cpp | 20 +- .../intrinsiccv/conversions/gray_to_rgb.h | 50 --- .../include/intrinsiccv/conversions/merge.h | 22 - .../intrinsiccv/conversions/rgb_to_rgb.h | 88 ---- .../include/intrinsiccv/conversions/split.h | 25 -- .../intrinsiccv/conversions/yuv_to_rgb.h | 169 -------- .../intrinsiccv/filters/gaussian_blur.h | 55 --- .../include/intrinsiccv/filters/sobel.h | 47 --- .../include/intrinsiccv/resize/resize.h | 35 -- .../intrinsiccv/resize/resize_linear.h | 35 -- intrinsiccv/src/analysis/min_max_api.cpp | 44 -- intrinsiccv/src/arithmetics/absdiff_api.cpp | 52 --- intrinsiccv/src/arithmetics/add_api.cpp | 55 --- intrinsiccv/src/arithmetics/multiply_api.cpp | 53 --- intrinsiccv/src/arithmetics/scale_api.cpp | 33 -- intrinsiccv/src/arithmetics/sub_api.cpp | 54 --- intrinsiccv/src/arithmetics/threshold_api.cpp | 39 -- intrinsiccv/src/arithmetics/transpose_api.cpp | 10 - .../src/conversions/gray_to_rgb_api.cpp | 16 - intrinsiccv/src/conversions/merge_api.cpp | 10 - .../src/conversions/yuv_to_rgb_api.cpp | 17 - .../src/filters/gaussian_blur_sve2.cpp | 21 - intrinsiccv/src/filters/sobel_api.cpp | 18 - intrinsiccv/src/morphology/morphology_api.cpp | 118 ------ intrinsiccv/src/resize/resize_api.cpp | 12 - intrinsiccv/src/resize/resize_linear_api.cpp | 12 - intrinsiccv/src/resize/resize_linear_sve2.cpp | 18 - intrinsiccv/src/resize/resize_sve2.cpp | 19 - {intrinsiccv => kleidicv}/CMakeLists.txt | 46 +-- .../include/kleidicv}/arithmetics/transpose.h | 12 +- .../include/kleidicv}/config.h.in | 8 +- .../include/kleidicv}/containers/stack.h | 6 +- .../kleidicv/conversions/gray_to_rgb.h | 50 +++ kleidicv/include/kleidicv/conversions/merge.h | 22 + .../include/kleidicv/conversions/rgb_to_rgb.h | 88 ++++ kleidicv/include/kleidicv/conversions/split.h | 24 ++ .../include/kleidicv/conversions/yuv_to_rgb.h | 157 +++++++ .../include/kleidicv}/ctypes.h | 19 +- .../include/kleidicv}/debug.h | 10 +- .../include/kleidicv}/dispatch.h | 2 +- .../include/kleidicv/filters/gaussian_blur.h | 55 +++ kleidicv/include/kleidicv/filters/sobel.h | 47 +++ .../include/kleidicv/kleidicv.h | 278 +++++++------ .../include/kleidicv}/morphology/workspace.h | 29 +- .../include/kleidicv}/neon.h | 12 +- .../include/kleidicv}/neon_intrinsics.h | 4 +- .../include/kleidicv}/operations.h | 4 +- kleidicv/include/kleidicv/resize/resize.h | 35 ++ .../include/kleidicv/resize/resize_linear.h | 35 ++ .../include/kleidicv}/sve2.h | 6 +- .../include/kleidicv}/traits.h | 2 +- .../include/kleidicv}/types.h | 14 +- .../include/kleidicv}/unsafe.h | 0 .../include/kleidicv}/utils.h | 12 +- .../include/kleidicv}/workspace/borders.h | 4 +- .../include/kleidicv}/workspace/separable.h | 4 +- .../src/analysis/canny_neon.cpp | 30 +- .../src/analysis/count_nonzeros_neon.cpp | 14 +- kleidicv/src/analysis/min_max_api.cpp | 44 ++ .../src/analysis/min_max_loc_neon.cpp | 20 +- .../src/analysis/min_max_neon.cpp | 16 +- kleidicv/src/arithmetics/absdiff_api.cpp | 52 +++ .../src/arithmetics/absdiff_neon.cpp | 26 +- .../src/arithmetics/absdiff_sme2.cpp | 20 +- .../src/arithmetics/absdiff_sve2.cpp | 26 +- .../add_abs_with_threshold_api.cpp | 31 +- .../add_abs_with_threshold_neon.cpp | 12 +- .../arithmetics/add_abs_with_threshold_sc.h | 6 +- .../add_abs_with_threshold_sme2.cpp | 8 +- .../add_abs_with_threshold_sve2.cpp | 8 +- kleidicv/src/arithmetics/add_api.cpp | 52 +++ .../src/arithmetics/add_neon.cpp | 24 +- .../src/arithmetics/add_sme2.cpp | 18 +- .../src/arithmetics/add_sve2.cpp | 24 +- kleidicv/src/arithmetics/multiply_api.cpp | 53 +++ .../src/arithmetics/multiply_neon.cpp | 20 +- .../src/arithmetics/multiply_sve2.cpp | 18 +- kleidicv/src/arithmetics/scale_api.cpp | 33 ++ .../src/arithmetics/scale_neon.cpp | 16 +- kleidicv/src/arithmetics/sub_api.cpp | 51 +++ .../src/arithmetics/sub_neon.cpp | 24 +- .../src/arithmetics/sub_sme2.cpp | 18 +- .../src/arithmetics/sub_sve2.cpp | 24 +- kleidicv/src/arithmetics/threshold_api.cpp | 39 ++ .../src/arithmetics/threshold_neon.cpp | 23 +- .../src/arithmetics/threshold_sc.h | 12 +- .../src/arithmetics/threshold_sme2.cpp | 15 +- .../src/arithmetics/threshold_sve2.cpp | 15 +- .../src/arithmetics/transpose_api.cpp | 8 +- .../src/arithmetics/transpose_neon.cpp | 31 +- .../src/conversions/float_conv_api.cpp | 42 +- .../src/conversions/float_conv_neon.cpp | 14 +- .../src/conversions/float_conv_sc.h | 6 +- .../src/conversions/float_conv_sme2.cpp | 8 +- .../src/conversions/float_conv_sve2.cpp | 8 +- kleidicv/src/conversions/gray_to_rgb_api.cpp | 16 + .../src/conversions/gray_to_rgb_neon.cpp | 22 +- .../src/conversions/gray_to_rgb_sc.h | 10 +- .../src/conversions/gray_to_rgb_sme2.cpp | 8 +- .../src/conversions/gray_to_rgb_sve2.cpp | 8 +- kleidicv/src/conversions/merge_api.cpp | 10 + .../src/conversions/merge_neon.cpp | 22 +- .../src/conversions/rgb_to_rgb_api.cpp | 46 +-- .../src/conversions/rgb_to_rgb_neon.cpp | 38 +- .../src/conversions/rgb_to_rgb_sc.h | 18 +- .../src/conversions/rgb_to_rgb_sme2.cpp | 16 +- .../src/conversions/rgb_to_rgb_sve2.cpp | 32 +- kleidicv/src/conversions/split_api.cpp | 10 + .../src/conversions/split_neon.cpp | 23 +- kleidicv/src/conversions/yuv_to_rgb_api.cpp | 17 + .../src/conversions/yuv_to_rgb_neon.cpp | 34 +- .../src/conversions/yuv_to_rgb_sc.h | 16 +- .../src/conversions/yuv_to_rgb_sme2.cpp | 12 +- .../src/conversions/yuv_to_rgb_sve2.cpp | 26 +- .../src/filters/gaussian_blur_api.cpp | 30 +- .../src/filters/gaussian_blur_neon.cpp | 43 +- .../src/filters/gaussian_blur_sc.h | 10 +- .../src/filters/gaussian_blur_sme2.cpp | 12 +- kleidicv/src/filters/gaussian_blur_sve2.cpp | 22 + kleidicv/src/filters/sobel_api.cpp | 18 + .../src/filters/sobel_neon.cpp | 29 +- .../src/filters/sobel_sc.h | 10 +- .../src/filters/sobel_sme2.cpp | 8 +- .../src/filters/sobel_sve2.cpp | 8 +- kleidicv/src/morphology/morphology_api.cpp | 118 ++++++ .../src/morphology/morphology_neon.cpp | 28 +- .../src/morphology/morphology_sc.h | 20 +- .../src/morphology/morphology_sme2.cpp | 16 +- .../src/morphology/morphology_sve2.cpp | 16 +- kleidicv/src/resize/resize_api.cpp | 12 + kleidicv/src/resize/resize_linear_api.cpp | 12 + .../src/resize/resize_linear_neon.cpp | 22 +- .../src/resize/resize_linear_sc.h | 24 +- .../src/resize/resize_linear_sme2.cpp | 8 +- kleidicv/src/resize/resize_linear_sve2.cpp | 18 + .../src/resize/resize_neon.cpp | 24 +- .../src/resize/resize_sc.h | 12 +- .../src/resize/resize_sme2.cpp | 8 +- kleidicv/src/resize/resize_sve2.cpp | 19 + .../src/supported-types.md | 0 scripts/build.sh | 8 +- scripts/ci-opencv.sh | 6 +- scripts/ci.sh | 28 +- scripts/format.sh | 2 +- scripts/run_opencv_conformity_checks.sh | 2 +- test/CMakeLists.txt | 16 +- test/api/CMakeLists.txt | 20 +- test/api/test_add_abs_with_threshold.cpp | 22 +- test/api/test_canny.cpp | 4 +- test/api/test_count_nonzeros.cpp | 4 +- test/api/test_float_conv.cpp | 13 +- test/api/test_gaussian_blur.cpp | 268 ++++++------ test/api/test_merge.cpp | 55 ++- test/api/test_min_max.cpp | 6 +- test/api/test_morphology.cpp | 383 +++++++++--------- test/api/test_resize_linear.cpp | 34 +- test/api/test_resize_to_quarter.cpp | 26 +- test/api/test_rgb_and_gray.cpp | 30 +- test/api/test_saturating_absdiff.cpp | 11 +- test/api/test_saturating_add.cpp | 8 +- test/api/test_saturating_multiply.cpp | 11 +- test/api/test_saturating_sub.cpp | 8 +- test/api/test_scale.cpp | 23 +- test/api/test_sobel.cpp | 23 +- test/api/test_split.cpp | 49 ++- test/api/test_threshold_binary.cpp | 8 +- test/api/test_transpose.cpp | 60 ++- test/api/test_yuv_to_rgb.cpp | 36 +- test/framework/CMakeLists.txt | 20 +- test/framework/border.cpp | 10 +- test/framework/border.h | 6 +- test/framework/kernel.h | 40 +- test/framework/operation.h | 4 +- test/framework/test_kernel.cpp | 14 +- test/framework/utils.cpp | 2 +- test/framework/utils.h | 4 +- 189 files changed, 2799 insertions(+), 2856 deletions(-) rename adapters/opencv/{intrinsiccv_hal.cpp => kleidicv_hal.cpp} (76%) rename adapters/opencv/{intrinsiccv_hal.h => kleidicv_hal.h} (84%) delete mode 100644 intrinsiccv/include/intrinsiccv/conversions/gray_to_rgb.h delete mode 100644 intrinsiccv/include/intrinsiccv/conversions/merge.h delete mode 100644 intrinsiccv/include/intrinsiccv/conversions/rgb_to_rgb.h delete mode 100644 intrinsiccv/include/intrinsiccv/conversions/split.h delete mode 100644 intrinsiccv/include/intrinsiccv/conversions/yuv_to_rgb.h delete mode 100644 intrinsiccv/include/intrinsiccv/filters/gaussian_blur.h delete mode 100644 intrinsiccv/include/intrinsiccv/filters/sobel.h delete mode 100644 intrinsiccv/include/intrinsiccv/resize/resize.h delete mode 100644 intrinsiccv/include/intrinsiccv/resize/resize_linear.h delete mode 100644 intrinsiccv/src/analysis/min_max_api.cpp delete mode 100644 intrinsiccv/src/arithmetics/absdiff_api.cpp delete mode 100644 intrinsiccv/src/arithmetics/add_api.cpp delete mode 100644 intrinsiccv/src/arithmetics/multiply_api.cpp delete mode 100644 intrinsiccv/src/arithmetics/scale_api.cpp delete mode 100644 intrinsiccv/src/arithmetics/sub_api.cpp delete mode 100644 intrinsiccv/src/arithmetics/threshold_api.cpp delete mode 100644 intrinsiccv/src/arithmetics/transpose_api.cpp delete mode 100644 intrinsiccv/src/conversions/gray_to_rgb_api.cpp delete mode 100644 intrinsiccv/src/conversions/merge_api.cpp delete mode 100644 intrinsiccv/src/conversions/yuv_to_rgb_api.cpp delete mode 100644 intrinsiccv/src/filters/gaussian_blur_sve2.cpp delete mode 100644 intrinsiccv/src/filters/sobel_api.cpp delete mode 100644 intrinsiccv/src/morphology/morphology_api.cpp delete mode 100644 intrinsiccv/src/resize/resize_api.cpp delete mode 100644 intrinsiccv/src/resize/resize_linear_api.cpp delete mode 100644 intrinsiccv/src/resize/resize_linear_sve2.cpp delete mode 100644 intrinsiccv/src/resize/resize_sve2.cpp rename {intrinsiccv => kleidicv}/CMakeLists.txt (74%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/arithmetics/transpose.h (59%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/config.h.in (92%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/containers/stack.h (98%) create mode 100644 kleidicv/include/kleidicv/conversions/gray_to_rgb.h create mode 100644 kleidicv/include/kleidicv/conversions/merge.h create mode 100644 kleidicv/include/kleidicv/conversions/rgb_to_rgb.h create mode 100644 kleidicv/include/kleidicv/conversions/split.h create mode 100644 kleidicv/include/kleidicv/conversions/yuv_to_rgb.h rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/ctypes.h (86%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/debug.h (92%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/dispatch.h (98%) create mode 100644 kleidicv/include/kleidicv/filters/gaussian_blur.h create mode 100644 kleidicv/include/kleidicv/filters/sobel.h rename intrinsiccv/include/intrinsiccv/intrinsiccv.h => kleidicv/include/kleidicv/kleidicv.h (88%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/morphology/workspace.h (94%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/neon.h (98%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/neon_intrinsics.h (99%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/operations.h (99%) create mode 100644 kleidicv/include/kleidicv/resize/resize.h create mode 100644 kleidicv/include/kleidicv/resize/resize_linear.h rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/sve2.h (99%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/traits.h (99%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/types.h (98%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/unsafe.h (100%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/utils.h (97%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/workspace/borders.h (98%) rename {intrinsiccv/include/intrinsiccv => kleidicv/include/kleidicv}/workspace/separable.h (99%) rename {intrinsiccv => kleidicv}/src/analysis/canny_neon.cpp (96%) rename {intrinsiccv => kleidicv}/src/analysis/count_nonzeros_neon.cpp (81%) create mode 100644 kleidicv/src/analysis/min_max_api.cpp rename {intrinsiccv => kleidicv}/src/analysis/min_max_loc_neon.cpp (96%) rename {intrinsiccv => kleidicv}/src/analysis/min_max_neon.cpp (83%) create mode 100644 kleidicv/src/arithmetics/absdiff_api.cpp rename {intrinsiccv => kleidicv}/src/arithmetics/absdiff_neon.cpp (73%) rename {intrinsiccv => kleidicv}/src/arithmetics/absdiff_sme2.cpp (81%) rename {intrinsiccv => kleidicv}/src/arithmetics/absdiff_sve2.cpp (72%) rename {intrinsiccv => kleidicv}/src/arithmetics/add_abs_with_threshold_api.cpp (59%) rename {intrinsiccv => kleidicv}/src/arithmetics/add_abs_with_threshold_neon.cpp (91%) rename {intrinsiccv => kleidicv}/src/arithmetics/add_abs_with_threshold_sc.h (94%) rename {intrinsiccv => kleidicv}/src/arithmetics/add_abs_with_threshold_sme2.cpp (84%) rename {intrinsiccv => kleidicv}/src/arithmetics/add_abs_with_threshold_sve2.cpp (82%) create mode 100644 kleidicv/src/arithmetics/add_api.cpp rename {intrinsiccv => kleidicv}/src/arithmetics/add_neon.cpp (79%) rename {intrinsiccv => kleidicv}/src/arithmetics/add_sme2.cpp (85%) rename {intrinsiccv => kleidicv}/src/arithmetics/add_sve2.cpp (75%) create mode 100644 kleidicv/src/arithmetics/multiply_api.cpp rename {intrinsiccv => kleidicv}/src/arithmetics/multiply_neon.cpp (84%) rename {intrinsiccv => kleidicv}/src/arithmetics/multiply_sve2.cpp (81%) create mode 100644 kleidicv/src/arithmetics/scale_api.cpp rename {intrinsiccv => kleidicv}/src/arithmetics/scale_neon.cpp (95%) create mode 100644 kleidicv/src/arithmetics/sub_api.cpp rename {intrinsiccv => kleidicv}/src/arithmetics/sub_neon.cpp (79%) rename {intrinsiccv => kleidicv}/src/arithmetics/sub_sme2.cpp (85%) rename {intrinsiccv => kleidicv}/src/arithmetics/sub_sve2.cpp (75%) create mode 100644 kleidicv/src/arithmetics/threshold_api.cpp rename {intrinsiccv => kleidicv}/src/arithmetics/threshold_neon.cpp (70%) rename {intrinsiccv => kleidicv}/src/arithmetics/threshold_sc.h (80%) rename {intrinsiccv => kleidicv}/src/arithmetics/threshold_sme2.cpp (57%) rename {intrinsiccv => kleidicv}/src/arithmetics/threshold_sve2.cpp (58%) rename intrinsiccv/src/conversions/split_api.cpp => kleidicv/src/arithmetics/transpose_api.cpp (50%) rename {intrinsiccv => kleidicv}/src/arithmetics/transpose_neon.cpp (90%) rename {intrinsiccv => kleidicv}/src/conversions/float_conv_api.cpp (52%) rename {intrinsiccv => kleidicv}/src/conversions/float_conv_neon.cpp (68%) rename {intrinsiccv => kleidicv}/src/conversions/float_conv_sc.h (98%) rename {intrinsiccv => kleidicv}/src/conversions/float_conv_sme2.cpp (83%) rename {intrinsiccv => kleidicv}/src/conversions/float_conv_sve2.cpp (85%) create mode 100644 kleidicv/src/conversions/gray_to_rgb_api.cpp rename {intrinsiccv => kleidicv}/src/conversions/gray_to_rgb_neon.cpp (87%) rename {intrinsiccv => kleidicv}/src/conversions/gray_to_rgb_sc.h (97%) rename {intrinsiccv => kleidicv}/src/conversions/gray_to_rgb_sme2.cpp (74%) rename {intrinsiccv => kleidicv}/src/conversions/gray_to_rgb_sve2.cpp (79%) create mode 100644 kleidicv/src/conversions/merge_api.cpp rename {intrinsiccv => kleidicv}/src/conversions/merge_neon.cpp (96%) rename {intrinsiccv => kleidicv}/src/conversions/rgb_to_rgb_api.cpp (51%) rename {intrinsiccv => kleidicv}/src/conversions/rgb_to_rgb_neon.cpp (87%) rename {intrinsiccv => kleidicv}/src/conversions/rgb_to_rgb_sc.h (96%) rename {intrinsiccv => kleidicv}/src/conversions/rgb_to_rgb_sme2.cpp (74%) rename {intrinsiccv => kleidicv}/src/conversions/rgb_to_rgb_sve2.cpp (50%) create mode 100644 kleidicv/src/conversions/split_api.cpp rename {intrinsiccv => kleidicv}/src/conversions/split_neon.cpp (94%) create mode 100644 kleidicv/src/conversions/yuv_to_rgb_api.cpp rename {intrinsiccv => kleidicv}/src/conversions/yuv_to_rgb_neon.cpp (93%) rename {intrinsiccv => kleidicv}/src/conversions/yuv_to_rgb_sc.h (96%) rename {intrinsiccv => kleidicv}/src/conversions/yuv_to_rgb_sme2.cpp (82%) rename {intrinsiccv => kleidicv}/src/conversions/yuv_to_rgb_sve2.cpp (57%) rename {intrinsiccv => kleidicv}/src/filters/gaussian_blur_api.cpp (56%) rename {intrinsiccv => kleidicv}/src/filters/gaussian_blur_neon.cpp (83%) rename {intrinsiccv => kleidicv}/src/filters/gaussian_blur_sc.h (95%) rename {intrinsiccv => kleidicv}/src/filters/gaussian_blur_sme2.cpp (62%) create mode 100644 kleidicv/src/filters/gaussian_blur_sve2.cpp create mode 100644 kleidicv/src/filters/sobel_api.cpp rename {intrinsiccv => kleidicv}/src/filters/sobel_neon.cpp (87%) rename {intrinsiccv => kleidicv}/src/filters/sobel_sc.h (96%) rename {intrinsiccv => kleidicv}/src/filters/sobel_sme2.cpp (80%) rename {intrinsiccv => kleidicv}/src/filters/sobel_sve2.cpp (76%) create mode 100644 kleidicv/src/morphology/morphology_api.cpp rename {intrinsiccv => kleidicv}/src/morphology/morphology_neon.cpp (96%) rename {intrinsiccv => kleidicv}/src/morphology/morphology_sc.h (97%) rename {intrinsiccv => kleidicv}/src/morphology/morphology_sme2.cpp (64%) rename {intrinsiccv => kleidicv}/src/morphology/morphology_sve2.cpp (66%) create mode 100644 kleidicv/src/resize/resize_api.cpp create mode 100644 kleidicv/src/resize/resize_linear_api.cpp rename {intrinsiccv => kleidicv}/src/resize/resize_linear_neon.cpp (96%) rename {intrinsiccv => kleidicv}/src/resize/resize_linear_sc.h (96%) rename {intrinsiccv => kleidicv}/src/resize/resize_linear_sme2.cpp (73%) create mode 100644 kleidicv/src/resize/resize_linear_sve2.cpp rename {intrinsiccv => kleidicv}/src/resize/resize_neon.cpp (83%) rename {intrinsiccv => kleidicv}/src/resize/resize_sc.h (95%) rename {intrinsiccv => kleidicv}/src/resize/resize_sme2.cpp (74%) create mode 100644 kleidicv/src/resize/resize_sve2.cpp rename {intrinsiccv => kleidicv}/src/supported-types.md (100%) diff --git a/.clang-tidy b/.clang-tidy index 3b576049d..936ded208 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -48,6 +48,6 @@ Checks: >- -readability-named-parameter, -readability-redundant-inline-specifier WarningsAsErrors: '*' -HeaderFilterRegex: '(intrinsiccv|test)/.*' +HeaderFilterRegex: '(kleidicv|test)/.*' FormatStyle: google ... diff --git a/.vscode/launch.json b/.vscode/launch.json index b1be9401f..6e8f2f256 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,13 +5,13 @@ "name": "Framework tests", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/intrinsiccv/test/framework/intrinsiccv-framework-test", + "program": "${workspaceFolder}/build/kleidicv/test/framework/kleidicv-framework-test", "MIMode": "gdb", "miDebuggerPath": "/usr/bin/gdb-multiarch", "miDebuggerServerAddress": "localhost:2345", "targetArchitecture": "arm64", "debugServerPath" : "${workspaceFolder}/.devcontainer/start_qemu.sh", - "debugServerArgs": "-g 2345 ${workspaceFolder}/build/intrinsiccv/test/framework/intrinsiccv-framework-test --gtest_filter=*", + "debugServerArgs": "-g 2345 ${workspaceFolder}/build/kleidicv/test/framework/kleidicv-framework-test --gtest_filter=*", "cwd": "${workspaceFolder}", "preLaunchTask": "Build KleidiCV for debug", }, @@ -19,13 +19,13 @@ "name": "NEON API tests", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test", + "program": "${workspaceFolder}/build/kleidicv-debug/test/api/kleidicv-api-test", "MIMode": "gdb", "miDebuggerPath": "/usr/bin/gdb-multiarch", "miDebuggerServerAddress": "localhost:2345", "targetArchitecture": "arm64", "debugServerPath" : "${workspaceFolder}/.devcontainer/start_qemu.sh", - "debugServerArgs": "-g 2345 -cpu cortex-a53 ${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test --vector-length=16 --gtest_filter=*", + "debugServerArgs": "-g 2345 -cpu cortex-a53 ${workspaceFolder}/build/kleidicv-debug/test/api/kleidicv-api-test --vector-length=16 --gtest_filter=*", "cwd": "${workspaceFolder}", "preLaunchTask": "Build KleidiCV for debug", }, @@ -33,13 +33,13 @@ "name": "SVE2 API tests, 128 bits", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test", + "program": "${workspaceFolder}/build/kleidicv-debug/test/api/kleidicv-api-test", "MIMode": "gdb", "miDebuggerPath": "/usr/bin/gdb-multiarch", "miDebuggerServerAddress": "localhost:2345", "targetArchitecture": "arm64", "debugServerPath" : "${workspaceFolder}/.devcontainer/start_qemu.sh", - "debugServerArgs": "-g 2345 -cpu max,sve128=on,sme=off ${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test --vector-length=16 --gtest_filter=*", + "debugServerArgs": "-g 2345 -cpu max,sve128=on,sme=off ${workspaceFolder}/build/kleidicv-debug/test/api/kleidicv-api-test --vector-length=16 --gtest_filter=*", "cwd": "${workspaceFolder}", "preLaunchTask": "Build KleidiCV for debug", }, @@ -47,13 +47,13 @@ "name": "SVE2 API tests, 2048 bits", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test", + "program": "${workspaceFolder}/build/kleidicv-debug/test/api/kleidicv-api-test", "MIMode": "gdb", "miDebuggerPath": "/usr/bin/gdb-multiarch", "miDebuggerServerAddress": "localhost:2345", "targetArchitecture": "arm64", "debugServerPath" : "${workspaceFolder}/.devcontainer/start_qemu.sh", - "debugServerArgs": "-g 2345 -cpu max,sve2048=on,sve-default-vector-length=256,sme=off ${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test --vector-length=256 --gtest_filter=*", + "debugServerArgs": "-g 2345 -cpu max,sve2048=on,sve-default-vector-length=256,sme=off ${workspaceFolder}/build/kleidicv-debug/test/api/kleidicv-api-test --vector-length=256 --gtest_filter=*", "cwd": "${workspaceFolder}", "preLaunchTask": "Build KleidiCV for debug", }, @@ -61,13 +61,13 @@ "name": "SME2 API tests", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test", + "program": "${workspaceFolder}/build/kleidicv-debug/test/api/kleidicv-api-test", "MIMode": "gdb", "miDebuggerPath": "/usr/bin/gdb-multiarch", "miDebuggerServerAddress": "localhost:2345", "targetArchitecture": "arm64", "debugServerPath" : "${workspaceFolder}/.devcontainer/start_qemu.sh", - "debugServerArgs": "-g 2345 -cpu max,sve128=on,sme512=on ${workspaceFolder}/build/intrinsiccv-debug/test/api/intrinsiccv-api-test --vector-length=64 --gtest_filter=*", + "debugServerArgs": "-g 2345 -cpu max,sve128=on,sme512=on ${workspaceFolder}/build/kleidicv-debug/test/api/kleidicv-api-test --vector-length=64 --gtest_filter=*", "cwd": "${workspaceFolder}", "preLaunchTask": "Build KleidiCV for debug", }, diff --git a/.vscode/settings.json b/.vscode/settings.json index 49aaecc4f..582fdecf2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,6 @@ "C_Cpp.intelliSenseEngine": "disabled", "clangd.path": "clangd", "clangd.arguments": [ - "--compile-commands-dir=${workspaceFolder}/build/intrinsiccv" + "--compile-commands-dir=${workspaceFolder}/build/kleidicv" ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a79884e39..4d4555906 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,7 +7,7 @@ "command": "${workspaceFolder}/scripts/build.sh", "problemMatcher" :"$gcc", "args": [ - "intrinsiccv-test" + "kleidicv-test" ], "options": { "env": { @@ -27,11 +27,11 @@ "command": "${workspaceFolder}/scripts/build.sh", "problemMatcher" :"$gcc", "args": [ - "intrinsiccv-test" + "kleidicv-test" ], "options": { "env": { - "BUILD_ID" : "intrinsiccv-debug", + "BUILD_ID" : "kleidicv-debug", "CMAKE_BUILD_TYPE" : "Debug", "CMAKE_CXX_FLAGS": "--target=aarch64-linux-gnu", "CMAKE_EXE_LINKER_FLAGS": "--rtlib=compiler-rt -static -fuse-ld=lld", @@ -59,7 +59,7 @@ "type": "process", "command": "qemu-aarch64", "args": [ - "${workspaceFolder}/build/intrinsiccv/test/framework/intrinsiccv-framework-test" + "${workspaceFolder}/build/kleidicv/test/framework/kleidicv-framework-test" ], "dependsOn": [ "Build KleidiCV" @@ -75,7 +75,7 @@ "args": [ "-cpu", "cortex-a35", - "${workspaceFolder}/build/intrinsiccv/test/api/intrinsiccv-api-test", + "${workspaceFolder}/build/kleidicv/test/api/kleidicv-api-test", "--vector-length=16" ], "dependsOn": [ @@ -92,7 +92,7 @@ "args": [ "-cpu", "max,sve128=on,sme=off", - "${workspaceFolder}/build/intrinsiccv/test/api/intrinsiccv-api-test", + "${workspaceFolder}/build/kleidicv/test/api/kleidicv-api-test", "--vector-length=16" ], "dependsOn": [ @@ -109,7 +109,7 @@ "args": [ "-cpu", "max,sve2048=on,sve-default-vector-length=256,sme=off", - "${workspaceFolder}/build/intrinsiccv/test/api/intrinsiccv-api-test", + "${workspaceFolder}/build/kleidicv/test/api/kleidicv-api-test", "--vector-length=256" ], "dependsOn": [ @@ -126,7 +126,7 @@ "args": [ "-cpu", "max,sve128=on,sme512=on", - "${workspaceFolder}/build/intrinsiccv/test/api/intrinsiccv-api-test", + "${workspaceFolder}/build/kleidicv/test/api/kleidicv-api-test", "--vector-length=64" ], "dependsOn": [ diff --git a/CMakeLists.txt b/CMakeLists.txt index dbfafd57d..d885bd65f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,6 @@ cmake_minimum_required(VERSION 3.16) project("KleidiCV" CXX) -add_subdirectory(intrinsiccv) +add_subdirectory(kleidicv) add_subdirectory(test) add_subdirectory(benchmark) diff --git a/Doxyfile b/Doxyfile index cd51f3bf0..9d8e0ca6e 100644 --- a/Doxyfile +++ b/Doxyfile @@ -9,7 +9,7 @@ HIDE_UNDOC_CLASSES = YES SHOW_INCLUDE_FILES = NO QUIET = YES WARN_AS_ERROR = FAIL_ON_WARNINGS -INPUT = intrinsiccv adapters/opencv/intrinsiccv_hal.h +INPUT = kleidicv adapters/opencv/kleidicv_hal.h RECURSIVE = YES EXCLUDE = build VERBATIM_HEADERS = NO diff --git a/README.md b/README.md index acf7f33c9..a33768632 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,14 @@ processing functions on Arm. It is designed to be simple to import into a wide variety of projects. The library provides a C interface. For details see -[the C API documentation](https://intrinsiccv.sites.arm.com/intrinsiccv/). +[the C API documentation](https://kleidicv.sites.arm.com/kleidicv/). An adapter layer API is currently provided for: * OpenCV - [available functionality overview](adapters/opencv/doc-opencv.md) # Structure -The directory `intrinsiccv` contains generic implementation of the library. +The directory `kleidicv` contains generic implementation of the library. Integration with other projects are stored in `adapters` folder. `test` contains API and unit tests for the library. `benchmark` contains benchmark source. `conformity` contains checks to compare the library output with different @@ -36,9 +36,9 @@ implementations. All supporting scripts are located in `scripts`. The library can be built using CMake: ``` cmake \ --S /path/to/intrinsiccv \ --B build-intrinsiccv \ -cmake --build build-intrinsiccv --parallel +-S /path/to/kleidicv \ +-B build-kleidicv \ +cmake --build build-kleidicv --parallel ``` To target Android devices the following CMake flags are also required: @@ -66,15 +66,15 @@ The build artifacts are placed in the `build` directory. ## Build and run tests for Android -To build all the tests use the target `intrinsiccv-test`, to also run them use -`check-intrinsiccv` and set a proper `CMAKE_CROSSCOMPILING_EMULATOR`. +To build all the tests use the target `kleidicv-test`, to also run them use +`check-kleidicv` and set a proper `CMAKE_CROSSCOMPILING_EMULATOR`. To build all tests: ``` BUILD_ID=android \ CMAKE_TOOLCHAIN_FILE=/path/to/android-ndk/build/cmake/android.toolchain.cmake \ EXTRA_CMAKE_ARGS="-DANDROID_ABI=arm64-v8a" \ -scripts/build.sh intrinsiccv-test +scripts/build.sh kleidicv-test ``` To run the tests: @@ -82,9 +82,9 @@ To run the tests: BUILD_ID=android \ CMAKE_TOOLCHAIN_FILE=/path/to/android-ndk/build/cmake/android.toolchain.cmake \ ADB= \ -CMAKE_CROSSCOMPILING_EMULATOR="/scripts/test_android.sh;/build/" \ +CMAKE_CROSSCOMPILING_EMULATOR="/scripts/test_android.sh;/build/" \ EXTRA_CMAKE_ARGS="-DANDROID_ABI=arm64-v8a" \ -scripts/build.sh check-intrinsiccv +scripts/build.sh check-kleidicv ``` For further options please refer to the documentation in `./scripts/build.sh` @@ -105,7 +105,7 @@ cd opencv-4.9.0 ``` 2. Patch OpenCV: ``` -patch -p1" CACHE INTERNAL "") +set(KLEIDICV_HAL_LIBRARIES "kleidicv_hal" CACHE INTERNAL "") +set(KLEIDICV_HAL_HEADERS "${CMAKE_CURRENT_LIST_DIR}/kleidicv_hal.h" CACHE INTERNAL "") +set(KLEIDICV_HAL_INCLUDE_DIRS "$" CACHE INTERNAL "") -add_library(intrinsiccv_hal STATIC "${CMAKE_CURRENT_LIST_DIR}/intrinsiccv_hal.cpp") -target_link_libraries(intrinsiccv_hal PUBLIC intrinsiccv) -target_include_directories(intrinsiccv_hal PRIVATE - $ +add_library(kleidicv_hal STATIC "${CMAKE_CURRENT_LIST_DIR}/kleidicv_hal.cpp") +target_link_libraries(kleidicv_hal PUBLIC kleidicv) +target_include_directories(kleidicv_hal PRIVATE + $ ${CMAKE_CURRENT_LIST_DIR} ${OPENCV_SOURCE_DIR}/modules/core/include ${OPENCV_SOURCE_DIR}/modules/imgproc/include ) -target_compile_options(intrinsiccv_hal PRIVATE $) -set_target_properties(intrinsiccv_hal PROPERTIES CXX_STANDARD 17) +target_compile_options(kleidicv_hal PRIVATE $) +set_target_properties(kleidicv_hal PROPERTIES CXX_STANDARD 17) if(NOT BUILD_SHARED_LIBS) - ocv_install_target(intrinsiccv_neon + ocv_install_target(kleidicv_neon EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev ) if(KLEIDICV_BUILD_SVE2) - ocv_install_target(intrinsiccv_sve2 + ocv_install_target(kleidicv_sve2 EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} @@ -38,20 +38,20 @@ if(NOT BUILD_SHARED_LIBS) ) endif() if(KLEIDICV_BUILD_SME2) - ocv_install_target(intrinsiccv_sme2 + ocv_install_target(kleidicv_sme2 EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev ) endif() - ocv_install_target(intrinsiccv + ocv_install_target(kleidicv EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev ) - ocv_install_target(intrinsiccv_hal + ocv_install_target(kleidicv_hal EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} diff --git a/adapters/opencv/intrinsiccv_hal.cpp b/adapters/opencv/kleidicv_hal.cpp similarity index 76% rename from adapters/opencv/intrinsiccv_hal.cpp rename to adapters/opencv/kleidicv_hal.cpp index f114e8b15..7c98dd0fe 100644 --- a/adapters/opencv/intrinsiccv_hal.cpp +++ b/adapters/opencv/kleidicv_hal.cpp @@ -2,19 +2,19 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv_hal.h" +#include "kleidicv_hal.h" #include #include #include #include -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "opencv2/imgproc/hal/interface.h" -namespace intrinsiccv::hal { +namespace kleidicv::hal { -static int convert_error(intrinsiccv_error_t e) { +static int convert_error(kleidicv_error_t e) { switch (e) { case KLEIDICV_OK: return CV_HAL_ERROR_OK; @@ -54,11 +54,11 @@ int gray_to_bgr(const uchar *src_data, size_t src_step, uchar *dst_data, if (depth == CV_8U) { if (dcn == 3) { - return convert_error(intrinsiccv_gray_to_rgb_u8( + return convert_error(kleidicv_gray_to_rgb_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } - return convert_error(intrinsiccv_gray_to_rgba_u8( + return convert_error(kleidicv_gray_to_rgba_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } @@ -77,44 +77,44 @@ int bgr_to_bgr(const uchar *src_data, size_t src_step, uchar *dst_data, if (depth == CV_8U) { if (scn == 3 && dcn == 3) { if (swapBlue) { - return convert_error(intrinsiccv_rgb_to_bgr_u8( + return convert_error(kleidicv_rgb_to_bgr_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } - return convert_error(intrinsiccv_rgb_to_rgb_u8( + return convert_error(kleidicv_rgb_to_rgb_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } if (scn == 4 && dcn == 4) { if (swapBlue) { - return convert_error(intrinsiccv_rgba_to_bgra_u8( + return convert_error(kleidicv_rgba_to_bgra_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } - return convert_error(intrinsiccv_rgba_to_rgba_u8( + return convert_error(kleidicv_rgba_to_rgba_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } if (scn == 3 && dcn == 4) { if (swapBlue) { - return convert_error(intrinsiccv_rgb_to_bgra_u8( + return convert_error(kleidicv_rgb_to_bgra_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } - return convert_error(intrinsiccv_rgb_to_rgba_u8( + return convert_error(kleidicv_rgb_to_rgba_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } if (scn == 4 && dcn == 3) { if (swapBlue) { - return convert_error(intrinsiccv_rgba_to_bgr_u8( + return convert_error(kleidicv_rgba_to_bgr_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } - return convert_error(intrinsiccv_rgba_to_rgb_u8( + return convert_error(kleidicv_rgba_to_rgb_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } @@ -141,13 +141,13 @@ int yuv_to_bgr_ex(const uchar *y_data, size_t y_step, const uchar *uv_data, if (dcn == 3) { if (is_bgr) { - return convert_error(intrinsiccv_yuv_sp_to_bgr_u8( + return convert_error(kleidicv_yuv_sp_to_bgr_u8( reinterpret_cast(y_data), y_step, reinterpret_cast(uv_data), uv_step, reinterpret_cast(dst_data), dst_step, dst_width, dst_height, is_nv21)); } - return convert_error(intrinsiccv_yuv_sp_to_rgb_u8( + return convert_error(kleidicv_yuv_sp_to_rgb_u8( reinterpret_cast(y_data), y_step, reinterpret_cast(uv_data), uv_step, reinterpret_cast(dst_data), dst_step, dst_width, dst_height, @@ -156,13 +156,13 @@ int yuv_to_bgr_ex(const uchar *y_data, size_t y_step, const uchar *uv_data, if (dcn == 4) { if (is_bgr) { - return convert_error(intrinsiccv_yuv_sp_to_bgra_u8( + return convert_error(kleidicv_yuv_sp_to_bgra_u8( reinterpret_cast(y_data), y_step, reinterpret_cast(uv_data), uv_step, reinterpret_cast(dst_data), dst_step, dst_width, dst_height, is_nv21)); } - return convert_error(intrinsiccv_yuv_sp_to_rgba_u8( + return convert_error(kleidicv_yuv_sp_to_rgba_u8( reinterpret_cast(y_data), y_step, reinterpret_cast(uv_data), uv_step, reinterpret_cast(dst_data), dst_step, dst_width, dst_height, @@ -177,7 +177,7 @@ int threshold(const uchar *src_data, size_t src_step, uchar *dst_data, double thresh, double maxValue, int thresholdType) { if ((depth == CV_8U) && (thresholdType == 0 /* THRESH_BINARY */)) { size_t width_in_elements = width * cn; - return convert_error(intrinsiccv_threshold_binary_u8( + return convert_error(kleidicv_threshold_binary_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width_in_elements, height, static_cast(thresh), static_cast(maxValue))); @@ -188,30 +188,30 @@ int threshold(const uchar *src_data, size_t src_step, uchar *dst_data, // Converts an OpenCV border type to an KleidiCV border type. static int from_opencv(int opencv_border_type, - intrinsiccv_border_type_t &border_type) { + kleidicv_border_type_t &border_type) { switch (opencv_border_type) { default: return 1; case CV_HAL_BORDER_CONSTANT: - border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_CONSTANT; + border_type = kleidicv_border_type_t::KLEIDICV_BORDER_TYPE_CONSTANT; break; case CV_HAL_BORDER_REPLICATE: - border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_REPLICATE; + border_type = kleidicv_border_type_t::KLEIDICV_BORDER_TYPE_REPLICATE; break; case CV_HAL_BORDER_REFLECT: - border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_REFLECT; + border_type = kleidicv_border_type_t::KLEIDICV_BORDER_TYPE_REFLECT; break; case CV_HAL_BORDER_REFLECT_101: - border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_REVERSE; + border_type = kleidicv_border_type_t::KLEIDICV_BORDER_TYPE_REVERSE; break; case CV_HAL_BORDER_WRAP: - border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_WRAP; + border_type = kleidicv_border_type_t::KLEIDICV_BORDER_TYPE_WRAP; break; case CV_HAL_BORDER_TRANSPARENT: - border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_TRANSPARENT; + border_type = kleidicv_border_type_t::KLEIDICV_BORDER_TYPE_TRANSPARENT; break; case CV_HAL_BORDER_ISOLATED: - border_type = intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_NONE; + border_type = kleidicv_border_type_t::KLEIDICV_BORDER_TYPE_NONE; break; } @@ -244,50 +244,50 @@ int gaussian_blur(const uchar *src_data, size_t src_step, uchar *dst_data, return CV_HAL_ERROR_NOT_IMPLEMENTED; } - intrinsiccv_border_type_t intrinsiccv_border_type; - if (from_opencv(border_type, intrinsiccv_border_type)) { + kleidicv_border_type_t kleidicv_border_type; + if (from_opencv(border_type, kleidicv_border_type)) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } - decltype(intrinsiccv_gaussian_blur_3x3_u8) impl{nullptr}; + decltype(kleidicv_gaussian_blur_3x3_u8) impl{nullptr}; if ((ksize_width == 3) && (ksize_height == 3) && (width >= 3) && (height >= 3)) { - impl = intrinsiccv_gaussian_blur_3x3_u8; + impl = kleidicv_gaussian_blur_3x3_u8; } else if ((ksize_width == 5) && (ksize_height == 5) && (width >= 5) && (height >= 5)) { - impl = intrinsiccv_gaussian_blur_5x5_u8; + impl = kleidicv_gaussian_blur_5x5_u8; } else { return CV_HAL_ERROR_NOT_IMPLEMENTED; } - intrinsiccv_filter_context_t *context; + kleidicv_filter_context_t *context; size_t type_size = get_type_size(depth); if (type_size == SIZE_MAX) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } type_size *= 2; /* widening */ - intrinsiccv_rectangle_t image = { - .width = static_cast(width), - .height = static_cast(height)}; - if (intrinsiccv_error_t create_err = - intrinsiccv_filter_create(&context, cn, type_size, image)) { + kleidicv_rectangle_t image = { + .width = static_cast(width), + .height = static_cast(height)}; + if (kleidicv_error_t create_err = + kleidicv_filter_create(&context, cn, type_size, image)) { return convert_error(create_err); } - intrinsiccv_error_t blur_err = + kleidicv_error_t blur_err = impl(reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height, cn, - intrinsiccv_border_type, context); + kleidicv_border_type, context); - intrinsiccv_error_t release_err = intrinsiccv_filter_release(context); + kleidicv_error_t release_err = kleidicv_filter_release(context); return convert_error(blur_err ? blur_err : release_err); } struct MorphologyParams { - intrinsiccv_morphology_context_t *context; - decltype(intrinsiccv_dilate_u8) impl; + kleidicv_morphology_context_t *context; + decltype(kleidicv_dilate_u8) impl; }; int morphology_init(cvhalFilter2D **cvcontext, int operation, int src_type, @@ -312,14 +312,13 @@ int morphology_init(cvhalFilter2D **cvcontext, int operation, int src_type, return CV_HAL_ERROR_NOT_IMPLEMENTED; } - intrinsiccv_border_type_t border_type; + kleidicv_border_type_t border_type; if (from_opencv(cvborder_type, border_type)) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } - if (border_type != intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_CONSTANT && - border_type != - intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_REPLICATE) { + if (border_type != kleidicv_border_type_t::KLEIDICV_BORDER_TYPE_CONSTANT && + border_type != kleidicv_border_type_t::KLEIDICV_BORDER_TYPE_REPLICATE) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } @@ -330,7 +329,7 @@ int morphology_init(cvhalFilter2D **cvcontext, int operation, int src_type, switch (CV_MAT_DEPTH(kernel_type)) { case CV_8U: { size_t nonzero_count = 0; - if (intrinsiccv_error_t err = intrinsiccv_count_nonzeros_u8( + if (kleidicv_error_t err = kleidicv_count_nonzeros_u8( static_cast(kernel_data), kernel_step, kernel_width_sz, kernel_height_sz, &nonzero_count)) { return convert_error(err); @@ -356,8 +355,8 @@ int morphology_init(cvhalFilter2D **cvcontext, int operation, int src_type, return CV_HAL_ERROR_NOT_IMPLEMENTED; } - intrinsiccv_border_values_t border_values = {}; - if (border_type == intrinsiccv_border_type_t::KLEIDICV_BORDER_TYPE_CONSTANT) { + kleidicv_border_values_t border_values = {}; + if (border_type == kleidicv_border_type_t::KLEIDICV_BORDER_TYPE_CONSTANT) { border_values.top = cvborder_values[0]; border_values.left = cvborder_values[1]; border_values.bottom = cvborder_values[2]; @@ -380,24 +379,24 @@ int morphology_init(cvhalFilter2D **cvcontext, int operation, int src_type, switch (operation) { case CV_HAL_MORPH_DILATE: - params->impl = intrinsiccv_dilate_u8; + params->impl = kleidicv_dilate_u8; break; case CV_HAL_MORPH_ERODE: - params->impl = intrinsiccv_erode_u8; + params->impl = kleidicv_erode_u8; break; default: return CV_HAL_ERROR_NOT_IMPLEMENTED; } - if (intrinsiccv_error_t err = intrinsiccv_morphology_create( + if (kleidicv_error_t err = kleidicv_morphology_create( ¶ms->context, - intrinsiccv_rectangle_t{static_cast(kernel_width), - static_cast(kernel_height)}, - intrinsiccv_point_t{static_cast(anchor_x), - static_cast(anchor_y)}, + kleidicv_rectangle_t{static_cast(kernel_width), + static_cast(kernel_height)}, + kleidicv_point_t{static_cast(anchor_x), + static_cast(anchor_y)}, border_type, border_values, channels, iterations, type_size, - intrinsiccv_rectangle_t{static_cast(max_width), - static_cast(max_height)})) { + kleidicv_rectangle_t{static_cast(max_width), + static_cast(max_height)})) { return convert_error(err); } @@ -432,7 +431,7 @@ int morphology_operation(cvhalFilter2D *cvcontext, uchar *src_data, int morphology_free(cvhalFilter2D *cvcontext) { std::unique_ptr params( reinterpret_cast(cvcontext)); - return convert_error(intrinsiccv_morphology_release(params->context)); + return convert_error(kleidicv_morphology_release(params->context)); } int resize(int src_type, const uchar *src_data, size_t src_step, int src_width, @@ -456,7 +455,7 @@ int resize(int src_type, const uchar *src_data, size_t src_step, int src_width, case CV_HAL_INTER_LINEAR: if ((inv_scale_x == 0 || inv_scale_x == 2) && (inv_scale_y == 0 || inv_scale_y == 2)) { - return convert_error(intrinsiccv_resize_linear_u8( + return convert_error(kleidicv_resize_linear_u8( src_data, src_step, src_width, src_height, dst_data, dst_step, dst_width, dst_height)); } @@ -507,13 +506,13 @@ int sobel(const uchar *src_data, size_t src_step, uchar *dst_data, } if (dx == 1 && dy == 0) { - return convert_error(intrinsiccv_sobel_3x3_horizontal_s16_u8( + return convert_error(kleidicv_sobel_3x3_horizontal_s16_u8( src_data, src_step, reinterpret_cast(dst_data), dst_step, width, height, cn)); } if (dx == 0 && dy == 1) { - return convert_error(intrinsiccv_sobel_3x3_vertical_s16_u8( + return convert_error(kleidicv_sobel_3x3_vertical_s16_u8( src_data, src_step, reinterpret_cast(dst_data), dst_step, width, height, cn)); } @@ -541,11 +540,11 @@ int canny(const uchar *src_data, size_t src_step, uchar *dst_data, return CV_HAL_ERROR_NOT_IMPLEMENTED; } - return convert_error(intrinsiccv_canny_u8( - reinterpret_cast(src_data), src_step, - reinterpret_cast(dst_data), dst_step, - static_cast(width), static_cast(height), lowThreshold, - highThreshold)); + return convert_error( + kleidicv_canny_u8(reinterpret_cast(src_data), src_step, + reinterpret_cast(dst_data), dst_step, + static_cast(width), static_cast(height), + lowThreshold, highThreshold)); } #endif // KLEIDICV_EXPERIMENTAL_FEATURE_CANNY @@ -561,7 +560,7 @@ int transpose(const uchar *src_data, size_t src_step, uchar *dst_data, return CV_HAL_ERROR_NOT_IMPLEMENTED; } - return convert_error(intrinsiccv_transpose( + return convert_error(kleidicv_transpose( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, static_cast(src_width), static_cast(src_height), @@ -569,14 +568,13 @@ int transpose(const uchar *src_data, size_t src_step, uchar *dst_data, } template -intrinsiccv_error_t call_min_max(FunctionType min_max_func, - const uchar *src_data, size_t src_stride, - int width, int height, double *min_value, - double *max_value) { +kleidicv_error_t call_min_max(FunctionType min_max_func, const uchar *src_data, + size_t src_stride, int width, int height, + double *min_value, double *max_value) { T tmp_min_value, tmp_max_value; T *p_min_value = min_value ? &tmp_min_value : nullptr; T *p_max_value = max_value ? &tmp_max_value : nullptr; - intrinsiccv_error_t err = + kleidicv_error_t err = min_max_func(reinterpret_cast(src_data), src_stride, static_cast(width), static_cast(height), p_min_value, p_max_value); @@ -590,16 +588,16 @@ intrinsiccv_error_t call_min_max(FunctionType min_max_func, } template -intrinsiccv_error_t call_min_max_loc(FunctionType min_max_loc_func, - const uchar *src_data, size_t src_stride, - int width, int height, double *min_value, - double *max_value, int *min_index, - int *max_index) { +kleidicv_error_t call_min_max_loc(FunctionType min_max_loc_func, + const uchar *src_data, size_t src_stride, + int width, int height, double *min_value, + double *max_value, int *min_index, + int *max_index) { size_t tmp_min_offset, tmp_max_offset; size_t *p_min_offset = (min_value || min_index) ? &tmp_min_offset : nullptr; size_t *p_max_offset = (max_value || max_index) ? &tmp_max_offset : nullptr; - intrinsiccv_error_t err = + kleidicv_error_t err = min_max_loc_func(reinterpret_cast(src_data), src_stride, static_cast(width), static_cast(height), p_min_offset, p_max_offset); @@ -630,7 +628,7 @@ int min_max_idx(const uchar *src_data, size_t src_step, int width, int height, if (minIdx || maxIdx) { if (depth == CV_8U) { return convert_error(call_min_max_loc( - intrinsiccv_min_max_loc_u8, src_data, src_step, width, height, minVal, + kleidicv_min_max_loc_u8, src_data, src_step, width, height, minVal, maxVal, minIdx, maxIdx)); } return CV_HAL_ERROR_NOT_IMPLEMENTED; @@ -638,25 +636,25 @@ int min_max_idx(const uchar *src_data, size_t src_step, int width, int height, switch (depth) { case CV_8S: - return convert_error(call_min_max(intrinsiccv_min_max_s8, - src_data, src_step, width, - height, minVal, maxVal)); + return convert_error(call_min_max(kleidicv_min_max_s8, src_data, + src_step, width, height, minVal, + maxVal)); case CV_8U: - return convert_error(call_min_max(intrinsiccv_min_max_u8, - src_data, src_step, width, - height, minVal, maxVal)); + return convert_error(call_min_max(kleidicv_min_max_u8, src_data, + src_step, width, height, + minVal, maxVal)); case CV_16S: - return convert_error(call_min_max(intrinsiccv_min_max_s16, - src_data, src_step, width, - height, minVal, maxVal)); + return convert_error(call_min_max(kleidicv_min_max_s16, src_data, + src_step, width, height, + minVal, maxVal)); case CV_16U: - return convert_error(call_min_max(intrinsiccv_min_max_u16, + return convert_error(call_min_max(kleidicv_min_max_u16, src_data, src_step, width, height, minVal, maxVal)); case CV_32S: - return convert_error(call_min_max(intrinsiccv_min_max_s32, - src_data, src_step, width, - height, minVal, maxVal)); + return convert_error(call_min_max(kleidicv_min_max_s32, src_data, + src_step, width, height, + minVal, maxVal)); default: return CV_HAL_ERROR_NOT_IMPLEMENTED; } @@ -674,7 +672,7 @@ int convertTo(const uchar *src_data, size_t src_step, int src_depth, } if (src_depth == CV_8U) { - return convert_error(intrinsiccv_scale_u8( + return convert_error(kleidicv_scale_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height, static_cast(scale), static_cast(shift))); @@ -686,25 +684,25 @@ int convertTo(const uchar *src_data, size_t src_step, int src_depth, if (scale == 1.0 && shift == 0.0) { // float32 to int8 if (src_depth == CV_32F && dst_depth == CV_8S) { - return convert_error(intrinsiccv_float_conversion_f32_s8( + return convert_error(kleidicv_float_conversion_f32_s8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } // float32 to uint8 if (src_depth == CV_32F && dst_depth == CV_8U) { - return convert_error(intrinsiccv_float_conversion_f32_u8( + return convert_error(kleidicv_float_conversion_f32_u8( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } // int8 to float32 if (src_depth == CV_8S && dst_depth == CV_32F) { - return convert_error(intrinsiccv_float_conversion_s8_f32( + return convert_error(kleidicv_float_conversion_s8_f32( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } // uint8 to float32 if (src_depth == CV_8U && dst_depth == CV_32F) { - return convert_error(intrinsiccv_float_conversion_u8_f32( + return convert_error(kleidicv_float_conversion_u8_f32( reinterpret_cast(src_data), src_step, reinterpret_cast(dst_data), dst_step, width, height)); } @@ -712,4 +710,4 @@ int convertTo(const uchar *src_data, size_t src_step, int src_depth, return CV_HAL_ERROR_NOT_IMPLEMENTED; } -} // namespace intrinsiccv::hal +} // namespace kleidicv::hal diff --git a/adapters/opencv/intrinsiccv_hal.h b/adapters/opencv/kleidicv_hal.h similarity index 84% rename from adapters/opencv/intrinsiccv_hal.h rename to adapters/opencv/kleidicv_hal.h index e17ea035f..c71616138 100644 --- a/adapters/opencv/intrinsiccv_hal.h +++ b/adapters/opencv/kleidicv_hal.h @@ -8,18 +8,18 @@ #include #include -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "opencv2/core/hal/interface.h" // Forward declarations of OpenCV internals. struct cvhalFilter2D; // Implemented HAL interfaces. -namespace intrinsiccv { +namespace kleidicv { namespace hal { // Macros to shorten repeated code. -#define KLEIDICV_HAL_API(api) (intrinsiccv::hal::api) +#define KLEIDICV_HAL_API(api) (kleidicv::hal::api) int gray_to_bgr(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int depth, int dcn); @@ -93,21 +93,20 @@ int convertTo(const uchar *src_data, size_t src_step, int src_depth, int height, double scale, double shift); } // namespace hal -} // namespace intrinsiccv +} // namespace kleidicv // Other HAL implementations might require the cv namespace namespace cv { -#define KLEIDICV_HAL_FALLBACK_FORWARD(intrinsiccv_impl, fallback_hal_impl, \ - ...) \ - (KLEIDICV_HAL_API(intrinsiccv_impl)(__VA_ARGS__) == CV_HAL_ERROR_OK \ - ? CV_HAL_ERROR_OK \ +#define KLEIDICV_HAL_FALLBACK_FORWARD(kleidicv_impl, fallback_hal_impl, ...) \ + (KLEIDICV_HAL_API(kleidicv_impl)(__VA_ARGS__) == CV_HAL_ERROR_OK \ + ? CV_HAL_ERROR_OK \ : fallback_hal_impl(__VA_ARGS__)) #ifdef OPENCV_IMGPROC_HAL_REPLACEMENT_HPP // gray_to_bgr -static inline int intrinsiccv_gray_to_bgr_with_fallback( +static inline int kleidicv_gray_to_bgr_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int depth, int dcn) { return KLEIDICV_HAL_FALLBACK_FORWARD(gray_to_bgr, cv_hal_cvtGraytoBGR, @@ -115,10 +114,10 @@ static inline int intrinsiccv_gray_to_bgr_with_fallback( width, height, depth, dcn); } #undef cv_hal_cvtGraytoBGR -#define cv_hal_cvtGraytoBGR intrinsiccv_gray_to_bgr_with_fallback +#define cv_hal_cvtGraytoBGR kleidicv_gray_to_bgr_with_fallback // bgr_to_bgr -static inline int intrinsiccv_bgr_to_bgr_with_fallback( +static inline int kleidicv_bgr_to_bgr_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int depth, int scn, int dcn, bool swapBlue) { return KLEIDICV_HAL_FALLBACK_FORWARD(bgr_to_bgr, cv_hal_cvtBGRtoBGR, src_data, @@ -126,10 +125,10 @@ static inline int intrinsiccv_bgr_to_bgr_with_fallback( height, depth, scn, dcn, swapBlue); } #undef cv_hal_cvtBGRtoBGR -#define cv_hal_cvtBGRtoBGR intrinsiccv_bgr_to_bgr_with_fallback +#define cv_hal_cvtBGRtoBGR kleidicv_bgr_to_bgr_with_fallback // yuv_to_bgr -static inline int intrinsiccv_yuv_to_bgr_with_fallback( +static inline int kleidicv_yuv_to_bgr_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int dst_width, int dst_height, int dcn, bool swapBlue, int uIdx) { return KLEIDICV_HAL_FALLBACK_FORWARD( @@ -137,10 +136,10 @@ static inline int intrinsiccv_yuv_to_bgr_with_fallback( dst_step, dst_width, dst_height, dcn, swapBlue, uIdx); } #undef cv_hal_cvtTwoPlaneYUVtoBGR -#define cv_hal_cvtTwoPlaneYUVtoBGR intrinsiccv_yuv_to_bgr_with_fallback +#define cv_hal_cvtTwoPlaneYUVtoBGR kleidicv_yuv_to_bgr_with_fallback // yuv_to_bgr_ex -static inline int intrinsiccv_yuv_to_bgr_ex_with_fallback( +static inline int kleidicv_yuv_to_bgr_ex_with_fallback( const uchar *y_data, size_t y_step, const uchar *uv_data, size_t uv_step, uchar *dst_data, size_t dst_step, int dst_width, int dst_height, int dcn, bool swapBlue, int uIdx) { @@ -149,10 +148,10 @@ static inline int intrinsiccv_yuv_to_bgr_ex_with_fallback( uv_step, dst_data, dst_step, dst_width, dst_height, dcn, swapBlue, uIdx); } #undef cv_hal_cvtTwoPlaneYUVtoBGREx -#define cv_hal_cvtTwoPlaneYUVtoBGREx intrinsiccv_yuv_to_bgr_ex_with_fallback +#define cv_hal_cvtTwoPlaneYUVtoBGREx kleidicv_yuv_to_bgr_ex_with_fallback // threshold -static inline int intrinsiccv_threshold_with_fallback( +static inline int kleidicv_threshold_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int depth, int cn, double thresh, double maxValue, int thresholdType) { @@ -161,10 +160,10 @@ static inline int intrinsiccv_threshold_with_fallback( width, height, depth, cn, thresh, maxValue, thresholdType); } #undef cv_hal_threshold -#define cv_hal_threshold intrinsiccv_threshold_with_fallback +#define cv_hal_threshold kleidicv_threshold_with_fallback // gaussian_blur -static inline int intrinsiccv_gaussian_blur_with_fallback( +static inline int kleidicv_gaussian_blur_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int depth, int cn, size_t margin_left, size_t margin_top, size_t margin_right, size_t margin_bottom, @@ -176,10 +175,10 @@ static inline int intrinsiccv_gaussian_blur_with_fallback( margin_bottom, ksize_width, ksize_height, sigmaX, sigmaY, border_type); } #undef cv_hal_gaussianBlur -#define cv_hal_gaussianBlur intrinsiccv_gaussian_blur_with_fallback +#define cv_hal_gaussianBlur kleidicv_gaussian_blur_with_fallback // morphology_init -static inline int intrinsiccv_morphology_init_with_fallback( +static inline int kleidicv_morphology_init_with_fallback( cvhalFilter2D **context, int operation, int src_type, int dst_type, int max_width, int max_height, int kernel_type, uchar *kernel_data, size_t kernel_step, int kernel_width, int kernel_height, int anchor_x, @@ -192,10 +191,10 @@ static inline int intrinsiccv_morphology_init_with_fallback( border_values, iterations, allow_submatrix, allow_in_place); } #undef cv_hal_morphInit -#define cv_hal_morphInit intrinsiccv_morphology_init_with_fallback +#define cv_hal_morphInit kleidicv_morphology_init_with_fallback // morphology_operation -static inline int intrinsiccv_morphology_operation_with_fallback( +static inline int kleidicv_morphology_operation_with_fallback( cvhalFilter2D *context, uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int src_full_width, int src_full_height, int src_roi_x, int src_roi_y, int dst_full_width, @@ -206,19 +205,19 @@ static inline int intrinsiccv_morphology_operation_with_fallback( src_roi_y, dst_full_width, dst_full_height, dst_roi_x, dst_roi_y); } #undef cv_hal_morph -#define cv_hal_morph intrinsiccv_morphology_operation_with_fallback +#define cv_hal_morph kleidicv_morphology_operation_with_fallback // morphology_free -static inline int intrinsiccv_morphology_free_with_fallback( +static inline int kleidicv_morphology_free_with_fallback( cvhalFilter2D *context) { return KLEIDICV_HAL_FALLBACK_FORWARD(morphology_free, cv_hal_morphFree, context); } #undef cv_hal_morphFree -#define cv_hal_morphFree intrinsiccv_morphology_free_with_fallback +#define cv_hal_morphFree kleidicv_morphology_free_with_fallback // resize -static inline int intrinsiccv_resize_with_fallback( +static inline int kleidicv_resize_with_fallback( int src_type, const uchar *src_data, size_t src_step, int src_width, int src_height, uchar *dst_data, size_t dst_step, int dst_width, int dst_height, double inv_scale_x, double inv_scale_y, int interpolation) { @@ -228,10 +227,10 @@ static inline int intrinsiccv_resize_with_fallback( inv_scale_y, interpolation); } #undef cv_hal_resize -#define cv_hal_resize intrinsiccv_resize_with_fallback +#define cv_hal_resize kleidicv_resize_with_fallback // sobel -static inline int intrinsiccv_sobel_with_fallback( +static inline int kleidicv_sobel_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int src_depth, int dst_depth, int cn, int margin_left, int margin_top, int margin_right, int margin_bottom, @@ -242,11 +241,11 @@ static inline int intrinsiccv_sobel_with_fallback( margin_bottom, dx, dy, ksize, scale, delta, border_type); } #undef cv_hal_sobel -#define cv_hal_sobel intrinsiccv_sobel_with_fallback +#define cv_hal_sobel kleidicv_sobel_with_fallback #if KLEIDICV_EXPERIMENTAL_FEATURE_CANNY // canny -static inline int intrinsiccv_canny_with_fallback( +static inline int kleidicv_canny_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, int cn, double lowThreshold, double highThreshold, int ksize, bool L2gradient) { @@ -255,7 +254,7 @@ static inline int intrinsiccv_canny_with_fallback( height, cn, lowThreshold, highThreshold, ksize, L2gradient); } #undef cv_hal_canny -#define cv_hal_canny intrinsiccv_canny_with_fallback +#define cv_hal_canny kleidicv_canny_with_fallback #endif // KLEIDICV_EXPERIMENTAL_FEATURE_CANNY #endif // OPENCV_IMGPROC_HAL_REPLACEMENT_HPP @@ -263,7 +262,7 @@ static inline int intrinsiccv_canny_with_fallback( #ifdef OPENCV_CORE_HAL_REPLACEMENT_HPP // transpose -static inline int intrinsiccv_transpose_with_fallback( +static inline int kleidicv_transpose_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int src_width, int src_height, int element_size) { return KLEIDICV_HAL_FALLBACK_FORWARD(transpose, cv_hal_transpose, src_data, @@ -271,10 +270,10 @@ static inline int intrinsiccv_transpose_with_fallback( src_height, element_size); } #undef cv_hal_transpose -#define cv_hal_transpose intrinsiccv_transpose_with_fallback +#define cv_hal_transpose kleidicv_transpose_with_fallback // min_max_idx -static inline int intrinsiccv_min_max_idx_with_fallback( +static inline int kleidicv_min_max_idx_with_fallback( const uchar *src_data, size_t src_stride, int width, int height, int depth, double *min_value, double *max_value, int *min_index, int *max_index, uchar *mask) { @@ -283,9 +282,9 @@ static inline int intrinsiccv_min_max_idx_with_fallback( min_value, max_value, min_index, max_index, mask); } #undef cv_hal_minMaxIdx -#define cv_hal_minMaxIdx intrinsiccv_min_max_idx_with_fallback +#define cv_hal_minMaxIdx kleidicv_min_max_idx_with_fallback -static inline int intrinsiccv_convertTo_with_fallback( +static inline int kleidicv_convertTo_with_fallback( const uchar *src_data, size_t src_step, int src_depth, uchar *dst_data, size_t dst_step, int dst_depth, int width, int height, double scale, double shift) { @@ -294,7 +293,7 @@ static inline int intrinsiccv_convertTo_with_fallback( dst_depth, width, height, scale, shift); } #undef cv_hal_convertTo -#define cv_hal_convertTo intrinsiccv_convertTo_with_fallback +#define cv_hal_convertTo kleidicv_convertTo_with_fallback #endif // OPENCV_CORE_HAL_REPLACEMENT_HPP diff --git a/adapters/opencv/opencv-4.9.patch b/adapters/opencv/opencv-4.9.patch index dc7e3dcb8..6cff33613 100644 --- a/adapters/opencv/opencv-4.9.patch +++ b/adapters/opencv/opencv-4.9.patch @@ -2,13 +2,13 @@ // // SPDX-License-Identifier: Apache-2.0 -diff --git a/3rdparty/intrinsiccv/CMakeLists.txt b/3rdparty/intrinsiccv/CMakeLists.txt +diff --git a/3rdparty/kleidicv/CMakeLists.txt b/3rdparty/kleidicv/CMakeLists.txt new file mode 100644 index 0000000000..c0ffb73ad7 --- /dev/null -+++ b/3rdparty/intrinsiccv/CMakeLists.txt ++++ b/3rdparty/kleidicv/CMakeLists.txt @@ -0,0 +1,3 @@ -+set(KLEIDICV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/intrinsiccv" CACHE PATH "Directory containing KleidiCV sources") ++set(KLEIDICV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/kleidicv" CACHE PATH "Directory containing KleidiCV sources") + +include("${KLEIDICV_SOURCE_PATH}/adapters/opencv/CMakeLists.txt") diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -39,8 +39,8 @@ index 5da9c2a695..3f1a2c7e38 100644 +if(WITH_KLEIDICV) + ocv_debug_message(STATUS "Enable KleidiCV acceleration") -+ if(NOT ";${OpenCV_HAL};" MATCHES ";intrinsiccv;") -+ set(OpenCV_HAL "intrinsiccv;${OpenCV_HAL}") ++ if(NOT ";${OpenCV_HAL};" MATCHES ";kleidicv;") ++ set(OpenCV_HAL "kleidicv;${OpenCV_HAL}") + endif() +endif() + @@ -51,8 +51,8 @@ index 5da9c2a695..3f1a2c7e38 100644 else() message(STATUS "Carotene: NEON is not available, disabling carotene...") endif() -+ elseif(hal STREQUAL "intrinsiccv") -+ add_subdirectory(3rdparty/intrinsiccv) ++ elseif(hal STREQUAL "kleidicv") ++ add_subdirectory(3rdparty/kleidicv) + ocv_hal_register(KLEIDICV_HAL_LIBRARIES KLEIDICV_HAL_HEADERS KLEIDICV_HAL_INCLUDE_DIRS) + list(APPEND OpenCV_USED_HAL "KleidiCV (ver ${KLEIDICV_HAL_VERSION})") elseif(hal STREQUAL "openvx") diff --git a/adapters/opencv/opencv-5.x.patch b/adapters/opencv/opencv-5.x.patch index 5b6439657..0748e0b4b 100644 --- a/adapters/opencv/opencv-5.x.patch +++ b/adapters/opencv/opencv-5.x.patch @@ -2,13 +2,13 @@ // // SPDX-License-Identifier: Apache-2.0 -diff --git a/3rdparty/intrinsiccv/CMakeLists.txt b/3rdparty/intrinsiccv/CMakeLists.txt +diff --git a/3rdparty/kleidicv/CMakeLists.txt b/3rdparty/kleidicv/CMakeLists.txt new file mode 100644 index 0000000000..c0ffb73ad7 --- /dev/null -+++ b/3rdparty/intrinsiccv/CMakeLists.txt ++++ b/3rdparty/kleidicv/CMakeLists.txt @@ -0,0 +1,3 @@ -+set(KLEIDICV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/intrinsiccv" CACHE PATH "Directory containing KleidiCV sources") ++set(KLEIDICV_SOURCE_PATH "${CMAKE_SOURCE_DIR}/kleidicv" CACHE PATH "Directory containing KleidiCV sources") + +include("${KLEIDICV_SOURCE_PATH}/adapters/opencv/CMakeLists.txt") diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -39,8 +39,8 @@ index 4a628c1a6a..999df2657d 100644 +if(WITH_KLEIDICV) + ocv_debug_message(STATUS "Enable KleidiCV acceleration") -+ if(NOT ";${OpenCV_HAL};" MATCHES ";intrinsiccv;") -+ set(OpenCV_HAL "intrinsiccv;${OpenCV_HAL}") ++ if(NOT ";${OpenCV_HAL};" MATCHES ";kleidicv;") ++ set(OpenCV_HAL "kleidicv;${OpenCV_HAL}") + endif() +endif() + @@ -51,8 +51,8 @@ index 4a628c1a6a..999df2657d 100644 else() message(STATUS "Carotene: NEON is not available, disabling carotene...") endif() -+ elseif(hal STREQUAL "intrinsiccv") -+ add_subdirectory(3rdparty/intrinsiccv) ++ elseif(hal STREQUAL "kleidicv") ++ add_subdirectory(3rdparty/kleidicv) + ocv_hal_register(KLEIDICV_HAL_LIBRARIES KLEIDICV_HAL_HEADERS KLEIDICV_HAL_INCLUDE_DIRS) + list(APPEND OpenCV_USED_HAL "KleidiCV (ver ${KLEIDICV_HAL_VERSION})") elseif(hal STREQUAL "openvx") diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 862a81efb..9f29557cb 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -24,8 +24,8 @@ FetchContent_MakeAvailable(benchmark) set(KLEIDICV_INCLUDE_DIR - ${CMAKE_CURRENT_SOURCE_DIR}/../intrinsiccv/include - ${CMAKE_CURRENT_BINARY_DIR}/../intrinsiccv/include + ${CMAKE_CURRENT_SOURCE_DIR}/../kleidicv/include + ${CMAKE_CURRENT_BINARY_DIR}/../kleidicv/include ) set(KLEIDICV_BENCHMARK_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) @@ -42,32 +42,32 @@ else() list(APPEND KLEIDICV_BENCHMARK_CXX_FLAGS "-O2" "-g0") endif() -file(GLOB intrinsiccv_benchmark_sources CONFIGURE_DEPENDS "*.h" "*.cpp") +file(GLOB kleidicv_benchmark_sources CONFIGURE_DEPENDS "*.h" "*.cpp") set_source_files_properties( - ${intrinsiccv_benchmark_sources} + ${kleidicv_benchmark_sources} PROPERTIES COMPILE_OPTIONS "${KLEIDICV_BENCHMARK_CXX_FLAGS}" ) add_executable( - intrinsiccv-benchmark - ${intrinsiccv_benchmark_sources} + kleidicv-benchmark + ${kleidicv_benchmark_sources} ) set_target_properties( - intrinsiccv-benchmark + kleidicv-benchmark PROPERTIES CXX_STANDARD 17 ) target_include_directories( - intrinsiccv-benchmark + kleidicv-benchmark PRIVATE ${KLEIDICV_INCLUDE_DIR} PRIVATE ${KLEIDICV_BENCHMARK_INCLUDE_DIR} ) target_link_libraries( - intrinsiccv-benchmark - intrinsiccv + kleidicv-benchmark + kleidicv benchmark::benchmark ) diff --git a/benchmark/benchmark.cpp b/benchmark/benchmark.cpp index ab24e096d..a884e9aeb 100644 --- a/benchmark/benchmark.cpp +++ b/benchmark/benchmark.cpp @@ -7,7 +7,7 @@ #include #include -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" extern size_t image_width, image_height; @@ -31,10 +31,10 @@ static void bench_binary_op(Function f, benchmark::State& state) { } } -#define BENCH_BINARY_OP(name, type) \ - static void name(benchmark::State& state) { \ - bench_binary_op(intrinsiccv_##name, state); \ - } \ +#define BENCH_BINARY_OP(name, type) \ + static void name(benchmark::State& state) { \ + bench_binary_op(kleidicv_##name, state); \ + } \ BENCHMARK(name) BENCH_BINARY_OP(saturating_add_s8, int8_t); @@ -53,8 +53,8 @@ static void min_max_loc_u8(benchmark::State& state) { for (auto _ : state) { // This code gets benchmarked auto unused = - intrinsiccv_min_max_loc_u8(src.data(), image_width, image_width, - image_height, &min_offset, &max_offset); + kleidicv_min_max_loc_u8(src.data(), image_width, image_width, + image_height, &min_offset, &max_offset); (void)unused; } } @@ -75,9 +75,9 @@ static void resize_linear_u8(size_t scale_x, size_t scale_y, for (auto _ : state) { // This code gets benchmarked - auto unused = intrinsiccv_resize_linear_u8( - src.data(), src_width, src_width, src_height, dst.data(), dst_width, - dst_width, dst_height); + auto unused = + kleidicv_resize_linear_u8(src.data(), src_width, src_width, src_height, + dst.data(), dst_width, dst_width, dst_height); (void)unused; } } diff --git a/intrinsiccv/include/intrinsiccv/conversions/gray_to_rgb.h b/intrinsiccv/include/intrinsiccv/conversions/gray_to_rgb.h deleted file mode 100644 index a9644c05d..000000000 --- a/intrinsiccv/include/intrinsiccv/conversions/gray_to_rgb.h +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#ifndef KLEIDICV_CONVERSIONS_GRAY_TO_RGB_H -#define KLEIDICV_CONVERSIONS_GRAY_TO_RGB_H - -#include "intrinsiccv/intrinsiccv.h" - -namespace intrinsiccv { - -namespace neon { - -intrinsiccv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -intrinsiccv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -} // namespace neon - -namespace sve2 { - -intrinsiccv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -intrinsiccv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -} // namespace sve2 - -namespace sme2 { - -intrinsiccv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -intrinsiccv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -} // namespace sme2 - -} // namespace intrinsiccv - -#endif // KLEIDICV_CONVERSIONS_GRAY_TO_RGB_H diff --git a/intrinsiccv/include/intrinsiccv/conversions/merge.h b/intrinsiccv/include/intrinsiccv/conversions/merge.h deleted file mode 100644 index 26729df5f..000000000 --- a/intrinsiccv/include/intrinsiccv/conversions/merge.h +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#ifndef KLEIDICV_CONVERSIONS_MERGE_H -#define KLEIDICV_CONVERSIONS_MERGE_H - -#include "intrinsiccv/intrinsiccv.h" - -namespace intrinsiccv { - -namespace neon { - -intrinsiccv_error_t merge(const void **srcs, const size_t *src_strides, - void *dst, size_t dst_stride, size_t width, - size_t height, size_t channels, size_t element_size); - -} // namespace neon - -} // namespace intrinsiccv - -#endif // KLEIDICV_CONVERSIONS_MERGE_H diff --git a/intrinsiccv/include/intrinsiccv/conversions/rgb_to_rgb.h b/intrinsiccv/include/intrinsiccv/conversions/rgb_to_rgb.h deleted file mode 100644 index b06387800..000000000 --- a/intrinsiccv/include/intrinsiccv/conversions/rgb_to_rgb.h +++ /dev/null @@ -1,88 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#ifndef KLEIDICV_CONVERSIONS_RGB_TO_RGB_H -#define KLEIDICV_CONVERSIONS_RGB_TO_RGB_H - -#include "intrinsiccv/intrinsiccv.h" - -namespace intrinsiccv { - -namespace neon { - -intrinsiccv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, size_t width, - size_t height); -intrinsiccv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); -intrinsiccv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); -intrinsiccv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); -intrinsiccv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); -intrinsiccv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -} // namespace neon - -namespace sve2 { - -intrinsiccv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, size_t width, - size_t height); -intrinsiccv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); -intrinsiccv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); -intrinsiccv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); -intrinsiccv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); -intrinsiccv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -} // namespace sve2 - -namespace sme2 { - -intrinsiccv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, size_t width, - size_t height); - -intrinsiccv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -intrinsiccv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -intrinsiccv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -intrinsiccv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -intrinsiccv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height); - -} // namespace sme2 - -} // namespace intrinsiccv - -#endif // KLEIDICV_CONVERSIONS_RGB_TO_RGB_H diff --git a/intrinsiccv/include/intrinsiccv/conversions/split.h b/intrinsiccv/include/intrinsiccv/conversions/split.h deleted file mode 100644 index bbff67777..000000000 --- a/intrinsiccv/include/intrinsiccv/conversions/split.h +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#ifndef KLEIDICV_CONVERSIONS_SPLIT_H -#define KLEIDICV_CONVERSIONS_SPLIT_H - -#include - -#include "intrinsiccv/ctypes.h" - -namespace intrinsiccv { - -namespace neon { - -intrinsiccv_error_t split(const void *src_data, size_t src_stride, - void **dst_data, const size_t *dst_strides, - size_t width, size_t height, size_t channels, - size_t element_size); - -} // namespace neon - -} // namespace intrinsiccv - -#endif // KLEIDICV_CONVERSIONS_SPLIT_H diff --git a/intrinsiccv/include/intrinsiccv/conversions/yuv_to_rgb.h b/intrinsiccv/include/intrinsiccv/conversions/yuv_to_rgb.h deleted file mode 100644 index 89e311859..000000000 --- a/intrinsiccv/include/intrinsiccv/conversions/yuv_to_rgb.h +++ /dev/null @@ -1,169 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#ifndef KLEIDICV_CONVERSIONS_YUV_TO_RGB_H -#define KLEIDICV_CONVERSIONS_YUV_TO_RGB_H - -#include "intrinsiccv/intrinsiccv.h" - -namespace intrinsiccv { - -/* Analog YUV to RGB conversion according to ITU-R BT.601-7 in matrix form: - - [ Ya ] = [ 0.299 0.587 0.114 ] [ Ra ] - [ Ua ] = [ -0.299 -0.587 0.886 ] [ Ga ] - [ Va ] = [ 0.701 -0.587 -0.114 ] [ Ba ] - -After re-normalization of the analog signal: - - Yan = Ya - Uan = Ua / 1.722 - Van = Va / 1.402 - - [ Yan ] = [ 0.299000 0.587000 0.114000 ] [ Ra ] - [ Uan ] = [ -0.168736 -0.331264 0.500000 ] [ Ga ] - [ Van ] = [ 0.500000 -0.418688 -0.081312 ] [ Ba ] - -Inverse transformation: - - [ Ra ] = [ 1.000000 0.000000 1.402000 ] [ Yan ] - [ Ga ] = [ 1.000000 -0.344136 -0.714136 ] [ Uan ] - [ Ba ] = [ 1.000000 1.772000 0.000000 ] [ Van ] - -Inverse transformation after quantization: - - Y' = saturating_subtract(Yan - 16) - U' = Uan - 128 - V' = Van - 128 - - R = 255 / 219 * Ra - G = 255 / 224 * Ga - B = 255 / 224 * Ba - - [ R ] = [ 1.164384 0.000000 1.596027 ] [ Y' ] - [ G ] = [ 1.164384 -0.391762 -0.812967 ] [ U' ] - [ B ] = [ 1.164384 2.017232 0.000000 ] [ V' ] - -The values used in this implementation are the following: - - [ R ] = [ 1.164000 0.000000 1.596000 ] [ Y' ] - [ G ] = [ 1.164000 -0.391000 -0.813000 ] [ U' ] - [ B ] = [ 1.164000 2.018000 0.000000 ] [ V' ] - -With 20 bit scaling and rounding, the integer constants are: - - [ R ] = [ 1,220,542 0 1,673,527 ] [ Y' ] - [ G ] = [ 1,220,542 - 409,993 -852,492 ] [ U' ] + (1 << 19) >> 20 - [ B ] = [ 1,220,542 2,116,026 0 ] [ V' ] - -The final results are calculated using roundign shift right and saturating -to 8 bit unsigned values: - - X = saturating_cast((X' + (1 << 19)) >> 20) - -The estimated error is then: - - [ R ] = [ 0.000000 0.000000 -0.000000 ] [ Y' ] - [ G ] = [ 0.000000 -0.000000 -0.000000 ] [ U' ] - [ B ] = [ 0.000000 -0.000000 0.000000 ] [ V' ] - -Sources: - [1] https://www.itu.int/rec/R-REC-BT.601 -*/ - -// Weights according to the calculation at the top of this file. -static constexpr size_t kWeightScale = 20; -static constexpr int32_t kYWeight = /* Weight(Y) */ 1220542; -static constexpr size_t kRVWeightIndex = 0; -static constexpr size_t kGUWeightIndex = 1; -static constexpr size_t kGVWeightIndex = 2; -static constexpr size_t kBUWeightIndex = 3; -static constexpr int32_t kUVWeights[4] = { - /* Weight(RV) */ 1673527, - /* Weight(GU) */ -409993, - /* Weight(GV) */ -852492, - /* Weight(BU) */ 2116026, -}; - -namespace neon { -intrinsiccv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); - -intrinsiccv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); - -intrinsiccv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); - -intrinsiccv_error_t yuv_sp_to_bgra_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); -} // namespace neon - -namespace sve2 { -intrinsiccv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); - -intrinsiccv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); - -intrinsiccv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); - -intrinsiccv_error_t yuv_sp_to_bgra_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); -} // namespace sve2 - -namespace sme2 { -intrinsiccv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); - -intrinsiccv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); - -intrinsiccv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); - -intrinsiccv_error_t yuv_sp_to_bgra_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21); -} // namespace sme2 - -} // namespace intrinsiccv - -#endif // KLEIDICV_CONVERSIONS_YUV_TO_RGB_H diff --git a/intrinsiccv/include/intrinsiccv/filters/gaussian_blur.h b/intrinsiccv/include/intrinsiccv/filters/gaussian_blur.h deleted file mode 100644 index 4a3840639..000000000 --- a/intrinsiccv/include/intrinsiccv/filters/gaussian_blur.h +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#ifndef KLEIDICV_FILTERS_GAUSSIAN_BLUR_H -#define KLEIDICV_FILTERS_GAUSSIAN_BLUR_H - -#include "intrinsiccv/config.h" -#include "intrinsiccv/types.h" - -namespace intrinsiccv { - -namespace neon { - -intrinsiccv_error_t gaussian_blur_3x3_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height, - size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context); - -intrinsiccv_error_t gaussian_blur_5x5_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height, - size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context); - -} // namespace neon - -namespace sve2 { - -intrinsiccv_error_t gaussian_blur_5x5_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height, - size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context); - -} // namespace sve2 - -namespace sme2 { - -intrinsiccv_error_t gaussian_blur_5x5_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height, - size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context); - -} // namespace sme2 - -} // namespace intrinsiccv - -#endif // KLEIDICV_FILTERS_GAUSSIAN_BLUR_H diff --git a/intrinsiccv/include/intrinsiccv/filters/sobel.h b/intrinsiccv/include/intrinsiccv/filters/sobel.h deleted file mode 100644 index 73d8e06aa..000000000 --- a/intrinsiccv/include/intrinsiccv/filters/sobel.h +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#ifndef KLEIDICV_FILTERS_SOBEL_H -#define KLEIDICV_FILTERS_SOBEL_H - -#include "intrinsiccv/intrinsiccv.h" - -namespace intrinsiccv { - -namespace neon { -intrinsiccv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, - size_t src_stride, int16_t *dst, - size_t dst_stride, size_t width, - size_t height, size_t channels); -intrinsiccv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, - size_t src_stride, int16_t *dst, - size_t dst_stride, size_t width, - size_t height, size_t channels); -} // namespace neon - -namespace sve2 { -intrinsiccv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, - size_t src_stride, int16_t *dst, - size_t dst_stride, size_t width, - size_t height, size_t channels); -intrinsiccv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, - size_t src_stride, int16_t *dst, - size_t dst_stride, size_t width, - size_t height, size_t channels); -} // namespace sve2 - -namespace sme2 { -intrinsiccv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, - size_t src_stride, int16_t *dst, - size_t dst_stride, size_t width, - size_t height, size_t channels); -intrinsiccv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, - size_t src_stride, int16_t *dst, - size_t dst_stride, size_t width, - size_t height, size_t channels); -} // namespace sme2 - -} // namespace intrinsiccv - -#endif // KLEIDICV_FILTERS_SOBEL_H diff --git a/intrinsiccv/include/intrinsiccv/resize/resize.h b/intrinsiccv/include/intrinsiccv/resize/resize.h deleted file mode 100644 index 14a5d2493..000000000 --- a/intrinsiccv/include/intrinsiccv/resize/resize.h +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#ifndef KLEIDICV_RESIZE_RESIZE_H -#define KLEIDICV_RESIZE_RESIZE_H - -#include "intrinsiccv/intrinsiccv.h" - -namespace intrinsiccv { - -namespace neon { -intrinsiccv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, - size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride, - size_t dst_width, size_t dst_height); -} // namespace neon - -namespace sve2 { -intrinsiccv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, - size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride, - size_t dst_width, size_t dst_height); -} // namespace sve2 - -namespace sme2 { -intrinsiccv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, - size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride, - size_t dst_width, size_t dst_height); -} // namespace sme2 - -} // namespace intrinsiccv - -#endif // KLEIDICV_RESIZE_RESIZE_H diff --git a/intrinsiccv/include/intrinsiccv/resize/resize_linear.h b/intrinsiccv/include/intrinsiccv/resize/resize_linear.h deleted file mode 100644 index 837ce834f..000000000 --- a/intrinsiccv/include/intrinsiccv/resize/resize_linear.h +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#ifndef KLEIDICV_RESIZE_RESIZE_LINEAR_H -#define KLEIDICV_RESIZE_RESIZE_LINEAR_H - -#include "intrinsiccv/intrinsiccv.h" - -namespace intrinsiccv { - -namespace neon { -intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, - size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride, - size_t dst_width, size_t dst_height); -} // namespace neon - -namespace sve2 { -intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, - size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride, - size_t dst_width, size_t dst_height); -} // namespace sve2 - -namespace sme2 { -intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, - size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride, - size_t dst_width, size_t dst_height); -} // namespace sme2 - -} // namespace intrinsiccv - -#endif // KLEIDICV_RESIZE_RESIZE_H diff --git a/intrinsiccv/src/analysis/min_max_api.cpp b/intrinsiccv/src/analysis/min_max_api.cpp deleted file mode 100644 index 12d2ffcfb..000000000 --- a/intrinsiccv/src/analysis/min_max_api.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/types.h" - -namespace intrinsiccv { - -namespace neon { - -template -intrinsiccv_error_t min_max(const T *src, size_t src_stride, size_t width, - size_t height, T *min_value, T *max_value); - -template -intrinsiccv_error_t min_max_loc(const T *src, size_t src_stride, size_t width, - size_t height, size_t *min_offset, - size_t *max_offset); - -} // namespace neon - -namespace sve2 {} // namespace sve2 - -namespace sme2 {} // namespace sme2 - -} // namespace intrinsiccv - -#define KLEIDICV_DEFINE_MINMAX_API(name, type) \ - KLEIDICV_MULTIVERSION_C_API(name, &intrinsiccv::neon::min_max, \ - nullptr, nullptr) - -KLEIDICV_DEFINE_MINMAX_API(intrinsiccv_min_max_u8, uint8_t); -KLEIDICV_DEFINE_MINMAX_API(intrinsiccv_min_max_s8, int8_t); -KLEIDICV_DEFINE_MINMAX_API(intrinsiccv_min_max_u16, uint16_t); -KLEIDICV_DEFINE_MINMAX_API(intrinsiccv_min_max_s16, int16_t); -KLEIDICV_DEFINE_MINMAX_API(intrinsiccv_min_max_s32, int32_t); - -#define KLEIDICV_DEFINE_MINMAXLOC_API(name, type) \ - KLEIDICV_MULTIVERSION_C_API(name, &intrinsiccv::neon::min_max_loc, \ - nullptr, nullptr) - -KLEIDICV_DEFINE_MINMAXLOC_API(intrinsiccv_min_max_loc_u8, uint8_t); diff --git a/intrinsiccv/src/arithmetics/absdiff_api.cpp b/intrinsiccv/src/arithmetics/absdiff_api.cpp deleted file mode 100644 index 8848faab7..000000000 --- a/intrinsiccv/src/arithmetics/absdiff_api.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/types.h" - -namespace intrinsiccv { - -namespace neon { - -template -intrinsiccv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, - T *dst, size_t dst_stride, size_t width, - size_t height); - -} // namespace neon - -namespace sve2 { - -template -intrinsiccv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, - T *dst, size_t dst_stride, size_t width, - size_t height); - -} // namespace sve2 - -namespace sme2 { -template -intrinsiccv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, - T *dst, size_t dst_stride, size_t width, - size_t height); - -} // namespace sme2 - -} // namespace intrinsiccv - -#define KLEIDICV_DEFINE_C_API(name, type) \ - KLEIDICV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::saturating_absdiff, \ - KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_absdiff), \ - &intrinsiccv::sme2::saturating_absdiff) - -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_absdiff_u8, uint8_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_absdiff_s8, int8_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_absdiff_u16, uint16_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_absdiff_s16, int16_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_absdiff_s32, int32_t); diff --git a/intrinsiccv/src/arithmetics/add_api.cpp b/intrinsiccv/src/arithmetics/add_api.cpp deleted file mode 100644 index 0b0ebdeff..000000000 --- a/intrinsiccv/src/arithmetics/add_api.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/types.h" - -namespace intrinsiccv { - -namespace neon { - -template -intrinsiccv_error_t saturating_add(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, T *dst, - size_t dst_stride, size_t width, - size_t height); - -} // namespace neon - -namespace sve2 { - -template -intrinsiccv_error_t saturating_add(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, T *dst, - size_t dst_stride, size_t width, - size_t height); - -} // namespace sve2 - -namespace sme2 { -template -intrinsiccv_error_t saturating_add(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, T *dst, - size_t dst_stride, size_t width, - size_t height); - -} // namespace sme2 - -} // namespace intrinsiccv - -#define KLEIDICV_DEFINE_C_API(name, type) \ - KLEIDICV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::saturating_add, \ - KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_add), \ - &intrinsiccv::sme2::saturating_add) - -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_s8, int8_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_u8, uint8_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_s16, int16_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_u16, uint16_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_s32, int32_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_u32, uint32_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_s64, int64_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_u64, uint64_t); diff --git a/intrinsiccv/src/arithmetics/multiply_api.cpp b/intrinsiccv/src/arithmetics/multiply_api.cpp deleted file mode 100644 index 256c9fbf7..000000000 --- a/intrinsiccv/src/arithmetics/multiply_api.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/types.h" - -namespace intrinsiccv { - -namespace neon { - -template -intrinsiccv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, - T *dst, size_t dst_stride, size_t width, - size_t height, double scale); - -} // namespace neon - -namespace sve2 { - -template -intrinsiccv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, - T *dst, size_t dst_stride, size_t width, - size_t height, double scale); - -} // namespace sve2 - -// namespace sme2 { - -// template -// intrinsiccv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, -// const T *src_b, -// size_t src_b_stride, T *dst, size_t dst_stride, -// size_t width, size_t height, double scale); - -// } // namespace sme2 - -} // namespace intrinsiccv - -#define KLEIDICV_DEFINE_C_API(name, type) \ - KLEIDICV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::saturating_multiply, \ - KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_multiply), \ - nullptr) - -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_multiply_u8, uint8_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_multiply_s8, int8_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_multiply_u16, uint16_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_multiply_s16, int16_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_multiply_s32, int32_t); diff --git a/intrinsiccv/src/arithmetics/scale_api.cpp b/intrinsiccv/src/arithmetics/scale_api.cpp deleted file mode 100644 index 77ffca7be..000000000 --- a/intrinsiccv/src/arithmetics/scale_api.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/types.h" - -namespace intrinsiccv { - -namespace neon { - -template -intrinsiccv_error_t scale(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, size_t height, - float scale, float shift); -} // namespace neon - -namespace sve2 {} // namespace sve2 - -namespace sme2 {} // namespace sme2 - -} // namespace intrinsiccv - -#define KLEIDICV_DEFINE_SCALE_API(name, type) \ - KLEIDICV_MULTIVERSION_C_API(name, &intrinsiccv::neon::scale, nullptr, \ - nullptr) - -KLEIDICV_DEFINE_SCALE_API(intrinsiccv_scale_u8, uint8_t); -// KLEIDICV_DEFINE_SCALE_API(intrinsiccv_scale_s8, int8_t); -// KLEIDICV_DEFINE_SCALE_API(intrinsiccv_scale_u16, uint16_t); -// KLEIDICV_DEFINE_SCALE_API(intrinsiccv_scale_s16, int16_t); -// KLEIDICV_DEFINE_SCALE_API(intrinsiccv_scale_s32, int32_t); diff --git a/intrinsiccv/src/arithmetics/sub_api.cpp b/intrinsiccv/src/arithmetics/sub_api.cpp deleted file mode 100644 index 7bd0dc295..000000000 --- a/intrinsiccv/src/arithmetics/sub_api.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" - -namespace intrinsiccv { - -namespace neon { - -template -intrinsiccv_error_t saturating_sub(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, T *dst, - size_t dst_stride, size_t width, - size_t height); - -} // namespace neon - -namespace sve2 { - -template -intrinsiccv_error_t saturating_sub(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, T *dst, - size_t dst_stride, size_t width, - size_t height); - -} // namespace sve2 - -namespace sme2 { -template -intrinsiccv_error_t saturating_sub(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, T *dst, - size_t dst_stride, size_t width, - size_t height); - -} // namespace sme2 - -} // namespace intrinsiccv - -#define KLEIDICV_DEFINE_C_API(name, type) \ - KLEIDICV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::saturating_sub, \ - KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::saturating_sub), \ - &intrinsiccv::sme2::saturating_sub) - -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_s8, int8_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_u8, uint8_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_s16, int16_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_u16, uint16_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_s32, int32_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_u32, uint32_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_s64, int64_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_sub_u64, uint64_t); diff --git a/intrinsiccv/src/arithmetics/threshold_api.cpp b/intrinsiccv/src/arithmetics/threshold_api.cpp deleted file mode 100644 index ec4000d21..000000000 --- a/intrinsiccv/src/arithmetics/threshold_api.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" - -namespace intrinsiccv { - -namespace neon { -template -intrinsiccv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, - size_t height, T threshold, T value); -} // namespace neon - -namespace sve2 { -template -intrinsiccv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, - size_t height, T threshold, T value); -} // namespace sve2 - -namespace sme2 { -template -intrinsiccv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, - size_t height, T threshold, T value); -} // namespace sme2 - -} // namespace intrinsiccv - -#define KLEIDICV_DEFINE_C_API(name, type) \ - KLEIDICV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::threshold_binary, \ - KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::threshold_binary), \ - &intrinsiccv::sme2::threshold_binary) - -KLEIDICV_DEFINE_C_API(intrinsiccv_threshold_binary_u8, uint8_t); diff --git a/intrinsiccv/src/arithmetics/transpose_api.cpp b/intrinsiccv/src/arithmetics/transpose_api.cpp deleted file mode 100644 index 925e05b13..000000000 --- a/intrinsiccv/src/arithmetics/transpose_api.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/arithmetics/transpose.h" -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" - -KLEIDICV_MULTIVERSION_C_API(intrinsiccv_transpose, - &intrinsiccv::neon::transpose, nullptr, nullptr); diff --git a/intrinsiccv/src/conversions/gray_to_rgb_api.cpp b/intrinsiccv/src/conversions/gray_to_rgb_api.cpp deleted file mode 100644 index da40a2377..000000000 --- a/intrinsiccv/src/conversions/gray_to_rgb_api.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/conversions/gray_to_rgb.h" -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" - -#define KLEIDICV_DEFINE_C_API(name, partialname) \ - KLEIDICV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::partialname, \ - KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::partialname), \ - &intrinsiccv::sme2::partialname) - -KLEIDICV_DEFINE_C_API(intrinsiccv_gray_to_rgb_u8, gray_to_rgb_u8); -KLEIDICV_DEFINE_C_API(intrinsiccv_gray_to_rgba_u8, gray_to_rgba_u8); diff --git a/intrinsiccv/src/conversions/merge_api.cpp b/intrinsiccv/src/conversions/merge_api.cpp deleted file mode 100644 index a6cef3f0f..000000000 --- a/intrinsiccv/src/conversions/merge_api.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/conversions/merge.h" -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" - -KLEIDICV_MULTIVERSION_C_API(intrinsiccv_merge, &intrinsiccv::neon::merge, - nullptr, nullptr); diff --git a/intrinsiccv/src/conversions/yuv_to_rgb_api.cpp b/intrinsiccv/src/conversions/yuv_to_rgb_api.cpp deleted file mode 100644 index ced78566c..000000000 --- a/intrinsiccv/src/conversions/yuv_to_rgb_api.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/conversions/yuv_to_rgb.h" -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" - -#define KLEIDICV_DEFINE_C_API(name, partialname) \ - KLEIDICV_MULTIVERSION_C_API(name, &intrinsiccv::neon::partialname, \ - &intrinsiccv::sve2::partialname, \ - &intrinsiccv::sme2::partialname) - -KLEIDICV_DEFINE_C_API(intrinsiccv_yuv_sp_to_rgb_u8, yuv_sp_to_rgb_u8); -KLEIDICV_DEFINE_C_API(intrinsiccv_yuv_sp_to_bgr_u8, yuv_sp_to_bgr_u8); -KLEIDICV_DEFINE_C_API(intrinsiccv_yuv_sp_to_rgba_u8, yuv_sp_to_rgba_u8); -KLEIDICV_DEFINE_C_API(intrinsiccv_yuv_sp_to_bgra_u8, yuv_sp_to_bgra_u8); diff --git a/intrinsiccv/src/filters/gaussian_blur_sve2.cpp b/intrinsiccv/src/filters/gaussian_blur_sve2.cpp deleted file mode 100644 index 3c83ff8de..000000000 --- a/intrinsiccv/src/filters/gaussian_blur_sve2.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "gaussian_blur_sc.h" -#include "intrinsiccv/filters/gaussian_blur.h" - -namespace intrinsiccv::sve2 { - -KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t gaussian_blur_5x5_u8( - const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height, size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context) { - return discrete_gaussian_blur(src, src_stride, dst, dst_stride, - width, height, channels, - border_type, context); -} - -} // namespace intrinsiccv::sve2 diff --git a/intrinsiccv/src/filters/sobel_api.cpp b/intrinsiccv/src/filters/sobel_api.cpp deleted file mode 100644 index f4a7b1c23..000000000 --- a/intrinsiccv/src/filters/sobel_api.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/filters/sobel.h" -#include "intrinsiccv/intrinsiccv.h" - -#define KLEIDICV_DEFINE_C_API(name, partialname) \ - KLEIDICV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::partialname, \ - KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::partialname), \ - &intrinsiccv::sme2::partialname) - -KLEIDICV_DEFINE_C_API(intrinsiccv_sobel_3x3_horizontal_s16_u8, - sobel_3x3_horizontal_s16_u8); -KLEIDICV_DEFINE_C_API(intrinsiccv_sobel_3x3_vertical_s16_u8, - sobel_3x3_vertical_s16_u8); diff --git a/intrinsiccv/src/morphology/morphology_api.cpp b/intrinsiccv/src/morphology/morphology_api.cpp deleted file mode 100644 index 2e3650a7a..000000000 --- a/intrinsiccv/src/morphology/morphology_api.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/morphology/workspace.h" - -namespace intrinsiccv { - -namespace neon { - -template -intrinsiccv_error_t dilate(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, size_t height, - intrinsiccv_morphology_context_t *context); - -template -intrinsiccv_error_t erode(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, size_t height, - intrinsiccv_morphology_context_t *context); - -} // namespace neon - -namespace sve2 { - -template -intrinsiccv_error_t dilate(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, size_t height, - intrinsiccv_morphology_context_t *context); - -template -intrinsiccv_error_t erode(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, size_t height, - intrinsiccv_morphology_context_t *context); - -} // namespace sve2 - -namespace sme2 { - -template -intrinsiccv_error_t dilate(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, size_t height, - intrinsiccv_morphology_context_t *context); - -template -intrinsiccv_error_t erode(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, size_t height, - intrinsiccv_morphology_context_t *context); - -} // namespace sme2 - -} // namespace intrinsiccv - -extern "C" { - -using KLEIDICV_TARGET_NAMESPACE::MorphologyWorkspace; - -intrinsiccv_error_t intrinsiccv_morphology_create( - intrinsiccv_morphology_context_t **context, intrinsiccv_rectangle_t kernel, - intrinsiccv_point_t anchor, intrinsiccv_border_type_t border_type, - intrinsiccv_border_values_t border_values, size_t channels, - size_t iterations, size_t type_size, intrinsiccv_rectangle_t image) { - CHECK_POINTERS(context); - *context = nullptr; - CHECK_RECTANGLE_SIZE(kernel); - CHECK_RECTANGLE_SIZE(image); - - if (type_size > KLEIDICV_MAXIMUM_TYPE_SIZE) { - return KLEIDICV_ERROR_RANGE; - } - - if (channels > KLEIDICV_MAXIMUM_CHANNEL_COUNT) { - return KLEIDICV_ERROR_RANGE; - } - - auto morphology_border_type = - MorphologyWorkspace::get_border_type(border_type); - - if (!morphology_border_type) { - return KLEIDICV_ERROR_NOT_IMPLEMENTED; - } - - MorphologyWorkspace::Pointer workspace; - if (intrinsiccv_error_t error = MorphologyWorkspace::create( - workspace, kernel, anchor, *morphology_border_type, border_values, - channels, iterations, type_size, image)) { - return error; - } - - *context = - reinterpret_cast(workspace.release()); - return KLEIDICV_OK; -} - -intrinsiccv_error_t intrinsiccv_morphology_release( - intrinsiccv_morphology_context_t *context) { - CHECK_POINTERS(context); - - // Deliberately create and immediately destroy a unique_ptr to delete the - // workspace. - // NOLINTBEGIN(bugprone-unused-raii) - MorphologyWorkspace::Pointer{ - reinterpret_cast(context)}; - // NOLINTEND(bugprone-unused-raii) - return KLEIDICV_OK; -} - -} // extern "C" - -#define KLEIDICV_DEFINE_C_API(name, tname, type) \ - KLEIDICV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::tname, \ - KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::tname), \ - &intrinsiccv::sme2::tname) - -KLEIDICV_DEFINE_C_API(intrinsiccv_dilate_u8, dilate, uint8_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_erode_u8, erode, uint8_t); diff --git a/intrinsiccv/src/resize/resize_api.cpp b/intrinsiccv/src/resize/resize_api.cpp deleted file mode 100644 index 293696c9a..000000000 --- a/intrinsiccv/src/resize/resize_api.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/resize/resize.h" - -KLEIDICV_MULTIVERSION_C_API( - intrinsiccv_resize_to_quarter_u8, &intrinsiccv::neon::resize_to_quarter_u8, - KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::resize_to_quarter_u8), - &intrinsiccv::sme2::resize_to_quarter_u8); diff --git a/intrinsiccv/src/resize/resize_linear_api.cpp b/intrinsiccv/src/resize/resize_linear_api.cpp deleted file mode 100644 index 23979e27a..000000000 --- a/intrinsiccv/src/resize/resize_linear_api.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/resize/resize_linear.h" - -KLEIDICV_MULTIVERSION_C_API( - intrinsiccv_resize_linear_u8, &intrinsiccv::neon::resize_linear_u8, - KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::resize_linear_u8), - &intrinsiccv::sme2::resize_linear_u8); diff --git a/intrinsiccv/src/resize/resize_linear_sve2.cpp b/intrinsiccv/src/resize/resize_linear_sve2.cpp deleted file mode 100644 index b385da9f8..000000000 --- a/intrinsiccv/src/resize/resize_linear_sve2.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/resize/resize_linear.h" -#include "resize_linear_sc.h" - -namespace intrinsiccv::sve2 { -KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, - size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride, - size_t dst_width, size_t dst_height) { - return resize_linear_u8_sc(src, src_stride, src_width, src_height, dst, - dst_stride, dst_width, dst_height); -} - -} // namespace intrinsiccv::sve2 diff --git a/intrinsiccv/src/resize/resize_sve2.cpp b/intrinsiccv/src/resize/resize_sve2.cpp deleted file mode 100644 index ab06494d9..000000000 --- a/intrinsiccv/src/resize/resize_sve2.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates -// -// SPDX-License-Identifier: Apache-2.0 - -#include "intrinsiccv/resize/resize.h" -#include "resize_sc.h" - -namespace intrinsiccv::sve2 { - -KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, - size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride, - size_t dst_width, size_t dst_height) { - return resize_to_quarter_u8_sc(src, src_stride, src_width, src_height, dst, - dst_stride, dst_width, dst_height); -} - -} // namespace intrinsiccv::sve2 diff --git a/intrinsiccv/CMakeLists.txt b/kleidicv/CMakeLists.txt similarity index 74% rename from intrinsiccv/CMakeLists.txt rename to kleidicv/CMakeLists.txt index d39d72705..296cce1e2 100644 --- a/intrinsiccv/CMakeLists.txt +++ b/kleidicv/CMakeLists.txt @@ -59,7 +59,7 @@ if(KLEIDICV_BUILD_SVE2 AND KLEIDICV_ENABLE_SVE2) set(KLEIDICV_ALWAYS_ENABLE_SVE2 ON) endif() -configure_file("${CMAKE_CURRENT_LIST_DIR}/include/intrinsiccv/config.h.in" "include/intrinsiccv/config.h") +configure_file("${CMAKE_CURRENT_LIST_DIR}/include/kleidicv/config.h.in" "include/kleidicv/config.h") file(GLOB KLEIDICV_API_SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/*_api.cpp" @@ -121,7 +121,7 @@ if (KLEIDICV_CHECK_BANNED_FUNCTIONS) # The `SHELL:` prefix is used to turn off de-duplication of compiler flags, # it is necessary if other headers are need to be force included. # https://cmake.org/cmake/help/latest/command/target_compile_options.html#option-de-duplication - list(APPEND KLEIDICV_CXX_FLAGS "SHELL:-include intrinsiccv/unsafe.h") + list(APPEND KLEIDICV_CXX_FLAGS "SHELL:-include kleidicv/unsafe.h") endif() if (CMAKE_BUILD_TYPE STREQUAL "Debug") @@ -130,20 +130,20 @@ else() list(APPEND KLEIDICV_CXX_FLAGS "-O2" "-g0") endif() -add_library(intrinsiccv_neon OBJECT ${KLEIDICV_NEON_SOURCES}) -target_include_directories(intrinsiccv_neon PRIVATE ${KLEIDICV_INCLUDE_DIRS}) -set_target_properties(intrinsiccv_neon PROPERTIES CXX_STANDARD 17) -target_compile_options(intrinsiccv_neon PRIVATE +add_library(kleidicv_neon OBJECT ${KLEIDICV_NEON_SOURCES}) +target_include_directories(kleidicv_neon PRIVATE ${KLEIDICV_INCLUDE_DIRS}) +set_target_properties(kleidicv_neon PROPERTIES CXX_STANDARD 17) +target_compile_options(kleidicv_neon PRIVATE ${KLEIDICV_CXX_FLAGS} "-march=armv8-a" "-DKLEIDICV_TARGET_NEON=1" ) if(KLEIDICV_BUILD_SVE2) - add_library(intrinsiccv_sve2 OBJECT ${KLEIDICV_SVE2_SOURCES}) - target_include_directories(intrinsiccv_sve2 PRIVATE ${KLEIDICV_INCLUDE_DIRS}) - set_target_properties(intrinsiccv_sve2 PROPERTIES CXX_STANDARD 17) - target_compile_options(intrinsiccv_sve2 PRIVATE + add_library(kleidicv_sve2 OBJECT ${KLEIDICV_SVE2_SOURCES}) + target_include_directories(kleidicv_sve2 PRIVATE ${KLEIDICV_INCLUDE_DIRS}) + set_target_properties(kleidicv_sve2 PROPERTIES CXX_STANDARD 17) + target_compile_options(kleidicv_sve2 PRIVATE ${KLEIDICV_CXX_FLAGS} "-march=armv8-a+sve2" "-DKLEIDICV_TARGET_SVE2=1" @@ -151,28 +151,28 @@ if(KLEIDICV_BUILD_SVE2) endif() if(KLEIDICV_BUILD_SME2) - add_library(intrinsiccv_sme2 OBJECT ${KLEIDICV_SME2_SOURCES}) - target_include_directories(intrinsiccv_sme2 PRIVATE ${KLEIDICV_INCLUDE_DIRS}) - set_target_properties(intrinsiccv_sme2 PROPERTIES CXX_STANDARD 17) - target_compile_options(intrinsiccv_sme2 PRIVATE + add_library(kleidicv_sme2 OBJECT ${KLEIDICV_SME2_SOURCES}) + target_include_directories(kleidicv_sme2 PRIVATE ${KLEIDICV_INCLUDE_DIRS}) + set_target_properties(kleidicv_sme2 PROPERTIES CXX_STANDARD 17) + target_compile_options(kleidicv_sme2 PRIVATE ${KLEIDICV_CXX_FLAGS} "-march=armv9-a+sve2+sme2" "-DKLEIDICV_TARGET_SME2=1" ) endif() -add_library(intrinsiccv STATIC ${KLEIDICV_API_SOURCES}) -target_include_directories(intrinsiccv PRIVATE ${KLEIDICV_INCLUDE_DIRS}) -set_target_properties(intrinsiccv PROPERTIES CXX_STANDARD 17) -target_compile_options(intrinsiccv PRIVATE ${KLEIDICV_CXX_FLAGS}) -target_link_libraries(intrinsiccv PRIVATE intrinsiccv_neon) +add_library(kleidicv STATIC ${KLEIDICV_API_SOURCES}) +target_include_directories(kleidicv PRIVATE ${KLEIDICV_INCLUDE_DIRS}) +set_target_properties(kleidicv PROPERTIES CXX_STANDARD 17) +target_compile_options(kleidicv PRIVATE ${KLEIDICV_CXX_FLAGS}) +target_link_libraries(kleidicv PRIVATE kleidicv_neon) if(KLEIDICV_BUILD_SVE2) - target_compile_definitions(intrinsiccv PRIVATE KLEIDICV_HAVE_SVE2) - target_link_libraries(intrinsiccv PRIVATE intrinsiccv_sve2) + target_compile_definitions(kleidicv PRIVATE KLEIDICV_HAVE_SVE2) + target_link_libraries(kleidicv PRIVATE kleidicv_sve2) endif() if(KLEIDICV_BUILD_SME2) - target_compile_definitions(intrinsiccv PRIVATE KLEIDICV_HAVE_SME2) - target_link_libraries(intrinsiccv PRIVATE intrinsiccv_sme2) + target_compile_definitions(kleidicv PRIVATE KLEIDICV_HAVE_SME2) + target_link_libraries(kleidicv PRIVATE kleidicv_sme2) endif() diff --git a/intrinsiccv/include/intrinsiccv/arithmetics/transpose.h b/kleidicv/include/kleidicv/arithmetics/transpose.h similarity index 59% rename from intrinsiccv/include/intrinsiccv/arithmetics/transpose.h rename to kleidicv/include/kleidicv/arithmetics/transpose.h index 846350f0a..6cea5f9c1 100644 --- a/intrinsiccv/include/intrinsiccv/arithmetics/transpose.h +++ b/kleidicv/include/kleidicv/arithmetics/transpose.h @@ -8,20 +8,20 @@ #include #include -#include "intrinsiccv/ctypes.h" +#include "kleidicv/ctypes.h" -namespace intrinsiccv { +namespace kleidicv { namespace neon { -intrinsiccv_error_t transpose(const void *src, size_t src_stride, void *dst, - size_t dst_stride, size_t width, size_t height, - size_t element_size); +kleidicv_error_t transpose(const void *src, size_t src_stride, void *dst, + size_t dst_stride, size_t width, size_t height, + size_t element_size); } // namespace neon namespace sve2 {} // namespace sve2 namespace sme2 {} // namespace sme2 -} // namespace intrinsiccv +} // namespace kleidicv #endif // KLEIDICV_ARITHMETICS_TRANSPOSE_H diff --git a/intrinsiccv/include/intrinsiccv/config.h.in b/kleidicv/include/kleidicv/config.h.in similarity index 92% rename from intrinsiccv/include/intrinsiccv/config.h.in rename to kleidicv/include/kleidicv/config.h.in index 743b20262..4efcf8e31 100644 --- a/intrinsiccv/include/intrinsiccv/config.h.in +++ b/kleidicv/include/kleidicv/config.h.in @@ -36,18 +36,18 @@ // Derived configuration switches and macros below. -#define KLEIDICV_TARGET_NAMESPACE intrinsiccv +#define KLEIDICV_TARGET_NAMESPACE kleidicv #if KLEIDICV_TARGET_NEON #define KLEIDICV_TARGET_FN_ATTRS KLEIDICV_ATTR_SECTION(".text.neon") #undef KLEIDICV_TARGET_NAMESPACE -#define KLEIDICV_TARGET_NAMESPACE intrinsiccv::neon +#define KLEIDICV_TARGET_NAMESPACE kleidicv::neon #endif #if KLEIDICV_TARGET_SVE2 #define KLEIDICV_TARGET_FN_ATTRS KLEIDICV_ATTR_SECTION(".text.sve2") #undef KLEIDICV_TARGET_NAMESPACE -#define KLEIDICV_TARGET_NAMESPACE intrinsiccv::sve2 +#define KLEIDICV_TARGET_NAMESPACE kleidicv::sve2 #endif #if KLEIDICV_TARGET_SME2 @@ -55,7 +55,7 @@ #define KLEIDICV_ASSUME_128BIT_SVE2 0 #define KLEIDICV_TARGET_FN_ATTRS KLEIDICV_ATTR_SECTION(".text.sme2") #undef KLEIDICV_TARGET_NAMESPACE -#define KLEIDICV_TARGET_NAMESPACE intrinsiccv::sme2 +#define KLEIDICV_TARGET_NAMESPACE kleidicv::sme2 #define KLEIDICV_LOCALLY_STREAMING __arm_locally_streaming #define KLEIDICV_STREAMING_COMPATIBLE __arm_streaming_compatible #else diff --git a/intrinsiccv/include/intrinsiccv/containers/stack.h b/kleidicv/include/kleidicv/containers/stack.h similarity index 98% rename from intrinsiccv/include/intrinsiccv/containers/stack.h rename to kleidicv/include/kleidicv/containers/stack.h index 39b696b7d..f63fa9fbb 100644 --- a/intrinsiccv/include/intrinsiccv/containers/stack.h +++ b/kleidicv/include/kleidicv/containers/stack.h @@ -9,9 +9,9 @@ #include #include -#include "intrinsiccv/config.h" -#include "intrinsiccv/traits.h" -#include "intrinsiccv/utils.h" +#include "kleidicv/config.h" +#include "kleidicv/traits.h" +#include "kleidicv/utils.h" namespace KLEIDICV_TARGET_NAMESPACE { diff --git a/kleidicv/include/kleidicv/conversions/gray_to_rgb.h b/kleidicv/include/kleidicv/conversions/gray_to_rgb.h new file mode 100644 index 000000000..e66897957 --- /dev/null +++ b/kleidicv/include/kleidicv/conversions/gray_to_rgb.h @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef KLEIDICV_CONVERSIONS_GRAY_TO_RGB_H +#define KLEIDICV_CONVERSIONS_GRAY_TO_RGB_H + +#include "kleidicv/kleidicv.h" + +namespace kleidicv { + +namespace neon { + +kleidicv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +kleidicv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +} // namespace neon + +namespace sve2 { + +kleidicv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +kleidicv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +} // namespace sve2 + +namespace sme2 { + +kleidicv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +kleidicv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +} // namespace sme2 + +} // namespace kleidicv + +#endif // KLEIDICV_CONVERSIONS_GRAY_TO_RGB_H diff --git a/kleidicv/include/kleidicv/conversions/merge.h b/kleidicv/include/kleidicv/conversions/merge.h new file mode 100644 index 000000000..c017433fb --- /dev/null +++ b/kleidicv/include/kleidicv/conversions/merge.h @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef KLEIDICV_CONVERSIONS_MERGE_H +#define KLEIDICV_CONVERSIONS_MERGE_H + +#include "kleidicv/kleidicv.h" + +namespace kleidicv { + +namespace neon { + +kleidicv_error_t merge(const void **srcs, const size_t *src_strides, void *dst, + size_t dst_stride, size_t width, size_t height, + size_t channels, size_t element_size); + +} // namespace neon + +} // namespace kleidicv + +#endif // KLEIDICV_CONVERSIONS_MERGE_H diff --git a/kleidicv/include/kleidicv/conversions/rgb_to_rgb.h b/kleidicv/include/kleidicv/conversions/rgb_to_rgb.h new file mode 100644 index 000000000..48f3cebb8 --- /dev/null +++ b/kleidicv/include/kleidicv/conversions/rgb_to_rgb.h @@ -0,0 +1,88 @@ +// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef KLEIDICV_CONVERSIONS_RGB_TO_RGB_H +#define KLEIDICV_CONVERSIONS_RGB_TO_RGB_H + +#include "kleidicv/kleidicv.h" + +namespace kleidicv { + +namespace neon { + +kleidicv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); +kleidicv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); +kleidicv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); +kleidicv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); +kleidicv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); +kleidicv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +} // namespace neon + +namespace sve2 { + +kleidicv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); +kleidicv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); +kleidicv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); +kleidicv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); +kleidicv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); +kleidicv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +} // namespace sve2 + +namespace sme2 { + +kleidicv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +kleidicv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +kleidicv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +kleidicv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +kleidicv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +kleidicv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height); + +} // namespace sme2 + +} // namespace kleidicv + +#endif // KLEIDICV_CONVERSIONS_RGB_TO_RGB_H diff --git a/kleidicv/include/kleidicv/conversions/split.h b/kleidicv/include/kleidicv/conversions/split.h new file mode 100644 index 000000000..dcdda93ed --- /dev/null +++ b/kleidicv/include/kleidicv/conversions/split.h @@ -0,0 +1,24 @@ +// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef KLEIDICV_CONVERSIONS_SPLIT_H +#define KLEIDICV_CONVERSIONS_SPLIT_H + +#include + +#include "kleidicv/ctypes.h" + +namespace kleidicv { + +namespace neon { + +kleidicv_error_t split(const void *src_data, size_t src_stride, void **dst_data, + const size_t *dst_strides, size_t width, size_t height, + size_t channels, size_t element_size); + +} // namespace neon + +} // namespace kleidicv + +#endif // KLEIDICV_CONVERSIONS_SPLIT_H diff --git a/kleidicv/include/kleidicv/conversions/yuv_to_rgb.h b/kleidicv/include/kleidicv/conversions/yuv_to_rgb.h new file mode 100644 index 000000000..3ec746e94 --- /dev/null +++ b/kleidicv/include/kleidicv/conversions/yuv_to_rgb.h @@ -0,0 +1,157 @@ +// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef KLEIDICV_CONVERSIONS_YUV_TO_RGB_H +#define KLEIDICV_CONVERSIONS_YUV_TO_RGB_H + +#include "kleidicv/kleidicv.h" + +namespace kleidicv { + +/* Analog YUV to RGB conversion according to ITU-R BT.601-7 in matrix form: + + [ Ya ] = [ 0.299 0.587 0.114 ] [ Ra ] + [ Ua ] = [ -0.299 -0.587 0.886 ] [ Ga ] + [ Va ] = [ 0.701 -0.587 -0.114 ] [ Ba ] + +After re-normalization of the analog signal: + + Yan = Ya + Uan = Ua / 1.722 + Van = Va / 1.402 + + [ Yan ] = [ 0.299000 0.587000 0.114000 ] [ Ra ] + [ Uan ] = [ -0.168736 -0.331264 0.500000 ] [ Ga ] + [ Van ] = [ 0.500000 -0.418688 -0.081312 ] [ Ba ] + +Inverse transformation: + + [ Ra ] = [ 1.000000 0.000000 1.402000 ] [ Yan ] + [ Ga ] = [ 1.000000 -0.344136 -0.714136 ] [ Uan ] + [ Ba ] = [ 1.000000 1.772000 0.000000 ] [ Van ] + +Inverse transformation after quantization: + + Y' = saturating_subtract(Yan - 16) + U' = Uan - 128 + V' = Van - 128 + + R = 255 / 219 * Ra + G = 255 / 224 * Ga + B = 255 / 224 * Ba + + [ R ] = [ 1.164384 0.000000 1.596027 ] [ Y' ] + [ G ] = [ 1.164384 -0.391762 -0.812967 ] [ U' ] + [ B ] = [ 1.164384 2.017232 0.000000 ] [ V' ] + +The values used in this implementation are the following: + + [ R ] = [ 1.164000 0.000000 1.596000 ] [ Y' ] + [ G ] = [ 1.164000 -0.391000 -0.813000 ] [ U' ] + [ B ] = [ 1.164000 2.018000 0.000000 ] [ V' ] + +With 20 bit scaling and rounding, the integer constants are: + + [ R ] = [ 1,220,542 0 1,673,527 ] [ Y' ] + [ G ] = [ 1,220,542 - 409,993 -852,492 ] [ U' ] + (1 << 19) >> 20 + [ B ] = [ 1,220,542 2,116,026 0 ] [ V' ] + +The final results are calculated using roundign shift right and saturating +to 8 bit unsigned values: + + X = saturating_cast((X' + (1 << 19)) >> 20) + +The estimated error is then: + + [ R ] = [ 0.000000 0.000000 -0.000000 ] [ Y' ] + [ G ] = [ 0.000000 -0.000000 -0.000000 ] [ U' ] + [ B ] = [ 0.000000 -0.000000 0.000000 ] [ V' ] + +Sources: + [1] https://www.itu.int/rec/R-REC-BT.601 +*/ + +// Weights according to the calculation at the top of this file. +static constexpr size_t kWeightScale = 20; +static constexpr int32_t kYWeight = /* Weight(Y) */ 1220542; +static constexpr size_t kRVWeightIndex = 0; +static constexpr size_t kGUWeightIndex = 1; +static constexpr size_t kGVWeightIndex = 2; +static constexpr size_t kBUWeightIndex = 3; +static constexpr int32_t kUVWeights[4] = { + /* Weight(RV) */ 1673527, + /* Weight(GU) */ -409993, + /* Weight(GV) */ -852492, + /* Weight(BU) */ 2116026, +}; + +namespace neon { +kleidicv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height, bool is_nv21); + +kleidicv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21); + +kleidicv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height, bool is_nv21); + +kleidicv_error_t yuv_sp_to_bgra_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21); +} // namespace neon + +namespace sve2 { +kleidicv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height, bool is_nv21); + +kleidicv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21); + +kleidicv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height, bool is_nv21); + +kleidicv_error_t yuv_sp_to_bgra_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21); +} // namespace sve2 + +namespace sme2 { +kleidicv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height, bool is_nv21); + +kleidicv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21); + +kleidicv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height, bool is_nv21); + +kleidicv_error_t yuv_sp_to_bgra_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21); +} // namespace sme2 + +} // namespace kleidicv + +#endif // KLEIDICV_CONVERSIONS_YUV_TO_RGB_H diff --git a/intrinsiccv/include/intrinsiccv/ctypes.h b/kleidicv/include/kleidicv/ctypes.h similarity index 86% rename from intrinsiccv/include/intrinsiccv/ctypes.h rename to kleidicv/include/kleidicv/ctypes.h index a6beac2f9..0349db0a4 100644 --- a/intrinsiccv/include/intrinsiccv/ctypes.h +++ b/kleidicv/include/kleidicv/ctypes.h @@ -16,7 +16,7 @@ #include "stddef.h" #endif // __cplusplus -#include "intrinsiccv/config.h" +#include "kleidicv/config.h" /// Error values reported by KleidiCV typedef enum KLEIDICV_NODISCARD { @@ -32,10 +32,10 @@ typedef enum KLEIDICV_NODISCARD { KLEIDICV_ERROR_ALLOCATION, /// A value did not meet alignment requirements. KLEIDICV_ERROR_ALIGNMENT, - /// The provided context (like @ref intrinsiccv_morphology_context_t) is not + /// The provided context (like @ref kleidicv_morphology_context_t) is not /// compatible with the operation. KLEIDICV_ERROR_CONTEXT_MISMATCH, -} intrinsiccv_error_t; +} kleidicv_error_t; /// Struct to represent a point typedef struct { @@ -43,7 +43,7 @@ typedef struct { size_t x; /// y coordinate size_t y; -} intrinsiccv_point_t; +} kleidicv_point_t; /// Struct to represent a rectangle typedef struct { @@ -51,7 +51,7 @@ typedef struct { size_t width; /// Height of the rectangle size_t height; -} intrinsiccv_rectangle_t; +} kleidicv_rectangle_t; /// Struct to store border values typedef struct { @@ -63,7 +63,7 @@ typedef struct { double bottom; /// Right border value double right; -} intrinsiccv_border_values_t; +} kleidicv_border_values_t; /// KleidiCV border types typedef enum { @@ -85,13 +85,12 @@ typedef enum { KLEIDICV_BORDER_TYPE_TRANSPARENT, /// The border is a hard border, there are no additional values to use. KLEIDICV_BORDER_TYPE_NONE, -} intrinsiccv_border_type_t; +} kleidicv_border_type_t; /// Internal structure where morphology operations store their state -typedef struct intrinsiccv_morphology_context_t_ - intrinsiccv_morphology_context_t; +typedef struct kleidicv_morphology_context_t_ kleidicv_morphology_context_t; /// Internal structure where filter operations store their state -typedef struct intrinsiccv_filter_context_t_ intrinsiccv_filter_context_t; +typedef struct kleidicv_filter_context_t_ kleidicv_filter_context_t; #endif // KLEIDICV_CTYPES_H diff --git a/intrinsiccv/include/intrinsiccv/debug.h b/kleidicv/include/kleidicv/debug.h similarity index 92% rename from intrinsiccv/include/intrinsiccv/debug.h rename to kleidicv/include/kleidicv/debug.h index bdb2cdc26..3de11595f 100644 --- a/intrinsiccv/include/intrinsiccv/debug.h +++ b/kleidicv/include/kleidicv/debug.h @@ -5,15 +5,15 @@ #ifndef KLEIDICV_DEBUG_H #define KLEIDICV_DEBUG_H -#include "intrinsiccv/config.h" +#include "kleidicv/config.h" #if KLEIDICV_TARGET_NEON -#include "intrinsiccv/neon.h" +#include "kleidicv/neon.h" #elif KLEIDICV_TARGET_SVE2 -#include "intrinsiccv/sve2.h" +#include "kleidicv/sve2.h" #endif #include -namespace intrinsiccv { +namespace kleidicv { #if KLEIDICV_TARGET_NEON @@ -67,6 +67,6 @@ template #endif // KLEIDICV_TARGET_SVE2 -} // namespace intrinsiccv +} // namespace kleidicv #endif // KLEIDICV_DEBUG_H diff --git a/intrinsiccv/include/intrinsiccv/dispatch.h b/kleidicv/include/kleidicv/dispatch.h similarity index 98% rename from intrinsiccv/include/intrinsiccv/dispatch.h rename to kleidicv/include/kleidicv/dispatch.h index cee3eb673..18f9056c0 100644 --- a/intrinsiccv/include/intrinsiccv/dispatch.h +++ b/kleidicv/include/kleidicv/dispatch.h @@ -5,7 +5,7 @@ #ifndef KLEIDICV_DISPATCH_H #define KLEIDICV_DISPATCH_H -#include "intrinsiccv/config.h" +#include "kleidicv/config.h" #if KLEIDICV_HAVE_SVE2 || KLEIDICV_HAVE_SME2 #include diff --git a/kleidicv/include/kleidicv/filters/gaussian_blur.h b/kleidicv/include/kleidicv/filters/gaussian_blur.h new file mode 100644 index 000000000..570c245a7 --- /dev/null +++ b/kleidicv/include/kleidicv/filters/gaussian_blur.h @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef KLEIDICV_FILTERS_GAUSSIAN_BLUR_H +#define KLEIDICV_FILTERS_GAUSSIAN_BLUR_H + +#include "kleidicv/config.h" +#include "kleidicv/types.h" + +namespace kleidicv { + +namespace neon { + +kleidicv_error_t gaussian_blur_3x3_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, + size_t channels, + kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context); + +kleidicv_error_t gaussian_blur_5x5_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, + size_t channels, + kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context); + +} // namespace neon + +namespace sve2 { + +kleidicv_error_t gaussian_blur_5x5_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, + size_t channels, + kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context); + +} // namespace sve2 + +namespace sme2 { + +kleidicv_error_t gaussian_blur_5x5_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, + size_t channels, + kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context); + +} // namespace sme2 + +} // namespace kleidicv + +#endif // KLEIDICV_FILTERS_GAUSSIAN_BLUR_H diff --git a/kleidicv/include/kleidicv/filters/sobel.h b/kleidicv/include/kleidicv/filters/sobel.h new file mode 100644 index 000000000..a2c567ae0 --- /dev/null +++ b/kleidicv/include/kleidicv/filters/sobel.h @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef KLEIDICV_FILTERS_SOBEL_H +#define KLEIDICV_FILTERS_SOBEL_H + +#include "kleidicv/kleidicv.h" + +namespace kleidicv { + +namespace neon { +kleidicv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, + size_t src_stride, int16_t *dst, + size_t dst_stride, size_t width, + size_t height, size_t channels); +kleidicv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, + size_t src_stride, int16_t *dst, + size_t dst_stride, size_t width, + size_t height, size_t channels); +} // namespace neon + +namespace sve2 { +kleidicv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, + size_t src_stride, int16_t *dst, + size_t dst_stride, size_t width, + size_t height, size_t channels); +kleidicv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, + size_t src_stride, int16_t *dst, + size_t dst_stride, size_t width, + size_t height, size_t channels); +} // namespace sve2 + +namespace sme2 { +kleidicv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, + size_t src_stride, int16_t *dst, + size_t dst_stride, size_t width, + size_t height, size_t channels); +kleidicv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, + size_t src_stride, int16_t *dst, + size_t dst_stride, size_t width, + size_t height, size_t channels); +} // namespace sme2 + +} // namespace kleidicv + +#endif // KLEIDICV_FILTERS_SOBEL_H diff --git a/intrinsiccv/include/intrinsiccv/intrinsiccv.h b/kleidicv/include/kleidicv/kleidicv.h similarity index 88% rename from intrinsiccv/include/intrinsiccv/intrinsiccv.h rename to kleidicv/include/kleidicv/kleidicv.h index 9b001e3f1..c9131b499 100644 --- a/intrinsiccv/include/intrinsiccv/intrinsiccv.h +++ b/kleidicv/include/kleidicv/kleidicv.h @@ -4,9 +4,9 @@ /// @mainpage /// -/// For documentation of the KleidiCV C API see @ref intrinsiccv.h +/// For documentation of the KleidiCV C API see @ref kleidicv.h /// -/// Project page: https://gitlab.arm.com/intrinsiccv/intrinsiccv +/// Project page: https://gitlab.arm.com/kleidicv/kleidicv /// /// KleidiCV shall use Semantic /// Versioning 2.0.0. The public API is defined according to what is @@ -18,13 +18,13 @@ /// @file /// @brief For an overview of the functions and their supported types see -/// @ref intrinsiccv/src/supported-types.md. +/// @ref kleidicv/src/supported-types.md. #ifndef KLEIDICV_H #define KLEIDICV_H -#include "intrinsiccv/config.h" -#include "intrinsiccv/ctypes.h" +#include "kleidicv/config.h" +#include "kleidicv/ctypes.h" #ifndef __aarch64__ #error "KleidiCV is only supported for aarch64" @@ -49,11 +49,10 @@ extern "C" { #endif // __cplusplus #ifdef DOXYGEN -#define KLEIDICV_API_DECLARATION(name, ...) \ - intrinsiccv_error_t name(__VA_ARGS__) +#define KLEIDICV_API_DECLARATION(name, ...) kleidicv_error_t name(__VA_ARGS__) #else #define KLEIDICV_API_DECLARATION(name, ...) \ - extern intrinsiccv_error_t (*name)(__VA_ARGS__) + extern kleidicv_error_t (*name)(__VA_ARGS__) #endif #define KLEIDICV_BINARY_OP(name, type) \ @@ -94,21 +93,21 @@ extern "C" { /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// -KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_s8, int8_t); -/// @copydoc intrinsiccv_saturating_add_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_u8, uint8_t); -/// @copydoc intrinsiccv_saturating_add_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_s16, int16_t); -/// @copydoc intrinsiccv_saturating_add_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_u16, uint16_t); -/// @copydoc intrinsiccv_saturating_add_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_s32, int32_t); -/// @copydoc intrinsiccv_saturating_add_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_u32, uint32_t); -/// @copydoc intrinsiccv_saturating_add_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_s64, int64_t); -/// @copydoc intrinsiccv_saturating_add_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_u64, uint64_t); +KLEIDICV_BINARY_OP(kleidicv_saturating_add_s8, int8_t); +/// @copydoc kleidicv_saturating_add_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_add_u8, uint8_t); +/// @copydoc kleidicv_saturating_add_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_add_s16, int16_t); +/// @copydoc kleidicv_saturating_add_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_add_u16, uint16_t); +/// @copydoc kleidicv_saturating_add_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_add_s32, int32_t); +/// @copydoc kleidicv_saturating_add_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_add_u32, uint32_t); +/// @copydoc kleidicv_saturating_add_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_add_s64, int64_t); +/// @copydoc kleidicv_saturating_add_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_add_u64, uint64_t); /// Subtracts the value of the corresponding element in `src_b` from `src_a`, /// and puts the result into `dst`. @@ -137,21 +136,21 @@ KLEIDICV_BINARY_OP(intrinsiccv_saturating_add_u64, uint64_t); /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// -KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_s8, int8_t); -/// @copydoc intrinsiccv_saturating_sub_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_u8, uint8_t); -/// @copydoc intrinsiccv_saturating_sub_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_s16, int16_t); -/// @copydoc intrinsiccv_saturating_sub_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_u16, uint16_t); -/// @copydoc intrinsiccv_saturating_sub_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_s32, int32_t); -/// @copydoc intrinsiccv_saturating_sub_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_u32, uint32_t); -/// @copydoc intrinsiccv_saturating_sub_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_s64, int64_t); -/// @copydoc intrinsiccv_saturating_sub_s8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_u64, uint64_t); +KLEIDICV_BINARY_OP(kleidicv_saturating_sub_s8, int8_t); +/// @copydoc kleidicv_saturating_sub_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_sub_u8, uint8_t); +/// @copydoc kleidicv_saturating_sub_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_sub_s16, int16_t); +/// @copydoc kleidicv_saturating_sub_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_sub_u16, uint16_t); +/// @copydoc kleidicv_saturating_sub_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_sub_s32, int32_t); +/// @copydoc kleidicv_saturating_sub_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_sub_u32, uint32_t); +/// @copydoc kleidicv_saturating_sub_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_sub_s64, int64_t); +/// @copydoc kleidicv_saturating_sub_s8 +KLEIDICV_BINARY_OP(kleidicv_saturating_sub_u64, uint64_t); /// From the corresponding elements in `src_a` and `src_b`, subtracts the lower /// one from the higher one, and puts the result into `dst`. @@ -180,15 +179,15 @@ KLEIDICV_BINARY_OP(intrinsiccv_saturating_sub_u64, uint64_t); /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// -KLEIDICV_BINARY_OP(intrinsiccv_saturating_absdiff_u8, uint8_t); -/// @copydoc intrinsiccv_saturating_absdiff_u8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_absdiff_s8, int8_t); -/// @copydoc intrinsiccv_saturating_absdiff_u8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_absdiff_u16, uint16_t); -/// @copydoc intrinsiccv_saturating_absdiff_u8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_absdiff_s16, int16_t); -/// @copydoc intrinsiccv_saturating_absdiff_u8 -KLEIDICV_BINARY_OP(intrinsiccv_saturating_absdiff_s32, int32_t); +KLEIDICV_BINARY_OP(kleidicv_saturating_absdiff_u8, uint8_t); +/// @copydoc kleidicv_saturating_absdiff_u8 +KLEIDICV_BINARY_OP(kleidicv_saturating_absdiff_s8, int8_t); +/// @copydoc kleidicv_saturating_absdiff_u8 +KLEIDICV_BINARY_OP(kleidicv_saturating_absdiff_u16, uint16_t); +/// @copydoc kleidicv_saturating_absdiff_u8 +KLEIDICV_BINARY_OP(kleidicv_saturating_absdiff_s16, int16_t); +/// @copydoc kleidicv_saturating_absdiff_u8 +KLEIDICV_BINARY_OP(kleidicv_saturating_absdiff_s32, int32_t); /// Multiplies the values of the corresponding elements in `src_a` and `src_b`, /// and puts the result into `dst`. @@ -218,15 +217,15 @@ KLEIDICV_BINARY_OP(intrinsiccv_saturating_absdiff_s32, int32_t); /// @param height Number of rows in the data. /// @param scale Currently unused parameter. /// -KLEIDICV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_u8, uint8_t, double); -/// @copydoc intrinsiccv_saturating_multiply_u8 -KLEIDICV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s8, int8_t, double); -/// @copydoc intrinsiccv_saturating_multiply_u8 -KLEIDICV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_u16, uint16_t, double); -/// @copydoc intrinsiccv_saturating_multiply_u8 -KLEIDICV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s16, int16_t, double); -/// @copydoc intrinsiccv_saturating_multiply_u8 -KLEIDICV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s32, int32_t, double); +KLEIDICV_BINARY_OP_SCALE(kleidicv_saturating_multiply_u8, uint8_t, double); +/// @copydoc kleidicv_saturating_multiply_u8 +KLEIDICV_BINARY_OP_SCALE(kleidicv_saturating_multiply_s8, int8_t, double); +/// @copydoc kleidicv_saturating_multiply_u8 +KLEIDICV_BINARY_OP_SCALE(kleidicv_saturating_multiply_u16, uint16_t, double); +/// @copydoc kleidicv_saturating_multiply_u8 +KLEIDICV_BINARY_OP_SCALE(kleidicv_saturating_multiply_s16, int16_t, double); +/// @copydoc kleidicv_saturating_multiply_u8 +KLEIDICV_BINARY_OP_SCALE(kleidicv_saturating_multiply_s32, int32_t, double); /// Adds the absolute values of the corresponding elements in `src_a` and /// `src_b`. Then, performs a comparison of each element's value in the result @@ -259,7 +258,7 @@ KLEIDICV_BINARY_OP_SCALE(intrinsiccv_saturating_multiply_s32, int32_t, double); /// @param threshold The value that the elements of the addition result /// are compared to. /// -KLEIDICV_API_DECLARATION(intrinsiccv_saturating_add_abs_with_threshold_s16, +KLEIDICV_API_DECLARATION(kleidicv_saturating_add_abs_with_threshold_s16, const int16_t *src_a, size_t src_a_stride, const int16_t *src_b, size_t src_b_stride, int16_t *dst, size_t dst_stride, size_t width, @@ -286,7 +285,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_saturating_add_abs_with_threshold_s16, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_gray_to_rgb_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_gray_to_rgb_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height); @@ -311,7 +310,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_gray_to_rgb_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_gray_to_rgba_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_gray_to_rgba_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height); @@ -336,7 +335,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_gray_to_rgba_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_bgr_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_rgb_to_bgr_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height); @@ -357,7 +356,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_bgr_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_rgb_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_rgb_to_rgb_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height); @@ -382,7 +381,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_rgb_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_bgra_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_rgba_to_bgra_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height); @@ -403,7 +402,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_bgra_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_rgba_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_rgba_to_rgba_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height); @@ -429,7 +428,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_rgba_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_bgra_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_rgb_to_bgra_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height); @@ -455,7 +454,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_bgra_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_rgba_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_rgb_to_rgba_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height); @@ -481,7 +480,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_rgb_to_rgba_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_bgr_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_rgba_to_bgr_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height); @@ -507,7 +506,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_bgr_u8, const uint8_t *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_rgb_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_rgba_to_rgb_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height); @@ -517,7 +516,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_rgb_u8, const uint8_t *src, /// | R,G,B | R,G,B | R,G,B | ... /// Where each letter represents one byte of data, and one pixel is represented /// by 3 bytes. There is no padding between the pixels. -/// If 4-byte alignment is required then intrinsiccv_yuv_sp_to_rgba_u8 can be +/// If 4-byte alignment is required then kleidicv_yuv_sp_to_rgba_u8 can be /// used. /// /// Width and height are the same for the source and for the destination. Number @@ -543,7 +542,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_rgba_to_rgb_u8, const uint8_t *src, /// @param is_nv21 If true, input is treated as NV21, otherwise treated /// as NV12. /// -KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgb_u8, const uint8_t *src_y, +KLEIDICV_API_DECLARATION(kleidicv_yuv_sp_to_rgb_u8, const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21); @@ -554,7 +553,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgb_u8, const uint8_t *src_y, /// | B,G,R | B,G,R | B,G,R | ... /// Where each letter represents one byte of data, and one pixel is represented /// by 3 bytes. There is no padding between the pixels. -/// If 4-byte alignment is required then intrinsiccv_yuv_sp_to_bgra_u8 can be +/// If 4-byte alignment is required then kleidicv_yuv_sp_to_bgra_u8 can be /// used. /// /// Width and height are the same for the source and for the destination. Number @@ -580,7 +579,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgb_u8, const uint8_t *src_y, /// @param is_nv21 If true, input is treated as NV21, otherwise treated /// as NV12. /// -KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_bgr_u8, const uint8_t *src_y, +KLEIDICV_API_DECLARATION(kleidicv_yuv_sp_to_bgr_u8, const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21); @@ -616,7 +615,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_bgr_u8, const uint8_t *src_y, /// @param is_nv21 If true, input is treated as NV21, otherwise treated /// as NV12. /// -KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgba_u8, const uint8_t *src_y, +KLEIDICV_API_DECLARATION(kleidicv_yuv_sp_to_rgba_u8, const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21); @@ -652,7 +651,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_rgba_u8, const uint8_t *src_y, /// @param is_nv21 If true, input is treated as NV21, otherwise treated /// as NV12. /// -KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_bgra_u8, const uint8_t *src_y, +KLEIDICV_API_DECLARATION(kleidicv_yuv_sp_to_bgra_u8, const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21); @@ -680,17 +679,17 @@ KLEIDICV_API_DECLARATION(intrinsiccv_yuv_sp_to_bgra_u8, const uint8_t *src_y, /// compared to. /// @param value The value that the larger elements are set to. /// -KLEIDICV_API_DECLARATION(intrinsiccv_threshold_binary_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_threshold_binary_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, uint8_t threshold, uint8_t value); /// Creates a morphology context according to the parameters. /// -/// Before a @ref intrinsiccv_dilate_u8 "dilate" or @ref intrinsiccv_erode_u8 +/// Before a @ref kleidicv_dilate_u8 "dilate" or @ref kleidicv_erode_u8 /// "erode" operation, this initialization is needed. After the operation is /// finished, the context needs to be released using @ref -/// intrinsiccv_morphology_release. +/// kleidicv_morphology_release. /// /// @param context Pointer where to return the created context's address. /// @param kernel Width and height of the kernel. Its size must not be @@ -712,19 +711,19 @@ KLEIDICV_API_DECLARATION(intrinsiccv_threshold_binary_u8, const uint8_t *src, /// @param image Image dimensions. Its size must not be more than /// @ref KLEIDICV_MAX_IMAGE_PIXELS. /// -intrinsiccv_error_t intrinsiccv_morphology_create( - intrinsiccv_morphology_context_t **context, intrinsiccv_rectangle_t kernel, - intrinsiccv_point_t anchor, intrinsiccv_border_type_t border_type, - intrinsiccv_border_values_t border_values, size_t channels, - size_t iterations, size_t type_size, intrinsiccv_rectangle_t image); +kleidicv_error_t kleidicv_morphology_create( + kleidicv_morphology_context_t **context, kleidicv_rectangle_t kernel, + kleidicv_point_t anchor, kleidicv_border_type_t border_type, + kleidicv_border_values_t border_values, size_t channels, size_t iterations, + size_t type_size, kleidicv_rectangle_t image); /// Releases a morphology context that was previously created using @ref -/// intrinsiccv_morphology_create. +/// kleidicv_morphology_create. /// /// @param context Pointer to morphology context. Must not be nullptr. /// -intrinsiccv_error_t intrinsiccv_morphology_release( - intrinsiccv_morphology_context_t *context); +kleidicv_error_t kleidicv_morphology_release( + kleidicv_morphology_context_t *context); /// Calculates maximum (dilate) or minimum (erode) element value of `src` /// values using a given kernel which has a rectangular shape, and puts the @@ -747,8 +746,8 @@ intrinsiccv_error_t intrinsiccv_morphology_release( /// Usage: /// /// Before using this function, a context must be created using -/// @ref intrinsiccv_morphology_create, and after finished, it has to be -/// released using @ref intrinsiccv_morphology_release. +/// @ref kleidicv_morphology_create, and after finished, it has to be +/// released using @ref kleidicv_morphology_release. /// The context must be created with the same image dimensions as width and /// height parameters, with sizeof(uint8) as size_type, and with the channel /// number of the data as channels. @@ -765,17 +764,17 @@ intrinsiccv_error_t intrinsiccv_morphology_release( /// @param height Number of rows in the data. /// @param context Pointer to morphology context. /// -KLEIDICV_API_DECLARATION(intrinsiccv_dilate_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_dilate_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, - intrinsiccv_morphology_context_t *context); + kleidicv_morphology_context_t *context); -/// @copydoc intrinsiccv_dilate_u8 +/// @copydoc kleidicv_dilate_u8 /// -KLEIDICV_API_DECLARATION(intrinsiccv_erode_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_erode_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, - intrinsiccv_morphology_context_t *context); + kleidicv_morphology_context_t *context); /// Counts how many nonzero elements are in the source data. Number of elements /// is limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. @@ -789,7 +788,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_erode_u8, const uint8_t *src, /// @param height Number of rows in the data. /// @param count Pointer to variable to store result. Must be non-null. /// -KLEIDICV_API_DECLARATION(intrinsiccv_count_nonzeros_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_count_nonzeros_u8, const uint8_t *src, size_t src_stride, size_t width, size_t height, size_t *count); @@ -836,7 +835,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_count_nonzeros_u8, const uint8_t *src, /// For odd src_height it must be either src_height / 2 /// or (src_height / 2) + 1. /// -KLEIDICV_API_DECLARATION(intrinsiccv_resize_to_quarter_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_resize_to_quarter_u8, const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height); @@ -866,7 +865,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_resize_to_quarter_u8, const uint8_t *src, /// @param dst_height Number of rows in the destination data. /// Must be src_height * 2. /// -KLEIDICV_API_DECLARATION(intrinsiccv_resize_linear_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_resize_linear_u8, const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height); @@ -903,10 +902,9 @@ KLEIDICV_API_DECLARATION(intrinsiccv_resize_linear_u8, const uint8_t *src, /// @param channels Number of channels in the data. Must be not more than /// @ref KLEIDICV_MAXIMUM_CHANNEL_COUNT. /// -KLEIDICV_API_DECLARATION(intrinsiccv_sobel_3x3_vertical_s16_u8, - const uint8_t *src, size_t src_stride, int16_t *dst, - size_t dst_stride, size_t width, size_t height, - size_t channels); +KLEIDICV_API_DECLARATION(kleidicv_sobel_3x3_vertical_s16_u8, const uint8_t *src, + size_t src_stride, int16_t *dst, size_t dst_stride, + size_t width, size_t height, size_t channels); /// Calculates horizontal derivative approximation with Sobel filter. /// @@ -940,7 +938,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_sobel_3x3_vertical_s16_u8, /// @param channels Number of channels in the data. Must be not more than /// @ref KLEIDICV_MAXIMUM_CHANNEL_COUNT. /// -KLEIDICV_API_DECLARATION(intrinsiccv_sobel_3x3_horizontal_s16_u8, +KLEIDICV_API_DECLARATION(kleidicv_sobel_3x3_horizontal_s16_u8, const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels); @@ -973,7 +971,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_sobel_3x3_horizontal_s16_u8, /// @param low_threshold Low threshold for the edge detector algorithm. /// @param high_threshold High threshold for the edge detector algorithm. /// -KLEIDICV_API_DECLARATION(intrinsiccv_canny_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_canny_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, double low_threshold, double high_threshold); @@ -983,7 +981,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_canny_u8, const uint8_t *src, /// /// Before a gaussian_blur operation, this initialization is needed. /// After the operation is finished, the context needs to be released -/// using @ref intrinsiccv_filter_release. +/// using @ref kleidicv_filter_release. /// /// @param context Pointer where to return the created context's address. /// @param channels Number of channels in the data. Must be not more than @@ -993,17 +991,16 @@ KLEIDICV_API_DECLARATION(intrinsiccv_canny_u8, const uint8_t *src, /// @param image Image dimensions. Its size must not be more than /// @ref KLEIDICV_MAX_IMAGE_PIXELS. /// -intrinsiccv_error_t intrinsiccv_filter_create( - intrinsiccv_filter_context_t **context, size_t channels, size_t type_size, - intrinsiccv_rectangle_t image); +kleidicv_error_t kleidicv_filter_create(kleidicv_filter_context_t **context, + size_t channels, size_t type_size, + kleidicv_rectangle_t image); /// Releases a filter context that was previously created using @ref -/// intrinsiccv_filter_create. +/// kleidicv_filter_create. /// /// @param context Pointer to filter context. Must not be nullptr. /// -intrinsiccv_error_t intrinsiccv_filter_release( - intrinsiccv_filter_context_t *context); +kleidicv_error_t kleidicv_filter_release(kleidicv_filter_context_t *context); /// Convolves the source image with the specified Gaussian kernel. /// In-place filtering is not supported. @@ -1028,8 +1025,8 @@ intrinsiccv_error_t intrinsiccv_filter_release( /// /// Usage: \n /// Before using this function, a context must be created using -/// intrinsiccv_filter_create, and after finished, it has to be released -/// using intrinsiccv_filter_release. The context must be created with the same +/// kleidicv_filter_create, and after finished, it has to be released +/// using kleidicv_filter_release. The context must be created with the same /// image dimensions as width and height parameters, with sizeof(uint8) as /// size_type, and with the channel number of the data as channels. \n /// Note, from the border types only these are supported: \n @@ -1056,19 +1053,19 @@ intrinsiccv_error_t intrinsiccv_filter_release( /// @param border_type Way of handling the border. /// @param context Pointer to filter context. /// -KLEIDICV_API_DECLARATION(intrinsiccv_gaussian_blur_3x3_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_gaussian_blur_3x3_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context); + kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context); -/// @copydoc intrinsiccv_gaussian_blur_3x3_u8 +/// @copydoc kleidicv_gaussian_blur_3x3_u8 /// -KLEIDICV_API_DECLARATION(intrinsiccv_gaussian_blur_5x5_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_gaussian_blur_5x5_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context); + kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context); /// Splits a multi channel source stream into separate 1-channel streams. Width /// and height are the same for the source stream and for all the destination @@ -1098,7 +1095,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_gaussian_blur_5x5_u8, const uint8_t *src, /// 4. /// @param element_size Size of one element in bytes. Must be 1, 2, 4 or 8. /// -KLEIDICV_API_DECLARATION(intrinsiccv_split, const void *src_data, +KLEIDICV_API_DECLARATION(kleidicv_split, const void *src_data, size_t src_stride, void **dst_data, const size_t *dst_strides, size_t width, size_t height, size_t channels, size_t element_size); @@ -1134,10 +1131,9 @@ KLEIDICV_API_DECLARATION(intrinsiccv_split, const void *src_data, /// @param src_height Number of rows in the data. /// @param element_size Size of one element in bytes. Must be 1, 2, 4 or 8. /// -KLEIDICV_API_DECLARATION(intrinsiccv_transpose, const void *src, - size_t src_stride, void *dst, size_t dst_stride, - size_t src_width, size_t src_height, - size_t element_size); +KLEIDICV_API_DECLARATION(kleidicv_transpose, const void *src, size_t src_stride, + void *dst, size_t dst_stride, size_t src_width, + size_t src_height, size_t element_size); /// Merges separate 1-channel source streams to one multi channel stream. Width /// and height are the same for all the source streams and for the destination. @@ -1167,7 +1163,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_transpose, const void *src, /// 3 or 4. /// @param element_size Size of one element in bytes. Must be 1, 2, 4 or 8. /// -KLEIDICV_API_DECLARATION(intrinsiccv_merge, const void **srcs, +KLEIDICV_API_DECLARATION(kleidicv_merge, const void **srcs, const size_t *src_strides, void *dst, size_t dst_stride, size_t width, size_t height, size_t channels, size_t element_size); @@ -1187,23 +1183,23 @@ KLEIDICV_API_DECLARATION(intrinsiccv_merge, const void **srcs, /// @param max_value Pointer to save result maximum value to, or nullptr if /// maximum is not to be calculated. /// -KLEIDICV_API_DECLARATION(intrinsiccv_min_max_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_min_max_u8, const uint8_t *src, size_t src_stride, size_t width, size_t height, uint8_t *min_value, uint8_t *max_value); -/// @copydoc intrinsiccv_min_max_u8 -KLEIDICV_API_DECLARATION(intrinsiccv_min_max_s8, const int8_t *src, +/// @copydoc kleidicv_min_max_u8 +KLEIDICV_API_DECLARATION(kleidicv_min_max_s8, const int8_t *src, size_t src_stride, size_t width, size_t height, int8_t *min_value, int8_t *max_value); -/// @copydoc intrinsiccv_min_max_u8 -KLEIDICV_API_DECLARATION(intrinsiccv_min_max_u16, const uint16_t *src, +/// @copydoc kleidicv_min_max_u8 +KLEIDICV_API_DECLARATION(kleidicv_min_max_u16, const uint16_t *src, size_t src_stride, size_t width, size_t height, uint16_t *min_value, uint16_t *max_value); -/// @copydoc intrinsiccv_min_max_u8 -KLEIDICV_API_DECLARATION(intrinsiccv_min_max_s16, const int16_t *src, +/// @copydoc kleidicv_min_max_u8 +KLEIDICV_API_DECLARATION(kleidicv_min_max_s16, const int16_t *src, size_t src_stride, size_t width, size_t height, int16_t *min_value, int16_t *max_value); -/// @copydoc intrinsiccv_min_max_u8 -KLEIDICV_API_DECLARATION(intrinsiccv_min_max_s32, const int32_t *src, +/// @copydoc kleidicv_min_max_u8 +KLEIDICV_API_DECLARATION(kleidicv_min_max_s32, const int32_t *src, size_t src_stride, size_t width, size_t height, int32_t *min_value, int32_t *max_value); @@ -1224,7 +1220,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_min_max_s32, const int32_t *src, /// @param max_offset Pointer to save result offset of maximum value to, or /// nullptr if maximum is not to be calculated. /// -KLEIDICV_API_DECLARATION(intrinsiccv_min_max_loc_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_min_max_loc_u8, const uint8_t *src, size_t src_stride, size_t width, size_t height, size_t *min_offset, size_t *max_offset); @@ -1250,7 +1246,7 @@ KLEIDICV_API_DECLARATION(intrinsiccv_min_max_loc_u8, const uint8_t *src, /// @param scale Value to multiply the input by. /// @param shift Value to add to the result. /// -KLEIDICV_API_DECLARATION(intrinsiccv_scale_u8, const uint8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_scale_u8, const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, float scale, float shift); @@ -1275,11 +1271,11 @@ KLEIDICV_API_DECLARATION(intrinsiccv_scale_u8, const uint8_t *src, /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_float_conversion_f32_s8, const float *src, +KLEIDICV_API_DECLARATION(kleidicv_float_conversion_f32_s8, const float *src, size_t src_stride, int8_t *dst, size_t dst_stride, size_t width, size_t height); -/// @copydoc intrinsiccv_float_conversion_f32_s8 -KLEIDICV_API_DECLARATION(intrinsiccv_float_conversion_f32_u8, const float *src, +/// @copydoc kleidicv_float_conversion_f32_s8 +KLEIDICV_API_DECLARATION(kleidicv_float_conversion_f32_u8, const float *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height); @@ -1305,13 +1301,13 @@ KLEIDICV_API_DECLARATION(intrinsiccv_float_conversion_f32_u8, const float *src, /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// -KLEIDICV_API_DECLARATION(intrinsiccv_float_conversion_s8_f32, const int8_t *src, +KLEIDICV_API_DECLARATION(kleidicv_float_conversion_s8_f32, const int8_t *src, + size_t src_stride, float *dst, size_t dst_stride, + size_t width, size_t height); +/// @copydoc kleidicv_float_conversion_s8_f32 +KLEIDICV_API_DECLARATION(kleidicv_float_conversion_u8_f32, const uint8_t *src, size_t src_stride, float *dst, size_t dst_stride, size_t width, size_t height); -/// @copydoc intrinsiccv_float_conversion_s8_f32 -KLEIDICV_API_DECLARATION(intrinsiccv_float_conversion_u8_f32, - const uint8_t *src, size_t src_stride, float *dst, - size_t dst_stride, size_t width, size_t height); #ifdef __cplusplus } // extern "C" diff --git a/intrinsiccv/include/intrinsiccv/morphology/workspace.h b/kleidicv/include/kleidicv/morphology/workspace.h similarity index 94% rename from intrinsiccv/include/intrinsiccv/morphology/workspace.h rename to kleidicv/include/kleidicv/morphology/workspace.h index c83ff422e..fb7c9e486 100644 --- a/intrinsiccv/include/intrinsiccv/morphology/workspace.h +++ b/kleidicv/include/kleidicv/morphology/workspace.h @@ -10,8 +10,8 @@ #include #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/types.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/types.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -40,7 +40,7 @@ class MorphologyWorkspace final { }; static std::optional get_border_type( - intrinsiccv_border_type_t border_type) KLEIDICV_STREAMING_COMPATIBLE { + kleidicv_border_type_t border_type) KLEIDICV_STREAMING_COMPATIBLE { switch (border_type) { case KLEIDICV_BORDER_TYPE_REPLICATE: return BorderType::REPLICATE; @@ -67,12 +67,11 @@ class MorphologyWorkspace final { MorphologyWorkspace() = delete; // Creates a workspace on the heap. - static intrinsiccv_error_t create( - Pointer &workspace, intrinsiccv_rectangle_t kernel, - intrinsiccv_point_t anchor, BorderType border_type, - intrinsiccv_border_values_t border_values, size_t channels, - size_t iterations, size_t type_size, - intrinsiccv_rectangle_t image) KLEIDICV_STREAMING_COMPATIBLE { + static kleidicv_error_t create( + Pointer &workspace, kleidicv_rectangle_t kernel, kleidicv_point_t anchor, + BorderType border_type, kleidicv_border_values_t border_values, + size_t channels, size_t iterations, size_t type_size, + kleidicv_rectangle_t image) KLEIDICV_STREAMING_COMPATIBLE { // These values are arbitrarily choosen. const size_t rows_per_iteration = std::max(2 * kernel.height, 32UL); // To avoid load/store penalties. @@ -150,10 +149,10 @@ class MorphologyWorkspace final { return KLEIDICV_OK; } - intrinsiccv_rectangle_t kernel() const { return kernel_; } - intrinsiccv_point_t anchor() const { return anchor_; } + kleidicv_rectangle_t kernel() const { return kernel_; } + kleidicv_point_t anchor() const { return anchor_; } BorderType border_type() const { return border_type_; } - intrinsiccv_border_values_t border_values() const { return border_values_; } + kleidicv_border_values_t border_values() const { return border_values_; } size_t channels() const { return channels_; } size_t iterations() const { return iterations_; } size_t type_size() const { return type_size_; } @@ -358,10 +357,10 @@ class MorphologyWorkspace final { static_assert(sizeof(Pointer) == sizeof(void *), "Unexpected type size"); - intrinsiccv_rectangle_t kernel_; - intrinsiccv_point_t anchor_; + kleidicv_rectangle_t kernel_; + kleidicv_point_t anchor_; BorderType border_type_; - intrinsiccv_border_values_t border_values_; + kleidicv_border_values_t border_values_; size_t iterations_; size_t type_size_; Rectangle image_size_; diff --git a/intrinsiccv/include/intrinsiccv/neon.h b/kleidicv/include/kleidicv/neon.h similarity index 98% rename from intrinsiccv/include/intrinsiccv/neon.h rename to kleidicv/include/kleidicv/neon.h index 00ea66e24..68c9d9eb9 100644 --- a/intrinsiccv/include/intrinsiccv/neon.h +++ b/kleidicv/include/kleidicv/neon.h @@ -7,12 +7,12 @@ #include -#include "intrinsiccv/neon_intrinsics.h" -#include "intrinsiccv/operations.h" -#include "intrinsiccv/utils.h" -#include "intrinsiccv/workspace/separable.h" +#include "kleidicv/neon_intrinsics.h" +#include "kleidicv/operations.h" +#include "kleidicv/utils.h" +#include "kleidicv/workspace/separable.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template <> class half_element_width { @@ -575,6 +575,6 @@ using SeparableFilter3x3 = SeparableFilter; template using SeparableFilter5x5 = SeparableFilter; -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon #endif // KLEIDICV_NEON_H diff --git a/intrinsiccv/include/intrinsiccv/neon_intrinsics.h b/kleidicv/include/kleidicv/neon_intrinsics.h similarity index 99% rename from intrinsiccv/include/intrinsiccv/neon_intrinsics.h rename to kleidicv/include/kleidicv/neon_intrinsics.h index 825191ef7..b90ee2e4d 100644 --- a/intrinsiccv/include/intrinsiccv/neon_intrinsics.h +++ b/kleidicv/include/kleidicv/neon_intrinsics.h @@ -13,7 +13,7 @@ #include -namespace intrinsiccv::neon { +namespace kleidicv::neon { // ----------------------------------------------------------------------------- // NEON binary operations @@ -409,6 +409,6 @@ static inline uint64x2_t vreinterpretq_u64(uint64x2_t vec) { return vec; } // clang-format on -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon #endif // KLEIDICV_NEON_INTRINSICS_H diff --git a/intrinsiccv/include/intrinsiccv/operations.h b/kleidicv/include/kleidicv/operations.h similarity index 99% rename from intrinsiccv/include/intrinsiccv/operations.h rename to kleidicv/include/kleidicv/operations.h index 7b86d079e..d6c736c5e 100644 --- a/intrinsiccv/include/intrinsiccv/operations.h +++ b/kleidicv/include/kleidicv/operations.h @@ -8,8 +8,8 @@ #include #include -#include "intrinsiccv/traits.h" -#include "intrinsiccv/types.h" +#include "kleidicv/traits.h" +#include "kleidicv/types.h" namespace KLEIDICV_TARGET_NAMESPACE { diff --git a/kleidicv/include/kleidicv/resize/resize.h b/kleidicv/include/kleidicv/resize/resize.h new file mode 100644 index 000000000..4fa23350f --- /dev/null +++ b/kleidicv/include/kleidicv/resize/resize.h @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef KLEIDICV_RESIZE_RESIZE_H +#define KLEIDICV_RESIZE_RESIZE_H + +#include "kleidicv/kleidicv.h" + +namespace kleidicv { + +namespace neon { +kleidicv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, + size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, + size_t dst_width, size_t dst_height); +} // namespace neon + +namespace sve2 { +kleidicv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, + size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, + size_t dst_width, size_t dst_height); +} // namespace sve2 + +namespace sme2 { +kleidicv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, + size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, + size_t dst_width, size_t dst_height); +} // namespace sme2 + +} // namespace kleidicv + +#endif // KLEIDICV_RESIZE_RESIZE_H diff --git a/kleidicv/include/kleidicv/resize/resize_linear.h b/kleidicv/include/kleidicv/resize/resize_linear.h new file mode 100644 index 000000000..78b0fa046 --- /dev/null +++ b/kleidicv/include/kleidicv/resize/resize_linear.h @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef KLEIDICV_RESIZE_RESIZE_LINEAR_H +#define KLEIDICV_RESIZE_RESIZE_LINEAR_H + +#include "kleidicv/kleidicv.h" + +namespace kleidicv { + +namespace neon { +kleidicv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, + size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, + size_t dst_width, size_t dst_height); +} // namespace neon + +namespace sve2 { +kleidicv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, + size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, + size_t dst_width, size_t dst_height); +} // namespace sve2 + +namespace sme2 { +kleidicv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, + size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, + size_t dst_width, size_t dst_height); +} // namespace sme2 + +} // namespace kleidicv + +#endif // KLEIDICV_RESIZE_RESIZE_H diff --git a/intrinsiccv/include/intrinsiccv/sve2.h b/kleidicv/include/kleidicv/sve2.h similarity index 99% rename from intrinsiccv/include/intrinsiccv/sve2.h rename to kleidicv/include/kleidicv/sve2.h index 6b83d0e12..bedd2cbd6 100644 --- a/intrinsiccv/include/intrinsiccv/sve2.h +++ b/kleidicv/include/kleidicv/sve2.h @@ -9,9 +9,9 @@ #include -#include "intrinsiccv/operations.h" -#include "intrinsiccv/utils.h" -#include "intrinsiccv/workspace/separable.h" +#include "kleidicv/operations.h" +#include "kleidicv/utils.h" +#include "kleidicv/workspace/separable.h" // It is used by SVE2 and SME2, the actual namespace will reflect it. namespace KLEIDICV_TARGET_NAMESPACE { diff --git a/intrinsiccv/include/intrinsiccv/traits.h b/kleidicv/include/kleidicv/traits.h similarity index 99% rename from intrinsiccv/include/intrinsiccv/traits.h rename to kleidicv/include/kleidicv/traits.h index 0102f4770..17b56cb4f 100644 --- a/intrinsiccv/include/intrinsiccv/traits.h +++ b/kleidicv/include/kleidicv/traits.h @@ -7,7 +7,7 @@ #include -#include "intrinsiccv/config.h" +#include "kleidicv/config.h" namespace KLEIDICV_TARGET_NAMESPACE { diff --git a/intrinsiccv/include/intrinsiccv/types.h b/kleidicv/include/kleidicv/types.h similarity index 98% rename from intrinsiccv/include/intrinsiccv/types.h rename to kleidicv/include/kleidicv/types.h index 2d3e1bfc1..717c7d478 100644 --- a/intrinsiccv/include/intrinsiccv/types.h +++ b/kleidicv/include/kleidicv/types.h @@ -9,9 +9,9 @@ #include #include -#include "intrinsiccv/config.h" -#include "intrinsiccv/ctypes.h" -#include "intrinsiccv/utils.h" +#include "kleidicv/config.h" +#include "kleidicv/ctypes.h" +#include "kleidicv/utils.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -39,7 +39,7 @@ class Rectangle final { explicit Rectangle(int width, int height) KLEIDICV_STREAMING_COMPATIBLE : Rectangle(static_cast(width), static_cast(height)) {} - explicit Rectangle(intrinsiccv_rectangle_t rect) KLEIDICV_STREAMING_COMPATIBLE + explicit Rectangle(kleidicv_rectangle_t rect) KLEIDICV_STREAMING_COMPATIBLE : Rectangle(rect.width, rect.height) {} size_t width() const KLEIDICV_STREAMING_COMPATIBLE { return width_; } @@ -82,8 +82,8 @@ class Margin final { right_(margin), bottom_(margin) {} - explicit Margin(intrinsiccv_rectangle_t kernel, - intrinsiccv_point_t anchor) KLEIDICV_STREAMING_COMPATIBLE + explicit Margin(kleidicv_rectangle_t kernel, + kleidicv_point_t anchor) KLEIDICV_STREAMING_COMPATIBLE : Margin(anchor.x, anchor.y, kernel.width - anchor.x - 1, kernel.height - anchor.y - 1) {} @@ -116,7 +116,7 @@ class Border final { right_{saturating_cast(right)}, bottom_{saturating_cast(bottom)} {} - explicit Border(intrinsiccv_border_values_t border_values) + explicit Border(kleidicv_border_values_t border_values) KLEIDICV_STREAMING_COMPATIBLE : Border(border_values.left, border_values.top, border_values.right, border_values.bottom) {} diff --git a/intrinsiccv/include/intrinsiccv/unsafe.h b/kleidicv/include/kleidicv/unsafe.h similarity index 100% rename from intrinsiccv/include/intrinsiccv/unsafe.h rename to kleidicv/include/kleidicv/unsafe.h diff --git a/intrinsiccv/include/intrinsiccv/utils.h b/kleidicv/include/kleidicv/utils.h similarity index 97% rename from intrinsiccv/include/intrinsiccv/utils.h rename to kleidicv/include/kleidicv/utils.h index 05a6e1887..825f3607d 100644 --- a/intrinsiccv/include/intrinsiccv/utils.h +++ b/kleidicv/include/kleidicv/utils.h @@ -10,9 +10,9 @@ #include #include -#include "intrinsiccv/config.h" -#include "intrinsiccv/ctypes.h" -#include "intrinsiccv/traits.h" +#include "kleidicv/config.h" +#include "kleidicv/ctypes.h" +#include "kleidicv/traits.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -366,7 +366,7 @@ T *align_up(T *value, size_t alignment) KLEIDICV_STREAMING_COMPATIBLE { // Specialisation for when stride misalignment is possible. template -std::enable_if_t check_pointer_and_stride( +std::enable_if_t check_pointer_and_stride( T *pointer, size_t stride) KLEIDICV_STREAMING_COMPATIBLE { if (pointer == nullptr) { return KLEIDICV_ERROR_NULL_POINTER; @@ -379,7 +379,7 @@ std::enable_if_t check_pointer_and_stride( // Specialisation for when stride misalignment is impossible. template -std::enable_if_t check_pointer_and_stride( +std::enable_if_t check_pointer_and_stride( T *pointer, size_t /*stride*/) KLEIDICV_STREAMING_COMPATIBLE { if (pointer == nullptr) { return KLEIDICV_ERROR_NULL_POINTER; @@ -389,7 +389,7 @@ std::enable_if_t check_pointer_and_stride( #define CHECK_POINTER_AND_STRIDE(pointer, stride) \ do { \ - if (intrinsiccv_error_t ptr_stride_err = \ + if (kleidicv_error_t ptr_stride_err = \ KLEIDICV_TARGET_NAMESPACE::check_pointer_and_stride(pointer, \ stride)) { \ return ptr_stride_err; \ diff --git a/intrinsiccv/include/intrinsiccv/workspace/borders.h b/kleidicv/include/kleidicv/workspace/borders.h similarity index 98% rename from intrinsiccv/include/intrinsiccv/workspace/borders.h rename to kleidicv/include/kleidicv/workspace/borders.h index ef0d285a7..a697f0121 100644 --- a/intrinsiccv/include/intrinsiccv/workspace/borders.h +++ b/kleidicv/include/kleidicv/workspace/borders.h @@ -7,7 +7,7 @@ #include -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -19,7 +19,7 @@ enum class FixedBorderType { }; inline std::optional get_fixed_border_type( - intrinsiccv_border_type_t border_type) KLEIDICV_STREAMING_COMPATIBLE { + kleidicv_border_type_t border_type) KLEIDICV_STREAMING_COMPATIBLE { switch (border_type) { case KLEIDICV_BORDER_TYPE_REPLICATE: return FixedBorderType::REPLICATE; diff --git a/intrinsiccv/include/intrinsiccv/workspace/separable.h b/kleidicv/include/kleidicv/workspace/separable.h similarity index 99% rename from intrinsiccv/include/intrinsiccv/workspace/separable.h rename to kleidicv/include/kleidicv/workspace/separable.h index fae62dda9..3cf1671b9 100644 --- a/intrinsiccv/include/intrinsiccv/workspace/separable.h +++ b/kleidicv/include/kleidicv/workspace/separable.h @@ -9,8 +9,8 @@ #include #include "borders.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/types.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/types.h" namespace KLEIDICV_TARGET_NAMESPACE { diff --git a/intrinsiccv/src/analysis/canny_neon.cpp b/kleidicv/src/analysis/canny_neon.cpp similarity index 96% rename from intrinsiccv/src/analysis/canny_neon.cpp rename to kleidicv/src/analysis/canny_neon.cpp index ba3f22145..fe59c5ec5 100644 --- a/intrinsiccv/src/analysis/canny_neon.cpp +++ b/kleidicv/src/analysis/canny_neon.cpp @@ -2,13 +2,13 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/containers/stack.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/containers/stack.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" #if KLEIDICV_EXPERIMENTAL_FEATURE_CANNY -namespace intrinsiccv::neon { +namespace kleidicv::neon { // Container to hold strong edges. using StrongEdgeStack = Stack; @@ -472,7 +472,7 @@ static void perform_hysteresis(StrongEdgeStack &strong_edge_pixels, } } -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t canny_u8( +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t canny_u8( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, double low_threshold, double high_threshold) { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -499,14 +499,14 @@ KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t canny_u8( } // Calculate horizontal dervatives using 3x3 Sobel operator. - if (auto err = intrinsiccv_sobel_3x3_horizontal_s16_u8( + if (auto err = kleidicv_sobel_3x3_horizontal_s16_u8( src, src_stride, horizontal_gradient.data(), horizontal_gradient.rows().stride(), width, height, 1)) { return err; } // Calculate vertical dervatives using 3x3 Sobel operator. - if (auto err = intrinsiccv_sobel_3x3_vertical_s16_u8( + if (auto err = kleidicv_sobel_3x3_vertical_s16_u8( src, src_stride, vertical_gradient.data(), vertical_gradient.rows().stride(), width, height, 1)) { return err; @@ -514,7 +514,7 @@ KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t canny_u8( // Calculate magnitude from the horizontal and vertical derivatives, and apply // lower threshold. - if (auto err = intrinsiccv_saturating_add_abs_with_threshold_s16( + if (auto err = kleidicv_saturating_add_abs_with_threshold_s16( &horizontal_gradient.rows()[0], horizontal_gradient.rows().stride(), &vertical_gradient.rows()[0], vertical_gradient.rows().stride(), &magnitudes.rows_without_margin()[0], @@ -538,18 +538,18 @@ KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t canny_u8( hysteresis.rows_without_margin().stride()); // Finalize results by supressing weak edges. - return intrinsiccv_threshold_binary_u8( - &hysteresis.rows_without_margin()[0], - hysteresis.rows_without_margin().stride(), dst, dst_stride, width, height, - 0x80, 0xFF); + return kleidicv_threshold_binary_u8(&hysteresis.rows_without_margin()[0], + hysteresis.rows_without_margin().stride(), + dst, dst_stride, width, height, 0x80, + 0xFF); } -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon extern "C" { -decltype(intrinsiccv::neon::canny_u8) *intrinsiccv_canny_u8 = - intrinsiccv::neon::canny_u8; +decltype(kleidicv::neon::canny_u8) *kleidicv_canny_u8 = + kleidicv::neon::canny_u8; } // extern "C" diff --git a/intrinsiccv/src/analysis/count_nonzeros_neon.cpp b/kleidicv/src/analysis/count_nonzeros_neon.cpp similarity index 81% rename from intrinsiccv/src/analysis/count_nonzeros_neon.cpp rename to kleidicv/src/analysis/count_nonzeros_neon.cpp index 27f0d0a69..f3eb3fc3c 100644 --- a/intrinsiccv/src/analysis/count_nonzeros_neon.cpp +++ b/kleidicv/src/analysis/count_nonzeros_neon.cpp @@ -5,10 +5,10 @@ #include #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class CountNonZeros final : public UnrollTwice { @@ -41,7 +41,7 @@ class CountNonZeros final : public UnrollTwice { }; // end of class CountNonZeros template -KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t count_nonzeros( +KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t count_nonzeros( const T *src, size_t src_stride, size_t width, size_t height, size_t *count) { CHECK_POINTERS(count); @@ -58,11 +58,11 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t count_nonzeros( return KLEIDICV_OK; } -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon extern "C" { -decltype(intrinsiccv::neon::count_nonzeros) - *intrinsiccv_count_nonzeros_u8 = intrinsiccv::neon::count_nonzeros; +decltype(kleidicv::neon::count_nonzeros) *kleidicv_count_nonzeros_u8 = + kleidicv::neon::count_nonzeros; } // extern "C" diff --git a/kleidicv/src/analysis/min_max_api.cpp b/kleidicv/src/analysis/min_max_api.cpp new file mode 100644 index 000000000..8136236aa --- /dev/null +++ b/kleidicv/src/analysis/min_max_api.cpp @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/types.h" + +namespace kleidicv { + +namespace neon { + +template +kleidicv_error_t min_max(const T *src, size_t src_stride, size_t width, + size_t height, T *min_value, T *max_value); + +template +kleidicv_error_t min_max_loc(const T *src, size_t src_stride, size_t width, + size_t height, size_t *min_offset, + size_t *max_offset); + +} // namespace neon + +namespace sve2 {} // namespace sve2 + +namespace sme2 {} // namespace sme2 + +} // namespace kleidicv + +#define KLEIDICV_DEFINE_MINMAX_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API(name, &kleidicv::neon::min_max, nullptr, \ + nullptr) + +KLEIDICV_DEFINE_MINMAX_API(kleidicv_min_max_u8, uint8_t); +KLEIDICV_DEFINE_MINMAX_API(kleidicv_min_max_s8, int8_t); +KLEIDICV_DEFINE_MINMAX_API(kleidicv_min_max_u16, uint16_t); +KLEIDICV_DEFINE_MINMAX_API(kleidicv_min_max_s16, int16_t); +KLEIDICV_DEFINE_MINMAX_API(kleidicv_min_max_s32, int32_t); + +#define KLEIDICV_DEFINE_MINMAXLOC_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API(name, &kleidicv::neon::min_max_loc, \ + nullptr, nullptr) + +KLEIDICV_DEFINE_MINMAXLOC_API(kleidicv_min_max_loc_u8, uint8_t); diff --git a/intrinsiccv/src/analysis/min_max_loc_neon.cpp b/kleidicv/src/analysis/min_max_loc_neon.cpp similarity index 96% rename from intrinsiccv/src/analysis/min_max_loc_neon.cpp rename to kleidicv/src/analysis/min_max_loc_neon.cpp index 4f2c8869c..b44f5ddde 100644 --- a/intrinsiccv/src/analysis/min_max_loc_neon.cpp +++ b/kleidicv/src/analysis/min_max_loc_neon.cpp @@ -5,8 +5,8 @@ #include #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" // This algorithm calculates the index of element in src array of the global // minimum and maximum values. @@ -96,7 +96,7 @@ // vmin_: [ 0x12, 0xFF, 0x20, 0x23 ] // vmin_new_: [ 0x12, 0x12, 0x12, 0x12 ] -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class MinMaxLoc final : public UnrollTwice { @@ -307,9 +307,9 @@ class MinMaxLoc final : public UnrollTwice { }; // end of class MinMaxLoc template -intrinsiccv_error_t min_max_loc(const ScalarType *src, size_t src_stride, - size_t width, size_t height, size_t *min_offset, - size_t *max_offset) { +kleidicv_error_t min_max_loc(const ScalarType *src, size_t src_stride, + size_t width, size_t height, size_t *min_offset, + size_t *max_offset) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_IMAGE_SIZE(width, height); @@ -331,11 +331,11 @@ intrinsiccv_error_t min_max_loc(const ScalarType *src, size_t src_stride, return KLEIDICV_OK; } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t min_max_loc( \ - const type *src, size_t src_stride, size_t width, size_t height, \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t min_max_loc( \ + const type *src, size_t src_stride, size_t width, size_t height, \ size_t *min_offset, size_t *max_offset) KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/analysis/min_max_neon.cpp b/kleidicv/src/analysis/min_max_neon.cpp similarity index 83% rename from intrinsiccv/src/analysis/min_max_neon.cpp rename to kleidicv/src/analysis/min_max_neon.cpp index cf7f1f262..ba1e26d8e 100644 --- a/intrinsiccv/src/analysis/min_max_neon.cpp +++ b/kleidicv/src/analysis/min_max_neon.cpp @@ -4,10 +4,10 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class MinMax final : public UnrollTwice { @@ -45,9 +45,9 @@ class MinMax final : public UnrollTwice { }; // end of class MinMax template -intrinsiccv_error_t min_max(const ScalarType *src, size_t src_stride, - size_t width, size_t height, ScalarType *min_value, - ScalarType *max_value) { +kleidicv_error_t min_max(const ScalarType *src, size_t src_stride, size_t width, + size_t height, ScalarType *min_value, + ScalarType *max_value) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_IMAGE_SIZE(width, height); @@ -69,7 +69,7 @@ intrinsiccv_error_t min_max(const ScalarType *src, size_t src_stride, } #define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t min_max( \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t min_max( \ const type *src, size_t src_stride, size_t width, size_t height, \ type *min_value, type *max_value) @@ -79,4 +79,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/kleidicv/src/arithmetics/absdiff_api.cpp b/kleidicv/src/arithmetics/absdiff_api.cpp new file mode 100644 index 000000000..2a010ab1b --- /dev/null +++ b/kleidicv/src/arithmetics/absdiff_api.cpp @@ -0,0 +1,52 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/types.h" + +namespace kleidicv { + +namespace neon { + +template +kleidicv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, + size_t height); + +} // namespace neon + +namespace sve2 { + +template +kleidicv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, + size_t height); + +} // namespace sve2 + +namespace sme2 { +template +kleidicv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, + size_t height); + +} // namespace sme2 + +} // namespace kleidicv + +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &kleidicv::neon::saturating_absdiff, \ + KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::saturating_absdiff), \ + &kleidicv::sme2::saturating_absdiff) + +KLEIDICV_DEFINE_C_API(kleidicv_saturating_absdiff_u8, uint8_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_absdiff_s8, int8_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_absdiff_u16, uint16_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_absdiff_s16, int16_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_absdiff_s32, int32_t); diff --git a/intrinsiccv/src/arithmetics/absdiff_neon.cpp b/kleidicv/src/arithmetics/absdiff_neon.cpp similarity index 73% rename from intrinsiccv/src/arithmetics/absdiff_neon.cpp rename to kleidicv/src/arithmetics/absdiff_neon.cpp index 494a12c55..4ebbdbde6 100644 --- a/intrinsiccv/src/arithmetics/absdiff_neon.cpp +++ b/kleidicv/src/arithmetics/absdiff_neon.cpp @@ -4,10 +4,10 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class SaturatingAbsDiff final : public UnrollTwice { @@ -36,10 +36,10 @@ class SaturatingAbsDiff final : public UnrollTwice { }; // end of class SaturatingAbsDiff template -intrinsiccv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, - T *dst, size_t dst_stride, size_t width, - size_t height) { +kleidicv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -55,11 +55,11 @@ intrinsiccv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, return KLEIDICV_OK; } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ - saturating_absdiff(const type *src_a, size_t src_a_stride, \ - const type *src_b, size_t src_b_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height) +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t saturating_absdiff( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ + size_t height) KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); @@ -67,4 +67,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/arithmetics/absdiff_sme2.cpp b/kleidicv/src/arithmetics/absdiff_sme2.cpp similarity index 81% rename from intrinsiccv/src/arithmetics/absdiff_sme2.cpp rename to kleidicv/src/arithmetics/absdiff_sme2.cpp index 1a4d6568b..bc254f2a7 100644 --- a/intrinsiccv/src/arithmetics/absdiff_sme2.cpp +++ b/kleidicv/src/arithmetics/absdiff_sme2.cpp @@ -2,10 +2,10 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { template ::value, bool> = true> @@ -37,7 +37,7 @@ class SaturatingAbsDiff final : public UnrollTwice { }; // end of class SaturatingAbsDiff template -KLEIDICV_LOCALLY_STREAMING intrinsiccv_error_t saturating_absdiff( +KLEIDICV_LOCALLY_STREAMING kleidicv_error_t saturating_absdiff( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); @@ -54,11 +54,11 @@ KLEIDICV_LOCALLY_STREAMING intrinsiccv_error_t saturating_absdiff( return KLEIDICV_OK; } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ - saturating_absdiff(const type *src_a, size_t src_a_stride, \ - const type *src_b, size_t src_b_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height) +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t saturating_absdiff( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ + size_t height) KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); @@ -66,4 +66,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/intrinsiccv/src/arithmetics/absdiff_sve2.cpp b/kleidicv/src/arithmetics/absdiff_sve2.cpp similarity index 72% rename from intrinsiccv/src/arithmetics/absdiff_sve2.cpp rename to kleidicv/src/arithmetics/absdiff_sve2.cpp index 973761823..9ede9ed35 100644 --- a/intrinsiccv/src/arithmetics/absdiff_sve2.cpp +++ b/kleidicv/src/arithmetics/absdiff_sve2.cpp @@ -2,10 +2,10 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { template ::value, bool> = true> @@ -34,10 +34,10 @@ class SaturatingAbsDiff final : public UnrollTwice { }; // end of class SaturatingAbsDiff template -intrinsiccv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, - T *dst, size_t dst_stride, size_t width, - size_t height) { +kleidicv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -52,11 +52,11 @@ intrinsiccv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, return KLEIDICV_OK; } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ - saturating_absdiff(const type *src_a, size_t src_a_stride, \ - const type *src_b, size_t src_b_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height) +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t saturating_absdiff( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ + size_t height) KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); @@ -64,4 +64,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/intrinsiccv/src/arithmetics/add_abs_with_threshold_api.cpp b/kleidicv/src/arithmetics/add_abs_with_threshold_api.cpp similarity index 59% rename from intrinsiccv/src/arithmetics/add_abs_with_threshold_api.cpp rename to kleidicv/src/arithmetics/add_abs_with_threshold_api.cpp index b6dca9409..363941177 100644 --- a/intrinsiccv/src/arithmetics/add_abs_with_threshold_api.cpp +++ b/kleidicv/src/arithmetics/add_abs_with_threshold_api.cpp @@ -2,16 +2,16 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/types.h" +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/types.h" -namespace intrinsiccv { +namespace kleidicv { namespace neon { template -intrinsiccv_error_t saturating_add_abs_with_threshold( +kleidicv_error_t saturating_add_abs_with_threshold( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold); @@ -19,27 +19,26 @@ intrinsiccv_error_t saturating_add_abs_with_threshold( namespace sve2 { template -intrinsiccv_error_t saturating_add_abs_with_threshold( +kleidicv_error_t saturating_add_abs_with_threshold( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold); } // namespace sve2 namespace sme2 { template -intrinsiccv_error_t saturating_add_abs_with_threshold( +kleidicv_error_t saturating_add_abs_with_threshold( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold); } // namespace sme2 -} // namespace intrinsiccv +} // namespace kleidicv -#define KLEIDICV_DEFINE_C_API(name, type) \ - KLEIDICV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::saturating_add_abs_with_threshold, \ - KLEIDICV_SVE2_IMPL_IF( \ - &intrinsiccv::sve2::saturating_add_abs_with_threshold), \ - &intrinsiccv::sme2::saturating_add_abs_with_threshold) +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &kleidicv::neon::saturating_add_abs_with_threshold, \ + KLEIDICV_SVE2_IMPL_IF( \ + &kleidicv::sve2::saturating_add_abs_with_threshold), \ + &kleidicv::sme2::saturating_add_abs_with_threshold) -KLEIDICV_DEFINE_C_API(intrinsiccv_saturating_add_abs_with_threshold_s16, - int16_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_abs_with_threshold_s16, int16_t); diff --git a/intrinsiccv/src/arithmetics/add_abs_with_threshold_neon.cpp b/kleidicv/src/arithmetics/add_abs_with_threshold_neon.cpp similarity index 91% rename from intrinsiccv/src/arithmetics/add_abs_with_threshold_neon.cpp rename to kleidicv/src/arithmetics/add_abs_with_threshold_neon.cpp index 9f1a9f54e..85440ad39 100644 --- a/intrinsiccv/src/arithmetics/add_abs_with_threshold_neon.cpp +++ b/kleidicv/src/arithmetics/add_abs_with_threshold_neon.cpp @@ -4,10 +4,10 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class SaturatingAddAbsWithThreshold final : public UnrollOnce, @@ -49,7 +49,7 @@ class SaturatingAddAbsWithThreshold final : public UnrollOnce, }; // end of class SaturatingAddAbsWithThreshold template -intrinsiccv_error_t saturating_add_abs_with_threshold( +kleidicv_error_t saturating_add_abs_with_threshold( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); @@ -67,7 +67,7 @@ intrinsiccv_error_t saturating_add_abs_with_threshold( } #define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t \ saturating_add_abs_with_threshold( \ const type *src_a, size_t src_a_stride, const type *src_b, \ size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ @@ -75,4 +75,4 @@ intrinsiccv_error_t saturating_add_abs_with_threshold( KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sc.h b/kleidicv/src/arithmetics/add_abs_with_threshold_sc.h similarity index 94% rename from intrinsiccv/src/arithmetics/add_abs_with_threshold_sc.h rename to kleidicv/src/arithmetics/add_abs_with_threshold_sc.h index 3e55c567d..2ea1735bd 100644 --- a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sc.h +++ b/kleidicv/src/arithmetics/add_abs_with_threshold_sc.h @@ -7,8 +7,8 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -35,7 +35,7 @@ class SaturatingAddAbsWithThreshold final : public UnrollTwice { }; // end of class SaturatingAddAbsWithThreshold template -intrinsiccv_error_t saturating_add_abs_with_threshold_sc( +kleidicv_error_t saturating_add_abs_with_threshold_sc( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold) KLEIDICV_STREAMING_COMPATIBLE { diff --git a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sme2.cpp b/kleidicv/src/arithmetics/add_abs_with_threshold_sme2.cpp similarity index 84% rename from intrinsiccv/src/arithmetics/add_abs_with_threshold_sme2.cpp rename to kleidicv/src/arithmetics/add_abs_with_threshold_sme2.cpp index dff653140..4013a5a51 100644 --- a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sme2.cpp +++ b/kleidicv/src/arithmetics/add_abs_with_threshold_sme2.cpp @@ -4,10 +4,10 @@ #include "add_abs_with_threshold_sc.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { template -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t saturating_add_abs_with_threshold(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, @@ -18,7 +18,7 @@ saturating_add_abs_with_threshold(const T *src_a, size_t src_a_stride, } #define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t \ saturating_add_abs_with_threshold( \ const type *src_a, size_t src_a_stride, const type *src_b, \ size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ @@ -26,4 +26,4 @@ saturating_add_abs_with_threshold(const T *src_a, size_t src_a_stride, KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sve2.cpp b/kleidicv/src/arithmetics/add_abs_with_threshold_sve2.cpp similarity index 82% rename from intrinsiccv/src/arithmetics/add_abs_with_threshold_sve2.cpp rename to kleidicv/src/arithmetics/add_abs_with_threshold_sve2.cpp index 87204191d..921697a88 100644 --- a/intrinsiccv/src/arithmetics/add_abs_with_threshold_sve2.cpp +++ b/kleidicv/src/arithmetics/add_abs_with_threshold_sve2.cpp @@ -4,10 +4,10 @@ #include "add_abs_with_threshold_sc.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { template -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_add_abs_with_threshold( +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t saturating_add_abs_with_threshold( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold) { return saturating_add_abs_with_threshold_sc(src_a, src_a_stride, src_b, @@ -16,7 +16,7 @@ KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_add_abs_with_threshold( } #define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t \ saturating_add_abs_with_threshold( \ const type *src_a, size_t src_a_stride, const type *src_b, \ size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ @@ -24,4 +24,4 @@ KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_add_abs_with_threshold( KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/kleidicv/src/arithmetics/add_api.cpp b/kleidicv/src/arithmetics/add_api.cpp new file mode 100644 index 000000000..a88b7b54b --- /dev/null +++ b/kleidicv/src/arithmetics/add_api.cpp @@ -0,0 +1,52 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/types.h" + +namespace kleidicv { + +namespace neon { + +template +kleidicv_error_t saturating_add(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, size_t height); + +} // namespace neon + +namespace sve2 { + +template +kleidicv_error_t saturating_add(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, size_t height); + +} // namespace sve2 + +namespace sme2 { +template +kleidicv_error_t saturating_add(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, size_t height); + +} // namespace sme2 + +} // namespace kleidicv + +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &kleidicv::neon::saturating_add, \ + KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::saturating_add), \ + &kleidicv::sme2::saturating_add) + +KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_s8, int8_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_u8, uint8_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_s16, int16_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_u16, uint16_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_s32, int32_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_u32, uint32_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_s64, int64_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_u64, uint64_t); diff --git a/intrinsiccv/src/arithmetics/add_neon.cpp b/kleidicv/src/arithmetics/add_neon.cpp similarity index 79% rename from intrinsiccv/src/arithmetics/add_neon.cpp rename to kleidicv/src/arithmetics/add_neon.cpp index ed98fa91d..21dd18b35 100644 --- a/intrinsiccv/src/arithmetics/add_neon.cpp +++ b/kleidicv/src/arithmetics/add_neon.cpp @@ -4,10 +4,10 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class SaturatingAdd final : public UnrollTwice { @@ -35,10 +35,10 @@ class SaturatingAdd final : public UnrollTwice { }; // end of class SaturatingAdd template -intrinsiccv_error_t saturating_add(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, T *dst, - size_t dst_stride, size_t width, - size_t height) { +kleidicv_error_t saturating_add(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -53,10 +53,10 @@ intrinsiccv_error_t saturating_add(const T *src_a, size_t src_a_stride, return KLEIDICV_OK; } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_add( \ - const type *src_a, size_t src_a_stride, const type *src_b, \ - size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t saturating_add( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ size_t height) KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); @@ -68,4 +68,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/arithmetics/add_sme2.cpp b/kleidicv/src/arithmetics/add_sme2.cpp similarity index 85% rename from intrinsiccv/src/arithmetics/add_sme2.cpp rename to kleidicv/src/arithmetics/add_sme2.cpp index ea3523ccd..99fdd6b69 100644 --- a/intrinsiccv/src/arithmetics/add_sme2.cpp +++ b/kleidicv/src/arithmetics/add_sme2.cpp @@ -4,10 +4,10 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { template class SaturatingAdd final : public UnrollTwice { @@ -23,7 +23,7 @@ class SaturatingAdd final : public UnrollTwice { }; // end of class SaturatingAdd template -KLEIDICV_LOCALLY_STREAMING intrinsiccv_error_t saturating_add( +KLEIDICV_LOCALLY_STREAMING kleidicv_error_t saturating_add( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); @@ -40,10 +40,10 @@ KLEIDICV_LOCALLY_STREAMING intrinsiccv_error_t saturating_add( return KLEIDICV_OK; } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_add( \ - const type *src_a, size_t src_a_stride, const type *src_b, \ - size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t saturating_add( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ size_t height) KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); @@ -55,4 +55,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/intrinsiccv/src/arithmetics/add_sve2.cpp b/kleidicv/src/arithmetics/add_sve2.cpp similarity index 75% rename from intrinsiccv/src/arithmetics/add_sve2.cpp rename to kleidicv/src/arithmetics/add_sve2.cpp index 9950130f0..c6b95b6d8 100644 --- a/intrinsiccv/src/arithmetics/add_sve2.cpp +++ b/kleidicv/src/arithmetics/add_sve2.cpp @@ -4,10 +4,10 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { template class SaturatingAdd final : public UnrollTwice { @@ -22,10 +22,10 @@ class SaturatingAdd final : public UnrollTwice { }; // end of class SaturatingAdd template -intrinsiccv_error_t saturating_add(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, T *dst, - size_t dst_stride, size_t width, - size_t height) { +kleidicv_error_t saturating_add(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -40,10 +40,10 @@ intrinsiccv_error_t saturating_add(const T *src_a, size_t src_a_stride, return KLEIDICV_OK; } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_add( \ - const type *src_a, size_t src_a_stride, const type *src_b, \ - size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t saturating_add( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ size_t height) KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); @@ -55,4 +55,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/kleidicv/src/arithmetics/multiply_api.cpp b/kleidicv/src/arithmetics/multiply_api.cpp new file mode 100644 index 000000000..560e6e20f --- /dev/null +++ b/kleidicv/src/arithmetics/multiply_api.cpp @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/types.h" + +namespace kleidicv { + +namespace neon { + +template +kleidicv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, + T *dst, size_t dst_stride, size_t width, + size_t height, double scale); + +} // namespace neon + +namespace sve2 { + +template +kleidicv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, + T *dst, size_t dst_stride, size_t width, + size_t height, double scale); + +} // namespace sve2 + +// namespace sme2 { + +// template +// kleidicv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, +// const T *src_b, +// size_t src_b_stride, T *dst, size_t dst_stride, +// size_t width, size_t height, double scale); + +// } // namespace sme2 + +} // namespace kleidicv + +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &kleidicv::neon::saturating_multiply, \ + KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::saturating_multiply), \ + nullptr) + +KLEIDICV_DEFINE_C_API(kleidicv_saturating_multiply_u8, uint8_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_multiply_s8, int8_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_multiply_u16, uint16_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_multiply_s16, int16_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_multiply_s32, int32_t); diff --git a/intrinsiccv/src/arithmetics/multiply_neon.cpp b/kleidicv/src/arithmetics/multiply_neon.cpp similarity index 84% rename from intrinsiccv/src/arithmetics/multiply_neon.cpp rename to kleidicv/src/arithmetics/multiply_neon.cpp index 469b832c7..0b660dbc3 100644 --- a/intrinsiccv/src/arithmetics/multiply_neon.cpp +++ b/kleidicv/src/arithmetics/multiply_neon.cpp @@ -4,11 +4,11 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" -#include "intrinsiccv/types.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" +#include "kleidicv/types.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class SaturatingMultiply final : public UnrollTwice { @@ -63,10 +63,10 @@ class SaturatingMultiply final : public UnrollTwice { }; template -intrinsiccv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, - T *dst, size_t dst_stride, size_t width, - size_t height, double scale) { +kleidicv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, + T *dst, size_t dst_stride, size_t width, + size_t height, double scale) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -84,7 +84,7 @@ intrinsiccv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, } #define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t \ saturating_multiply(const type *src_a, size_t src_a_stride, \ const type *src_b, size_t src_b_stride, type *dst, \ size_t dst_stride, size_t width, size_t height, \ @@ -96,4 +96,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/arithmetics/multiply_sve2.cpp b/kleidicv/src/arithmetics/multiply_sve2.cpp similarity index 81% rename from intrinsiccv/src/arithmetics/multiply_sve2.cpp rename to kleidicv/src/arithmetics/multiply_sve2.cpp index b8a53767d..fd26f2a7f 100644 --- a/intrinsiccv/src/arithmetics/multiply_sve2.cpp +++ b/kleidicv/src/arithmetics/multiply_sve2.cpp @@ -2,10 +2,10 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { template class SaturatingMultiply final : public UnrollTwice { @@ -41,10 +41,10 @@ class SaturatingMultiply final : public UnrollTwice { }; template -intrinsiccv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, - T *dst, size_t dst_stride, size_t width, - size_t height, double scale) { +kleidicv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, + T *dst, size_t dst_stride, size_t width, + size_t height, double scale) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -61,7 +61,7 @@ intrinsiccv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, } #define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t \ saturating_multiply(const type *src_a, size_t src_a_stride, \ const type *src_b, size_t src_b_stride, type *dst, \ size_t dst_stride, size_t width, size_t height, \ @@ -73,4 +73,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); KLEIDICV_INSTANTIATE_TEMPLATE(int16_t); KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/kleidicv/src/arithmetics/scale_api.cpp b/kleidicv/src/arithmetics/scale_api.cpp new file mode 100644 index 000000000..d7d22964b --- /dev/null +++ b/kleidicv/src/arithmetics/scale_api.cpp @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/types.h" + +namespace kleidicv { + +namespace neon { + +template +kleidicv_error_t scale(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, size_t height, + float scale, float shift); +} // namespace neon + +namespace sve2 {} // namespace sve2 + +namespace sme2 {} // namespace sme2 + +} // namespace kleidicv + +#define KLEIDICV_DEFINE_SCALE_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API(name, &kleidicv::neon::scale, nullptr, \ + nullptr) + +KLEIDICV_DEFINE_SCALE_API(kleidicv_scale_u8, uint8_t); +// KLEIDICV_DEFINE_SCALE_API(kleidicv_scale_s8, int8_t); +// KLEIDICV_DEFINE_SCALE_API(kleidicv_scale_u16, uint16_t); +// KLEIDICV_DEFINE_SCALE_API(kleidicv_scale_s16, int16_t); +// KLEIDICV_DEFINE_SCALE_API(kleidicv_scale_s32, int32_t); diff --git a/intrinsiccv/src/arithmetics/scale_neon.cpp b/kleidicv/src/arithmetics/scale_neon.cpp similarity index 95% rename from intrinsiccv/src/arithmetics/scale_neon.cpp rename to kleidicv/src/arithmetics/scale_neon.cpp index d14258f4b..bad86de90 100644 --- a/intrinsiccv/src/arithmetics/scale_neon.cpp +++ b/kleidicv/src/arithmetics/scale_neon.cpp @@ -6,10 +6,10 @@ #include #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { // Scale algorithm: for each value in the source, // dst[i] = src[i] * scale + shift (floating point operation) @@ -169,9 +169,9 @@ class ScaleFloat final : public ScaleBase { }; // end of class ScaleFloat template -intrinsiccv_error_t scale(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, size_t height, - float scale, float shift) { +kleidicv_error_t scale(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, size_t height, + float scale, float shift) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -193,7 +193,7 @@ intrinsiccv_error_t scale(const T *src, size_t src_stride, T *dst, } #define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t scale( \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t scale( \ const type *src, size_t src_stride, type *dst, size_t dst_stride, \ size_t width, size_t height, float scale, float shift) @@ -203,4 +203,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); // KLEIDICV_INSTANTIATE_TEMPLATE(uint16_t); // KLEIDICV_INSTANTIATE_TEMPLATE(int32_t); -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/kleidicv/src/arithmetics/sub_api.cpp b/kleidicv/src/arithmetics/sub_api.cpp new file mode 100644 index 000000000..edabdc034 --- /dev/null +++ b/kleidicv/src/arithmetics/sub_api.cpp @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" + +namespace kleidicv { + +namespace neon { + +template +kleidicv_error_t saturating_sub(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, size_t height); + +} // namespace neon + +namespace sve2 { + +template +kleidicv_error_t saturating_sub(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, size_t height); + +} // namespace sve2 + +namespace sme2 { +template +kleidicv_error_t saturating_sub(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, size_t height); + +} // namespace sme2 + +} // namespace kleidicv + +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &kleidicv::neon::saturating_sub, \ + KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::saturating_sub), \ + &kleidicv::sme2::saturating_sub) + +KLEIDICV_DEFINE_C_API(kleidicv_saturating_sub_s8, int8_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_sub_u8, uint8_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_sub_s16, int16_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_sub_u16, uint16_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_sub_s32, int32_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_sub_u32, uint32_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_sub_s64, int64_t); +KLEIDICV_DEFINE_C_API(kleidicv_saturating_sub_u64, uint64_t); diff --git a/intrinsiccv/src/arithmetics/sub_neon.cpp b/kleidicv/src/arithmetics/sub_neon.cpp similarity index 79% rename from intrinsiccv/src/arithmetics/sub_neon.cpp rename to kleidicv/src/arithmetics/sub_neon.cpp index e73fca6f3..cb162dd9a 100644 --- a/intrinsiccv/src/arithmetics/sub_neon.cpp +++ b/kleidicv/src/arithmetics/sub_neon.cpp @@ -4,10 +4,10 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class SaturatingSub final : public UnrollTwice { @@ -35,10 +35,10 @@ class SaturatingSub final : public UnrollTwice { }; // end of class SaturatingSub template -intrinsiccv_error_t saturating_sub(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, T *dst, - size_t dst_stride, size_t width, - size_t height) { +kleidicv_error_t saturating_sub(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -53,10 +53,10 @@ intrinsiccv_error_t saturating_sub(const T *src_a, size_t src_a_stride, return KLEIDICV_OK; } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_sub( \ - const type *src_a, size_t src_a_stride, const type *src_b, \ - size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t saturating_sub( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ size_t height) KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); @@ -68,4 +68,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/arithmetics/sub_sme2.cpp b/kleidicv/src/arithmetics/sub_sme2.cpp similarity index 85% rename from intrinsiccv/src/arithmetics/sub_sme2.cpp rename to kleidicv/src/arithmetics/sub_sme2.cpp index c744765a2..6817e9552 100644 --- a/intrinsiccv/src/arithmetics/sub_sme2.cpp +++ b/kleidicv/src/arithmetics/sub_sme2.cpp @@ -4,10 +4,10 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { template class SaturatingSub final : public UnrollTwice { @@ -23,7 +23,7 @@ class SaturatingSub final : public UnrollTwice { }; // end of class SaturatingSub template -KLEIDICV_LOCALLY_STREAMING intrinsiccv_error_t saturating_sub( +KLEIDICV_LOCALLY_STREAMING kleidicv_error_t saturating_sub( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); @@ -40,10 +40,10 @@ KLEIDICV_LOCALLY_STREAMING intrinsiccv_error_t saturating_sub( return KLEIDICV_OK; } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_sub( \ - const type *src_a, size_t src_a_stride, const type *src_b, \ - size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t saturating_sub( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ size_t height) KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); @@ -55,4 +55,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/intrinsiccv/src/arithmetics/sub_sve2.cpp b/kleidicv/src/arithmetics/sub_sve2.cpp similarity index 75% rename from intrinsiccv/src/arithmetics/sub_sve2.cpp rename to kleidicv/src/arithmetics/sub_sve2.cpp index 134df3d2f..822cbc83a 100644 --- a/intrinsiccv/src/arithmetics/sub_sve2.cpp +++ b/kleidicv/src/arithmetics/sub_sve2.cpp @@ -4,10 +4,10 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { template class SaturatingSub final : public UnrollTwice { @@ -22,10 +22,10 @@ class SaturatingSub final : public UnrollTwice { }; // end of class SaturatingSub template -intrinsiccv_error_t saturating_sub(const T *src_a, size_t src_a_stride, - const T *src_b, size_t src_b_stride, T *dst, - size_t dst_stride, size_t width, - size_t height) { +kleidicv_error_t saturating_sub(const T *src_a, size_t src_a_stride, + const T *src_b, size_t src_b_stride, T *dst, + size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -40,10 +40,10 @@ intrinsiccv_error_t saturating_sub(const T *src_a, size_t src_a_stride, return KLEIDICV_OK; } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t saturating_sub( \ - const type *src_a, size_t src_a_stride, const type *src_b, \ - size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t saturating_sub( \ + const type *src_a, size_t src_a_stride, const type *src_b, \ + size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \ size_t height) KLEIDICV_INSTANTIATE_TEMPLATE(int8_t); @@ -55,4 +55,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(uint32_t); KLEIDICV_INSTANTIATE_TEMPLATE(int64_t); KLEIDICV_INSTANTIATE_TEMPLATE(uint64_t); -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/kleidicv/src/arithmetics/threshold_api.cpp b/kleidicv/src/arithmetics/threshold_api.cpp new file mode 100644 index 000000000..b9d43ab67 --- /dev/null +++ b/kleidicv/src/arithmetics/threshold_api.cpp @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" + +namespace kleidicv { + +namespace neon { +template +kleidicv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, + size_t height, T threshold, T value); +} // namespace neon + +namespace sve2 { +template +kleidicv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, + size_t height, T threshold, T value); +} // namespace sve2 + +namespace sme2 { +template +kleidicv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, + size_t height, T threshold, T value); +} // namespace sme2 + +} // namespace kleidicv + +#define KLEIDICV_DEFINE_C_API(name, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &kleidicv::neon::threshold_binary, \ + KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::threshold_binary), \ + &kleidicv::sme2::threshold_binary) + +KLEIDICV_DEFINE_C_API(kleidicv_threshold_binary_u8, uint8_t); diff --git a/intrinsiccv/src/arithmetics/threshold_neon.cpp b/kleidicv/src/arithmetics/threshold_neon.cpp similarity index 70% rename from intrinsiccv/src/arithmetics/threshold_neon.cpp rename to kleidicv/src/arithmetics/threshold_neon.cpp index 989bddead..1f0618400 100644 --- a/intrinsiccv/src/arithmetics/threshold_neon.cpp +++ b/kleidicv/src/arithmetics/threshold_neon.cpp @@ -2,10 +2,10 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class BinaryThreshold final : public UnrollTwice { @@ -38,9 +38,9 @@ class BinaryThreshold final : public UnrollTwice { }; // end of class BinaryThreshold template -intrinsiccv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, - size_t height, T threshold, T value) { +kleidicv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, + size_t height, T threshold, T value) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -53,12 +53,11 @@ intrinsiccv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, return KLEIDICV_OK; } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ - threshold_binary(const type *src, size_t src_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height, \ - type threshold, type value) +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t threshold_binary( \ + const type *src, size_t src_stride, type *dst, size_t dst_stride, \ + size_t width, size_t height, type threshold, type value) KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/arithmetics/threshold_sc.h b/kleidicv/src/arithmetics/threshold_sc.h similarity index 80% rename from intrinsiccv/src/arithmetics/threshold_sc.h rename to kleidicv/src/arithmetics/threshold_sc.h index a380eef17..b0a330999 100644 --- a/intrinsiccv/src/arithmetics/threshold_sc.h +++ b/kleidicv/src/arithmetics/threshold_sc.h @@ -5,8 +5,8 @@ #ifndef KLEIDICV_THRESHOLD_SC_H #define KLEIDICV_THRESHOLD_SC_H -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -34,10 +34,10 @@ class BinaryThreshold final : public UnrollTwice { }; // end of class BinaryThreshold template -intrinsiccv_error_t threshold_binary_sc(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, - size_t height, T threshold, - T value) KLEIDICV_STREAMING_COMPATIBLE { +kleidicv_error_t threshold_binary_sc(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, + size_t height, T threshold, + T value) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); diff --git a/intrinsiccv/src/arithmetics/threshold_sme2.cpp b/kleidicv/src/arithmetics/threshold_sme2.cpp similarity index 57% rename from intrinsiccv/src/arithmetics/threshold_sme2.cpp rename to kleidicv/src/arithmetics/threshold_sme2.cpp index 5f17c5867..cdd1ee125 100644 --- a/intrinsiccv/src/arithmetics/threshold_sme2.cpp +++ b/kleidicv/src/arithmetics/threshold_sme2.cpp @@ -4,22 +4,21 @@ #include "threshold_sc.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { template -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold, T value) { return threshold_binary_sc(src, src_stride, dst, dst_stride, width, height, threshold, value); } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ - threshold_binary(const type *src, size_t src_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height, \ - type threshold, type value) +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t threshold_binary( \ + const type *src, size_t src_stride, type *dst, size_t dst_stride, \ + size_t width, size_t height, type threshold, type value) KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/intrinsiccv/src/arithmetics/threshold_sve2.cpp b/kleidicv/src/arithmetics/threshold_sve2.cpp similarity index 58% rename from intrinsiccv/src/arithmetics/threshold_sve2.cpp rename to kleidicv/src/arithmetics/threshold_sve2.cpp index 24e2032b5..3786d10cb 100644 --- a/intrinsiccv/src/arithmetics/threshold_sve2.cpp +++ b/kleidicv/src/arithmetics/threshold_sve2.cpp @@ -4,22 +4,21 @@ #include "threshold_sc.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { template -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold, T value) { return threshold_binary_sc(src, src_stride, dst, dst_stride, width, height, threshold, value); } -#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ - threshold_binary(const type *src, size_t src_stride, type *dst, \ - size_t dst_stride, size_t width, size_t height, \ - type threshold, type value) +#define KLEIDICV_INSTANTIATE_TEMPLATE(type) \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t threshold_binary( \ + const type *src, size_t src_stride, type *dst, size_t dst_stride, \ + size_t width, size_t height, type threshold, type value) KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t); -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/intrinsiccv/src/conversions/split_api.cpp b/kleidicv/src/arithmetics/transpose_api.cpp similarity index 50% rename from intrinsiccv/src/conversions/split_api.cpp rename to kleidicv/src/arithmetics/transpose_api.cpp index 059e4999e..d5c9e9bba 100644 --- a/intrinsiccv/src/conversions/split_api.cpp +++ b/kleidicv/src/arithmetics/transpose_api.cpp @@ -2,9 +2,9 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/conversions/split.h" -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/arithmetics/transpose.h" +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" -KLEIDICV_MULTIVERSION_C_API(intrinsiccv_split, &intrinsiccv::neon::split, +KLEIDICV_MULTIVERSION_C_API(kleidicv_transpose, &kleidicv::neon::transpose, nullptr, nullptr); diff --git a/intrinsiccv/src/arithmetics/transpose_neon.cpp b/kleidicv/src/arithmetics/transpose_neon.cpp similarity index 90% rename from intrinsiccv/src/arithmetics/transpose_neon.cpp rename to kleidicv/src/arithmetics/transpose_neon.cpp index f8400ac4e..0909c91ca 100644 --- a/intrinsiccv/src/arithmetics/transpose_neon.cpp +++ b/kleidicv/src/arithmetics/transpose_neon.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/arithmetics/transpose.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/arithmetics/transpose.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template @@ -98,9 +98,9 @@ static void scalar_path(Rows src_rows, } template -static intrinsiccv_error_t transpose(Rectangle rect, - Rows src_rows, - Rows dst_rows) { +static kleidicv_error_t transpose(Rectangle rect, + Rows src_rows, + Rows dst_rows) { constexpr size_t num_of_lanes = VecTraits::num_lanes(); auto handle_lane_number_of_rows = [&](size_t vindex) { @@ -130,8 +130,7 @@ static intrinsiccv_error_t transpose(Rectangle rect, } template -static intrinsiccv_error_t transpose(Rectangle rect, - Rows data_rows) { +static kleidicv_error_t transpose(Rectangle rect, Rows data_rows) { constexpr size_t num_of_lanes = VecTraits::num_lanes(); // rect.width() needs to be equal to rect.height() @@ -195,9 +194,9 @@ static intrinsiccv_error_t transpose(Rectangle rect, } template -static intrinsiccv_error_t transpose(const void *src_void, size_t src_stride, - void *dst_void, size_t dst_stride, - size_t src_width, size_t src_height) { +static kleidicv_error_t transpose(const void *src_void, size_t src_stride, + void *dst_void, size_t dst_stride, + size_t src_width, size_t src_height) { MAKE_POINTER_CHECK_ALIGNMENT(const T, src, src_void); MAKE_POINTER_CHECK_ALIGNMENT(T, dst, dst_void); CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -219,9 +218,9 @@ static intrinsiccv_error_t transpose(const void *src_void, size_t src_stride, } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t transpose(const void *src, size_t src_stride, void *dst, - size_t dst_stride, size_t src_width, - size_t src_height, size_t element_size) { +kleidicv_error_t transpose(const void *src, size_t src_stride, void *dst, + size_t dst_stride, size_t src_width, + size_t src_height, size_t element_size) { switch (element_size) { case sizeof(uint8_t): return transpose(src, src_stride, dst, dst_stride, src_width, @@ -240,4 +239,4 @@ intrinsiccv_error_t transpose(const void *src, size_t src_stride, void *dst, } } -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/conversions/float_conv_api.cpp b/kleidicv/src/conversions/float_conv_api.cpp similarity index 52% rename from intrinsiccv/src/conversions/float_conv_api.cpp rename to kleidicv/src/conversions/float_conv_api.cpp index 08c3c9287..0f3fdea2d 100644 --- a/intrinsiccv/src/conversions/float_conv_api.cpp +++ b/kleidicv/src/conversions/float_conv_api.cpp @@ -2,43 +2,43 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/types.h" +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/types.h" -namespace intrinsiccv { +namespace kleidicv { namespace neon { template -intrinsiccv_error_t float_conversion(const InputType* src, size_t src_stride, - OutputType* dst, size_t dst_stride, - size_t width, size_t height); +kleidicv_error_t float_conversion(const InputType* src, size_t src_stride, + OutputType* dst, size_t dst_stride, + size_t width, size_t height); } // namespace neon namespace sve2 { template -intrinsiccv_error_t float_conversion(const InputType* src, size_t src_stride, - OutputType* dst, size_t dst_stride, - size_t width, size_t height); +kleidicv_error_t float_conversion(const InputType* src, size_t src_stride, + OutputType* dst, size_t dst_stride, + size_t width, size_t height); } // namespace sve2 namespace sme2 { template -intrinsiccv_error_t float_conversion(const InputType* src, size_t src_stride, - OutputType* dst, size_t dst_stride, - size_t width, size_t height); +kleidicv_error_t float_conversion(const InputType* src, size_t src_stride, + OutputType* dst, size_t dst_stride, + size_t width, size_t height); } // namespace sme2 #ifdef KLEIDICV_HAVE_SVE2 #define SVE2_FUNC_POINTER(name, itype, otype) \ [[maybe_unused]] static auto sve2_func_##itype##_##otype = \ - intrinsiccv::sve2::float_conversion; + kleidicv::sve2::float_conversion; #else #define SVE2_FUNC_POINTER(name, itype, otype) #endif // KLEIDICV_HAVE_SVE2 @@ -46,7 +46,7 @@ intrinsiccv_error_t float_conversion(const InputType* src, size_t src_stride, #ifdef KLEIDICV_HAVE_SME2 #define SME2_FUNC_POINTER(name, itype, otype) \ static auto sme2_func_##itype##_##otype = \ - intrinsiccv::sme2::float_conversion; + kleidicv::sme2::float_conversion; #else #define SME2_FUNC_POINTER(name, itype, otype) #endif // KLEIDICV_HAVE_SME2 @@ -54,7 +54,7 @@ intrinsiccv_error_t float_conversion(const InputType* src, size_t src_stride, // NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables) #define KLEIDICV_DEFINE_C_API(name, itype, otype) \ static auto neon_func_##itype##_##otype = \ - intrinsiccv::neon::float_conversion; \ + kleidicv::neon::float_conversion; \ SVE2_FUNC_POINTER(name, itype, otype); \ SME2_FUNC_POINTER(name, itype, otype); \ KLEIDICV_MULTIVERSION_C_API( \ @@ -63,9 +63,9 @@ intrinsiccv_error_t float_conversion(const InputType* src, size_t src_stride, sme2_func_##itype##_##otype) // NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables) -KLEIDICV_DEFINE_C_API(intrinsiccv_float_conversion_f32_s8, float, int8_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_float_conversion_f32_u8, float, uint8_t); -KLEIDICV_DEFINE_C_API(intrinsiccv_float_conversion_s8_f32, int8_t, float); -KLEIDICV_DEFINE_C_API(intrinsiccv_float_conversion_u8_f32, uint8_t, float); +KLEIDICV_DEFINE_C_API(kleidicv_float_conversion_f32_s8, float, int8_t); +KLEIDICV_DEFINE_C_API(kleidicv_float_conversion_f32_u8, float, uint8_t); +KLEIDICV_DEFINE_C_API(kleidicv_float_conversion_s8_f32, int8_t, float); +KLEIDICV_DEFINE_C_API(kleidicv_float_conversion_u8_f32, uint8_t, float); -} // namespace intrinsiccv +} // namespace kleidicv diff --git a/intrinsiccv/src/conversions/float_conv_neon.cpp b/kleidicv/src/conversions/float_conv_neon.cpp similarity index 68% rename from intrinsiccv/src/conversions/float_conv_neon.cpp rename to kleidicv/src/conversions/float_conv_neon.cpp index 74448c719..b6e1fe0a8 100644 --- a/intrinsiccv/src/conversions/float_conv_neon.cpp +++ b/kleidicv/src/conversions/float_conv_neon.cpp @@ -2,19 +2,19 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template -intrinsiccv_error_t float_conversion(const InputType*, size_t, OutputType*, - size_t, size_t, size_t) { +kleidicv_error_t float_conversion(const InputType*, size_t, OutputType*, size_t, + size_t, size_t) { return KLEIDICV_ERROR_NOT_IMPLEMENTED; } #define KLEIDICV_INSTANTIATE_TEMPLATE(itype, otype) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t \ float_conversion(const itype* src, size_t src_stride, \ otype* dst, size_t dst_stride, size_t width, \ size_t height) @@ -24,4 +24,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(float, uint8_t); KLEIDICV_INSTANTIATE_TEMPLATE(int8_t, float); KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t, float); -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/conversions/float_conv_sc.h b/kleidicv/src/conversions/float_conv_sc.h similarity index 98% rename from intrinsiccv/src/conversions/float_conv_sc.h rename to kleidicv/src/conversions/float_conv_sc.h index bfb9bd919..fb2b4e85b 100644 --- a/intrinsiccv/src/conversions/float_conv_sc.h +++ b/kleidicv/src/conversions/float_conv_sc.h @@ -8,8 +8,8 @@ #include #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -145,7 +145,7 @@ class float_conversion_operation { }; template -static intrinsiccv_error_t float_conversion_sc( +static kleidicv_error_t float_conversion_sc( const I* src, size_t src_stride, O* dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); diff --git a/intrinsiccv/src/conversions/float_conv_sme2.cpp b/kleidicv/src/conversions/float_conv_sme2.cpp similarity index 83% rename from intrinsiccv/src/conversions/float_conv_sme2.cpp rename to kleidicv/src/conversions/float_conv_sme2.cpp index 6c3eeead2..49832008a 100644 --- a/intrinsiccv/src/conversions/float_conv_sme2.cpp +++ b/kleidicv/src/conversions/float_conv_sme2.cpp @@ -4,10 +4,10 @@ #include "float_conv_sc.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { template -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t float_conversion(const InputType* src, size_t src_stride, OutputType* dst, size_t dst_stride, size_t width, size_t height) { return float_conversion_sc(src, src_stride, dst, @@ -15,7 +15,7 @@ float_conversion(const InputType* src, size_t src_stride, OutputType* dst, } #define KLEIDICV_INSTANTIATE_TEMPLATE(itype, otype) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t \ float_conversion(const itype* src, size_t src_stride, \ otype* dst, size_t dst_stride, size_t width, \ size_t height) @@ -25,4 +25,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(float, uint8_t); KLEIDICV_INSTANTIATE_TEMPLATE(int8_t, float); KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t, float); -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/intrinsiccv/src/conversions/float_conv_sve2.cpp b/kleidicv/src/conversions/float_conv_sve2.cpp similarity index 85% rename from intrinsiccv/src/conversions/float_conv_sve2.cpp rename to kleidicv/src/conversions/float_conv_sve2.cpp index 794aa88f6..6bbd5d72e 100644 --- a/intrinsiccv/src/conversions/float_conv_sve2.cpp +++ b/kleidicv/src/conversions/float_conv_sve2.cpp @@ -4,10 +4,10 @@ #include "float_conv_sc.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { template -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t float_conversion(const InputType* src, size_t src_stride, OutputType* dst, size_t dst_stride, size_t width, size_t height) { return float_conversion_sc(src, src_stride, dst, @@ -15,7 +15,7 @@ float_conversion(const InputType* src, size_t src_stride, OutputType* dst, } #define KLEIDICV_INSTANTIATE_TEMPLATE(itype, otype) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t \ float_conversion(const itype* src, size_t src_stride, \ otype* dst, size_t dst_stride, size_t width, \ size_t height) @@ -25,4 +25,4 @@ KLEIDICV_INSTANTIATE_TEMPLATE(float, uint8_t); KLEIDICV_INSTANTIATE_TEMPLATE(int8_t, float); KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t, float); -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/kleidicv/src/conversions/gray_to_rgb_api.cpp b/kleidicv/src/conversions/gray_to_rgb_api.cpp new file mode 100644 index 000000000..6d40ef5a4 --- /dev/null +++ b/kleidicv/src/conversions/gray_to_rgb_api.cpp @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/conversions/gray_to_rgb.h" +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" + +#define KLEIDICV_DEFINE_C_API(name, partialname) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &kleidicv::neon::partialname, \ + KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::partialname), \ + &kleidicv::sme2::partialname) + +KLEIDICV_DEFINE_C_API(kleidicv_gray_to_rgb_u8, gray_to_rgb_u8); +KLEIDICV_DEFINE_C_API(kleidicv_gray_to_rgba_u8, gray_to_rgba_u8); diff --git a/intrinsiccv/src/conversions/gray_to_rgb_neon.cpp b/kleidicv/src/conversions/gray_to_rgb_neon.cpp similarity index 87% rename from intrinsiccv/src/conversions/gray_to_rgb_neon.cpp rename to kleidicv/src/conversions/gray_to_rgb_neon.cpp index 418d69be3..b8705c8da 100644 --- a/intrinsiccv/src/conversions/gray_to_rgb_neon.cpp +++ b/kleidicv/src/conversions/gray_to_rgb_neon.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/conversions/gray_to_rgb.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/conversions/gray_to_rgb.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class GrayToRGB final : public UnrollTwice { @@ -105,9 +105,9 @@ class GrayToRGBA final : public UnrollTwice { }; // end of class GrayToRGBA KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height) { +kleidicv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -121,9 +121,9 @@ intrinsiccv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height) { +kleidicv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -136,4 +136,4 @@ intrinsiccv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, return KLEIDICV_OK; } -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/conversions/gray_to_rgb_sc.h b/kleidicv/src/conversions/gray_to_rgb_sc.h similarity index 97% rename from intrinsiccv/src/conversions/gray_to_rgb_sc.h rename to kleidicv/src/conversions/gray_to_rgb_sc.h index a026a35b9..2844bee85 100644 --- a/intrinsiccv/src/conversions/gray_to_rgb_sc.h +++ b/kleidicv/src/conversions/gray_to_rgb_sc.h @@ -5,9 +5,9 @@ #ifndef KLEIDICV_GRAY_TO_RGB_SC_H #define KLEIDICV_GRAY_TO_RGB_SC_H -#include "intrinsiccv/conversions/gray_to_rgb.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/conversions/gray_to_rgb.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -201,7 +201,7 @@ class GrayToRGBAWithLookUpTable final : public UnrollTwice, }; // end of class GrayToRGBAWithLookUpTable #endif // !KLEIDICV_PREFER_INTERLEAVING_LOAD_STORE -KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t gray_to_rgb_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t gray_to_rgb_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -221,7 +221,7 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t gray_to_rgb_u8_sc( return KLEIDICV_OK; } -KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t gray_to_rgba_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t gray_to_rgba_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); diff --git a/intrinsiccv/src/conversions/gray_to_rgb_sme2.cpp b/kleidicv/src/conversions/gray_to_rgb_sme2.cpp similarity index 74% rename from intrinsiccv/src/conversions/gray_to_rgb_sme2.cpp rename to kleidicv/src/conversions/gray_to_rgb_sme2.cpp index 07735f84a..8a889a8d2 100644 --- a/intrinsiccv/src/conversions/gray_to_rgb_sme2.cpp +++ b/kleidicv/src/conversions/gray_to_rgb_sme2.cpp @@ -4,18 +4,18 @@ #include "gray_to_rgb_sc.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return gray_to_rgb_u8_sc(src, src_stride, dst, dst_stride, width, height); } -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return gray_to_rgba_u8_sc(src, src_stride, dst, dst_stride, width, height); } -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/intrinsiccv/src/conversions/gray_to_rgb_sve2.cpp b/kleidicv/src/conversions/gray_to_rgb_sve2.cpp similarity index 79% rename from intrinsiccv/src/conversions/gray_to_rgb_sve2.cpp rename to kleidicv/src/conversions/gray_to_rgb_sve2.cpp index 985c53f19..9b51fa134 100644 --- a/intrinsiccv/src/conversions/gray_to_rgb_sve2.cpp +++ b/kleidicv/src/conversions/gray_to_rgb_sve2.cpp @@ -4,18 +4,18 @@ #include "gray_to_rgb_sc.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return gray_to_rgb_u8_sc(src, src_stride, dst, dst_stride, width, height); } -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return gray_to_rgba_u8_sc(src, src_stride, dst, dst_stride, width, height); } -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/kleidicv/src/conversions/merge_api.cpp b/kleidicv/src/conversions/merge_api.cpp new file mode 100644 index 000000000..91f7e8ef9 --- /dev/null +++ b/kleidicv/src/conversions/merge_api.cpp @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/conversions/merge.h" +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" + +KLEIDICV_MULTIVERSION_C_API(kleidicv_merge, &kleidicv::neon::merge, nullptr, + nullptr); diff --git a/intrinsiccv/src/conversions/merge_neon.cpp b/kleidicv/src/conversions/merge_neon.cpp similarity index 96% rename from intrinsiccv/src/conversions/merge_neon.cpp rename to kleidicv/src/conversions/merge_neon.cpp index 7a5ce325a..24536c42f 100644 --- a/intrinsiccv/src/conversions/merge_neon.cpp +++ b/kleidicv/src/conversions/merge_neon.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/conversions/merge.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/conversions/merge.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { // ---------------------------------------- // ------------ Two-way merge ------------- @@ -364,9 +364,9 @@ class Merge4 final : public UnrollTwice { // Most of the complexity comes from parameter checking. // NOLINTBEGIN(readability-function-cognitive-complexity) template -intrinsiccv_error_t merge(const void **srcs, const size_t *src_strides, - void *dst_void, size_t dst_stride, size_t width, - size_t height, size_t channels) { +kleidicv_error_t merge(const void **srcs, const size_t *src_strides, + void *dst_void, size_t dst_stride, size_t width, + size_t height, size_t channels) { if (channels < 2) { return KLEIDICV_ERROR_RANGE; } @@ -420,9 +420,9 @@ intrinsiccv_error_t merge(const void **srcs, const size_t *src_strides, // NOLINTEND(readability-function-cognitive-complexity) KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t merge(const void **srcs, const size_t *src_strides, - void *dst, size_t dst_stride, size_t width, - size_t height, size_t channels, size_t element_size) { +kleidicv_error_t merge(const void **srcs, const size_t *src_strides, void *dst, + size_t dst_stride, size_t width, size_t height, + size_t channels, size_t element_size) { switch (element_size) { case sizeof(uint8_t): return merge(srcs, src_strides, dst, dst_stride, width, height, @@ -445,4 +445,4 @@ intrinsiccv_error_t merge(const void **srcs, const size_t *src_strides, } } -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/conversions/rgb_to_rgb_api.cpp b/kleidicv/src/conversions/rgb_to_rgb_api.cpp similarity index 51% rename from intrinsiccv/src/conversions/rgb_to_rgb_api.cpp rename to kleidicv/src/conversions/rgb_to_rgb_api.cpp index 8c75992ab..47e81b990 100644 --- a/intrinsiccv/src/conversions/rgb_to_rgb_api.cpp +++ b/kleidicv/src/conversions/rgb_to_rgb_api.cpp @@ -2,23 +2,23 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/conversions/rgb_to_rgb.h" -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/types.h" - -#define KLEIDICV_DEFINE_C_API(name, partialname) \ - KLEIDICV_MULTIVERSION_C_API( \ - name, &intrinsiccv::neon::partialname, \ - KLEIDICV_SVE2_IMPL_IF(&intrinsiccv::sve2::partialname), \ - &intrinsiccv::sme2::partialname) - -KLEIDICV_DEFINE_C_API(intrinsiccv_rgb_to_bgr_u8, rgb_to_bgr_u8); -KLEIDICV_DEFINE_C_API(intrinsiccv_rgba_to_bgra_u8, rgba_to_bgra_u8); -KLEIDICV_DEFINE_C_API(intrinsiccv_rgb_to_bgra_u8, rgb_to_bgra_u8); -KLEIDICV_DEFINE_C_API(intrinsiccv_rgb_to_rgba_u8, rgb_to_rgba_u8); -KLEIDICV_DEFINE_C_API(intrinsiccv_rgba_to_bgr_u8, rgba_to_bgr_u8); -KLEIDICV_DEFINE_C_API(intrinsiccv_rgba_to_rgb_u8, rgba_to_rgb_u8); +#include "kleidicv/conversions/rgb_to_rgb.h" +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/types.h" + +#define KLEIDICV_DEFINE_C_API(name, partialname) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &kleidicv::neon::partialname, \ + KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::partialname), \ + &kleidicv::sme2::partialname) + +KLEIDICV_DEFINE_C_API(kleidicv_rgb_to_bgr_u8, rgb_to_bgr_u8); +KLEIDICV_DEFINE_C_API(kleidicv_rgba_to_bgra_u8, rgba_to_bgra_u8); +KLEIDICV_DEFINE_C_API(kleidicv_rgb_to_bgra_u8, rgb_to_bgra_u8); +KLEIDICV_DEFINE_C_API(kleidicv_rgb_to_rgba_u8, rgb_to_rgba_u8); +KLEIDICV_DEFINE_C_API(kleidicv_rgba_to_bgr_u8, rgba_to_bgr_u8); +KLEIDICV_DEFINE_C_API(kleidicv_rgba_to_rgb_u8, rgba_to_rgb_u8); extern "C" { @@ -26,7 +26,7 @@ using KLEIDICV_TARGET_NAMESPACE::CopyRows; using KLEIDICV_TARGET_NAMESPACE::Rectangle; using KLEIDICV_TARGET_NAMESPACE::Rows; -static intrinsiccv_error_t intrinsiccv_rgb_to_rgb_u8_impl( +static kleidicv_error_t kleidicv_rgb_to_rgb_u8_impl( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -40,10 +40,10 @@ static intrinsiccv_error_t intrinsiccv_rgb_to_rgb_u8_impl( return KLEIDICV_OK; } -decltype(intrinsiccv_rgb_to_rgb_u8_impl) *intrinsiccv_rgb_to_rgb_u8 = - intrinsiccv_rgb_to_rgb_u8_impl; +decltype(kleidicv_rgb_to_rgb_u8_impl) *kleidicv_rgb_to_rgb_u8 = + kleidicv_rgb_to_rgb_u8_impl; -static intrinsiccv_error_t intrinsiccv_rgba_to_rgba_u8_impl( +static kleidicv_error_t kleidicv_rgba_to_rgba_u8_impl( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -57,7 +57,7 @@ static intrinsiccv_error_t intrinsiccv_rgba_to_rgba_u8_impl( return KLEIDICV_OK; } -decltype(intrinsiccv_rgba_to_rgba_u8_impl) *intrinsiccv_rgba_to_rgba_u8 = - intrinsiccv_rgba_to_rgba_u8_impl; +decltype(kleidicv_rgba_to_rgba_u8_impl) *kleidicv_rgba_to_rgba_u8 = + kleidicv_rgba_to_rgba_u8_impl; } // extern "C" diff --git a/intrinsiccv/src/conversions/rgb_to_rgb_neon.cpp b/kleidicv/src/conversions/rgb_to_rgb_neon.cpp similarity index 87% rename from intrinsiccv/src/conversions/rgb_to_rgb_neon.cpp rename to kleidicv/src/conversions/rgb_to_rgb_neon.cpp index 6c4992e92..fe19051ec 100644 --- a/intrinsiccv/src/conversions/rgb_to_rgb_neon.cpp +++ b/kleidicv/src/conversions/rgb_to_rgb_neon.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/conversions/rgb_to_rgb.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/conversions/rgb_to_rgb.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class RGBToBGR final : public UnrollTwice { @@ -188,9 +188,9 @@ class RGBAToRGB final : public UnrollTwice { }; // end of class RGBAToRGB KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, size_t width, - size_t height) { +kleidicv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -204,9 +204,9 @@ intrinsiccv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height) { +kleidicv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -219,7 +219,7 @@ intrinsiccv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, return KLEIDICV_OK; } -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -234,7 +234,7 @@ rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, return KLEIDICV_OK; } -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -250,9 +250,9 @@ rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height) { +kleidicv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -266,9 +266,9 @@ intrinsiccv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height) { +kleidicv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -281,4 +281,4 @@ intrinsiccv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, return KLEIDICV_OK; } -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/conversions/rgb_to_rgb_sc.h b/kleidicv/src/conversions/rgb_to_rgb_sc.h similarity index 96% rename from intrinsiccv/src/conversions/rgb_to_rgb_sc.h rename to kleidicv/src/conversions/rgb_to_rgb_sc.h index a5785e9cd..bab6c91fb 100644 --- a/intrinsiccv/src/conversions/rgb_to_rgb_sc.h +++ b/kleidicv/src/conversions/rgb_to_rgb_sc.h @@ -5,9 +5,9 @@ #ifndef KLEIDICV_RGB_TO_RGB_SC_H #define KLEIDICV_RGB_TO_RGB_SC_H -#include "intrinsiccv/conversions/rgb_to_rgb.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/conversions/rgb_to_rgb.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -183,7 +183,7 @@ class RGBAToRGB final : public UnrollTwice { } }; // end of class RGBAToRGB -KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t rgb_to_bgr_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t rgb_to_bgr_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -204,7 +204,7 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t rgb_to_bgr_u8_sc( } KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t rgba_to_bgra_u8_sc( +static kleidicv_error_t rgba_to_bgra_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -220,7 +220,7 @@ static intrinsiccv_error_t rgba_to_bgra_u8_sc( } KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t rgb_to_bgra_u8_sc( +static kleidicv_error_t rgb_to_bgra_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -236,7 +236,7 @@ static intrinsiccv_error_t rgb_to_bgra_u8_sc( } KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t rgb_to_rgba_u8_sc( +static kleidicv_error_t rgb_to_rgba_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -252,7 +252,7 @@ static intrinsiccv_error_t rgb_to_rgba_u8_sc( } KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t rgba_to_bgr_u8_sc( +static kleidicv_error_t rgba_to_bgr_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); @@ -268,7 +268,7 @@ static intrinsiccv_error_t rgba_to_bgr_u8_sc( } KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t rgba_to_rgb_u8_sc( +static kleidicv_error_t rgba_to_rgb_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTER_AND_STRIDE(src, src_stride); diff --git a/intrinsiccv/src/conversions/rgb_to_rgb_sme2.cpp b/kleidicv/src/conversions/rgb_to_rgb_sme2.cpp similarity index 74% rename from intrinsiccv/src/conversions/rgb_to_rgb_sme2.cpp rename to kleidicv/src/conversions/rgb_to_rgb_sme2.cpp index 1e9af255e..3dd0f8db2 100644 --- a/intrinsiccv/src/conversions/rgb_to_rgb_sme2.cpp +++ b/kleidicv/src/conversions/rgb_to_rgb_sme2.cpp @@ -4,42 +4,42 @@ #include "rgb_to_rgb_sc.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgb_to_bgr_u8_sc(src, src_stride, dst, dst_stride, width, height); } -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgba_to_bgra_u8_sc(src, src_stride, dst, dst_stride, width, height); } -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgb_to_bgra_u8_sc(src, src_stride, dst, dst_stride, width, height); } -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgb_to_rgba_u8_sc(src, src_stride, dst, dst_stride, width, height); } -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgba_to_bgr_u8_sc(src, src_stride, dst, dst_stride, width, height); } -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgba_to_rgb_u8_sc(src, src_stride, dst, dst_stride, width, height); } -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/intrinsiccv/src/conversions/rgb_to_rgb_sve2.cpp b/kleidicv/src/conversions/rgb_to_rgb_sve2.cpp similarity index 50% rename from intrinsiccv/src/conversions/rgb_to_rgb_sve2.cpp rename to kleidicv/src/conversions/rgb_to_rgb_sve2.cpp index c107564b5..375cf1eb9 100644 --- a/intrinsiccv/src/conversions/rgb_to_rgb_sve2.cpp +++ b/kleidicv/src/conversions/rgb_to_rgb_sve2.cpp @@ -4,46 +4,46 @@ #include "rgb_to_rgb_sc.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, size_t width, - size_t height) { +kleidicv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height) { return rgb_to_bgr_u8_sc(src, src_stride, dst, dst_stride, width, height); } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height) { +kleidicv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height) { return rgba_to_bgra_u8_sc(src, src_stride, dst, dst_stride, width, height); } -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgb_to_bgra_u8_sc(src, src_stride, dst, dst_stride, width, height); } -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { return rgb_to_rgba_u8_sc(src, src_stride, dst, dst_stride, width, height); } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height) { +kleidicv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height) { return rgba_to_bgr_u8_sc(src, src_stride, dst, dst_stride, width, height); } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, - uint8_t *dst, size_t dst_stride, - size_t width, size_t height) { +kleidicv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height) { return rgba_to_rgb_u8_sc(src, src_stride, dst, dst_stride, width, height); } -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/kleidicv/src/conversions/split_api.cpp b/kleidicv/src/conversions/split_api.cpp new file mode 100644 index 000000000..05b3d8763 --- /dev/null +++ b/kleidicv/src/conversions/split_api.cpp @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/conversions/split.h" +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" + +KLEIDICV_MULTIVERSION_C_API(kleidicv_split, &kleidicv::neon::split, nullptr, + nullptr); diff --git a/intrinsiccv/src/conversions/split_neon.cpp b/kleidicv/src/conversions/split_neon.cpp similarity index 94% rename from intrinsiccv/src/conversions/split_neon.cpp rename to kleidicv/src/conversions/split_neon.cpp index caa24f38e..4cddd0473 100644 --- a/intrinsiccv/src/conversions/split_neon.cpp +++ b/kleidicv/src/conversions/split_neon.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/conversions/split.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/conversions/split.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { // Generic 2-channel split // @@ -249,9 +249,9 @@ class Split4 final : public UnrollTwice { // Most of the complexity comes from parameter checking. // NOLINTBEGIN(readability-function-cognitive-complexity) template -intrinsiccv_error_t split(const void *src_void, const size_t src_stride, - void **dst_data, const size_t *dst_strides, - size_t width, size_t height, size_t channels) { +kleidicv_error_t split(const void *src_void, const size_t src_stride, + void **dst_data, const size_t *dst_strides, size_t width, + size_t height, size_t channels) { if (channels < 2) { return KLEIDICV_ERROR_RANGE; } @@ -302,10 +302,9 @@ intrinsiccv_error_t split(const void *src_void, const size_t src_stride, // NOLINTEND(readability-function-cognitive-complexity) KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t split(const void *src_data, size_t src_stride, - void **dst_data, const size_t *dst_strides, - size_t width, size_t height, size_t channels, - size_t element_size) { +kleidicv_error_t split(const void *src_data, size_t src_stride, void **dst_data, + const size_t *dst_strides, size_t width, size_t height, + size_t channels, size_t element_size) { switch (element_size) { case sizeof(uint8_t): return split(src_data, src_stride, dst_data, dst_strides, width, @@ -327,4 +326,4 @@ intrinsiccv_error_t split(const void *src_data, size_t src_stride, return KLEIDICV_ERROR_NOT_IMPLEMENTED; } } -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/kleidicv/src/conversions/yuv_to_rgb_api.cpp b/kleidicv/src/conversions/yuv_to_rgb_api.cpp new file mode 100644 index 000000000..56e237c47 --- /dev/null +++ b/kleidicv/src/conversions/yuv_to_rgb_api.cpp @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/conversions/yuv_to_rgb.h" +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" + +#define KLEIDICV_DEFINE_C_API(name, partialname) \ + KLEIDICV_MULTIVERSION_C_API(name, &kleidicv::neon::partialname, \ + &kleidicv::sve2::partialname, \ + &kleidicv::sme2::partialname) + +KLEIDICV_DEFINE_C_API(kleidicv_yuv_sp_to_rgb_u8, yuv_sp_to_rgb_u8); +KLEIDICV_DEFINE_C_API(kleidicv_yuv_sp_to_bgr_u8, yuv_sp_to_bgr_u8); +KLEIDICV_DEFINE_C_API(kleidicv_yuv_sp_to_rgba_u8, yuv_sp_to_rgba_u8); +KLEIDICV_DEFINE_C_API(kleidicv_yuv_sp_to_bgra_u8, yuv_sp_to_bgra_u8); diff --git a/intrinsiccv/src/conversions/yuv_to_rgb_neon.cpp b/kleidicv/src/conversions/yuv_to_rgb_neon.cpp similarity index 93% rename from intrinsiccv/src/conversions/yuv_to_rgb_neon.cpp rename to kleidicv/src/conversions/yuv_to_rgb_neon.cpp index dcd07d021..dfb1da3e4 100644 --- a/intrinsiccv/src/conversions/yuv_to_rgb_neon.cpp +++ b/kleidicv/src/conversions/yuv_to_rgb_neon.cpp @@ -4,11 +4,11 @@ #include -#include "intrinsiccv/conversions/yuv_to_rgb.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/conversions/yuv_to_rgb.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class YUVSpToRGBxOrBGRx final : public UnrollOnce, public TryToAvoidTailLoop { @@ -287,7 +287,7 @@ using YUVSpToBGR = YUVSpToRGBxOrBGRx; using YUVSpToBGRA = YUVSpToRGBxOrBGRx; template -intrinsiccv_error_t yuv2rgbx_operation( +kleidicv_error_t yuv2rgbx_operation( OperationType &operation, const ScalarType *src_y, size_t src_y_stride, const ScalarType *src_uv, size_t src_uv_stride, ScalarType *dst, size_t dst_stride, size_t width, size_t height) { @@ -312,27 +312,25 @@ intrinsiccv_error_t yuv2rgbx_operation( } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21) { +kleidicv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height, bool is_nv21) { YUVSpToRGB operation{is_nv21}; return yuv2rgbx_operation(operation, src_y, src_y_stride, src_uv, src_uv_stride, dst, dst_stride, width, height); } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21) { +kleidicv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21) { YUVSpToRGBA operation{is_nv21}; return yuv2rgbx_operation(operation, src_y, src_y_stride, src_uv, src_uv_stride, dst, dst_stride, width, height); } -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { @@ -341,7 +339,7 @@ yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, src_uv_stride, dst, dst_stride, width, height); } -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgra_u8( +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t yuv_sp_to_bgra_u8( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { @@ -350,4 +348,4 @@ KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgra_u8( src_uv_stride, dst, dst_stride, width, height); } -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/conversions/yuv_to_rgb_sc.h b/kleidicv/src/conversions/yuv_to_rgb_sc.h similarity index 96% rename from intrinsiccv/src/conversions/yuv_to_rgb_sc.h rename to kleidicv/src/conversions/yuv_to_rgb_sc.h index a318aa356..71a0f8e19 100644 --- a/intrinsiccv/src/conversions/yuv_to_rgb_sc.h +++ b/kleidicv/src/conversions/yuv_to_rgb_sc.h @@ -5,9 +5,9 @@ #ifndef KLEIDICV_YUV_TO_RGB_SC_H #define KLEIDICV_YUV_TO_RGB_SC_H -#include "intrinsiccv/conversions/yuv_to_rgb.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/conversions/yuv_to_rgb.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -186,7 +186,7 @@ using YUVSpToBGR = YUVSpToRGBxOrBGRx; using YUVSpToBGRA = YUVSpToRGBxOrBGRx; template -intrinsiccv_error_t yuv2rgbx_operation( +kleidicv_error_t yuv2rgbx_operation( OperationType &operation, const ScalarType *src_y, size_t src_y_stride, const ScalarType *src_uv, size_t src_uv_stride, ScalarType *dst, size_t dst_stride, size_t width, @@ -212,7 +212,7 @@ intrinsiccv_error_t yuv2rgbx_operation( } KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t yuv_sp_to_rgb_u8_sc( +static kleidicv_error_t yuv_sp_to_rgb_u8_sc( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) KLEIDICV_STREAMING_COMPATIBLE { @@ -222,7 +222,7 @@ static intrinsiccv_error_t yuv_sp_to_rgb_u8_sc( } KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t yuv_sp_to_rgba_u8_sc( +static kleidicv_error_t yuv_sp_to_rgba_u8_sc( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) KLEIDICV_STREAMING_COMPATIBLE { @@ -232,7 +232,7 @@ static intrinsiccv_error_t yuv_sp_to_rgba_u8_sc( } KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t yuv_sp_to_bgr_u8_sc( +static kleidicv_error_t yuv_sp_to_bgr_u8_sc( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) KLEIDICV_STREAMING_COMPATIBLE { @@ -242,7 +242,7 @@ static intrinsiccv_error_t yuv_sp_to_bgr_u8_sc( } KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t yuv_sp_to_bgra_u8_sc( +static kleidicv_error_t yuv_sp_to_bgra_u8_sc( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) KLEIDICV_STREAMING_COMPATIBLE { diff --git a/intrinsiccv/src/conversions/yuv_to_rgb_sme2.cpp b/kleidicv/src/conversions/yuv_to_rgb_sme2.cpp similarity index 82% rename from intrinsiccv/src/conversions/yuv_to_rgb_sme2.cpp rename to kleidicv/src/conversions/yuv_to_rgb_sme2.cpp index 21468f8d0..4890226b8 100644 --- a/intrinsiccv/src/conversions/yuv_to_rgb_sme2.cpp +++ b/kleidicv/src/conversions/yuv_to_rgb_sme2.cpp @@ -4,9 +4,9 @@ #include "yuv_to_rgb_sc.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { @@ -14,7 +14,7 @@ yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, dst_stride, width, height, is_nv21); } -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, @@ -23,7 +23,7 @@ yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, dst_stride, width, height, is_nv21); } -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { @@ -31,7 +31,7 @@ yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, dst_stride, width, height, is_nv21); } -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t yuv_sp_to_bgra_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, @@ -40,4 +40,4 @@ yuv_sp_to_bgra_u8(const uint8_t *src_y, size_t src_y_stride, dst_stride, width, height, is_nv21); } -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/intrinsiccv/src/conversions/yuv_to_rgb_sve2.cpp b/kleidicv/src/conversions/yuv_to_rgb_sve2.cpp similarity index 57% rename from intrinsiccv/src/conversions/yuv_to_rgb_sve2.cpp rename to kleidicv/src/conversions/yuv_to_rgb_sve2.cpp index edd1cec26..9c7d9a645 100644 --- a/intrinsiccv/src/conversions/yuv_to_rgb_sve2.cpp +++ b/kleidicv/src/conversions/yuv_to_rgb_sve2.cpp @@ -4,29 +4,27 @@ #include "yuv_to_rgb_sc.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21) { +kleidicv_error_t yuv_sp_to_rgb_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, size_t width, + size_t height, bool is_nv21) { return yuv_sp_to_rgb_u8_sc(src_y, src_y_stride, src_uv, src_uv_stride, dst, dst_stride, width, height, is_nv21); } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, - const uint8_t *src_uv, - size_t src_uv_stride, uint8_t *dst, - size_t dst_stride, size_t width, - size_t height, bool is_nv21) { +kleidicv_error_t yuv_sp_to_rgba_u8(const uint8_t *src_y, size_t src_y_stride, + const uint8_t *src_uv, size_t src_uv_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, bool is_nv21) { return yuv_sp_to_rgba_u8_sc(src_y, src_y_stride, src_uv, src_uv_stride, dst, dst_stride, width, height, is_nv21); } -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { @@ -34,7 +32,7 @@ yuv_sp_to_bgr_u8(const uint8_t *src_y, size_t src_y_stride, dst_stride, width, height, is_nv21); } -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgra_u8( +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t yuv_sp_to_bgra_u8( const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21) { @@ -42,4 +40,4 @@ KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t yuv_sp_to_bgra_u8( dst_stride, width, height, is_nv21); } -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/intrinsiccv/src/filters/gaussian_blur_api.cpp b/kleidicv/src/filters/gaussian_blur_api.cpp similarity index 56% rename from intrinsiccv/src/filters/gaussian_blur_api.cpp rename to kleidicv/src/filters/gaussian_blur_api.cpp index 841694de4..17b4ff543 100644 --- a/intrinsiccv/src/filters/gaussian_blur_api.cpp +++ b/kleidicv/src/filters/gaussian_blur_api.cpp @@ -2,19 +2,19 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/dispatch.h" -#include "intrinsiccv/filters/gaussian_blur.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/workspace/separable.h" +#include "kleidicv/dispatch.h" +#include "kleidicv/filters/gaussian_blur.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/workspace/separable.h" extern "C" { using KLEIDICV_TARGET_NAMESPACE::Rectangle; using KLEIDICV_TARGET_NAMESPACE::SeparableFilterWorkspace; -intrinsiccv_error_t intrinsiccv_filter_create( - intrinsiccv_filter_context_t **context, size_t channels, size_t type_size, - intrinsiccv_rectangle_t image) { +kleidicv_error_t kleidicv_filter_create(kleidicv_filter_context_t **context, + size_t channels, size_t type_size, + kleidicv_rectangle_t image) { CHECK_POINTERS(context); CHECK_RECTANGLE_SIZE(image); @@ -33,13 +33,11 @@ intrinsiccv_error_t intrinsiccv_filter_create( return KLEIDICV_ERROR_ALLOCATION; } - *context = - reinterpret_cast(workspace.release()); + *context = reinterpret_cast(workspace.release()); return KLEIDICV_OK; } -intrinsiccv_error_t intrinsiccv_filter_release( - intrinsiccv_filter_context_t *context) { +kleidicv_error_t kleidicv_filter_release(kleidicv_filter_context_t *context) { CHECK_POINTERS(context); // Deliberately create and immediately destroy a unique_ptr to delete the @@ -53,11 +51,11 @@ intrinsiccv_error_t intrinsiccv_filter_release( } // extern "C" -KLEIDICV_MULTIVERSION_C_API(intrinsiccv_gaussian_blur_3x3_u8, - &intrinsiccv::neon::gaussian_blur_3x3_u8, nullptr, +KLEIDICV_MULTIVERSION_C_API(kleidicv_gaussian_blur_3x3_u8, + &kleidicv::neon::gaussian_blur_3x3_u8, nullptr, nullptr); KLEIDICV_MULTIVERSION_C_API( - intrinsiccv_gaussian_blur_5x5_u8, &intrinsiccv::neon::gaussian_blur_5x5_u8, - KLEIDICV_SVE2_IMPL_IF(intrinsiccv::sve2::gaussian_blur_5x5_u8), - &intrinsiccv::sme2::gaussian_blur_5x5_u8); + kleidicv_gaussian_blur_5x5_u8, &kleidicv::neon::gaussian_blur_5x5_u8, + KLEIDICV_SVE2_IMPL_IF(kleidicv::sve2::gaussian_blur_5x5_u8), + &kleidicv::sme2::gaussian_blur_5x5_u8); diff --git a/intrinsiccv/src/filters/gaussian_blur_neon.cpp b/kleidicv/src/filters/gaussian_blur_neon.cpp similarity index 83% rename from intrinsiccv/src/filters/gaussian_blur_neon.cpp rename to kleidicv/src/filters/gaussian_blur_neon.cpp index 56fd951f3..096231d35 100644 --- a/intrinsiccv/src/filters/gaussian_blur_neon.cpp +++ b/kleidicv/src/filters/gaussian_blur_neon.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/filters/gaussian_blur.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/filters/gaussian_blur.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { // Primary template for Gaussian Blur approximation filters. template @@ -143,11 +143,12 @@ class DiscreteGaussianBlur { }; // end of class DiscreteGaussianBlur template -intrinsiccv_error_t discrete_gaussian_blur( - const ScalarType *src, size_t src_stride, ScalarType *dst, - size_t dst_stride, size_t width, size_t height, size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context) { +kleidicv_error_t discrete_gaussian_blur(const ScalarType *src, + size_t src_stride, ScalarType *dst, + size_t dst_stride, size_t width, + size_t height, size_t channels, + kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context) { using GaussianBlurFilterType = DiscreteGaussianBlur; CHECK_POINTERS(context); @@ -195,25 +196,27 @@ intrinsiccv_error_t discrete_gaussian_blur( } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t gaussian_blur_3x3_u8( - const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height, size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context) { +kleidicv_error_t gaussian_blur_3x3_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, + size_t channels, + kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context) { return discrete_gaussian_blur(src, src_stride, dst, dst_stride, width, height, channels, border_type, context); } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t gaussian_blur_5x5_u8( - const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, - size_t width, size_t height, size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context) { +kleidicv_error_t gaussian_blur_5x5_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, + size_t channels, + kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context) { return discrete_gaussian_blur(src, src_stride, dst, dst_stride, width, height, channels, border_type, context); } -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/filters/gaussian_blur_sc.h b/kleidicv/src/filters/gaussian_blur_sc.h similarity index 95% rename from intrinsiccv/src/filters/gaussian_blur_sc.h rename to kleidicv/src/filters/gaussian_blur_sc.h index f2ae39d7e..4c08577db 100644 --- a/intrinsiccv/src/filters/gaussian_blur_sc.h +++ b/kleidicv/src/filters/gaussian_blur_sc.h @@ -7,8 +7,8 @@ #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -83,11 +83,11 @@ class DiscreteGaussianBlur { }; // end of class DiscreteGaussianBlur template -intrinsiccv_error_t discrete_gaussian_blur( +kleidicv_error_t discrete_gaussian_blur( const ScalarType *src, size_t src_stride, ScalarType *dst, size_t dst_stride, size_t width, size_t height, size_t channels, - intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context) KLEIDICV_STREAMING_COMPATIBLE { + kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context) KLEIDICV_STREAMING_COMPATIBLE { using GaussianBlurFilterType = DiscreteGaussianBlur; CHECK_POINTERS(context); diff --git a/intrinsiccv/src/filters/gaussian_blur_sme2.cpp b/kleidicv/src/filters/gaussian_blur_sme2.cpp similarity index 62% rename from intrinsiccv/src/filters/gaussian_blur_sme2.cpp rename to kleidicv/src/filters/gaussian_blur_sme2.cpp index 592385d69..ed69922fe 100644 --- a/intrinsiccv/src/filters/gaussian_blur_sme2.cpp +++ b/kleidicv/src/filters/gaussian_blur_sme2.cpp @@ -3,18 +3,18 @@ // SPDX-License-Identifier: Apache-2.0 #include "gaussian_blur_sc.h" -#include "intrinsiccv/filters/gaussian_blur.h" +#include "kleidicv/filters/gaussian_blur.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t gaussian_blur_5x5_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, - size_t channels, intrinsiccv_border_type_t border_type, - intrinsiccv_filter_context_t *context) { + size_t channels, kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context) { return discrete_gaussian_blur(src, src_stride, dst, dst_stride, width, height, channels, border_type, context); } -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/kleidicv/src/filters/gaussian_blur_sve2.cpp b/kleidicv/src/filters/gaussian_blur_sve2.cpp new file mode 100644 index 000000000..7e82cfbf6 --- /dev/null +++ b/kleidicv/src/filters/gaussian_blur_sve2.cpp @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "gaussian_blur_sc.h" +#include "kleidicv/filters/gaussian_blur.h" + +namespace kleidicv::sve2 { + +KLEIDICV_TARGET_FN_ATTRS +kleidicv_error_t gaussian_blur_5x5_u8(const uint8_t *src, size_t src_stride, + uint8_t *dst, size_t dst_stride, + size_t width, size_t height, + size_t channels, + kleidicv_border_type_t border_type, + kleidicv_filter_context_t *context) { + return discrete_gaussian_blur(src, src_stride, dst, dst_stride, + width, height, channels, + border_type, context); +} + +} // namespace kleidicv::sve2 diff --git a/kleidicv/src/filters/sobel_api.cpp b/kleidicv/src/filters/sobel_api.cpp new file mode 100644 index 000000000..f1460027b --- /dev/null +++ b/kleidicv/src/filters/sobel_api.cpp @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/dispatch.h" +#include "kleidicv/filters/sobel.h" +#include "kleidicv/kleidicv.h" + +#define KLEIDICV_DEFINE_C_API(name, partialname) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &kleidicv::neon::partialname, \ + KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::partialname), \ + &kleidicv::sme2::partialname) + +KLEIDICV_DEFINE_C_API(kleidicv_sobel_3x3_horizontal_s16_u8, + sobel_3x3_horizontal_s16_u8); +KLEIDICV_DEFINE_C_API(kleidicv_sobel_3x3_vertical_s16_u8, + sobel_3x3_vertical_s16_u8); diff --git a/intrinsiccv/src/filters/sobel_neon.cpp b/kleidicv/src/filters/sobel_neon.cpp similarity index 87% rename from intrinsiccv/src/filters/sobel_neon.cpp rename to kleidicv/src/filters/sobel_neon.cpp index 16cc58e4b..51a419392 100644 --- a/intrinsiccv/src/filters/sobel_neon.cpp +++ b/kleidicv/src/filters/sobel_neon.cpp @@ -2,12 +2,12 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/filters/sobel.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/morphology/workspace.h" -#include "intrinsiccv/neon.h" +#include "kleidicv/filters/sobel.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/morphology/workspace.h" +#include "kleidicv/neon.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { // Template for 3x3 Sobel filters which calculate horizontal derivative // approximations, often denoted as Gx. @@ -127,11 +127,10 @@ class VerticalSobel3x3 { }; // end of class VerticalSobel3x3 KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, - size_t src_stride, int16_t *dst, - size_t dst_stride, size_t width, - size_t height, - size_t channels) { +kleidicv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, + size_t src_stride, int16_t *dst, + size_t dst_stride, size_t width, + size_t height, size_t channels) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -164,10 +163,10 @@ intrinsiccv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, - size_t src_stride, int16_t *dst, - size_t dst_stride, size_t width, - size_t height, size_t channels) { +kleidicv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, + size_t src_stride, int16_t *dst, + size_t dst_stride, size_t width, + size_t height, size_t channels) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(width, height); @@ -199,4 +198,4 @@ intrinsiccv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, return KLEIDICV_OK; } -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/filters/sobel_sc.h b/kleidicv/src/filters/sobel_sc.h similarity index 96% rename from intrinsiccv/src/filters/sobel_sc.h rename to kleidicv/src/filters/sobel_sc.h index 1bd04691a..5671232fb 100644 --- a/intrinsiccv/src/filters/sobel_sc.h +++ b/kleidicv/src/filters/sobel_sc.h @@ -5,9 +5,9 @@ #ifndef KLEIDICV_SOBEL_SC_H #define KLEIDICV_SOBEL_SC_H -#include "intrinsiccv/filters/sobel.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/filters/sobel.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -118,7 +118,7 @@ class VerticalSobel3x3 { }; // end of class VerticalSobel3x3 KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t sobel_3x3_horizontal_s16_u8_sc( +static kleidicv_error_t sobel_3x3_horizontal_s16_u8_sc( const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) KLEIDICV_STREAMING_COMPATIBLE { @@ -154,7 +154,7 @@ static intrinsiccv_error_t sobel_3x3_horizontal_s16_u8_sc( } KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t sobel_3x3_vertical_s16_u8_sc( +static kleidicv_error_t sobel_3x3_vertical_s16_u8_sc( const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) KLEIDICV_STREAMING_COMPATIBLE { diff --git a/intrinsiccv/src/filters/sobel_sme2.cpp b/kleidicv/src/filters/sobel_sme2.cpp similarity index 80% rename from intrinsiccv/src/filters/sobel_sme2.cpp rename to kleidicv/src/filters/sobel_sme2.cpp index 2831babb6..0183c9315 100644 --- a/intrinsiccv/src/filters/sobel_sme2.cpp +++ b/kleidicv/src/filters/sobel_sme2.cpp @@ -4,9 +4,9 @@ #include "sobel_sc.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) { @@ -14,7 +14,7 @@ sobel_3x3_horizontal_s16_u8(const uint8_t *src, size_t src_stride, int16_t *dst, height, channels); } -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) { @@ -22,4 +22,4 @@ sobel_3x3_vertical_s16_u8(const uint8_t *src, size_t src_stride, int16_t *dst, height, channels); } -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/intrinsiccv/src/filters/sobel_sve2.cpp b/kleidicv/src/filters/sobel_sve2.cpp similarity index 76% rename from intrinsiccv/src/filters/sobel_sve2.cpp rename to kleidicv/src/filters/sobel_sve2.cpp index 735851850..189e75325 100644 --- a/intrinsiccv/src/filters/sobel_sve2.cpp +++ b/kleidicv/src/filters/sobel_sve2.cpp @@ -4,20 +4,20 @@ #include "sobel_sc.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t sobel_3x3_horizontal_s16_u8( +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t sobel_3x3_horizontal_s16_u8( const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) { return sobel_3x3_horizontal_s16_u8_sc(src, src_stride, dst, dst_stride, width, height, channels); } -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t sobel_3x3_vertical_s16_u8( +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t sobel_3x3_vertical_s16_u8( const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) { return sobel_3x3_vertical_s16_u8_sc(src, src_stride, dst, dst_stride, width, height, channels); } -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/kleidicv/src/morphology/morphology_api.cpp b/kleidicv/src/morphology/morphology_api.cpp new file mode 100644 index 000000000..42679e328 --- /dev/null +++ b/kleidicv/src/morphology/morphology_api.cpp @@ -0,0 +1,118 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/morphology/workspace.h" + +namespace kleidicv { + +namespace neon { + +template +kleidicv_error_t dilate(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, size_t height, + kleidicv_morphology_context_t *context); + +template +kleidicv_error_t erode(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, size_t height, + kleidicv_morphology_context_t *context); + +} // namespace neon + +namespace sve2 { + +template +kleidicv_error_t dilate(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, size_t height, + kleidicv_morphology_context_t *context); + +template +kleidicv_error_t erode(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, size_t height, + kleidicv_morphology_context_t *context); + +} // namespace sve2 + +namespace sme2 { + +template +kleidicv_error_t dilate(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, size_t height, + kleidicv_morphology_context_t *context); + +template +kleidicv_error_t erode(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, size_t height, + kleidicv_morphology_context_t *context); + +} // namespace sme2 + +} // namespace kleidicv + +extern "C" { + +using KLEIDICV_TARGET_NAMESPACE::MorphologyWorkspace; + +kleidicv_error_t kleidicv_morphology_create( + kleidicv_morphology_context_t **context, kleidicv_rectangle_t kernel, + kleidicv_point_t anchor, kleidicv_border_type_t border_type, + kleidicv_border_values_t border_values, size_t channels, size_t iterations, + size_t type_size, kleidicv_rectangle_t image) { + CHECK_POINTERS(context); + *context = nullptr; + CHECK_RECTANGLE_SIZE(kernel); + CHECK_RECTANGLE_SIZE(image); + + if (type_size > KLEIDICV_MAXIMUM_TYPE_SIZE) { + return KLEIDICV_ERROR_RANGE; + } + + if (channels > KLEIDICV_MAXIMUM_CHANNEL_COUNT) { + return KLEIDICV_ERROR_RANGE; + } + + auto morphology_border_type = + MorphologyWorkspace::get_border_type(border_type); + + if (!morphology_border_type) { + return KLEIDICV_ERROR_NOT_IMPLEMENTED; + } + + MorphologyWorkspace::Pointer workspace; + if (kleidicv_error_t error = MorphologyWorkspace::create( + workspace, kernel, anchor, *morphology_border_type, border_values, + channels, iterations, type_size, image)) { + return error; + } + + *context = + reinterpret_cast(workspace.release()); + return KLEIDICV_OK; +} + +kleidicv_error_t kleidicv_morphology_release( + kleidicv_morphology_context_t *context) { + CHECK_POINTERS(context); + + // Deliberately create and immediately destroy a unique_ptr to delete the + // workspace. + // NOLINTBEGIN(bugprone-unused-raii) + MorphologyWorkspace::Pointer{ + reinterpret_cast(context)}; + // NOLINTEND(bugprone-unused-raii) + return KLEIDICV_OK; +} + +} // extern "C" + +#define KLEIDICV_DEFINE_C_API(name, tname, type) \ + KLEIDICV_MULTIVERSION_C_API( \ + name, &kleidicv::neon::tname, \ + KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::tname), \ + &kleidicv::sme2::tname) + +KLEIDICV_DEFINE_C_API(kleidicv_dilate_u8, dilate, uint8_t); +KLEIDICV_DEFINE_C_API(kleidicv_erode_u8, erode, uint8_t); diff --git a/intrinsiccv/src/morphology/morphology_neon.cpp b/kleidicv/src/morphology/morphology_neon.cpp similarity index 96% rename from intrinsiccv/src/morphology/morphology_neon.cpp rename to kleidicv/src/morphology/morphology_neon.cpp index 9e2aef425..5b99b9221 100644 --- a/intrinsiccv/src/morphology/morphology_neon.cpp +++ b/kleidicv/src/morphology/morphology_neon.cpp @@ -5,12 +5,12 @@ #include #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/morphology/workspace.h" -#include "intrinsiccv/neon.h" -#include "intrinsiccv/types.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/morphology/workspace.h" +#include "kleidicv/neon.h" +#include "kleidicv/types.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template class VerticalOp final { @@ -488,9 +488,9 @@ class DilateOperation final { }; // end of class DilateOperation template -intrinsiccv_error_t dilate(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, size_t height, - intrinsiccv_morphology_context_t *context) { +kleidicv_error_t dilate(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, size_t height, + kleidicv_morphology_context_t *context) { CHECK_POINTERS(context); CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -559,9 +559,9 @@ class ErodeOperation final { }; // end of class ErodeOperation template -intrinsiccv_error_t erode(const T *src, size_t src_stride, T *dst, - size_t dst_stride, size_t width, size_t height, - intrinsiccv_morphology_context_t *context) { +kleidicv_error_t erode(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, size_t height, + kleidicv_morphology_context_t *context) { CHECK_POINTERS(context); CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -603,11 +603,11 @@ intrinsiccv_error_t erode(const T *src, size_t src_stride, T *dst, } #define KLEIDICV_INSTANTIATE_TEMPLATE(name, type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t name( \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t name( \ const type *src, size_t src_stride, type *dst, size_t dst_stride, \ - size_t width, size_t height, intrinsiccv_morphology_context_t *context) + size_t width, size_t height, kleidicv_morphology_context_t *context) KLEIDICV_INSTANTIATE_TEMPLATE(dilate, uint8_t); KLEIDICV_INSTANTIATE_TEMPLATE(erode, uint8_t); -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/morphology/morphology_sc.h b/kleidicv/src/morphology/morphology_sc.h similarity index 97% rename from intrinsiccv/src/morphology/morphology_sc.h rename to kleidicv/src/morphology/morphology_sc.h index 7698c92fa..d6e6c8eb0 100644 --- a/intrinsiccv/src/morphology/morphology_sc.h +++ b/kleidicv/src/morphology/morphology_sc.h @@ -8,10 +8,10 @@ #include #include -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/morphology/workspace.h" -#include "intrinsiccv/sve2.h" -#include "intrinsiccv/types.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/morphology/workspace.h" +#include "kleidicv/sve2.h" +#include "kleidicv/types.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -472,10 +472,10 @@ class DilateOperation final { }; // end of class DilateOperation template -static intrinsiccv_error_t dilate_sc( +static kleidicv_error_t dilate_sc( const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, - intrinsiccv_morphology_context_t *context) KLEIDICV_STREAMING_COMPATIBLE { + kleidicv_morphology_context_t *context) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTERS(context); CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); @@ -545,10 +545,10 @@ class ErodeOperation final { }; // end of class ErodeOperation template -static intrinsiccv_error_t erode_sc( - const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, - size_t height, - intrinsiccv_morphology_context_t *context) KLEIDICV_STREAMING_COMPATIBLE { +static kleidicv_error_t erode_sc(const T *src, size_t src_stride, T *dst, + size_t dst_stride, size_t width, size_t height, + kleidicv_morphology_context_t *context) + KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTERS(context); CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); diff --git a/intrinsiccv/src/morphology/morphology_sme2.cpp b/kleidicv/src/morphology/morphology_sme2.cpp similarity index 64% rename from intrinsiccv/src/morphology/morphology_sme2.cpp rename to kleidicv/src/morphology/morphology_sme2.cpp index 9ac790203..26c3214b4 100644 --- a/intrinsiccv/src/morphology/morphology_sme2.cpp +++ b/kleidicv/src/morphology/morphology_sme2.cpp @@ -4,30 +4,30 @@ #include "morphology_sc.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { template -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t dilate(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, - size_t height, intrinsiccv_morphology_context_t *context) { + size_t height, kleidicv_morphology_context_t *context) { return dilate_sc >(src, src_stride, dst, dst_stride, width, height, context); } template -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t erode(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, - size_t height, intrinsiccv_morphology_context_t *context) { + size_t height, kleidicv_morphology_context_t *context) { return erode_sc >(src, src_stride, dst, dst_stride, width, height, context); } #define KLEIDICV_INSTANTIATE_TEMPLATE(name, type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t name( \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t name( \ const type *src, size_t src_stride, type *dst, size_t dst_stride, \ - size_t width, size_t height, intrinsiccv_morphology_context_t *context) + size_t width, size_t height, kleidicv_morphology_context_t *context) KLEIDICV_INSTANTIATE_TEMPLATE(dilate, uint8_t); KLEIDICV_INSTANTIATE_TEMPLATE(erode, uint8_t); -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/intrinsiccv/src/morphology/morphology_sve2.cpp b/kleidicv/src/morphology/morphology_sve2.cpp similarity index 66% rename from intrinsiccv/src/morphology/morphology_sve2.cpp rename to kleidicv/src/morphology/morphology_sve2.cpp index ae821971b..e4825ef72 100644 --- a/intrinsiccv/src/morphology/morphology_sve2.cpp +++ b/kleidicv/src/morphology/morphology_sve2.cpp @@ -4,30 +4,30 @@ #include "morphology_sc.h" -namespace intrinsiccv::sve2 { +namespace kleidicv::sve2 { template -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t dilate(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, - size_t height, intrinsiccv_morphology_context_t *context) { + size_t height, kleidicv_morphology_context_t *context) { return dilate_sc >( src, src_stride, dst, dst_stride, width, height, context); } template -KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t erode(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, - size_t height, intrinsiccv_morphology_context_t *context) { + size_t height, kleidicv_morphology_context_t *context) { return erode_sc >( src, src_stride, dst, dst_stride, width, height, context); } #define KLEIDICV_INSTANTIATE_TEMPLATE(name, type) \ - template KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t name( \ + template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t name( \ const type *src, size_t src_stride, type *dst, size_t dst_stride, \ - size_t width, size_t height, intrinsiccv_morphology_context_t *context) + size_t width, size_t height, kleidicv_morphology_context_t *context) KLEIDICV_INSTANTIATE_TEMPLATE(dilate, uint8_t); KLEIDICV_INSTANTIATE_TEMPLATE(erode, uint8_t); -} // namespace intrinsiccv::sve2 +} // namespace kleidicv::sve2 diff --git a/kleidicv/src/resize/resize_api.cpp b/kleidicv/src/resize/resize_api.cpp new file mode 100644 index 000000000..d30cd2536 --- /dev/null +++ b/kleidicv/src/resize/resize_api.cpp @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/resize/resize.h" + +KLEIDICV_MULTIVERSION_C_API( + kleidicv_resize_to_quarter_u8, &kleidicv::neon::resize_to_quarter_u8, + KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::resize_to_quarter_u8), + &kleidicv::sme2::resize_to_quarter_u8); diff --git a/kleidicv/src/resize/resize_linear_api.cpp b/kleidicv/src/resize/resize_linear_api.cpp new file mode 100644 index 000000000..ab3eca341 --- /dev/null +++ b/kleidicv/src/resize/resize_linear_api.cpp @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/dispatch.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/resize/resize_linear.h" + +KLEIDICV_MULTIVERSION_C_API( + kleidicv_resize_linear_u8, &kleidicv::neon::resize_linear_u8, + KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::resize_linear_u8), + &kleidicv::sme2::resize_linear_u8); diff --git a/intrinsiccv/src/resize/resize_linear_neon.cpp b/kleidicv/src/resize/resize_linear_neon.cpp similarity index 96% rename from intrinsiccv/src/resize/resize_linear_neon.cpp rename to kleidicv/src/resize/resize_linear_neon.cpp index cedad0fb8..518413b9e 100644 --- a/intrinsiccv/src/resize/resize_linear_neon.cpp +++ b/kleidicv/src/resize/resize_linear_neon.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" -#include "intrinsiccv/resize/resize_linear.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" +#include "kleidicv/resize/resize_linear.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { template uint8x8_t lerp2d_vector_p_q_q_1(uint8x8_t a, uint8x8_t b, uint8x8_t c, @@ -57,7 +57,7 @@ uint8x8_t lerp2d_vector_p_q_q_r(uint8x8_t a, uint8x8_t b, uint8x8_t c, return result; } -KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8( +KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t resize_2x2_u8( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride) { size_t dst_width = src_width * 2; @@ -187,7 +187,7 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8( return KLEIDICV_OK; } -KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8( +KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t resize_4x4_u8( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride) { size_t dst_width = src_width * 4, dst_height = src_height * 4; @@ -409,10 +409,10 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8( } KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, - size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride, - size_t dst_width, size_t dst_height) { +kleidicv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, + size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, + size_t dst_width, size_t dst_height) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(dst_width, dst_height); @@ -431,4 +431,4 @@ intrinsiccv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, return KLEIDICV_ERROR_NOT_IMPLEMENTED; } -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/resize/resize_linear_sc.h b/kleidicv/src/resize/resize_linear_sc.h similarity index 96% rename from intrinsiccv/src/resize/resize_linear_sc.h rename to kleidicv/src/resize/resize_linear_sc.h index 26fd6d26f..29532fa86 100644 --- a/intrinsiccv/src/resize/resize_linear_sc.h +++ b/kleidicv/src/resize/resize_linear_sc.h @@ -5,12 +5,12 @@ #ifndef KLEIDICV_RESIZE_LINEAR_SC_H #define KLEIDICV_RESIZE_LINEAR_SC_H -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" namespace KLEIDICV_TARGET_NAMESPACE { -KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t resize_2x2_u8_sc( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride) KLEIDICV_STREAMING_COMPATIBLE { size_t dst_width = src_width * 2; @@ -71,11 +71,11 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8_sc( }; // Work-around for clang-format oddness. -#define ISC KLEIDICV_STREAMING_COMPATIBLE +#define KSC KLEIDICV_STREAMING_COMPATIBLE // Handle top or bottom edge auto process_edge_row = [src_width, lerp1d_vector](const uint8_t *src_row, - uint8_t *dst_row) ISC { + uint8_t *dst_row) KSC { for (size_t src_x = 0; src_x + 1 < src_width; src_x += svcntb()) { size_t dst_x = src_x * 2 + 1; @@ -163,7 +163,7 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_2x2_u8_sc( return KLEIDICV_OK; } -KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t resize_4x4_u8_sc( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride) KLEIDICV_STREAMING_COMPATIBLE { size_t dst_width = src_width * 4; @@ -173,7 +173,7 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8_sc( [](uint8_t p, uint8_t a, uint8_t q, uint8_t b) KLEIDICV_STREAMING_COMPATIBLE { return (p * a + q * b + 4) >> 3; }; - auto lerp1d_vector = [](uint8_t p, svuint8_t a, uint8_t q, svuint8_t b) ISC { + auto lerp1d_vector = [](uint8_t p, svuint8_t a, uint8_t q, svuint8_t b) KSC { // bias svuint16_t top = svdup_u16(4); @@ -192,7 +192,7 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8_sc( }; auto lerp2d_vector = [](uint8_t p, svuint8_t a, uint8_t q, svuint8_t b, - uint8_t r, svuint8_t c, uint8_t s, svuint8_t d) ISC { + uint8_t r, svuint8_t c, uint8_t s, svuint8_t d) KSC { // bias svuint16_t top = svdup_u16(32); @@ -219,7 +219,7 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8_sc( // Handle top or bottom edge auto process_edge_row = [src_width, lerp1d_vector](const uint8_t *src_row, - uint8_t *dst_row) ISC { + uint8_t *dst_row) KSC { for (size_t src_x = 0; src_x + 1 < src_width; src_x += svcntb()) { size_t dst_x = src_x * 4 + 2; svbool_t pg = svwhilelt_b8(src_x + 1, src_width); @@ -273,7 +273,7 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8_sc( // Corners auto set_corner = [dst, dst_stride](size_t left_column, size_t top_row, - uint8_t value) ISC { + uint8_t value) KSC { dst[dst_stride * top_row + left_column] = value; dst[dst_stride * top_row + left_column + 1] = value; dst[dst_stride * (top_row + 1) + left_column] = value; @@ -313,7 +313,7 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8_sc( } auto copy_dst_row = [src_width](const uint8_t *dst_from, - uint8_t *dst_to) ISC { + uint8_t *dst_to) KSC { for (size_t i = 0; i < src_width; i += svcntb()) { svbool_t pg = svwhilelt_b8(i, src_width); svst4(pg, dst_to + i * 4, svld4(pg, dst_from + i * 4)); @@ -346,7 +346,7 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_4x4_u8_sc( return KLEIDICV_OK; } -KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_linear_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t resize_linear_u8_sc( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height) KLEIDICV_STREAMING_COMPATIBLE { diff --git a/intrinsiccv/src/resize/resize_linear_sme2.cpp b/kleidicv/src/resize/resize_linear_sme2.cpp similarity index 73% rename from intrinsiccv/src/resize/resize_linear_sme2.cpp rename to kleidicv/src/resize/resize_linear_sme2.cpp index 6290cd882..2464608ba 100644 --- a/intrinsiccv/src/resize/resize_linear_sme2.cpp +++ b/kleidicv/src/resize/resize_linear_sme2.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/resize/resize_linear.h" +#include "kleidicv/resize/resize_linear.h" #include "resize_linear_sc.h" -namespace intrinsiccv::sme2 { -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +namespace kleidicv::sme2 { +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height) { @@ -14,4 +14,4 @@ resize_linear_u8(const uint8_t *src, size_t src_stride, size_t src_width, dst_stride, dst_width, dst_height); } -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/kleidicv/src/resize/resize_linear_sve2.cpp b/kleidicv/src/resize/resize_linear_sve2.cpp new file mode 100644 index 000000000..3be39279a --- /dev/null +++ b/kleidicv/src/resize/resize_linear_sve2.cpp @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/resize/resize_linear.h" +#include "resize_linear_sc.h" + +namespace kleidicv::sve2 { +KLEIDICV_TARGET_FN_ATTRS +kleidicv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, + size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, + size_t dst_width, size_t dst_height) { + return resize_linear_u8_sc(src, src_stride, src_width, src_height, dst, + dst_stride, dst_width, dst_height); +} + +} // namespace kleidicv::sve2 diff --git a/intrinsiccv/src/resize/resize_neon.cpp b/kleidicv/src/resize/resize_neon.cpp similarity index 83% rename from intrinsiccv/src/resize/resize_neon.cpp rename to kleidicv/src/resize/resize_neon.cpp index 8cb00ef15..208bdd664 100644 --- a/intrinsiccv/src/resize/resize_neon.cpp +++ b/kleidicv/src/resize/resize_neon.cpp @@ -2,14 +2,14 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/neon.h" -#include "intrinsiccv/resize/resize.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/neon.h" +#include "kleidicv/resize/resize.h" -namespace intrinsiccv::neon { +namespace kleidicv::neon { KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t check_dimensions(size_t src_dim, size_t dst_dim) { +static kleidicv_error_t check_dimensions(size_t src_dim, size_t dst_dim) { size_t half_src_dim = src_dim / 2; if ((src_dim % 2) == 0) { @@ -29,19 +29,19 @@ static intrinsiccv_error_t check_dimensions(size_t src_dim, size_t dst_dim) { // better to leave it in one piece. // NOLINTBEGIN(readability-function-cognitive-complexity) KLEIDICV_TARGET_FN_ATTRS -intrinsiccv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, - size_t src_width, size_t src_height, - uint8_t *dst, size_t dst_stride, - size_t dst_width, size_t dst_height) { +kleidicv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, + size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, + size_t dst_width, size_t dst_height) { CHECK_POINTER_AND_STRIDE(src, src_stride); CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(src_width, src_height); - if (intrinsiccv_error_t ret = check_dimensions(src_width, dst_width)) { + if (kleidicv_error_t ret = check_dimensions(src_width, dst_width)) { return ret; } - if (intrinsiccv_error_t ret = check_dimensions(src_height, dst_height)) { + if (kleidicv_error_t ret = check_dimensions(src_height, dst_height)) { return ret; } @@ -121,4 +121,4 @@ intrinsiccv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, } // NOLINTEND(readability-function-cognitive-complexity) -} // namespace intrinsiccv::neon +} // namespace kleidicv::neon diff --git a/intrinsiccv/src/resize/resize_sc.h b/kleidicv/src/resize/resize_sc.h similarity index 95% rename from intrinsiccv/src/resize/resize_sc.h rename to kleidicv/src/resize/resize_sc.h index 6e80bd0d6..fa5e1f6aa 100644 --- a/intrinsiccv/src/resize/resize_sc.h +++ b/kleidicv/src/resize/resize_sc.h @@ -5,8 +5,8 @@ #ifndef KLEIDICV_RESIZE_SC_H #define KLEIDICV_RESIZE_SC_H -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/sve2.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/sve2.h" namespace KLEIDICV_TARGET_NAMESPACE { @@ -138,7 +138,7 @@ static inline void process_single_row( } KLEIDICV_TARGET_FN_ATTRS -static intrinsiccv_error_t check_dimensions(size_t src_dim, size_t dst_dim) +static kleidicv_error_t check_dimensions(size_t src_dim, size_t dst_dim) KLEIDICV_STREAMING_COMPATIBLE { size_t half_src_dim = src_dim / 2; @@ -155,7 +155,7 @@ static intrinsiccv_error_t check_dimensions(size_t src_dim, size_t dst_dim) return KLEIDICV_ERROR_RANGE; } -KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_to_quarter_u8_sc( +KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t resize_to_quarter_u8_sc( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height) KLEIDICV_STREAMING_COMPATIBLE { @@ -163,11 +163,11 @@ KLEIDICV_TARGET_FN_ATTRS static intrinsiccv_error_t resize_to_quarter_u8_sc( CHECK_POINTER_AND_STRIDE(dst, dst_stride); CHECK_IMAGE_SIZE(src_width, src_height); - if (intrinsiccv_error_t ret = check_dimensions(src_width, dst_width)) { + if (kleidicv_error_t ret = check_dimensions(src_width, dst_width)) { return ret; } - if (intrinsiccv_error_t ret = check_dimensions(src_height, dst_height)) { + if (kleidicv_error_t ret = check_dimensions(src_height, dst_height)) { return ret; } diff --git a/intrinsiccv/src/resize/resize_sme2.cpp b/kleidicv/src/resize/resize_sme2.cpp similarity index 74% rename from intrinsiccv/src/resize/resize_sme2.cpp rename to kleidicv/src/resize/resize_sme2.cpp index 4d80eae26..490ccb69a 100644 --- a/intrinsiccv/src/resize/resize_sme2.cpp +++ b/kleidicv/src/resize/resize_sme2.cpp @@ -2,12 +2,12 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "intrinsiccv/resize/resize.h" +#include "kleidicv/resize/resize.h" #include "resize_sc.h" -namespace intrinsiccv::sme2 { +namespace kleidicv::sme2 { -KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS intrinsiccv_error_t +KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height) { @@ -15,4 +15,4 @@ resize_to_quarter_u8(const uint8_t *src, size_t src_stride, size_t src_width, dst_stride, dst_width, dst_height); } -} // namespace intrinsiccv::sme2 +} // namespace kleidicv::sme2 diff --git a/kleidicv/src/resize/resize_sve2.cpp b/kleidicv/src/resize/resize_sve2.cpp new file mode 100644 index 000000000..e6f3a0140 --- /dev/null +++ b/kleidicv/src/resize/resize_sve2.cpp @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#include "kleidicv/resize/resize.h" +#include "resize_sc.h" + +namespace kleidicv::sve2 { + +KLEIDICV_TARGET_FN_ATTRS +kleidicv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, + size_t src_width, size_t src_height, + uint8_t *dst, size_t dst_stride, + size_t dst_width, size_t dst_height) { + return resize_to_quarter_u8_sc(src, src_stride, src_width, src_height, dst, + dst_stride, dst_width, dst_height); +} + +} // namespace kleidicv::sve2 diff --git a/intrinsiccv/src/supported-types.md b/kleidicv/src/supported-types.md similarity index 100% rename from intrinsiccv/src/supported-types.md rename to kleidicv/src/supported-types.md diff --git a/scripts/build.sh b/scripts/build.sh index d6871f468..7dd9406f1 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -7,10 +7,10 @@ # Builds a given target. # # Arguments: -# 1: Target to build. Defaults to 'intrinsiccv'. +# 1: Target to build. Defaults to 'kleidicv'. # # Options: -# BUILD_ID: Identifier of the build, defaults to 'intrinsiccv'. +# BUILD_ID: Identifier of the build, defaults to 'kleidicv'. # BUILD_PATH: Directory for all the files associated with a build. # CLEAN: Clean builds if set to 'ON'. Defaults to 'OFF'. # CMAKE: Full path of the CMake executable. @@ -35,7 +35,7 @@ set -exu SCRIPT_PATH="$(realpath "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")" -: "${BUILD_ID:=intrinsiccv}" +: "${BUILD_ID:=kleidicv}" : "${BUILD_PATH:=${SCRIPT_PATH}/../build/${BUILD_ID}}" : "${CLEAN:=OFF}" : "${CMAKE:=cmake}" @@ -51,7 +51,7 @@ SCRIPT_PATH="$(realpath "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")" : "${EXTRA_CMAKE_ARGS:=}" : "${SOURCE_PATH:="$(realpath "${SCRIPT_PATH}"/../)"}" -CMAKE_TARGET="${1:-intrinsiccv}" +CMAKE_TARGET="${1:-kleidicv}" IFS=' ' read -r -a EXTRA_CMAKE_ARGS_ARRAY <<< "${EXTRA_CMAKE_ARGS}" diff --git a/scripts/ci-opencv.sh b/scripts/ci-opencv.sh index 904b04a0f..a0982daff 100755 --- a/scripts/ci-opencv.sh +++ b/scripts/ci-opencv.sh @@ -19,7 +19,7 @@ CLEAN="ON" \ ./scripts/run_opencv_conformity_checks.sh || TESTRESULT=1 # Build OpenCV test executables from already configured conformity check project -ninja -C build/conformity/opencv_intrinsiccv opencv_test_imgproc opencv_test_core +ninja -C build/conformity/opencv_kleidicv opencv_test_imgproc opencv_test_core # Run a subset of the OpenCV test suite, requres opencv_extra for the test images tar xf /opt/opencv-extra-${OPENCV_VERSION}.tar.gz -C build @@ -47,7 +47,7 @@ IMGPROC_TEST_PATTERNS=( '*Imgproc_Canny*' ) IMGPROC_TEST_PATTERNS_STR="$(join_strings_with_colon "${IMGPROC_TEST_PATTERNS[*]}")" -../../../conformity/opencv_intrinsiccv/bin/opencv_test_imgproc \ +../../../conformity/opencv_kleidicv/bin/opencv_test_imgproc \ --gtest_filter="${IMGPROC_TEST_PATTERNS_STR}" || TESTRESULT=1 CORE_TEST_PATTERNS=( @@ -56,7 +56,7 @@ CORE_TEST_PATTERNS=( '*Core_ConvertScale*' ) CORE_TEST_PATTERNS_STR="$(join_strings_with_colon "${CORE_TEST_PATTERNS[*]}")" -../../../conformity/opencv_intrinsiccv/bin/opencv_test_core \ +../../../conformity/opencv_kleidicv/bin/opencv_test_core \ --gtest_filter="${CORE_TEST_PATTERNS_STR}" || TESTRESULT=1 popd diff --git a/scripts/ci.sh b/scripts/ci.sh index 2b5ecb6c2..27bad74fc 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -54,21 +54,21 @@ ninja -C build/gcc LONG_VECTOR_TESTS="GRAY2.*:RGB*" EXCLUDE_FLOAT_CONVERSION_TESTS="-FloatConversion*" TESTRESULT=0 -qemu-aarch64 build/test/framework/intrinsiccv-framework-test --gtest_output=xml:build/test-results/ || TESTRESULT=1 -qemu-aarch64 -cpu cortex-a35 build/test/api/intrinsiccv-api-test --gtest_filter="${EXCLUDE_FLOAT_CONVERSION_TESTS}" --gtest_output=xml:build/test-results/clang-neon/ || TESTRESULT=1 +qemu-aarch64 build/test/framework/kleidicv-framework-test --gtest_output=xml:build/test-results/ || TESTRESULT=1 +qemu-aarch64 -cpu cortex-a35 build/test/api/kleidicv-api-test --gtest_filter="${EXCLUDE_FLOAT_CONVERSION_TESTS}" --gtest_output=xml:build/test-results/clang-neon/ || TESTRESULT=1 qemu-aarch64 -cpu max,sve128=on,sme=off \ - build/test/api/intrinsiccv-api-test --gtest_output=xml:build/test-results/clang-sve128/ --vector-length=16 || TESTRESULT=1 + build/test/api/kleidicv-api-test --gtest_output=xml:build/test-results/clang-sve128/ --vector-length=16 || TESTRESULT=1 qemu-aarch64 -cpu max,sve2048=on,sve-default-vector-length=256,sme=off \ - build/test/api/intrinsiccv-api-test --gtest_filter="${LONG_VECTOR_TESTS}" --gtest_output=xml:build/test-results/clang-sve2048/ --vector-length=256 || TESTRESULT=1 + build/test/api/kleidicv-api-test --gtest_filter="${LONG_VECTOR_TESTS}" --gtest_output=xml:build/test-results/clang-sve2048/ --vector-length=256 || TESTRESULT=1 qemu-aarch64 -cpu max,sve128=on,sme512=on \ - build/test/api/intrinsiccv-api-test --gtest_output=xml:build/test-results/clang-sme/ --vector-length=64 || TESTRESULT=1 -qemu-aarch64 -cpu cortex-a35 build/gcc/test/api/intrinsiccv-api-test --gtest_filter="${EXCLUDE_FLOAT_CONVERSION_TESTS}" --gtest_output=xml:build/test-results/gcc-neon/ || TESTRESULT=1 + build/test/api/kleidicv-api-test --gtest_output=xml:build/test-results/clang-sme/ --vector-length=64 || TESTRESULT=1 +qemu-aarch64 -cpu cortex-a35 build/gcc/test/api/kleidicv-api-test --gtest_filter="${EXCLUDE_FLOAT_CONVERSION_TESTS}" --gtest_output=xml:build/test-results/gcc-neon/ || TESTRESULT=1 -scripts/prefix_testsuite_names.py build/test-results/clang-neon/intrinsiccv-api-test.xml "clang-neon." -scripts/prefix_testsuite_names.py build/test-results/clang-sve128/intrinsiccv-api-test.xml "clang-sve128." -scripts/prefix_testsuite_names.py build/test-results/clang-sve2048/intrinsiccv-api-test.xml "clang-sve2048." -scripts/prefix_testsuite_names.py build/test-results/clang-sme/intrinsiccv-api-test.xml "clang-sme." -scripts/prefix_testsuite_names.py build/test-results/gcc-neon/intrinsiccv-api-test.xml "gcc-neon." +scripts/prefix_testsuite_names.py build/test-results/clang-neon/kleidicv-api-test.xml "clang-neon." +scripts/prefix_testsuite_names.py build/test-results/clang-sve128/kleidicv-api-test.xml "clang-sve128." +scripts/prefix_testsuite_names.py build/test-results/clang-sve2048/kleidicv-api-test.xml "clang-sve2048." +scripts/prefix_testsuite_names.py build/test-results/clang-sme/kleidicv-api-test.xml "clang-sme." +scripts/prefix_testsuite_names.py build/test-results/gcc-neon/kleidicv-api-test.xml "gcc-neon." # Generate test coverage report LLVM_COV=llvm-cov scripts/generate_coverage_report.py @@ -80,8 +80,8 @@ if [[ $(dpkg --print-architecture) = arm64 ]]; then -DCMAKE_BUILD_TYPE=Debug \ -DKLEIDICV_ENABLE_SME2=OFF \ -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-sanitize-recover=all -Wno-pass-failed" - ninja -C build/sanitize intrinsiccv-api-test - build/sanitize/test/api/intrinsiccv-api-test --gtest_filter="${EXCLUDE_FLOAT_CONVERSION_TESTS}" + ninja -C build/sanitize kleidicv-api-test + build/sanitize/test/api/kleidicv-api-test --gtest_filter="${EXCLUDE_FLOAT_CONVERSION_TESTS}" fi # Build benchmarks, just to prevent bitrot. @@ -95,7 +95,7 @@ cmake -S . -B build/build-benchmark -G Ninja \ -DKLEIDICV_BENCHMARK=ON \ -DKLEIDICV_ENABLE_SVE2=ON \ -DKLEIDICV_ENABLE_SVE2_SELECTIVELY=OFF -ninja -C build/build-benchmark intrinsiccv-benchmark +ninja -C build/build-benchmark kleidicv-benchmark # TODO: Cross-build OpenCV if [[ $(dpkg --print-architecture) = arm64 ]]; then diff --git a/scripts/format.sh b/scripts/format.sh index 3f64aa335..fb76d66ad 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -31,7 +31,7 @@ KLEIDICV_ROOT_PATH="$(realpath "${SCRIPT_PATH}"/..)" SOURCES="$(find \ "${KLEIDICV_ROOT_PATH}/adapters" \ "${KLEIDICV_ROOT_PATH}/benchmark" \ - "${KLEIDICV_ROOT_PATH}/intrinsiccv" \ + "${KLEIDICV_ROOT_PATH}/kleidicv" \ "${KLEIDICV_ROOT_PATH}/test" \ "${KLEIDICV_ROOT_PATH}/conformity/opencv" \ \( -name \*.cpp -o -name \*.h -o -name \*.h.in \) \ diff --git a/scripts/run_opencv_conformity_checks.sh b/scripts/run_opencv_conformity_checks.sh index a1c75793b..f2e7b59e8 100755 --- a/scripts/run_opencv_conformity_checks.sh +++ b/scripts/run_opencv_conformity_checks.sh @@ -16,7 +16,7 @@ SOURCE_PATH="${SCRIPT_PATH}/../conformity/opencv" KLEIDICV_SOURCE_PATH="${SCRIPT_PATH}/.." BUILD_PATH="${SCRIPT_PATH}/../build/conformity" OPENCV_DEFAULT_PATH="${BUILD_PATH}/opencv_default" -OPENCV_KLEIDICV_PATH="${BUILD_PATH}/opencv_intrinsiccv" +OPENCV_KLEIDICV_PATH="${BUILD_PATH}/opencv_kleidicv" if [[ "${CLEAN}" == "ON" ]]; then rm -rf "${BUILD_PATH}" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index eb1c1018e..478ef714e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.16) set(KLEIDICV_INCLUDE_DIR - ${CMAKE_CURRENT_SOURCE_DIR}/../intrinsiccv/include - ${CMAKE_CURRENT_BINARY_DIR}/../intrinsiccv/include + ${CMAKE_CURRENT_SOURCE_DIR}/../kleidicv/include + ${CMAKE_CURRENT_BINARY_DIR}/../kleidicv/include ) set(KLEIDICV_TEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -61,15 +61,15 @@ add_subdirectory(framework) # Target to build all tests. add_custom_target( - intrinsiccv-test - DEPENDS intrinsiccv-framework-test intrinsiccv-api-test + kleidicv-test + DEPENDS kleidicv-framework-test kleidicv-api-test ) # Target to build and run all tests. add_custom_target( - check-intrinsiccv - COMMAND intrinsiccv-framework-test - COMMAND intrinsiccv-api-test - DEPENDS intrinsiccv-test + check-kleidicv + COMMAND kleidicv-framework-test + COMMAND kleidicv-api-test + DEPENDS kleidicv-test USES_TERMINAL ) diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt index 3622d6a5a..f3f35df76 100644 --- a/test/api/CMakeLists.txt +++ b/test/api/CMakeLists.txt @@ -2,42 +2,42 @@ # # SPDX-License-Identifier: Apache-2.0 -file(GLOB intrinsiccv_api_test_sources CONFIGURE_DEPENDS "*.h" "test_*.cpp") +file(GLOB kleidicv_api_test_sources CONFIGURE_DEPENDS "*.h" "test_*.cpp") -list(APPEND intrinsiccv_api_test_sources ${KLEIDICV_TEST_FRAMEWORK_SOURCES}) +list(APPEND kleidicv_api_test_sources ${KLEIDICV_TEST_FRAMEWORK_SOURCES}) set_source_files_properties( - ${intrinsiccv_api_test_sources} + ${kleidicv_api_test_sources} PROPERTIES COMPILE_OPTIONS "${KLEIDICV_TEST_CXX_FLAGS}" ) add_executable( - intrinsiccv-api-test - ${intrinsiccv_api_test_sources} + kleidicv-api-test + ${kleidicv_api_test_sources} ) set_target_properties( - intrinsiccv-api-test + kleidicv-api-test PROPERTIES CXX_STANDARD 17 ) target_include_directories( - intrinsiccv-api-test + kleidicv-api-test PRIVATE ${KLEIDICV_INCLUDE_DIR} PRIVATE ${KLEIDICV_TEST_INCLUDE_DIR} ) if (KLEIDICV_ALLOCATION_TESTS) target_link_options( - intrinsiccv-api-test + kleidicv-api-test PRIVATE -Wl,--wrap,malloc ) endif() target_link_libraries( - intrinsiccv-api-test - intrinsiccv + kleidicv-api-test + kleidicv gtest_main gmock ) diff --git a/test/api/test_add_abs_with_threshold.cpp b/test/api/test_add_abs_with_threshold.cpp index 1ce78fdf5..9aaaa43db 100644 --- a/test/api/test_add_abs_with_threshold.cpp +++ b/test/api/test_add_abs_with_threshold.cpp @@ -5,7 +5,7 @@ #include #include "framework/operation.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" template @@ -13,8 +13,8 @@ class SaturatingAddAbsWithThresholdTestBase : public BinaryOperationTest { protected: // Calls the API-under-test in the appropriate way. - intrinsiccv_error_t call_api() override { - return intrinsiccv_saturating_add_abs_with_threshold_s16( + kleidicv_error_t call_api() override { + return kleidicv_saturating_add_abs_with_threshold_s16( this->inputs_[0].data(), this->inputs_[0].stride(), this->inputs_[1].data(), this->inputs_[1].stride(), this->actual_[0].data(), this->actual_[0].stride(), this->width(), @@ -178,7 +178,7 @@ TYPED_TEST(SaturatingAddAbsWithThresholdTest, TestMax) { TYPED_TEST(SaturatingAddAbsWithThresholdTest, NullPointer) { TypeParam src[1] = {}, dst[1]; - test::test_null_args(intrinsiccv_saturating_add_abs_with_threshold_s16, src, + test::test_null_args(kleidicv_saturating_add_abs_with_threshold_s16, src, sizeof(TypeParam), src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, 1); } @@ -190,25 +190,25 @@ TYPED_TEST(SaturatingAddAbsWithThresholdTest, Misalignment) { } TypeParam src[1] = {}, dst[1] = {}; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, - intrinsiccv_saturating_add_abs_with_threshold_s16( + kleidicv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, 1)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, - intrinsiccv_saturating_add_abs_with_threshold_s16( + kleidicv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, sizeof(TypeParam), 1, 1, 1)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, - intrinsiccv_saturating_add_abs_with_threshold_s16( + kleidicv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, 1)); } TYPED_TEST(SaturatingAddAbsWithThresholdTest, ZeroImageSize) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_saturating_add_abs_with_threshold_s16( + EXPECT_EQ(KLEIDICV_OK, kleidicv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, sizeof(TypeParam), 0, 1, 1)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_saturating_add_abs_with_threshold_s16( + EXPECT_EQ(KLEIDICV_OK, kleidicv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 0, 1)); } @@ -216,11 +216,11 @@ TYPED_TEST(SaturatingAddAbsWithThresholdTest, ZeroImageSize) { TYPED_TEST(SaturatingAddAbsWithThresholdTest, OversizeImage) { TypeParam src[1] = {}, dst[1]; EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_saturating_add_abs_with_threshold_s16( + kleidicv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, 1)); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_saturating_add_abs_with_threshold_s16( + kleidicv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, 1)); diff --git a/test/api/test_canny.cpp b/test/api/test_canny.cpp index 90315fe04..ed69818ae 100644 --- a/test/api/test_canny.cpp +++ b/test/api/test_canny.cpp @@ -5,13 +5,13 @@ #include #include "framework/utils.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" #if KLEIDICV_EXPERIMENTAL_FEATURE_CANNY #define KLEIDICV_CANNY(type, suffix) \ - KLEIDICV_API(canny, intrinsiccv_canny_##suffix, type) + KLEIDICV_API(canny, kleidicv_canny_##suffix, type) KLEIDICV_CANNY(uint8_t, u8); diff --git a/test/api/test_count_nonzeros.cpp b/test/api/test_count_nonzeros.cpp index 6427ea6fb..07ccfde34 100644 --- a/test/api/test_count_nonzeros.cpp +++ b/test/api/test_count_nonzeros.cpp @@ -8,11 +8,11 @@ #include "framework/array.h" #include "framework/utils.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" #define KLEIDICV_COUNT_NONZEROS(type, suffix) \ - KLEIDICV_API(count_nonzeros, intrinsiccv_count_nonzeros_##suffix, type) + KLEIDICV_API(count_nonzeros, kleidicv_count_nonzeros_##suffix, type) KLEIDICV_COUNT_NONZEROS(uint8_t, u8); diff --git a/test/api/test_float_conv.cpp b/test/api/test_float_conv.cpp index bdfe6d5c9..41b60bf49 100644 --- a/test/api/test_float_conv.cpp +++ b/test/api/test_float_conv.cpp @@ -8,14 +8,13 @@ #include "framework/generator.h" #include "framework/operation.h" #include "framework/utils.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" -#define KLEIDICV_float_conversion(I, input_type_name, O, output_type_name) \ - KLEIDICV_DIFF_IO_API( \ - float_conversion, \ - intrinsiccv_float_conversion_##input_type_name##_##output_type_name, I, \ - O) +#define KLEIDICV_float_conversion(I, input_type_name, O, output_type_name) \ + KLEIDICV_DIFF_IO_API( \ + float_conversion, \ + kleidicv_float_conversion_##input_type_name##_##output_type_name, I, O) KLEIDICV_float_conversion(float, f32, int8_t, s8); KLEIDICV_float_conversion(float, f32, uint8_t, u8); @@ -368,7 +367,7 @@ using ElementTypes = ::testing::Types, std::pair, std::pair, std::pair>; -// Tests intrinsiccv_float_conversion API. +// Tests kleidicv_float_conversion API. TYPED_TEST_SUITE(FloatConversion, ElementTypes); TYPED_TEST(FloatConversion, NullPointer) { diff --git a/test/api/test_gaussian_blur.cpp b/test/api/test_gaussian_blur.cpp index 521156440..12ab7c7ab 100644 --- a/test/api/test_gaussian_blur.cpp +++ b/test/api/test_gaussian_blur.cpp @@ -8,13 +8,12 @@ #include "framework/generator.h" #include "framework/kernel.h" #include "framework/utils.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" -#define KLEIDICV_GAUSSIAN_BLUR(type, kernel_suffix, type_suffix) \ - KLEIDICV_API(gaussian_blur_##kernel_suffix, \ - intrinsiccv_gaussian_blur_##kernel_suffix##_##type_suffix, \ - type) +#define KLEIDICV_GAUSSIAN_BLUR(type, kernel_suffix, type_suffix) \ + KLEIDICV_API(gaussian_blur_##kernel_suffix, \ + kleidicv_gaussian_blur_##kernel_suffix##_##type_suffix, type) KLEIDICV_GAUSSIAN_BLUR(uint8_t, 3x3, u8); KLEIDICV_GAUSSIAN_BLUR(uint8_t, 5x5, u8); @@ -32,13 +31,13 @@ struct GaussianBlurKernelTestParams { static constexpr size_t kKernelSize = KernelSize; }; // end of struct GaussianBlurKernelTestParams -static constexpr std::array kDefaultBorder = { +static constexpr std::array kDefaultBorder = { KLEIDICV_BORDER_TYPE_REPLICATE}; -static constexpr std::array kReflectBorder = { +static constexpr std::array kReflectBorder = { KLEIDICV_BORDER_TYPE_REFLECT}; -static constexpr std::array kAllBorders = { +static constexpr std::array kAllBorders = { KLEIDICV_BORDER_TYPE_REPLICATE, KLEIDICV_BORDER_TYPE_REFLECT, KLEIDICV_BORDER_TYPE_WRAP, @@ -77,7 +76,7 @@ class GaussianBlurTest : public test::KernelTest { } GaussianBlurTest &with_border_types( - std::unique_ptr> g) { + std::unique_ptr> g) { border_type_generator_ = std::move(g); return *this; } @@ -96,22 +95,22 @@ class GaussianBlurTest : public test::KernelTest { protected: std::array small_array_layouts_; std::unique_ptr> array_layout_generator_; - std::unique_ptr> + std::unique_ptr> border_type_generator_; - intrinsiccv_error_t call_api(const test::Array2D *input, - test::Array2D *output, - intrinsiccv_border_type_t border_type, - intrinsiccv_border_values_t) override { + kleidicv_error_t call_api(const test::Array2D *input, + test::Array2D *output, + kleidicv_border_type_t border_type, + kleidicv_border_values_t) override { auto api = KernelTestParams::kKernelSize == 3 ? gaussian_blur_3x3() : gaussian_blur_5x5(); - intrinsiccv_filter_context_t *context = nullptr; - auto ret = intrinsiccv_filter_create( + kleidicv_filter_context_t *context = nullptr; + auto ret = kleidicv_filter_create( &context, input->channels(), sizeof(IntermediateType), - intrinsiccv_rectangle_t{input->width() / input->channels(), - input->height()}); + kleidicv_rectangle_t{input->width() / input->channels(), + input->height()}); if (ret != KLEIDICV_OK) { return ret; } @@ -119,7 +118,7 @@ class GaussianBlurTest : public test::KernelTest { ret = api(input->data(), input->stride(), output->data(), output->stride(), input->width() / input->channels(), input->height(), input->channels(), border_type, context); - auto releaseRet = intrinsiccv_filter_release(context); + auto releaseRet = kleidicv_filter_release(context); if (releaseRet != KLEIDICV_OK) { return releaseRet; } @@ -193,13 +192,13 @@ TYPED_TEST(GaussianBlur, 5x5) { TYPED_TEST(GaussianBlur, UnsupportedBorderType3x3) { using KernelTestParams = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams::kKernelSize - 1; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{validSize, validSize})); TypeParam src[1] = {}, dst[1]; - for (intrinsiccv_border_type_t border : { + for (kleidicv_border_type_t border : { KLEIDICV_BORDER_TYPE_CONSTANT, KLEIDICV_BORDER_TYPE_TRANSPARENT, KLEIDICV_BORDER_TYPE_NONE, @@ -209,18 +208,18 @@ TYPED_TEST(GaussianBlur, UnsupportedBorderType3x3) { sizeof(TypeParam), validSize, validSize, 1, border, context)); } - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, UnsupportedBorderType5x5) { using KernelTestParams = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams::kKernelSize - 1; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{validSize, validSize})); TypeParam src[1] = {}, dst[1]; - for (intrinsiccv_border_type_t border : { + for (kleidicv_border_type_t border : { KLEIDICV_BORDER_TYPE_CONSTANT, KLEIDICV_BORDER_TYPE_TRANSPARENT, KLEIDICV_BORDER_TYPE_NONE, @@ -230,17 +229,17 @@ TYPED_TEST(GaussianBlur, UnsupportedBorderType5x5) { sizeof(TypeParam), validSize, validSize, 1, border, context)); } - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, NullPointer) { using KernelTestParams3x3 = GaussianBlurKernelTestParams; using KernelTestParams5x5 = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{validSize, validSize})); TypeParam src[1] = {}, dst[1]; test::test_null_args(gaussian_blur_3x3(), src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, validSize, 1, @@ -249,7 +248,7 @@ TYPED_TEST(GaussianBlur, NullPointer) { test::test_null_args(gaussian_blur_5x5(), src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, validSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, Misalignment) { @@ -259,11 +258,11 @@ TYPED_TEST(GaussianBlur, Misalignment) { } using KernelTestParams3x3 = GaussianBlurKernelTestParams; using KernelTestParams5x5 = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{validSize, validSize})); TypeParam src[1] = {}, dst[1]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, gaussian_blur_3x3()( @@ -282,60 +281,60 @@ TYPED_TEST(GaussianBlur, Misalignment) { gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, validSize, validSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, ZeroImageSize3x3) { TypeParam src[1] = {}, dst[1]; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, - intrinsiccv_filter_create(&context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{0, 1})); + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{0, 1})); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), 0, 1, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); ASSERT_EQ(KLEIDICV_OK, - intrinsiccv_filter_create(&context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{1, 0})); + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{1, 0})); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 0, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, ZeroImageSize5x5) { TypeParam src[1] = {}, dst[1]; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, - intrinsiccv_filter_create(&context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{0, 1})); + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{0, 1})); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), 0, 1, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); ASSERT_EQ(KLEIDICV_OK, - intrinsiccv_filter_create(&context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{1, 0})); + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{1, 0})); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 0, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, ValidImageSize3x3) { using KernelTestParams = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams::kKernelSize - 1; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{validSize, validSize})); test::Array2D src{validSize, validSize, test::Options::vector_length()}; src.set(0, 0, {1, 2}); @@ -347,16 +346,16 @@ TYPED_TEST(GaussianBlur, ValidImageSize3x3) { gaussian_blur_3x3()( src.data(), src.stride(), dst.data(), dst.stride(), validSize, validSize, 1, KLEIDICV_BORDER_TYPE_REVERSE, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, ValidImageSize5x5) { using KernelTestParams = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams::kKernelSize - 1; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{validSize, validSize})); test::Array2D src{validSize, validSize, test::Options::vector_length()}; src.set(0, 0, {1, 2, 3, 4}); @@ -370,81 +369,81 @@ TYPED_TEST(GaussianBlur, ValidImageSize5x5) { gaussian_blur_5x5()( src.data(), src.stride(), dst.data(), dst.stride(), validSize, validSize, 1, KLEIDICV_BORDER_TYPE_REVERSE, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, UndersizeImage3x3) { using KernelTestParams = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t underSize = KernelTestParams::kKernelSize - 2; size_t validWidth = KernelTestParams::kKernelSize + 10; size_t validHeight = KernelTestParams::kKernelSize + 5; TypeParam src[1], dst[1]; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{underSize, underSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{underSize, underSize})); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), underSize, underSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); + ASSERT_EQ(KLEIDICV_OK, kleidicv_filter_create( &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{underSize, validHeight})); + kleidicv_rectangle_t{underSize, validHeight})); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), underSize, validHeight, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); + ASSERT_EQ(KLEIDICV_OK, kleidicv_filter_create( &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validWidth, underSize})); + kleidicv_rectangle_t{validWidth, underSize})); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_3x3()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validWidth, underSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, UndersizeImage5x5) { using KernelTestParams = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t underSize = KernelTestParams::kKernelSize - 2; size_t width = KernelTestParams::kKernelSize + 8; size_t height = KernelTestParams::kKernelSize + 3; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{underSize, underSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{underSize, underSize})); TypeParam src[1] = {}, dst[1]; EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), underSize, underSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{underSize, height})); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{underSize, height})); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), underSize, height, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{width, underSize})); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{width, underSize})); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), width, underSize, 1, KLEIDICV_BORDER_TYPE_REPLICATE, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, OversizeImage) { - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, - intrinsiccv_filter_create(&context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{1, 1})); + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{1, 1})); TypeParam src[1], dst[1]; EXPECT_EQ(KLEIDICV_ERROR_RANGE, gaussian_blur_3x3()( @@ -466,18 +465,18 @@ TYPED_TEST(GaussianBlur, OversizeImage) { src, sizeof(TypeParam), dst, sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, ChannelNumber) { using KernelTestParams3x3 = GaussianBlurKernelTestParams; using KernelTestParams5x5 = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{validSize, validSize})); TypeParam src[1], dst[1]; EXPECT_EQ(KLEIDICV_ERROR_RANGE, gaussian_blur_3x3()( @@ -491,18 +490,18 @@ TYPED_TEST(GaussianBlur, ChannelNumber) { src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, validSize, KLEIDICV_MAXIMUM_CHANNEL_COUNT + 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, InvalidContextSizeType) { using KernelTestParams3x3 = GaussianBlurKernelTestParams; using KernelTestParams5x5 = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam) + 1, - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam) + 1, + kleidicv_rectangle_t{validSize, validSize})); TypeParam src[1], dst[1]; EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, gaussian_blur_3x3()( @@ -513,18 +512,18 @@ TYPED_TEST(GaussianBlur, InvalidContextSizeType) { gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, validSize, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, InvalidContextChannelNumber) { using KernelTestParams3x3 = GaussianBlurKernelTestParams; using KernelTestParams5x5 = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 2, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 2, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{validSize, validSize})); TypeParam src[1], dst[1]; EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, gaussian_blur_3x3()( @@ -536,18 +535,18 @@ TYPED_TEST(GaussianBlur, InvalidContextChannelNumber) { gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize, validSize, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } TYPED_TEST(GaussianBlur, InvalidContextImageSize) { using KernelTestParams3x3 = GaussianBlurKernelTestParams; using KernelTestParams5x5 = GaussianBlurKernelTestParams; - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; size_t validSize = KernelTestParams3x3::kKernelSize - 1; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_filter_create( - &context, 1, 2 * sizeof(TypeParam), - intrinsiccv_rectangle_t{validSize, validSize})); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_filter_create(&context, 1, 2 * sizeof(TypeParam), + kleidicv_rectangle_t{validSize, validSize})); TypeParam src[1], dst[1]; EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, gaussian_blur_3x3()( @@ -559,59 +558,56 @@ TYPED_TEST(GaussianBlur, InvalidContextImageSize) { gaussian_blur_5x5()( src, sizeof(TypeParam), dst, sizeof(TypeParam), validSize + 1, validSize + 1, 1, KLEIDICV_BORDER_TYPE_REFLECT, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_filter_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_filter_release(context)); } #ifdef KLEIDICV_ALLOCATION_TESTS TEST(FilterCreate, CannotAllocateFilter) { MockMallocToFail::enable(); - intrinsiccv_filter_context_t *context = nullptr; - intrinsiccv_rectangle_t rect{KLEIDICV_MAX_IMAGE_PIXELS, 1}; + kleidicv_filter_context_t *context = nullptr; + kleidicv_rectangle_t rect{KLEIDICV_MAX_IMAGE_PIXELS, 1}; EXPECT_EQ(KLEIDICV_ERROR_ALLOCATION, - intrinsiccv_filter_create(&context, 1, 1, rect)); + kleidicv_filter_create(&context, 1, 1, rect)); MockMallocToFail::disable(); } #endif TEST(FilterCreate, OversizeImage) { - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; - for (intrinsiccv_rectangle_t rect : { - intrinsiccv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS + 1, 1}, - intrinsiccv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS, - KLEIDICV_MAX_IMAGE_PIXELS}, + for (kleidicv_rectangle_t rect : { + kleidicv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS + 1, 1}, + kleidicv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS}, }) { EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_filter_create(&context, 1, 1, rect)); + kleidicv_filter_create(&context, 1, 1, rect)); ASSERT_EQ(nullptr, context); } } TEST(FilterCreate, TypeSize) { - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; - EXPECT_EQ( - KLEIDICV_ERROR_RANGE, - intrinsiccv_filter_create(&context, 1, KLEIDICV_MAXIMUM_TYPE_SIZE + 1, - intrinsiccv_rectangle_t{1, 1})); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, + kleidicv_filter_create(&context, 1, KLEIDICV_MAXIMUM_TYPE_SIZE + 1, + kleidicv_rectangle_t{1, 1})); ASSERT_EQ(nullptr, context); } TEST(FilterCreate, ChannelNumber) { - intrinsiccv_filter_context_t *context = nullptr; + kleidicv_filter_context_t *context = nullptr; - EXPECT_EQ( - KLEIDICV_ERROR_RANGE, - intrinsiccv_filter_create(&context, KLEIDICV_MAXIMUM_CHANNEL_COUNT + 1, 1, - intrinsiccv_rectangle_t{1, 1})); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, + kleidicv_filter_create(&context, KLEIDICV_MAXIMUM_CHANNEL_COUNT + 1, + 1, kleidicv_rectangle_t{1, 1})); ASSERT_EQ(nullptr, context); } TEST(FilterCreate, NullPointer) { - EXPECT_EQ( - KLEIDICV_ERROR_NULL_POINTER, - intrinsiccv_filter_create(nullptr, 1, 1, intrinsiccv_rectangle_t{1, 1})); + EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, + kleidicv_filter_create(nullptr, 1, 1, kleidicv_rectangle_t{1, 1})); } TEST(FilterRelease, NullPointer) { - EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, intrinsiccv_filter_release(nullptr)); + EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, kleidicv_filter_release(nullptr)); } diff --git a/test/api/test_merge.cpp b/test/api/test_merge.cpp index 992930356..48d83d0cb 100644 --- a/test/api/test_merge.cpp +++ b/test/api/test_merge.cpp @@ -6,7 +6,7 @@ #include "framework/array.h" #include "framework/utils.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" template @@ -87,11 +87,10 @@ class MergeTest final { for (size_t i = 0; i < Channels; ++i) { strides[i] = inputs[i].stride(); } - ASSERT_EQ( - KLEIDICV_OK, - intrinsiccv_merge(input_raw_pointers, strides, actual_output.data(), - actual_output.stride(), input_width, height, Channels, - sizeof(ElementType))); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_merge(input_raw_pointers, strides, actual_output.data(), + actual_output.stride(), input_width, height, + Channels, sizeof(ElementType))); // Compare the results for (size_t i = 0; i < Channels; ++i) { @@ -110,7 +109,7 @@ class MergeTest final { template static void test_not_implemented( - intrinsiccv_error_t expected = KLEIDICV_ERROR_NOT_IMPLEMENTED) { + kleidicv_error_t expected = KLEIDICV_ERROR_NOT_IMPLEMENTED) { const size_t width = 1, height = 1; ElementType src_arrays[kChannels][width * height] = {{234}}; ElementType dst[kChannels * width * height] = {123}; @@ -122,9 +121,8 @@ static void test_not_implemented( } size_t dst_stride = kChannels * width * sizeof(ElementType); - ASSERT_EQ(expected, - intrinsiccv_merge(srcs, src_strides, dst, dst_stride, width, height, - kChannels, sizeof(ElementType))); + ASSERT_EQ(expected, kleidicv_merge(srcs, src_strides, dst, dst_stride, width, + height, kChannels, sizeof(ElementType))); // Destination should not be modified. EXPECT_EQ(123, dst[0]); @@ -229,8 +227,8 @@ TYPED_TEST(Merge, NullPointer) { const void* srcs[kChannels] = {src_arrays, src_arrays + 1, src_arrays + 2, src_arrays + 3}; size_t dst_stride = kChannels * sizeof(TypeParam); - test::test_null_args(intrinsiccv_merge, srcs, src_strides, dst, dst_stride, 1, - 1, kChannels, sizeof(TypeParam)); + test::test_null_args(kleidicv_merge, srcs, src_strides, dst, dst_stride, 1, 1, + kChannels, sizeof(TypeParam)); for (int channels = 2; channels <= 4; ++channels) { for (int null_src = 0; null_src < channels; ++null_src) { @@ -238,8 +236,8 @@ TYPED_TEST(Merge, NullPointer) { srcs[i] = (i == null_src) ? nullptr : src_arrays + i; } EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, - intrinsiccv_merge(srcs, src_strides, dst, dst_stride, 1, 1, - channels, sizeof(TypeParam))); + kleidicv_merge(srcs, src_strides, dst, dst_stride, 1, 1, + channels, sizeof(TypeParam))); } } } @@ -269,11 +267,10 @@ TYPED_TEST(Merge, Misalignment) { auto check_merge = [&](int channels, void* dst_maybe_misaligned, size_t dst_stride_maybe_misaligned) { - EXPECT_EQ( - KLEIDICV_ERROR_ALIGNMENT, - intrinsiccv_merge(reinterpret_cast(srcs), src_strides, - dst_maybe_misaligned, dst_stride_maybe_misaligned, 1, - 1, channels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, + kleidicv_merge(reinterpret_cast(srcs), src_strides, + dst_maybe_misaligned, dst_stride_maybe_misaligned, + 1, 1, channels, sizeof(TypeParam))); }; for (size_t channels = 2; channels <= kChannels; ++channels) { @@ -307,10 +304,10 @@ TYPED_TEST(Merge, ZeroImageSize) { size_t src_strides[kChannels] = {sizeof(TypeParam), sizeof(TypeParam)}; const size_t dst_stride = kChannels * sizeof(TypeParam); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_merge(srcs, src_strides, dst, dst_stride, - 0, 1, kChannels, sizeof(TypeParam))); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_merge(srcs, src_strides, dst, dst_stride, - 1, 0, kChannels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_OK, kleidicv_merge(srcs, src_strides, dst, dst_stride, 0, + 1, kChannels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_OK, kleidicv_merge(srcs, src_strides, dst, dst_stride, 1, + 0, kChannels, sizeof(TypeParam))); } TYPED_TEST(Merge, OversizeImage) { @@ -321,11 +318,11 @@ TYPED_TEST(Merge, OversizeImage) { const size_t dst_stride = kChannels * sizeof(TypeParam); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_merge(srcs, src_strides, dst, dst_stride, - KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, kChannels, - sizeof(TypeParam))); + kleidicv_merge(srcs, src_strides, dst, dst_stride, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, kChannels, + sizeof(TypeParam))); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_merge( - srcs, src_strides, dst, dst_stride, KLEIDICV_MAX_IMAGE_PIXELS, - KLEIDICV_MAX_IMAGE_PIXELS, kChannels, sizeof(TypeParam))); + kleidicv_merge(srcs, src_strides, dst, dst_stride, + KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, + kChannels, sizeof(TypeParam))); } diff --git a/test/api/test_min_max.cpp b/test/api/test_min_max.cpp index e7c057ac6..b5a0ed43c 100644 --- a/test/api/test_min_max.cpp +++ b/test/api/test_min_max.cpp @@ -6,11 +6,11 @@ #include "framework/array.h" #include "framework/utils.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" #define KLEIDICV_MIN_MAX(type, suffix) \ - KLEIDICV_API(min_max, intrinsiccv_min_max_##suffix, type) + KLEIDICV_API(min_max, kleidicv_min_max_##suffix, type) KLEIDICV_MIN_MAX(int8_t, s8); KLEIDICV_MIN_MAX(uint8_t, u8); @@ -19,7 +19,7 @@ KLEIDICV_MIN_MAX(uint16_t, u16); KLEIDICV_MIN_MAX(int32_t, s32); #define KLEIDICV_MIN_MAX_LOC(type, suffix) \ - KLEIDICV_API(min_max_loc, intrinsiccv_min_max_loc_##suffix, type) + KLEIDICV_API(min_max_loc, kleidicv_min_max_loc_##suffix, type) KLEIDICV_MIN_MAX_LOC(uint8_t, u8); diff --git a/test/api/test_morphology.cpp b/test/api/test_morphology.cpp index cf3a6e0c2..46a6b8b3e 100644 --- a/test/api/test_morphology.cpp +++ b/test/api/test_morphology.cpp @@ -11,7 +11,7 @@ #include "framework/generator.h" #include "framework/kernel.h" #include "framework/operation.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" #define KLEIDICV_PARAMS(name, impl, type, op) \ @@ -25,8 +25,8 @@ } \ }; -KLEIDICV_PARAMS(DilateParams, intrinsiccv_dilate_u8, uint8_t, std::max); -KLEIDICV_PARAMS(ErodeParams, intrinsiccv_erode_u8, uint8_t, std::min); +KLEIDICV_PARAMS(DilateParams, kleidicv_dilate_u8, uint8_t, std::max); +KLEIDICV_PARAMS(ErodeParams, kleidicv_erode_u8, uint8_t, std::min); template struct MorphologyKernelTestParams { @@ -35,21 +35,21 @@ struct MorphologyKernelTestParams { using OutputType = ElementType; }; // end of struct MorphologyKernelTestParams -static constexpr std::array kDefaultBorder = { +static constexpr std::array kDefaultBorder = { KLEIDICV_BORDER_TYPE_REPLICATE}; -static constexpr std::array kConstantBorder = { +static constexpr std::array kConstantBorder = { KLEIDICV_BORDER_TYPE_CONSTANT}; -static constexpr std::array - kDefaultBorderValues = {{ +static constexpr std::array kDefaultBorderValues = + {{ {0, 0, 0, 0}, // default }}; template -static const std::array &more_border_values() { +static const std::array &more_border_values() { using limit = std::numeric_limits; - static const std::array values = { + static const std::array values = { {{0, 0, 0, 0}, // default {7, 42, 99, 9}, {limit::min(), limit::max(), limit::min(), limit::max()}, @@ -104,13 +104,13 @@ class MorphologyTest } MorphologyTest &with_border_types( - std::unique_ptr> g) { + std::unique_ptr> g) { border_type_generator_ = std::move(g); return *this; } MorphologyTest &with_border_values( - std::unique_ptr> g) { + std::unique_ptr> g) { border_values_generator_ = std::move(g); return *this; } @@ -127,23 +127,23 @@ class MorphologyTest size_t iterations_; std::array small_array_layouts_; std::unique_ptr> array_layout_generator_; - std::unique_ptr> + std::unique_ptr> border_type_generator_; - std::unique_ptr> + std::unique_ptr> border_values_generator_; - intrinsiccv_error_t call_api( - const test::Array2D *input, test::Array2D *output, - intrinsiccv_border_type_t border_type, - intrinsiccv_border_values_t border_values) override { - intrinsiccv_morphology_context_t *context = nullptr; - auto kernelRect = intrinsiccv_rectangle_t{kernelWidth, kernelHeight}; - intrinsiccv_point_t anchor{kernel_.anchor().x, kernel_.anchor().y}; - auto ret = intrinsiccv_morphology_create( + kleidicv_error_t call_api(const test::Array2D *input, + test::Array2D *output, + kleidicv_border_type_t border_type, + kleidicv_border_values_t border_values) override { + kleidicv_morphology_context_t *context = nullptr; + auto kernelRect = kleidicv_rectangle_t{kernelWidth, kernelHeight}; + kleidicv_point_t anchor{kernel_.anchor().x, kernel_.anchor().y}; + auto ret = kleidicv_morphology_create( &context, kernelRect, anchor, border_type, border_values, input->channels(), iterations_, sizeof(InputType), - intrinsiccv_rectangle_t{input->width() / input->channels(), - input->height()}); + kleidicv_rectangle_t{input->width() / input->channels(), + input->height()}); if (ret != KLEIDICV_OK) { return ret; } @@ -151,7 +151,7 @@ class MorphologyTest ret = OperationParams::api()( input->data(), input->stride(), output->data(), output->stride(), input->width() / input->channels(), input->height(), context); - auto releaseRet = intrinsiccv_morphology_release(context); + auto releaseRet = kleidicv_morphology_release(context); if (releaseRet != KLEIDICV_OK) { return releaseRet; } @@ -161,8 +161,8 @@ class MorphologyTest void prepare_expected(const test::Kernel &kernel, const test::ArrayLayout &array_layout, - intrinsiccv_border_type_t border_type, - intrinsiccv_border_values_t border_values) override { + kleidicv_border_type_t border_type, + kleidicv_border_values_t border_values) override { Base::prepare_expected(kernel, array_layout, border_type, border_values); if (iterations_ > 1) { test::Array2D saved_input = this->input_; @@ -308,37 +308,37 @@ TYPED_TEST(Morphology, Anchors) { MorphologyTest{}.with_anchor({2, 4}).test(); } -static intrinsiccv_error_t make_minimal_context( - intrinsiccv_morphology_context_t **context, size_t type_size, - intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE) { - return intrinsiccv_morphology_create( - context, intrinsiccv_rectangle_t{1, 1}, intrinsiccv_point_t{0, 0}, border, - intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, type_size, - intrinsiccv_rectangle_t{1, 1}); +static kleidicv_error_t make_minimal_context( + kleidicv_morphology_context_t **context, size_t type_size, + kleidicv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE) { + return kleidicv_morphology_create(context, kleidicv_rectangle_t{1, 1}, + kleidicv_point_t{0, 0}, border, + kleidicv_border_values_t{0, 0, 1, 1}, 1, 1, + type_size, kleidicv_rectangle_t{1, 1}); } template -static void test_valid_image_size(intrinsiccv_rectangle_t kernel, +static void test_valid_image_size(kleidicv_rectangle_t kernel, test::Array2D src) { size_t validSize = kernel.width - 1; - intrinsiccv_rectangle_t image{validSize, validSize}; - intrinsiccv_border_values_t border_values{0, 0, 1, 1}; + kleidicv_rectangle_t image{validSize, validSize}; + kleidicv_border_values_t border_values{0, 0, 1, 1}; test::Array2D dst{validSize, validSize, test::Options::vector_length()}; for (size_t x = 0; x < kernel.width; x += kernel.width - 1) { for (size_t y = 0; y < kernel.width; y += kernel.width - 1) { - intrinsiccv_point_t anchor{x, y}; - for (intrinsiccv_border_type_t border : { + kleidicv_point_t anchor{x, y}; + for (kleidicv_border_type_t border : { KLEIDICV_BORDER_TYPE_REPLICATE, KLEIDICV_BORDER_TYPE_CONSTANT, }) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, - intrinsiccv_morphology_create(&context, kernel, anchor, - border, border_values, 1, 1, - sizeof(ElementType), image)); + kleidicv_morphology_create(&context, kernel, anchor, border, + border_values, 1, 1, + sizeof(ElementType), image)); EXPECT_EQ(KLEIDICV_OK, ErodeParams::api()( src.data(), src.stride(), dst.data(), dst.stride(), @@ -347,26 +347,26 @@ static void test_valid_image_size(intrinsiccv_rectangle_t kernel, DilateParams::api()( src.data(), src.stride(), dst.data(), dst.stride(), validSize, validSize, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } } } } template -static void test_undersize_image(intrinsiccv_rectangle_t kernel) { +static void test_undersize_image(kleidicv_rectangle_t kernel) { size_t underSize = kernel.width - 2; size_t validWidth = kernel.width + 10; size_t validHeight = kernel.height + 5; - intrinsiccv_morphology_context_t *context = nullptr; - intrinsiccv_rectangle_t image{underSize, underSize}; - intrinsiccv_rectangle_t imageW{underSize, validHeight}; - intrinsiccv_rectangle_t imageH{validWidth, underSize}; - intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; - intrinsiccv_border_values_t border_values{0, 0, 1, 1}; - intrinsiccv_point_t anchor{1, 1}; + kleidicv_morphology_context_t *context = nullptr; + kleidicv_rectangle_t image{underSize, underSize}; + kleidicv_rectangle_t imageW{underSize, validHeight}; + kleidicv_rectangle_t imageH{validWidth, underSize}; + kleidicv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; + kleidicv_border_values_t border_values{0, 0, 1, 1}; + kleidicv_point_t anchor{1, 1}; ElementType src[1], dst[1]; - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( + ASSERT_EQ(KLEIDICV_OK, kleidicv_morphology_create( &context, kernel, anchor, border, border_values, 1, 1, sizeof(ElementType), image)); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, @@ -377,8 +377,8 @@ static void test_undersize_image(intrinsiccv_rectangle_t kernel) { DilateParams::api()(src, sizeof(ElementType), dst, sizeof(ElementType), underSize, underSize, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); + ASSERT_EQ(KLEIDICV_OK, kleidicv_morphology_create( &context, kernel, anchor, border, border_values, 1, 1, sizeof(ElementType), imageW)); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, @@ -389,8 +389,8 @@ static void test_undersize_image(intrinsiccv_rectangle_t kernel) { DilateParams::api()(src, sizeof(ElementType), dst, sizeof(ElementType), underSize, validHeight, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); + ASSERT_EQ(KLEIDICV_OK, kleidicv_morphology_create( &context, kernel, anchor, border, border_values, 1, 1, sizeof(ElementType), imageH)); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, @@ -401,18 +401,18 @@ static void test_undersize_image(intrinsiccv_rectangle_t kernel) { DilateParams::api()(src, sizeof(ElementType), dst, sizeof(ElementType), validWidth, underSize, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, UnsupportedBorderType) { - for (intrinsiccv_border_type_t border : { + for (kleidicv_border_type_t border : { KLEIDICV_BORDER_TYPE_REFLECT, KLEIDICV_BORDER_TYPE_WRAP, KLEIDICV_BORDER_TYPE_REVERSE, KLEIDICV_BORDER_TYPE_TRANSPARENT, KLEIDICV_BORDER_TYPE_NONE, }) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, make_minimal_context(&context, sizeof(TypeParam), border)); ASSERT_EQ(nullptr, context); @@ -420,27 +420,27 @@ TYPED_TEST(Morphology, UnsupportedBorderType) { } TYPED_TEST(Morphology, UnsupportedSize) { - intrinsiccv_morphology_context_t *context = nullptr; - intrinsiccv_rectangle_t small_rect{1, 1}; - intrinsiccv_point_t anchor{0, 0}; - intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; - intrinsiccv_border_values_t border_values{0, 0, 1, 1}; - - for (intrinsiccv_rectangle_t bad_rect : { - intrinsiccv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS + 1, 1}, - intrinsiccv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS, - KLEIDICV_MAX_IMAGE_PIXELS}, + kleidicv_morphology_context_t *context = nullptr; + kleidicv_rectangle_t small_rect{1, 1}; + kleidicv_point_t anchor{0, 0}; + kleidicv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; + kleidicv_border_values_t border_values{0, 0, 1, 1}; + + for (kleidicv_rectangle_t bad_rect : { + kleidicv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS + 1, 1}, + kleidicv_rectangle_t{KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS}, }) { EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_morphology_create(&context, bad_rect, anchor, border, - border_values, 1, 1, - sizeof(TypeParam), small_rect)); + kleidicv_morphology_create(&context, bad_rect, anchor, border, + border_values, 1, 1, sizeof(TypeParam), + small_rect)); ASSERT_EQ(nullptr, context); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_morphology_create(&context, small_rect, anchor, - border, border_values, 1, 1, - sizeof(TypeParam), bad_rect)); + kleidicv_morphology_create(&context, small_rect, anchor, border, + border_values, 1, 1, sizeof(TypeParam), + bad_rect)); ASSERT_EQ(nullptr, context); } } @@ -448,92 +448,92 @@ TYPED_TEST(Morphology, UnsupportedSize) { #ifdef KLEIDICV_ALLOCATION_TESTS TYPED_TEST(Morphology, CannotAllocateImage) { MockMallocToFail::enable(); - intrinsiccv_morphology_context_t *context = nullptr; - intrinsiccv_rectangle_t kernel{3, 3}, image{3072, 2048}; - intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; - intrinsiccv_border_values_t border_values{0, 0, 1, 1}; - intrinsiccv_point_t anchor{1, 1}; + kleidicv_morphology_context_t *context = nullptr; + kleidicv_rectangle_t kernel{3, 3}, image{3072, 2048}; + kleidicv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; + kleidicv_border_values_t border_values{0, 0, 1, 1}; + kleidicv_point_t anchor{1, 1}; EXPECT_EQ(KLEIDICV_ERROR_ALLOCATION, - intrinsiccv_morphology_create(&context, kernel, anchor, border, - border_values, 1, 1, - sizeof(TypeParam), image)); + kleidicv_morphology_create(&context, kernel, anchor, border, + border_values, 1, 1, sizeof(TypeParam), + image)); MockMallocToFail::disable(); } #endif TYPED_TEST(Morphology, OversizeImage) { - intrinsiccv_morphology_context_t *context = nullptr; - intrinsiccv_rectangle_t kernel{3, 1UL << 33}, image{1UL << 33, 100}; - intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; - intrinsiccv_border_values_t border_values{0, 0, 1, 1}; - intrinsiccv_point_t anchor{1, 1}; + kleidicv_morphology_context_t *context = nullptr; + kleidicv_rectangle_t kernel{3, 1UL << 33}, image{1UL << 33, 100}; + kleidicv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; + kleidicv_border_values_t border_values{0, 0, 1, 1}; + kleidicv_point_t anchor{1, 1}; EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_morphology_create(&context, kernel, anchor, border, - border_values, 1, 1, - sizeof(TypeParam), image)); + kleidicv_morphology_create(&context, kernel, anchor, border, + border_values, 1, 1, sizeof(TypeParam), + image)); } TYPED_TEST(Morphology, InvalidAnchors) { - intrinsiccv_morphology_context_t *context = nullptr; - intrinsiccv_rectangle_t kernel1{1, 1}, kernel2{6, 4}, image{20, 20}; - intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; - intrinsiccv_border_values_t border_values{0, 0, 1, 1}; - intrinsiccv_point_t anchor1{1, 0}, anchor2{6, 3}, anchor3{5, 4}; + kleidicv_morphology_context_t *context = nullptr; + kleidicv_rectangle_t kernel1{1, 1}, kernel2{6, 4}, image{20, 20}; + kleidicv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; + kleidicv_border_values_t border_values{0, 0, 1, 1}; + kleidicv_point_t anchor1{1, 0}, anchor2{6, 3}, anchor3{5, 4}; EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_morphology_create(&context, kernel1, anchor1, border, - border_values, 1, 1, - sizeof(TypeParam), image)); + kleidicv_morphology_create(&context, kernel1, anchor1, border, + border_values, 1, 1, sizeof(TypeParam), + image)); ASSERT_EQ(nullptr, context); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_morphology_create(&context, kernel2, anchor2, border, - border_values, 1, 1, - sizeof(TypeParam), image)); + kleidicv_morphology_create(&context, kernel2, anchor2, border, + border_values, 1, 1, sizeof(TypeParam), + image)); ASSERT_EQ(nullptr, context); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_morphology_create(&context, kernel2, anchor3, border, - border_values, 1, 1, - sizeof(TypeParam), image)); + kleidicv_morphology_create(&context, kernel2, anchor3, border, + border_values, 1, 1, sizeof(TypeParam), + image)); ASSERT_EQ(nullptr, context); } TYPED_TEST(Morphology, InvalidTypeSize) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; - EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_morphology_create( - &context, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, - intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, - KLEIDICV_MAXIMUM_TYPE_SIZE + 1, intrinsiccv_rectangle_t{1, 1})); + EXPECT_EQ( + KLEIDICV_ERROR_RANGE, + kleidicv_morphology_create( + &context, kleidicv_rectangle_t{1, 1}, kleidicv_point_t{0, 0}, + KLEIDICV_BORDER_TYPE_REPLICATE, kleidicv_border_values_t{0, 0, 1, 1}, + 1, 1, KLEIDICV_MAXIMUM_TYPE_SIZE + 1, kleidicv_rectangle_t{1, 1})); ASSERT_EQ(nullptr, context); } TYPED_TEST(Morphology, InvalidChannelNumber) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_morphology_create( - &context, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, - intrinsiccv_border_values_t{0, 0, 1, 1}, - KLEIDICV_MAXIMUM_CHANNEL_COUNT + 1, 1, 1, - intrinsiccv_rectangle_t{1, 1})); + kleidicv_morphology_create(&context, kleidicv_rectangle_t{1, 1}, + kleidicv_point_t{0, 0}, + KLEIDICV_BORDER_TYPE_REPLICATE, + kleidicv_border_values_t{0, 0, 1, 1}, + KLEIDICV_MAXIMUM_CHANNEL_COUNT + 1, 1, 1, + kleidicv_rectangle_t{1, 1})); ASSERT_EQ(nullptr, context); } TYPED_TEST(Morphology, ImageBiggerThanContext) { - intrinsiccv_morphology_context_t *context = nullptr; - intrinsiccv_rectangle_t kernel{3, 3}, image{5, 5}; - intrinsiccv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; - intrinsiccv_border_values_t border_values{0, 0, 1, 1}; - intrinsiccv_point_t anchor{1, 1}; - - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_create( - &context, kernel, anchor, border, border_values, 1, - 1, sizeof(TypeParam), image)); + kleidicv_morphology_context_t *context = nullptr; + kleidicv_rectangle_t kernel{3, 3}, image{5, 5}; + kleidicv_border_type_t border = KLEIDICV_BORDER_TYPE_REPLICATE; + kleidicv_border_values_t border_values{0, 0, 1, 1}; + kleidicv_point_t anchor{1, 1}; + + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_create(&context, kernel, anchor, + border, border_values, 1, 1, + sizeof(TypeParam), image)); const size_t w = 7, h = 7; TypeParam src[w * h], dst[w * h]; EXPECT_EQ( @@ -544,25 +544,25 @@ TYPED_TEST(Morphology, ImageBiggerThanContext) { KLEIDICV_ERROR_CONTEXT_MISMATCH, DilateParams::api()(src, sizeof(TypeParam) * w, dst, sizeof(TypeParam) * w, w, h, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, DilateNullPointer) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1] = {}, dst[1]; test::test_null_args(DilateParams::api(), src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, context); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeNullPointer) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1] = {}, dst[1]; test::test_null_args(ErodeParams::api(), src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, context); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, DilateMisalignment) { @@ -570,7 +570,7 @@ TYPED_TEST(Morphology, DilateMisalignment) { // misalignment impossible return; } - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1] = {}, dst[1]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, @@ -580,7 +580,7 @@ TYPED_TEST(Morphology, DilateMisalignment) { KLEIDICV_ERROR_ALIGNMENT, DilateParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeMisalignment) { @@ -588,7 +588,7 @@ TYPED_TEST(Morphology, ErodeMisalignment) { // misalignment impossible return; } - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1] = {}, dst[1]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, @@ -598,104 +598,104 @@ TYPED_TEST(Morphology, ErodeMisalignment) { KLEIDICV_ERROR_ALIGNMENT, ErodeParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, DilateZeroImageSize) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; TypeParam src[1], dst[1]; - ASSERT_EQ(KLEIDICV_OK, - intrinsiccv_morphology_create( - &context, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, - intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, - sizeof(TypeParam), intrinsiccv_rectangle_t{0, 1})); + ASSERT_EQ( + KLEIDICV_OK, + kleidicv_morphology_create( + &context, kleidicv_rectangle_t{1, 1}, kleidicv_point_t{0, 0}, + KLEIDICV_BORDER_TYPE_REPLICATE, kleidicv_border_values_t{0, 0, 1, 1}, + 1, 1, sizeof(TypeParam), kleidicv_rectangle_t{0, 1})); EXPECT_EQ(KLEIDICV_OK, DilateParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 0, 1, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); - - ASSERT_EQ(KLEIDICV_OK, - intrinsiccv_morphology_create( - &context, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, - intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, - sizeof(TypeParam), intrinsiccv_rectangle_t{1, 0})); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); + + ASSERT_EQ( + KLEIDICV_OK, + kleidicv_morphology_create( + &context, kleidicv_rectangle_t{1, 1}, kleidicv_point_t{0, 0}, + KLEIDICV_BORDER_TYPE_REPLICATE, kleidicv_border_values_t{0, 0, 1, 1}, + 1, 1, sizeof(TypeParam), kleidicv_rectangle_t{1, 0})); EXPECT_EQ(KLEIDICV_OK, DilateParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 0, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeZeroImageSize) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; TypeParam src[1], dst[1]; - ASSERT_EQ(KLEIDICV_OK, - intrinsiccv_morphology_create( - &context, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, - intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, - sizeof(TypeParam), intrinsiccv_rectangle_t{0, 1})); + ASSERT_EQ( + KLEIDICV_OK, + kleidicv_morphology_create( + &context, kleidicv_rectangle_t{1, 1}, kleidicv_point_t{0, 0}, + KLEIDICV_BORDER_TYPE_REPLICATE, kleidicv_border_values_t{0, 0, 1, 1}, + 1, 1, sizeof(TypeParam), kleidicv_rectangle_t{0, 1})); EXPECT_EQ(KLEIDICV_OK, ErodeParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 0, 1, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); - - ASSERT_EQ(KLEIDICV_OK, - intrinsiccv_morphology_create( - &context, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, - intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, - sizeof(TypeParam), intrinsiccv_rectangle_t{1, 0})); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); + + ASSERT_EQ( + KLEIDICV_OK, + kleidicv_morphology_create( + &context, kleidicv_rectangle_t{1, 1}, kleidicv_point_t{0, 0}, + KLEIDICV_BORDER_TYPE_REPLICATE, kleidicv_border_values_t{0, 0, 1, 1}, + 1, 1, sizeof(TypeParam), kleidicv_rectangle_t{1, 0})); EXPECT_EQ(KLEIDICV_OK, ErodeParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 0, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, DilateInvalidContextSizeType) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam) + 1)); TypeParam src[1], dst[1]; EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, DilateParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeInvalidContextSizeType) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam) + 1)); TypeParam src[1], dst[1]; EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, ErodeParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, DilateInvalidContextImageSize) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1], dst[1]; EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, DilateParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 2, 1, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeInvalidContextImageSize) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1], dst[1]; EXPECT_EQ(KLEIDICV_ERROR_CONTEXT_MISMATCH, ErodeParams::api()(src, sizeof(TypeParam), dst, sizeof(TypeParam), 2, 1, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, ValidImageSize) { - intrinsiccv_rectangle_t kernel3x3{3, 3}; - intrinsiccv_rectangle_t kernel5x5{5, 5}; + kleidicv_rectangle_t kernel3x3{3, 3}; + kleidicv_rectangle_t kernel5x5{5, 5}; test::Array2D src2x2{kernel3x3.width - 1, kernel3x3.width - 1, test::Options::vector_length()}; src2x2.set(0, 0, {1, 2}); @@ -711,14 +711,14 @@ TYPED_TEST(Morphology, ValidImageSize) { } TYPED_TEST(Morphology, UndersizeImage) { - intrinsiccv_rectangle_t kernel3x3{3, 3}; - intrinsiccv_rectangle_t kernel5x5{5, 5}; + kleidicv_rectangle_t kernel3x3{3, 3}; + kleidicv_rectangle_t kernel5x5{5, 5}; test_undersize_image(kernel3x3); test_undersize_image(kernel5x5); } TYPED_TEST(Morphology, DilateOversizeImage) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1], dst[1]; EXPECT_EQ(KLEIDICV_ERROR_RANGE, @@ -729,11 +729,11 @@ TYPED_TEST(Morphology, DilateOversizeImage) { DilateParams::api()( src, sizeof(TypeParam), dst, sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TYPED_TEST(Morphology, ErodeOversizeImage) { - intrinsiccv_morphology_context_t *context = nullptr; + kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); TypeParam src[1], dst[1]; EXPECT_EQ(KLEIDICV_ERROR_RANGE, @@ -744,18 +744,17 @@ TYPED_TEST(Morphology, ErodeOversizeImage) { ErodeParams::api()( src, sizeof(TypeParam), dst, sizeof(TypeParam), KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, context)); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_morphology_release(context)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } TEST(MorphologyCreate, NullPointer) { EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, - intrinsiccv_morphology_create( - nullptr, intrinsiccv_rectangle_t{1, 1}, - intrinsiccv_point_t{0, 0}, KLEIDICV_BORDER_TYPE_REPLICATE, - intrinsiccv_border_values_t{0, 0, 1, 1}, 1, 1, 1, - intrinsiccv_rectangle_t{1, 1})); + kleidicv_morphology_create(nullptr, kleidicv_rectangle_t{1, 1}, + kleidicv_point_t{0, 0}, + KLEIDICV_BORDER_TYPE_REPLICATE, + kleidicv_border_values_t{0, 0, 1, 1}, 1, + 1, 1, kleidicv_rectangle_t{1, 1})); } TEST(MorphologyRelease, NullPointer) { - EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, - intrinsiccv_morphology_release(nullptr)); + EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, kleidicv_morphology_release(nullptr)); } diff --git a/test/api/test_resize_linear.cpp b/test/api/test_resize_linear.cpp index af6a3beec..8353d93b9 100644 --- a/test/api/test_resize_linear.cpp +++ b/test/api/test_resize_linear.cpp @@ -9,7 +9,7 @@ #include "framework/array.h" #include "framework/utils.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" TEST(ResizeLinear, NotImplemented) { @@ -17,20 +17,19 @@ TEST(ResizeLinear, NotImplemented) { uint8_t dst[4]; EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, - intrinsiccv_resize_linear_u8(src, 1, 1, 1, dst, 2, 2, 1)); + kleidicv_resize_linear_u8(src, 1, 1, 1, dst, 2, 2, 1)); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, - intrinsiccv_resize_linear_u8(src, 1, 1, 1, dst, 1, 1, 2)); + kleidicv_resize_linear_u8(src, 1, 1, 1, dst, 1, 1, 2)); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, - intrinsiccv_resize_linear_u8(src, 1, 1, 1, dst, 4, 4, 2)); + kleidicv_resize_linear_u8(src, 1, 1, 1, dst, 4, 4, 2)); EXPECT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, - intrinsiccv_resize_linear_u8(src, 1, 1, 1, dst, 2, 2, 4)); + kleidicv_resize_linear_u8(src, 1, 1, 1, dst, 2, 2, 4)); } TEST(ResizeLinear, NullPointer) { const uint8_t src[1] = {}; uint8_t dst[4]; - test::test_null_args(intrinsiccv_resize_linear_u8, src, 1, 1, 1, dst, 2, 2, - 2); + test::test_null_args(kleidicv_resize_linear_u8, src, 1, 1, 1, dst, 2, 2, 2); } TEST(ResizeLinear, InvalidImageSize) { @@ -38,12 +37,12 @@ TEST(ResizeLinear, InvalidImageSize) { uint8_t dst[4]; EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_resize_linear_u8(src, 1, 1, 1, dst, - KLEIDICV_MAX_IMAGE_PIXELS + 1, - KLEIDICV_MAX_IMAGE_PIXELS + 1, 1)); + kleidicv_resize_linear_u8(src, 1, 1, 1, dst, + KLEIDICV_MAX_IMAGE_PIXELS + 1, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1)); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_resize_linear_u8( + kleidicv_resize_linear_u8( src, 1, 1, 1, dst, KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS)); } @@ -51,12 +50,9 @@ TEST(ResizeLinear, InvalidImageSize) { TEST(ResizeLinear, ZeroImageSize) { const uint8_t src[1] = {}; uint8_t dst[1]; - EXPECT_EQ(KLEIDICV_OK, - intrinsiccv_resize_linear_u8(src, 0, 0, 0, dst, 0, 0, 0)); - EXPECT_EQ(KLEIDICV_OK, - intrinsiccv_resize_linear_u8(src, 1, 1, 0, dst, 2, 2, 0)); - EXPECT_EQ(KLEIDICV_OK, - intrinsiccv_resize_linear_u8(src, 0, 0, 1, dst, 0, 0, 2)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_resize_linear_u8(src, 0, 0, 0, dst, 0, 0, 0)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_resize_linear_u8(src, 1, 1, 0, dst, 2, 2, 0)); + EXPECT_EQ(KLEIDICV_OK, kleidicv_resize_linear_u8(src, 0, 0, 1, dst, 0, 0, 2)); } static void resize_linear_unaccelerated_2x2_u8( @@ -248,7 +244,7 @@ static void do_large_dimensions_test(size_t x_scale, size_t y_scale) { resize_linear_unaccelerated_u8(src.data(), src_stride, src_width, src_height, expected_data.data(), dst_stride, dst_width, dst_height); - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_resize_linear_u8( + ASSERT_EQ(KLEIDICV_OK, kleidicv_resize_linear_u8( src.data(), src_stride, src_width, src_height, dst.data(), dst_stride, dst_width, dst_height)); @@ -314,7 +310,7 @@ void do_linear_resize_test(const ResizeTestParams ¶m, size_t src_padding, std::vector src = flatten(param.src, src_padding), dst; dst.resize(dst_stride * dst_height); - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_resize_linear_u8( + ASSERT_EQ(KLEIDICV_OK, kleidicv_resize_linear_u8( src.data(), src_stride, src_width, src_height, dst.data(), dst_stride, dst_width, dst_height)); for (size_t y = 0; y < dst_height; ++y) { diff --git a/test/api/test_resize_to_quarter.cpp b/test/api/test_resize_to_quarter.cpp index 6b9ee7ecf..994eea671 100644 --- a/test/api/test_resize_to_quarter.cpp +++ b/test/api/test_resize_to_quarter.cpp @@ -6,7 +6,7 @@ #include "framework/array.h" #include "framework/utils.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" class ResizeToQuarterTest final { @@ -41,7 +41,7 @@ class ResizeToQuarterTest final { calculate_expected(source, expected); - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_resize_to_quarter_u8( + ASSERT_EQ(KLEIDICV_OK, kleidicv_resize_to_quarter_u8( source.data(), source.stride(), source.width(), source.height(), actual.data(), actual.stride(), actual.width(), actual.height())); @@ -216,8 +216,8 @@ TEST(ResizeToQuarter, OddDimsTruncated) { TEST(ResizeToQuarter, NullPointer) { const uint8_t src[4] = {}; uint8_t dst[1]; - test::test_null_args(intrinsiccv_resize_to_quarter_u8, src, 2, 2, 2, dst, 1, - 1, 1); + test::test_null_args(kleidicv_resize_to_quarter_u8, src, 2, 2, 2, dst, 1, 1, + 1); } TEST(ResizeToQuarter, ZeroImageSize) { @@ -225,9 +225,9 @@ TEST(ResizeToQuarter, ZeroImageSize) { uint8_t dst[1]; EXPECT_EQ(KLEIDICV_OK, - intrinsiccv_resize_to_quarter_u8(src, 1, 0, 1, dst, 1, 0, 1)); + kleidicv_resize_to_quarter_u8(src, 1, 0, 1, dst, 1, 0, 1)); EXPECT_EQ(KLEIDICV_OK, - intrinsiccv_resize_to_quarter_u8(src, 1, 1, 0, dst, 1, 1, 0)); + kleidicv_resize_to_quarter_u8(src, 1, 1, 0, dst, 1, 1, 0)); } TEST(ResizeToQuarter, InvalidImageSize) { @@ -235,22 +235,22 @@ TEST(ResizeToQuarter, InvalidImageSize) { uint8_t dst[1]; EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_resize_to_quarter_u8( - src, 1, KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, dst, 1, 1, 1)); + kleidicv_resize_to_quarter_u8(src, 1, KLEIDICV_MAX_IMAGE_PIXELS + 1, + 1, dst, 1, 1, 1)); - EXPECT_EQ(KLEIDICV_ERROR_RANGE, intrinsiccv_resize_to_quarter_u8( + EXPECT_EQ(KLEIDICV_ERROR_RANGE, kleidicv_resize_to_quarter_u8( src, 1, KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, dst, 1, 1, 1)); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_resize_to_quarter_u8(src, 1, 8, 8, dst, 1, 4, 3)); + kleidicv_resize_to_quarter_u8(src, 1, 8, 8, dst, 1, 4, 3)); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_resize_to_quarter_u8(src, 1, 8, 8, dst, 1, 3, 4)); + kleidicv_resize_to_quarter_u8(src, 1, 8, 8, dst, 1, 3, 4)); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_resize_to_quarter_u8(src, 1, 9, 9, dst, 1, 4, 1)); + kleidicv_resize_to_quarter_u8(src, 1, 9, 9, dst, 1, 4, 1)); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_resize_to_quarter_u8(src, 1, 9, 9, dst, 1, 7, 5)); + kleidicv_resize_to_quarter_u8(src, 1, 9, 9, dst, 1, 7, 5)); } diff --git a/test/api/test_rgb_and_gray.cpp b/test/api/test_rgb_and_gray.cpp index 83b2071c7..09ec2b500 100644 --- a/test/api/test_rgb_and_gray.cpp +++ b/test/api/test_rgb_and_gray.cpp @@ -6,7 +6,7 @@ #include "framework/array.h" #include "framework/utils.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" class GrayTest final { @@ -167,57 +167,57 @@ class ColourTest final { }; TEST(GRAY2, RGB) { - GrayTest{false}.execute_test(intrinsiccv_gray_to_rgb_u8); - GrayTest{false}.with_padding(1).execute_test(intrinsiccv_gray_to_rgb_u8); + GrayTest{false}.execute_test(kleidicv_gray_to_rgb_u8); + GrayTest{false}.with_padding(1).execute_test(kleidicv_gray_to_rgb_u8); GrayTest{false} .with_width(2 * test::Options::vector_lanes()) - .execute_test(intrinsiccv_gray_to_rgb_u8); + .execute_test(kleidicv_gray_to_rgb_u8); } TEST(GRAY2, RGBA) { - GrayTest{true}.execute_test(intrinsiccv_gray_to_rgba_u8); - GrayTest{true}.with_padding(1).execute_test(intrinsiccv_gray_to_rgba_u8); + GrayTest{true}.execute_test(kleidicv_gray_to_rgba_u8); + GrayTest{true}.with_padding(1).execute_test(kleidicv_gray_to_rgba_u8); GrayTest{true} .with_width(2 * test::Options::vector_lanes()) - .execute_test(intrinsiccv_gray_to_rgba_u8); + .execute_test(kleidicv_gray_to_rgba_u8); } TEST(RGB2, RGB) { ColourTest colour_test(3, 3, false); - colour_test.execute_test(intrinsiccv_rgb_to_rgb_u8); + colour_test.execute_test(kleidicv_rgb_to_rgb_u8); } TEST(RGBA2, RGBA) { ColourTest colour_test(4, 4, false); - colour_test.execute_test(intrinsiccv_rgba_to_rgba_u8); + colour_test.execute_test(kleidicv_rgba_to_rgba_u8); } TEST(RGB2, BGR) { ColourTest colour_test(3, 3, true); - colour_test.execute_test(intrinsiccv_rgb_to_bgr_u8); + colour_test.execute_test(kleidicv_rgb_to_bgr_u8); } TEST(RGBA2, BGRA) { ColourTest colour_test(4, 4, true); - colour_test.execute_test(intrinsiccv_rgba_to_bgra_u8); + colour_test.execute_test(kleidicv_rgba_to_bgra_u8); } TEST(RGB2, BGRA) { ColourTest colour_test(3, 4, true); - colour_test.execute_test(intrinsiccv_rgb_to_bgra_u8); + colour_test.execute_test(kleidicv_rgb_to_bgra_u8); } TEST(RGB2, RGBA) { ColourTest colour_test(3, 4, false); - colour_test.execute_test(intrinsiccv_rgb_to_rgba_u8); + colour_test.execute_test(kleidicv_rgb_to_rgba_u8); } TEST(RGBA2, BGR) { ColourTest colour_test(4, 3, true); - colour_test.execute_test(intrinsiccv_rgba_to_bgr_u8); + colour_test.execute_test(kleidicv_rgba_to_bgr_u8); } TEST(RGBA2, RGB) { ColourTest colour_test(4, 3, false); - colour_test.execute_test(intrinsiccv_rgba_to_rgb_u8); + colour_test.execute_test(kleidicv_rgba_to_rgb_u8); } diff --git a/test/api/test_saturating_absdiff.cpp b/test/api/test_saturating_absdiff.cpp index 3a641561e..5d9d80134 100644 --- a/test/api/test_saturating_absdiff.cpp +++ b/test/api/test_saturating_absdiff.cpp @@ -7,12 +7,11 @@ #include #include "framework/operation.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" -#define KLEIDICV_SATURATING_ABSDIFF(type, suffix) \ - KLEIDICV_API(saturating_absdiff, intrinsiccv_saturating_absdiff_##suffix, \ - type) +#define KLEIDICV_SATURATING_ABSDIFF(type, suffix) \ + KLEIDICV_API(saturating_absdiff, kleidicv_saturating_absdiff_##suffix, type) KLEIDICV_SATURATING_ABSDIFF(int8_t, s8); KLEIDICV_SATURATING_ABSDIFF(uint8_t, u8); @@ -31,7 +30,7 @@ class SaturatingAbsDiffTest final : public BinaryOperationTest { using BinaryOperationTest::max; // Calls the API-under-test in the appropriate way. - intrinsiccv_error_t call_api() override { + kleidicv_error_t call_api() override { return saturating_absdiff()( this->inputs_[0].data(), this->inputs_[0].stride(), this->inputs_[1].data(), this->inputs_[1].stride(), @@ -90,7 +89,7 @@ using ElementTypes = ::testing::Types; TYPED_TEST_SUITE(SaturatingAbsDiff, ElementTypes); -// Tests intrinsiccv_saturating_absdiff_ API. +// Tests kleidicv_saturating_absdiff_ API. TYPED_TEST(SaturatingAbsDiff, API) { // Test without padding. SaturatingAbsDiffTest{}.test(); diff --git a/test/api/test_saturating_add.cpp b/test/api/test_saturating_add.cpp index 74ef87a4b..99e48f031 100644 --- a/test/api/test_saturating_add.cpp +++ b/test/api/test_saturating_add.cpp @@ -7,11 +7,11 @@ #include #include "framework/operation.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" #define KLEIDICV_SATURATING_ADD(type, suffix) \ - KLEIDICV_API(saturating_add, intrinsiccv_saturating_add_##suffix, type) + KLEIDICV_API(saturating_add, kleidicv_saturating_add_##suffix, type) KLEIDICV_SATURATING_ADD(int8_t, s8); KLEIDICV_SATURATING_ADD(uint8_t, u8); @@ -33,7 +33,7 @@ class SaturatingAddTest final : public BinaryOperationTest { using BinaryOperationTest::max; // Calls the API-under-test in the appropriate way. - intrinsiccv_error_t call_api() override { + kleidicv_error_t call_api() override { return saturating_add()( this->inputs_[0].data(), this->inputs_[0].stride(), this->inputs_[1].data(), this->inputs_[1].stride(), @@ -82,7 +82,7 @@ using ElementTypes = ::testing::Types; TYPED_TEST_SUITE(SaturatingAdd, ElementTypes); -// Tests intrinsiccv_saturating_add_ API. +// Tests kleidicv_saturating_add_ API. TYPED_TEST(SaturatingAdd, API) { // Test without padding. SaturatingAddTest{}.test(); diff --git a/test/api/test_saturating_multiply.cpp b/test/api/test_saturating_multiply.cpp index 3c998ae8f..552af28f2 100644 --- a/test/api/test_saturating_multiply.cpp +++ b/test/api/test_saturating_multiply.cpp @@ -7,12 +7,11 @@ #include #include "framework/operation.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" -#define KLEIDICV_SATURATING_MULTIPLY(type, suffix) \ - KLEIDICV_API(saturating_multiply, intrinsiccv_saturating_multiply_##suffix, \ - type) +#define KLEIDICV_SATURATING_MULTIPLY(type, suffix) \ + KLEIDICV_API(saturating_multiply, kleidicv_saturating_multiply_##suffix, type) KLEIDICV_SATURATING_MULTIPLY(uint8_t, u8); KLEIDICV_SATURATING_MULTIPLY(int8_t, s8); @@ -31,7 +30,7 @@ class SaturatingMultiplyTest final : public BinaryOperationTest { using BinaryOperationTest::max; // Calls the API-under-test in the appropriate way. - intrinsiccv_error_t call_api() override { + kleidicv_error_t call_api() override { return saturating_multiply()( this->inputs_[0].data(), this->inputs_[0].stride(), this->inputs_[1].data(), this->inputs_[1].stride(), @@ -90,7 +89,7 @@ using ElementTypes = ::testing::Types; TYPED_TEST_SUITE(SaturatingMultiply, ElementTypes); -// Tests intrinsiccv_saturating_multiply_ API. +// Tests kleidicv_saturating_multiply_ API. TYPED_TEST(SaturatingMultiply, API) { // Test without padding. SaturatingMultiplyTest{}.test(); diff --git a/test/api/test_saturating_sub.cpp b/test/api/test_saturating_sub.cpp index 0c8a55f36..d07ba0f43 100644 --- a/test/api/test_saturating_sub.cpp +++ b/test/api/test_saturating_sub.cpp @@ -7,11 +7,11 @@ #include #include "framework/operation.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" #define KLEIDICV_SATURATING_SUB(type, suffix) \ - KLEIDICV_API(saturating_sub, intrinsiccv_saturating_sub_##suffix, type) + KLEIDICV_API(saturating_sub, kleidicv_saturating_sub_##suffix, type) KLEIDICV_SATURATING_SUB(int8_t, s8); KLEIDICV_SATURATING_SUB(uint8_t, u8); @@ -33,7 +33,7 @@ class SaturatingSubTest final : public BinaryOperationTest { using BinaryOperationTest::max; // Calls the API-under-test in the appropriate way. - intrinsiccv_error_t call_api() override { + kleidicv_error_t call_api() override { return saturating_sub()( this->inputs_[0].data(), this->inputs_[0].stride(), this->inputs_[1].data(), this->inputs_[1].stride(), @@ -84,7 +84,7 @@ using ElementTypes = ::testing::Types; TYPED_TEST_SUITE(SaturatingSub, ElementTypes); -// Tests intrinsiccv_saturating_sub_ API. +// Tests kleidicv_saturating_sub_ API. TYPED_TEST(SaturatingSub, API) { // Test without padding. SaturatingSubTest{}.test(); diff --git a/test/api/test_scale.cpp b/test/api/test_scale.cpp index 21e7bb129..ab9974722 100644 --- a/test/api/test_scale.cpp +++ b/test/api/test_scale.cpp @@ -7,11 +7,11 @@ #include "framework/array.h" #include "framework/generator.h" #include "framework/operation.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" #define KLEIDICV_SCALE(type, suffix) \ - KLEIDICV_API(scale, intrinsiccv_scale_##suffix, type) + KLEIDICV_API(scale, kleidicv_scale_##suffix, type) KLEIDICV_SCALE(uint8_t, u8); @@ -22,11 +22,11 @@ class ScaleTestBase : public UnaryOperationTest { using UnaryOperationTest::max; // Calls the API-under-test in the appropriate way. - intrinsiccv_error_t call_api() override { - return intrinsiccv_scale_u8( - this->inputs_[0].data(), this->inputs_[0].stride(), - this->actual_[0].data(), this->actual_[0].stride(), this->width(), - this->height(), this->scale(), this->shift()); + kleidicv_error_t call_api() override { + return kleidicv_scale_u8(this->inputs_[0].data(), this->inputs_[0].stride(), + this->actual_[0].data(), this->actual_[0].stride(), + this->width(), this->height(), this->scale(), + this->shift()); } virtual float scale() = 0; virtual float shift() = 0; @@ -106,10 +106,9 @@ class ScaleTestLinearBase { calculate_expected(source, expected); - ASSERT_EQ( - KLEIDICV_OK, - intrinsiccv_scale_u8(source.data(), source.stride(), actual.data(), - actual.stride(), width, height, scale(), shift())); + ASSERT_EQ(KLEIDICV_OK, kleidicv_scale_u8(source.data(), source.stride(), + actual.data(), actual.stride(), + width, height, scale(), shift())); EXPECT_EQ_ARRAY2D(expected, actual); } @@ -330,7 +329,7 @@ class ScaleTest : public testing::Test {}; using ElementTypes = ::testing::Types; -// Tests intrinsiccv_scale_u8 API. +// Tests kleidicv_scale_u8 API. TYPED_TEST_SUITE(ScaleTest, ElementTypes); TYPED_TEST(ScaleTest, TestScalar1) { diff --git a/test/api/test_sobel.cpp b/test/api/test_sobel.cpp index a61d05882..664b84941 100644 --- a/test/api/test_sobel.cpp +++ b/test/api/test_sobel.cpp @@ -9,17 +9,16 @@ #include "framework/array.h" #include "framework/generator.h" #include "framework/kernel.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" -#define KLEIDICV_SOBEL_3X3_HORIZONTAL(type, suffix) \ - KLEIDICV_API(sobel_3x3_horizontal, \ - intrinsiccv_sobel_3x3_horizontal_##suffix, type) - -#define KLEIDICV_SOBEL_3X3_VERTICAL(type, suffix) \ - KLEIDICV_API(sobel_3x3_vertical, intrinsiccv_sobel_3x3_vertical_##suffix, \ +#define KLEIDICV_SOBEL_3X3_HORIZONTAL(type, suffix) \ + KLEIDICV_API(sobel_3x3_horizontal, kleidicv_sobel_3x3_horizontal_##suffix, \ type) +#define KLEIDICV_SOBEL_3X3_VERTICAL(type, suffix) \ + KLEIDICV_API(sobel_3x3_vertical, kleidicv_sobel_3x3_vertical_##suffix, type) + KLEIDICV_SOBEL_3X3_HORIZONTAL(uint8_t, s16_u8); KLEIDICV_SOBEL_3X3_VERTICAL(uint8_t, s16_u8); @@ -37,7 +36,7 @@ struct SobelKernelTestParams { static constexpr bool kIsHorizontal = IsHorizontal; }; // end of struct SobelKernelTestParams -static constexpr std::array kSupportedBorders = { +static constexpr std::array kSupportedBorders = { KLEIDICV_BORDER_TYPE_REPLICATE, }; @@ -49,10 +48,10 @@ class Sobel3x3Test : public test::KernelTest { using typename Base::IntermediateType; using typename Base::OutputType; - intrinsiccv_error_t call_api(const test::Array2D *input, - test::Array2D *output, - intrinsiccv_border_type_t, - intrinsiccv_border_values_t) override { + kleidicv_error_t call_api(const test::Array2D *input, + test::Array2D *output, + kleidicv_border_type_t, + kleidicv_border_values_t) override { auto api = KernelTestParams::kIsHorizontal ? sobel_3x3_horizontal() : sobel_3x3_vertical(); diff --git a/test/api/test_split.cpp b/test/api/test_split.cpp index 07a080765..fcdcda622 100644 --- a/test/api/test_split.cpp +++ b/test/api/test_split.cpp @@ -6,7 +6,7 @@ #include "framework/array.h" #include "framework/utils.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" template @@ -89,9 +89,9 @@ class SplitTest final { strides[i] = actual_outputs[i].stride(); } ASSERT_EQ(KLEIDICV_OK, - intrinsiccv_split(input.data(), input.stride(), - actual_raw_pointers, strides, output_width, - height, Channels, sizeof(ElementType))); + kleidicv_split(input.data(), input.stride(), actual_raw_pointers, + strides, output_width, height, Channels, + sizeof(ElementType))); // Compare the results for (size_t i = 0; i < Channels; ++i) { @@ -110,7 +110,7 @@ class SplitTest final { template static void test_not_implemented( - intrinsiccv_error_t expected = KLEIDICV_ERROR_NOT_IMPLEMENTED) { + kleidicv_error_t expected = KLEIDICV_ERROR_NOT_IMPLEMENTED) { const size_t width = 1, height = 1; ElementType src_data[kChannels * width * height] = {234}; @@ -124,8 +124,8 @@ static void test_not_implemented( } ASSERT_EQ(expected, - intrinsiccv_split(src_data, src_stride, dst_data, dst_strides, - width, height, kChannels, sizeof(ElementType))); + kleidicv_split(src_data, src_stride, dst_data, dst_strides, width, + height, kChannels, sizeof(ElementType))); // Destination should not be modified. EXPECT_EQ(123, dst_arrays[0][0]); @@ -216,7 +216,7 @@ TYPED_TEST(Split, NullPointer) { size_t dst_strides[kChannels] = {sizeof(TypeParam), sizeof(TypeParam), sizeof(TypeParam), sizeof(TypeParam)}; - test::test_null_args(intrinsiccv_split, src_data, src_stride, dst_data, + test::test_null_args(kleidicv_split, src_data, src_stride, dst_data, dst_strides, 1, 1, kChannels, sizeof(TypeParam)); for (int channels = 2; channels <= 4; ++channels) { @@ -225,8 +225,8 @@ TYPED_TEST(Split, NullPointer) { dst_data[i] = (i == null_src) ? nullptr : dst_arrays + i; } EXPECT_EQ(KLEIDICV_ERROR_NULL_POINTER, - intrinsiccv_split(src_data, src_stride, dst_data, dst_strides, - 1, 1, channels, sizeof(TypeParam))); + kleidicv_split(src_data, src_stride, dst_data, dst_strides, 1, + 1, channels, sizeof(TypeParam))); } } } @@ -256,11 +256,10 @@ TYPED_TEST(Split, Misalignment) { auto check_split = [&](int channels, void* src_maybe_misaligned, size_t src_stride_maybe_misaligned) { - EXPECT_EQ( - KLEIDICV_ERROR_ALIGNMENT, - intrinsiccv_split(src_maybe_misaligned, src_stride_maybe_misaligned, - reinterpret_cast(dst_data), dst_strides, 1, 1, - channels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, + kleidicv_split(src_maybe_misaligned, src_stride_maybe_misaligned, + reinterpret_cast(dst_data), dst_strides, 1, + 1, channels, sizeof(TypeParam))); }; for (size_t channels = 2; channels <= kChannels; ++channels) { @@ -294,10 +293,10 @@ TYPED_TEST(Split, ZeroImageSize) { void* dsts[kChannels] = {dst1, dst2}; size_t dst_strides[kChannels] = {sizeof(TypeParam), sizeof(TypeParam)}; - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_split(src, src_stride, dsts, dst_strides, - 0, 1, kChannels, sizeof(TypeParam))); - EXPECT_EQ(KLEIDICV_OK, intrinsiccv_split(src, src_stride, dsts, dst_strides, - 1, 0, kChannels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_OK, kleidicv_split(src, src_stride, dsts, dst_strides, 0, + 1, kChannels, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_OK, kleidicv_split(src, src_stride, dsts, dst_strides, 1, + 0, kChannels, sizeof(TypeParam))); } TYPED_TEST(Split, OversizeImage) { @@ -308,11 +307,11 @@ TYPED_TEST(Split, OversizeImage) { size_t dst_strides[kChannels] = {sizeof(TypeParam), sizeof(TypeParam)}; EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_split(src, src_stride, dsts, dst_strides, - KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, kChannels, - sizeof(TypeParam))); + kleidicv_split(src, src_stride, dsts, dst_strides, + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, kChannels, + sizeof(TypeParam))); EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_split( - src, src_stride, dsts, dst_strides, KLEIDICV_MAX_IMAGE_PIXELS, - KLEIDICV_MAX_IMAGE_PIXELS, kChannels, sizeof(TypeParam))); + kleidicv_split(src, src_stride, dsts, dst_strides, + KLEIDICV_MAX_IMAGE_PIXELS, KLEIDICV_MAX_IMAGE_PIXELS, + kChannels, sizeof(TypeParam))); } diff --git a/test/api/test_threshold_binary.cpp b/test/api/test_threshold_binary.cpp index fd3aad9bf..2c615e8a0 100644 --- a/test/api/test_threshold_binary.cpp +++ b/test/api/test_threshold_binary.cpp @@ -5,11 +5,11 @@ #include #include "framework/operation.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" #define KLEIDICV_THRESHOLD_BINARY(type, suffix) \ - KLEIDICV_API(threshold_binary, intrinsiccv_threshold_binary_##suffix, type) + KLEIDICV_API(threshold_binary, kleidicv_threshold_binary_##suffix, type) KLEIDICV_THRESHOLD_BINARY(uint8_t, u8); @@ -20,8 +20,8 @@ class ThresholdBinaryTestBase : public UnaryOperationTest { using UnaryOperationTest::max; // Calls the API-under-test in the appropriate way. - intrinsiccv_error_t call_api() override { - return intrinsiccv_threshold_binary_u8( + kleidicv_error_t call_api() override { + return kleidicv_threshold_binary_u8( this->inputs_[0].data(), this->inputs_[0].stride(), this->actual_[0].data(), this->actual_[0].stride(), this->width(), this->height(), this->threshold(), this->value()); diff --git a/test/api/test_transpose.cpp b/test/api/test_transpose.cpp index 1f52d9001..45230e713 100644 --- a/test/api/test_transpose.cpp +++ b/test/api/test_transpose.cpp @@ -6,7 +6,7 @@ #include "framework/array.h" #include "framework/generator.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" #include "test_config.h" template @@ -70,10 +70,10 @@ class TestTranspose final { calculate_expected(source, expected); - ASSERT_EQ(KLEIDICV_OK, intrinsiccv_transpose( - source.data(), source.stride(), p_actual->data(), - p_actual->stride(), src_width, src_height, - sizeof(ElementType))); + ASSERT_EQ(KLEIDICV_OK, + kleidicv_transpose(source.data(), source.stride(), + p_actual->data(), p_actual->stride(), + src_width, src_height, sizeof(ElementType))); EXPECT_EQ_ARRAY2D(expected, *p_actual); } @@ -103,8 +103,8 @@ class TestNotImplemented { ElementType source[width * height] = {0xFF}; ASSERT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, - intrinsiccv_transpose(source, stride, source, stride, width, - height, sizeof(ElementType))); + kleidicv_transpose(source, stride, source, stride, width, height, + sizeof(ElementType))); } template @@ -115,8 +115,8 @@ class TestNotImplemented { WrongType source[width * height] = {0xFF}; ASSERT_EQ(KLEIDICV_ERROR_NOT_IMPLEMENTED, - intrinsiccv_transpose(source, stride, source, stride, width, - height, sizeof(WrongType))); + kleidicv_transpose(source, stride, source, stride, width, height, + sizeof(WrongType))); } }; @@ -188,7 +188,7 @@ TYPED_TEST(Transpose, VectorPlusScalarInplaceWithPadding) { TYPED_TEST(Transpose, NullPointer) { TypeParam src[1] = {}, dst[1]; - test::test_null_args(intrinsiccv_transpose, src, sizeof(TypeParam), dst, + test::test_null_args(kleidicv_transpose, src, sizeof(TypeParam), dst, sizeof(TypeParam), 1, 1, sizeof(TypeParam)); } @@ -210,39 +210,37 @@ TYPED_TEST(Transpose, Misalignment) { char src[kBufSize] = {}, dst[kBufSize] = {}; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, - intrinsiccv_transpose(src + 1, sizeof(TypeParam), dst, - sizeof(TypeParam), 1, 1, sizeof(TypeParam))); + kleidicv_transpose(src + 1, sizeof(TypeParam), dst, + sizeof(TypeParam), 1, 1, sizeof(TypeParam))); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, - intrinsiccv_transpose(src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1, sizeof(TypeParam))); + kleidicv_transpose(src, sizeof(TypeParam) + 1, dst, + sizeof(TypeParam), 1, 1, sizeof(TypeParam))); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, - intrinsiccv_transpose(src, sizeof(TypeParam), dst + 1, - sizeof(TypeParam), 1, 1, sizeof(TypeParam))); - EXPECT_EQ( - KLEIDICV_ERROR_ALIGNMENT, - intrinsiccv_transpose(src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, - 1, 1, sizeof(TypeParam))); + kleidicv_transpose(src, sizeof(TypeParam), dst + 1, + sizeof(TypeParam), 1, 1, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, + kleidicv_transpose(src, sizeof(TypeParam), dst, + sizeof(TypeParam) + 1, 1, 1, sizeof(TypeParam))); } TYPED_TEST(Transpose, ZeroImageSize) { TypeParam src[1] = {}, dst[1]; EXPECT_EQ(KLEIDICV_OK, - intrinsiccv_transpose(src, sizeof(TypeParam), dst, - sizeof(TypeParam), 0, 1, sizeof(TypeParam))); + kleidicv_transpose(src, sizeof(TypeParam), dst, sizeof(TypeParam), + 0, 1, sizeof(TypeParam))); EXPECT_EQ(KLEIDICV_OK, - intrinsiccv_transpose(src, sizeof(TypeParam), dst, - sizeof(TypeParam), 1, 0, sizeof(TypeParam))); + kleidicv_transpose(src, sizeof(TypeParam), dst, sizeof(TypeParam), + 1, 0, sizeof(TypeParam))); } TYPED_TEST(Transpose, OversizeImage) { TypeParam src[1] = {}, dst[1]; - EXPECT_EQ(KLEIDICV_ERROR_RANGE, - intrinsiccv_transpose( - src, sizeof(TypeParam), dst, sizeof(TypeParam), - KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, sizeof(TypeParam))); EXPECT_EQ( KLEIDICV_ERROR_RANGE, - intrinsiccv_transpose(src, sizeof(TypeParam), dst, sizeof(TypeParam), - KLEIDICV_MAX_IMAGE_PIXELS, - KLEIDICV_MAX_IMAGE_PIXELS, sizeof(TypeParam))); + kleidicv_transpose(src, sizeof(TypeParam), dst, sizeof(TypeParam), + KLEIDICV_MAX_IMAGE_PIXELS + 1, 1, sizeof(TypeParam))); + EXPECT_EQ(KLEIDICV_ERROR_RANGE, + kleidicv_transpose(src, sizeof(TypeParam), dst, sizeof(TypeParam), + KLEIDICV_MAX_IMAGE_PIXELS, + KLEIDICV_MAX_IMAGE_PIXELS, sizeof(TypeParam))); } diff --git a/test/api/test_yuv_to_rgb.cpp b/test/api/test_yuv_to_rgb.cpp index 26d69b343..ccf462f24 100644 --- a/test/api/test_yuv_to_rgb.cpp +++ b/test/api/test_yuv_to_rgb.cpp @@ -6,8 +6,8 @@ #include "framework/array.h" #include "framework/utils.h" -#include "intrinsiccv/intrinsiccv.h" -#include "intrinsiccv/utils.h" +#include "kleidicv/kleidicv.h" +#include "kleidicv/utils.h" #include "test_config.h" class YuvTest final { @@ -143,80 +143,80 @@ class YuvTest final { TEST(YUV2, RGB_NV12_scalar) { YuvTest yuv_test(3, false); - yuv_test.execute_scalar_test(intrinsiccv_yuv_sp_to_rgb_u8, false); + yuv_test.execute_scalar_test(kleidicv_yuv_sp_to_rgb_u8, false); } TEST(YUV2, RGB_NV12_vector) { YuvTest yuv_test(3, false); - yuv_test.execute_vector_test(intrinsiccv_yuv_sp_to_rgb_u8, false); + yuv_test.execute_vector_test(kleidicv_yuv_sp_to_rgb_u8, false); } TEST(YUV2, RGB_NV21_scalar) { YuvTest yuv_test(3, false); - yuv_test.execute_scalar_test(intrinsiccv_yuv_sp_to_rgb_u8, true); + yuv_test.execute_scalar_test(kleidicv_yuv_sp_to_rgb_u8, true); } TEST(YUV2, RGB_NV21_vector) { YuvTest yuv_test(3, false); - yuv_test.execute_vector_test(intrinsiccv_yuv_sp_to_rgb_u8, true); + yuv_test.execute_vector_test(kleidicv_yuv_sp_to_rgb_u8, true); } TEST(YUV2, BGR_NV12_scalar) { YuvTest yuv_test(3, true); - yuv_test.execute_scalar_test(intrinsiccv_yuv_sp_to_bgr_u8, false); + yuv_test.execute_scalar_test(kleidicv_yuv_sp_to_bgr_u8, false); } TEST(YUV2, BGR_NV12_vector) { YuvTest yuv_test(3, true); - yuv_test.execute_vector_test(intrinsiccv_yuv_sp_to_bgr_u8, false); + yuv_test.execute_vector_test(kleidicv_yuv_sp_to_bgr_u8, false); } TEST(YUV2, BGR_NV21_scalar) { YuvTest yuv_test(3, true); - yuv_test.execute_scalar_test(intrinsiccv_yuv_sp_to_bgr_u8, true); + yuv_test.execute_scalar_test(kleidicv_yuv_sp_to_bgr_u8, true); } TEST(YUV2, BGR_NV21_vector) { YuvTest yuv_test(3, true); - yuv_test.execute_vector_test(intrinsiccv_yuv_sp_to_bgr_u8, true); + yuv_test.execute_vector_test(kleidicv_yuv_sp_to_bgr_u8, true); } TEST(YUV2, RGBA_NV12_scalar) { YuvTest yuv_test(4, false); - yuv_test.execute_scalar_test(intrinsiccv_yuv_sp_to_rgba_u8, false); + yuv_test.execute_scalar_test(kleidicv_yuv_sp_to_rgba_u8, false); } TEST(YUV2, RGBA_NV12_vector) { YuvTest yuv_test(4, false); - yuv_test.execute_vector_test(intrinsiccv_yuv_sp_to_rgba_u8, false); + yuv_test.execute_vector_test(kleidicv_yuv_sp_to_rgba_u8, false); } TEST(YUV2, RGBA_NV21_scalar) { YuvTest yuv_test(4, false); - yuv_test.execute_scalar_test(intrinsiccv_yuv_sp_to_rgba_u8, true); + yuv_test.execute_scalar_test(kleidicv_yuv_sp_to_rgba_u8, true); } TEST(YUV2, RGBA_NV21_vector) { YuvTest yuv_test(4, false); - yuv_test.execute_vector_test(intrinsiccv_yuv_sp_to_rgba_u8, true); + yuv_test.execute_vector_test(kleidicv_yuv_sp_to_rgba_u8, true); } TEST(YUV2, BGRA_NV12_scalar) { YuvTest yuv_test(4, true); - yuv_test.execute_scalar_test(intrinsiccv_yuv_sp_to_bgra_u8, false); + yuv_test.execute_scalar_test(kleidicv_yuv_sp_to_bgra_u8, false); } TEST(YUV2, BGRA_NV12_vector) { YuvTest yuv_test(4, true); - yuv_test.execute_vector_test(intrinsiccv_yuv_sp_to_bgra_u8, false); + yuv_test.execute_vector_test(kleidicv_yuv_sp_to_bgra_u8, false); } TEST(YUV2, BGRA_NV21_scalar) { YuvTest yuv_test(4, true); - yuv_test.execute_scalar_test(intrinsiccv_yuv_sp_to_bgra_u8, true); + yuv_test.execute_scalar_test(kleidicv_yuv_sp_to_bgra_u8, true); } TEST(YUV2, BGRA_NV21_vector) { YuvTest yuv_test(4, true); - yuv_test.execute_vector_test(intrinsiccv_yuv_sp_to_bgra_u8, true); + yuv_test.execute_vector_test(kleidicv_yuv_sp_to_bgra_u8, true); } diff --git a/test/framework/CMakeLists.txt b/test/framework/CMakeLists.txt index 12b8caf65..68c4496bc 100644 --- a/test/framework/CMakeLists.txt +++ b/test/framework/CMakeLists.txt @@ -2,41 +2,41 @@ # # SPDX-License-Identifier: Apache-2.0 -file(GLOB intrinsiccv_framework_test_sources CONFIGURE_DEPENDS "*.h" "test_*.cpp") +file(GLOB kleidicv_framework_test_sources CONFIGURE_DEPENDS "*.h" "test_*.cpp") -list(APPEND intrinsiccv_framework_test_sources ${KLEIDICV_TEST_FRAMEWORK_SOURCES}) +list(APPEND kleidicv_framework_test_sources ${KLEIDICV_TEST_FRAMEWORK_SOURCES}) set_source_files_properties( - ${intrinsiccv_framework_test_sources} + ${kleidicv_framework_test_sources} PROPERTIES COMPILE_OPTIONS "${KLEIDICV_TEST_CXX_FLAGS}" ) add_executable( - intrinsiccv-framework-test - ${intrinsiccv_framework_test_sources} + kleidicv-framework-test + ${kleidicv_framework_test_sources} ) set_target_properties( - intrinsiccv-framework-test + kleidicv-framework-test PROPERTIES CXX_STANDARD 17 ) target_include_directories( - intrinsiccv-framework-test + kleidicv-framework-test PRIVATE ${KLEIDICV_INCLUDE_DIR} PRIVATE ${KLEIDICV_TEST_INCLUDE_DIR} ) if (KLEIDICV_ALLOCATION_TESTS) target_link_options( - intrinsiccv-framework-test + kleidicv-framework-test PRIVATE -Wl,--wrap,malloc ) endif() target_link_libraries( - intrinsiccv-framework-test - intrinsiccv + kleidicv-framework-test + kleidicv gtest_main ) diff --git a/test/framework/border.cpp b/test/framework/border.cpp index 2e46666bb..ace94551d 100644 --- a/test/framework/border.cpp +++ b/test/framework/border.cpp @@ -68,7 +68,7 @@ static void replicate(const Bordered *bordered, // | X X | A B C D E | Y Y | template static void constant(const Bordered *bordered, - intrinsiccv_border_values_t border_values, + kleidicv_border_values_t border_values, TwoDimensional *elements) { ASSERT_LE((bordered->left() + bordered->right()) * elements->channels(), elements->width()); @@ -280,8 +280,8 @@ static void reverse(const Bordered *bordered, } template -void prepare_borders(intrinsiccv_border_type_t border_type, - intrinsiccv_border_values_t border_values, +void prepare_borders(kleidicv_border_type_t border_type, + kleidicv_border_values_t border_values, const Bordered *bordered, TwoDimensional *elements) { ASSERT_NE(bordered, nullptr); @@ -308,8 +308,8 @@ void prepare_borders(intrinsiccv_border_type_t border_type, } } -template void prepare_borders(intrinsiccv_border_type_t, - intrinsiccv_border_values_t, +template void prepare_borders(kleidicv_border_type_t, + kleidicv_border_values_t, const Bordered *, TwoDimensional *); diff --git a/test/framework/border.h b/test/framework/border.h index e17f28ca9..3a4355185 100644 --- a/test/framework/border.h +++ b/test/framework/border.h @@ -6,14 +6,14 @@ #define KLEIDICV_TEST_FRAMEWORK_BORDER_H_ #include "framework/abstract.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" namespace test { // Prepares bordering elements given a border type and bordering requirements. template -void prepare_borders(intrinsiccv_border_type_t border_type, - intrinsiccv_border_values_t border_values, +void prepare_borders(kleidicv_border_type_t border_type, + kleidicv_border_values_t border_values, const Bordered *bordered, TwoDimensional *elements); diff --git a/test/framework/kernel.h b/test/framework/kernel.h index 31986ce43..9fb8f9c98 100644 --- a/test/framework/kernel.h +++ b/test/framework/kernel.h @@ -15,7 +15,7 @@ #include "framework/border.h" #include "framework/generator.h" #include "framework/types.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" namespace test { @@ -83,8 +83,8 @@ class KernelTest { void test(Generator>& kernel_generator, Generator& array_layout_generator, - Generator& border_type_generator, - Generator& border_values_generator, + Generator& border_type_generator, + Generator& border_values_generator, Generator& element_generator) { kernel_generator.reset(); @@ -98,8 +98,8 @@ class KernelTest { void test(Kernel kernel, Generator& array_layout_generator, - Generator& border_type_generator, - Generator& border_values_generator, + Generator& border_type_generator, + Generator& border_values_generator, Generator& element_generator) { array_layout_generator.reset(); @@ -116,12 +116,12 @@ class KernelTest { } void test(Kernel kernel, ArrayLayout array_layout, - Generator& border_type_generator, - Generator& border_values_generator, + Generator& border_type_generator, + Generator& border_values_generator, Generator& element_generator) { border_type_generator.reset(); - std::optional maybe_border_type; + std::optional maybe_border_type; while ((maybe_border_type = border_type_generator.next()) != std::nullopt) { test(kernel, array_layout, *maybe_border_type, border_values_generator, element_generator); @@ -130,11 +130,11 @@ class KernelTest { } void test(Kernel kernel, ArrayLayout array_layout, - intrinsiccv_border_type_t border_type, - Generator& border_values_generator, + kleidicv_border_type_t border_type, + Generator& border_values_generator, Generator& element_generator) { border_values_generator.reset(); - std::optional maybe_border_values; + std::optional maybe_border_values; while ((maybe_border_values = border_values_generator.next()) != std::nullopt) { test(kernel, array_layout, border_type, *maybe_border_values, @@ -144,8 +144,8 @@ class KernelTest { } void test(Kernel kernel, ArrayLayout array_layout, - intrinsiccv_border_type_t border_type, - intrinsiccv_border_values_t border_values, + kleidicv_border_type_t border_type, + kleidicv_border_values_t border_values, Generator& element_generator) { prepare_source(element_generator); prepare_expected(kernel, array_layout, border_type, border_values); @@ -158,10 +158,10 @@ class KernelTest { // Calls the API-under-test in the appropriate way. // // The arguments are never nullptr. - virtual intrinsiccv_error_t call_api( - const Array2D* input, Array2D* output, - intrinsiccv_border_type_t border_type, - intrinsiccv_border_values_t border_values) = 0; + virtual kleidicv_error_t call_api(const Array2D* input, + Array2D* output, + kleidicv_border_type_t border_type, + kleidicv_border_values_t border_values) = 0; // Calculates the expected output. virtual void calculate_expected(const Kernel& kernel, @@ -232,8 +232,8 @@ class KernelTest { // Computes expected output of the kernel-based operation. virtual void prepare_expected(const Kernel& kernel, const ArrayLayout& array_layout, - intrinsiccv_border_type_t border_type, - intrinsiccv_border_values_t border_values) { + kleidicv_border_type_t border_type, + kleidicv_border_values_t border_values) { input_with_borders_.set(kernel.anchor().y, kernel.anchor().x * array_layout.channels, &input_); @@ -262,7 +262,7 @@ class KernelTest { void prepare_actual() { actual_.fill(42); } // Checks that the actual output matches the expectations. - void check_results(intrinsiccv_error_t err) { + void check_results(kleidicv_error_t err) { if (debug_) { std::cout << "[actual]" << std::endl; dump(&actual_); diff --git a/test/framework/operation.h b/test/framework/operation.h index edf9fcbf3..f8e78f90f 100644 --- a/test/framework/operation.h +++ b/test/framework/operation.h @@ -121,10 +121,10 @@ class OperationTest { } // Calls the API-under-test in the appropriate way. - virtual intrinsiccv_error_t call_api() = 0; + virtual kleidicv_error_t call_api() = 0; // Checks that the result meets the expectations. - virtual void check(intrinsiccv_error_t err) { + virtual void check(kleidicv_error_t err) { EXPECT_EQ(KLEIDICV_OK, err); for (size_t index = 0; index < expected_.size(); ++index) { EXPECT_EQ_ARRAY2D(expected_[index], actual_[index]); diff --git a/test/framework/test_kernel.cpp b/test/framework/test_kernel.cpp index 781a47ff7..d3750e49c 100644 --- a/test/framework/test_kernel.cpp +++ b/test/framework/test_kernel.cpp @@ -8,7 +8,7 @@ #include "framework/kernel.h" #include "framework/types.h" -#include "intrinsiccv/intrinsiccv.h" +#include "kleidicv/kleidicv.h" // Tests that the constructor of test::Kernel works for odd width and // height. @@ -93,10 +93,10 @@ class ExampleKernelTest : public test::KernelTest { using IntermediateType = typename KernelTestParams::IntermediateType; using OutputType = typename KernelTestParams::OutputType; - intrinsiccv_error_t call_api( - const test::Array2D *input, test::Array2D *output, - intrinsiccv_border_type_t border_type, - intrinsiccv_border_values_t border_values) override { + kleidicv_error_t call_api(const test::Array2D *input, + test::Array2D *output, + kleidicv_border_type_t border_type, + kleidicv_border_values_t border_values) override { // Check the expected border type. EXPECT_EQ(border_type, kBorders[border_count_ % kBorders.size()]); // Check the expected border value. @@ -149,10 +149,10 @@ class ExampleKernelTest : public test::KernelTest { {9, 7, 11, 3}, }}; - static constexpr std::array kBorders = { + static constexpr std::array kBorders = { KLEIDICV_BORDER_TYPE_REPLICATE, KLEIDICV_BORDER_TYPE_CONSTANT}; - static constexpr std::array kBorderValues = { + static constexpr std::array kBorderValues = { {{0, 0, 0, 0}, {1, 2, 3, 4}}}; size_t api_calls_{0}; diff --git a/test/framework/utils.cpp b/test/framework/utils.cpp index 541c2c7a7..c79ec1335 100644 --- a/test/framework/utils.cpp +++ b/test/framework/utils.cpp @@ -50,7 +50,7 @@ template void dump(const TwoDimensional *); template void dump(const TwoDimensional *); template void dump(const TwoDimensional *); -std::array default_border_values() { +std::array default_border_values() { return {{ {0, 0, 0, 0}, // default }}; diff --git a/test/framework/utils.h b/test/framework/utils.h index 1d1582501..5eefe1fd8 100644 --- a/test/framework/utils.h +++ b/test/framework/utils.h @@ -15,7 +15,7 @@ #include "framework/abstract.h" #include "framework/types.h" -#include "intrinsiccv/ctypes.h" +#include "kleidicv/ctypes.h" #define KLEIDICV_API(name, impl, type) \ template void dump(const TwoDimensional *elements); // Returns default border values. -std::array default_border_values(); +std::array default_border_values(); // Returns an array of just a few small layouts. std::array small_array_layouts(size_t min_width, -- GitLab