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.

JPEGCorrespondence
Width>0(greater than 0)
Height>0(greater than 0)
Color formatYCbCr444, YCbCr422, YCbCr420, YCbCr411
BitmapCorrespondence
Width>0(greater than 0)
Height>0(greater than 0)
Color formatYCbCr422

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

Committer:
dkato
Date:
Mon Apr 24 08:16:23 2017 +0000
Revision:
13:1ee2176ef13f
Parent:
0:37e1e6a45ced
Add "SetQuality()" to JCU.
; Bug fixes.

Who changed what in which revision?

UserRevisionLine numberNew 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
dkato 0:37e1e6a45ced 22 *******************************************************************************/
dkato 0:37e1e6a45ced 23 /*******************************************************************************
dkato 0:37e1e6a45ced 24 * $FileName: jcu_para.c $
dkato 0:37e1e6a45ced 25 * $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
dkato 0:37e1e6a45ced 26 * $Rev: 38 $
dkato 0:37e1e6a45ced 27 * $Date:: 2014-03-18 16:14:45 +0900#$
dkato 0:37e1e6a45ced 28 * Description : JCU driver checking parameter
dkato 0:37e1e6a45ced 29 ******************************************************************************/
dkato 0:37e1e6a45ced 30
dkato 0:37e1e6a45ced 31 /******************************************************************************
dkato 0:37e1e6a45ced 32 Includes <System Includes> , "Project Includes"
dkato 0:37e1e6a45ced 33 ******************************************************************************/
dkato 0:37e1e6a45ced 34 #include <string.h>
dkato 0:37e1e6a45ced 35 #include "r_typedefs.h"
dkato 0:37e1e6a45ced 36 #include "r_ospl.h"
dkato 0:37e1e6a45ced 37 #include "r_jcu_api.h"
dkato 0:37e1e6a45ced 38 #include "r_jcu_local.h"
dkato 0:37e1e6a45ced 39 #include "r_jcu_user.h"
dkato 0:37e1e6a45ced 40 #include "iodefine.h"
dkato 0:37e1e6a45ced 41
dkato 0:37e1e6a45ced 42 #ifdef JCU_PARAMETER_CHECK
dkato 0:37e1e6a45ced 43
dkato 0:37e1e6a45ced 44 /******************************************************************************
dkato 0:37e1e6a45ced 45 Typedef definitions
dkato 0:37e1e6a45ced 46 ******************************************************************************/
dkato 0:37e1e6a45ced 47
dkato 0:37e1e6a45ced 48 /******************************************************************************
dkato 0:37e1e6a45ced 49 Macro definitions
dkato 0:37e1e6a45ced 50 ******************************************************************************/
dkato 0:37e1e6a45ced 51 #define MASK_LOW_3BIT (0x7u)
dkato 0:37e1e6a45ced 52 #define MOD_8 (0x8u)
dkato 0:37e1e6a45ced 53 #define MOD_16 (0x10u)
dkato 0:37e1e6a45ced 54
dkato 0:37e1e6a45ced 55 /******************************************************************************
dkato 0:37e1e6a45ced 56 Imported global variables and functions (from other files)
dkato 0:37e1e6a45ced 57 ******************************************************************************/
dkato 0:37e1e6a45ced 58
dkato 0:37e1e6a45ced 59 /******************************************************************************
dkato 0:37e1e6a45ced 60 Exported global variables and functions (to be accessed by other files)
dkato 0:37e1e6a45ced 61 ******************************************************************************/
dkato 0:37e1e6a45ced 62
dkato 0:37e1e6a45ced 63 /******************************************************************************
dkato 0:37e1e6a45ced 64 Private global variables and functions
dkato 0:37e1e6a45ced 65 ******************************************************************************/
dkato 0:37e1e6a45ced 66
dkato 0:37e1e6a45ced 67 /**************************************************************************//**
dkato 0:37e1e6a45ced 68 * Function Name : [JCU_ParaCheckSelectCodec]
dkato 0:37e1e6a45ced 69 * @brief SelectCodec api's parameter checking
dkato 0:37e1e6a45ced 70 * @param [in] codec codec type
dkato 0:37e1e6a45ced 71 * @retval jcu_errorcode_t
dkato 0:37e1e6a45ced 72 *****************************************************************************/
dkato 0:37e1e6a45ced 73 jcu_errorcode_t JCU_ParaCheckSelectCodec(
dkato 0:37e1e6a45ced 74 const jcu_codec_t codec)
dkato 0:37e1e6a45ced 75 {
dkato 0:37e1e6a45ced 76 jcu_errorcode_t returnValue;
dkato 0:37e1e6a45ced 77
dkato 0:37e1e6a45ced 78 IF_DS ((codec != JCU_ENCODE)
dkato 0:37e1e6a45ced 79 && (codec != JCU_DECODE)) {
dkato 0:37e1e6a45ced 80 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 81 }
dkato 0:37e1e6a45ced 82 else {
dkato 0:37e1e6a45ced 83 returnValue = JCU_ERROR_OK;
dkato 0:37e1e6a45ced 84 } /* end if */
dkato 0:37e1e6a45ced 85
dkato 0:37e1e6a45ced 86 return (returnValue);
dkato 0:37e1e6a45ced 87 }
dkato 0:37e1e6a45ced 88
dkato 0:37e1e6a45ced 89 /**************************************************************************//**
dkato 0:37e1e6a45ced 90 * Function Name : [JCU_ParaCheckStart]
dkato 0:37e1e6a45ced 91 * @brief Start api's parameter checking
dkato 0:37e1e6a45ced 92 * @param [in] codec codec type
dkato 0:37e1e6a45ced 93 * @retval jcu_errorcode_t
dkato 0:37e1e6a45ced 94 *****************************************************************************/
dkato 0:37e1e6a45ced 95 jcu_errorcode_t JCU_ParaCheckStart(
dkato 0:37e1e6a45ced 96 void)
dkato 0:37e1e6a45ced 97 {
dkato 0:37e1e6a45ced 98 jcu_errorcode_t returnValue;
dkato 0:37e1e6a45ced 99
dkato 0:37e1e6a45ced 100 /* If jcu already start, it cannot update this bit (this is limitation of hardware) */
dkato 0:37e1e6a45ced 101 IF ( (uint32_t)R_GET_REG_BIT_FIELD( JCU.JCCMD, JSRT ) == REG_F_SET ) {
dkato 0:37e1e6a45ced 102 returnValue = JCU_ERROR_STATUS;
dkato 0:37e1e6a45ced 103 }
dkato 0:37e1e6a45ced 104 else {
dkato 0:37e1e6a45ced 105 returnValue = JCU_ERROR_OK;
dkato 0:37e1e6a45ced 106 } /* end if */
dkato 0:37e1e6a45ced 107
dkato 0:37e1e6a45ced 108 return (returnValue);
dkato 0:37e1e6a45ced 109 }
dkato 0:37e1e6a45ced 110
dkato 0:37e1e6a45ced 111 /**************************************************************************//**
dkato 0:37e1e6a45ced 112 * Function Name : [JCU_ParaCheckSetCountMode]
dkato 0:37e1e6a45ced 113 * @brief parameter check for the SetCountMode
dkato 0:37e1e6a45ced 114 * @param [in] buffer the parameter for the Count Mode
dkato 0:37e1e6a45ced 115 * @retval jcu_errorcode_t
dkato 0:37e1e6a45ced 116 *****************************************************************************/
dkato 0:37e1e6a45ced 117 jcu_errorcode_t JCU_ParaCheckSetCountMode(
dkato 0:37e1e6a45ced 118 const jcu_count_mode_param_t *const buffer)
dkato 0:37e1e6a45ced 119 {
dkato 0:37e1e6a45ced 120 jcu_errorcode_t returnValue = JCU_ERROR_OK;
dkato 0:37e1e6a45ced 121
dkato 0:37e1e6a45ced 122 IF (buffer == NULL) {
dkato 0:37e1e6a45ced 123 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 124 goto fin;
dkato 0:37e1e6a45ced 125 } /* end if */
dkato 0:37e1e6a45ced 126
dkato 0:37e1e6a45ced 127 IF ((buffer->inputBuffer.isEnable != false) && (buffer->outputBuffer.isEnable != false)) {
dkato 0:37e1e6a45ced 128 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 129 goto fin;
dkato 0:37e1e6a45ced 130 }
dkato 0:37e1e6a45ced 131
dkato 0:37e1e6a45ced 132 if (buffer->inputBuffer.isEnable != false) {
dkato 0:37e1e6a45ced 133 /* When initAddress is true, restartAddress has to set the address */
dkato 0:37e1e6a45ced 134 if (buffer->inputBuffer.isInitAddress != false) {
dkato 0:37e1e6a45ced 135 IF (buffer->inputBuffer.restartAddress == NULL) {
dkato 0:37e1e6a45ced 136 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 137 goto fin;
dkato 0:37e1e6a45ced 138 } /* end if */
dkato 0:37e1e6a45ced 139 } /* end if */
dkato 0:37e1e6a45ced 140
dkato 0:37e1e6a45ced 141 /* Datasize(JDATAS/LINES bit) have to 8byte alignment */
dkato 0:37e1e6a45ced 142 IF ((buffer->inputBuffer.dataCount & MASK_LOW_3BIT) != 0u) {
dkato 0:37e1e6a45ced 143 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 144 goto fin;
dkato 0:37e1e6a45ced 145 } /* end if */
dkato 0:37e1e6a45ced 146
dkato 0:37e1e6a45ced 147 /* Datasize have to bigger than 0 */
dkato 0:37e1e6a45ced 148 IF (buffer->inputBuffer.dataCount == 0u) {
dkato 0:37e1e6a45ced 149 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 150 goto fin;
dkato 0:37e1e6a45ced 151 } /* end if */
dkato 0:37e1e6a45ced 152
dkato 0:37e1e6a45ced 153 } /* end if */
dkato 0:37e1e6a45ced 154
dkato 0:37e1e6a45ced 155 if (buffer->outputBuffer.isEnable != false) {
dkato 0:37e1e6a45ced 156 /* When initAddress is true, restartAddress has to set the address */
dkato 0:37e1e6a45ced 157 if (buffer->outputBuffer.isInitAddress != false) {
dkato 0:37e1e6a45ced 158 IF (buffer->outputBuffer.restartAddress == NULL) {
dkato 0:37e1e6a45ced 159 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 160 goto fin;
dkato 0:37e1e6a45ced 161 } /* end if */
dkato 0:37e1e6a45ced 162 } /* end if */
dkato 0:37e1e6a45ced 163
dkato 0:37e1e6a45ced 164 /* Datasize(JDATAS/LINES bit) have to 8byte alignment */
dkato 0:37e1e6a45ced 165 IF ((buffer->outputBuffer.dataCount & MASK_LOW_3BIT) != 0u) {
dkato 0:37e1e6a45ced 166 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 167 goto fin;
dkato 0:37e1e6a45ced 168 } /* end if */
dkato 0:37e1e6a45ced 169
dkato 0:37e1e6a45ced 170 /* Datasize have to bigger than 0 */
dkato 0:37e1e6a45ced 171 IF (buffer->outputBuffer.dataCount == 0u) {
dkato 0:37e1e6a45ced 172 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 173 goto fin;
dkato 0:37e1e6a45ced 174 } /* end if */
dkato 0:37e1e6a45ced 175
dkato 0:37e1e6a45ced 176 } /* end if */
dkato 0:37e1e6a45ced 177 fin:
dkato 0:37e1e6a45ced 178 return (returnValue);
dkato 0:37e1e6a45ced 179 }
dkato 0:37e1e6a45ced 180
dkato 0:37e1e6a45ced 181 /**************************************************************************//**
dkato 0:37e1e6a45ced 182 * Function Name : [JCU_ParaCheckSetDecodeParam]
dkato 0:37e1e6a45ced 183 * @brief SetDecodeParam api's parameter checking
dkato 0:37e1e6a45ced 184 * @param [in] buffer input and output buffer settings
dkato 0:37e1e6a45ced 185 * @param [in] interruptKind tye type of interrupt that use in this system
dkato 0:37e1e6a45ced 186 * @retval jcu_errorcode_t
dkato 0:37e1e6a45ced 187 *****************************************************************************/
dkato 0:37e1e6a45ced 188 jcu_errorcode_t JCU_ParaCheckSetDecodeParam(
dkato 0:37e1e6a45ced 189 const jcu_decode_param_t *const decode,
dkato 0:37e1e6a45ced 190 const jcu_buffer_param_t *const buffer)
dkato 0:37e1e6a45ced 191 {
dkato 0:37e1e6a45ced 192 jcu_errorcode_t returnValue = JCU_ERROR_OK;
dkato 0:37e1e6a45ced 193
dkato 0:37e1e6a45ced 194 IF ((decode == NULL) || (buffer == NULL)) {
dkato 0:37e1e6a45ced 195 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 196 goto fin;
dkato 0:37e1e6a45ced 197 } /* end if */
dkato 0:37e1e6a45ced 198
dkato 0:37e1e6a45ced 199 /* NULL check for the address data */
dkato 0:37e1e6a45ced 200 IF ((buffer->source.address == NULL)
dkato 0:37e1e6a45ced 201 || (buffer->destination.address == NULL)) {
dkato 0:37e1e6a45ced 202 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 203 goto fin;
dkato 0:37e1e6a45ced 204 } /* end if */
dkato 0:37e1e6a45ced 205
dkato 0:37e1e6a45ced 206 /* Check for the address alignment */
dkato 0:37e1e6a45ced 207 /* ->MISRA 11.3 */ /* ->SEC R2.7.1 */
dkato 0:37e1e6a45ced 208 IF ((((uint32_t) (buffer->source.address) % MOD_8) != 0u) ||
dkato 0:37e1e6a45ced 209 (((uint32_t) (buffer->destination.address) % MOD_8) != 0u))
dkato 0:37e1e6a45ced 210 /* <-MISRA 11.3 */ { /* <-SEC R2.7.1 */
dkato 0:37e1e6a45ced 211 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 212 goto fin;
dkato 0:37e1e6a45ced 213 } /* end if */
dkato 0:37e1e6a45ced 214
dkato 0:37e1e6a45ced 215 /*Check for Cb/Cr offset */
dkato 0:37e1e6a45ced 216 if(decode->decodeFormat == JCU_OUTPUT_YCbCr422) {
dkato 0:37e1e6a45ced 217 IF (((decode->outputCbCrOffset) != JCU_CBCR_OFFSET_0) && ((decode->outputCbCrOffset) != JCU_CBCR_OFFSET_128)) {
dkato 0:37e1e6a45ced 218 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 219 } /* end if */
dkato 0:37e1e6a45ced 220 } else {
dkato 0:37e1e6a45ced 221 IF ((decode->outputCbCrOffset) != JCU_CBCR_OFFSET_0) {
dkato 0:37e1e6a45ced 222 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 223 } /* end if */
dkato 0:37e1e6a45ced 224 } /* end if */
dkato 0:37e1e6a45ced 225 fin:
dkato 0:37e1e6a45ced 226 return (returnValue);
dkato 0:37e1e6a45ced 227 }
dkato 0:37e1e6a45ced 228
dkato 0:37e1e6a45ced 229 /**************************************************************************//**
dkato 0:37e1e6a45ced 230 * Function Name : [JCU_ParaCheckGetImageInfo]
dkato 0:37e1e6a45ced 231 * @brief GetImageInfo api's parameter checking
dkato 0:37e1e6a45ced 232 * @param [in] buffer buffer address that set the image information
dkato 0:37e1e6a45ced 233 * @retval jcu_errorcode_t
dkato 0:37e1e6a45ced 234 *****************************************************************************/
dkato 0:37e1e6a45ced 235 jcu_errorcode_t JCU_ParaCheckGetImageInfo(
dkato 0:37e1e6a45ced 236 const jcu_image_info_t *const buffer)
dkato 0:37e1e6a45ced 237 {
dkato 0:37e1e6a45ced 238 jcu_errorcode_t returnValue = JCU_ERROR_OK;
dkato 0:37e1e6a45ced 239
dkato 0:37e1e6a45ced 240 IF (buffer == NULL) {
dkato 0:37e1e6a45ced 241 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 242 } /* end if */
dkato 0:37e1e6a45ced 243
dkato 0:37e1e6a45ced 244 return (returnValue);
dkato 0:37e1e6a45ced 245 }
dkato 0:37e1e6a45ced 246
dkato 0:37e1e6a45ced 247 /**************************************************************************//**
dkato 0:37e1e6a45ced 248 * Function Name : [JCU_ParaCheckSetQuantizationTbl]
dkato 0:37e1e6a45ced 249 * @brief SetQuantizationTable api's parameter checking
dkato 0:37e1e6a45ced 250 * @param [in] tableNo the table number that set the parameter
dkato 0:37e1e6a45ced 251 * @retval jcu_errorcode_t
dkato 0:37e1e6a45ced 252 *****************************************************************************/
dkato 0:37e1e6a45ced 253 jcu_errorcode_t JCU_ParaCheckSetQuantizationTbl(
dkato 0:37e1e6a45ced 254 const jcu_table_no_t tableNo)
dkato 0:37e1e6a45ced 255 {
dkato 0:37e1e6a45ced 256 jcu_errorcode_t returnValue = JCU_ERROR_OK;
dkato 0:37e1e6a45ced 257
dkato 0:37e1e6a45ced 258 /* ->MISRA 13.7 : For fail safe. */
dkato 0:37e1e6a45ced 259 IF_DS (tableNo > JCU_TABLE_NO_3)
dkato 0:37e1e6a45ced 260 /* <-MISRA 13.7 */
dkato 0:37e1e6a45ced 261 /* ->MISRA 14.1 ->QAC 3201 : For fail safe. */
dkato 0:37e1e6a45ced 262 {
dkato 0:37e1e6a45ced 263 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 264 } /* end if */
dkato 0:37e1e6a45ced 265 /* <-MISRA 14.1 <-QAC 3201 */
dkato 0:37e1e6a45ced 266
dkato 0:37e1e6a45ced 267 return (returnValue);
dkato 0:37e1e6a45ced 268 }
dkato 0:37e1e6a45ced 269
dkato 0:37e1e6a45ced 270 /**************************************************************************//**
dkato 0:37e1e6a45ced 271 * Function Name : [JCU_ParaCheckSetHuffmanTable]
dkato 0:37e1e6a45ced 272 * @brief SetHuffmanTable api's parameter checking
dkato 0:37e1e6a45ced 273 * @param [in] tableNo the table number that set the parameter
dkato 0:37e1e6a45ced 274 * @param [in] type the type which table is set(AC or DC)
dkato 0:37e1e6a45ced 275 * @retval jcu_errorcode_t
dkato 0:37e1e6a45ced 276 *****************************************************************************/
dkato 0:37e1e6a45ced 277 jcu_errorcode_t JCU_ParaCheckSetHuffmanTable(
dkato 0:37e1e6a45ced 278 const jcu_table_no_t tableNo,
dkato 0:37e1e6a45ced 279 const jcu_huff_t type)
dkato 0:37e1e6a45ced 280 {
dkato 0:37e1e6a45ced 281 jcu_errorcode_t returnValue = JCU_ERROR_OK;
dkato 0:37e1e6a45ced 282
dkato 0:37e1e6a45ced 283 /* ->MISRA 13.7 : For fail safe. */
dkato 0:37e1e6a45ced 284 IF (tableNo > JCU_TABLE_NO_1)
dkato 0:37e1e6a45ced 285 /* <-MISRA 13.7 */
dkato 0:37e1e6a45ced 286 {
dkato 0:37e1e6a45ced 287 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 288 goto fin;
dkato 0:37e1e6a45ced 289 } /* end if */
dkato 0:37e1e6a45ced 290
dkato 0:37e1e6a45ced 291 /* ->MISRA 13.7 : For fail safe. */
dkato 0:37e1e6a45ced 292 IF_DS ((type != JCU_HUFFMAN_AC)
dkato 0:37e1e6a45ced 293 && (type != JCU_HUFFMAN_DC))
dkato 0:37e1e6a45ced 294 /* <-MISRA 13.7 */
dkato 0:37e1e6a45ced 295 /* ->MISRA 14.1 ->QAC 3201 : For fail safe. */
dkato 0:37e1e6a45ced 296 {
dkato 0:37e1e6a45ced 297 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 298 } /* end if */
dkato 0:37e1e6a45ced 299 /* <-MISRA 14.1 <-QAC 3201 */
dkato 0:37e1e6a45ced 300 fin:
dkato 0:37e1e6a45ced 301 return (returnValue);
dkato 0:37e1e6a45ced 302 }
dkato 0:37e1e6a45ced 303
dkato 0:37e1e6a45ced 304 /**************************************************************************//**
dkato 0:37e1e6a45ced 305 * Function Name : [JCU_ParaCheckEncodeParam]
dkato 0:37e1e6a45ced 306 * @brief api's parameter checking
dkato 0:37e1e6a45ced 307 * @param [in]
dkato 0:37e1e6a45ced 308 * @retval jcu_errorcode_t
dkato 0:37e1e6a45ced 309 *****************************************************************************/
dkato 0:37e1e6a45ced 310 jcu_errorcode_t JCU_ParaCheckEncodeParam(
dkato 0:37e1e6a45ced 311 const jcu_encode_param_t *const encode,
dkato 0:37e1e6a45ced 312 const jcu_buffer_param_t *const buffer)
dkato 0:37e1e6a45ced 313 {
dkato 0:37e1e6a45ced 314 jcu_errorcode_t returnValue = JCU_ERROR_OK;
dkato 0:37e1e6a45ced 315
dkato 0:37e1e6a45ced 316 IF ((encode == NULL) || (buffer == NULL)) {
dkato 0:37e1e6a45ced 317 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 318 goto fin;
dkato 0:37e1e6a45ced 319 } /* end if */
dkato 0:37e1e6a45ced 320
dkato 0:37e1e6a45ced 321 /* NULL check for the address data */
dkato 0:37e1e6a45ced 322 IF ((buffer->source.address == NULL)
dkato 0:37e1e6a45ced 323 || (buffer->destination.address == NULL)) {
dkato 0:37e1e6a45ced 324 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 325 goto fin;
dkato 0:37e1e6a45ced 326 } /* end if */
dkato 0:37e1e6a45ced 327
dkato 0:37e1e6a45ced 328
dkato 0:37e1e6a45ced 329 if (encode->encodeFormat == JCU_JPEG_YCbCr422) {
dkato 0:37e1e6a45ced 330 /* Check the width of the image data */
dkato 0:37e1e6a45ced 331 IF ((encode->width % MOD_16) != 0u) {
dkato 0:37e1e6a45ced 332 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 333 goto fin;
dkato 0:37e1e6a45ced 334 } /* end if */
dkato 0:37e1e6a45ced 335
dkato 0:37e1e6a45ced 336 /* Check the height of the image data */
dkato 0:37e1e6a45ced 337 IF ((encode->height % MOD_8) != 0u) {
dkato 0:37e1e6a45ced 338 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 339 goto fin;
dkato 0:37e1e6a45ced 340 } /* end if */
dkato 0:37e1e6a45ced 341 } else {
dkato 0:37e1e6a45ced 342 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 343 ASSERT_D( false, R_NOOP() );
dkato 0:37e1e6a45ced 344 goto fin;
dkato 0:37e1e6a45ced 345 } /* end if */
dkato 0:37e1e6a45ced 346
dkato 0:37e1e6a45ced 347 /*Check for Cb/Cr offset */
dkato 0:37e1e6a45ced 348 IF (((encode->inputCbCrOffset) != JCU_CBCR_OFFSET_0) && ((encode->inputCbCrOffset) != JCU_CBCR_OFFSET_128)) {
dkato 0:37e1e6a45ced 349 returnValue = JCU_ERROR_PARAM;
dkato 0:37e1e6a45ced 350 } /* end if */
dkato 0:37e1e6a45ced 351
dkato 0:37e1e6a45ced 352 fin:
dkato 0:37e1e6a45ced 353 return (returnValue);
dkato 0:37e1e6a45ced 354 }
dkato 0:37e1e6a45ced 355
dkato 0:37e1e6a45ced 356 #endif