nn::jpeg::CTR Namespace

Description

The namespace of the CTR JPEG compression/decompression library.
(This namespace can also be written without the ::CTR portion.)

Decodable JPEG and MP Data Formats

The nn::jpeg::JpegMpDecoder class can only decode JPEG data in baseline JPEG compression format.

The same applies to MP data formats.

In particular, decoding the following JPEG and MP formats will fail.

It may be unable to decode JPEG images created by other than the nn::jpeg::JpegMpEncoder class, even if it is in baseline JPEG compression format.

If decoding fails, it may be possible to decode the image after removing the Exif data, the thumbnail, and APPn (where n is 0-15). In the case of data in MP format, however, keep APP2 segments with MP-format related information.

Handling of Data Quantization When Decoding

In versions of the SDK older than 3.2, the Y component references QT0 for DQT (the data quantization table), and the Cb and Cr components reference QT1. Images comprising other combinations were not decoded correctly, even when the decode function succeeded. For example, if only QT0 is defined and gets referenced by all of the image components, then all cases of QT1 will be treated as 0 and the image will appear monochrome. Decoding works correctly in SDK 3.2 and later.

Handling of APP1 Marker When Decoding

If the data contains multiple APP1 sections, the Exif information that is found first is used and all other EXIF information is ignored. In SDK versions prior to version 3.2, a bug in the process for ignoring this information caused decoding to fail for images that had no Exif information in the first APP1 section. Decoding works correctly in SDK 3.2 and later. Even if the APP1 section contains Exif information, decoding will fail when JPEG or MP-format data has an offset to IFD0 other than 8.

Image Degradation After Repeated Encoding and Decoding

The quality of an image degrades when it is encoded and then the result is decoded. We have confirmed that repeatedly encoding and decoding the same image causes noticeable degradation and emphasizes the green component of the image. Below is an example of a way to minimize this degradation. Implement it in your application if needed.

Classes

nn::jpeg::CTR::JpegMpDecoder This class performs JPEG decoding.
nn::jpeg::CTR::JpegMpEncoder This class performs JPEG encoding.

Structures

nn::jpeg::CTR::MpIndex Structure holding the MP Index IFD in a format easily processed by the library. The MP Index IFD is included in the data stored in MP format.
nn::jpeg::CTR::MpEntry Structure holding an MP entry in a format easily processed by the library. MP entries are included in the data stored in MP format.
nn::jpeg::CTR::Rational RATIONAL (unsigned rational number) data type, used for members of the MP Attribute IFD and GPS IFD.
nn::jpeg::CTR::Srational SRATIONAL (signed rational number) data type, used for members of the MP Attribute IFD and GPS IFD.
nn::jpeg::CTR::MpAttribute Structure holding the MP Attribute IFD in a format easily processed by the library. The MP Attribute IFD is included in the data stored in MP format.
nn::jpeg::CTR::MpRegionsToBuildJpegData Structure holding the region information (pointer and byte count) for rebuilding the JPEG data.
nn::jpeg::CTR::GpsData This structure maintains GPS IFD in a format easily processed by the library.

Enumerated Types

PixelSampling Enumerated type indicating the output format when encoding.
PixelFormat Enumerated type indicating the pixel format.
MpTypeFlag Flag(s) included in the MP type information.
MpTypeDataFormat Data format included in the MP type information.
MpTypeCode Type code included in the MP type information.
EncoderErrorCode Gives the reason why the encoding just performed failed.
DecoderErrorCode Gives the reason why the decoding or other operation just performed failed.
EncoderOption Options used when encoding.
DecoderOption Options used when decoding.

Constants

DATE_TIME_SIZE const size_t Number of bytes in the buffer that stores date and time information. This constant is a string with the format "YYYY:MM:DD HH:MM:DD" terminated with 0x00, for a total of 20 characters.
IMAGE_UID_SIZE const size_t Number of bytes in the JPEG's unique image ID. This also represents the number of bytes in one element of the MP format's unique ID list for individual images.
MPF_VERSION_SIZE const size_t The number of bytes of the MP format version.
MP_ENTRY_SIZE const size_t This constant represents the number of bytes in one element of an MP-format MP entry. This is not the number of bytes in the MpEntry structure.
GPS_VERSION_ID_SIZE const size_t The number of bytes of the GPS tag version.
GPS_DATE_STAMP_SIZE const size_t The number of bytes in the GPS date stamp.
MIN_DECODER_SHRINK_LEVEL const u32 Minimum value that can be specified for the shrink level when shrink decoding.
MAX_DECODER_SHRINK_LEVEL const u32 Maximum value that can be specified for the shrink level when shrink decoding.
TWL_PHOTO_MAKER_NOTE_SIZE const size_t The number of bytes in a MakerNote for the Nintendo DSi Camera application.
MAX_DECODER_OUTPUT_BUFFER_WIDTH const u32 Maximum value (number of pixels) that can be specified for the output image buffer width when decoding.
MAX_ENCODER_INPUT_BUFFER_WIDTH const u32 Maximum value (number of pixels) that can be specified for the input image buffer width when encoding.
DEFAULT_THUMBNAIL_PIXEL_SAMPLING const PixelSampling Default thumbnail output format.
DEFAULT_THUMBNAIL_WIDTH const u32 Default thumbnail image width, in pixels.
DEFAULT_THUMBNAIL_HEIGHT const u32 Default thumbnail image height, in pixels.

Revision History

2011/10/24
Added information about image degradation after repeated encoding and decoding.
2011/10/06
Described revisions in SDK 3.2.
2011/06/14
Noted that in some cases the decode result will be monochrome.
2011/04/08
Revised the description of data examples that will cause decode failure.
2011/03/04
Added information about decodable JPEG and MP data formats.
2010/10/21
Added descriptions of GpsData, EncoderErrorCode, DecoderErrorCode, EncoderOption, and DecoderOption.
2010/04/14
Initial version.

CONFIDENTIAL