Arm-2D
2D Image Processing Library for Cortex-M Processors
Loading...
Searching...
No Matches
arm_2d_features.h
1
/*
2
* Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*
6
* Licensed under the Apache License, Version 2.0 (the License); you may
7
* not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
14
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*/
18
19
/* ----------------------------------------------------------------------
20
* Project: Arm-2D Library
21
* Title: #include "arm_2d_features.h"
22
* Description: Public header file to indicate features avaialble for this
23
* arm-2d library variant.
24
*
25
* $Date: 24. April 2025
26
* $Revision: V.1.2.0
27
*
28
* Target Processor: Cortex-M cores
29
* -------------------------------------------------------------------- */
30
31
#ifndef __ARM_2D_FEATURES_H__
32
#define __ARM_2D_FEATURES_H__
33
34
/*============================ INCLUDES ======================================*/
35
36
/*!
37
* \addtogroup gKernel 1 Kernel
38
* @{
39
*/
40
41
#ifndef ___ARM_2D_CFG_SKIP_HEADER___
42
# ifndef ___ARM_2D_CFG_HEADER___
43
# include "arm_2d_cfg.h"
44
# else
45
# include ___ARM_2D_CFG_HEADER___
46
# endif
47
#endif
48
49
#ifdef __cplusplus
50
extern
"C"
{
51
#endif
52
53
#if defined(__clang__)
54
# pragma clang diagnostic push
55
# pragma clang diagnostic ignored "-Wunknown-warning-option"
56
# pragma clang diagnostic ignored "-Wreserved-identifier"
57
# pragma clang diagnostic ignored "-Wmicrosoft-anon-tag"
58
# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
59
#endif
60
61
/*============================ MACROS ========================================*/
62
63
#undef __ARM_2D_HAS_HELIUM__
64
#undef __ARM_2D_HAS_HELIUM_INTEGER__
65
#undef __ARM_2D_HAS_HELIUM_FLOAT__
66
67
#if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE
68
# define __ARM_2D_HAS_HELIUM__ 1
//!< target MCU has the Helium extension
69
# define __ARM_2D_HAS_HELIUM_INTEGER__ 1
//!< target MCU has the Helium integer extension
70
# if (__ARM_FEATURE_MVE & 2)
71
# define __ARM_2D_HAS_HELIUM_FLOAT__ 1
//!< target MCU has the Helium floating point extension
72
# else
73
# define __ARM_2D_HAS_HELIUM_FLOAT__ 0
//!< target MCU has does not have Helium floating point extension
74
# endif
75
#else
76
# define __ARM_2D_HAS_HELIUM__ 0
//!< target MCU has does not have Helium extension
77
# define __ARM_2D_HAS_HELIUM_INTEGER__ 0
//!< target MCU has does not have Helium integer extension
78
# define __ARM_2D_HAS_HELIUM_FLOAT__ 0
//!< target MCU has does not have Helium floating point extension
79
#endif
80
81
#if defined(__ARM_NEON) && __ARM_NEON
82
# define __ARM_2D_HAS_NEON__ 1
//!< target processor has the NEON extension
83
#else
84
# define __ARM_2D_HAS_NEON__ 0
//!< target processor does not have NEON extension
85
#endif
86
87
#if defined(__ARM_FEATURE_SVE2) && __ARM_FEATURE_SVE2
88
# define __ARM_2D_HAS_SVE2__ 1
//!< target processor has the SVE2 extension
89
#else
90
# define __ARM_2D_HAS_SVE2__ 0
//!< target processor does not have the SVE2 extension
91
#endif
92
93
#if defined(__ARM_FEATURE_CDE) && __ARM_FEATURE_CDE
94
# define __ARM_2D_HAS_ACI__ 1
//!< target MCU has ACI implementation
95
#else
96
# define __ARM_2D_HAS_ACI__ 0
//!< target MCU has no ACI implementation
97
#endif
98
99
#ifndef __ARM_2D_HAS_TIGHTLY_COUPLED_ACC__
100
# define __ARM_2D_HAS_TIGHTLY_COUPLED_ACC__ 0
//!< target MCU has no tightly coupled acceleration (other than ACI)
101
#endif
102
103
#ifndef __ARM_2D_HAS_HW_ACC__
104
# define __ARM_2D_HAS_HW_ACC__ 0
//!< target MCU has no dedicated hardware (async) acceleration
105
#endif
106
107
#if defined(__ARM_2D_HAS_HW_ACC__) && __ARM_2D_HAS_HW_ACC__
108
# if defined(__ARM_2D_HAS_ASYNC__) && !__ARM_2D_HAS_ASYNC__
109
# warning As long as __ARM_2D_HAS_HW_ACC__ is set to 1,\
110
__ARM_2D_HAS_ASYNC__ is forced to 1. Since you set __ARM_2D_HAS_ASYNC__ to\
111
0, please remove your macro definition for __ARM_2D_HAS_ASYNC__ to avoid this\
112
warning.
113
# endif
114
# undef __ARM_2D_HAS_ASYNC__
115
# define __ARM_2D_HAS_ASYNC__ 1
//!< enable asynchronous mode (enable pipeline)
116
#endif
117
118
#ifndef __ARM_2D_HAS_ASYNC__
119
# define __ARM_2D_HAS_ASYNC__ 1
//!< enable asynchronous mode (enable pipeline)
120
#endif
121
#if defined(__ARM_2D_HAS_ASYNC__) && __ARM_2D_HAS_ASYNC__
122
# if !defined(__ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__) || \
123
__ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ < 4
124
# define __ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ 4
//!< default pool size for sub-tasks
125
# endif
126
#endif
127
128
#undef __ARM_2D_HAS_FPU__
129
#if defined(__ARM_FP)
130
#define __ARM_2D_HAS_FPU__ 1
//!< target MCU has FPU
131
#else
132
#define __ARM_2D_HAS_FPU__ 0
//!< target MCU has no FPU
133
#endif
134
135
#undef __ARM_2D_HAS_DSP__
136
#if defined(__ARM_FEATURE_DSP) && __ARM_FEATURE_DSP
137
#define __ARM_2D_HAS_DSP__ 1
//!< target MCU has a (simple) DSP extension
138
#else
139
#define __ARM_2D_HAS_DSP__ 0
//!< target MCU has no DSP extension
140
#endif
141
142
#ifndef __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__
143
# ifdef __ARM_2D_HAS_INTERPOLATION_ROTATION__
144
# warning __ARM_2D_HAS_INTERPOLATION_ROTATION__ is deprecated, please use __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ instead.
145
/*! \brief __ARM_2D_HAS_INTERPOLATION_ROTATION__ is deprecated
146
*! add this for backward compatible
147
*/
148
149
/*! enable the anti-alias support in transform operations */
150
# define __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ \
151
__ARM_2D_HAS_INTERPOLATION_ROTATION__
152
# else
153
# define __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ 0
//!< disable the anti-alias support in transform operations
154
# endif
155
#endif
156
157
158
/*! \note DO NOT define macro __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ unless
159
*! you sure about what you are doing.
160
*/
161
#if !__ARM_2D_HAS_FPU__
162
# undef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
163
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
//!< use fixed point numbers in transform operations
164
#elif !__ARM_2D_HAS_HELIUM__ \
165
&& !defined(__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__)
166
/*! \note For Armv7-m processors and Armv8-m processors that have no Helium
167
*! extension but only FPU, fixed point rotation is faster than the
168
*! float point rotation even if FPU can accelerate float point
169
*! operations.
170
*/
171
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
//!< use fixed point numbers in transform operations
172
#endif
173
174
#if __ARM_2D_HAS_HELIUM_INTEGER__ && !__ARM_2D_HAS_HELIUM_FLOAT__
175
# undef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
176
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
//!< use fixed point numbers in transform operations
177
#endif
178
179
#ifndef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
180
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
//!< use fixed point numbers in transform operations
181
#endif
182
183
#ifndef __ARM_2D_CFG_OPTIMIZE_FOR_POINTER_LIKE_SHAPES_IN_TRANSFORM__
184
# define __ARM_2D_CFG_OPTIMIZE_FOR_POINTER_LIKE_SHAPES_IN_TRANSFORM__ 1
185
#endif
186
187
/*! \note In your application, if you do need to use RGBA8888 for some resources
188
*! and you want to use colour channels (e.g. the alpha channel) in mask
189
*! related APIs, please set this macro to 1 in your project.
190
*/
191
#ifndef __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__
192
# define __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__ 1
//!< enable the support for CCCA8888
193
#endif
194
195
#ifndef __ARM_2D_CFG_USE_IIR_BLUR_REVERSE_PATH__
196
# define __ARM_2D_CFG_USE_IIR_BLUR_REVERSE_PATH__ 0
197
#endif
198
199
#ifndef __ARM_2D_CFG_SUPPORT_CCCA8888_IMPLICIT_CONVERSION__
200
# define __ARM_2D_CFG_SUPPORT_CCCA8888_IMPLICIT_CONVERSION__ 0
201
#endif
202
203
/*----------------------------------------------------------------------------*
204
* Unsafe configurations *
205
*----------------------------------------------------------------------------*
206
* Following macro switches are used to improve performance with aggressive *
207
* methods which might cause errors or distortions in some cases. *
208
* Those macros are undefined by defaults. Please use with cautions. *
209
*----------------------------------------------------------------------------*
210
* *
211
* 1. __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ *
212
* This option is used to remove calibration in angle computations to gain *
213
* a better performance, small error might be noticible for angles like *
214
* 90, 180, 270 etc. *
215
* *
216
* 2. __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ *
217
* This option is used to speed up M-cores without DSP support *
218
* It skips saturation in the QADD/QDADD/QDSUB involved in the rotation. *
219
* The chances of overflow remain low as elements involved are using *
220
* non-accumulating Q15.16 format and integer parts are in the range of *
221
* the screen size providing enough margin. *
222
* *
223
* 3. __ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__ *
224
* When define this macro, alpha value 0xFF will not be treated as opaque *
225
* in mask related operations you can barely see the background. Defining *
226
* this macro can get a big performance uplift. *
227
*----------------------------------------------------------------------------*/
228
229
230
/*! \note __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__ is
231
* deprecated.
232
* Please use __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ instead.
233
*/
234
#ifndef __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__
235
# ifdef __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__
236
237
# warning __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__\
238
is deprecated, please use __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__\
239
instead.
240
241
/*! disable the small angle calibration in transform operations */
242
# define __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ \
243
__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__
244
# endif
245
#endif
246
247
/*! \note __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__ is
248
* deprecated.
249
* Please use __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ instead.
250
*/
251
#ifndef __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__
252
# ifdef __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__
253
# warning __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__\
254
is deprecated, please use __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__\
255
instead.
256
257
/*! disable the saturation protection in fixed point operations */
258
# define __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ \
259
__ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__
260
#endif
261
#endif
262
263
/*============================ MACROFIED FUNCTIONS ===========================*/
264
/*============================ TYPES =========================================*/
265
/*============================ GLOBAL VARIABLES ==============================*/
266
/*============================ PROTOTYPES ====================================*/
267
268
/*! @} */
269
270
#ifdef __cplusplus
271
}
272
#endif
273
274
275
/*============================ POST INCLUDES =================================*/
276
277
/* include user acceleration header file(s) */
278
#if defined(__ARM_2D_HAS_TIGHTLY_COUPLED_ACC__) && __ARM_2D_HAS_TIGHTLY_COUPLED_ACC__
279
# include "arm_2d_user_sync_acc.h"
280
#endif
281
#if defined(__ARM_2D_HAS_ACI__) && __ARM_2D_HAS_ACI__
282
# include "arm_2d_user_aci.h"
283
#endif
284
#if defined(__ARM_2D_HAS_HW_ACC__) && __ARM_2D_HAS_HW_ACC__
285
# include "arm_2d_user_async_acc.h"
286
#endif
287
288
#endif
Library
Include
arm_2d_features.h