Graphics framework for GR-PEACH. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE
Dependents: ImageZoomInout_Sample ImageRotaion_Sample ImageScroll_Sample GR-PEACH_LCD_4_3inch_Save_to_USB ... more
License
When you use this library, we judge you have agreed to the following contents.
https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE
Note
If you import the GraphicsFramework library, please import GR-PEACH_video library and R_BSP library together.
JPEG Converter
The JPEG Converter driver implements encode and decode functionality which uses the JCU of the RZ/A Series.
Hello World!
Import programJCU_HelloWorld
Hello World for JCU(JPEG Codec Unit). JCU is JPEG codec unit of RZ/A1. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE
API
Import library
Data Structures |
|
struct | bitmap_buff_info_t |
Bitmap data setting struct.
More...
|
|
struct | encode_options_t |
Encode option setting.
More...
|
|
Public Types |
|
enum |
jpeg_conv_error_t
{
JPEG_CONV_OK = 0, JPEG_CONV_JCU_ERR = -1, JPEG_CONV_FORMA_ERR = -2, JPEG_CONV_PARAM_ERR = -3, JPEG_CONV_BUSY = -4, JPEG_CONV_PARAM_RANGE_ERR = -7 } |
Error codes. More... |
|
enum |
wr_rd_swa_t
{
WR_RD_WRSWA_NON = 0, WR_RD_WRSWA_8BIT = 1, WR_RD_WRSWA_16BIT = 2, WR_RD_WRSWA_16_8BIT = 3, WR_RD_WRSWA_32BIT = 4, WR_RD_WRSWA_32_8BIT = 5, WR_RD_WRSWA_32_16BIT = 6, WR_RD_WRSWA_32_16_8BIT = 7 } |
Write/Read image pixcel frame buffer swap setting. More... |
|
enum | wr_rd_format_t { WR_RD_YCbCr422 = 0x00, WR_RD_ARGB8888 = 0x01, WR_RD_RGB565 = 0x02 } |
Write/Read image pixcel format selects. More... |
|
enum | sub_sampling_t { SUB_SAMPLING_1_1 = 0x00, SUB_SAMPLING_1_2 = 0x01, SUB_SAMPLING_1_4 = 0x02, SUB_SAMPLING_1_8 = 0x03 } |
Thinning output image selects. More... |
|
enum | cbcr_offset_t { CBCR_OFFSET_0 = 0x00, CBCR_OFFSET_128 = 0x01 } |
Cb/Cr range selects for decode. More... |
|
Public Member Functions |
|
JPEG_Converter () | |
Constructor method of JPEG converter(encode/decode)
|
|
virtual | ~JPEG_Converter () |
Destructor method of JPEG converter(encode/decode)
|
|
JPEG_Converter::jpeg_conv_error_t | decode (void *pJpegBuff, bitmap_buff_info_t *psOutputBuff) |
Decode JPEG to rinear data.
|
|
JPEG_Converter::jpeg_conv_error_t | decode (void *pJpegBuff, bitmap_buff_info_t *psOutputBuff, decode_options_t *pOptions) |
JPEG data decode to bitmap.
|
|
JPEG_Converter::jpeg_conv_error_t | encode ( bitmap_buff_info_t *psInputBuff, void *pJpegBuff, size_t *pEncodeSize) |
Encode rinear data to JPEG.
|
|
JPEG_Converter::jpeg_conv_error_t | encode ( bitmap_buff_info_t *psInputBuff, void *pJpegBuff, size_t *pEncodeSize, encode_options_t *pOptions) |
Bitmap data encode to JPEG.
|
|
JPEG_Converter::jpeg_conv_error_t | SetQuality (const uint8_t qual) |
Set encode quality.
|
Correspondence file
A correspondence file of JPEG Converter is as the following table.
JPEG | Correspondence |
Width | >0(greater than 0) |
Height | >0(greater than 0) |
Color format | YCbCr444, YCbCr422, YCbCr420, YCbCr411 |
Bitmap | Correspondence |
Width | >0(greater than 0) |
Height | >0(greater than 0) |
Color format | YCbCr422 |
Notice
You run JPEG converter once destruction each time.
You set whether these JPEG files aren't input, or it check error setting decode(set in "flag" = true). The JPEG file which becomes correspondence outside will be the following condition.
- File besides the above-mentioned correspondence file.
- As information in the JPEG file, WIDTH or HEIGHT is larger than output buffer setting.
Buffer area is used encode/decode, set 8 bytes align and non-cash memory area. The output buffer when decoding, is made beyond the size decided in the size of the JPEG file, the format, setting of thinning out. You make output buffer for decode/encode to enough big size in order to stock this result. JPEG Converter, if you do not particularly perform specified, does not check size against the output data at the time of encoding and decoding. You set the output buffer so that there is no effect of corruption by the output data.
Color format
Color format in case to be converted from Bitmap to JPEG is either ARGB8888 or RGB555, YCbCr422.
Color format of the If you want to convert from JPEG file to Bitmap file is YCbCr422.
You correct "alpha(member of decode_options_t)" of setting and "output_cb_cr_offset(member of decode_options_t)" according to color format when decoding.
- example
decode to ARGB8888(WR_RD_ARGB8888 set in format member of bitmap_buff_info_t)
alpha = 0x01-0xFF
output_cb_cr_offset = CBCR_OFFSET_0
decode to YCbCr422(WR_RD_YCbCr422 set in format member of bitmap_buff_info_t)
alpha = 0
output_cb_cr_offset = CBCR_OFFSET_0 or CBCR_OFFSET_128
decode to RGB565(WR_RD_RGB565 set in format member of bitmap_buff_info_t)
alpha = 0
output_cb_cr_offset = CBCR_OFFSET_0
Decode/encode settings are optional
If omitted encode/decode settings, it will work with the following settings.
[Decode option setting (member of decode_options_t)]
- Vertical sub sampling is thinning output image to 1/1.
- Horizontal sub sampling is thinning output image to 1/1.
- Output data of Cb/Cr range is -128 to 127.
- Output data of swap in 8-bit units: 2-1-4-3-6-5-8-7.
- Alpha value of 0.
- JPEG format correspondence outside error check.
- It decode in a synchronous function.
[Encode option setting (member of encode_options_t)]
- DRI value is 0.
- Encoding JPEG file start width offset is 0.
- Encoding JPEG file start height offset is 0.
- Input data of Cb/Cr range of input data is -128 to 127.
- Input data swap in 8-bit units: 2-1-4-3-6-5-8-7.
- It don't check encode size.
- Quantization Y use default table(Quality75).
- Quantization C use default table(Quality75).
- Huffman Y DC use default table.
- Huffman C DC use default table.
- Huffman Y AC use default table.
- Huffman C AC use default table.
- It encode in a synchronous function.
Synchronous/asynchronous switching
Decoding and encoding setting to operate asynchronously by setting a callback function(decode_options_t and encode_options_t).
Quality
Quality changes are possible.
If you want to change the Quality, please specify the table made of Quality you want to change the address of the setting.
If you do not want to change the Quality, it will operate at Quality75.
RGA
The RGA library implements fast drawing functionality which uses the RGA of the RZ/A Series.
Supporting compiler is ARMCC, GCC ARM and IAR.
Hello World!
Import programRGA_HelloWorld
Hello World for RGA(Renesas Graphics Architecture). RGA is the Graphics Library of RZ/A1. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE
RGA/inc/RGA_Port_inline.h@13:1ee2176ef13f, 2017-04-24 (annotated)
- Committer:
- dkato
- Date:
- Mon Apr 24 08:16:23 2017 +0000
- Revision:
- 13:1ee2176ef13f
- Parent:
- 3:9f857750e4e9
Add "SetQuality()" to JCU.
; Bug fixes.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
1050186 | 3:9f857750e4e9 | 1 | /******************************************************************************* |
1050186 | 3:9f857750e4e9 | 2 | * DISCLAIMER |
1050186 | 3:9f857750e4e9 | 3 | * This software is supplied by Renesas Electronics Corporation and is only |
1050186 | 3:9f857750e4e9 | 4 | * intended for use with Renesas products. No other uses are authorized. This |
1050186 | 3:9f857750e4e9 | 5 | * software is owned by Renesas Electronics Corporation and is protected under |
1050186 | 3:9f857750e4e9 | 6 | * all applicable laws, including copyright laws. |
1050186 | 3:9f857750e4e9 | 7 | * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING |
1050186 | 3:9f857750e4e9 | 8 | * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT |
1050186 | 3:9f857750e4e9 | 9 | * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE |
1050186 | 3:9f857750e4e9 | 10 | * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. |
1050186 | 3:9f857750e4e9 | 11 | * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS |
1050186 | 3:9f857750e4e9 | 12 | * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE |
1050186 | 3:9f857750e4e9 | 13 | * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR |
1050186 | 3:9f857750e4e9 | 14 | * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE |
1050186 | 3:9f857750e4e9 | 15 | * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
1050186 | 3:9f857750e4e9 | 16 | * Renesas reserves the right, without notice, to make changes to this software |
1050186 | 3:9f857750e4e9 | 17 | * and to discontinue the availability of this software. By using this software, |
1050186 | 3:9f857750e4e9 | 18 | * you agree to the additional terms and conditions found by accessing the |
1050186 | 3:9f857750e4e9 | 19 | * following link: |
1050186 | 3:9f857750e4e9 | 20 | * http://www.renesas.com/disclaimer |
1050186 | 3:9f857750e4e9 | 21 | * Copyright (C) 2013 - 2014 Renesas Electronics Corporation. All rights reserved. |
1050186 | 3:9f857750e4e9 | 22 | *******************************************************************************/ |
1050186 | 3:9f857750e4e9 | 23 | /****************************************************************************** |
1050186 | 3:9f857750e4e9 | 24 | * $FileName: RGA_Port_inline.h $ |
1050186 | 3:9f857750e4e9 | 25 | * $Module: RGA $ $PublicVersion: 1.03 $ (=RGA_VERSION) |
1050186 | 3:9f857750e4e9 | 26 | * $Rev: $ |
1050186 | 3:9f857750e4e9 | 27 | * $Date:: $ |
1050186 | 3:9f857750e4e9 | 28 | * Description: |
1050186 | 3:9f857750e4e9 | 29 | ******************************************************************************/ |
1050186 | 3:9f857750e4e9 | 30 | |
1050186 | 3:9f857750e4e9 | 31 | |
1050186 | 3:9f857750e4e9 | 32 | /* This file is included from "RGA_Port.h" */ |
1050186 | 3:9f857750e4e9 | 33 | |
1050186 | 3:9f857750e4e9 | 34 | |
1050186 | 3:9f857750e4e9 | 35 | #ifndef RGA_PORT_INLINE_H |
1050186 | 3:9f857750e4e9 | 36 | #define RGA_PORT_INLINE_H |
1050186 | 3:9f857750e4e9 | 37 | #ifndef NOT_DEFINE_INLINE_FUNCTION |
1050186 | 3:9f857750e4e9 | 38 | |
1050186 | 3:9f857750e4e9 | 39 | /****************************************************************************** |
1050186 | 3:9f857750e4e9 | 40 | Includes <System Includes> , "Project Includes" |
1050186 | 3:9f857750e4e9 | 41 | ******************************************************************************/ |
1050186 | 3:9f857750e4e9 | 42 | #include "clib_drivers.h" |
1050186 | 3:9f857750e4e9 | 43 | #include "frame_buffer.h" |
1050186 | 3:9f857750e4e9 | 44 | |
1050186 | 3:9f857750e4e9 | 45 | #ifdef __cplusplus |
1050186 | 3:9f857750e4e9 | 46 | extern "C" { |
1050186 | 3:9f857750e4e9 | 47 | #endif /* __cplusplus */ |
1050186 | 3:9f857750e4e9 | 48 | |
1050186 | 3:9f857750e4e9 | 49 | |
1050186 | 3:9f857750e4e9 | 50 | /****************************************************************************** |
1050186 | 3:9f857750e4e9 | 51 | Typedef definitions |
1050186 | 3:9f857750e4e9 | 52 | ******************************************************************************/ |
1050186 | 3:9f857750e4e9 | 53 | /* in RGA_Port_typedef.h */ |
1050186 | 3:9f857750e4e9 | 54 | |
1050186 | 3:9f857750e4e9 | 55 | /****************************************************************************** |
1050186 | 3:9f857750e4e9 | 56 | Macro definitions |
1050186 | 3:9f857750e4e9 | 57 | ******************************************************************************/ |
1050186 | 3:9f857750e4e9 | 58 | /* in RGA_Port_typedef.h */ |
1050186 | 3:9f857750e4e9 | 59 | |
1050186 | 3:9f857750e4e9 | 60 | /****************************************************************************** |
1050186 | 3:9f857750e4e9 | 61 | Variable Externs |
1050186 | 3:9f857750e4e9 | 62 | ******************************************************************************/ |
1050186 | 3:9f857750e4e9 | 63 | /* in RGA_Port_typedef.h */ |
1050186 | 3:9f857750e4e9 | 64 | |
1050186 | 3:9f857750e4e9 | 65 | /****************************************************************************** |
1050186 | 3:9f857750e4e9 | 66 | Functions Prototypes |
1050186 | 3:9f857750e4e9 | 67 | ******************************************************************************/ |
1050186 | 3:9f857750e4e9 | 68 | |
1050186 | 3:9f857750e4e9 | 69 | |
1050186 | 3:9f857750e4e9 | 70 | /** |
1050186 | 3:9f857750e4e9 | 71 | * @brief SwapEndian to 2Byte |
1050186 | 3:9f857750e4e9 | 72 | * |
1050186 | 3:9f857750e4e9 | 73 | * @param in_out_2byteVariable Address to 2 byte |
1050186 | 3:9f857750e4e9 | 74 | * @return None |
1050186 | 3:9f857750e4e9 | 75 | */ |
1050186 | 3:9f857750e4e9 | 76 | INLINE void SwapEndian2Byte( void *in_out_2byteVariable ) |
1050186 | 3:9f857750e4e9 | 77 | { |
1050186 | 3:9f857750e4e9 | 78 | byte_t buffer[2]; |
1050186 | 3:9f857750e4e9 | 79 | byte_t *data = (byte_t *) in_out_2byteVariable; |
1050186 | 3:9f857750e4e9 | 80 | |
1050186 | 3:9f857750e4e9 | 81 | buffer[0] = data[0]; |
1050186 | 3:9f857750e4e9 | 82 | buffer[1] = data[1]; |
1050186 | 3:9f857750e4e9 | 83 | |
1050186 | 3:9f857750e4e9 | 84 | data[0] = buffer[1]; |
1050186 | 3:9f857750e4e9 | 85 | data[1] = buffer[0]; |
1050186 | 3:9f857750e4e9 | 86 | } |
1050186 | 3:9f857750e4e9 | 87 | |
1050186 | 3:9f857750e4e9 | 88 | |
1050186 | 3:9f857750e4e9 | 89 | /** |
1050186 | 3:9f857750e4e9 | 90 | * @brief SwapEndian to 4Byte |
1050186 | 3:9f857750e4e9 | 91 | * |
1050186 | 3:9f857750e4e9 | 92 | * @param in_out_2byteVariable Address to 4 byte |
1050186 | 3:9f857750e4e9 | 93 | * @return None |
1050186 | 3:9f857750e4e9 | 94 | */ |
1050186 | 3:9f857750e4e9 | 95 | INLINE void SwapEndian4Byte( void *in_out_4byteVariable ) |
1050186 | 3:9f857750e4e9 | 96 | { |
1050186 | 3:9f857750e4e9 | 97 | byte_t buffer[4]; |
1050186 | 3:9f857750e4e9 | 98 | byte_t *data = (byte_t *) in_out_4byteVariable; |
1050186 | 3:9f857750e4e9 | 99 | |
1050186 | 3:9f857750e4e9 | 100 | buffer[0] = data[0]; |
1050186 | 3:9f857750e4e9 | 101 | buffer[1] = data[1]; |
1050186 | 3:9f857750e4e9 | 102 | buffer[2] = data[2]; |
1050186 | 3:9f857750e4e9 | 103 | buffer[3] = data[3]; |
1050186 | 3:9f857750e4e9 | 104 | |
1050186 | 3:9f857750e4e9 | 105 | data[0] = buffer[3]; |
1050186 | 3:9f857750e4e9 | 106 | data[1] = buffer[2]; |
1050186 | 3:9f857750e4e9 | 107 | data[2] = buffer[1]; |
1050186 | 3:9f857750e4e9 | 108 | data[3] = buffer[0]; |
1050186 | 3:9f857750e4e9 | 109 | } |
1050186 | 3:9f857750e4e9 | 110 | |
1050186 | 3:9f857750e4e9 | 111 | |
1050186 | 3:9f857750e4e9 | 112 | /** |
1050186 | 3:9f857750e4e9 | 113 | * @brief Sets the value to the address not aligned 4byte |
1050186 | 3:9f857750e4e9 | 114 | * |
1050186 | 3:9f857750e4e9 | 115 | * @param out_Variable <uint32_not_aligned_t> |
1050186 | 3:9f857750e4e9 | 116 | * @param Value Set value |
1050186 | 3:9f857750e4e9 | 117 | * @return None |
1050186 | 3:9f857750e4e9 | 118 | */ |
1050186 | 3:9f857750e4e9 | 119 | INLINE void uint32_not_aligned_t_set( uint32_not_aligned_t *out_Variable, uint32_t Value ) |
1050186 | 3:9f857750e4e9 | 120 | { |
1050186 | 3:9f857750e4e9 | 121 | #if BYTE_ENDIAN == BYTE_LITTLE_ENDIAN |
1050186 | 3:9f857750e4e9 | 122 | out_Variable->byte[0] = (byte_t)( ( Value & 0x000000FF ) ); |
1050186 | 3:9f857750e4e9 | 123 | out_Variable->byte[1] = (byte_t)( ( Value & 0x0000FF00 ) >> 8 ); |
1050186 | 3:9f857750e4e9 | 124 | out_Variable->byte[2] = (byte_t)( ( Value & 0x00FF0000 ) >> 16 ); |
1050186 | 3:9f857750e4e9 | 125 | out_Variable->byte[3] = (byte_t)( ( Value & 0xFF000000 ) >> 24 ); |
1050186 | 3:9f857750e4e9 | 126 | #else |
1050186 | 3:9f857750e4e9 | 127 | out_Variable->byte[0] = (byte_t)( ( Value & 0xFF000000 ) >> 24 ); |
1050186 | 3:9f857750e4e9 | 128 | out_Variable->byte[1] = (byte_t)( ( Value & 0x00FF0000 ) >> 16 ); |
1050186 | 3:9f857750e4e9 | 129 | out_Variable->byte[2] = (byte_t)( ( Value & 0x0000FF00 ) >> 8 ); |
1050186 | 3:9f857750e4e9 | 130 | out_Variable->byte[3] = (byte_t)( ( Value & 0x000000FF ) ); |
1050186 | 3:9f857750e4e9 | 131 | #endif |
1050186 | 3:9f857750e4e9 | 132 | } |
1050186 | 3:9f857750e4e9 | 133 | |
1050186 | 3:9f857750e4e9 | 134 | |
1050186 | 3:9f857750e4e9 | 135 | /*********************************************************************** |
1050186 | 3:9f857750e4e9 | 136 | * Class: byte_per_pixel_t |
1050186 | 3:9f857750e4e9 | 137 | ************************************************************************/ |
1050186 | 3:9f857750e4e9 | 138 | |
1050186 | 3:9f857750e4e9 | 139 | |
1050186 | 3:9f857750e4e9 | 140 | /** |
1050186 | 3:9f857750e4e9 | 141 | * @brief R_RGA_BitPerPixelType_To_BytePerPixelType |
1050186 | 3:9f857750e4e9 | 142 | * |
1050186 | 3:9f857750e4e9 | 143 | * @param BitPerPixel Input |
1050186 | 3:9f857750e4e9 | 144 | * @return byte_per_pixel_t |
1050186 | 3:9f857750e4e9 | 145 | */ |
1050186 | 3:9f857750e4e9 | 146 | INLINE byte_per_pixel_t R_RGA_BitPerPixelType_To_BytePerPixelType( int_fast32_t BitPerPixel ) |
1050186 | 3:9f857750e4e9 | 147 | { |
1050186 | 3:9f857750e4e9 | 148 | if ( R_Mod_8s( BitPerPixel ) == 0 ) { |
1050186 | 3:9f857750e4e9 | 149 | return (byte_per_pixel_t)( (uint_fast32_t) BitPerPixel / 8 ); |
1050186 | 3:9f857750e4e9 | 150 | } else { |
1050186 | 3:9f857750e4e9 | 151 | return BitPerPixel << R_BYTE_PER_PIXEL_SHIFT; |
1050186 | 3:9f857750e4e9 | 152 | } |
1050186 | 3:9f857750e4e9 | 153 | } |
1050186 | 3:9f857750e4e9 | 154 | |
1050186 | 3:9f857750e4e9 | 155 | |
1050186 | 3:9f857750e4e9 | 156 | /** |
1050186 | 3:9f857750e4e9 | 157 | * @brief R_RGA_BytePerPixelType_To_BitPerPixelType |
1050186 | 3:9f857750e4e9 | 158 | * |
1050186 | 3:9f857750e4e9 | 159 | * @param BytePerPixel byte_per_pixel_t |
1050186 | 3:9f857750e4e9 | 160 | * @return BitPerPixel |
1050186 | 3:9f857750e4e9 | 161 | */ |
1050186 | 3:9f857750e4e9 | 162 | INLINE int_fast32_t R_RGA_BytePerPixelType_To_BitPerPixelType( byte_per_pixel_t BytePerPixel ) |
1050186 | 3:9f857750e4e9 | 163 | { |
1050186 | 3:9f857750e4e9 | 164 | return ( ( BytePerPixel & R_BYTE_PER_PIXEL_MASK ) * 8 ) | |
1050186 | 3:9f857750e4e9 | 165 | ( BytePerPixel >> R_BYTE_PER_PIXEL_SHIFT ); |
1050186 | 3:9f857750e4e9 | 166 | } |
1050186 | 3:9f857750e4e9 | 167 | |
1050186 | 3:9f857750e4e9 | 168 | |
1050186 | 3:9f857750e4e9 | 169 | /** |
1050186 | 3:9f857750e4e9 | 170 | * @brief R_BYTE_PER_PIXEL_IsInteger |
1050186 | 3:9f857750e4e9 | 171 | * |
1050186 | 3:9f857750e4e9 | 172 | * @param BytePerPixel byte_per_pixel_t |
1050186 | 3:9f857750e4e9 | 173 | * @return Whether "BytePerPixel" is integer type. |
1050186 | 3:9f857750e4e9 | 174 | */ |
1050186 | 3:9f857750e4e9 | 175 | INLINE bool_t R_BYTE_PER_PIXEL_IsInteger( byte_per_pixel_t BytePerPixel ) |
1050186 | 3:9f857750e4e9 | 176 | { |
1050186 | 3:9f857750e4e9 | 177 | return ( BytePerPixel & R_BYTE_PER_PIXEL_MASK ) != 0; |
1050186 | 3:9f857750e4e9 | 178 | } |
1050186 | 3:9f857750e4e9 | 179 | |
1050186 | 3:9f857750e4e9 | 180 | |
1050186 | 3:9f857750e4e9 | 181 | /* Section: Global */ |
1050186 | 3:9f857750e4e9 | 182 | /** |
1050186 | 3:9f857750e4e9 | 183 | * @brief argb8888_t_to_rgb565_t |
1050186 | 3:9f857750e4e9 | 184 | * |
1050186 | 3:9f857750e4e9 | 185 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 186 | * None |
1050186 | 3:9f857750e4e9 | 187 | * @return None. |
1050186 | 3:9f857750e4e9 | 188 | */ |
1050186 | 3:9f857750e4e9 | 189 | INLINE rgb565_t argb8888_t_to_rgb565_t( argb8888_t Color ) |
1050186 | 3:9f857750e4e9 | 190 | { |
1050186 | 3:9f857750e4e9 | 191 | rgb565_t ret = {0}; |
1050186 | 3:9f857750e4e9 | 192 | /* Warning: C4017W: ret may be used before being set */ |
1050186 | 3:9f857750e4e9 | 193 | /* This warning is not correct */ |
1050186 | 3:9f857750e4e9 | 194 | |
1050186 | 3:9f857750e4e9 | 195 | ret.Value = (uint16_t)( |
1050186 | 3:9f857750e4e9 | 196 | ( ( Color.Value & 0x00F80000 ) >> 8 ) | |
1050186 | 3:9f857750e4e9 | 197 | ( ( Color.Value & 0x0000FC00 ) >> 5 ) | |
1050186 | 3:9f857750e4e9 | 198 | ( ( Color.Value & 0x000000F8 ) >> 3 ) ); |
1050186 | 3:9f857750e4e9 | 199 | |
1050186 | 3:9f857750e4e9 | 200 | return ret; |
1050186 | 3:9f857750e4e9 | 201 | } |
1050186 | 3:9f857750e4e9 | 202 | |
1050186 | 3:9f857750e4e9 | 203 | |
1050186 | 3:9f857750e4e9 | 204 | /** |
1050186 | 3:9f857750e4e9 | 205 | * @brief argb8888_t_to_argb1555_t |
1050186 | 3:9f857750e4e9 | 206 | * |
1050186 | 3:9f857750e4e9 | 207 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 208 | * None |
1050186 | 3:9f857750e4e9 | 209 | * @return None. |
1050186 | 3:9f857750e4e9 | 210 | */ |
1050186 | 3:9f857750e4e9 | 211 | INLINE argb1555_t argb8888_t_to_argb1555_t( argb8888_t Color ) |
1050186 | 3:9f857750e4e9 | 212 | { |
1050186 | 3:9f857750e4e9 | 213 | argb1555_t ret = {0}; |
1050186 | 3:9f857750e4e9 | 214 | /* Warning: C4017W: ret may be used before being set */ |
1050186 | 3:9f857750e4e9 | 215 | /* This warning is not correct */ |
1050186 | 3:9f857750e4e9 | 216 | |
1050186 | 3:9f857750e4e9 | 217 | ret.Value = (uint16_t)( |
1050186 | 3:9f857750e4e9 | 218 | ( ( Color.Value & 0x80000000 ) >> 16 ) | /* A */ |
1050186 | 3:9f857750e4e9 | 219 | ( ( Color.Value & 0x00F80000 ) >> 9 ) | /* R */ |
1050186 | 3:9f857750e4e9 | 220 | ( ( Color.Value & 0x0000F800 ) >> 6 ) | /* G */ |
1050186 | 3:9f857750e4e9 | 221 | ( ( Color.Value & 0x000000F8 ) >> 3 ) ); /* B */ |
1050186 | 3:9f857750e4e9 | 222 | |
1050186 | 3:9f857750e4e9 | 223 | return ret; |
1050186 | 3:9f857750e4e9 | 224 | } |
1050186 | 3:9f857750e4e9 | 225 | |
1050186 | 3:9f857750e4e9 | 226 | |
1050186 | 3:9f857750e4e9 | 227 | /** |
1050186 | 3:9f857750e4e9 | 228 | * @brief argb8888_t_to_argb4444_t |
1050186 | 3:9f857750e4e9 | 229 | * |
1050186 | 3:9f857750e4e9 | 230 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 231 | * None |
1050186 | 3:9f857750e4e9 | 232 | * @return None. |
1050186 | 3:9f857750e4e9 | 233 | */ |
1050186 | 3:9f857750e4e9 | 234 | INLINE argb4444_t argb8888_t_to_argb4444_t( argb8888_t Color ) |
1050186 | 3:9f857750e4e9 | 235 | { |
1050186 | 3:9f857750e4e9 | 236 | argb4444_t ret = {0}; |
1050186 | 3:9f857750e4e9 | 237 | /* Warning: C4017W: ret may be used before being set */ |
1050186 | 3:9f857750e4e9 | 238 | /* This warning is not correct */ |
1050186 | 3:9f857750e4e9 | 239 | |
1050186 | 3:9f857750e4e9 | 240 | ret.Value = (uint16_t)( |
1050186 | 3:9f857750e4e9 | 241 | ( ( Color.Value & 0xF0000000 ) >> 16 ) | |
1050186 | 3:9f857750e4e9 | 242 | ( ( Color.Value & 0x00F00000 ) >> 12 ) | |
1050186 | 3:9f857750e4e9 | 243 | ( ( Color.Value & 0x0000F000 ) >> 8 ) | |
1050186 | 3:9f857750e4e9 | 244 | ( ( Color.Value & 0x000000F0 ) >> 4 ) ); |
1050186 | 3:9f857750e4e9 | 245 | |
1050186 | 3:9f857750e4e9 | 246 | return ret; |
1050186 | 3:9f857750e4e9 | 247 | } |
1050186 | 3:9f857750e4e9 | 248 | |
1050186 | 3:9f857750e4e9 | 249 | |
1050186 | 3:9f857750e4e9 | 250 | /** |
1050186 | 3:9f857750e4e9 | 251 | * @brief argb8888_t_to_r8g8b8a8_t |
1050186 | 3:9f857750e4e9 | 252 | * |
1050186 | 3:9f857750e4e9 | 253 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 254 | * None |
1050186 | 3:9f857750e4e9 | 255 | * @return None. |
1050186 | 3:9f857750e4e9 | 256 | */ |
1050186 | 3:9f857750e4e9 | 257 | INLINE r8g8b8a8_t argb8888_t_to_r8g8b8a8_t( argb8888_t Color ) |
1050186 | 3:9f857750e4e9 | 258 | { |
1050186 | 3:9f857750e4e9 | 259 | r8g8b8a8_t ret; |
1050186 | 3:9f857750e4e9 | 260 | ret.Value = 0; /* Avoid Warning: C4017W: ret may be used before being set */ |
1050186 | 3:9f857750e4e9 | 261 | |
1050186 | 3:9f857750e4e9 | 262 | ret.u.Red = Color.u.Red; |
1050186 | 3:9f857750e4e9 | 263 | ret.u.Green = Color.u.Green; |
1050186 | 3:9f857750e4e9 | 264 | ret.u.Blue = Color.u.Blue; |
1050186 | 3:9f857750e4e9 | 265 | ret.u.Alpha = Color.u.Alpha; |
1050186 | 3:9f857750e4e9 | 266 | |
1050186 | 3:9f857750e4e9 | 267 | return ret; |
1050186 | 3:9f857750e4e9 | 268 | } |
1050186 | 3:9f857750e4e9 | 269 | |
1050186 | 3:9f857750e4e9 | 270 | |
1050186 | 3:9f857750e4e9 | 271 | /** |
1050186 | 3:9f857750e4e9 | 272 | * @brief rgb565_t_to_argb8888_t |
1050186 | 3:9f857750e4e9 | 273 | * |
1050186 | 3:9f857750e4e9 | 274 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 275 | * None |
1050186 | 3:9f857750e4e9 | 276 | * @return None. |
1050186 | 3:9f857750e4e9 | 277 | */ |
1050186 | 3:9f857750e4e9 | 278 | INLINE argb8888_t rgb565_t_to_argb8888_t( rgb565_t Color ) |
1050186 | 3:9f857750e4e9 | 279 | { |
1050186 | 3:9f857750e4e9 | 280 | argb8888_t ret; |
1050186 | 3:9f857750e4e9 | 281 | |
1050186 | 3:9f857750e4e9 | 282 | ret.Value = 0xFF000000 | /* A */ |
1050186 | 3:9f857750e4e9 | 283 | ( ( Color.Value & 0xF800 ) << 8 ) | ( ( Color.Value & 0xE000 ) << 3 ) | /* R */ |
1050186 | 3:9f857750e4e9 | 284 | ( ( Color.Value & 0x07E0 ) << 5 ) | ( ( Color.Value & 0x0600 ) >> 1 ) | /* G */ |
1050186 | 3:9f857750e4e9 | 285 | ( ( Color.Value & 0x001F ) << 3 ) | ( ( Color.Value & 0x001C ) >> 2 ); /* B */ |
1050186 | 3:9f857750e4e9 | 286 | |
1050186 | 3:9f857750e4e9 | 287 | return ret; |
1050186 | 3:9f857750e4e9 | 288 | } |
1050186 | 3:9f857750e4e9 | 289 | |
1050186 | 3:9f857750e4e9 | 290 | |
1050186 | 3:9f857750e4e9 | 291 | /** |
1050186 | 3:9f857750e4e9 | 292 | * @brief argb1555_t_to_argb8888_t |
1050186 | 3:9f857750e4e9 | 293 | * |
1050186 | 3:9f857750e4e9 | 294 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 295 | * None |
1050186 | 3:9f857750e4e9 | 296 | * @return None. |
1050186 | 3:9f857750e4e9 | 297 | */ |
1050186 | 3:9f857750e4e9 | 298 | INLINE argb8888_t argb1555_t_to_argb8888_t( argb1555_t Color ) |
1050186 | 3:9f857750e4e9 | 299 | { |
1050186 | 3:9f857750e4e9 | 300 | argb8888_t ret; |
1050186 | 3:9f857750e4e9 | 301 | |
1050186 | 3:9f857750e4e9 | 302 | ret.Value = |
1050186 | 3:9f857750e4e9 | 303 | ( ( Color.Value & 0x7C00 ) << 9 ) | ( ( Color.Value & 0x7000 ) << 4 ) | /* R */ |
1050186 | 3:9f857750e4e9 | 304 | ( ( Color.Value & 0x03E0 ) << 6 ) | ( ( Color.Value & 0x0380 ) << 1 ) | /* G */ |
1050186 | 3:9f857750e4e9 | 305 | ( ( Color.Value & 0x001F ) << 3 ) | ( ( Color.Value & 0x001C ) >> 2 ); /* B */ |
1050186 | 3:9f857750e4e9 | 306 | |
1050186 | 3:9f857750e4e9 | 307 | if ( Color.u.Alpha ) { |
1050186 | 3:9f857750e4e9 | 308 | ret.Value |= 0xFF000000; /* A */ |
1050186 | 3:9f857750e4e9 | 309 | } |
1050186 | 3:9f857750e4e9 | 310 | |
1050186 | 3:9f857750e4e9 | 311 | return ret; |
1050186 | 3:9f857750e4e9 | 312 | } |
1050186 | 3:9f857750e4e9 | 313 | |
1050186 | 3:9f857750e4e9 | 314 | |
1050186 | 3:9f857750e4e9 | 315 | /** |
1050186 | 3:9f857750e4e9 | 316 | * @brief argb4444_t_to_argb8888_t |
1050186 | 3:9f857750e4e9 | 317 | * |
1050186 | 3:9f857750e4e9 | 318 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 319 | * None |
1050186 | 3:9f857750e4e9 | 320 | * @return None. |
1050186 | 3:9f857750e4e9 | 321 | */ |
1050186 | 3:9f857750e4e9 | 322 | INLINE argb8888_t argb4444_t_to_argb8888_t( argb4444_t Color ) |
1050186 | 3:9f857750e4e9 | 323 | { |
1050186 | 3:9f857750e4e9 | 324 | argb8888_t ret; |
1050186 | 3:9f857750e4e9 | 325 | |
1050186 | 3:9f857750e4e9 | 326 | ret.Value = |
1050186 | 3:9f857750e4e9 | 327 | ( ( Color.Value & 0xF000 ) << 16 ) | ( ( Color.Value & 0xF000 ) << 12 ) | /* A */ |
1050186 | 3:9f857750e4e9 | 328 | ( ( Color.Value & 0x0F00 ) << 12 ) | ( ( Color.Value & 0x0F00 ) << 8 ) | /* R */ |
1050186 | 3:9f857750e4e9 | 329 | ( ( Color.Value & 0x00F0 ) << 8 ) | ( ( Color.Value & 0x00F0 ) << 4 ) | /* G */ |
1050186 | 3:9f857750e4e9 | 330 | ( ( Color.Value & 0x000F ) << 4 ) | ( ( Color.Value & 0x000F ) ); /* B */ |
1050186 | 3:9f857750e4e9 | 331 | |
1050186 | 3:9f857750e4e9 | 332 | return ret; |
1050186 | 3:9f857750e4e9 | 333 | } |
1050186 | 3:9f857750e4e9 | 334 | |
1050186 | 3:9f857750e4e9 | 335 | |
1050186 | 3:9f857750e4e9 | 336 | /** |
1050186 | 3:9f857750e4e9 | 337 | * @brief rgba8888_t_to_rgb565_t |
1050186 | 3:9f857750e4e9 | 338 | * |
1050186 | 3:9f857750e4e9 | 339 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 340 | * None |
1050186 | 3:9f857750e4e9 | 341 | * @return None. |
1050186 | 3:9f857750e4e9 | 342 | */ |
1050186 | 3:9f857750e4e9 | 343 | INLINE rgb565_t rgba8888_t_to_rgb565_t( rgba8888_t Color ) |
1050186 | 3:9f857750e4e9 | 344 | { |
1050186 | 3:9f857750e4e9 | 345 | rgb565_t ret; |
1050186 | 3:9f857750e4e9 | 346 | |
1050186 | 3:9f857750e4e9 | 347 | ret.Value = (uint16_t) ( |
1050186 | 3:9f857750e4e9 | 348 | ( ( Color.Value & 0xF8000000 ) >> 16 ) | /* R */ |
1050186 | 3:9f857750e4e9 | 349 | ( ( Color.Value & 0x00FC0000 ) >> 13 ) | /* G */ |
1050186 | 3:9f857750e4e9 | 350 | ( ( Color.Value & 0x0000F800 ) >> 11 ) ); /* B */ |
1050186 | 3:9f857750e4e9 | 351 | |
1050186 | 3:9f857750e4e9 | 352 | return ret; |
1050186 | 3:9f857750e4e9 | 353 | } |
1050186 | 3:9f857750e4e9 | 354 | |
1050186 | 3:9f857750e4e9 | 355 | |
1050186 | 3:9f857750e4e9 | 356 | /** |
1050186 | 3:9f857750e4e9 | 357 | * @brief rgba8888_t_to_argb1555_t |
1050186 | 3:9f857750e4e9 | 358 | * |
1050186 | 3:9f857750e4e9 | 359 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 360 | * None |
1050186 | 3:9f857750e4e9 | 361 | * @return None. |
1050186 | 3:9f857750e4e9 | 362 | */ |
1050186 | 3:9f857750e4e9 | 363 | INLINE argb1555_t rgba8888_t_to_argb1555_t( rgba8888_t Color ) |
1050186 | 3:9f857750e4e9 | 364 | { |
1050186 | 3:9f857750e4e9 | 365 | argb1555_t ret; |
1050186 | 3:9f857750e4e9 | 366 | |
1050186 | 3:9f857750e4e9 | 367 | ret.Value = (uint16_t) ( |
1050186 | 3:9f857750e4e9 | 368 | ( ( Color.Value & 0xF8000000 ) >> 17 ) | /* R */ |
1050186 | 3:9f857750e4e9 | 369 | ( ( Color.Value & 0x00F80000 ) >> 14 ) | /* G */ |
1050186 | 3:9f857750e4e9 | 370 | ( ( Color.Value & 0x0000F800 ) >> 11 ) | /* B */ |
1050186 | 3:9f857750e4e9 | 371 | ( ( Color.Value & 0x00000080 ) << 8 ) ); /* A */ |
1050186 | 3:9f857750e4e9 | 372 | |
1050186 | 3:9f857750e4e9 | 373 | return ret; |
1050186 | 3:9f857750e4e9 | 374 | } |
1050186 | 3:9f857750e4e9 | 375 | |
1050186 | 3:9f857750e4e9 | 376 | |
1050186 | 3:9f857750e4e9 | 377 | /** |
1050186 | 3:9f857750e4e9 | 378 | * @brief rgba8888_t_to_argb4444_t |
1050186 | 3:9f857750e4e9 | 379 | * |
1050186 | 3:9f857750e4e9 | 380 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 381 | * None |
1050186 | 3:9f857750e4e9 | 382 | * @return None. |
1050186 | 3:9f857750e4e9 | 383 | */ |
1050186 | 3:9f857750e4e9 | 384 | INLINE argb4444_t rgba8888_t_to_argb4444_t( rgba8888_t Color ) |
1050186 | 3:9f857750e4e9 | 385 | { |
1050186 | 3:9f857750e4e9 | 386 | argb4444_t ret; |
1050186 | 3:9f857750e4e9 | 387 | |
1050186 | 3:9f857750e4e9 | 388 | ret.Value = (uint16_t) ( |
1050186 | 3:9f857750e4e9 | 389 | ( ( Color.Value & 0xF0000000 ) >> 20 ) | /* R */ |
1050186 | 3:9f857750e4e9 | 390 | ( ( Color.Value & 0x00F00000 ) >> 16 ) | /* G */ |
1050186 | 3:9f857750e4e9 | 391 | ( ( Color.Value & 0x0000F000 ) >> 12 ) | /* B */ |
1050186 | 3:9f857750e4e9 | 392 | ( ( Color.Value & 0x000000F0 ) << 8 ) ); /* A */ |
1050186 | 3:9f857750e4e9 | 393 | |
1050186 | 3:9f857750e4e9 | 394 | return ret; |
1050186 | 3:9f857750e4e9 | 395 | } |
1050186 | 3:9f857750e4e9 | 396 | |
1050186 | 3:9f857750e4e9 | 397 | |
1050186 | 3:9f857750e4e9 | 398 | /** |
1050186 | 3:9f857750e4e9 | 399 | * @brief r8g8b8a8_t_to_argb8888_t |
1050186 | 3:9f857750e4e9 | 400 | * |
1050186 | 3:9f857750e4e9 | 401 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 402 | * None |
1050186 | 3:9f857750e4e9 | 403 | * @return None. |
1050186 | 3:9f857750e4e9 | 404 | */ |
1050186 | 3:9f857750e4e9 | 405 | INLINE argb8888_t r8g8b8a8_t_to_argb8888_t( r8g8b8a8_t Color ) |
1050186 | 3:9f857750e4e9 | 406 | { |
1050186 | 3:9f857750e4e9 | 407 | argb8888_t ret; |
1050186 | 3:9f857750e4e9 | 408 | |
1050186 | 3:9f857750e4e9 | 409 | ret.Value = |
1050186 | 3:9f857750e4e9 | 410 | ( Color.u.Alpha << 24 ) | |
1050186 | 3:9f857750e4e9 | 411 | ( Color.u.Red << 16 ) | |
1050186 | 3:9f857750e4e9 | 412 | ( Color.u.Green << 8 ) | |
1050186 | 3:9f857750e4e9 | 413 | ( Color.u.Blue ); |
1050186 | 3:9f857750e4e9 | 414 | |
1050186 | 3:9f857750e4e9 | 415 | return ret; |
1050186 | 3:9f857750e4e9 | 416 | } |
1050186 | 3:9f857750e4e9 | 417 | |
1050186 | 3:9f857750e4e9 | 418 | |
1050186 | 3:9f857750e4e9 | 419 | /** |
1050186 | 3:9f857750e4e9 | 420 | * @brief rgba8888_t_to_argb8888_t |
1050186 | 3:9f857750e4e9 | 421 | * |
1050186 | 3:9f857750e4e9 | 422 | * @par Parameters |
1050186 | 3:9f857750e4e9 | 423 | * None |
1050186 | 3:9f857750e4e9 | 424 | * @return None. |
1050186 | 3:9f857750e4e9 | 425 | */ |
1050186 | 3:9f857750e4e9 | 426 | INLINE argb8888_t rgba8888_t_to_argb8888_t( rgba8888_t Color ) |
1050186 | 3:9f857750e4e9 | 427 | { |
1050186 | 3:9f857750e4e9 | 428 | argb8888_t ret; |
1050186 | 3:9f857750e4e9 | 429 | |
1050186 | 3:9f857750e4e9 | 430 | ret.Value = ( |
1050186 | 3:9f857750e4e9 | 431 | ( ( Color.Value & 0xFF000000 ) >> 8 ) | /* R */ |
1050186 | 3:9f857750e4e9 | 432 | ( ( Color.Value & 0x00FF0000 ) >> 8 ) | /* G */ |
1050186 | 3:9f857750e4e9 | 433 | ( ( Color.Value & 0x0000FF00 ) >> 8 ) | /* B */ |
1050186 | 3:9f857750e4e9 | 434 | ( ( Color.Value & 0x000000FF ) << 24 ) ); /* A */ |
1050186 | 3:9f857750e4e9 | 435 | |
1050186 | 3:9f857750e4e9 | 436 | return ret; |
1050186 | 3:9f857750e4e9 | 437 | } |
1050186 | 3:9f857750e4e9 | 438 | |
1050186 | 3:9f857750e4e9 | 439 | |
1050186 | 3:9f857750e4e9 | 440 | #ifdef __cplusplus |
1050186 | 3:9f857750e4e9 | 441 | } /* extern "C" */ |
1050186 | 3:9f857750e4e9 | 442 | #endif /* __cplusplus */ |
1050186 | 3:9f857750e4e9 | 443 | |
1050186 | 3:9f857750e4e9 | 444 | #endif /* NOT_DEFINE_INLINE_FUNCTION */ |
1050186 | 3:9f857750e4e9 | 445 | #endif /* RGA_PORT_INLINE_H */ |