nn::jpeg::CTR::JpegMpEncoder::StartMpEncoderFirst Member Function

Syntax

#include <nn/jpeg.h>

size_t StartMpEncoderFirst(
     u8 * dst,
     size_t limit,
     const void * src,
     u32 width,
     u32 height,
     u32 quality,
     PixelSampling dstPixelSampling,
     PixelFormat srcPixelFormat,
     bool addThumbnail,
     u32 numImages = 2,
     MpTypeCode typeCode = MP_TYPE_CODE_MULTI_VIEW_DISPARITY_IMAGE,
     bool addImageUidList = false,
     bool addTotalFrames = false
);

Arguments

Name Description
out dst Specifies the buffer that stores the encoded result.
Do not destroy this buffer until after encoding completes for the specified total number of images. (You can destroy it if encoding has been cancelled.)
in limit Specifies the size of dst in bytes. Encoding fails if this size is exceeded.
If the StartMpEncoderNext function fails before the specified total number of images are done encoding, it might be because this byte size is insufficient.
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.
in numImages Specifies the total number of images included in one MPO.
If the MP type is a stereoscopic image, this must be set to at least 2.
For Baseline MP primary images, this must be set to no more than 3.
The default value is 2.
in typeCode Specifies the MP type. Can take any of the following values:
MP_TYPE_CODE_MULTI_VIEW_DISPARITY_IMAGE (stereoscopic image)
MP_TYPE_CODE_MULTI_VIEW_PANORAMA_IMAGE (panorama image)
MP_TYPE_CODE_MULTI_VIEW_MULTI_ANGLE_IMAGE (multi-angle image)
MP_TYPE_CODE_UNDEFINED ((undefined type)
MP_TYPE_CODE_BASELINE_MP_PRIMARY_IMAGE (Baseline MP primary image)
The default is MP_TYPE_CODE_MULTI_VIEW_DISPARITY_IMAGE (stereoscopic image).
in addImageUidList Specifies whether to append an individual image unique ID list.
Appended if the value is true and not appended if the value is false. The value that gets appended is the unique image ID specified by the SetImageUid function immediately preceding the call to this function or the StartMpEncoderNext function.
This value is NULL (all bytes cleared to 0) if SetImageUid has not been called or if the image is the starting image.
The default value is false.
in addTotalFrames Specifies whether to append the total number of frames taken.
Appended if the value is true and not appended if the value is false. If the MP type (as set in the typeCode argument) is MP_TYPE_CODE_BASELINE_MP_PRIMARY_IMAGE, this specification is ignored and the total number of frames taken is not appended.
The value to append is usually the total number of images, but if 0 was specified as the individual image number in the call to SetMpIndividualNum immediately preceding the call to this function or the StartMpEncoderNext function, then that image is not counted.
Starting from the second image, images of MP type MP_TYPE_CODE_LARGE_THUMBNAIL_IMAGE_CLASS_1 or MP_TYPE_CODE_LARGE_THUMBNAIL_IMAGE_CLASS_2 (images for monitor display) are not counted either.
The default value is FALSE.

Return Values

If successful, returns the number of bytes in the generated MPO. (However, if the total number of images is greater than 1, then this MPO is not yet complete.)
Returns 0 on failure. Use the GetLastError function to get the reason for failure.

Description

JPEG-encodes an image and stores it as the starting image in MP format.

This function specifies the total number of images included in one set of MP-format data (a multi-picture object or "MPO") and encodes the starting image. Call the StartMpEncoderNext function to encode the second image and all subsequent images up to the total.

Depending on the encoding results of the successive calls to StartMpEncoderNext, the APP2 for the starting image encoded by this function (including the MP Index IFD, MP entries, and MP Attribute IFD) might be overwritten. If the encoding function fails before encoding is complete for the specified total number of images, or if encoding is cancelled, encoding must be redone from the starting image.

Unlike the StartMpEncoderLR function, when using this function you can register various types of data to each individual image by calling SetUserMakerNote, SetMpTypeFlags, SetDateTime or other functions. To register such data to the second or subsequent images, you must call those functions before calling the StartMpEncoderNext function.

The SetThumbnailSize and SetInputBufferWidth function arguments can also be specified separately for each image. To specify these values for the second or subsequent images, you must call those functions before calling the StartMpEncoderNext function.

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). The same is true of the StartJpegEncoder function.

Specify MP_TYPE_CODE_BASELINE_MP_PRIMARY_IMAGE as the value of the typeCode argument to use the Baseline MP format. Specify any other value to use the Extended MP format.
MP Attribute IFDs are not stored in the Baseline MP format, so the following functions have no effect:
SetMpIndividualNum, SetMpPanOrientation, SetMpPanOverlapH, SetMpPanOverlapV, SetMpBaseViewpointNum, SetMpConvergenceAngle, SetMpBaselineLength, SetMpVerticalDivergence, SetMpAxisDistanceX, SetMpAxisDistanceY, SetMpAxisDistanceZ, SetMpYawAngle, SetMpPitchAngle, SetMpRollAngle

Revision History

2010/06/14
Initial version.

CONFIDENTIAL