Elffuss BraidHub

kikocis/kleidiai public

main · 1.6 KiBRawPermalink
1//
2// SPDX-FileCopyrightText: Copyright 2024-2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
3//
4// SPDX-License-Identifier: Apache-2.0
5//
6
7#pragma once
8
9#include <cstddef>
10#include <cstdint>
11
12#include "test/common/buffer.hpp"
13#include "test/common/data_type.hpp"
14
15namespace kai::test {
16
17/// Pads the rows in matrix.
18/// Works for non-packed and packed using provided strides.
19///
20/// @param[in] data Data buffer.
21/// @param[in] height Number of rows.
22/// @param[in] width Number of columns.
23/// @param[in] src_stride Stride of source buffer.
24/// @param[in] dst_stride Stride for destination buffer.
25/// @param[in] dst_size Size of destination buffer.
26/// @param[in] pad_value Default value for the padding.
27///
28/// @return The padded matrix.
29///
30template <typename T>
31Buffer pad_row(
32 const void* data, size_t height, size_t width, size_t src_stride, size_t dst_stride, size_t dst_size,
33 uint8_t val = 0);
34
35/// Creates a padded matrix from an input matrix.
36///
37/// @param[in] data The input data buffer.
38/// @param[in] height The number of input rows.
39/// @param[in] width The number of input columns.
40/// @param[in] pad_left The number of element padded to the left.
41/// @param[in] pad_top The number of element padded to the top.
42/// @param[in] pad_right The number of element padded to the right.
43/// @param[in] pad_bottom The number of element padded to the bottom.
44/// @param[in] pad_value The padding value.
45///
46/// @return The padded matrix.
47template <typename T>
48Buffer pad_matrix(
49 const void* data, size_t height, size_t width, size_t pad_left, size_t pad_top, size_t pad_right, size_t pad_bottom,
50 T pad_value);
51
52} // namespace kai::test