![]() |
Synergy Software Package User's Manual
|
The JPEG Decode HAL module provides a high-level API for industry standard JPEG image decode processing and supports the Renesas Synergy™ JPEG Codec peripheral. The JPEG Decode Framework Module is a ThreadX®-aware implementation and provides thread-safe access to the Synergy JPEG hardware on a Synergy MCU. A user-defined callback can be created to detect hardware supported events.
The JPEG Decode Framework module defines APIs for opening, closing, setting alarms and starting and stopping RTC operations. A complete list of the available APIs, an example API call and a short description of each can be found in the following table. A table of status return values follows the API summary table.
JPEG Decode Framework Module API Summary
| Function Name | Example API Call and Description |
|---|---|
| open | g_sf_jpeg_decode0.p_api->open(g_sf_jpeg_decode0.p_ctrl, g_sf_jpeg_decode0.p_cfg);Open the JPEG Decode Framework. |
| inputBufferSet | g_sf_jpeg_decode0.p_api->close(g_sf_jpeg_decode0.p_ctrl);Close the JPEG Decode Framework. |
| outputBufferSet | g_sf_jpeg_decode0.p_api->outputBufferSet(g_sf_jpeg_decode0.p_ctrl, p_buffer, buffer_size);Assign output buffer to JPEG codec for storing output data. |
| linesDecodedGet | g_sf_jpeg_decode0.p_api->linesDecodedGet g_sf_jpeg_decode0.p_ctrl, p_lines);Return the number of lines decoded into the output buffer. |
| horizontalStrideSet | g_sf_jpeg_decode0.p_api->horizontalStrideSet(g_sf_jpeg_decode0.p_ctrl, stride);Configure the horizontal stride value. |
| imageSubsampleSet | g_sf_jpeg_decode0.p_api->imageSubsampleSet(g_sf_jpeg_decode0.p_ctrl, horizontal, vertical);Configure the horizontal and vertical subsample settings. |
| wait | g_sf_jpeg_decode0.p_api->wait(g_sf_jpeg_decode0.p_ctrl, p_status, timeout);Wait for the current JPEG codec operation to finish with a timeout value given in ThreadX ticks. |
| statusGet | g_sf_jpeg_decode0.p_api->statusGet(g_sf_jpeg_decode0.p_ctrl, p_status);Retrieve current status of the JPEG codec module. |
| imageSizeGet | g_sf_jpeg_decode0.p_api->imageSizeGet(g_sf_jpeg_decode0.p_ctrl, p_horizontal, p_vertical);Retrieve image size during decoding operation. |
| pixelFormatGet | g_sf_jpeg_decode0.p_api->pixelFormatGet(g_sf_jpeg_decode0.p_ctrl, p_color_space);Get the input pixel format. |
| close | g_sf_jpeg_decode0.p_api->close(g_sf_jpeg_decode0.p_ctrl);Cancel an outstanding operation. |
| versionGet | g_sf_jpeg_decode0.p_api->versionGet(&version);Get version and store it in provided pointer p_version. |
Status Return Values
| Name | Description |
|---|---|
| SSP_SUCCESS | JPEG Decode driver is successfully opened. |
| SSP_ERR_ASSERTION | Assertion error. |
| SSP_ERR_IN_USE | Module already in use. |
| SSP_ERR_TIMEOUT | The wait operation times out, the underlying driver did not respond in time. |
| SSP_ERR_WAIT_ABORTED | System internal error occurred. |
The JPEG Decode Framework module implements the standard JPEG decode operation. It takes the data in an input buffer and applies the defined JPEG decode algorithm to the buffer, the output is then delivered to the defined output buffer location. A wait API function can be used to suspend/resume the thread for synchronization with JPEG hardware supported events.
This section describes how to include the JPEG Decode Framework Module in an application using the SSP configurator.
To add the JPEG Decode Framework to an application, simply add it to a thread using the stacks selection sequence given in the following table. (The default name for the JPEG Decode Framework is g_sf_jpeg_decode0. This name can be changed in the associated Properties window.)
JPEG Decode Framework Module Selection Sequence
| Resource | ISDE Tab | Stacks Selection Sequence |
|---|---|---|
| g_sf_jpeg_decode0 JPEG Framework | Threads | New Stack> Framework> Graphics> JPEG Decode Framework on sf_jpeg_decode |
When the JPEG Decode Framework on sf_jpeg_decode is added to the thread stack as shown in the following figure, the configurator automatically adds any needed lower‑level modules. Any modules needing additional configuration information have the box text highlighted in Red. Modules with a Gray band are individual modules that stand alone. Modules with a Blue band are shared or common; they need only be added once and can be used by multiple stacks. Modules with a Pink band can require the selection of lower-level modules; these are either optional or recommended. (This is indicated in the block with the inclusion of this text.) If the addition of lower-level modules is required, the module description include Add in the text. Clicking on any Pink banded modules brings up the New icon and displays possible choices.
Decompression Process Interrupt (JEDI)
The JPEG decompression-process interrupt occurs when:
Data Transfer Interrupt (JDTI)
The JPEG data-transfer interrupt occurs when:
The number of input image-data lines specified by sf_jpeg_decode_api_t::inputBufferSet has been transferred.
The JPEG Decode Framework Module must be configured by the user for the desired operation. The available configuration settings and defaults for all the user-accessible properties are given in the properties tab within the SSP configurator and are shown in the following tables for easy reference. Only properties that can be changed without causing conflicts are available for modification. Other properties are locked and not available for changes and are identified with a lock icon for the locked property in the Properties window in the ISDE. This approach simplifies the configuration process and makes it much less error-prone than previous manual approaches to configuration. The available configuration settings and defaults for all the user-accessible properties are given in the Properties tab within the SSP Configurator and are shown in the following tables for easy reference.
Configuration Settings for the JPEG Decode Framework Module on sf_jpeg_decode
| ISDE Property | Value | Description |
|---|---|---|
| Parameter Checking | BSP, Enabled, Disabled Default: BSP | Enable or disable the parameter checking. |
| Name | g_sf_jpeg_decode0 | The name to be used for a JPEG Decode Framework module instance. |
Typically, only a small number of settings must be modified from the default for lower level drivers as indicated via the red text in the thread stack block. Notice that some of the configuration properties must be set to a certain value for proper framework operation and will be locked to prevent user modification. The following tables identify all the settings within the properties section for the module.
Configuration Settings for the JPEG HAL Module on r_jpeg
| ISDE Property | Value | Description |
|---|---|---|
| Parameter Checking | BSP, Enabled, Disabled Default: BSP | Enable or disable the parameter error checking. |
| Name | g_jpeg_decode0 | The name to be used for a JPEG Decode module instance. |
| Byte Order for Input Data Format | Normal byte order (1)(2)(3)(4)(5)(6)(7)(8), Byte Swap (2)(1)(4)(3)(6)(5)(8)(7), Word Swap (3)(4)(1)(2)(7)(8)(5)(6), Word-Byte Swap (4)(3)(2)(1)(8)(7)(6)(5), Longword Swap (5)(6)(7)(8)(1)(2)(3)(4), Longword-Byte Swap (6)(5)(8)(7)(2)(1)(4)(3), Longword-Word Swap (7)(8)(5)(6)(3)(4)(1)(2), Longword-Word Swap (7)(8)(5)(6)(3)(4)(1)(2) Default: Normal Byte order | Specify the byte order for input data. The order is swapped as specified in every 8-byte. |
| Byte Order for Output Data Format | Normal byte order (1)(2)(3)(4)(5)(6)(7)(8), Byte Swap (2)(1)(4)(3)(6)(5)(8)(7), Word Swap (3)(4)(1)(2)(7)(8)(5)(6), Word-Byte Swap (4)(3)(2)(1)(8)(7)(6)(5), Longword Swap (5)(6)(7)(8)(1)(2)(3)(4), Longword-Byte Swap (6)(5)(8)(7)(2)(1)(4)(3), Longword-Word Swap (7)(8)(5)(6)(3)(4)(1)(2), Longword-Word Swap (7)(8)(5)(6)(3)(4)(1)(2) Default: Normal Byte order | Specify the byte order for output data. The order is swapped as specified in every 8-byte. |
| Output Data Color Format | Pixel Data RGB565 format, Pixel Data ARGBB888 format Default: Pixel Data RGB565 format | Specify the output data format. |
| Alpha value to be applied to decoded pixel data (only valid for ARGB8888 format) | 255 | Specify the alpha value for the output data format (only valid for ARGB8888 format). |
| Name of user callback function | NULL | Specify the name of user callback function. |
| Decompression Interrupt Priority | Priority 0 (highest), Priority 1:14, Priority 15 (lowest - not valid if using ThreadX) Default: Priority 12 | Decompression interrupt priority selection. |
| Data Transfer Interrupt Priority | Priority 0 (highest), Priority 1:14, Priority 15 (lowest - not valid if using ThreadX) Default: Priority 12 | Data transfer interrupt priority selection. |
Configuration Settings for the JPEG Common Module
| ISDE Property | Value | Description |
|---|---|---|
| Name | g_jpeg_common0 | Module name. |
The JPEG Framework module uses the peripheral module clock A (PCLKA) to run the internal logic.
To enable interrupts, set the priority of the decompression interrupt and the data-transfer interrupt in the Properties window of the JPEG Decode Framework module in the ISDE.
The JPEG Decode Framework module does not use any pins.
The steps in using the JPEG Decode Framework module in a typical application are:
These common steps are illustrated in a typical operational flow diagram in the following figure: