Synergy Software Package User's Manual

RTOS-integrated JPEG Framework. More...

Data Structures

struct  sf_jpeg_decode_instance_ctrl_t
 

Macros

#define SF_JPEG_DECODE_CODE_VERSION_MAJOR   (2U)
 
#define SF_JPEG_DECODE_OPEN   (0x4A504547U)
 
#define SF_JPEG_ERROR_RETURN(a, err)   SSP_ERROR_RETURN((a), (err), &g_module_name[0], &s_sf_jpeg_version)
 

Functions

ssp_err_t sf_jpeg_initialize (sf_jpeg_decode_instance_ctrl_t *const p_ctrl, sf_jpeg_decode_cfg_t const *const p_cfg)
 Acquires mutex, then handles driver initialization at the HAL layer. This function releases the mutex before returns to the caller. More...
 
ssp_err_t SF_JPEG_Decode_Open (sf_jpeg_decode_ctrl_t *const p_api_ctrl, sf_jpeg_decode_cfg_t const *const p_cfg)
 Parameter checking and initialize JPEG decode with sf_jpeg_initialize helper function and marking the open flag in control block. More...
 
ssp_err_t SF_JPEG_Decode_InputBufferSet (sf_jpeg_decode_ctrl_t *const p_api_ctrl, void *const p_buffer, uint32_t const buffer_size)
 Configures JPEG coded input data. More...
 
ssp_err_t SF_JPEG_Decode_LinesDecodedGet (sf_jpeg_decode_ctrl_t *const p_api_ctrl, uint32_t *const p_lines)
 Obtain number of lines decoded by the codec. More...
 
ssp_err_t SF_JPEG_Decode_HorizontalStrideSet (sf_jpeg_decode_ctrl_t *const p_api_ctrl, uint32_t horizontal_stride)
 Configure the horizontal stride value. More...
 
ssp_err_t SF_JPEG_Decode_ImageSubsampleSet (sf_jpeg_decode_ctrl_t *const p_api_ctrl, jpeg_decode_subsample_t horizontal_subsample, jpeg_decode_subsample_t vertical_subsample)
 Configure the horizontal and vertical subsample values. This allows an application to reduce the size of the decoded image at runtime. More...
 
ssp_err_t SF_JPEG_Decode_OutputBufferSet (sf_jpeg_decode_ctrl_t *const p_api_ctrl, void *p_buffer, uint32_t buffer_size)
 Configure the decode output buffer. More...
 
ssp_err_t SF_JPEG_Decode_Wait (sf_jpeg_decode_ctrl_t *const p_api_ctrl, jpeg_decode_status_t *const p_status, uint32_t timeout)
 Wait for current JPEG codec operation to finish. More...
 
ssp_err_t SF_JPEG_Decode_StatusGet (sf_jpeg_decode_ctrl_t *const p_api_ctrl, jpeg_decode_status_t *const p_status)
 Obtain JPEG codec status. This function can be used to poll the device instead of using SF_JPEG_Decode_Wait() to block on JPEG operations. More...
 
ssp_err_t SF_JPEG_Decode_PixelFormatGet (sf_jpeg_decode_ctrl_t *const p_api_ctrl, jpeg_decode_color_space_t *const p_color_space)
 Obtain the format of the image. This function is only useful for decoding a JPEG image. More...
 
ssp_err_t SF_JPEG_Decode_ImageSizeGet (sf_jpeg_decode_ctrl_t *const p_api_ctrl, uint16_t *p_horizontal_size, uint16_t *p_vertical_size)
 Obtain the size of the image. This function is only useful for decoding a JPEG image. More...
 
ssp_err_t SF_JPEG_Decode_Close (sf_jpeg_decode_ctrl_t *const p_api_ctrl)
 Close JPEG codec device. Un-finished codec operation is interrupted, and output data are discarded. More...
 
ssp_err_t SF_JPEG_Decode_VersionGet (ssp_version_t *const p_version)
 Get version and store it in provided pointer p_version. More...
 

Detailed Description

RTOS-integrated JPEG Framework.

