nn::jpeg::CTR::JpegMpEncoder::StartJpegEncoder Member Function

Syntax

#include <nn/jpeg.h>

size_t StartJpegEncoder(
     u8 * dst,
     size_t limit,
     const void * src,
     u32 width,
     u32 height,
     u32 quality,
     PixelSampling dstPixelSampling,
     PixelFormat srcPixelFormat,
     bool addThumbnail
);

Arguments

Name Description
out dst Specifies the buffer that stores the encoded result.
in limit Specifies the size of dst in bytes. Encoding fails if it exceeds this size.
in src Specifies the buffer of image data to encode. Must be 4-byte aligned.
in width Specifies the image width in pixels. (Up to 65536)
in height Specifies the image height in pixels. (Up to 65536)
in quality Specifies the encoding quality.
Values can be set from 1-100, 100 being the highest quality and the largest size.
in dstPixelSampling Specifies the image's output format (its pixel sampling).
in srcPixelFormat Specifies the input pixel format of the image to encode.
in addThumbnail Specifies whether to add a thumbnail.

Return Values

If successful, returns the number of bytes of JPEG-format data that were generated. If the function fails it returns 0.
Use the GetLastError function to get the reason for failure.

Description

Runs the JPEG encoder.

The widths and heights of images that this function can encode depend on the output format of the image (in other words, the dstPixelSampling argument).
If PIXEL_SAMPLING_YUV444 is specified, both the vertical and horizontal size of the image must be a multiple of 8.
If PIXEL_SAMPLING_YUV420 is specified, both the vertical and horizontal size of the image must be a multiple of 16.
If PIXEL_SAMPLING_YUV422 is specified, the height must be a multiple of 8, and the width must be a multiple of 16.

Revision History

2010/04/14
Initial version.

CONFIDENTIAL