1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" /> 7 <style type="text/css"><!-- 8 span.static_style 9 { 10 font-size : 8pt; 11 color : white; 12 font-weight : bold; 13 background : #44f; 14 border-left : solid 1px #aaf; 15 border-top : solid 1px #aaf; 16 border-right : solid 1px #00c; 17 border-bottom : solid 1px #00c; 18 padding-left : 2px; 19 padding-right : 2px; 20 } 21 22 span.virtual_style 23 { 24 font-size : 8pt; 25 color : white; 26 font-weight : bold; 27 background : #0a0; 28 border-left : solid 1px #0f0; 29 border-top : solid 1px #0f0; 30 border-right : solid 1px #060; 31 border-bottom : solid 1px #060; 32 padding-left : 2px; 33 padding-right : 2px; 34 } 35 36 span.protected_style 37 { 38 font-size : 8pt; 39 color : white; 40 font-weight : bold; 41 background : #444; 42 border-left : solid 1px #ccc; 43 border-top : solid 1px #ccc; 44 border-right : solid 1px #222; 45 border-bottom : solid 1px #222; 46 padding-left : 2px; 47 padding-right : 2px; 48 } 49 --></style> 50<title>nn::jpeg::CTR</title> 51 </head> 52 <body> 53<h1><CODE><a href="../../../nn/Overview.html">nn</a>::<a href="../../../nn/jpeg/Overview.html">jpeg</a>::CTR</CODE> Namespace</h1> 54<h2>Description</h2> 55 <div class="section"> 56<p>The namespace of the <a href="../../../nn/jpeg/CTR/Overview.html">CTR</a> JPEG compression/decompression library. <br />(This namespace can also be written without the <CODE>::CTR</CODE> portion.)</p><h3>Decodable JPEG and MP Data Formats</h3><p> 57The <CODE>nn::jpeg::JpegMpDecoder</CODE> class can only decode JPEG data in baseline JPEG compression format.<br /><br />The same applies to MP data formats.<br /><br />In particular, decoding the following JPEG and MP formats will fail. 58<ul><li>Progressive</li><li>Uncompressed</li></ul> 59It may be unable to decode JPEG images created by other than the <CODE>nn::jpeg::JpegMpEncoder</CODE> class, even if it is in baseline JPEG compression format.<br /><br />If decoding fails, it may be possible to decode the image after removing the Exif data, the thumbnail, and APP<I>n</I> (where <I>n</I> is 0-15). In the case of data in MP format, however, keep APP2 segments with MP-format related information. 60</p><h3>Handling of Data Quantization When Decoding</h3><p> 61In versions of the SDK older than 3.2, the Y component references <CODE>QT0</CODE> for DQT (the data quantization table), and the Cb and Cr components reference <CODE>QT1</CODE>. Images comprising other combinations were not decoded correctly, even when the decode function succeeded. For example, if only <CODE>QT0</CODE> is defined and gets referenced by all of the image components, then all cases of <CODE>QT1</CODE> will be treated as <CODE>0</CODE> and the image will appear monochrome. Decoding works correctly in SDK 3.2 and later. 62</p><h3>Handling of APP1 Marker When Decoding</h3><p> 63If 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. 64</p><h3>Image Degradation After Repeated Encoding and Decoding</h3><p> 65The 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. 66</p><ul><li>When decoding, specify the pixel format as <CODE>nn::jpeg::CTR::PIXEL_FORMAT_YUYV8</CODE> before editing or encoding the image. If this is not feasible, consider specifying 8-bit color components like <CODE>nn::jpeg::CTR::PIXEL_FORMAT_RGB8</CODE> rather than <CODE>nn::jpeg::CTR::PIXEL_FORMAT_CTR_RGB565</CODE>.</li><li>Specify <CODE>nn::jpeg::CTR::PIXEL_SAMPLING_YUV444</CODE> for pixel sampling when encoding. <CODE>nn::jpeg::CTR::PIXEL_SAMPLING_YUV420</CODE> is the most susceptible to degradation of image quality.</li><li>Specify high image quality when encoding.</li></ul></div> 67 <a name="class" id="class"> 68<h2>Classes</h2> 69 <div class="section"> 70 <table class="members"> 71 <tr> 72 <th> 73<a href="../../../nn/jpeg/CTR/JpegMpDecoder/Overview.html"><CODE>nn::jpeg::CTR::JpegMpDecoder</CODE></a> 74 </th> 75<td>This class performs JPEG decoding.</td> 76 </tr> 77 <tr> 78 <th> 79<a href="../../../nn/jpeg/CTR/JpegMpEncoder/Overview.html"><CODE>nn::jpeg::CTR::JpegMpEncoder</CODE></a> 80 </th> 81<td>This class performs JPEG encoding.</td> 82 </tr> </table> 83 </div> 84 </a> <a name="struct" id="struct"> 85<h2>Structures</h2> 86 <div class="section"> 87 <table class="members"> 88 <tr> 89 <th> 90<a href="../../../nn/jpeg/CTR/MpIndex/Overview.html"><CODE>nn::jpeg::CTR::MpIndex</CODE></a> 91 </th> 92<td>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.</td> 93 </tr> 94 <tr> 95 <th> 96<a href="../../../nn/jpeg/CTR/MpEntry/Overview.html"><CODE>nn::jpeg::CTR::MpEntry</CODE></a> 97 </th> 98<td>Structure holding an MP entry in a format easily processed by the library. MP entries are included in the data stored in MP format.</td> 99 </tr> 100 <tr> 101 <th> 102<a href="../../../nn/jpeg/CTR/Rational/Overview.html"><CODE>nn::jpeg::CTR::Rational</CODE></a> 103 </th> 104<td><CODE>RATIONAL</CODE> (unsigned rational number) data type, used for members of the MP Attribute IFD and GPS IFD.</td> 105 </tr> 106 <tr> 107 <th> 108<a href="../../../nn/jpeg/CTR/Srational/Overview.html"><CODE>nn::jpeg::CTR::Srational</CODE></a> 109 </th> 110<td><CODE>SRATIONAL</CODE> (signed rational number) data type, used for members of the MP Attribute IFD and GPS IFD.</td> 111 </tr> 112 <tr> 113 <th> 114<a href="../../../nn/jpeg/CTR/MpAttribute/Overview.html"><CODE>nn::jpeg::CTR::MpAttribute</CODE></a> 115 </th> 116<td>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.</td> 117 </tr> 118 <tr> 119 <th> 120<a href="../../../nn/jpeg/CTR/MpRegionsToBuildJpegData/Overview.html"><CODE>nn::jpeg::CTR::MpRegionsToBuildJpegData</CODE></a> 121 </th> 122<td>Structure holding the region information (pointer and byte count) for rebuilding the JPEG data.</td> 123 </tr> 124 <tr> 125 <th> 126<a href="../../../nn/jpeg/CTR/GpsData/Overview.html">nn::jpeg::CTR::GpsData</a> 127 </th> 128<td>This structure maintains GPS IFD in a format easily processed by the library.</td> 129 </tr> </table> 130 </div> 131 </a> <a name="enum" id="enum"> 132<h2>Enumerated Types</h2> 133 <div class="section"> 134 <table class="members"> 135 <tr> 136 <td width="100"> </td> 137 <th> 138<a href="../../../nn/jpeg/CTR/PixelSampling.html"><CODE>PixelSampling</CODE></a> 139 </th> 140<td>Enumerated type indicating the output format when encoding.</td> 141 </tr> 142 <tr> 143 <td width="100"> </td> 144 <th> 145<a href="../../../nn/jpeg/CTR/PixelFormat.html"><CODE>PixelFormat</CODE></a> 146 </th> 147<td>Enumerated type indicating the pixel format.</td> 148 </tr> 149 <tr> 150 <td width="100"> </td> 151 <th> 152<a href="../../../nn/jpeg/CTR/MpTypeFlag.html"><CODE>MpTypeFlag</CODE></a> 153 </th> 154<td>Flag(s) included in the MP type information.</td> 155 </tr> 156 <tr> 157 <td width="100"> </td> 158 <th> 159<a href="../../../nn/jpeg/CTR/MpTypeDataFormat.html"><CODE>MpTypeDataFormat</CODE></a> 160 </th> 161<td>Data format included in the MP type information.</td> 162 </tr> 163 <tr> 164 <td width="100"> </td> 165 <th> 166<a href="../../../nn/jpeg/CTR/MpTypeCode.html"><CODE>MpTypeCode</CODE></a> 167 </th> 168<td>Type code included in the MP type information.</td> 169 </tr> 170 <tr> 171 <td width="100"> </td> 172 <th> 173<a href="../../../nn/jpeg/CTR/EncoderErrorCode.html">EncoderErrorCode</a> 174 </th> 175<td>Gives the reason why the encoding just performed failed.</td> 176 </tr> 177 <tr> 178 <td width="100"> </td> 179 <th> 180<a href="../../../nn/jpeg/CTR/DecoderErrorCode.html">DecoderErrorCode</a> 181 </th> 182<td>Gives the reason why the decoding or other operation just performed failed.</td> 183 </tr> 184 <tr> 185 <td width="100"> </td> 186 <th> 187<a href="../../../nn/jpeg/CTR/EncoderOption.html">EncoderOption</a> 188 </th> 189<td>Options used when encoding.</td> 190 </tr> 191 <tr> 192 <td width="100"> </td> 193 <th> 194<a href="../../../nn/jpeg/CTR/DecoderOption.html">DecoderOption</a> 195 </th> 196<td>Options used when decoding.</td> 197 </tr> </table> 198 </div> 199 </a> <a name="constant" id="constant"> 200<h2>Constants</h2> 201 <div class="section"> 202 <table class="members"> 203 <tr> 204 <td width="100"> </td> 205 <th> 206<span class="argument"><a href="../../../nn/jpeg/CTR/DATE_TIME_SIZE.html"><CODE>DATE_TIME_SIZE</CODE></a></span> 207 </th> 208<td width="100">const size_t</td> 209<td>Number of bytes in the buffer that stores date and time information. This constant is a string with the format "<CODE>YYYY:MM:DD HH:MM:DD</CODE>" terminated with <CODE>0x00</CODE>, for a total of 20 characters.</td> 210 </tr> 211 <tr> 212 <td width="100"> </td> 213 <th> 214<span class="argument"><a href="../../../nn/jpeg/CTR/IMAGE_UID_SIZE.html"><CODE>IMAGE_UID_SIZE</CODE></a></span> 215 </th> 216<td width="100">const size_t</td> 217<td>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.</td> 218 </tr> 219 <tr> 220 <td width="100"> </td> 221 <th> 222<span class="argument"><a href="../../../nn/jpeg/CTR/MPF_VERSION_SIZE.html">MPF_VERSION_SIZE</a></span> 223 </th> 224<td width="100">const size_t</td> 225<td>The number of bytes of the MP format version.</td> 226 </tr> 227 <tr> 228 <td width="100"> </td> 229 <th> 230<span class="argument"><a href="../../../nn/jpeg/CTR/MP_ENTRY_SIZE.html"><CODE>MP_ENTRY_SIZE</CODE></a></span> 231 </th> 232<td width="100">const size_t</td> 233<td>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 <CODE><a href="../../../nn/jpeg/CTR/MpEntry/Overview.html">MpEntry</a></CODE> structure.</td> 234 </tr> 235 <tr> 236 <td width="100"> </td> 237 <th> 238<span class="argument"><a href="../../../nn/jpeg/CTR/GPS_VERSION_ID_SIZE.html">GPS_VERSION_ID_SIZE</a></span> 239 </th> 240<td width="100">const size_t</td> 241<td>The number of bytes of the GPS tag version.</td> 242 </tr> 243 <tr> 244 <td width="100"> </td> 245 <th> 246<span class="argument"><a href="../../../nn/jpeg/CTR/GPS_DATE_STAMP_SIZE.html">GPS_DATE_STAMP_SIZE</a></span> 247 </th> 248<td width="100">const size_t</td> 249<td>The number of bytes in the GPS date stamp.</td> 250 </tr> 251 <tr> 252 <td width="100"> </td> 253 <th> 254<span class="argument"><a href="../../../nn/jpeg/CTR/MIN_DECODER_SHRINK_LEVEL.html"><CODE>MIN_DECODER_SHRINK_LEVEL</CODE></a></span> 255 </th> 256<td width="100">const <a href="../../../nn_types/u32.html">u32</a></td> 257<td>Minimum value that can be specified for the shrink level when shrink decoding.</td> 258 </tr> 259 <tr> 260 <td width="100"> </td> 261 <th> 262<span class="argument"><a href="../../../nn/jpeg/CTR/MAX_DECODER_SHRINK_LEVEL.html"><CODE>MAX_DECODER_SHRINK_LEVEL</CODE></a></span> 263 </th> 264<td width="100">const <a href="../../../nn_types/u32.html">u32</a></td> 265<td>Maximum value that can be specified for the shrink level when shrink decoding.</td> 266 </tr> 267 <tr> 268 <td width="100"> </td> 269 <th> 270<span class="argument"><a href="../../../nn/jpeg/CTR/TWL_PHOTO_MAKER_NOTE_SIZE.html"><CODE>TWL_PHOTO_MAKER_NOTE_SIZE</CODE></a></span> 271 </th> 272<td width="100">const size_t</td> 273<td>The number of bytes in a MakerNote for the Nintendo DSi Camera application.</td> 274 </tr> 275 <tr> 276 <td width="100"> </td> 277 <th> 278<span class="argument"><a href="../../../nn/jpeg/CTR/MAX_DECODER_OUTPUT_BUFFER_WIDTH.html"><CODE>MAX_DECODER_OUTPUT_BUFFER_WIDTH</CODE></a></span> 279 </th> 280<td width="100">const <a href="../../../nn_types/u32.html">u32</a></td> 281<td>Maximum value (number of pixels) that can be specified for the output image buffer width when decoding.</td> 282 </tr> 283 <tr> 284 <td width="100"> </td> 285 <th> 286<span class="argument"><a href="../../../nn/jpeg/CTR/MAX_ENCODER_INPUT_BUFFER_WIDTH.html"><CODE>MAX_ENCODER_INPUT_BUFFER_WIDTH</CODE></a></span> 287 </th> 288<td width="100">const <a href="../../../nn_types/u32.html">u32</a></td> 289<td>Maximum value (number of pixels) that can be specified for the input image buffer width when encoding.</td> 290 </tr> 291 <tr> 292 <td width="100"> </td> 293 <th> 294<span class="argument"><a href="../../../nn/jpeg/CTR/DEFAULT_THUMBNAIL_PIXEL_SAMPLING.html"><CODE>DEFAULT_THUMBNAIL_PIXEL_SAMPLING</CODE></a></span> 295 </th> 296<td width="100">const <a href="../../../nn/jpeg/CTR/PixelSampling.html">PixelSampling</a></td> 297<td>Default thumbnail output format.</td> 298 </tr> 299 <tr> 300 <td width="100"> </td> 301 <th> 302<span class="argument"><a href="../../../nn/jpeg/CTR/DEFAULT_THUMBNAIL_WIDTH.html"><CODE>DEFAULT_THUMBNAIL_WIDTH</CODE></a></span> 303 </th> 304<td width="100">const <a href="../../../nn_types/u32.html">u32</a></td> 305<td>Default thumbnail image width, in pixels.</td> 306 </tr> 307 <tr> 308 <td width="100"> </td> 309 <th> 310<span class="argument"><a href="../../../nn/jpeg/CTR/DEFAULT_THUMBNAIL_HEIGHT.html"><CODE>DEFAULT_THUMBNAIL_HEIGHT</CODE></a></span> 311 </th> 312<td width="100">const <a href="../../../nn_types/u32.html">u32</a></td> 313<td>Default thumbnail image height, in pixels.</td> 314 </tr> </table> 315 </div> 316 </a> 317<h2>Revision History</h2> 318 <div class="section"> 319 <dl class="history"> 320 <dt>2011/10/24</dt> 321<dd>Added information about image degradation after repeated encoding and decoding. 322 </dd> 323 <dt>2011/10/06</dt> 324<dd>Described revisions in SDK 3.2. 325 </dd> 326 <dt>2011/06/14</dt> 327<dd>Noted that in some cases the decode result will be monochrome.<br /> 328 </dd> 329 <dt>2011/04/08</dt> 330<dd>Revised the description of data examples that will cause decode failure.<br /> 331 </dd> 332 <dt>2011/03/04</dt> 333<dd>Added information about decodable JPEG and MP data formats.<br /> 334 </dd> 335 <dt>2010/10/21</dt> 336<dd>Added descriptions of GpsData, EncoderErrorCode, DecoderErrorCode, EncoderOption, and DecoderOption.<br /> 337 </dd> 338 <dt>2010/04/14</dt> 339<dd>Initial version.<br /> 340 </dd> 341 </dl> 342 </div> 343 <hr><p>CONFIDENTIAL</p></body> 344</html> 345