Macro Definition Documentation

◆ SF_JPEG_DECODE_CODE_VERSION_MAJOR

#define SF_JPEG_DECODE_CODE_VERSION_MAJOR   (2U)

Version of code that implements the API defined in this file

◆ SF_JPEG_DECODE_OPEN

#define SF_JPEG_DECODE_OPEN   (0x4A504547U)

"JPEG" in ASCII, used to identify general JPEG control block

◆ SF_JPEG_ERROR_RETURN

#define SF_JPEG_ERROR_RETURN (   a,
  err 
)    SSP_ERROR_RETURN((a), (err), &g_module_name[0], &s_sf_jpeg_version)

Macro for error logger.

Function Documentation

◆ SF_JPEG_Decode_Close()

ssp_err_t SF_JPEG_Decode_Close ( sf_jpeg_decode_ctrl_t *const  p_api_ctrl)

Close JPEG codec device. Un-finished codec operation is interrupted, and output data are discarded.

Precondition
Call SF_JPEG_Decode_Open() to configure the timer before using this function.
Return values
SSP_SUCCESSThe JPEG decode device is successfully closed.
SSP_ERR_ASSERTIONp_ctrl is null.
SSP_ERR_NOT_OPENJPEG Decode Framework module is not yet initialized.

Call the low level driver to close the JPEG device.

Clear information from control block so other functions know this block is closed

◆ SF_JPEG_Decode_HorizontalStrideSet()

ssp_err_t SF_JPEG_Decode_HorizontalStrideSet ( sf_jpeg_decode_ctrl_t *const  p_api_ctrl,
uint32_t  horizontal_stride 
)

Configure the horizontal stride value.

Precondition
Call SF_JPEG_Decode_Open() to configure the JPEG codec block before using this function.
Return values
SSP_SUCCESSHorizontal Stride value is successfully configured.
SSP_ERR_ASSERTIONp_ctrl is null.
SSP_ERR_NOT_OPENJPEG Decode Framework module is not yet initialized.
SSP_ERR_IN_USEThe mutex may be unavailable for the the device. See HAL driver for other possible causes.
Returns
See Common Error Codes or HAL driver for other possible return codes or causes. This function calls

Obtain mutex before making HAL-level driver call.

◆ SF_JPEG_Decode_ImageSizeGet()

ssp_err_t SF_JPEG_Decode_ImageSizeGet ( sf_jpeg_decode_ctrl_t *const  p_api_ctrl,
uint16_t *  p_horizontal_size,
uint16_t *  p_vertical_size 
)

Obtain the size of the image. This function is only useful for decoding a JPEG image.

Precondition
Call SF_JPEG_Decode_Open() to configure the JPEG codec block before using this function.
Return values
SSP_SUCCESSThe JPEG image size is obtained.
SSP_ERR_ASSERTIONp_ctrl is null.
SSP_ERR_NOT_OPENJPEG Decode Framework module is not yet initialized.
SSP_ERR_IN_USEThe mutex may be unavailable for the the device. See HAL driver for other possible causes.
Returns
See Common Error Codes or HAL driver for other possible return codes or causes. This function calls

Obtain mutex before making HAL-level driver call.

◆ SF_JPEG_Decode_ImageSubsampleSet()

ssp_err_t SF_JPEG_Decode_ImageSubsampleSet ( sf_jpeg_decode_ctrl_t *const  p_api_ctrl,
jpeg_decode_subsample_t  horizontal_subsample,
jpeg_decode_subsample_t  vertical_subsample 
)

Configure the horizontal and vertical subsample values. This allows an application to reduce the size of the decoded image at runtime.

Precondition
Call SF_JPEG_Decode_Open() to configure the JPEG codec block before using this function.
Return values
SSP_SUCCESSImage subsample values are successfully configured.
SSP_ERR_ASSERTIONp_ctrl is null.
SSP_ERR_NOT_OPENJPEG Decode Framework module is not yet initialized.
SSP_ERR_IN_USEThe mutex may be unavailable for the the device. See HAL driver for other possible causes.
Returns
See Common Error Codes or HAL driver for other possible return codes or causes. This function calls

