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<title>StartJpegDecoderShrink</title> 8 </head> 9 <body> 10<h1><CODE>nn::jpeg::CTR::JpegMpDecoder::StartJpegDecoderShrink</CODE> Member Function</h1> 11<h2>Syntax</h2> 12 <div class="section"> 13 <pre class="definition">#include <nn/jpeg.h> 14size_t StartJpegDecoderShrink( 15 void * dst, 16 size_t dstSize, 17 const u8 * src, 18 size_t srcSize, 19 u32 maxWidth, 20 u32 maxHeight, 21 <a href="../../../../nn/jpeg/CTR/PixelFormat.html">PixelFormat</a> dstPixelFormat, 22 bool decodeThumbnail, 23 u32 shrinkLevel 24); 25</pre> 26 </div> 27<h2>Arguments</h2> 28 <div class="section"> 29 <table class="arguments"> 30 <thead> 31 <tr> 32 <td width="15" /> 33<th>Name</th> 34<td>Description</td> 35 </tr> 36 </thead> 37 <tr> 38<td>out</td> 39<th>dst</th> 40<td>Specifies the buffer that stores the decoded result.<br />The alignment of this buffer must match the output pixel format specified by the <SPAN class="argument">dstPixelFormat</SPAN> argument.</td> 41 </tr> 42 <tr> 43<td>in</td> 44<th>dstSize</th> 45<td>Specifies the size of <SPAN class="argument">dst</SPAN> in bytes.<br />Specify the return value of <CODE><a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetDstBufferSize.html">GetDstBufferSize</a></CODE>. The <SPAN class="argument">maxWidth</SPAN> and <SPAN class="argument">maxHeight</SPAN> arguments of <CODE><a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetDstBufferSize.html">GetDstBufferSize</a></CODE> specify the maximum image dimensions of the decoded result (after shrinking).<br />Use the <SPAN class="argument">maxWidth</SPAN>, <SPAN class="argument">maxHeight</SPAN>, <SPAN class="argument">dstPixelFormat</SPAN>, and <SPAN class="argument">shrinkLevel</SPAN> arguments to this function as shown in this example:<br /><CODE><a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetDstBufferSize.html">GetDstBufferSize</a> ( maxWidth >> shrinkLevel, maxHeight >> shrinkLevel, dstPixelFormat )</CODE><br />However, when using the <a href="../../../../nn/jpeg/CTR/JpegMpDecoder/SetOutputBufferWidth.html"><CODE>SetOutputBufferWidth</CODE></a> function, specify the larger of that specified width and (<SPAN class="argument">maxWidth</SPAN> >> <SPAN class="argument">shrinkLevel</SPAN>).</td> 46 </tr> 47 <tr> 48<td>in</td> 49<th>src</th> 50<td>Specifies the JPEG data to decode.</td> 51 </tr> 52 <tr> 53<td>in</td> 54<th>srcSize</th> 55<td>Specifies the size of <SPAN class="argument">src</SPAN> in bytes.</td> 56 </tr> 57 <tr> 58<td>in</td> 59<th>maxWidth</th> 60<td>Specifies the maximum width (in pixels) of an image that can be decoded (equal to or less than 65536). <br />This value must be a multiple of the bitwise result of (1 << <SPAN class="argument">shrinkLevel</SPAN>).<br />After decoding successfully completes, use the <CODE><a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetLastWidth.html">GetLastWidth</a></CODE> function to get the original image width and the <CODE><a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetLastOutputBufferWidth.html">GetLastOutputBufferWidth</a></CODE> function to get the decoded result width.</td> 61 </tr> 62 <tr> 63<td>in</td> 64<th>maxHeight</th> 65<td>Specifies the maximum height (in pixels) of an image that can be decoded (equal to or less than 65536). <br />This value must be a multiple of the bitwise result of (1 << <SPAN class="argument">shrinkLevel</SPAN>).<br />After decoding successfully completes, use the <a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetLastHeight.html"><CODE>GetLastHeight</CODE></a> function to get the original image height and the <a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetLastOutputBufferHeight.html"><CODE>GetLastOutputBufferHeight</CODE></a> function to get the decoded result height.</td> 66 </tr> 67 <tr> 68<td>in</td> 69<th>dstPixelFormat</th> 70<td>Specifies the output pixel format.</td> 71 </tr> 72 <tr> 73<td>in</td> 74<th>decodeThumbnail</th> 75<td>Specify <CODE>true</CODE> to decode the thumbnail.<br />Specify <CODE>false</CODE> to decode the primary image.</td> 76 </tr> 77 <tr> 78<td>in</td> 79<th>shrinkLevel</th> 80<td>Specifies the shrink level. You can specify values of <CODE>1</CODE> to <CODE>4</CODE>.<br />Specify <CODE>1</CODE> to shrink both the height and width of the image to 1/2 the dimension of the original image.<br />Specify <CODE>2</CODE> to shrink both dimensions to 1/4, specify <CODE>3</CODE> for 1/8, and specify <CODE>4</CODE> for 1/16.</td> 81 </tr> </table> 82 </div> 83<h2>Return Values</h2> 84<div class="section">On success, returns the size (in bytes) of the buffer storing the decoded result.<br />Returns <CODE>0</CODE> on failure.<br />Use the <CODE><a href="../../../../nn/jpeg/CTR/JpegMpEncoder/GetLastError.html">GetLastError</a></CODE> function to get the reason for failure. </div> 85<h2>Description</h2> 86 <div class="section"> 87<p>Decodes a JPEG image and outputs it after shrinking.</p><p>The height and width of the output image are 1/2, 1/4, 1/8, or 1/16 of the original dimensions depending on the value of the shrinkLevel argument (values are rounded up).</p><p>The alignment specified by the <SPAN class="argument">dst</SPAN> argument is the same as for <a href="../../../../nn/jpeg/CTR/JpegMpDecoder/StartJpegDecoder.html"><CODE>StartJpegDecoder</CODE></a>.</p><p>The values of <SPAN class="argument">maxWidth</SPAN> and <SPAN class="argument">maxHeight</SPAN> specify the largest decodable image size. They must be a multiple of the bitwise result of (1 << <SPAN class="argument">shrinkLevel</SPAN>).<br /> In specific, the following conditions must be met.</p><p><UL> <LI> The dimensions must be a multiple of 2 when <SPAN class="argument">shrinkLevel</SPAN> is 1.<LI> The dimensions must be a multiple of 2 when <SPAN class="argument">shrinkLevel</SPAN> is 2.<LI> The dimensions must be a multiple of 8 when <SPAN class="argument">shrinkLevel</SPAN> is 3.<LI> The dimensions must be a multiple of 16 when <SPAN class="argument">shrinkLevel</SPAN> is 4.</LI></UL></p><p>The actual image size does not need to be a multiple of the bitwise result of (1 << <SPAN class="argument">shrinkLevel</SPAN>). If JPEG_DECODER_OPTION_MATCH_WIDTH_HEIGHT is specified using <a href="../../../../nn/jpeg/CTR/JpegMpDecoder/SetOption.html">SetOption</a>, the values of arguments maxWidth and maxHeight must match, otherwise decoding will fail.</p><p>After this function completes successfully, call the <a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetLastWidth.html"><CODE>GetLastWidth</CODE></a> and <a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetLastHeight.html"><CODE>GetLastHeight</CODE></a> functions to get the original image dimensions (before shrinking). Call the <a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetLastOutputBufferWidth.html"><CODE>GetLastOutputBufferWidth</CODE></a> and <a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetLastOutputBufferHeight.html"><CODE>GetLastOutputBufferHeight</CODE></a> functions to get the dimensions of the decoded result (output to a buffer after shrinking).</p><p>Processing time is not related to whether the original image size is a multiple of 8 or 16 pixels. Larger original and decoded image sizes take longer to process.</p><!-- write here --></div> 88<h2>Revision History</h2> 89 <div class="section"> 90 <dl class="history"> 91 <dt>2010/10/21</dt> 92<dd>Added a description of <CODE>SetOption</CODE>.<br /> 93 </dd> 94 <dt>2010/08/16</dt> 95<dd>Initial version.<br /> 96 </dd> 97 </dl> 98 </div> 99 <hr><p>CONFIDENTIAL</p></body> 100</html> 101