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