Arm-2D  
2D Image Processing Library for Cortex-M Processors
arm_2d_types.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: arm_2d_types.h
22 * Description: Public header file to contain the Arm-2D structs
23 *
24 * $Date: 29. Aug 2024
25 * $Revision: V.1.2.15
26 *
27 * Target Processor: Cortex-M cores
28 * -------------------------------------------------------------------- */
29
30
31#ifndef __ARM_2D_TYPES_H__
32#define __ARM_2D_TYPES_H__
33
34/*============================ INCLUDES ======================================*/
35#include <string.h>
36#include <stdint.h>
37#include <stdbool.h>
38#include <assert.h>
39#include <inttypes.h>
40
41#include "arm_2d_features.h"
42#include "arm_2d_utils.h"
43#include "__arm_2d_math.h"
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49#if defined(__clang__)
50# pragma clang diagnostic push
51# pragma clang diagnostic ignored "-Wunknown-warning-option"
52# pragma clang diagnostic ignored "-Wreserved-identifier"
53# pragma clang diagnostic ignored "-Wmissing-declarations"
54# pragma clang diagnostic ignored "-Wpadded"
55# pragma clang diagnostic ignored "-Wc11-extensions"
56# pragma clang diagnostic ignored "-Wembedded-directive"
57#elif __IS_COMPILER_ARM_COMPILER_5__
58# pragma diag_suppress 64
59#elif __IS_COMPILER_GCC__
60# pragma GCC diagnostic push
61# pragma GCC diagnostic ignored "-Wmissing-declarations"
62# pragma GCC diagnostic ignored "-Wpadded"
63#endif
64
65/*!
66 * \addtogroup gKernel 1 Kernel
67 * @{
68 */
69
70/*============================ MACROS ========================================*/
71
72/* A patch for GCC support */
73#if defined(__IS_COMPILER_GCC__) && __IS_COMPILER_GCC__ && __ARM_2D_HAS_HELIUM__
74
75# if (__GNUC__ > 13) || \
76 (__GNUC__ == 13 && __GNUC_MINOR__ > 2) || \
77 (__GNUC__ == 13 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >= 1)
78
79 /* require minimal gcc version: 13.2 rel1 */
80# ifndef __ARM_2D_SUPPRESS_GCC_HELIUM_PERFORMANCE_WARNING__
81# pragma GCC warning "GCC only has basic support for Helium and its\
82 performance might highly like disappoint you,You can define a macro\
83 __ARM_2D_SUPPRESS_GCC_HELIUM_PERFORMANCE_WARNING__ to suppress this warning."
84# endif
85
86# ifndef USE_MVE_INTRINSICS
87# define USE_MVE_INTRINSICS
88# endif
89
90# else
91 /* the gcc version is too low to support helium well */
92# ifndef __ARM_2D_SUPPRESS_GCC_HELIUM_PATCH_WARNING__
93# pragma GCC warning "As GCC has compilation issues for supporting Helium,\
94 the scalar version is used. You can define a macro\
95 __ARM_2D_SUPPRESS_GCC_HELIUM_PATCH_WARNING__ to suppress this warning."
96# endif
97
98# undef __ARM_2D_HAS_HELIUM__
99# undef __ARM_2D_HAS_HELIUM_INTEGER__
100# undef __ARM_2D_HAS_HELIUM_FLOAT__
101
102# define __ARM_2D_HAS_HELIUM__ 0 //!< target MCU has no Helium extension
103# define __ARM_2D_HAS_HELIUM_INTEGER__ 0 //!< target MCU has no Helium integer extension
104# define __ARM_2D_HAS_HELIUM_FLOAT__ 0 //!< target MCU has no Helium floating point extension
105
106# endif
107
108#endif
109
110#if defined(__IS_COMPILER_IAR__) && __IS_COMPILER_IAR__
111# ifndef USE_MVE_INTRINSICS
112# define USE_MVE_INTRINSICS
113# endif
114#endif
115
116#if defined(__IS_COMPILER_GCC__) && __IS_COMPILER_GCC__
117# define __va_list va_list
118#endif
119
120#if defined(__IS_COMPILER_LLVM__) && __IS_COMPILER_LLVM__
121# define __va_list va_list
122#endif
123
124#if defined(__IS_COMPILER_IAR__) && __IS_COMPILER_IAR__
125# define __va_list va_list
126#endif
127
128
129/*============================ MACROFIED FUNCTIONS ===========================*/
130/*============================ TYPES =========================================*/
131
132
133/*----------------------------------------------------------------------------*
134 * Infrastructure *
135 *----------------------------------------------------------------------------*/
136
137/*!
138 * \brief finite-state-machine status return (Compatible with arm_status, minimal integer: int8_t)
139 *
140 */
141typedef enum {
142 arm_fsm_rt_err = -1, //!< fsm error
143 arm_fsm_rt_cpl = 0, //!< fsm complete
144 arm_fsm_rt_on_going = 1, //!< fsm on-going
145 arm_fsm_rt_wait_for_obj = 2, //!< fsm wait for IPC object
146 arm_fsm_rt_async = 3, //!< fsm work asynchronously, please check it later.
147 arm_fsm_rt_wait_for_res = 4, //!< wait for resource
149
150/*!
151 * \brief the error code for arm-2d (minimal integer: int8_t)
152 *
153 */
154typedef enum {
155 ARM_2D_ERR_INVALID_STATUS = -13, //!< the target service is in an invalid status for an API
156 ARM_2D_ERR_NOT_AVAILABLE = -12, //!< service is not available or not initialissed
157 ARM_2D_ERR_UNSUPPORTED_COLOUR = -11, //!< the specified colour is not supported
158 ARM_2D_ERR_BUSY = -10, //!< service is busy
159 ARM_2D_ERR_INSUFFICIENT_RESOURCE = -9, //!< insufficient resource
160 ARM_2D_ERR_IO_BUSY = -8, //!< HW accelerator is busy
161 ARM_2D_ERR_IO_ERROR = -7, //!< Generic HW error
162 ARM_2D_ERR_MISSING_PARAM = -6, //!< missing mandatory parameter
163 ARM_2D_ERR_INVALID_OP = -5, //!< unsupported / invalid operation
164 ARM_2D_ERR_NOT_SUPPORT = -4, //!< feature/service/operation is not supported
165 ARM_2D_ERR_OUT_OF_REGION = -3, //!< the operation is out of target area
166 ARM_2D_ERR_INVALID_PARAM = -2, //!< invalid parameter
167 ARM_2D_ERR_UNKNOWN = -1, //!< generic or unknown errors
168 ARM_2D_ERR_NONE = 0, //!< no error
169 ARM_2D_RT_FALSE = 0, //!< false
170 ARM_2D_RT_TRUE = 1, //!< true
172
173/*!
174 * \brief comparison result
175 *
176 */
177typedef enum {
178 ARM_2D_CMP_SMALLER = -1, //!< the target is smaller than the reference
179 ARM_2D_CMP_EQUALS = 0, //!< the target is equal to the reference
180 ARM_2D_CMP_LARGER = 1, //!< the target is larger than the reference
182
183/*----------------------------------------------------------------------------*
184 * Colour definitions *
185 *----------------------------------------------------------------------------*/
186
187/*!
188 * \brief the colour type for gray8 (8bit gray scale)
189 *
190 */
191typedef struct arm_2d_color_gray8_t {
192 uint8_t tValue;
194
195/*!
196 * \brief the colour type for rgb565
197 *
198 */
200 uint16_t tValue;
201 struct {
202 uint16_t u5B : 5;
203 uint16_t u6G : 6;
204 uint16_t u5R : 5;
205 };
207
208/*!
209 * \brief the colour type for brga8888
210 *
211 * \details In most cases four equal-sized pieces of adjacent memory are used,
212 * one for each channel, and a 0 in a channel indicates black color or
213 * transparent alpha, while all-1 bits indicates white or fully opaque
214 * alpha. By far the most common format is to store 8 bits (one byte)
215 * for each channel, which is 32 bits for each pixel.
216 *
217 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
218 */
220 uint32_t tValue;
221 uint8_t chChannel[4];
222 struct {
223 uint32_t u8B : 8;
224 uint32_t u8G : 8;
225 uint32_t u8R : 8;
226 uint32_t u8A : 8;
227 };
229
230/*!
231 * \brief the colour type for rgb888 (compliant with ccca888 and bgra8888)
232 *
233 * \details In most cases four equal-sized pieces of adjacent memory are used,
234 * one for each channel, and a 0 in a channel indicates black color or
235 * transparent alpha, while all-1 bits indicates white or fully opaque
236 * alpha. By far the most common format is to store 8 bits (one byte)
237 * for each channel, which is 32 bits for each pixel.
238 *
239 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
240 */
242 uint32_t tValue;
243 struct {
244 uint32_t u8B : 8;
245 uint32_t u8G : 8;
246 uint32_t u8R : 8;
247 uint32_t : 8;
248 };
250
251/*!
252 * \brief the colour type for any 32bit colour formats which has an alpha channel on its 3rd byte.
253 *
254 * \details In most cases four equal-sized pieces of adjacent memory are used,
255 * one for each channel, and a 0 in a channel indicates black color or
256 * transparent alpha, while all-1 bits indicates white or fully opaque
257 * alpha. By far the most common format is to store 8 bits (one byte)
258 * for each channel, which is 32 bits for each pixel.
259 *
260 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
261 */
263 uint32_t tValue;
264 struct {
265 uint8_t u8C[3];
266 uint8_t u8A;
267 };
269
270/*!
271 * \brief the colour type for any 32bit colour formats which has an alpha channel on its first byte.
272 *
273 * \details In most cases four equal-sized pieces of adjacent memory are used,
274 * one for each channel, and a 0 in a channel indicates black color or
275 * transparent alpha, while all-1 bits indicates white or fully opaque
276 * alpha. By far the most common format is to store 8 bits (one byte)
277 * for each channel, which is 32 bits for each pixel.
278 *
279 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
280 */
282 uint32_t tValue;
283 struct {
284 uint8_t u8A;
285 uint8_t u8C[3];
286 };
288
289/*!
290 * \brief the colour type for any 32bit colour formats which has an unused-alpha channel on its 3rd byte.
291 *
292 * \details In most cases four equal-sized pieces of adjacent memory are used,
293 * one for each channel, and a 0 in a channel indicates black color or
294 * transparent alpha, while all-1 bits indicates white or fully opaque
295 * alpha. By far the most common format is to store 8 bits (one byte)
296 * for each channel, which is 32 bits for each pixel.
297 *
298 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
299 */
301 uint32_t tValue;
302 struct {
303 uint8_t u8C[3];
304 uint8_t : 8;
305 };
307
308/*!
309 * \brief the colour type for any 32bit colour formats which has an unused-alpha channel on its first byte.
310 *
311 * \details In most cases four equal-sized pieces of adjacent memory are used,
312 * one for each channel, and a 0 in a channel indicates black color or
313 * transparent alpha, while all-1 bits indicates white or fully opaque
314 * alpha. By far the most common format is to store 8 bits (one byte)
315 * for each channel, which is 32 bits for each pixel.
316 *
317 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
318 */
320 uint32_t tValue;
321 struct {
322 uint8_t : 8;
323 uint8_t u8C[3];
324 };
326
327
328/*!
329 * \brief the generic type to hold a colour
330 *
331 */
332typedef union arm_2d_colour_t {
333
334 uint32_t wColour;
335 uint16_t hwColour;
336 uint8_t chColour;
337
346
348
349/*!
350 * \brief enumerations for colour attributes
351 */
352enum {
353 ARM_2D_COLOUR_SZ_1BIT = 0, //!< 1 bit:black and white
354 ARM_2D_COLOUR_SZ_2BIT = 1, //!< 4 colours or 4 gray-levels
355 ARM_2D_COLOUR_SZ_4BIT = 2, //!< 16 colours or 16 gray-levels
356 ARM_2D_COLOUR_SZ_8BIT = 3, //!< 256 colours
357 ARM_2D_COLOUR_SZ_16BIT = 4, //!< 16bits
358 ARM_2D_COLOUR_SZ_32BIT = 5, //!< true colour (32bit)
359 ARM_2D_COLOUR_SZ_24BIT = 6, //!< true colour (24bit)
360
361 ARM_2D_COLOUR_SZ_1BIT_msk = ARM_2D_COLOUR_SZ_1BIT << 1,
362 ARM_2D_COLOUR_SZ_2BIT_msk = ARM_2D_COLOUR_SZ_2BIT << 1,
363 ARM_2D_COLOUR_SZ_4BIT_msk = ARM_2D_COLOUR_SZ_4BIT << 1,
364 ARM_2D_COLOUR_SZ_8BIT_msk = ARM_2D_COLOUR_SZ_8BIT << 1,
365 ARM_2D_COLOUR_SZ_16BIT_msk = ARM_2D_COLOUR_SZ_16BIT<< 1,
366 ARM_2D_COLOUR_SZ_32BIT_msk = ARM_2D_COLOUR_SZ_32BIT<< 1,
367 ARM_2D_COLOUR_SZ_24BIT_msk = ARM_2D_COLOUR_SZ_24BIT<< 1,
368 ARM_2D_COLOUR_SZ_msk = (0x07 << 1),
369
370 ARM_2D_COLOUR_LITTLE_ENDIAN = 0,
371 ARM_2D_COLOUR_BIG_ENDIAN = 1,
372
373 ARM_2D_COLOUR_LITTLE_ENDIAN_msk = ARM_2D_COLOUR_LITTLE_ENDIAN << 4,
374 ARM_2D_COLOUR_BIG_ENDIAN_msk = ARM_2D_COLOUR_BIG_ENDIAN << 4,
375
376 ARM_2D_COLOUR_NO_ALPHA = 0,
377 ARM_2D_COLOUR_HAS_ALPHA = 1,
378
379 ARM_2D_COLOUR_NO_ALPHA_msk = ARM_2D_COLOUR_NO_ALPHA << 0,
380 ARM_2D_COLOUR_HAS_ALPHA_msk = ARM_2D_COLOUR_HAS_ALPHA << 0,
381
382 ARM_2D_COLOUR_VARIANT_pos = 5,
383 ARM_2D_COLOUR_VARIANT_msk = 0x07 << ARM_2D_COLOUR_VARIANT_pos,
384};
385
386/* macros for colour attributes */
387#define ARM_2D_M_COLOUR_SZ_1BIT 0 //!< 1 bit:black and white
388#define ARM_2D_M_COLOUR_SZ_2BIT 1 //!< 4 colours or 4 gray-levels
389#define ARM_2D_M_COLOUR_SZ_4BIT 2 //!< 16 colours or 16 gray-levels
390#define ARM_2D_M_COLOUR_SZ_8BIT 3 //!< 256 colours
391#define ARM_2D_M_COLOUR_SZ_16BIT 4 //!< 16bits
392#define ARM_2D_M_COLOUR_SZ_32BIT 5 //!< true colour
393#define ARM_2D_M_COLOUR_SZ_24BIT 6 //!< true colour
394
395#define ARM_2D_M_COLOUR_SZ_1BIT_msk (ARM_2D_M_COLOUR_SZ_1BIT << 1) //!< bitmask for 1bit colour formats
396#define ARM_2D_M_COLOUR_SZ_2BIT_msk (ARM_2D_M_COLOUR_SZ_2BIT << 1) //!< bitmask for 2bit colour formats
397#define ARM_2D_M_COLOUR_SZ_4BIT_msk (ARM_2D_M_COLOUR_SZ_4BIT << 1) //!< bitmask for 4bit colour formats
398#define ARM_2D_M_COLOUR_SZ_8BIT_msk (ARM_2D_M_COLOUR_SZ_8BIT << 1) //!< bitmask for 8bit colour formats
399#define ARM_2D_M_COLOUR_SZ_16BIT_msk (ARM_2D_M_COLOUR_SZ_16BIT<< 1) //!< bitmask for 16bit colour formats
400#define ARM_2D_M_COLOUR_SZ_32BIT_msk (ARM_2D_M_COLOUR_SZ_32BIT<< 1) //!< bitmask for 32bit colour formats
401#define ARM_2D_M_COLOUR_SZ_24BIT_msk (ARM_2D_M_COLOUR_SZ_24BIT<< 1) //!< bitmask for 24bit colour formats
402#define ARM_2D_M_COLOUR_SZ_msk (0x07 << 1), //!< bitmask for the SZ bitfield
403
404#define ARM_2D_M_COLOUR_LITTLE_ENDIAN 0 //!< pixels are stored in little endian
405#define ARM_2D_M_COLOUR_BIG_ENDIAN 1 //!< pixels are stored big endian
406
407#define ARM_2D_M_COLOUR_LITTLE_ENDIAN_msk (ARM_2D_M_COLOUR_LITTLE_ENDIAN << 4)//!< bitmask for little-endian
408#define ARM_2D_M_COLOUR_BIG_ENDIAN_msk (ARM_2D_M_COLOUR_BIG_ENDIAN << 4)//!< bitmask for big-endian
409
410#define ARM_2D_M_COLOUR_NO_ALPHA 0 //!< there is no alpha channel in each pixel
411#define ARM_2D_M_COLOUR_HAS_ALPHA 1 //!< there is an alpha channel in each pixel
412
413#define ARM_2D_M_COLOUR_NO_ALPHA_msk (ARM_2D_M_COLOUR_NO_ALPHA << 0) //!< bitmask for no-alpha-channel-in-pixel
414#define ARM_2D_M_COLOUR_HAS_ALPHA_msk (ARM_2D_M_COLOUR_HAS_ALPHA << 0) //!< bitmask for has-alpha-channel-in-pixel
415
416#define ARM_2D_M_COLOUR_VARIANT_pos 5 //!< offset for the VARIANT bitfield
417#define ARM_2D_M_COLOUR_VARIANT_msk (0x07<<ARM_2D_M_COLOUR_VARIANT_pos) //!< bitmask for the VARIANT bitfield
418
419/*!
420 * \brief enumerations for colour types
421 *
422 */
423enum {
424 ARM_2D_COLOUR_MONOCHROME = ARM_2D_COLOUR_SZ_1BIT_msk,
425 ARM_2D_COLOUR_BIN = ARM_2D_COLOUR_SZ_1BIT_msk,
426 ARM_2D_COLOUR_1BIT = ARM_2D_COLOUR_SZ_1BIT_msk,
427
428 ARM_2D_COLOUR_MASK_A1 = ARM_2D_M_COLOUR_SZ_1BIT_msk,
429 ARM_2D_COLOUR_MASK_A2 = ARM_2D_M_COLOUR_SZ_2BIT_msk,
430 ARM_2D_COLOUR_MASK_A4 = ARM_2D_M_COLOUR_SZ_4BIT_msk,
431
432 ARM_2D_COLOUR_2BIT = ARM_2D_M_COLOUR_SZ_2BIT_msk,
433 ARM_2D_COLOUR_4BIT = ARM_2D_M_COLOUR_SZ_4BIT_msk,
434
435 ARM_2D_COLOUR_8BIT = ARM_2D_COLOUR_SZ_8BIT_msk,
436 ARM_2D_COLOUR_GRAY8 = ARM_2D_COLOUR_SZ_8BIT_msk,
437 ARM_2D_COLOUR_MASK_A8 = ARM_2D_COLOUR_SZ_8BIT_msk,
438
439 ARM_2D_COLOUR_16BIT = ARM_2D_COLOUR_SZ_16BIT_msk,
440 ARM_2D_COLOUR_RGB16 = ARM_2D_COLOUR_SZ_16BIT_msk,
441 ARM_2D_COLOUR_RGB565 = ARM_2D_COLOUR_RGB16,
442
443/* won't support
444 ARM_2D_COLOUR_RGB565_BE = ARM_2D_COLOUR_SZ_16BIT_msk |
445 ARM_2D_COLOUR_BIG_ENDIAN_msk ,
446 */
447
448 ARM_2D_COLOUR_24BIT = ARM_2D_COLOUR_SZ_24BIT_msk , /* not supported yet */
449 ARM_2D_COLOUR_RGB24 = ARM_2D_COLOUR_SZ_24BIT_msk , /* not supported yet */
450
451 ARM_2D_COLOUR_32BIT = ARM_2D_COLOUR_SZ_32BIT_msk ,
452 ARM_2D_COLOUR_RGB32 = ARM_2D_COLOUR_SZ_32BIT_msk ,
453
454 ARM_2D_COLOUR_CCCN888 = ARM_2D_COLOUR_RGB32 ,
455 ARM_2D_COLOUR_CCCA8888 = ARM_2D_COLOUR_SZ_32BIT_msk |
456 ARM_2D_COLOUR_HAS_ALPHA_msk ,
457
458 ARM_2D_COLOUR_RGB888 = ARM_2D_COLOUR_CCCN888 ,
459 ARM_2D_COLOUR_BGRA8888 = ARM_2D_COLOUR_CCCA8888 ,
460
461/* not supported yet
462 ARM_2D_COLOUR_NCCC888 = ARM_2D_COLOUR_RGB32 |
463 ARM_2D_COLOUR_BIG_ENDIAN_msk ,
464 ARM_2D_COLOUR_ACCC8888 = ARM_2D_COLOUR_SZ_32BIT_msk |
465 ARM_2D_COLOUR_HAS_ALPHA_msk |
466 ARM_2D_COLOUR_BIG_ENDIAN_msk ,
467*/
468
469 ARM_2D_CHANNEL_8in32 = ARM_2D_COLOUR_SZ_32BIT_msk |
470 ARM_2D_COLOUR_HAS_ALPHA_msk |
471 ARM_2D_COLOUR_VARIANT_msk ,
472};
473
474/* macros for colour formats */
475#define ARM_2D_M_COLOUR_MONOCHROME ARM_2D_M_COLOUR_SZ_1BIT_msk //!< macro for the monochrome
476#define ARM_2D_M_COLOUR_BIN ARM_2D_M_COLOUR_SZ_1BIT_msk //!< macro for the 1bit colour format (alias)
477#define ARM_2D_M_COLOUR_1BIT ARM_2D_M_COLOUR_SZ_1BIT_msk //!< macro for the 1bin colour format (alias)
478
479#define ARM_2D_M_COLOUR_MASK_A1 ARM_2D_M_COLOUR_SZ_1BIT_msk //!< macro for the 1bit alpha mask
480#define ARM_2D_M_COLOUR_MASK_A2 ARM_2D_M_COLOUR_SZ_2BIT_msk //!< macro for the 2bit alpha mask
481#define ARM_2D_M_COLOUR_MASK_A4 ARM_2D_M_COLOUR_SZ_4BIT_msk //!< macro for the 4bit alpha mask
482
483#define ARM_2D_M_COLOUR_8BIT ARM_2D_M_COLOUR_SZ_8BIT_msk //!< macro for the generic 8bit colour formats
484#define ARM_2D_M_COLOUR_GRAY8 ARM_2D_M_COLOUR_SZ_8BIT_msk //!< macro for the gray8 colour format
485#define ARM_2D_M_COLOUR_MASK_A8 ARM_2D_M_COLOUR_SZ_8BIT_msk //!< macro for the 8bit alpha mask
486
487#define ARM_2D_M_COLOUR_16BIT ARM_2D_M_COLOUR_SZ_16BIT_msk //!< macro for the generic 16bit colour formats
488#define ARM_2D_M_COLOUR_RGB16 ARM_2D_M_COLOUR_SZ_16BIT_msk //!< macro for the generic 16bit colour formats
489#define ARM_2D_M_COLOUR_RGB565 ARM_2D_M_COLOUR_RGB16 //!< macro for the rgb565
490
491/* won't support
492#define ARM_2D_M_COLOUR_RGB565_BE ( ARM_2D_M_COLOUR_SZ_16BIT_msk \
493 | ARM_2D_M_COLOUR_BIG_ENDIAN_msk )
494 */
495
496#define ARM_2D_M_COLOUR_24BIT ARM_2D_M_COLOUR_SZ_24BIT_msk //!< macro for the generic 24bit colour formats
497#define ARM_2D_M_COLOUR_RGB24 ARM_2D_M_COLOUR_SZ_24BIT_msk //!< macro for the generic 24bit colour formats
498
499#define ARM_2D_M_COLOUR_32BIT ARM_2D_M_COLOUR_SZ_32BIT_msk //!< macro for the generic 32bit colour formats
500#define ARM_2D_M_COLOUR_RGB32 ARM_2D_M_COLOUR_SZ_32BIT_msk //!< macro for the generic 32bit colour formats
501
502#define ARM_2D_M_COLOUR_CCCN888 ARM_2D_M_COLOUR_RGB32 //!< macro for the generic 32bit colour formats with an reserved channel at the highest byte
503
504/*! macro for the generic 32bit colour formats with an alpha channel at the highest byte */
505#define ARM_2D_M_COLOUR_CCCA8888 ( ARM_2D_M_COLOUR_SZ_32BIT_msk \
506 | ARM_2D_M_COLOUR_HAS_ALPHA_msk)
507
508#define ARM_2D_M_COLOUR_RGBX888 ARM_2D_M_COLOUR_CCCN888 //!< macro for the RGB888 (BGRN8888)
509#define ARM_2D_M_COLOUR_BGRA8888 ARM_2D_M_COLOUR_CCCA8888 //!< macro for the BGRA8888
510
511/* not supported yet
512#define ARM_2D_M_COLOUR_NCCC888 ( ARM_2D_M_COLOUR_RGB32 \
513 | ARM_2D_M_COLOUR_BIG_ENDIAN_msk )
514#define ARM_2D_M_COLOUR_ACCC8888 ( ARM_2D_M_COLOUR_SZ_32BIT_msk \
515 | ARM_2D_M_COLOUR_HAS_ALPHA_msk \
516 | ARM_2D_M_COLOUR_BIG_ENDIAN_msk )
517*/
518/*! macro for a special colour format which access only one channel in RGB32 */
519#define ARM_2D_M_CHANNEL_8in32 ( ARM_2D_M_COLOUR_SZ_32BIT_msk \
520 | ARM_2D_M_COLOUR_HAS_ALPHA_msk) \
521 | ARM_2D_M_COLOUR_VARIANT_msk )
522
523/*!
524 * \brief a type used as colour descriptor
525 *
526 */
527typedef union {
528 struct {
529 uint8_t bHasAlpha : 1; //!< whether the target colour has alpha channel
530 uint8_t u3ColourSZ : 3; //!< the size of the colour
531 uint8_t bBigEndian : 1; //!< whether the colour is stored in big endian
532 uint8_t u2Variant : 2;
533 uint8_t : 1;
534 };
535 struct {
536 uint8_t u7ColourFormat : 7;
537 uint8_t : 1;
538 };
539 uint8_t chScheme;
541
542/*----------------------------------------------------------------------------*
543 * Tile and Regions *
544 *----------------------------------------------------------------------------*/
545
546/*!
547 * \brief a type for coordinates (integer)
548 *
549 */
550typedef struct arm_2d_location_t {
551 int16_t iX; //!< x in Cartesian coordinate system
552 int16_t iY; //!< y in Cartesian coordinate system
554
555/*!
556 * \brief a type for coordinates in floating point
557 *
558 */
559typedef struct arm_2d_point_float_t {
560 float fX; //!< x in Cartesian coordinate system
561 float fY; //!< y in Cartesian coordinate system
563
564/*!
565 * \brief a type for coordinates in fixed point
566 *
567 */
568typedef struct arm_2d_point_fx_t {
569 int32_t X; //!< x in Cartesian coordinate system
570 int32_t Y; //!< y in Cartesian coordinate system
572
573/*!
574 * \brief a type for the size of an rectangular area
575 *
576 */
577typedef struct arm_2d_size_t {
578 int16_t iWidth; //!< width of an rectangular area
579 int16_t iHeight; //!< height of an rectangular area
581
582/*!
583 * \brief a type for an rectangular area
584 *
585 */
586typedef struct arm_2d_region_t {
587 implement_ex(arm_2d_location_t, tLocation); //!< the location (top-left corner)
588 implement_ex(arm_2d_size_t, tSize); //!< the size
590
591/*!
592 * \brief the tile extension ID
593 *
594 */
595enum {
596 ARM_2D_TILE_EXTENSION_NONE = 0, //!< no extension in the tile.tInfo.Extension field
597 ARM_2D_TILE_EXTENSION_PFB, //!< contains PFB extension information
598 ARM_2D_TILE_EXTENSION_VRES, //!< contains Virtual resource extension information
599};
600
601/*!
602 * \brief a type for tile
603 *
604 */
605typedef struct arm_2d_tile_t arm_2d_tile_t;
607 implement_ex(struct {
608 uint8_t bIsRoot : 1; //!< is this tile a root tile
609 uint8_t bHasEnforcedColour : 1; //!< does this tile contains enforced colour info
610 uint8_t bDerivedResource : 1; //!< indicate whether this is a derived resources (when bIsRoot == 0)
611 uint8_t bVirtualResource : 1; //!< indicate whether the resource should be loaded on-demand
612 uint8_t bVirtualScreen : 1; //!< DO NOT USE! indicate whether the tile is considered as the virtual screen, it is used in dirty region calculation
613 uint8_t u3ExtensionID : 3; //!< Tile Extension ID
614 arm_2d_color_info_t tColourInfo; //!< enforced colour
615
616 union {
617 uint16_t : 16;
618 struct {
619 uint8_t bIsNewFrame : 1;
620 uint8_t bIsDryRun : 1;
621 }PFB;
622 struct {
623 int16_t iTargetStride;
624 }VRES;
625 } Extension;
626
627 }, tInfo);
628
629 implement_ex(arm_2d_region_t, tRegion); //!< the region of the tile
630
631 union {
632 /* when bIsRoot is true, phwBuffer is available,
633 * otherwise ptParent is available
634 */
635 arm_2d_tile_t *ptParent; //!< a pointer points to the parent tile
636 uint8_t *pchBuffer; //!< a pointer points to a buffer in a 8bit colour type
637 uint16_t *phwBuffer; //!< a pointer points to a buffer in a 16bit colour type
638 uint32_t *pwBuffer; //!< a pointer points to a buffer in a 32bit colour type
639
640 intptr_t nAddress; //!< a pointer in integer
641 };
642};
643
644/*----------------------------------------------------------------------------*
645 * Misc *
646 *----------------------------------------------------------------------------*/
647
648/*!
649 * \brief alignment
650 */
651typedef enum {
652 ARM_2D_ALIGN_LEFT = _BV(0), /*!< align to left */
653 ARM_2D_ALIGN_RIGHT = _BV(1), /*!< align to right */
654 ARM_2D_ALIGN_TOP = _BV(2), /*!< align to top */
655 ARM_2D_ALIGN_BOTTOM = _BV(3), /*!< align to bottom */
656
657 ARM_2D_ALIGN_CENTRE = 0, /*!< align to centre */
658 ARM_2D_ALIGN_CENTRE_ALIAS = ARM_2D_ALIGN_LEFT /*!< align to centre */
662
663 ARM_2D_ALIGN_TOP_LEFT = ARM_2D_ALIGN_TOP /*!< align to top left corner */
665 ARM_2D_ALIGN_TOP_RIGHT = ARM_2D_ALIGN_TOP /*!< align to top right corner */
667 ARM_2D_ALIGN_TOP_MIDDLE = ARM_2D_ALIGN_TOP /*!< align to the middle of the top */
670 ARM_2D_ALIGN_TOP_CENTRE = ARM_2D_ALIGN_TOP_MIDDLE,
671
672 ARM_2D_ALIGN_BOTTOM_LEFT = ARM_2D_ALIGN_BOTTOM /*!< align to bottom left corner */
674 ARM_2D_ALIGN_BOTTOM_RIGHT = ARM_2D_ALIGN_BOTTOM /*!< align to bottom right corner */
676 ARM_2D_ALIGN_BOTTOM_MIDDLE = ARM_2D_ALIGN_BOTTOM /*!< align to the middle of the bottom */
679 ARM_2D_ALIGN_BOTTOM_CENTRE = ARM_2D_ALIGN_TOP_MIDDLE,
680
681 ARM_2D_ALIGN_MIDDLE_LEFT = ARM_2D_ALIGN_LEFT /*!< align to the middle of the left side */
684 ARM_2D_ALIGN_MIDDLE_RIGHT = ARM_2D_ALIGN_RIGHT /*!< align to the middle of the right side */
688
689/*!
690 * \brief the margin inside a region / container
691 */
692typedef struct arm_2d_margin_t {
693 uint8_t chLeft; /*!< left margin */
694 uint8_t chRight; /*!< right margin */
695 uint8_t chTop; /*!< top margin */
696 uint8_t chBottom; /*!< bottom margin */
698
699/*!
700 * \brief the padding between rectanglar areas
701 */
702typedef struct arm_2d_padding_t {
703 int8_t chLeft; /*!< left padding */
704 int8_t chRight; /*!< right padding */
705 int8_t chTop; /*!< top padding */
706 int8_t chBottom; /*!< bottom padding */
708
709/*!
710 * \brief type for 4 points alpha sample points
711 *
712 */
714 struct {
715 uint8_t chTopLeft;
716 uint8_t chTopRight;
717 uint8_t chBottomLeft;
718 uint8_t chBottomRight;
719 };
720 uint8_t chAlpha[4];
722
723/*!
724 * \brief type for 3 points alpha sample points
725 *
726 */
728 struct {
729 uint8_t chTopLeft;
730 uint8_t chTopRight;
731 uint8_t chBottomLeft;
732 };
733 uint8_t chAlpha[3];
735
736/*!
737 * \brief type for 2 points alpha sample points
738 *
739 */
741 struct {
742 uint8_t chLeft; /* chTopLeft */
743 uint8_t chRight; /* chTopRight */
744 };
745 struct {
746 uint8_t chTopLeft;
747 union {
748 uint8_t chTopRight;
749 uint8_t chBottomLeft;
750 };
751 };
752 struct {
753 uint8_t chTop; /* chTopLeft */
754 uint8_t chBottom; /* chBottomLeft */
755 };
756 uint8_t chAlpha[2];
758
759/*!
760 * \brief the enumeration type for describing memory types
761 *
762 */
763typedef enum {
764 ARM_2D_MEM_TYPE_UNSPECIFIED, //!< normal memory, we don't know its characterisics
765 ARM_2D_MEM_TYPE_SLOW, //!< for slow memories, such as SDRAM, DDRAM, external memory etc
766 ARM_2D_MEM_TYPE_FAST, //!< for fast memories, such as TCM, SRAM etc.
768
769typedef union __arm_2d_mem_info_t {
770 struct {
771 uint32_t u24SizeInByte : 24; //!< the memory size in Byte
772 uint32_t u2ItemSize : 3; //!< the size of the data item
773 uint32_t u2Align : 3; //!< the alignment
774 uint32_t u2Type : 2; //!< The memory type define in enum arm_2d_mem_type_t
775 };
776 uint32_t Value; //!< Memory Information
778
779/*!
780 * \brief scratch memory descriptor
781 * \note "manually" derived from __arm_2d_mem_info_t
782 */
783typedef struct arm_2d_scratch_mem_t {
784 implement_ex(union {
785 struct {
786 uint32_t u24SizeInByte : 24; //!< the memory size in Byte
787 uint32_t u2ItemSize : 3; //!< the size of the data item
788 uint32_t u2Align : 3; //!< the alignment
789 uint32_t u2Type : 2; //!< The memory type define in enum arm_2d_mem_type_t
790 };
791 uint32_t Value; //!< Memory Information
792 }, tInfo);
793
794 uintptr_t pBuffer;
796
797/*!
798 * \brief a type for scratch memory blocks
799 *
800 */
801typedef struct __arm_2d_mem_t __arm_2d_mem_t;
803 union {
804 __arm_2d_mem_t *ptNext; //!< a list pointer
805 uint32_t wSignature; //!< a signature for validation
806 };
807 __arm_2d_mem_info_t tInfo; //!< memory info
808 uint8_t pBuffer[]; //!< a constant pointer points to the buffer following this header
809};
810
811
812/*!
813 * \brief a type for virtual resource
814 *
815 * \note the flag tTile.tInfo.bVirtualResource must be true (1)
816 */
817typedef struct arm_2d_vres_t arm_2d_vres_t;
819
820 /*! base class: tTile */
822
823 /*! a reference of an user object */
824 uintptr_t pTarget;
825
826 /*!
827 * \brief a method to load a specific part of an image
828 * \param[in] pTarget a reference of an user object
829 * \param[in] ptVRES a reference of this virtual resource
830 * \param[in] ptRegion the target region of the image
831 * \return intptr_t the address of a resource buffer which holds the content
832 */
833 intptr_t (*Load) ( uintptr_t pTarget,
834 arm_2d_vres_t *ptVRES,
835 arm_2d_region_t *ptRegion);
836
837 /*!
838 * \brief a method to despose the buffer
839 * \param[in] pTarget a reference of an user object
840 * \param[in] ptVRES a reference of this virtual resource
841 * \param[in] pBuffer the target buffer
842 */
843 void (*Depose) ( uintptr_t pTarget,
844 arm_2d_vres_t *ptVRES,
845 intptr_t pBuffer );
846};
847
848/*----------------------------------------------------------------------------*
849 * Task *
850 *----------------------------------------------------------------------------*/
851
852/*!
853 * \brief arm-2d application level task control block
854 *
855 */
856typedef struct arm_2d_task_t {
857ARM_PRIVATE(
858 arm_fsm_rt_t tResult; //!< the temporary result of the task
859 uint8_t chState; //!< the state of the FSM
860
861 void *ptTask; //!< a pointer for an internal object
864
865/*----------------------------------------------------------------------------*
866 * Operation and Events Handling *
867 *----------------------------------------------------------------------------*/
868
869
871
872/*!
873 * \brief a prototype of event handlers for 2D operations
874 *
875 * \param[in] ptThisOP the target 2D operation descriptor
876 * \param[in] tResult the operation result
877 * \param[in] pTarget A user attached object
878 * \return bool a boolean value to indicate whether the event has been handled
879 */
881 arm_fsm_rt_t tResult,
882 void *pTarget);
883
884/*!
885 * \brief a type for 2D operation event handling
886 *
887 */
888typedef struct arm_2d_op_evt_t {
890 void *pTarget; //!< user attached target
892
893/*!
894 * \brief a prototype for generic event handlers
895 *
896 * \param pTarget A user attached object
897 * \return bool a boolean value to indicate whether the event has been handled
898 */
899typedef bool arm_2d_evt_handler_t(void *pTarget);
900
901/*!
902 * \brief a type for generic event handling
903 *
904 */
905typedef struct arm_2d_evt_t {
906 arm_2d_evt_handler_t *fnHandler; //!< event handler
907 void *pTarget; //!< user attached target
909
910
911#define ARM_2D_OP_INFO_PARAM_HAS_SOURCE _BV(0) //!< opcode has source tile info
912#define ARM_2D_OP_INFO_PARAM_HAS_TARGET _BV(1) //!< opcode has target tile info
913#define ARM_2D_OP_INFO_PARAM_HAS_SOURCE_MASK _BV(2) //!< opcode has source mask info
914#define ARM_2D_OP_INFO_PARAM_HAS_TARGET_MASK _BV(3) //!< opcode has target mask info
915#define ARM_2D_OP_INFO_PARAM_HAS_ORIGIN _BV(4) //!< opcode has original tile info
916
917/*! a bitmask for INFO_PARAM_HAS_xxxx bitfields */
918#define ARM_2D_OP_INFO_PARAM_TILES_MASK ( \
919 ARM_2D_OP_INFO_PARAM_HAS_SOURCE | \
920 ARM_2D_OP_INFO_PARAM_HAS_TARGET | \
921 ARM_2D_OP_INFO_PARAM_HAS_SOURCE_MASK | \
922 ARM_2D_OP_INFO_PARAM_HAS_TARGET_MASK | \
923 ARM_2D_OP_INFO_PARAM_HAS_ORIGIN )
924
925
926//! \brief an incomplete defintion which is only used for defining pointers
928
929/*!
930 * \brief A descriptive header for 2D operations
931 */
932typedef union __arm_2d_op_info_t {
933 struct {
934 arm_2d_color_info_t Colour; //!< the colour used in thie operation
935 union {
936 struct {
937 uint8_t bHasSource : 1; //!< whether this operation contains source tile
938 uint8_t bHasTarget : 1; //!< whether this operation contains target tile
939 uint8_t bHasSrcMask : 1; //!< whether this operation has Mask layer for source tile
940 uint8_t bHasDesMask : 1; //!< whether this operation has Mask layer for target tile
941 uint8_t bHasOrigin : 1; //!< whether the Source has an origin tile
942 uint8_t : 2;
943 uint8_t bAllowEnforcedColour : 1; //!< whether this operation allow enforced colours in tiles
944 };
945 uint8_t chValue; //!< feature value
946 }Param; //!< operation feature set
947
948 uint8_t chInClassOffset; //!< some operation uses this as the offset of the key member in the class
949 uint8_t chOpIndex; //!< __ARM_2D_OP_IDX_XXXXXX
950
951 union {
952 struct {
953 uint8_t CopyLike; //!< A copy-like interface contains the target tile, the source tile and the copy size
954 uint8_t FillLike; //!< A copy-like interface contains the target tile and the source tile
955 };
956 struct {
957 uint8_t CopyOrigLike; //!< A copy-like interface contains the target tile, the dummy tile, the reference to the original source tile and the copy size
958 uint8_t FillOrigLike; //!< A copy-like interface contains the target tile, the dummy tile and the reference to the original source tile
959 };
960 struct {
961 uint8_t TileProcessLike; //!< A simple interface contains only the target tile
962 };
963 }LowLevelInterfaceIndex; //!< Low level interface index
964
965 union {
966 const __arm_2d_low_level_io_t *IO[2]; //!< array of IOs
967
968 struct {
969 const __arm_2d_low_level_io_t *ptCopyLike; //!< the function pointer for a copy-like implementation
970 const __arm_2d_low_level_io_t *ptFillLike; //!< the function pointer for a fill-like implementation
971 };
972 struct {
973 const __arm_2d_low_level_io_t *ptCopyOrigLike; //!< the function pointer for a copy-orig-like implementation
974 const __arm_2d_low_level_io_t *ptFillOrigLike; //!< the function pointer for a fill-orig-like implementation
975 };
976 struct {
977 const __arm_2d_low_level_io_t *ptTileProcessLike; //!< the function pointer for the tile-process-like implementation
978 };
979 }LowLevelIO; //!< low level IO definition
980
981 }Info; //!< operation description
982 uint32_t wID; //!< Operation ID
984
985/*!
986 * \brief how would you want to accelerate the 2d-operation
987 */
988enum {
989 //! Use hardware acceleration if possible, even if there is a long queue to wait
991
992 //! Only use Hardware Acceleration, if it is not supported, IO error will be issued
994
995 //! Only use software algorithm
997
998 //!< don't care, let the arm-2d library decide
999 ARM_2D_PREF_ACC_DONT_CARE = 3,
1000};
1001
1002#define __ARM_2D_OP_STATUS_BUSY_msk (1 << 4) //!< bitmask for the busy flag
1003#define __ARM_2D_OP_STATUS_IO_ERROR_msk (1 << 5) //!< bitmask for the IO error flag
1004#define __ARM_2D_OP_STATUS_CPL_msk (1 << 6) //!< bitmask for the complete flag
1005
1006/*!
1007 * \brief a type for 2D operation status
1008 *
1009 */
1010typedef union arm_2d_op_status_t {
1011 struct {
1012 uint16_t u4SubTaskCount : 4; //!< sub task count
1013 uint16_t bIsBusy : 1; //!< busy flag
1014 uint16_t bIOError : 1; //!< HW IO Error
1015 uint16_t bOpCpl : 1; //!< the whole operation complete
1016 uint16_t : 9; //!< reserved
1017 };
1018 uint16_t tValue; //!< the host integer
1020
1021/*!
1022 * \brief the abstract class of 2D operations
1023 *
1024 */
1026ARM_PRIVATE(
1027 arm_2d_op_core_t *ptNext; //!< a pointer for a single list
1028
1029 const __arm_2d_op_info_t *ptOp; //!< the pointer for the corresponding 2D operation description
1030
1031 struct {
1032 uint8_t u2ACCMethods : 2; //!< acceleration Methods
1033 uint8_t : 6; //!< reserved
1034 }Preference;
1035
1036 int8_t tResult; //!< operation result
1037 volatile arm_2d_op_status_t Status; //!< operation status
1038
1039 arm_2d_op_evt_t evt2DOpCpl; //!< operation-complete event
1040
1041#if __ARM_2D_HAS_ASYNC__
1042 uintptr_t pSemaphore; //!< point to semaphore
1043#endif
1045
1046 uintptr_t pUserParam; //!< user attached object
1047};
1048
1049/*!
1050 * \brief the base class for operations with only a target tile
1051 * \note arm_2d_op_msk_t inherits from arm_2d_op_core_t
1052 */
1053typedef struct arm_2d_op_t {
1055 struct {
1056 const arm_2d_tile_t *ptTile; //!< target tile
1057 const arm_2d_region_t *ptRegion; //!< target region
1058 } Target;
1059} arm_2d_op_t;
1060
1061/*!
1062 * \brief the base class for operations with a target tile and a target mask
1063 * \note arm_2d_op_msk_t inherits from arm_2d_op_t
1064 */
1065typedef struct arm_2d_op_msk_t {
1067 struct {
1068 const arm_2d_tile_t *ptTile; //!< target tile
1069 const arm_2d_region_t *ptRegion; //!< target region
1070 } Target;
1071
1072 /* derived part */
1073 struct {
1074 const arm_2d_tile_t *ptTargetSide; //!< target mask tile
1075 } Mask;
1077
1078/*!
1079 * \brief the base class for operations with a target tile and a source tile
1080 * \note arm_2d_op_src_t inherits from arm_2d_op_t
1081 */
1082typedef struct arm_2d_op_src_t {
1084 struct {
1085 const arm_2d_tile_t *ptTile; //!< target tile
1086 const arm_2d_region_t *ptRegion; //!< target region
1087 } Target;
1088
1089 /* derived part */
1090 struct {
1091 const arm_2d_tile_t *ptTile; //!< source tile
1092 }Source;
1093 uint32_t wMode;
1095
1096/*!
1097 * \brief the base class for operations with a target tile, a source tile and masks
1098 * \note arm_2d_op_src_msk_t inherits from arm_2d_op_src_t
1099 */
1100typedef struct arm_2d_op_src_msk_t {
1102 struct {
1103 const arm_2d_tile_t *ptTile; //!< target tile
1104 const arm_2d_region_t *ptRegion; //!< target region
1105 } Target;
1106 struct {
1107 const arm_2d_tile_t *ptTile; //!< source tile
1108 }Source;
1109 uint32_t wMode;
1110
1111 /* derived part */
1112 struct {
1113 const arm_2d_tile_t *ptSourceSide; //!< source side mask
1114 const arm_2d_tile_t *ptTargetSide; //!< target side mask
1115 } Mask;
1117
1118/*!
1119 * \brief the base class for operations with a target tile, a source tile and masks
1120 * \note arm_2d_op_src_msk_opc_t inherits from arm_2d_op_src_msk_t
1121 */
1124 struct {
1125 const arm_2d_tile_t *ptTile; //!< target tile
1126 const arm_2d_region_t *ptRegion; //!< target region
1127 } Target;
1128 struct {
1129 const arm_2d_tile_t *ptTile; //!< source tile
1130 }Source;
1131 uint32_t wMode;
1132
1133 /* derived part */
1134 struct {
1135 const arm_2d_tile_t *ptSourceSide; //!< source side mask
1136 const arm_2d_tile_t *ptTargetSide; //!< target side mask
1137 } Mask;
1138
1139 uint8_t chOpacity; //!< opacity
1141
1142/*!
1143 * \brief the base class for operations with a target tile, a dummy tile and a reference to the original source tile
1144 * \note arm_2d_op_src_orig_t inherits from arm_2d_op_src_t
1145 */
1146typedef struct arm_2d_op_src_orig_t {
1148 struct {
1149 const arm_2d_tile_t *ptTile; //!< target tile
1150 const arm_2d_region_t *ptRegion; //!< target region
1151 } Target;
1152 struct {
1153 const arm_2d_tile_t *ptTile; //!< the dummy source tile
1154 }Source;
1155 uint32_t wMode;
1156
1157 /* derived part */
1158 struct {
1159 const arm_2d_tile_t *ptTile; //!< the origin tile
1160 arm_2d_tile_t tDummySource; //!< the buffer for the source
1161 }Origin;
1162
1164
1165/*!
1166 * \brief the base class for operations with a target tile, a dummy tile, a reference to the original source tile and masks
1167 * \note arm_2d_op_src_orig_msk_t inherits from arm_2d_op_src_orig_t
1168 */
1171 struct {
1172 const arm_2d_tile_t *ptTile; //!< target tile
1173 const arm_2d_region_t *ptRegion; //!< target region
1174 } Target;
1175 struct {
1176 const arm_2d_tile_t *ptTile; //!< the dummy source tile
1177 }Source;
1178 uint32_t wMode;
1179 struct {
1180 const arm_2d_tile_t *ptTile; //!< the origin tile
1181 arm_2d_tile_t tDummySource; //!< the buffer for the source
1182 }Origin;
1183
1184 /* derived part */
1185 struct {
1186 const arm_2d_tile_t *ptOriginSide; //!< origin side mask
1187 const arm_2d_tile_t *ptTargetSide; //!< target side mask
1188 } Mask;
1190
1191
1192/*----------------------------------------------------------------------------*
1193 * Fast Rotation linear regression structure
1194 *----------------------------------------------------------------------------*/
1195
1196#if (__ARM_2D_HAS_HELIUM_FLOAT__ || __ARM_2D_HAS_FPU__) \
1197 && !__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
1198/*!
1199 * \brief a type for parameters of linear interpolation (in floating point)
1200 *
1201 */
1202typedef struct arm_2d_rot_linear_regr_t {
1203 float slopeY;
1204 float interceptY;
1205 float slopeX;
1206 float interceptX;
1208
1209#else
1210/*!
1211 * \brief a type for parameters of linear interpolation (in fixed point)
1212 *
1213 */
1215 int32_t slopeY;
1216 int32_t interceptY;
1217 int32_t slopeX;
1218 int32_t interceptX;
1220
1221#endif
1222
1223/*============================ GLOBAL VARIABLES ==============================*/
1224/*============================ PROTOTYPES ====================================*/
1225
1226/*! @} */
1227
1228#if defined(__clang__)
1229#pragma clang diagnostic pop
1230#elif __IS_COMPILER_ARM_COMPILER_5__
1231#pragma diag_warning 64
1232#elif __IS_COMPILER_GCC__
1233#pragma GCC diagnostic pop
1234#endif
1235
1236#ifdef __cplusplus
1237}
1238#endif
1239
1240#endif // __ARM_2D_TYPES_H__
1241
1242