| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-FileCopyrightText: 2025 Arm Limited and/or its affiliates <open-source-office@arm.com> | ||
| 2 | // | ||
| 3 | // SPDX-License-Identifier: Apache-2.0 | ||
| 4 | |||
| 5 | #ifndef KLEIDICV_FILTER_2D_WINDOW_LOADER_3X3_H | ||
| 6 | #define KLEIDICV_FILTER_2D_WINDOW_LOADER_3X3_H | ||
| 7 | |||
| 8 | #include "kleidicv/types.h" | ||
| 9 | #include "kleidicv/workspace/border_3x3.h" | ||
| 10 | |||
| 11 | namespace KLEIDICV_TARGET_NAMESPACE { | ||
| 12 | template <typename SourceType> | ||
| 13 | class Filter2dWindowLoader3x3 { | ||
| 14 | public: | ||
| 15 | using BorderInfoType = | ||
| 16 | typename KLEIDICV_TARGET_NAMESPACE::FixedBorderInfo3x3<SourceType>; | ||
| 17 | using BorderOffsets = typename BorderInfoType::Offsets; | ||
| 18 | |||
| 19 | template <typename LoadArrayElementFunctionType, typename KernelWindowFunctor> | ||
| 20 | 44260 | static void load_window(KernelWindowFunctor& KernelWindow, | |
| 21 | LoadArrayElementFunctionType load_array_element, | ||
| 22 | Rows<const SourceType> src_rows, | ||
| 23 | BorderOffsets window_row_offsets, | ||
| 24 | BorderOffsets window_col_offsets, | ||
| 25 | size_t index) KLEIDICV_STREAMING { | ||
| 26 | 44260 | KernelWindow(0, 0) = load_array_element( | |
| 27 | 44260 | src_rows.at(window_row_offsets.c0(), window_col_offsets.c0())[index]); | |
| 28 | 44260 | KernelWindow(0, 1) = load_array_element( | |
| 29 | 44260 | src_rows.at(window_row_offsets.c0(), window_col_offsets.c1())[index]); | |
| 30 | 44260 | KernelWindow(0, 2) = load_array_element( | |
| 31 | 44260 | src_rows.at(window_row_offsets.c0(), window_col_offsets.c2())[index]); | |
| 32 | |||
| 33 | 44260 | KernelWindow(1, 0) = load_array_element( | |
| 34 | 44260 | src_rows.at(window_row_offsets.c1(), window_col_offsets.c0())[index]); | |
| 35 | 44260 | KernelWindow(1, 1) = load_array_element( | |
| 36 | 44260 | src_rows.at(window_row_offsets.c1(), window_col_offsets.c1())[index]); | |
| 37 | 44260 | KernelWindow(1, 2) = load_array_element( | |
| 38 | 44260 | src_rows.at(window_row_offsets.c1(), window_col_offsets.c2())[index]); | |
| 39 | |||
| 40 | 44260 | KernelWindow(2, 0) = load_array_element( | |
| 41 | 44260 | src_rows.at(window_row_offsets.c2(), window_col_offsets.c0())[index]); | |
| 42 | 44260 | KernelWindow(2, 1) = load_array_element( | |
| 43 | 44260 | src_rows.at(window_row_offsets.c2(), window_col_offsets.c1())[index]); | |
| 44 | 44260 | KernelWindow(2, 2) = load_array_element( | |
| 45 | 44260 | src_rows.at(window_row_offsets.c2(), window_col_offsets.c2())[index]); | |
| 46 | 44260 | } | |
| 47 | |||
| 48 | template <typename LoadArrayElementFunctionType, typename KernelWindowFunctor> | ||
| 49 | 36836 | static void load_window_to_handle_dual_rows( | |
| 50 | KernelWindowFunctor& KernelWindow, | ||
| 51 | LoadArrayElementFunctionType load_array_element, | ||
| 52 | Rows<const SourceType> src_rows, BorderOffsets window_row_offsets_0, | ||
| 53 | BorderOffsets window_row_offsets_1, BorderOffsets window_col_offsets, | ||
| 54 | size_t index) KLEIDICV_STREAMING { | ||
| 55 | 73672 | load_window(KernelWindow, load_array_element, src_rows, | |
| 56 | 36836 | window_row_offsets_0, window_col_offsets, index); | |
| 57 | |||
| 58 | 110508 | KernelWindow(3, 0) = load_array_element(src_rows.at( | |
| 59 | 73672 | window_row_offsets_1.c2() + 1, window_col_offsets.c0())[index]); | |
| 60 | 110508 | KernelWindow(3, 1) = load_array_element(src_rows.at( | |
| 61 | 73672 | window_row_offsets_1.c2() + 1, window_col_offsets.c1())[index]); | |
| 62 | 110508 | KernelWindow(3, 2) = load_array_element(src_rows.at( | |
| 63 | 73672 | window_row_offsets_1.c2() + 1, window_col_offsets.c2())[index]); | |
| 64 | 36836 | } | |
| 65 | }; | ||
| 66 | } // namespace KLEIDICV_TARGET_NAMESPACE | ||
| 67 | |||
| 68 | #endif // KLEIDICV_FILTER_2D_WINDOW_LOADER_3X3_BASE_H | ||
| 69 |