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> 14 15size_t StartJpegDecoderShrink( 16 void * dst, 17 size_t dstSize, 18 const u8 * src, 19 size_t srcSize, 20 u32 maxWidth, 21 u32 maxHeight, 22 <a href="../../../../nn/jpeg/CTR/PixelFormat.html">PixelFormat</a> dstPixelFormat, 23 bool decodeThumbnail, 24 u32 shrinkLevel 25); 26</pre> 27 </div> 28<h2>Arguments</h2> 29 <div class="section"> 30 <table class="arguments"> 31 <thead> 32 <tr> 33 <td width="15" /> 34<th>Name</th> 35<td>Description</td> 36 </tr> 37 </thead> 38 <tr> 39<td>out</td> 40<th>dst</th> 41<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> 42 </tr> 43 <tr> 44<td>in</td> 45<th>dstSize</th> 46<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 decoding results (after shrinking).<br />You can specify the function arguments <SPAN class="argument">maxWidth</SPAN>, <SPAN class="argument">maxHeight</SPAN>, <SPAN class="argument">dstPixelFormat</SPAN> and <SPAN class="argument">shrinkLevel</SPAN> as shown in this example:<br /><a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetDstBufferSize.html"><CODE>GetDstBufferSize</CODE></a> ( <SPAN class="argument">maxWidth</SPAN> >> <SPAN class="argument">shrinkLevel</SPAN>, <SPAN class="argument">maxHeight</SPAN> >> <SPAN class="argument">shrinkLevel</SPAN>, <SPAN class="argument">dstPixelFormat </SPAN>)<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>maxWidth </SPAN>>> <CODE>shrinkLevel</CODE>).</td> 47 </tr> 48 <tr> 49<td>in</td> 50<th>src</th> 51<td>Specifies the JPEG data to decode.</td> 52 </tr> 53 <tr> 54<td>in</td> 55<th>srcSize</th> 56<td>Specifies the size of <SPAN class="argument">src</SPAN> in bytes.</td> 57 </tr> 58 <tr> 59<td>in</td> 60<th>maxWidth</th> 61<td>Specifies the maximum width (in pixels) of an image that can be decoded. (Up to 65536) <br />Must be a multiple of the bitwise result of (1 << shrinkLevel).<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> 62 </tr> 63 <tr> 64<td>in</td> 65<th>maxHeight</th> 66<td>Specifies the maximum height (in pixels) of an image that can be decoded. (Up to 65536) <br />Must be a multiple of the bitwise result of (1 << shrinkLevel).<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> 67 </tr> 68 <tr> 69<td>in</td> 70<th>dstPixelFormat</th> 71<td>Specifies the output pixel format.</td> 72 </tr> 73 <tr> 74<td>in</td> 75<th>decodeThumbnail</th> 76<td>Specify <CODE>true</CODE> to decode the thumbnail.<br />Specify <CODE>false</CODE> to decode the main image.</td> 77 </tr> 78 <tr> 79<td>in</td> 80<th>shrinkLevel</th> 81<td>Specifies the shrink level. You can specify values of 1 through 4.<br />Specify 1 to shrink both the original height and width of the image by 1/2.<br />Specify 2 to shrink both original dimensions by 1/4, 3 for 1/8, and 4 for 1/16.</td> 82 </tr> </table> 83 </div> 84<h2>Return Values</h2> 85<div class="section">When the function succeeds, the resulting buffer size (in bytes) is returned.<br />If the function fails it returns <CODE>0</CODE>.<br />Use the <CODE><a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetLastError.html">GetLastError</a></CODE> function to get the reason for failure. </div> 86<h2>Description</h2> 87 <div class="section"> 88<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 <SPAN class="argument">shrinkLevel</SPAN> argument. (Fractions 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 specified for <SPAN class="argument">maxWidth</SPAN> and <SPAN class="argument">maxHeight</SPAN> (which define the largest image for which decoding is permitted) must be multiples of the bitwise result of (1 << <SPAN class="argument">shrinkLevel</SPAN>) for the given shrink level.<br />To be specific, you need to satisfy these conditions:<br />・When <CODE>shrinkLevel</CODE> is set to 1, specify a multiple of 2.<br />・When <CODE>shrinkLevel</CODE> is set to 2, specify a multiple of 4.<br />・When <CODE>shrinkLevel</CODE> is set to 3, specify a multiple of 8.<br />・When <CODE>shrinkLevel</CODE> is set to 4, specify a multiple of 16.<br />The actual image size does not need to be a multiple of the bitwise result of (1 << <SPAN class="argument">shrinkLevel</SPAN>).</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> 89<h2>Revision History</h2> 90 <div class="section"> 91 <dl class="history"> 92 <dt>2010/08/16</dt> 93<dd>Initial version.<br /> 94 </dd> 95 </dl> 96 </div> 97 <hr><p>CONFIDENTIAL</p></body> 98</html>