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