JPEGDecDecodeImage

Syntax

#include <cafe/jpeg.h>

JPEGStatus
JPEGDecDecodeImage(
    u32          *pDestBuf,
    u32           destBufSize,
    const void   *pJpegBuf,
    u32           jpegBufSize,
    s32           resolution,
    void         *pWorkArea,
    u32           workAreaSize);

Parameters

pDestBuf The start address of the buffer used to store the surface image to be decoded. Surface images are decoded using the GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM specification of GX2SurfaceFormat.
destBufSize The size of pDestBuf.
pJpegBuf The start address of the buffer used to store the JPEG binary to be decoded.
jpegBufSize The size of pJpegBuf.
resolution The resolution compression level. The following values can be specified: 1, 2, 4, or 8. Both the width and the height of the output image are set to 1/resolution of the input JPEG data. The JPEG_STATUS_ARGS error code is returned if the input value is invalid.
pWorkArea The start address of the temporary buffer used to decode JPEG binary.
workAreaSize The size of pWorkArea.

Return Values

JPEG_STATUS_OK Function completed successfully.
Any other value Abnormal exit.

Description

Decodes the JPEG binary accepted as input and outputs the corresponding surface image.

When using decoded surface image as imagePtr of GX2Surface, GX2Surface should be configured with GX2_TILE_MODE_LINEAR_SPECIAL to tileMode of GX2Surface firstly. Only this configuration can accept decoded JPEG image although disabling any alignment, padding, and swizzle options results slower texture handling on CPU than that on GPU. To achieve higher performance in rendering decoded JPEG image, convert the configured surface using GX2CopySurface. It is given that JPEG buffer pJpegBuf will not be modified.

For more information, see the GX2Surface related pages listed in the See Also section of this topic.

Do Not Call From

Multiple threads This function is not thread-safe.

See Also

JPEGDecGetImageInfo
JPEGImageDim
JPEGStatus
GX2 Surface APIs
GX2 Surface Copying, Resizing, Re-Formatting, etc.
GX2 Texture APIs
GX2 Texture Swizzle APIs

Revision History

2013/06/03 Changed argument order of API and Added notion about constant argument.
2013/05/08 Automated cleanup pass.
2013/05/06 Link GX2 related references in the See Also section.
2013/02/19 Replaced words 'texture' with 'surface'. Appended description for use with GX2.
2011/08/08 Initial version.


CONFIDENTIAL