Arm-2D
2D Image Processing Library for Cortex-M Processors
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: 18. July 2022
26
* $Revision: V.1.0.3
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
#ifdef __cplusplus
38
extern
"C"
{
39
#endif
40
41
/*!
42
* \addtogroup gKernel 1 Kernel
43
* @{
44
*/
45
46
#ifndef __ARM_2D_SKIP_CFG_HEADER__
47
# ifndef __ARM_2D_USER_CFG_HEADER__
48
# include "arm_2d_cfg.h"
49
# else
50
# include __ARM_2D_USER_CFG_HEADER__
51
# endif
52
#endif
53
54
/*============================ MACROS ========================================*/
55
56
#undef __ARM_2D_HAS_HELIUM__
57
#undef __ARM_2D_HAS_HELIUM_INTEGER__
58
#undef __ARM_2D_HAS_HELIUM_FLOAT__
59
60
#if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE
61
# define __ARM_2D_HAS_HELIUM__ 1
62
# define __ARM_2D_HAS_HELIUM_INTEGER__ 1
63
# if (__ARM_FEATURE_MVE & 2)
64
# define __ARM_2D_HAS_HELIUM_FLOAT__ 1
65
# else
66
# define __ARM_2D_HAS_HELIUM_FLOAT__ 0
67
# endif
68
#else
69
# define __ARM_2D_HAS_HELIUM__ 0
70
# define __ARM_2D_HAS_HELIUM_INTEGER__ 0
71
# define __ARM_2D_HAS_HELIUM_FLOAT__ 0
72
#endif
73
74
75
#ifndef __ARM_2D_HAS_CDE__
76
# define __ARM_2D_HAS_CDE__ 0
77
#endif
78
79
#ifndef __ARM_2D_HAS_HW_ACC__
80
# define __ARM_2D_HAS_HW_ACC__ 0
81
#endif
82
#if defined(__ARM_2D_HAS_HW_ACC__) && __ARM_2D_HAS_HW_ACC__
83
# if defined(__ARM_2D_HAS_ASYNC__) && !__ARM_2D_HAS_ASYNC__
84
# warning As long as __ARM_2D_HAS_HW_ACC__ is set to 1,\
85
__ARM_2D_HAS_ASYNC__ is forced to 1. Since you set __ARM_2D_HAS_ASYNC__ to\
86
0, please remove your macro definition for __ARM_2D_HAS_ASYNC__ to avoid this\
87
warning.
88
# endif
89
# undef __ARM_2D_HAS_ASYNC__
90
# define __ARM_2D_HAS_ASYNC__ 1
91
#endif
92
93
#ifndef __ARM_2D_HAS_ASYNC__
94
# define __ARM_2D_HAS_ASYNC__ 1
95
#endif
96
#if defined(__ARM_2D_HAS_ASYNC__) && __ARM_2D_HAS_ASYNC__
97
# if !defined(__ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__) || \
98
__ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ < 4
99
# define __ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ 4
100
# endif
101
#endif
102
103
#undef __ARM_2D_HAS_FPU__
104
#if defined(__ARM_FP)
105
#define __ARM_2D_HAS_FPU__ 1
106
#else
107
#define __ARM_2D_HAS_FPU__ 0
108
#endif
109
110
#undef __ARM_2D_HAS_DSP__
111
#if defined(__ARM_FEATURE_DSP) && __ARM_FEATURE_DSP
112
#define __ARM_2D_HAS_DSP__ 1
113
#else
114
#define __ARM_2D_HAS_DSP__ 0
115
#endif
116
117
#ifndef __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__
118
# ifdef __ARM_2D_HAS_INTERPOLATION_ROTATION__
119
# warning __ARM_2D_HAS_INTERPOLATION_ROTATION__ is deprecated, please use __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ instead.
120
/*! \brief __ARM_2D_HAS_INTERPOLATION_ROTATION__ is deprecated
121
*! add this for backward compatible
122
*/
123
# define __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ \
124
__ARM_2D_HAS_INTERPOLATION_ROTATION__
125
# else
126
# define __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ 0
127
# endif
128
#endif
129
130
131
/*! \note DO NOT define macro __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ unless
132
*! you sure about what you are doing.
133
*/
134
#if !__ARM_2D_HAS_FPU__
135
# undef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
136
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
137
#elif !__ARM_2D_HAS_HELIUM__ \
138
&& !defined(__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__)
139
/*! \note For Armv7-m processors and Armv8-m processors that have no Helium
140
*! extension but only FPU, fixed point rotation is faster than the
141
*! float point rotation even if FPU can accelerate float point
142
*! operations.
143
*/
144
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
145
#endif
146
147
#if __ARM_2D_HAS_HELIUM_INTEGER__ && !__ARM_2D_HAS_HELIUM_FLOAT__
148
# undef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
149
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
150
#endif
151
152
#ifndef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
153
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
154
#endif
155
156
/*! \note In your application, if you do need to use RGBA8888 for some resources
157
*! and you want to use colour channels (e.g. the alpha channel) in mask
158
*! related APIs, please set this macro to 1 in your project.
159
*/
160
#ifndef __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__
161
# define __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__ 1
162
#endif
163
164
/*----------------------------------------------------------------------------*
165
* Unsafe configurations *
166
*----------------------------------------------------------------------------*
167
* Following macro switches are used to improve performance with aggressive *
168
* methods which might cause errors or distortions in some cases. *
169
* Those macros are undefined by defaults. Please use with cautions. *
170
*----------------------------------------------------------------------------*
171
* *
172
* 1. __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ *
173
* This option is used to remove calibration in angle computations to gain *
174
* a better performance, small error might be noticible for angles like *
175
* 90, 180, 270 etc. *
176
* *
177
* 2. __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ *
178
* This option is used to speed up M-cores without DSP support *
179
* It skips saturation in the QADD/QDADD/QDSUB involved in the rotation. *
180
* The chances of overflow remain low as elements involved are using *
181
* non-accumulating Q15.16 format and integer parts are in the range of *
182
* the screen size providing enough margin. *
183
* *
184
* 3. __ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__ *
185
* When define this macro, alpha value 0xFF will not be treated as opaque *
186
* in mask related operations you can barely see the background. Defining *
187
* this macro can get a big performance uplift. *
188
*----------------------------------------------------------------------------*/
189
190
191
/*! \note __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__ is
192
* deprecated.
193
* Please use __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ instead.
194
*/
195
#ifndef __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__
196
# ifdef __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__
197
198
# warning __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__\
199
is deprecated, please use __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__\
200
instead.
201
202
# define __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ \
203
__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__
204
# endif
205
#endif
206
207
/*! \note __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__ is
208
* deprecated.
209
* Please use __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ instead.
210
*/
211
#ifndef __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__
212
# ifdef __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__
213
# warning __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__\
214
is deprecated, please use __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__\
215
instead.
216
217
# define __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ \
218
__ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__
219
#endif
220
#endif
221
222
/*============================ MACROFIED FUNCTIONS ===========================*/
223
/*============================ TYPES =========================================*/
224
/*============================ GLOBAL VARIABLES ==============================*/
225
/*============================ PROTOTYPES ====================================*/
226
227
/*! @} */
228
229
#ifdef __cplusplus
230
}
231
#endif
232
233
#endif
Library
Include
arm_2d_features.h