<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>AlbumShaper: jpegSize.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> </div> <div class="contents"> <h1>jpegSize.h File Reference</h1><div class="dynheader"> This graph shows which files directly or indirectly include this file:</div> <div class="dynsection"> </div> <p><a href="jpegSize_8h_source.html">Go to the source code of this file.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="jpegSize_8h.html#a15dc90155bd20ad6b903b548af5690ae">getJPEGSize</a> (const char *filename, int &<a class="el" href="blur_8cpp.html#a2474a5474cbff19523a51eb1de01cda4">width</a>, int &<a class="el" href="blur_8cpp.html#ad12fc34ce789bce6c8a05d8a17138534">height</a>)</td></tr> </table> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a15dc90155bd20ad6b903b548af5690ae"></a><!-- doxytag: member="jpegSize.h::getJPEGSize" ref="a15dc90155bd20ad6b903b548af5690ae" args="(const char *filename, int &width, int &height)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool getJPEGSize </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>filename</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int & </td> <td class="paramname"> <em>width</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int & </td> <td class="paramname"> <em>height</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="jpegSize_8cpp_source.html#l00065">65</a> of file <a class="el" href="jpegSize_8cpp_source.html">jpegSize.cpp</a>.</p> <p>References <a class="el" href="jpegSize_8cpp_source.html#l00149">first_marker()</a>, <a class="el" href="jpegSize_8cpp_source.html#l00056">infile</a>, <a class="el" href="jpegSize_8cpp_source.html#l00040">M_EOI</a>, <a class="el" href="jpegSize_8cpp_source.html#l00026">M_SOF0</a>, <a class="el" href="jpegSize_8cpp_source.html#l00027">M_SOF1</a>, <a class="el" href="jpegSize_8cpp_source.html#l00034">M_SOF10</a>, <a class="el" href="jpegSize_8cpp_source.html#l00035">M_SOF11</a>, <a class="el" href="jpegSize_8cpp_source.html#l00036">M_SOF13</a>, <a class="el" href="jpegSize_8cpp_source.html#l00037">M_SOF14</a>, <a class="el" href="jpegSize_8cpp_source.html#l00038">M_SOF15</a>, <a class="el" href="jpegSize_8cpp_source.html#l00028">M_SOF2</a>, <a class="el" href="jpegSize_8cpp_source.html#l00029">M_SOF3</a>, <a class="el" href="jpegSize_8cpp_source.html#l00030">M_SOF5</a>, <a class="el" href="jpegSize_8cpp_source.html#l00031">M_SOF6</a>, <a class="el" href="jpegSize_8cpp_source.html#l00032">M_SOF7</a>, <a class="el" href="jpegSize_8cpp_source.html#l00033">M_SOF9</a>, <a class="el" href="jpegSize_8cpp_source.html#l00041">M_SOS</a>, <a class="el" href="jpegSize_8cpp_source.html#l00172">next_marker()</a>, <a class="el" href="jpegSize_8cpp_source.html#l00261">process_SOFn()</a>, <a class="el" href="jpegSize_8cpp_source.html#l00052">READ_BINARY</a>, and <a class="el" href="jpegSize_8cpp_source.html#l00237">skip_variable()</a>.</p> <p>Referenced by <a class="el" href="imageTools_8cpp_source.html#l00201">getImageSize()</a>, and <a class="el" href="imageTools_8cpp_source.html#l00033">isJpeg()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00066"></a>00066 { <a name="l00067"></a>00067 <span class="comment">//open file</span> <a name="l00068"></a>00068 <span class="keywordflow">if</span> ((<a class="code" href="jpegSize_8cpp.html#af19157da745ecb3f2b088c8f3a10c0a7">infile</a> = fopen(filename, <a class="code" href="jpegSize_8cpp.html#a7032a5e02e3a69b9bb87efd768bffabc">READ_BINARY</a>)) == NULL) <a name="l00069"></a>00069 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00070"></a>00070 <a name="l00071"></a>00071 <span class="comment">//this is scan_JPEG_header (int verbose)</span> <a name="l00072"></a>00072 <span class="comment">//Parse the marker stream until SOFn is seen;</span> <a name="l00073"></a>00073 <span class="keywordtype">int</span> marker; <a name="l00074"></a>00074 <a name="l00075"></a>00075 <span class="comment">//Expect SOI at start of file</span> <a name="l00076"></a>00076 <span class="keywordflow">if</span> (!<a class="code" href="jpegSize_8cpp.html#a03a794f9a32e547280feb641b6f482b7">first_marker</a>(&marker)) <a name="l00077"></a>00077 { <a name="l00078"></a>00078 fclose(<a class="code" href="jpegSize_8cpp.html#af19157da745ecb3f2b088c8f3a10c0a7">infile</a>); <a name="l00079"></a>00079 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00080"></a>00080 } <a name="l00081"></a>00081 <a name="l00082"></a>00082 <span class="comment">/* Scan miscellaneous markers until we reach SOFn. */</span> <a name="l00083"></a>00083 <span class="keywordflow">for</span> (;;) <a name="l00084"></a>00084 { <a name="l00085"></a>00085 <span class="keywordflow">if</span>(!<a class="code" href="jpegSize_8cpp.html#a3dc947c90667a67ece81b9e877575164">next_marker</a>(&marker)) <a name="l00086"></a>00086 { <a name="l00087"></a>00087 fclose(<a class="code" href="jpegSize_8cpp.html#af19157da745ecb3f2b088c8f3a10c0a7">infile</a>); <a name="l00088"></a>00088 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00089"></a>00089 } <a name="l00090"></a>00090 <a name="l00091"></a>00091 <span class="keywordflow">switch</span> (marker) <a name="l00092"></a>00092 { <a name="l00093"></a>00093 <span class="comment">/* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be,</span> <a name="l00094"></a>00094 <span class="comment"> * treated as SOFn. C4 in particular is actually DHT.</span> <a name="l00095"></a>00095 <span class="comment"> */</span> <a name="l00096"></a>00096 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#ae747795c32cea1314b49e9b7d65be454">M_SOF0</a>: <span class="comment">/* Baseline */</span> <a name="l00097"></a>00097 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#ab58d501dd163fdd0dee4ba6907e191a0">M_SOF1</a>: <span class="comment">/* Extended sequential, Huffman */</span> <a name="l00098"></a>00098 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#aeeeb620f261aa6b63448de940c7a7714">M_SOF2</a>: <span class="comment">/* Progressive, Huffman */</span> <a name="l00099"></a>00099 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#a7f09d1c601661800967c5d7e447d5a1f">M_SOF3</a>: <span class="comment">/* Lossless, Huffman */</span> <a name="l00100"></a>00100 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#ace7276c4a30808cd6fe74abda2f16ad6">M_SOF5</a>: <span class="comment">/* Differential sequential, Huffman */</span> <a name="l00101"></a>00101 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#a3f5a3446a533760babdfd4d0f775e97c">M_SOF6</a>: <span class="comment">/* Differential progressive, Huffman */</span> <a name="l00102"></a>00102 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#a3805e83e6b1e8f52a78f1b6cb0668133">M_SOF7</a>: <span class="comment">/* Differential lossless, Huffman */</span> <a name="l00103"></a>00103 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#a5a510cc3009a14911acbbe7ddb378776">M_SOF9</a>: <span class="comment">/* Extended sequential, arithmetic */</span> <a name="l00104"></a>00104 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#aa718681ce1acfa7622ad9776404cfa98">M_SOF10</a>: <span class="comment">/* Progressive, arithmetic */</span> <a name="l00105"></a>00105 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#a51ac607f59c2730811fd514561770966">M_SOF11</a>: <span class="comment">/* Lossless, arithmetic */</span> <a name="l00106"></a>00106 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#a8ba4457ac8573d317b4562303197c72e">M_SOF13</a>: <span class="comment">/* Differential sequential, arithmetic */</span> <a name="l00107"></a>00107 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#ae3a73495aaced1aacd8577dac2dbe22e">M_SOF14</a>: <span class="comment">/* Differential progressive, arithmetic */</span> <a name="l00108"></a>00108 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#a6e4ec1d092fa9aaaa3a8a18aa1ee4381">M_SOF15</a>: <span class="comment">/* Differential lossless, arithmetic */</span> <a name="l00109"></a>00109 <span class="keywordflow">if</span>(!<a class="code" href="jpegSize_8cpp.html#ac9692d87db7c729416c07817a3d884ef">process_SOFn</a>(<a class="code" href="blur_8cpp.html#a2474a5474cbff19523a51eb1de01cda4">width</a>, <a class="code" href="blur_8cpp.html#ad12fc34ce789bce6c8a05d8a17138534">height</a>)) <a name="l00110"></a>00110 { <a name="l00111"></a>00111 fclose(<a class="code" href="jpegSize_8cpp.html#af19157da745ecb3f2b088c8f3a10c0a7">infile</a>); <a name="l00112"></a>00112 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00113"></a>00113 } <a name="l00114"></a>00114 <span class="keywordflow">else</span> <a name="l00115"></a>00115 { <a name="l00116"></a>00116 fclose(<a class="code" href="jpegSize_8cpp.html#af19157da745ecb3f2b088c8f3a10c0a7">infile</a>); <a name="l00117"></a>00117 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00118"></a>00118 } <a name="l00119"></a>00119 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#af5fdac2a556ee915b65b295faff22ead">M_SOS</a>: <span class="comment">/* stop before hitting compressed data */</span> <a name="l00120"></a>00120 { <a name="l00121"></a>00121 fclose(<a class="code" href="jpegSize_8cpp.html#af19157da745ecb3f2b088c8f3a10c0a7">infile</a>); <a name="l00122"></a>00122 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00123"></a>00123 } <a name="l00124"></a>00124 <span class="keywordflow">case</span> <a class="code" href="jpegSize_8cpp.html#a43056e27046e8d6327320714a5a0b0f0">M_EOI</a>: <span class="comment">/* in case it's a tables-only JPEG stream */</span> <a name="l00125"></a>00125 { <a name="l00126"></a>00126 fclose(<a class="code" href="jpegSize_8cpp.html#af19157da745ecb3f2b088c8f3a10c0a7">infile</a>); <a name="l00127"></a>00127 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00128"></a>00128 } <a name="l00129"></a>00129 <span class="keywordflow">default</span>: <span class="comment">/* Anything else just gets skipped */</span> <a name="l00130"></a>00130 <a class="code" href="jpegSize_8cpp.html#ac8503f8433f75c15d731b738830b8eb6">skip_variable</a>(); <span class="comment">/* we assume it has a parameter count... */</span> <a name="l00131"></a>00131 <span class="keywordflow">break</span>; <a name="l00132"></a>00132 } <a name="l00133"></a>00133 } <span class="comment">/* end loop */</span> <a name="l00134"></a>00134 <a name="l00135"></a>00135 <a name="l00136"></a>00136 <span class="comment">//cout << "ERROR!\n";</span> <a name="l00137"></a>00137 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00138"></a>00138 <a name="l00139"></a>00139 } </pre></div></p> </div> </div> </div> <hr size="1"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address> </body> </html>