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_7X7_H |
6 |
|
|
#define KLEIDICV_FILTER_2D_WINDOW_LOADER_7X7_H |
7 |
|
|
|
8 |
|
|
#include "kleidicv/workspace/border_7x7.h" |
9 |
|
|
|
10 |
|
|
namespace KLEIDICV_TARGET_NAMESPACE { |
11 |
|
|
template <typename SourceType> |
12 |
|
|
class Filter2dWindowLoader7x7 { |
13 |
|
|
public: |
14 |
|
|
using BorderInfoType = |
15 |
|
|
typename KLEIDICV_TARGET_NAMESPACE::FixedBorderInfo7x7<SourceType>; |
16 |
|
|
using BorderOffsets = typename BorderInfoType::Offsets; |
17 |
|
|
|
18 |
|
|
template <typename LoadArrayElementFunctionType, typename KernelWindowFunctor> |
19 |
|
189568 |
static void load_window(KernelWindowFunctor& KernelWindow, |
20 |
|
|
LoadArrayElementFunctionType load_array_element, |
21 |
|
|
Rows<const SourceType> src_rows, |
22 |
|
|
BorderOffsets window_row_offsets, |
23 |
|
|
BorderOffsets window_col_offsets, |
24 |
|
|
size_t index) KLEIDICV_STREAMING { |
25 |
|
|
// first row |
26 |
|
189568 |
KernelWindow(0, 0) = load_array_element( |
27 |
|
189568 |
src_rows.at(window_row_offsets.c0(), window_col_offsets.c0())[index]); |
28 |
|
189568 |
KernelWindow(0, 1) = load_array_element( |
29 |
|
189568 |
src_rows.at(window_row_offsets.c0(), window_col_offsets.c1())[index]); |
30 |
|
189568 |
KernelWindow(0, 2) = load_array_element( |
31 |
|
189568 |
src_rows.at(window_row_offsets.c0(), window_col_offsets.c2())[index]); |
32 |
|
189568 |
KernelWindow(0, 3) = load_array_element( |
33 |
|
189568 |
src_rows.at(window_row_offsets.c0(), window_col_offsets.c3())[index]); |
34 |
|
189568 |
KernelWindow(0, 4) = load_array_element( |
35 |
|
189568 |
src_rows.at(window_row_offsets.c0(), window_col_offsets.c4())[index]); |
36 |
|
189568 |
KernelWindow(0, 5) = load_array_element( |
37 |
|
189568 |
src_rows.at(window_row_offsets.c0(), window_col_offsets.c5())[index]); |
38 |
|
189568 |
KernelWindow(0, 6) = load_array_element( |
39 |
|
189568 |
src_rows.at(window_row_offsets.c0(), window_col_offsets.c6())[index]); |
40 |
|
|
// second row |
41 |
|
189568 |
KernelWindow(1, 0) = load_array_element( |
42 |
|
189568 |
src_rows.at(window_row_offsets.c1(), window_col_offsets.c0())[index]); |
43 |
|
189568 |
KernelWindow(1, 1) = load_array_element( |
44 |
|
189568 |
src_rows.at(window_row_offsets.c1(), window_col_offsets.c1())[index]); |
45 |
|
189568 |
KernelWindow(1, 2) = load_array_element( |
46 |
|
189568 |
src_rows.at(window_row_offsets.c1(), window_col_offsets.c2())[index]); |
47 |
|
189568 |
KernelWindow(1, 3) = load_array_element( |
48 |
|
189568 |
src_rows.at(window_row_offsets.c1(), window_col_offsets.c3())[index]); |
49 |
|
189568 |
KernelWindow(1, 4) = load_array_element( |
50 |
|
189568 |
src_rows.at(window_row_offsets.c1(), window_col_offsets.c4())[index]); |
51 |
|
189568 |
KernelWindow(1, 5) = load_array_element( |
52 |
|
189568 |
src_rows.at(window_row_offsets.c1(), window_col_offsets.c5())[index]); |
53 |
|
189568 |
KernelWindow(1, 6) = load_array_element( |
54 |
|
189568 |
src_rows.at(window_row_offsets.c1(), window_col_offsets.c6())[index]); |
55 |
|
|
// 3 |
56 |
|
189568 |
KernelWindow(2, 0) = load_array_element( |
57 |
|
189568 |
src_rows.at(window_row_offsets.c2(), window_col_offsets.c0())[index]); |
58 |
|
189568 |
KernelWindow(2, 1) = load_array_element( |
59 |
|
189568 |
src_rows.at(window_row_offsets.c2(), window_col_offsets.c1())[index]); |
60 |
|
189568 |
KernelWindow(2, 2) = load_array_element( |
61 |
|
189568 |
src_rows.at(window_row_offsets.c2(), window_col_offsets.c2())[index]); |
62 |
|
189568 |
KernelWindow(2, 3) = load_array_element( |
63 |
|
189568 |
src_rows.at(window_row_offsets.c2(), window_col_offsets.c3())[index]); |
64 |
|
189568 |
KernelWindow(2, 4) = load_array_element( |
65 |
|
189568 |
src_rows.at(window_row_offsets.c2(), window_col_offsets.c4())[index]); |
66 |
|
189568 |
KernelWindow(2, 5) = load_array_element( |
67 |
|
189568 |
src_rows.at(window_row_offsets.c2(), window_col_offsets.c5())[index]); |
68 |
|
189568 |
KernelWindow(2, 6) = load_array_element( |
69 |
|
189568 |
src_rows.at(window_row_offsets.c2(), window_col_offsets.c6())[index]); |
70 |
|
|
// 4 |
71 |
|
189568 |
KernelWindow(3, 0) = load_array_element( |
72 |
|
189568 |
src_rows.at(window_row_offsets.c3(), window_col_offsets.c0())[index]); |
73 |
|
189568 |
KernelWindow(3, 1) = load_array_element( |
74 |
|
189568 |
src_rows.at(window_row_offsets.c3(), window_col_offsets.c1())[index]); |
75 |
|
189568 |
KernelWindow(3, 2) = load_array_element( |
76 |
|
189568 |
src_rows.at(window_row_offsets.c3(), window_col_offsets.c2())[index]); |
77 |
|
189568 |
KernelWindow(3, 3) = load_array_element( |
78 |
|
189568 |
src_rows.at(window_row_offsets.c3(), window_col_offsets.c3())[index]); |
79 |
|
189568 |
KernelWindow(3, 4) = load_array_element( |
80 |
|
189568 |
src_rows.at(window_row_offsets.c3(), window_col_offsets.c4())[index]); |
81 |
|
189568 |
KernelWindow(3, 5) = load_array_element( |
82 |
|
189568 |
src_rows.at(window_row_offsets.c3(), window_col_offsets.c5())[index]); |
83 |
|
189568 |
KernelWindow(3, 6) = load_array_element( |
84 |
|
189568 |
src_rows.at(window_row_offsets.c3(), window_col_offsets.c6())[index]); |
85 |
|
|
// 5 |
86 |
|
189568 |
KernelWindow(4, 0) = load_array_element( |
87 |
|
189568 |
src_rows.at(window_row_offsets.c4(), window_col_offsets.c0())[index]); |
88 |
|
189568 |
KernelWindow(4, 1) = load_array_element( |
89 |
|
189568 |
src_rows.at(window_row_offsets.c4(), window_col_offsets.c1())[index]); |
90 |
|
189568 |
KernelWindow(4, 2) = load_array_element( |
91 |
|
189568 |
src_rows.at(window_row_offsets.c4(), window_col_offsets.c2())[index]); |
92 |
|
189568 |
KernelWindow(4, 3) = load_array_element( |
93 |
|
189568 |
src_rows.at(window_row_offsets.c4(), window_col_offsets.c3())[index]); |
94 |
|
189568 |
KernelWindow(4, 4) = load_array_element( |
95 |
|
189568 |
src_rows.at(window_row_offsets.c4(), window_col_offsets.c4())[index]); |
96 |
|
189568 |
KernelWindow(4, 5) = load_array_element( |
97 |
|
189568 |
src_rows.at(window_row_offsets.c4(), window_col_offsets.c5())[index]); |
98 |
|
189568 |
KernelWindow(4, 6) = load_array_element( |
99 |
|
189568 |
src_rows.at(window_row_offsets.c4(), window_col_offsets.c6())[index]); |
100 |
|
|
// 6 |
101 |
|
189568 |
KernelWindow(5, 0) = load_array_element( |
102 |
|
189568 |
src_rows.at(window_row_offsets.c5(), window_col_offsets.c0())[index]); |
103 |
|
189568 |
KernelWindow(5, 1) = load_array_element( |
104 |
|
189568 |
src_rows.at(window_row_offsets.c5(), window_col_offsets.c1())[index]); |
105 |
|
189568 |
KernelWindow(5, 2) = load_array_element( |
106 |
|
189568 |
src_rows.at(window_row_offsets.c5(), window_col_offsets.c2())[index]); |
107 |
|
189568 |
KernelWindow(5, 3) = load_array_element( |
108 |
|
189568 |
src_rows.at(window_row_offsets.c5(), window_col_offsets.c3())[index]); |
109 |
|
189568 |
KernelWindow(5, 4) = load_array_element( |
110 |
|
189568 |
src_rows.at(window_row_offsets.c5(), window_col_offsets.c4())[index]); |
111 |
|
189568 |
KernelWindow(5, 5) = load_array_element( |
112 |
|
189568 |
src_rows.at(window_row_offsets.c5(), window_col_offsets.c5())[index]); |
113 |
|
189568 |
KernelWindow(5, 6) = load_array_element( |
114 |
|
189568 |
src_rows.at(window_row_offsets.c5(), window_col_offsets.c6())[index]); |
115 |
|
|
// 7 |
116 |
|
189568 |
KernelWindow(6, 0) = load_array_element( |
117 |
|
189568 |
src_rows.at(window_row_offsets.c6(), window_col_offsets.c0())[index]); |
118 |
|
189568 |
KernelWindow(6, 1) = load_array_element( |
119 |
|
189568 |
src_rows.at(window_row_offsets.c6(), window_col_offsets.c1())[index]); |
120 |
|
189568 |
KernelWindow(6, 2) = load_array_element( |
121 |
|
189568 |
src_rows.at(window_row_offsets.c6(), window_col_offsets.c2())[index]); |
122 |
|
189568 |
KernelWindow(6, 3) = load_array_element( |
123 |
|
189568 |
src_rows.at(window_row_offsets.c6(), window_col_offsets.c3())[index]); |
124 |
|
189568 |
KernelWindow(6, 4) = load_array_element( |
125 |
|
189568 |
src_rows.at(window_row_offsets.c6(), window_col_offsets.c4())[index]); |
126 |
|
189568 |
KernelWindow(6, 5) = load_array_element( |
127 |
|
189568 |
src_rows.at(window_row_offsets.c6(), window_col_offsets.c5())[index]); |
128 |
|
189568 |
KernelWindow(6, 6) = load_array_element( |
129 |
|
189568 |
src_rows.at(window_row_offsets.c6(), window_col_offsets.c6())[index]); |
130 |
|
189568 |
} |
131 |
|
|
}; |
132 |
|
|
|
133 |
|
|
} // namespace KLEIDICV_TARGET_NAMESPACE |
134 |
|
|
|
135 |
|
|
#endif // KLEIDICV_FILTER_2D_WINDOW_LOADER_7X7_H |
136 |
|
|
|