# SSP_ConvertJpegEncodeData

## Syntax

    BOOL SSP_ConvertJpegEncodeData(const void* src, u8 *wrk, u32 width, u32 height, u32 sampling, u32 option);

## Arguments

src | Image data to encode (RGB555 or YUV422). Must be 4-byte aligned.
wrk | Working buffer. This must be 4-byte aligned. You can use the `SSP_GetJpegEncoderBufferSize` function to calculate the required size.
width | Width (in pixels) of the image to encode.
height | Height (in pixels) of the image to encode.
sampling | Main image output format (`SSP_JPEG_OUTPUT_YUV444`, `SSP_JPEG_OUTPUT_YUV420`, or `SSP_JPEG_OUTPUT_YUV422`) to use at time of encoding.
option | Encoding options (`SSP_JPEG_RGB555`, `SSP_JPEG_YUV422`, or `SSP_JPEG_THUMBNAIL`).

## Return Values

`TRUE` if successful.

## Description

Converts image data into a format used for encoding in a JPEG file.
RGB555 and YUV422 formats can be used for the image data to be encoded. When you specify YUV422 image data as src, you must specify `SSP_JPEG_YUV422` in option. If you want to encode a thumbnail icon, you must specify `SSP_JPEG_THUMBNAIL` in option.
Therefore, to encode a YUV422 image along with a thumbnail icon, you must specify `SSP_JPEG_YUV422|SSP_JPEG_THUMBNAIL` in option.
The height and width of an image that can be encoded differs depending on the value of sampling.
If `SSP_JPEG_OUTPUT_YUV444` is specified, both the height and width of the image must be a multiple of 8.
If `SSP_JPEG_OUTPUT_YUV420` is specified, both the height and width of the image must be a multiple of 16.
If `SSP_JPEG_OUTPUT_YUV422` is specified, the height must be a multiple of 8, and the width a multiple of 16.
Because actual encoding is performed using the `SSP_StartJpegEncoderWithEncodeData` function, src, which represents input source data, can be destroyed without problem upon termination of this function.

## See Also

`SSP_StartJpegEncoderWithEncodeData`
`SSP_GetJpegEncoderBufferSize`

## Revision History

2009/04/28 Added information on alignment restrictions.
2008/11/14 Initial version.

CONFIDENTIAL