#include <cafe/jpeg.h>

JPEGStatus JPEGEncEncode(
			void          *pWorkArea,
			u32            workAreaSize,
			u32           *pTexBuf,
			JPEGImageDim  *pTexDim,
			s32            quality,
			void          *pDestBuf,
			u32            destBufSize,
			u32           *pActualDestSize);


pWorkArea The start address of the temporary buffer used to decode JPEG binary.
workAreaSize The size of pWorkArea.
pTexBuf The start address of the buffer used to store the surface image to be encoded. The format of the surface image must conform to the GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM specification of GX2SurfaceFormat. Behavior is undefined for invalid surface image.
pTexDim The address of the JPEGImageDim object that includes the width, height, and number of colors of the pTexBuf surface image to be encoded.
quality The compressed image quality in the range from 1 to 100. In general, the greater this value is, the better the image quality, but the lower the compression rate. 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 JPEG binary to be encoded. Be sure to specify a large enough buffer if you do not know the size of the JPEG data to be encoded.
destBufSize The size of pDestBuf.
pActualDestSize The size of the JPEG binary to be encoded.

Return Values

JPEG_STATUS_OK Function completed successfully.
Any other value Abnormal exit.


This function is deprecated. Use JPEGEncEncodeSurface instead.

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

When encoding a surface image brought from the GX2 rendering system, the surface must be tiled with a GX2_TILE_MODE_LINEAR_ALIGNED or GX2_TILE_MODE_LINEAR_SPECIAL specification. Also, it must have no padding and no swizzling. If the surface image to be encoded is configured with different specifications, the surface must be converted to fit the constraints of the JPEG encoder using GX2CopySurface and specifying GX2_TILE_MODE_LINEAR_SPECIAL to tileMode of GX2Surface. As this API converts the tiling mode to GX2_TILE_MODE_LINEAR_SPECIAL using CPU (not GPU), this conversion may be slower than one to other tiling mode.

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.