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