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