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
common/inc/clib_drivers.h@0:37e1e6a45ced, 2015-08-19 (annotated)
- Committer:
- dkato
- Date:
- Wed Aug 19 08:58:26 2015 +0000
- Revision:
- 0:37e1e6a45ced
- Child:
- 3:9f857750e4e9
first comit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dkato | 0:37e1e6a45ced | 1 | /******************************************************************************* |
dkato | 0:37e1e6a45ced | 2 | * DISCLAIMER |
dkato | 0:37e1e6a45ced | 3 | * This software is supplied by Renesas Electronics Corporation and is only |
dkato | 0:37e1e6a45ced | 4 | * intended for use with Renesas products. No other uses are authorized. This |
dkato | 0:37e1e6a45ced | 5 | * software is owned by Renesas Electronics Corporation and is protected under |
dkato | 0:37e1e6a45ced | 6 | * all applicable laws, including copyright laws. |
dkato | 0:37e1e6a45ced | 7 | * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING |
dkato | 0:37e1e6a45ced | 8 | * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT |
dkato | 0:37e1e6a45ced | 9 | * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE |
dkato | 0:37e1e6a45ced | 10 | * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. |
dkato | 0:37e1e6a45ced | 11 | * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS |
dkato | 0:37e1e6a45ced | 12 | * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE |
dkato | 0:37e1e6a45ced | 13 | * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR |
dkato | 0:37e1e6a45ced | 14 | * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE |
dkato | 0:37e1e6a45ced | 15 | * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
dkato | 0:37e1e6a45ced | 16 | * Renesas reserves the right, without notice, to make changes to this software |
dkato | 0:37e1e6a45ced | 17 | * and to discontinue the availability of this software. By using this software, |
dkato | 0:37e1e6a45ced | 18 | * you agree to the additional terms and conditions found by accessing the |
dkato | 0:37e1e6a45ced | 19 | * following link: |
dkato | 0:37e1e6a45ced | 20 | * http://www.renesas.com/disclaimer |
dkato | 0:37e1e6a45ced | 21 | * Copyright (C) 2013 - 2015 Renesas Electronics Corporation. All rights reserved. |
dkato | 0:37e1e6a45ced | 22 | *******************************************************************************/ |
dkato | 0:37e1e6a45ced | 23 | /** |
dkato | 0:37e1e6a45ced | 24 | * @file clib_drivers.h |
dkato | 0:37e1e6a45ced | 25 | * @brief $Module: CLibCommon $ $PublicVersion: 0.90 $ (=CLIB_VERSION) |
dkato | 0:37e1e6a45ced | 26 | * $Rev: 30 $ |
dkato | 0:37e1e6a45ced | 27 | * $Date:: 2014-02-13 21:21:47 +0900#$ |
dkato | 0:37e1e6a45ced | 28 | * - Description: Common code for drivers and more. |
dkato | 0:37e1e6a45ced | 29 | */ |
dkato | 0:37e1e6a45ced | 30 | |
dkato | 0:37e1e6a45ced | 31 | #ifndef CLIB_DRIVERS_H |
dkato | 0:37e1e6a45ced | 32 | #define CLIB_DRIVERS_H |
dkato | 0:37e1e6a45ced | 33 | |
dkato | 0:37e1e6a45ced | 34 | /****************************************************************************** |
dkato | 0:37e1e6a45ced | 35 | Includes <System Includes> , "Project Includes" |
dkato | 0:37e1e6a45ced | 36 | ******************************************************************************/ |
dkato | 0:37e1e6a45ced | 37 | #include "r_ospl_typedef.h" |
dkato | 0:37e1e6a45ced | 38 | #include "clib_drivers_typedef.h" |
dkato | 0:37e1e6a45ced | 39 | |
dkato | 0:37e1e6a45ced | 40 | /* for Inline Functions */ |
dkato | 0:37e1e6a45ced | 41 | #include "r_multi_compiler.h" |
dkato | 0:37e1e6a45ced | 42 | |
dkato | 0:37e1e6a45ced | 43 | |
dkato | 0:37e1e6a45ced | 44 | #ifdef __cplusplus |
dkato | 0:37e1e6a45ced | 45 | extern "C" { |
dkato | 0:37e1e6a45ced | 46 | #endif /* __cplusplus */ |
dkato | 0:37e1e6a45ced | 47 | |
dkato | 0:37e1e6a45ced | 48 | |
dkato | 0:37e1e6a45ced | 49 | /****************************************************************************** |
dkato | 0:37e1e6a45ced | 50 | Typedef definitions |
dkato | 0:37e1e6a45ced | 51 | ******************************************************************************/ |
dkato | 0:37e1e6a45ced | 52 | /* in clib_drivers_typedef.h */ |
dkato | 0:37e1e6a45ced | 53 | |
dkato | 0:37e1e6a45ced | 54 | /****************************************************************************** |
dkato | 0:37e1e6a45ced | 55 | Macro definitions |
dkato | 0:37e1e6a45ced | 56 | ******************************************************************************/ |
dkato | 0:37e1e6a45ced | 57 | /* in clib_drivers_typedef.h */ |
dkato | 0:37e1e6a45ced | 58 | |
dkato | 0:37e1e6a45ced | 59 | /****************************************************************************** |
dkato | 0:37e1e6a45ced | 60 | Variable Externs |
dkato | 0:37e1e6a45ced | 61 | ******************************************************************************/ |
dkato | 0:37e1e6a45ced | 62 | /* in clib_drivers_typedef.h */ |
dkato | 0:37e1e6a45ced | 63 | |
dkato | 0:37e1e6a45ced | 64 | /****************************************************************************** |
dkato | 0:37e1e6a45ced | 65 | Functions Prototypes |
dkato | 0:37e1e6a45ced | 66 | ******************************************************************************/ |
dkato | 0:37e1e6a45ced | 67 | |
dkato | 0:37e1e6a45ced | 68 | errnum_t R_int32_t_to_int8_t( int32_t input, int8_t *output ); |
dkato | 0:37e1e6a45ced | 69 | |
dkato | 0:37e1e6a45ced | 70 | |
dkato | 0:37e1e6a45ced | 71 | |
dkato | 0:37e1e6a45ced | 72 | /*-------------------------------------------------------------------------*/ |
dkato | 0:37e1e6a45ced | 73 | /* <<<< ### Inline Functions >>>> */ |
dkato | 0:37e1e6a45ced | 74 | /*-------------------------------------------------------------------------*/ |
dkato | 0:37e1e6a45ced | 75 | |
dkato | 0:37e1e6a45ced | 76 | /** |
dkato | 0:37e1e6a45ced | 77 | * @brief Cast with range check |
dkato | 0:37e1e6a45ced | 78 | * |
dkato | 0:37e1e6a45ced | 79 | * @param input Input value |
dkato | 0:37e1e6a45ced | 80 | * @param output Output value |
dkato | 0:37e1e6a45ced | 81 | * @return Error Code. 0=No Error. |
dkato | 0:37e1e6a45ced | 82 | */ |
dkato | 0:37e1e6a45ced | 83 | INLINE errnum_t R_int_t_to_int8_t( int_t input, int8_t *output ) |
dkato | 0:37e1e6a45ced | 84 | { |
dkato | 0:37e1e6a45ced | 85 | return R_int32_t_to_int8_t( input, output ); |
dkato | 0:37e1e6a45ced | 86 | } |
dkato | 0:37e1e6a45ced | 87 | |
dkato | 0:37e1e6a45ced | 88 | |
dkato | 0:37e1e6a45ced | 89 | /** |
dkato | 0:37e1e6a45ced | 90 | * @brief Fast mod operation |
dkato | 0:37e1e6a45ced | 91 | * |
dkato | 0:37e1e6a45ced | 92 | * @param value Left operand |
dkato | 0:37e1e6a45ced | 93 | * @return value % N |
dkato | 0:37e1e6a45ced | 94 | * |
dkato | 0:37e1e6a45ced | 95 | * @par Description |
dkato | 0:37e1e6a45ced | 96 | * - This is shared description of |
dkato | 0:37e1e6a45ced | 97 | * R_Mod_2s, R_Mod_4s, R_Mod_8s, R_Mod_16s, R_Mod_32s, R_Mod_64s, |
dkato | 0:37e1e6a45ced | 98 | * R_Mod_2u, R_Mod_4u, R_Mod_8u, R_Mod_16u, R_Mod_32u, R_Mod_64u. |
dkato | 0:37e1e6a45ced | 99 | * - Porting layer of fast % operator. |
dkato | 0:37e1e6a45ced | 100 | * - MISRA & IPA SEC confirmed version. |
dkato | 0:37e1e6a45ced | 101 | * - Minus value is expected 2's complement. |
dkato | 0:37e1e6a45ced | 102 | * - Not same C99 % operator. |
dkato | 0:37e1e6a45ced | 103 | * - Sample: R_Mod_4s( - 7 ) == +1. Sample: -7 % 4 == -3 |
dkato | 0:37e1e6a45ced | 104 | */ |
dkato | 0:37e1e6a45ced | 105 | |
dkato | 0:37e1e6a45ced | 106 | |
dkato | 0:37e1e6a45ced | 107 | /** |
dkato | 0:37e1e6a45ced | 108 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 109 | * |
dkato | 0:37e1e6a45ced | 110 | * @par Parameters |
dkato | 0:37e1e6a45ced | 111 | * None |
dkato | 0:37e1e6a45ced | 112 | * @return None. |
dkato | 0:37e1e6a45ced | 113 | */ |
dkato | 0:37e1e6a45ced | 114 | INLINE int_fast32_t R_Mod_2s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 115 | { |
dkato | 0:37e1e6a45ced | 116 | enum { mask = 1 }; |
dkato | 0:37e1e6a45ced | 117 | return ((int_fast32_t)((uint_fast32_t)(value) & mask)); |
dkato | 0:37e1e6a45ced | 118 | } |
dkato | 0:37e1e6a45ced | 119 | |
dkato | 0:37e1e6a45ced | 120 | |
dkato | 0:37e1e6a45ced | 121 | /** |
dkato | 0:37e1e6a45ced | 122 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 123 | * |
dkato | 0:37e1e6a45ced | 124 | * @par Parameters |
dkato | 0:37e1e6a45ced | 125 | * None |
dkato | 0:37e1e6a45ced | 126 | * @return None. |
dkato | 0:37e1e6a45ced | 127 | */ |
dkato | 0:37e1e6a45ced | 128 | INLINE int_fast32_t R_Mod_4s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 129 | { |
dkato | 0:37e1e6a45ced | 130 | enum { mask = 3 }; |
dkato | 0:37e1e6a45ced | 131 | return ((int_fast32_t)((uint_fast32_t)(value) & mask)); |
dkato | 0:37e1e6a45ced | 132 | } |
dkato | 0:37e1e6a45ced | 133 | |
dkato | 0:37e1e6a45ced | 134 | |
dkato | 0:37e1e6a45ced | 135 | /** |
dkato | 0:37e1e6a45ced | 136 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 137 | * |
dkato | 0:37e1e6a45ced | 138 | * @par Parameters |
dkato | 0:37e1e6a45ced | 139 | * None |
dkato | 0:37e1e6a45ced | 140 | * @return None. |
dkato | 0:37e1e6a45ced | 141 | */ |
dkato | 0:37e1e6a45ced | 142 | INLINE int_fast32_t R_Mod_8s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 143 | { |
dkato | 0:37e1e6a45ced | 144 | enum { mask = 7 }; |
dkato | 0:37e1e6a45ced | 145 | return ((int_fast32_t)((uint_fast32_t)(value) & mask)); |
dkato | 0:37e1e6a45ced | 146 | } |
dkato | 0:37e1e6a45ced | 147 | |
dkato | 0:37e1e6a45ced | 148 | |
dkato | 0:37e1e6a45ced | 149 | /** |
dkato | 0:37e1e6a45ced | 150 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 151 | * |
dkato | 0:37e1e6a45ced | 152 | * @par Parameters |
dkato | 0:37e1e6a45ced | 153 | * None |
dkato | 0:37e1e6a45ced | 154 | * @return None. |
dkato | 0:37e1e6a45ced | 155 | */ |
dkato | 0:37e1e6a45ced | 156 | INLINE int_fast32_t R_Mod_16s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 157 | { |
dkato | 0:37e1e6a45ced | 158 | enum { mask = 15 }; |
dkato | 0:37e1e6a45ced | 159 | return ((int_fast32_t)((uint_fast32_t)(value) & mask)); |
dkato | 0:37e1e6a45ced | 160 | } |
dkato | 0:37e1e6a45ced | 161 | |
dkato | 0:37e1e6a45ced | 162 | |
dkato | 0:37e1e6a45ced | 163 | /** |
dkato | 0:37e1e6a45ced | 164 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 165 | * |
dkato | 0:37e1e6a45ced | 166 | * @par Parameters |
dkato | 0:37e1e6a45ced | 167 | * None |
dkato | 0:37e1e6a45ced | 168 | * @return None. |
dkato | 0:37e1e6a45ced | 169 | */ |
dkato | 0:37e1e6a45ced | 170 | INLINE int_fast32_t R_Mod_32s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 171 | { |
dkato | 0:37e1e6a45ced | 172 | enum { mask = 31 }; |
dkato | 0:37e1e6a45ced | 173 | return ((int_fast32_t)((uint_fast32_t)(value) & mask)); |
dkato | 0:37e1e6a45ced | 174 | } |
dkato | 0:37e1e6a45ced | 175 | |
dkato | 0:37e1e6a45ced | 176 | |
dkato | 0:37e1e6a45ced | 177 | /** |
dkato | 0:37e1e6a45ced | 178 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 179 | * |
dkato | 0:37e1e6a45ced | 180 | * @par Parameters |
dkato | 0:37e1e6a45ced | 181 | * None |
dkato | 0:37e1e6a45ced | 182 | * @return None. |
dkato | 0:37e1e6a45ced | 183 | */ |
dkato | 0:37e1e6a45ced | 184 | INLINE int_fast32_t R_Mod_64s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 185 | { |
dkato | 0:37e1e6a45ced | 186 | enum { mask = 63 }; |
dkato | 0:37e1e6a45ced | 187 | return ((int_fast32_t)((uint_fast32_t)(value) & mask)); |
dkato | 0:37e1e6a45ced | 188 | } |
dkato | 0:37e1e6a45ced | 189 | |
dkato | 0:37e1e6a45ced | 190 | |
dkato | 0:37e1e6a45ced | 191 | /** |
dkato | 0:37e1e6a45ced | 192 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 193 | * |
dkato | 0:37e1e6a45ced | 194 | * @par Parameters |
dkato | 0:37e1e6a45ced | 195 | * None |
dkato | 0:37e1e6a45ced | 196 | * @return None. |
dkato | 0:37e1e6a45ced | 197 | */ |
dkato | 0:37e1e6a45ced | 198 | INLINE uint_fast32_t R_Mod_2u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 199 | { |
dkato | 0:37e1e6a45ced | 200 | return ((value) & 1u); |
dkato | 0:37e1e6a45ced | 201 | } |
dkato | 0:37e1e6a45ced | 202 | |
dkato | 0:37e1e6a45ced | 203 | |
dkato | 0:37e1e6a45ced | 204 | /** |
dkato | 0:37e1e6a45ced | 205 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 206 | * |
dkato | 0:37e1e6a45ced | 207 | * @par Parameters |
dkato | 0:37e1e6a45ced | 208 | * None |
dkato | 0:37e1e6a45ced | 209 | * @return None. |
dkato | 0:37e1e6a45ced | 210 | */ |
dkato | 0:37e1e6a45ced | 211 | INLINE uint_fast32_t R_Mod_4u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 212 | { |
dkato | 0:37e1e6a45ced | 213 | return ((value) & 3u); |
dkato | 0:37e1e6a45ced | 214 | } |
dkato | 0:37e1e6a45ced | 215 | |
dkato | 0:37e1e6a45ced | 216 | |
dkato | 0:37e1e6a45ced | 217 | /** |
dkato | 0:37e1e6a45ced | 218 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 219 | * |
dkato | 0:37e1e6a45ced | 220 | * @par Parameters |
dkato | 0:37e1e6a45ced | 221 | * None |
dkato | 0:37e1e6a45ced | 222 | * @return None. |
dkato | 0:37e1e6a45ced | 223 | */ |
dkato | 0:37e1e6a45ced | 224 | INLINE uint_fast32_t R_Mod_8u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 225 | { |
dkato | 0:37e1e6a45ced | 226 | return ((value) & 7u); |
dkato | 0:37e1e6a45ced | 227 | } |
dkato | 0:37e1e6a45ced | 228 | |
dkato | 0:37e1e6a45ced | 229 | |
dkato | 0:37e1e6a45ced | 230 | /** |
dkato | 0:37e1e6a45ced | 231 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 232 | * |
dkato | 0:37e1e6a45ced | 233 | * @par Parameters |
dkato | 0:37e1e6a45ced | 234 | * None |
dkato | 0:37e1e6a45ced | 235 | * @return None. |
dkato | 0:37e1e6a45ced | 236 | */ |
dkato | 0:37e1e6a45ced | 237 | INLINE uint_fast32_t R_Mod_16u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 238 | { |
dkato | 0:37e1e6a45ced | 239 | return ((value) & 15u); |
dkato | 0:37e1e6a45ced | 240 | } |
dkato | 0:37e1e6a45ced | 241 | |
dkato | 0:37e1e6a45ced | 242 | |
dkato | 0:37e1e6a45ced | 243 | /** |
dkato | 0:37e1e6a45ced | 244 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 245 | * |
dkato | 0:37e1e6a45ced | 246 | * @par Parameters |
dkato | 0:37e1e6a45ced | 247 | * None |
dkato | 0:37e1e6a45ced | 248 | * @return None. |
dkato | 0:37e1e6a45ced | 249 | */ |
dkato | 0:37e1e6a45ced | 250 | INLINE uint_fast32_t R_Mod_32u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 251 | { |
dkato | 0:37e1e6a45ced | 252 | return ((value) & 31u); |
dkato | 0:37e1e6a45ced | 253 | } |
dkato | 0:37e1e6a45ced | 254 | |
dkato | 0:37e1e6a45ced | 255 | |
dkato | 0:37e1e6a45ced | 256 | /** |
dkato | 0:37e1e6a45ced | 257 | * @brief Fast mod operation. See <R_Mod_N>. |
dkato | 0:37e1e6a45ced | 258 | * |
dkato | 0:37e1e6a45ced | 259 | * @par Parameters |
dkato | 0:37e1e6a45ced | 260 | * None |
dkato | 0:37e1e6a45ced | 261 | * @return None. |
dkato | 0:37e1e6a45ced | 262 | */ |
dkato | 0:37e1e6a45ced | 263 | INLINE uint_fast32_t R_Mod_64u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 264 | { |
dkato | 0:37e1e6a45ced | 265 | return ((value) & 63u); |
dkato | 0:37e1e6a45ced | 266 | } |
dkato | 0:37e1e6a45ced | 267 | |
dkato | 0:37e1e6a45ced | 268 | |
dkato | 0:37e1e6a45ced | 269 | /** |
dkato | 0:37e1e6a45ced | 270 | * @brief Fast ceil operation |
dkato | 0:37e1e6a45ced | 271 | * |
dkato | 0:37e1e6a45ced | 272 | * @param value Left operand |
dkato | 0:37e1e6a45ced | 273 | * @return Ceil( value / N ) |
dkato | 0:37e1e6a45ced | 274 | * |
dkato | 0:37e1e6a45ced | 275 | * @par Description |
dkato | 0:37e1e6a45ced | 276 | * - This is shared description of |
dkato | 0:37e1e6a45ced | 277 | * R_Ceil_2s, R_Ceil_4s, R_Ceil_8s, R_Ceil_16s, R_Ceil_32s, R_Ceil_64s, |
dkato | 0:37e1e6a45ced | 278 | * R_Ceil_2u, R_Ceil_4u, R_Ceil_8u, R_Ceil_16u, R_Ceil_32u, R_Ceil_64u. |
dkato | 0:37e1e6a45ced | 279 | * - Porting layer of fast ceil operation. |
dkato | 0:37e1e6a45ced | 280 | * - Function version is confirmed with MISRA & IPA SEC. |
dkato | 0:37e1e6a45ced | 281 | */ |
dkato | 0:37e1e6a45ced | 282 | |
dkato | 0:37e1e6a45ced | 283 | |
dkato | 0:37e1e6a45ced | 284 | /** |
dkato | 0:37e1e6a45ced | 285 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 286 | * |
dkato | 0:37e1e6a45ced | 287 | * @par Parameters |
dkato | 0:37e1e6a45ced | 288 | * None |
dkato | 0:37e1e6a45ced | 289 | * @return None. |
dkato | 0:37e1e6a45ced | 290 | */ |
dkato | 0:37e1e6a45ced | 291 | INLINE int_fast32_t R_Ceil_2s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 292 | { |
dkato | 0:37e1e6a45ced | 293 | static const uint_fast32_t mask = 1; |
dkato | 0:37e1e6a45ced | 294 | return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask)); |
dkato | 0:37e1e6a45ced | 295 | } |
dkato | 0:37e1e6a45ced | 296 | |
dkato | 0:37e1e6a45ced | 297 | |
dkato | 0:37e1e6a45ced | 298 | /** |
dkato | 0:37e1e6a45ced | 299 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 300 | * |
dkato | 0:37e1e6a45ced | 301 | * @par Parameters |
dkato | 0:37e1e6a45ced | 302 | * None |
dkato | 0:37e1e6a45ced | 303 | * @return None. |
dkato | 0:37e1e6a45ced | 304 | */ |
dkato | 0:37e1e6a45ced | 305 | INLINE int_fast32_t R_Ceil_4s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 306 | { |
dkato | 0:37e1e6a45ced | 307 | static const uint_fast32_t mask = 3; |
dkato | 0:37e1e6a45ced | 308 | return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask)); |
dkato | 0:37e1e6a45ced | 309 | } |
dkato | 0:37e1e6a45ced | 310 | |
dkato | 0:37e1e6a45ced | 311 | |
dkato | 0:37e1e6a45ced | 312 | /** |
dkato | 0:37e1e6a45ced | 313 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 314 | * |
dkato | 0:37e1e6a45ced | 315 | * @par Parameters |
dkato | 0:37e1e6a45ced | 316 | * None |
dkato | 0:37e1e6a45ced | 317 | * @return None. |
dkato | 0:37e1e6a45ced | 318 | */ |
dkato | 0:37e1e6a45ced | 319 | INLINE int_fast32_t R_Ceil_8s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 320 | { |
dkato | 0:37e1e6a45ced | 321 | static const uint_fast32_t mask = 7; |
dkato | 0:37e1e6a45ced | 322 | return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask)); |
dkato | 0:37e1e6a45ced | 323 | } |
dkato | 0:37e1e6a45ced | 324 | |
dkato | 0:37e1e6a45ced | 325 | |
dkato | 0:37e1e6a45ced | 326 | /** |
dkato | 0:37e1e6a45ced | 327 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 328 | * |
dkato | 0:37e1e6a45ced | 329 | * @par Parameters |
dkato | 0:37e1e6a45ced | 330 | * None |
dkato | 0:37e1e6a45ced | 331 | * @return None. |
dkato | 0:37e1e6a45ced | 332 | */ |
dkato | 0:37e1e6a45ced | 333 | INLINE int_fast32_t R_Ceil_16s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 334 | { |
dkato | 0:37e1e6a45ced | 335 | static const uint_fast32_t mask = 15; |
dkato | 0:37e1e6a45ced | 336 | return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask)); |
dkato | 0:37e1e6a45ced | 337 | } |
dkato | 0:37e1e6a45ced | 338 | |
dkato | 0:37e1e6a45ced | 339 | |
dkato | 0:37e1e6a45ced | 340 | /** |
dkato | 0:37e1e6a45ced | 341 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 342 | * |
dkato | 0:37e1e6a45ced | 343 | * @par Parameters |
dkato | 0:37e1e6a45ced | 344 | * None |
dkato | 0:37e1e6a45ced | 345 | * @return None. |
dkato | 0:37e1e6a45ced | 346 | */ |
dkato | 0:37e1e6a45ced | 347 | INLINE int_fast32_t R_Ceil_32s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 348 | { |
dkato | 0:37e1e6a45ced | 349 | static const uint_fast32_t mask = 31; |
dkato | 0:37e1e6a45ced | 350 | return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask)); |
dkato | 0:37e1e6a45ced | 351 | } |
dkato | 0:37e1e6a45ced | 352 | |
dkato | 0:37e1e6a45ced | 353 | |
dkato | 0:37e1e6a45ced | 354 | /** |
dkato | 0:37e1e6a45ced | 355 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 356 | * |
dkato | 0:37e1e6a45ced | 357 | * @par Parameters |
dkato | 0:37e1e6a45ced | 358 | * None |
dkato | 0:37e1e6a45ced | 359 | * @return None. |
dkato | 0:37e1e6a45ced | 360 | */ |
dkato | 0:37e1e6a45ced | 361 | INLINE int_fast32_t R_Ceil_64s( int_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 362 | { |
dkato | 0:37e1e6a45ced | 363 | static const uint_fast32_t mask = 63; |
dkato | 0:37e1e6a45ced | 364 | return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask)); |
dkato | 0:37e1e6a45ced | 365 | } |
dkato | 0:37e1e6a45ced | 366 | |
dkato | 0:37e1e6a45ced | 367 | |
dkato | 0:37e1e6a45ced | 368 | /** |
dkato | 0:37e1e6a45ced | 369 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 370 | * |
dkato | 0:37e1e6a45ced | 371 | * @par Parameters |
dkato | 0:37e1e6a45ced | 372 | * None |
dkato | 0:37e1e6a45ced | 373 | * @return None. |
dkato | 0:37e1e6a45ced | 374 | */ |
dkato | 0:37e1e6a45ced | 375 | INLINE uint_fast32_t R_Ceil_2u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 376 | { |
dkato | 0:37e1e6a45ced | 377 | static const uint_fast32_t mask = 1; |
dkato | 0:37e1e6a45ced | 378 | return (((value)+mask)&~mask); |
dkato | 0:37e1e6a45ced | 379 | } |
dkato | 0:37e1e6a45ced | 380 | |
dkato | 0:37e1e6a45ced | 381 | |
dkato | 0:37e1e6a45ced | 382 | /** |
dkato | 0:37e1e6a45ced | 383 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 384 | * |
dkato | 0:37e1e6a45ced | 385 | * @par Parameters |
dkato | 0:37e1e6a45ced | 386 | * None |
dkato | 0:37e1e6a45ced | 387 | * @return None. |
dkato | 0:37e1e6a45ced | 388 | */ |
dkato | 0:37e1e6a45ced | 389 | INLINE uint_fast32_t R_Ceil_4u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 390 | { |
dkato | 0:37e1e6a45ced | 391 | static const uint_fast32_t mask = 3; |
dkato | 0:37e1e6a45ced | 392 | return (((value)+mask)&~mask); |
dkato | 0:37e1e6a45ced | 393 | } |
dkato | 0:37e1e6a45ced | 394 | |
dkato | 0:37e1e6a45ced | 395 | |
dkato | 0:37e1e6a45ced | 396 | /** |
dkato | 0:37e1e6a45ced | 397 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 398 | * |
dkato | 0:37e1e6a45ced | 399 | * @par Parameters |
dkato | 0:37e1e6a45ced | 400 | * None |
dkato | 0:37e1e6a45ced | 401 | * @return None. |
dkato | 0:37e1e6a45ced | 402 | */ |
dkato | 0:37e1e6a45ced | 403 | INLINE uint_fast32_t R_Ceil_8u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 404 | { |
dkato | 0:37e1e6a45ced | 405 | static const uint_fast32_t mask = 7; |
dkato | 0:37e1e6a45ced | 406 | return (((value)+mask)&~mask); |
dkato | 0:37e1e6a45ced | 407 | } |
dkato | 0:37e1e6a45ced | 408 | |
dkato | 0:37e1e6a45ced | 409 | |
dkato | 0:37e1e6a45ced | 410 | /** |
dkato | 0:37e1e6a45ced | 411 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 412 | * |
dkato | 0:37e1e6a45ced | 413 | * @par Parameters |
dkato | 0:37e1e6a45ced | 414 | * None |
dkato | 0:37e1e6a45ced | 415 | * @return None. |
dkato | 0:37e1e6a45ced | 416 | */ |
dkato | 0:37e1e6a45ced | 417 | INLINE uint_fast32_t R_Ceil_16u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 418 | { |
dkato | 0:37e1e6a45ced | 419 | static const uint_fast32_t mask = 15; |
dkato | 0:37e1e6a45ced | 420 | return (((value)+mask)&~mask); |
dkato | 0:37e1e6a45ced | 421 | } |
dkato | 0:37e1e6a45ced | 422 | |
dkato | 0:37e1e6a45ced | 423 | |
dkato | 0:37e1e6a45ced | 424 | /** |
dkato | 0:37e1e6a45ced | 425 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 426 | * |
dkato | 0:37e1e6a45ced | 427 | * @par Parameters |
dkato | 0:37e1e6a45ced | 428 | * None |
dkato | 0:37e1e6a45ced | 429 | * @return None. |
dkato | 0:37e1e6a45ced | 430 | */ |
dkato | 0:37e1e6a45ced | 431 | INLINE uint_fast32_t R_Ceil_32u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 432 | { |
dkato | 0:37e1e6a45ced | 433 | static const uint_fast32_t mask = 31; |
dkato | 0:37e1e6a45ced | 434 | return (((value)+mask)&~mask); |
dkato | 0:37e1e6a45ced | 435 | } |
dkato | 0:37e1e6a45ced | 436 | |
dkato | 0:37e1e6a45ced | 437 | |
dkato | 0:37e1e6a45ced | 438 | /** |
dkato | 0:37e1e6a45ced | 439 | * @brief Fast ceil operation. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 440 | * |
dkato | 0:37e1e6a45ced | 441 | * @par Parameters |
dkato | 0:37e1e6a45ced | 442 | * None |
dkato | 0:37e1e6a45ced | 443 | * @return None. |
dkato | 0:37e1e6a45ced | 444 | */ |
dkato | 0:37e1e6a45ced | 445 | INLINE uint_fast32_t R_Ceil_64u( uint_fast32_t const value ) |
dkato | 0:37e1e6a45ced | 446 | { |
dkato | 0:37e1e6a45ced | 447 | static const uint_fast32_t mask = 63; |
dkato | 0:37e1e6a45ced | 448 | return (((value)+mask)&~mask); |
dkato | 0:37e1e6a45ced | 449 | } |
dkato | 0:37e1e6a45ced | 450 | |
dkato | 0:37e1e6a45ced | 451 | |
dkato | 0:37e1e6a45ced | 452 | /** |
dkato | 0:37e1e6a45ced | 453 | * @brief Fast ceil operation. Macro version. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 454 | * |
dkato | 0:37e1e6a45ced | 455 | * @par Parameters |
dkato | 0:37e1e6a45ced | 456 | * None |
dkato | 0:37e1e6a45ced | 457 | * @return None. |
dkato | 0:37e1e6a45ced | 458 | */ |
dkato | 0:37e1e6a45ced | 459 | #define R_CEIL_2U( value ) (((value)+1)&~1) |
dkato | 0:37e1e6a45ced | 460 | |
dkato | 0:37e1e6a45ced | 461 | |
dkato | 0:37e1e6a45ced | 462 | /** |
dkato | 0:37e1e6a45ced | 463 | * @brief Fast ceil operation. Macro version. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 464 | * |
dkato | 0:37e1e6a45ced | 465 | * @par Parameters |
dkato | 0:37e1e6a45ced | 466 | * None |
dkato | 0:37e1e6a45ced | 467 | * @return None. |
dkato | 0:37e1e6a45ced | 468 | */ |
dkato | 0:37e1e6a45ced | 469 | #define R_CEIL_4U( value ) (((value)+3)&~3) |
dkato | 0:37e1e6a45ced | 470 | |
dkato | 0:37e1e6a45ced | 471 | |
dkato | 0:37e1e6a45ced | 472 | /** |
dkato | 0:37e1e6a45ced | 473 | * @brief Fast ceil operation. Macro version. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 474 | * |
dkato | 0:37e1e6a45ced | 475 | * @par Parameters |
dkato | 0:37e1e6a45ced | 476 | * None |
dkato | 0:37e1e6a45ced | 477 | * @return None. |
dkato | 0:37e1e6a45ced | 478 | */ |
dkato | 0:37e1e6a45ced | 479 | #define R_CEIL_8U( value ) (((value)+7)&~7) |
dkato | 0:37e1e6a45ced | 480 | |
dkato | 0:37e1e6a45ced | 481 | |
dkato | 0:37e1e6a45ced | 482 | /** |
dkato | 0:37e1e6a45ced | 483 | * @brief Fast ceil operation. Macro version. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 484 | * |
dkato | 0:37e1e6a45ced | 485 | * @par Parameters |
dkato | 0:37e1e6a45ced | 486 | * None |
dkato | 0:37e1e6a45ced | 487 | * @return None. |
dkato | 0:37e1e6a45ced | 488 | */ |
dkato | 0:37e1e6a45ced | 489 | #define R_CEIL_16U( value ) (((value)+15)&~15) |
dkato | 0:37e1e6a45ced | 490 | |
dkato | 0:37e1e6a45ced | 491 | |
dkato | 0:37e1e6a45ced | 492 | /** |
dkato | 0:37e1e6a45ced | 493 | * @brief Fast ceil operation. Macro version. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 494 | * |
dkato | 0:37e1e6a45ced | 495 | * @par Parameters |
dkato | 0:37e1e6a45ced | 496 | * None |
dkato | 0:37e1e6a45ced | 497 | * @return None. |
dkato | 0:37e1e6a45ced | 498 | */ |
dkato | 0:37e1e6a45ced | 499 | #define R_CEIL_32U( value ) (((value)+31)&~31) |
dkato | 0:37e1e6a45ced | 500 | |
dkato | 0:37e1e6a45ced | 501 | |
dkato | 0:37e1e6a45ced | 502 | /** |
dkato | 0:37e1e6a45ced | 503 | * @brief Fast ceil operation. Macro version. See <R_Ceil_N>. |
dkato | 0:37e1e6a45ced | 504 | * |
dkato | 0:37e1e6a45ced | 505 | * @par Parameters |
dkato | 0:37e1e6a45ced | 506 | * None |
dkato | 0:37e1e6a45ced | 507 | * @return None. |
dkato | 0:37e1e6a45ced | 508 | */ |
dkato | 0:37e1e6a45ced | 509 | #define R_CEIL_64U( value ) (((value)+63)&~63) |
dkato | 0:37e1e6a45ced | 510 | |
dkato | 0:37e1e6a45ced | 511 | |
dkato | 0:37e1e6a45ced | 512 | #ifdef __cplusplus |
dkato | 0:37e1e6a45ced | 513 | } /* extern "C" */ |
dkato | 0:37e1e6a45ced | 514 | #endif /* __cplusplus */ |
dkato | 0:37e1e6a45ced | 515 | |
dkato | 0:37e1e6a45ced | 516 | #endif /* CLIB_DRIVERS_H */ |
dkato | 0:37e1e6a45ced | 517 | |
dkato | 0:37e1e6a45ced | 518 | |
dkato | 0:37e1e6a45ced | 519 |