Sophie

Sophie

distrib > Mandriva > 2010.0 > x86_64 > by-pkgid > f250c16c2b84c9364a2f35a71121aaa2 > files > 354

lib64dirac-devel-1.0.2-2mdv2010.0.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Dirac Video Codec</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<h1 align="center" color="#606080">
Dirac - A Video Codec
</h1>
<p align="center">
Created by the <a href="http://www.bbc.co.uk">British Broadcasting Corporation</a>.
</p>
<hr>
<!-- Generated by Doxygen 1.5.9 -->
<h1>parseunit_byteio.h</h1><a href="a00210.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* ***** BEGIN LICENSE BLOCK *****</span>
<a name="l00002"></a>00002 <span class="comment">*</span>
<a name="l00003"></a>00003 <span class="comment">* $Id: parseunit_byteio.h,v 1.11 2008/05/02 05:57:19 asuraparaju Exp $ $Name: Dirac_1_0_2 $</span>
<a name="l00004"></a>00004 <span class="comment">*</span>
<a name="l00005"></a>00005 <span class="comment">* Version: MPL 1.1/GPL 2.0/LGPL 2.1</span>
<a name="l00006"></a>00006 <span class="comment">*</span>
<a name="l00007"></a>00007 <span class="comment">* The contents of this file are subject to the Mozilla Public License</span>
<a name="l00008"></a>00008 <span class="comment">* Version 1.1 (the "License"); you may not use this file except in compliance</span>
<a name="l00009"></a>00009 <span class="comment">* with the License. You may obtain a copy of the License at</span>
<a name="l00010"></a>00010 <span class="comment">* http://www.mozilla.org/MPL/</span>
<a name="l00011"></a>00011 <span class="comment">*</span>
<a name="l00012"></a>00012 <span class="comment">* Software distributed under the License is distributed on an "AS IS" basis,</span>
<a name="l00013"></a>00013 <span class="comment">* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for</span>
<a name="l00014"></a>00014 <span class="comment">* the specific language governing rights and limitations under the License.</span>
<a name="l00015"></a>00015 <span class="comment">*</span>
<a name="l00016"></a>00016 <span class="comment">* The Original Code is BBC Research and Development code.</span>
<a name="l00017"></a>00017 <span class="comment">*</span>
<a name="l00018"></a>00018 <span class="comment">* The Initial Developer of the Original Code is the British Broadcasting</span>
<a name="l00019"></a>00019 <span class="comment">* Corporation.</span>
<a name="l00020"></a>00020 <span class="comment">* Portions created by the Initial Developer are Copyright (C) 2004.</span>
<a name="l00021"></a>00021 <span class="comment">* All Rights Reserved.</span>
<a name="l00022"></a>00022 <span class="comment">*</span>
<a name="l00023"></a>00023 <span class="comment">* Contributor(s): Andrew Kennedy (Original Author)</span>
<a name="l00024"></a>00024 <span class="comment">*                 Anuradha Suraparaju</span>
<a name="l00025"></a>00025 <span class="comment">*</span>
<a name="l00026"></a>00026 <span class="comment">* Alternatively, the contents of this file may be used under the terms of</span>
<a name="l00027"></a>00027 <span class="comment">* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser</span>
<a name="l00028"></a>00028 <span class="comment">* Public License Version 2.1 (the "LGPL"), in which case the provisions of</span>
<a name="l00029"></a>00029 <span class="comment">* the GPL or the LGPL are applicable instead of those above. If you wish to</span>
<a name="l00030"></a>00030 <span class="comment">* allow use of your version of this file only under the terms of the either</span>
<a name="l00031"></a>00031 <span class="comment">* the GPL or LGPL and not to allow others to use your version of this file</span>
<a name="l00032"></a>00032 <span class="comment">* under the MPL, indicate your decision by deleting the provisions above</span>
<a name="l00033"></a>00033 <span class="comment">* and replace them with the notice and other provisions required by the GPL</span>
<a name="l00034"></a>00034 <span class="comment">* or LGPL. If you do not delete the provisions above, a recipient may use</span>
<a name="l00035"></a>00035 <span class="comment">* your version of this file under the terms of any one of the MPL, the GPL</span>
<a name="l00036"></a>00036 <span class="comment">* or the LGPL.</span>
<a name="l00037"></a>00037 <span class="comment">* ***** END LICENSE BLOCK ***** */</span>
<a name="l00038"></a>00038 
<a name="l00042"></a>00042 <span class="preprocessor">#ifndef parseunit_byteio_h</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define parseunit_byteio_h</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span>
<a name="l00045"></a>00045 <span class="comment">//SYSTEM INLUDES</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &lt;map&gt;</span>                  <span class="comment">// Byte-map</span>
<a name="l00047"></a>00047 <span class="preprocessor">#include &lt;string&gt;</span>               <span class="comment">// stores values</span>
<a name="l00048"></a>00048 
<a name="l00049"></a>00049 <span class="comment">//LOCAL INCLUDES</span>
<a name="l00050"></a>00050 <span class="preprocessor">#include "<a class="code" href="a00168.html">byteio.h</a>"</span>             <span class="comment">// Parent class</span>
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 
<a name="l00053"></a>00053 <span class="keyword">namespace </span>dirac
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055 
<a name="l00056"></a>00056     <span class="comment">/* Types of parse-unit */</span>
<a name="l00057"></a><a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc">00057</a>     <span class="keyword">typedef</span> <span class="keyword">enum</span> {
<a name="l00058"></a><a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc837ca4b31bee93a33fd95992a7583e67">00058</a>         <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc837ca4b31bee93a33fd95992a7583e67">PU_SEQ_HEADER</a>=0,
<a name="l00059"></a><a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afca33fab0d42ec5cca1b69efbcd00e6c25">00059</a>         <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afca33fab0d42ec5cca1b69efbcd00e6c25">PU_PICTURE</a>,
<a name="l00060"></a><a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc2ed33a962dcf586e0dbcbd74ed824a7f">00060</a>         <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc2ed33a962dcf586e0dbcbd74ed824a7f">PU_END_OF_SEQUENCE</a>,
<a name="l00061"></a><a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc829fb549e57a8145e2a24c650a27144b">00061</a>         <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc829fb549e57a8145e2a24c650a27144b">PU_AUXILIARY_DATA</a>,
<a name="l00062"></a><a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc8fb3bb01ad427d4b620a61dacefa3b08">00062</a>         <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc8fb3bb01ad427d4b620a61dacefa3b08">PU_PADDING_DATA</a>,
<a name="l00063"></a><a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc62b5c21009ba7107021e886083dd069c">00063</a>         <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc62b5c21009ba7107021e886083dd069c">PU_CORE_PICTURE</a>,
<a name="l00064"></a><a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afcbf81d206eeb139ee7eb53e789eb5fc86">00064</a>         <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afcbf81d206eeb139ee7eb53e789eb5fc86">PU_LOW_DELAY_PICTURE</a>,
<a name="l00065"></a><a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc11a031670154cbc1a0d8264e80b555f4">00065</a>         <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc11a031670154cbc1a0d8264e80b555f4">PU_UNDEFINED</a>
<a name="l00066"></a>00066     } <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc">ParseUnitType</a>;
<a name="l00067"></a>00067 
<a name="l00072"></a><a class="code" href="a00105.html">00072</a>     <span class="keyword">class </span><a class="code" href="a00105.html" title="Represents a collection of data in a Dirac bytestream that can be parsed as a self-contained...">ParseUnitByteIO</a> : <span class="keyword">public</span> <a class="code" href="a00016.html" title="Class ByteIO - top-level class for reading/writing bytes to a stream.">ByteIO</a>
<a name="l00073"></a>00073     {
<a name="l00074"></a>00074     <span class="keyword">public</span>:
<a name="l00075"></a>00075 
<a name="l00079"></a>00079         <a class="code" href="a00105.html#ff8dd96dab5e2995a66391b195825882" title="Constructor.">ParseUnitByteIO</a>();
<a name="l00080"></a>00080 
<a name="l00085"></a>00085         <a class="code" href="a00105.html#ff8dd96dab5e2995a66391b195825882" title="Constructor.">ParseUnitByteIO</a>(<span class="keyword">const</span> <a class="code" href="a00016.html" title="Class ByteIO - top-level class for reading/writing bytes to a stream.">ByteIO</a>&amp; byte_io);
<a name="l00086"></a>00086 
<a name="l00091"></a>00091         <a class="code" href="a00105.html#ff8dd96dab5e2995a66391b195825882" title="Constructor.">ParseUnitByteIO</a>(<span class="keyword">const</span> <a class="code" href="a00105.html" title="Represents a collection of data in a Dirac bytestream that can be parsed as a self-contained...">ParseUnitByteIO</a>&amp; parseunit_byteio);
<a name="l00092"></a>00092 
<a name="l00096"></a>00096         <a class="code" href="a00105.html#b1cf48da0ed03f1bb547cdb4dc89aba0" title="Destructor.">~ParseUnitByteIO</a>();
<a name="l00097"></a>00097 
<a name="l00102"></a>00102         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00105.html#1f36aeff86b15bbab398c666ea8cc930" title="Gathers byte stats on the parse-unit data.">CollateByteStats</a>(<a class="code" href="a00049.html" title="Class DiracByteStats - for collecting statistics on aspects of the Dirac byte-stream...">DiracByteStats</a>&amp; dirac_byte_stats);
<a name="l00103"></a>00103 
<a name="l00108"></a>00108         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#db71de3fab0a4643d88b3a2101d5d5d8" title="Reads from byte-stream to find parse data.">Input</a>(); <span class="comment">// decoding</span>
<a name="l00109"></a>00109 
<a name="l00113"></a>00113         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#eeab54788e0b18d464316c7c98fa15eb" title="Accesses validity of a unit by comparing it with an adjacent unit.">IsValid</a>();
<a name="l00114"></a>00114 
<a name="l00119"></a>00119         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#6ba17ad78987f08df6da0135a52b18da" title="Can Skip past the entire parse-unit.">CanSkip</a>();
<a name="l00120"></a>00120 
<a name="l00124"></a>00124         <span class="keyword">virtual</span> <span class="keyword">const</span> std::string <a class="code" href="a00105.html#24f54a63d7dd8d65d849664d43c3a88d" title="Gets string containing coded bytes.">GetBytes</a>();   <span class="comment">// encoding</span>
<a name="l00125"></a>00125 
<a name="l00130"></a>00130         <span class="keywordtype">void</span> <a class="code" href="a00105.html#a5dae0bd0014f21d06f68e939859f8c1" title="Set next/previous parse-unit values.">SetAdjacentParseUnits</a>(<a class="code" href="a00105.html" title="Represents a collection of data in a Dirac bytestream that can be parsed as a self-contained...">ParseUnitByteIO</a> *p_prev_parseunit);  <span class="comment">// encoding</span>
<a name="l00131"></a>00131 
<a name="l00132"></a>00132         <span class="comment">/*</span>
<a name="l00133"></a>00133 <span class="comment">        * Gets number of bytes input/output within unit</span>
<a name="l00134"></a>00134 <span class="comment">        */</span>
<a name="l00135"></a>00135         <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a00105.html#95a696f9ad57770fe393c2667c44b3c8" title="Gets size (in bytes).">GetSize</a>() <span class="keyword">const</span>;
<a name="l00136"></a>00136 
<a name="l00140"></a>00140         <span class="keywordtype">int</span> <a class="code" href="a00105.html#45406cef03720a227d411ba8f3311019" title="Gets expected number of bytes to start of next parse-unit.">GetNextParseOffset</a>() <span class="keyword">const</span>;
<a name="l00141"></a>00141 
<a name="l00145"></a>00145         <span class="keywordtype">int</span> <a class="code" href="a00105.html#c57ac69186e9890cc4c8d035418339f8" title="Gets number of bytes to start of previous parse-unit.">GetPreviousParseOffset</a>() <span class="keyword">const</span>;
<a name="l00146"></a>00146 
<a name="l00150"></a>00150         <span class="keyword">virtual</span> <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc">ParseUnitType</a> <a class="code" href="a00105.html#f70dfc609d589ba4cd81d9447c5649a9" title="Gets parse-unit type.">GetType</a>() <span class="keyword">const</span>;
<a name="l00151"></a>00151 
<a name="l00155"></a><a class="code" href="a00105.html#eada73b3cd701abe6aa2002e4ce837b4">00155</a>         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#eada73b3cd701abe6aa2002e4ce837b4" title="Returns true is parse unit is a Sequence Header.">IsSeqHeader</a>()<span class="keyword"> const</span>
<a name="l00156"></a>00156 <span class="keyword">        </span>{ <span class="keywordflow">return</span> <a class="code" href="a00105.html#4ceb2e5ae838f13ad6f07d352dd3283f" title="Parse-type-identifier.">m_parse_code</a>==0x00; }
<a name="l00157"></a>00157 
<a name="l00161"></a><a class="code" href="a00105.html#9fe990935674e607cab72291c3095fa5">00161</a>         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#9fe990935674e607cab72291c3095fa5" title="Returns true is parse unit is an End of Sequence unit.">IsEndOfSequence</a>()<span class="keyword"> const</span>
<a name="l00162"></a>00162 <span class="keyword">        </span>{ <span class="keywordflow">return</span> <a class="code" href="a00105.html#4ceb2e5ae838f13ad6f07d352dd3283f" title="Parse-type-identifier.">m_parse_code</a>==0x10; }
<a name="l00163"></a>00163 
<a name="l00167"></a><a class="code" href="a00105.html#de8efc3d665a902ace4cbb3512eb3b15">00167</a>         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#de8efc3d665a902ace4cbb3512eb3b15" title="Returns true is parse unit is Auxiliary Data.">IsAuxiliaryData</a>()<span class="keyword"> const</span>
<a name="l00168"></a>00168 <span class="keyword">        </span>{ <span class="keywordflow">return</span> (<a class="code" href="a00105.html#4ceb2e5ae838f13ad6f07d352dd3283f" title="Parse-type-identifier.">m_parse_code</a>&amp;0xF8)==0x20; }
<a name="l00169"></a>00169 
<a name="l00173"></a><a class="code" href="a00105.html#31351cec0973ab8eb1bf486719dcd92e">00173</a>         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#31351cec0973ab8eb1bf486719dcd92e" title="Returns true is parse unit is Padding data.">IsPaddingData</a>()<span class="keyword"> const</span>
<a name="l00174"></a>00174 <span class="keyword">        </span>{ <span class="keywordflow">return</span> <a class="code" href="a00105.html#4ceb2e5ae838f13ad6f07d352dd3283f" title="Parse-type-identifier.">m_parse_code</a>==0x30; }
<a name="l00175"></a>00175 
<a name="l00179"></a><a class="code" href="a00105.html#b14750bd735d199159c6566d87bfbda6">00179</a>         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#b14750bd735d199159c6566d87bfbda6" title="Returns true is parse unit is Picture data.">IsPicture</a>()<span class="keyword"> const</span>
<a name="l00180"></a>00180 <span class="keyword">        </span>{ <span class="keywordflow">return</span> ((<a class="code" href="a00105.html#4ceb2e5ae838f13ad6f07d352dd3283f" title="Parse-type-identifier.">m_parse_code</a>&amp;0x08)==0x08); }
<a name="l00181"></a>00181 
<a name="l00185"></a><a class="code" href="a00105.html#1aeb950188f03e3e6cc4fe10c9dba159">00185</a>         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#1aeb950188f03e3e6cc4fe10c9dba159" title="Returns true is parse unit is Low Delay Sybtax unit.">IsLowDelay</a>()<span class="keyword"> const</span>
<a name="l00186"></a>00186 <span class="keyword">        </span>{ <span class="keywordflow">return</span> ((<a class="code" href="a00105.html#4ceb2e5ae838f13ad6f07d352dd3283f" title="Parse-type-identifier.">m_parse_code</a>&amp;0x88)==0x88); }
<a name="l00187"></a>00187 
<a name="l00191"></a><a class="code" href="a00105.html#c5c708ee2adec13df2b794e4acd1bc4e">00191</a>         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#c5c708ee2adec13df2b794e4acd1bc4e" title="Returns true is parse unit is Core syntax unit.">IsCoreSyntax</a>()<span class="keyword"> const</span>
<a name="l00192"></a>00192 <span class="keyword">        </span>{ <span class="keywordflow">return</span> ((<a class="code" href="a00105.html#4ceb2e5ae838f13ad6f07d352dd3283f" title="Parse-type-identifier.">m_parse_code</a>&amp;0x88)==0x08); }
<a name="l00193"></a>00193 
<a name="l00197"></a><a class="code" href="a00105.html#226979034294983033670460138ebd53">00197</a>         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#226979034294983033670460138ebd53" title="Returns true is parse unit uses Arithmetic coding.">IsUsingAC</a>()<span class="keyword"> const</span>
<a name="l00198"></a>00198 <span class="keyword">        </span>{ <span class="keywordflow">return</span> ((<a class="code" href="a00105.html#4ceb2e5ae838f13ad6f07d352dd3283f" title="Parse-type-identifier.">m_parse_code</a>&amp;0x48)==0x08); }
<a name="l00199"></a>00199 
<a name="l00200"></a>00200     <span class="keyword">protected</span>:
<a name="l00201"></a>00201 
<a name="l00206"></a>00206         <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a00105.html#7b8a683b3c129c31ae8d3648ead744a8" title="Calculates number of bytes to start of next unit.">CalcNextUnitOffset</a>();
<a name="l00207"></a>00207 
<a name="l00212"></a><a class="code" href="a00105.html#a41cdb515c2bf889f2d8f56a2cf44768">00212</a>         <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="a00105.html#a41cdb515c2bf889f2d8f56a2cf44768" title="Pure virtual method for calculating parse-code.">CalcParseCode</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> 0;}    <span class="comment">// encoding</span>
<a name="l00213"></a>00213 
<a name="l00218"></a>00218         <span class="keywordtype">bool</span> <a class="code" href="a00105.html#16a96c12acc649141403b72e0e66b738" title="Locates start of parse-unit.">SyncToUnitStart</a>();   <span class="comment">// decoding</span>
<a name="l00219"></a>00219 
<a name="l00223"></a><a class="code" href="a00105.html#6d8fe0975e4934d7b6fa2f27ffba79fc">00223</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="a00105.html#6d8fe0975e4934d7b6fa2f27ffba79fc" title="Get parse code.">GetParseCode</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="a00105.html#4ceb2e5ae838f13ad6f07d352dd3283f" title="Parse-type-identifier.">m_parse_code</a>;}
<a name="l00224"></a>00224 
<a name="l00225"></a>00225     <span class="keyword">private</span>:
<a name="l00226"></a>00226 
<a name="l00230"></a><a class="code" href="a00105.html#04ab4a53d39b397accb30ef467618459">00230</a>         <span class="keywordtype">int</span> <a class="code" href="a00105.html#04ab4a53d39b397accb30ef467618459" title="Number of bytes to next parse-unit.">m_previous_parse_offset</a>;
<a name="l00231"></a>00231 
<a name="l00235"></a><a class="code" href="a00105.html#b5f7431d1e5b1e0102aabf6d7d03ad02">00235</a>         <span class="keywordtype">int</span> <a class="code" href="a00105.html#b5f7431d1e5b1e0102aabf6d7d03ad02" title="Number of bytes to previous parse-unit.">m_next_parse_offset</a>;
<a name="l00236"></a>00236 
<a name="l00240"></a><a class="code" href="a00105.html#4ceb2e5ae838f13ad6f07d352dd3283f">00240</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="a00105.html#4ceb2e5ae838f13ad6f07d352dd3283f" title="Parse-type-identifier.">m_parse_code</a>;
<a name="l00241"></a>00241 
<a name="l00242"></a>00242     };
<a name="l00243"></a>00243 
<a name="l00244"></a>00244 
<a name="l00245"></a>00245 } <span class="comment">// namespace dirac</span>
<a name="l00246"></a>00246 
<a name="l00247"></a>00247 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr>
<p align="center"><small>
&copy; 2004 British Broadcasting Corporation.
Dirac code licensed under the <a href="http://www.mozilla.org/MPL/">Mozilla Public License (MPL) Version 1.1</a>.<br>
HTML documentation generated by Dimitri van Heesch's
excellent <a href="http://www.doxygen.org">Doxygen</a> tool.
</small></p>
</body>
</html>