Obtain mutex before making HAL-level driver call.

◆ SF_JPEG_Decode_InputBufferSet()

ssp_err_t SF_JPEG_Decode_InputBufferSet ( sf_jpeg_decode_ctrl_t *const  p_api_ctrl,
void *const  p_buffer,
uint32_t const  buffer_size 
)

Configures JPEG coded input data.

This API configures the decode input buffer address register. After the input buffer address is set, the driver checks whether the output buffer address is set, and verifies that the output buffer size is large enough to hold at least eight output lines of data. If both the input buffer and output buffer are set properly, the driver automatically starts the decode process.

Precondition
Call SF_JPEG_Decode_Open() to configure the JPEG codec block before using this function.
Return values
SSP_SUCCESSDecode input buffer is successfully configured.
SSP_ERR_ASSERTIONp_ctrl is null.
SSP_ERR_NOT_OPENJPEG Decode Framework module is not yet initialized.
SSP_ERR_IN_USEThe mutex may be unavailable for the the device. See HAL driver for other possible causes.
Returns
See Common Error Codes or HAL driver for other possible return codes or causes. This function calls

Obtain mutex before making HAL-level driver call.

Call the HAL driver layer inputBufferSet routine.

◆ SF_JPEG_Decode_LinesDecodedGet()

ssp_err_t SF_JPEG_Decode_LinesDecodedGet ( sf_jpeg_decode_ctrl_t *const  p_api_ctrl,
uint32_t *const  p_lines 
)

Obtain number of lines decoded by the codec.

Precondition
Call SF_JPEG_Decode_Open() to configure the JPEG codec block before using this function.
Return values
SSP_SUCCESSLines decoded value is successfully obtained.
SSP_ERR_ASSERTIONp_ctrl is null.
SSP_ERR_NOT_OPENJPEG Decode Framework module is not yet initialized.
SSP_ERR_IN_USEThe mutex may be unavailable for the the device. See HAL driver for other possible causes.
Returns
See Common Error Codes or HAL driver for other possible return codes or causes. This function calls

Obtain mutex before making HAL-level driver call.

◆ SF_JPEG_Decode_Open()

ssp_err_t SF_JPEG_Decode_Open ( sf_jpeg_decode_ctrl_t *const  p_api_ctrl,
sf_jpeg_decode_cfg_t const *const  p_cfg 
)

Parameter checking and initialize JPEG decode with sf_jpeg_initialize helper function and marking the open flag in control block.

Return values
SSP_SUCCESSJPEG Decode framework is successfully opened.
SSP_ERR_ASSERTIONOne of the following parameters may be null: p_ctrl or p_cfg.
SSP_ERR_ALREADY_OPENJPEG Decode framework is already open.
Returns
See Common Error Codes or HAL driver for other possible return codes or causes.

Initialize the JPEG framework

Save driver structure pointer for use in other framework layer functions.

Mark control block open so subsequent calls know the device is open.

◆ SF_JPEG_Decode_OutputBufferSet()

ssp_err_t SF_JPEG_Decode_OutputBufferSet ( sf_jpeg_decode_ctrl_t *const  p_api_ctrl,
void *  p_buffer,
uint32_t  buffer_size 
)

Configure the decode output buffer.

This API configures the decode output buffer address register. After the output buffer address is set, the driver computers the number of output lines the buffer is able to hold. The hardware requires the number out output lines to decode at a time is multiple of eight. If both the input buffer and output buffer are set properly, the driver automatically starts the decode process.

Precondition
Call SF_JPEG_Decode_Open() to configure the JPEG codec block before using this function.
Return values
SSP_SUCCESSOutput buffer is successfully configured.
SSP_ERR_ASSERTIONp_ctrl is null.
SSP_ERR_NOT_OPENJPEG Decode Framework module is not yet initialized.
SSP_ERR_IN_USEThe mutex may be unavailable for the the device. See HAL driver for other possible causes.
Returns
See Common Error Codes or HAL driver for other possible return codes or causes. This function calls

