31#ifndef __ARM_2D_CONVERSION_H__
32#define __ARM_2D_CONVERSION_H__
36#include "arm_2d_types.h"
43# pragma clang diagnostic push
44# pragma clang diagnostic ignored "-Wunknown-warning-option"
45# pragma clang diagnostic ignored "-Wreserved-identifier"
46# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
47# pragma clang diagnostic ignored "-Wunknown-warning-option"
48# pragma clang diagnostic ignored "-Wreserved-identifier"
49# pragma clang diagnostic ignored "-Wsign-conversion"
50# pragma clang diagnostic ignored "-Wnarrowing"
51#elif defined(__IS_COMPILER_IAR__)
52# pragma diag_suppress=Go029
63#define arm_2dp_convert_colour_to_rgb888 arm_2dp_convert_colour_to_cccn888
64#define arm_2d_convert_colour_to_rgb888 arm_2d_convert_colour_to_cccn888
75#define arm_2d_convert_colour_to_gray8( __SRC_ADDR, \
77 arm_2dp_convert_colour_to_gray8(NULL, \
81#define arm_2d_tile_copy_to_gray8( __SRC_ADDR, \
84 arm_2dp_tile_copy_to_gray8( NULL, \
89#define arm_2d_convert_colour_to_rgb565(__SRC_ADDR, \
91 arm_2dp_convert_colour_to_rgb565( NULL, \
95#define arm_2d_tile_copy_to_rgb565( __SRC_ADDR, \
98 arm_2dp_tile_copy_to_rgb565(NULL, \
103#define arm_2d_convert_colour_to_cccn888(__SRC_ADDR, \
105 arm_2dp_convert_colour_to_cccn888( NULL, \
109#define arm_2d_tile_copy_to_cccn888(__SRC_ADDR, \
112 arm_2dp_tile_copy_to_cccn888( NULL, \
117#define arm_2d_pixel_ccca8888_to_rgb565(__COLOUR) \
118 ({__arm_2d_color_fast_rgb_t ARM_2D_SAFE_NAME(tChannels); \
119 __arm_2d_ccca8888_unpack((__COLOUR), &ARM_2D_SAFE_NAME(tChannels)); \
120 __arm_2d_rgb565_pack(&ARM_2D_SAFE_NAME(tChannels));})
122#define arm_2d_pixel_ccca8888_to_gray8(__COLOUR) \
123 ({__arm_2d_color_fast_rgb_t ARM_2D_SAFE_NAME(tChannels); \
124 __arm_2d_ccca8888_unpack((__COLOUR), &ARM_2D_SAFE_NAME(tChannels)); \
125 __arm_2d_gray8_pack(&ARM_2D_SAFE_NAME(tChannels));})
127#define arm_2d_pixel_brga8888_to_rgb565 arm_2d_pixel_ccca8888_to_rgb565
128#define arm_2d_pixel_brga8888_to_gray8 arm_2d_pixel_ccca8888_to_gray8
163 assert(NULL != ptRGB);
165 ptRGB->B = (uint16_t) chColor;
166 ptRGB->G = (uint16_t) chColor;
167 ptRGB->R = (uint16_t) chColor;
168 ptRGB->A = (uint16_t) 0xFF;
180 assert(NULL != ptRGB);
183 uint16_t maskRunpk = 0x001f, maskGunpk = 0x003f;
185 ptRGB->B = (uint16_t) ((hwColor & maskRunpk) << 3);
186 ptRGB->R = (uint16_t) ((hwColor >> 11) << 3);
187 ptRGB->G = (uint16_t) (((hwColor >> 5) & maskGunpk) << 2);
201 assert(NULL != ptRGB);
203 uint8_t *pchChannel = (uint8_t *)&wColor;
205 ptRGB->B = (uint16_t) pchChannel[0];
206 ptRGB->G = (uint16_t) pchChannel[1];
207 ptRGB->R = (uint16_t) pchChannel[2];
208 ptRGB->A = (uint16_t) pchChannel[3];
220 assert(NULL != ptRGB);
222 uint16_t tGrayScale = (ptRGB->R * 77 + ptRGB->G * 151 + ptRGB->B * 28) >> 8;
224 return (uint8_t)( (tGrayScale <= 255) * tGrayScale
225 + (tGrayScale > 255) * 255);
237 assert(NULL != ptRGB);
240 .u5B = (uint16_t) (ptRGB->B >> 3),
241 .u6G = (uint16_t) (ptRGB->G >> 2),
242 .u5R = (uint16_t) (ptRGB->R >> 3),
244 return tOutput.tValue;
256 assert(NULL != ptRGB);
259 .u8B = (uint16_t) ptRGB->B,
260 .u8G = (uint16_t) ptRGB->G,
261 .u8R = (uint16_t) ptRGB->R,
262 .u8A = (uint16_t) ptRGB->A,
264 return tOutput.tValue;
361#if defined(__clang__)
362# pragma clang diagnostic pop
363#elif defined(__IS_COMPILER_IAR__)
364# pragma diag_warning=Go029