nn::jpeg::CTR::JpegMpEncoder::StartMpEncoderNext Member Function

Syntax

#include <nn/jpeg.h>
size_t StartMpEncoderNext(
     const void * src,
     u32 width,
     u32 height,
     u32 quality,
     PixelSampling dstPixelSampling,
     PixelFormat srcPixelFormat,
     bool addThumbnail,
     MpTypeCode typeCode = MP_TYPE_CODE_MULTI_VIEW_DISPARITY_IMAGE,
     bool omitPixelDimensions = false
);

Arguments

Name Description
in src Specifies the buffer of image data to encode. Must be 4-byte aligned.
in width Specifies the image width in pixels (equal to or less than 65536).
in height Specifies the image height in pixels (equal to or less than 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.
in typeCode Specifies the MP type. Refer to Description for specifiable values. The default is MP_TYPE_CODE_MULTI_VIEW_DISPARITY_IMAGE (stereoscopic image).
in omitPixelDimensions When the MP type (the value of the typeCode argument) is MP_TYPE_CODE_LARGE_THUMBNAIL_IMAGE_CLASS_1 or MP_TYPE_CODE_LARGE_THUMBNAIL_IMAGE_CLASS_2 (image for monitor display), you must specify whether to omit recording the effective image size (PixelXDimension, PixelYDimension) in APP1.
This specification is ignored for other MP types, since for other types the size must always be recorded.
Specify true to omit recording it, or false to record it. The default value is false.

Return Values

If the call is successful, the function returns the number of bytes of the generated MP. (However, this MP0 is not complete until the call has succeeded the required number of times.) Returns 0 on failure. Use the GetLastError function to get the reason for failure.

Description

JPEG-encodes an image and appends it to the encoded results from the immediately previous call to either StartMpEncoderFirst or this function.

If processing fails, this function also fails. (You must re-encode from the first image.)

If the total number of images specified in the StartMpEncoderFirst function is greater than 1, to complete the multi-picture object (MPO) this function must be called (total number of images - 1) number of times. Calling more than the required number of times will result in failure. If the function fails before encoding is complete or if encoding is cancelled, there is no further need to call this function.

Initializing the encoder object partway through encoding will prevent subsequent encoding results from being appended, so do not call the Initialize function before calling this function.

This function's encoding results are appended to the encoding results for the immediately previous image, within the limits of the buffer and byte size specified in the StartMpEncoderFirst function. The data is padded so that the byte offset from the start of the buffer to the location where data is appended is a multiple of 2. Consequently, there is sometimes 1 byte of zeros inserted between the EOI marker of the previous individual image and the SOI marker for this individual image. No padding is added after appending.

Any data registered using SetUserMakerNote, SetMpTypeFlags, SetDateTime or other functions, and any values specified in the SetThumbnailSize or SetInputBufferWidth functions are cleared after this function completes, regardless of whether this function succeeded or failed. When encoding multiple times, you must call these functions before encoding each image.

When the starting image MP type is MP_TYPE_CODE_BASELINE_MP_PRIMARY_IMAGE, the baseline MP format is used so the MP Attribute IFD is not stored. Just as with StartMpEncoderFirst, calls to functions that register the MP Attribute IFD have no effect.

When encoding an image for monitor display, only the following tags are recorded in the APP1. You cannot use the GetMpRegionsToBuildJpegData function to rebuild JPEG data, therefore, right after encoding images for monitor display.

(*) The MP format standard recommends that these tags not be recorded if the images are the same as the original monitor images. The application must check whether the size of the images for encoding (the width and height arguments) are the same as the original monitor images. These are not recorded if the omitPixelDimensions argument is set to TRUE.

Revision History

2010/10/22
Made revisions to make descriptions easier to understand.
2010/06/14
Initial version.

CONFIDENTIAL