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: 4. April 2024
26 * $Revision: V.1.1.1
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
50extern "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 no Helium floating point extension
74# endif
75#else
76# define __ARM_2D_HAS_HELIUM__ 0 //!< target MCU has no Helium extension
77# define __ARM_2D_HAS_HELIUM_INTEGER__ 0 //!< target MCU has no Helium integer extension
78# define __ARM_2D_HAS_HELIUM_FLOAT__ 0 //!< target MCU has no Helium floating point extension
79#endif
80
81#if defined(__ARM_FEATURE_CDE) && __ARM_FEATURE_CDE
82# define __ARM_2D_HAS_ACI__ 1 //!< target MCU has ACI implementation
83#else
84# define __ARM_2D_HAS_ACI__ 0 //!< target MCU has no ACI implementation
85#endif
86
87#ifndef __ARM_2D_HAS_TIGHTLY_COUPLED_ACC__
88# define __ARM_2D_HAS_TIGHTLY_COUPLED_ACC__ 0 //!< target MCU has no tightly coupled acceleration (other than ACI)
89#endif
90
91#ifndef __ARM_2D_HAS_HW_ACC__
92# define __ARM_2D_HAS_HW_ACC__ 0 //!< target MCU has no dedicated hardware (async) acceleration
93#endif
94
95#if defined(__ARM_2D_HAS_HW_ACC__) && __ARM_2D_HAS_HW_ACC__
96# if defined(__ARM_2D_HAS_ASYNC__) && !__ARM_2D_HAS_ASYNC__
97# warning As long as __ARM_2D_HAS_HW_ACC__ is set to 1,\
98 __ARM_2D_HAS_ASYNC__ is forced to 1. Since you set __ARM_2D_HAS_ASYNC__ to\
99 0, please remove your macro definition for __ARM_2D_HAS_ASYNC__ to avoid this\
100 warning.
101# endif
102# undef __ARM_2D_HAS_ASYNC__
103# define __ARM_2D_HAS_ASYNC__ 1 //!< enable asynchronous mode (enable pipeline)
104#endif
105
106#ifndef __ARM_2D_HAS_ASYNC__
107# define __ARM_2D_HAS_ASYNC__ 1 //!< enable asynchronous mode (enable pipeline)
108#endif
109#if defined(__ARM_2D_HAS_ASYNC__) && __ARM_2D_HAS_ASYNC__
110# if !defined(__ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__) || \
111 __ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ < 4
112# define __ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ 4 //!< default pool size for sub-tasks
113# endif
114#endif
115
116#undef __ARM_2D_HAS_FPU__
117#if defined(__ARM_FP)
118#define __ARM_2D_HAS_FPU__ 1 //!< target MCU has FPU
119#else
120#define __ARM_2D_HAS_FPU__ 0 //!< target MCU has no FPU
121#endif
122
123#undef __ARM_2D_HAS_DSP__
124#if defined(__ARM_FEATURE_DSP) && __ARM_FEATURE_DSP
125#define __ARM_2D_HAS_DSP__ 1 //!< target MCU has a (simple) DSP extension
126#else
127#define __ARM_2D_HAS_DSP__ 0 //!< target MCU has no DSP extension
128#endif
129
130#ifndef __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__
131# ifdef __ARM_2D_HAS_INTERPOLATION_ROTATION__
132# warning __ARM_2D_HAS_INTERPOLATION_ROTATION__ is deprecated, please use __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ instead.
133/*! \brief __ARM_2D_HAS_INTERPOLATION_ROTATION__ is deprecated
134 *! add this for backward compatible
135 */
136
137/*! enable the anti-alias support in transform operations */
138# define __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ \
139 __ARM_2D_HAS_INTERPOLATION_ROTATION__
140# else
141# define __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ 0 //!< disable the anti-alias support in transform operations
142# endif
143#endif
144
145
146/*! \note DO NOT define macro __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ unless
147 *! you sure about what you are doing.
148 */
149#if !__ARM_2D_HAS_FPU__
150# undef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
151# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1 //!< use fixed point numbers in transform operations
152#elif !__ARM_2D_HAS_HELIUM__ \
153 && !defined(__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__)
154 /*! \note For Armv7-m processors and Armv8-m processors that have no Helium
155 *! extension but only FPU, fixed point rotation is faster than the
156 *! float point rotation even if FPU can accelerate float point
157 *! operations.
158 */
159# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1 //!< use fixed point numbers in transform operations
160#endif
161
162#if __ARM_2D_HAS_HELIUM_INTEGER__ && !__ARM_2D_HAS_HELIUM_FLOAT__
163# undef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
164# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1 //!< use fixed point numbers in transform operations
165#endif
166
167#ifndef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
168# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1 //!< use fixed point numbers in transform operations
169#endif
170
171#ifndef __ARM_2D_CFG_OPTIMIZE_FOR_POINTER_LIKE_SHAPES_IN_TRANSFORM__
172# define __ARM_2D_CFG_OPTIMIZE_FOR_POINTER_LIKE_SHAPES_IN_TRANSFORM__ 1
173#endif
174
175/*! \note In your application, if you do need to use RGBA8888 for some resources
176 *! and you want to use colour channels (e.g. the alpha channel) in mask
177 *! related APIs, please set this macro to 1 in your project.
178 */
179#ifndef __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__
180# define __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__ 1 //!< enable the support for CCCA8888
181#endif
182
183#ifndef __ARM_2D_CFG_USE_IIR_BLUR_REVERSE_PATH__
184# define __ARM_2D_CFG_USE_IIR_BLUR_REVERSE_PATH__ 0
185#endif
186
187#ifndef __ARM_2D_CFG_SUPPORT_CCCA8888_IMPLICIT_CONVERSION__
188# define __ARM_2D_CFG_SUPPORT_CCCA8888_IMPLICIT_CONVERSION__ 0
189#endif
190
191/*----------------------------------------------------------------------------*
192 * Unsafe configurations *
193 *----------------------------------------------------------------------------*
194 * Following macro switches are used to improve performance with aggressive *
195 * methods which might cause errors or distortions in some cases. *
196 * Those macros are undefined by defaults. Please use with cautions. *
197 *----------------------------------------------------------------------------*
198 * *
199 * 1. __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ *
200 * This option is used to remove calibration in angle computations to gain *
201 * a better performance, small error might be noticible for angles like *
202 * 90, 180, 270 etc. *
203 * *
204 * 2. __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ *
205 * This option is used to speed up M-cores without DSP support *
206 * It skips saturation in the QADD/QDADD/QDSUB involved in the rotation. *
207 * The chances of overflow remain low as elements involved are using *
208 * non-accumulating Q15.16 format and integer parts are in the range of *
209 * the screen size providing enough margin. *
210 * *
211 * 3. __ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__ *
212 * When define this macro, alpha value 0xFF will not be treated as opaque *
213 * in mask related operations you can barely see the background. Defining *
214 * this macro can get a big performance uplift. *
215 *----------------------------------------------------------------------------*/
216
217
218/*! \note __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__ is
219 * deprecated.
220 * Please use __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ instead.
221 */
222#ifndef __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__
223# ifdef __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__
224
225# warning __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__\
226 is deprecated, please use __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__\
227 instead.
228
229/*! disable the small angle calibration in transform operations */
230# define __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ \
231 __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__
232# endif
233#endif
234
235/*! \note __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__ is
236 * deprecated.
237 * Please use __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ instead.
238 */
239#ifndef __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__
240# ifdef __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__
241# warning __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__\
242 is deprecated, please use __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__\
243 instead.
244
245/*! disable the saturation protection in fixed point operations */
246# define __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ \
247 __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__
248#endif
249#endif
250
251/*============================ MACROFIED FUNCTIONS ===========================*/
252/*============================ TYPES =========================================*/
253/*============================ GLOBAL VARIABLES ==============================*/
254/*============================ PROTOTYPES ====================================*/
255
256/*! @} */
257
258#ifdef __cplusplus
259}
260#endif
261
262
263/*============================ POST INCLUDES =================================*/
264
265/* include user acceleration header file(s) */
266#if defined(__ARM_2D_HAS_TIGHTLY_COUPLED_ACC__) && __ARM_2D_HAS_TIGHTLY_COUPLED_ACC__
267# include "arm_2d_user_sync_acc.h"
268#endif
269#if defined(__ARM_2D_HAS_ACI__) && __ARM_2D_HAS_ACI__
270# include "arm_2d_user_aci.h"
271#endif
272#if defined(__ARM_2D_HAS_HW_ACC__) && __ARM_2D_HAS_HW_ACC__
273# include "arm_2d_user_async_acc.h"
274#endif
275
276#endif