#include <cafe/jpeg.h>

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


pWorkArea The start address of the temporary buffer used to decode JPEG binary.
workAreaSize The size of pWorkArea.
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.
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.

Return Values

JPEG_STATUS_OK Function completed successfully.
Any other value Abnormal exit.


This function is deprecated. Use JPEGDecDecodeImage instead.

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.

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

Do Not Call From

Deprecated Do not call this function in new code.
Multiple threads This function is not thread-safe.

See Also

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

Revision History

2013/06/04 This API is now deprecated.
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.