Obtain mutex before making HAL-level driver call.

◆ SF_JPEG_Decode_PixelFormatGet()

ssp_err_t SF_JPEG_Decode_PixelFormatGet ( sf_jpeg_decode_ctrl_t *const  p_api_ctrl,
jpeg_decode_color_space_t *const  p_color_space 
)

Obtain the format of the image. This function is only useful for decoding a JPEG image.

Precondition
Call SF_JPEG_Decode_Open() to configure the JPEG codec block before using this function.
Return values
SSP_SUCCESSThe JPEG image size is obtained.
SSP_ERR_ASSERTIONp_ctrl is null.
SSP_ERR_NOT_OPENJPEG Decode Framework module is not yet initialized.
SSP_ERR_IN_USEThe mutex may be unavailable for the the device. See HAL driver for other possible causes.
Returns
See Common Error Codes or HAL driver for other possible return codes or causes. This function calls

Obtain mutex before making HAL-level driver call.

◆ SF_JPEG_Decode_StatusGet()

ssp_err_t SF_JPEG_Decode_StatusGet ( sf_jpeg_decode_ctrl_t *const  p_api_ctrl,
jpeg_decode_status_t *const  p_status 
)

Obtain JPEG codec status. This function can be used to poll the device instead of using SF_JPEG_Decode_Wait() to block on JPEG operations.

Precondition
Call SF_JPEG_Decode_Open() to configure the JPEG codec block before using this function.
Return values
SSP_SUCCESSThe JPEG status information is obtained.
SSP_ERR_ASSERTIONp_ctrl is null.
SSP_ERR_NOT_OPENJPEG Decode Framework module is not yet initialized.
SSP_ERR_IN_USEThe mutex may be unavailable for the the device. See HAL driver for other possible causes.
Returns
See Common Error Codes or HAL driver for other possible return codes or causes. This function calls

Obtain mutex before making HAL-level driver call.

◆ SF_JPEG_Decode_VersionGet()

ssp_err_t SF_JPEG_Decode_VersionGet ( ssp_version_t *const  p_version)

Get version and store it in provided pointer p_version.

Return values
SSP_SUCCESSVersion returned successfully.
SSP_ERR_ASSERTIONParameter p_version is null.

◆ SF_JPEG_Decode_Wait()

ssp_err_t SF_JPEG_Decode_Wait ( sf_jpeg_decode_ctrl_t *const  p_api_ctrl,
jpeg_decode_status_t *const  p_status,
uint32_t  timeout 
)

Wait for current JPEG codec operation to finish.

Precondition
Call SF_JPEG_Decode_Open() to configure the JPEG codec block before using this function.
Return values
SSP_SUCCESSThe wait function returns successfully.
SSP_ERR_ASSERTIONp_ctrl or p_status is null.
SSP_ERR_NOT_OPENJPEG Decode Framework module is not yet initialized.
SSP_ERR_TIMEOUTThe wait operation timed out, the underlying driver did not response in time.
SSP_ERR_WAIT_ABORTEDSystem internal error occurred.

Obtain mutex before making HAL-level driver call.

◆ sf_jpeg_initialize()

ssp_err_t sf_jpeg_initialize ( sf_jpeg_decode_instance_ctrl_t *const  p_ctrl,
sf_jpeg_decode_cfg_t const *const  p_cfg 
)

Acquires mutex, then handles driver initialization at the HAL layer. This function releases the mutex before returns to the caller.

Parameters
[in,out]p_ctrlControl handle for JPEG framework context for a device.
[in]p_cfgPointer to JPEG framework Configuration Structure.
Return values
SSP_SUCCESSJPEG Decode driver is successfully opened.
SSP_ERR_INTERNALAn internal ThreadX error has occurred.
Returns
See Common Error Codes or HAL driver for other possible return codes or causes. This function calls

Create event flags for use with wait function

Create the mutex for this instance, this mutex is used to protect access to lower level hardware

Duplicate the content of p_cfg.

Install framework callback and context.

Call the low level driver to configure the JPEG device.

If the operation failed, delete the resources.