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 |
|
35124 |
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 |
|
35124 |
KernelWindow(0, 0) = load_array_element( |
27 |
|
35124 |
src_rows.at(window_row_offsets.c0(), window_col_offsets.c0())[index]); |
28 |
|
35124 |
KernelWindow(0, 1) = load_array_element( |
29 |
|
35124 |
src_rows.at(window_row_offsets.c0(), window_col_offsets.c1())[index]); |
30 |
|
35124 |
KernelWindow(0, 2) = load_array_element( |
31 |
|
35124 |
src_rows.at(window_row_offsets.c0(), window_col_offsets.c2())[index]); |
32 |
|
|
|
33 |
|
35124 |
KernelWindow(1, 0) = load_array_element( |
34 |
|
35124 |
src_rows.at(window_row_offsets.c1(), window_col_offsets.c0())[index]); |
35 |
|
35124 |
KernelWindow(1, 1) = load_array_element( |
36 |
|
35124 |
src_rows.at(window_row_offsets.c1(), window_col_offsets.c1())[index]); |
37 |
|
35124 |
KernelWindow(1, 2) = load_array_element( |
38 |
|
35124 |
src_rows.at(window_row_offsets.c1(), window_col_offsets.c2())[index]); |
39 |
|
|
|
40 |
|
35124 |
KernelWindow(2, 0) = load_array_element( |
41 |
|
35124 |
src_rows.at(window_row_offsets.c2(), window_col_offsets.c0())[index]); |
42 |
|
35124 |
KernelWindow(2, 1) = load_array_element( |
43 |
|
35124 |
src_rows.at(window_row_offsets.c2(), window_col_offsets.c1())[index]); |
44 |
|
35124 |
KernelWindow(2, 2) = load_array_element( |
45 |
|
35124 |
src_rows.at(window_row_offsets.c2(), window_col_offsets.c2())[index]); |
46 |
|
35124 |
} |
47 |
|
|
|
48 |
|
|
template <typename LoadArrayElementFunctionType, typename KernelWindowFunctor> |
49 |
|
29172 |
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 |
|
58344 |
load_window(KernelWindow, load_array_element, src_rows, |
56 |
|
29172 |
window_row_offsets_0, window_col_offsets, index); |
57 |
|
|
|
58 |
|
87516 |
KernelWindow(3, 0) = load_array_element(src_rows.at( |
59 |
|
58344 |
window_row_offsets_1.c2() + 1, window_col_offsets.c0())[index]); |
60 |
|
87516 |
KernelWindow(3, 1) = load_array_element(src_rows.at( |
61 |
|
58344 |
window_row_offsets_1.c2() + 1, window_col_offsets.c1())[index]); |
62 |
|
87516 |
KernelWindow(3, 2) = load_array_element(src_rows.at( |
63 |
|
58344 |
window_row_offsets_1.c2() + 1, window_col_offsets.c2())[index]); |
64 |
|
29172 |
} |
65 |
|
|
}; |
66 |
|
|
} // namespace KLEIDICV_TARGET_NAMESPACE |
67 |
|
|
|
68 |
|
|
#endif // KLEIDICV_FILTER_2D_WINDOW_LOADER_3X3_BASE_H |
69 |
|
|
|