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_2d_convert_colour_to_rgb888(__SRC_ADDR, \
65 arm_2dp_convert_colour_to_rgb888( NULL, \
69#define arm_2d_convert_colour_to_rgb565(__SRC_ADDR, \
71 arm_2dp_convert_colour_to_rgb565( NULL, \
75#define arm_2d_pixel_brga8888_to_rgb565(__COLOUR) \
76 ({__arm_2d_color_fast_rgb_t ARM_2D_SAFE_NAME(tChannels); \
77 __arm_2d_brga8888_unpack((__COLOUR), &ARM_2D_SAFE_NAME(tChannels)); \
78 __arm_2d_rgb565_pack(&ARM_2D_SAFE_NAME(tChannels));})
80#define arm_2d_pixel_brga8888_to_gray8(__COLOUR) \
81 ({__arm_2d_color_fast_rgb_t ARM_2D_SAFE_NAME(tChannels); \
82 __arm_2d_brga8888_unpack((__COLOUR), &ARM_2D_SAFE_NAME(tChannels)); \
83 __arm_2d_gray8_pack(&ARM_2D_SAFE_NAME(tChannels));})
118 assert(NULL != ptRGB);
121 uint16_t maskRunpk = 0x001f, maskGunpk = 0x003f;
123 ptRGB->B = (uint16_t) ((hwColor & maskRunpk) << 3);
124 ptRGB->R = (uint16_t) ((hwColor >> 11) << 3);
125 ptRGB->G = (uint16_t) (((hwColor >> 5) & maskGunpk) << 2);
139 assert(NULL != ptRGB);
141 uint8_t *pchChannel = (uint8_t *)&wColor;
143 ptRGB->B = (uint16_t) pchChannel[0];
144 ptRGB->G = (uint16_t) pchChannel[1];
145 ptRGB->R = (uint16_t) pchChannel[2];
146 ptRGB->A = (uint16_t) pchChannel[3];
158 assert(NULL != ptRGB);
160 uint16_t tGrayScale = (ptRGB->R + ptRGB->G + ptRGB->B) / 3;
162 return (uint8_t)( (tGrayScale <= 255) * tGrayScale
163 + (tGrayScale > 255) * 255);
175 assert(NULL != ptRGB);
178 .u5R = (uint16_t) ptRGB->R >> 3,
179 .u6G = (uint16_t) ptRGB->G >> 2,
180 .u5B = (uint16_t) ptRGB->B >> 3,
182 return tOutput.tValue;
194 assert(NULL != ptRGB);
197 .u8R = (uint16_t) ptRGB->R,
198 .u8G = (uint16_t) ptRGB->G,
199 .u8B = (uint16_t) ptRGB->B,
200 .u8A = (uint16_t) ptRGB->A,
202 return tOutput.tValue;
250#if defined(__clang__)
251# pragma clang diagnostic pop
252#elif defined(__IS_COMPILER_IAR__)
253# pragma diag_warning=Go029