# SSP_StartJpegEncoderWithEncodeData

## Syntax

    u32 SSP_StartJpegEncoderWithEncodeData(u8 *dst, u32 limit, u8 *wrk, u32 width, u32 height, u32 quality, u32 sampling, u32 option);

## Arguments

dst | Buffer that stores encoded results.
limit | Size of dst. Encoding fails if this size is exceeded.
wrk | Working buffer. This must be 4-byte aligned. Use the same value specified to the `SSP_ConvertJpegEncodeData` function.
width | The width (in pixels) of the image to be encoded. Make the same specifications as for the `SSP_ConvertJpegEncodeData` function.
height | The height (in pixels) of the image to be encoded. Make the same specifications as for the `SSP_ConvertJpegEncodeData` function.
quality | Encoding quality. Values from 1 to 100 can be specified, where 100 represents the highest quality and the largest size.
sampling | The main image output format (`SSP_JPEG_OUTPUT_YUV444`, `SSP_JPEG_OUTPUT_YUV420`, or `SSP_JPEG_OUTPUT_YUV422`). Make the same specifications as for the `SSP_ConvertJpegEncodeData` function.
option | The encoding option (`SSP_JPEG_RGB555`, `SSP_JPEG_YUV422`, or `SSP_JPEG_THUMBNAIL`). Make the same specifications as for the `SSP_ConvertJpegEncodeData` function.

## Return Values

Returns the size of the created JPEG file when successful.
Returns 0 when it fails.

## Description

Encodes image data converted into a JPEG file using the `SSP_ConvertJpegEncodeData` function.
The wrk, width, height, sampling, and option arguments must be specified in the same manner as for the `SSP_ConvertJpegEncodeData` function.
If you want to perform the conversion and encoding processes at once, use the `SSP_StartJpegEncoder` function.
Note:
Regardless of whether this function succeeds or fails at encoding, after completion the values set by the `SSP_SetJpegEncoderDateTime`, `SSP_SetJpegEncoderDateTimeNow`, `SSP_SetJpegEncoderMakerNote`, and `SSP_SetJpegEncoderMakerNoteEx` functions are cleared.
If this function does not call the `SSP_SetJpegEncoderDateTime` or `SSP_SetJpegEncoderDateTimeNow` function in advance, the `SSP_GetDateTime` function is called.

## See Also

`SSP_SetJpegEncoderDateTime`
`SSP_SetJpegEncoderDateTimeNow`
`SSP_ConvertJpegEncodeData`
`SSP_StartJpegEncoder`
`SSP_SetJpegEncoderMakerNote`
`SSP_SetJpegEncoderMakerNoteEx`
`SSP_GetDateTime`

## Revision History

2009/07/16 Changed to explanation that matches function behavior.
2009/04/28 Added information on alignment restrictions.
2008/11/14 Initial version.

CONFIDENTIAL