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><a href="../../../../nn/Overview.html">nn</a>::<a href="../../../../nn/jpeg/Overview.html">jpeg</a>::<a href="../../../../nn/jpeg/CTR/Overview.html">CTR</a>::<a href="../../../../nn/jpeg/CTR/JpegMpDecoder/Overview.html">JpegMpDecoder</a>::StartJpegDecoderShrink</CODE> Member Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">#include &lt;nn/jpeg.h&gt;
14
15size_t StartJpegDecoderShrink(
16     void * dst,
17     size_t dstSize,
18     const <a href="../../../../nn_types/u8.html">u8</a> * src,
19     size_t srcSize,
20     <a href="../../../../nn_types/u32.html">u32</a> maxWidth,
21     <a href="../../../../nn_types/u32.html">u32</a> maxHeight,
22     <a href="../../../../nn/jpeg/CTR/PixelFormat.html">PixelFormat</a> dstPixelFormat,
23     bool decodeThumbnail,
24     <a href="../../../../nn_types/u32.html">u32</a> shrinkLevel
25);
26</pre>
27    </div>
28<h2>Parameters</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 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 &gt;&gt; shrinkLevel, maxHeight &gt;&gt; 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> &gt;&gt; <SPAN class="argument">shrinkLevel</SPAN>).</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 (equal to or less than 65536). <br />This value must be a multiple of the bitwise result of (1 &lt;&lt; <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>
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 (equal to or less than 65536). <br />This value must be a multiple of the bitwise result of (1 &lt;&lt; <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>
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 primary 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 <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>
82        </tr> </table>
83    </div>
84<h2>Return Values</h2>
85<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>
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 shrinkLevel argument (fractional 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 &lt;&lt; <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 4 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 4 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 &lt;&lt;  <SPAN class="argument">shrinkLevel</SPAN>). If JPEG_DECODER_OPTION_MATCH_WIDTH_HEIGHT is specified for<a href="../../../../nn/jpeg/CTR/JpegMpDecoder/SetOption.html">SetOption</a>, the values of the maxWidth and maxHeight arguments must match and not be the maximum values, 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>
89<h2>Revision History</h2>
90    <div class="section">
91      <dl class="history">
92        <dt>2010/10/21</dt>
93<dd>Added a description of <CODE>SetOption</CODE>.<br />
94        </dd>
95        <dt>2010/08/16</dt>
96<dd>Initial version.<br />
97        </dd>
98      </dl>
99    </div>
100  <hr><p>CONFIDENTIAL</p></body>
101</html>
102