SSP_StartJpegEncoder

Syntax


u32 SSP_StartJpegEncoder(const void* src, u8 *dst, u32 limit, u8 *wrk, u32 width, u32 height, u32 quality, u32 sampling, u32 option);

Arguments

src Image data to encode (RGB555 or YUV422). Must be 4-byte aligned.
dst Buffer that stores encoded results.
limit Represents the dst size.
Encoding fails if this size is exceeded.
wrk Working buffer. This must be 4-byte aligned. 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.
quality Encode quality.
Values can be from 1 to 100, where 100 represents the highest quality and the largest size.
sampling Main image output formats (SSP_JPEG_OUTPUT_YUV444, SSP_JPEG_OUTPUT_YUV420, or SSP_JPEG_OUTPUT_YUV422).
option Encoding options (SSP_JPEG_RGB555, SSP_JPEG_YUV422, or SSP_JPEG_THUMBNAIL).

Return Values

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

Description

Encodes image data as a JPEG file. RGB555 and YUV422 images can 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 images that can be encoded using this function 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.


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_SetJpegEncoderMakerNote
SSP_SetJpegEncoderMakerNoteEx
SSP_GetDateTime
SSP_GetJpegEncoderBufferSize

Revision History

2009/07/16 Changed to explanation that matches function behavior.
2009/04/28 Added information on alignment restrictions.
2008/11/04 Added a description of values cleared after this function completes.
2008/10/15 Added a description of restrictions on the height and width of images that can be encoded.
2008/10/09 Added a description of RSF file settings.
2008/09/15 Initial version.


CONFIDENTIAL