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