Sophie

Sophie

distrib > Mandriva > 2010.0 > x86_64 > media > main-release > by-pkgid > f250c16c2b84c9364a2f35a71121aaa2 > files > 270

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>byteio.h</h1><a href="a00168.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: byteio.h,v 1.11 2009/01/21 05:18:09 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 byteio_h</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define byteio_h</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span>
<a name="l00045"></a>00045 <span class="comment">// SYSTEM INCLUDES</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &lt;iostream&gt;</span>             <span class="comment">// IO classes</span>
<a name="l00047"></a>00047 <span class="preprocessor">#include &lt;sstream&gt;</span>              <span class="comment">// IO classes</span>
<a name="l00048"></a>00048 <span class="preprocessor">#include &lt;iomanip&gt;</span>              <span class="comment">// setw</span>
<a name="l00049"></a>00049 <span class="preprocessor">#include &lt;climits&gt;</span>              <span class="comment">// CHAR_BIT</span>
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="comment">//LOCAL INCLUDEs</span>
<a name="l00052"></a>00052 <span class="preprocessor">#include &lt;<a class="code" href="a00179.html">libdirac_byteio/dirac_byte_stats.h</a>&gt;</span>   <span class="comment">// stores stats</span>
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 <span class="keyword">namespace </span>dirac
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056     
<a name="l00057"></a>00057     <span class="comment">// BIT DEFS</span>
<a name="l00058"></a><a class="code" href="a00168.html#fe60fc1318bd5443226a6bd38a12ff4b">00058</a> <span class="preprocessor">    #define BIT_ZERO 0</span>
<a name="l00059"></a><a class="code" href="a00168.html#eead6609dbdc7a87cbcfd85c41ee6f27">00059</a> <span class="preprocessor"></span><span class="preprocessor">    #define BIT_ONE 1</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span>
<a name="l00061"></a>00061     <span class="comment">// most significant bit in a character </span>
<a name="l00062"></a><a class="code" href="a00168.html#a963b8b74c7171092974d2e4948e3b66">00062</a> <span class="preprocessor">    #define MS_BIT                (1 &lt;&lt; (CHAR_BIT - 1))</span>
<a name="l00063"></a>00063 <span class="preprocessor"></span>
<a name="l00064"></a>00064     <span class="comment">/* array index for character containing bit */</span>
<a name="l00065"></a>00065     <span class="comment">//#define BIT_IN_CHAR(bit)      (1 &lt;&lt; (CHAR_BIT-1-bit))</span>
<a name="l00066"></a><a class="code" href="a00168.html#99cc5a998dfeebc3567baec59b4a77a3">00066</a> <span class="preprocessor">    #define BIT_IN_CHAR(bit)      (1 &lt;&lt; bit)</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span> 
<a name="l00068"></a>00068 
<a name="l00072"></a><a class="code" href="a00016.html">00072</a>    <span class="keyword">class </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="l00080"></a>00080        <a class="code" href="a00016.html#ec6f9d7b1502f39e74eba50035402a62" title="Default constructor.">ByteIO</a>(<span class="keywordtype">bool</span> new_stream=<span class="keyword">true</span>);
<a name="l00081"></a>00081 
<a name="l00086"></a>00086        <a class="code" href="a00016.html#ec6f9d7b1502f39e74eba50035402a62" title="Default constructor.">ByteIO</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; stream_data);
<a name="l00087"></a>00087 
<a name="l00091"></a>00091        <span class="keyword">virtual</span> <a class="code" href="a00016.html#c509b1dbbd2d20dfb5ccd6ffd6b0db6f" title="Destructor.">~ByteIO</a>();
<a name="l00092"></a>00092 
<a name="l00097"></a><a class="code" href="a00016.html#92ce0abd65cbfcc16928878477a5178b">00097</a>        <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00016.html#92ce0abd65cbfcc16928878477a5178b" title="Gathers byte-stream statistics.">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="l00098"></a>00098        { dirac_byte_stats.<a class="code" href="a00049.html#becdc0a6af66b7f8d726a8aa414f3517" title="Clears data.">Clear</a>(); }
<a name="l00099"></a>00099 
<a name="l00103"></a>00103         <span class="keyword">virtual</span> <span class="keyword">const</span> std::string <a class="code" href="a00016.html#c6dc5649b47b66bfc1688d93eeec5430" title="Get bytes in Dirac-bytestream format.">GetBytes</a>();
<a name="l00104"></a>00104 
<a name="l00108"></a><a class="code" href="a00016.html#9a4ddcb132317f766eb35b05b198be2f">00108</a>         <span class="keywordtype">int</span> <a class="code" href="a00016.html#9a4ddcb132317f766eb35b05b198be2f" title="Get position of read stream pointer.">GetReadBytePosition</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a>-&gt;tellg();};
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 
<a name="l00114"></a>00114         <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a00016.html#4f8f25a0c300e4df73149d1e44437b11" title="Gets size (in bytes).">GetSize</a>() <span class="keyword">const</span>;
<a name="l00115"></a>00115 
<a name="l00120"></a>00120         <span class="keywordtype">void</span> <a class="code" href="a00016.html#97bcf5e39020155180589d322a9abfb7" title="Copies stream source/destination info.">SetByteParams</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="l00121"></a>00121 
<a name="l00125"></a>00125         <span class="keywordtype">void</span> <a class="code" href="a00016.html#66c2bdd3f07e2509c529aef17f2785fd" title="Sync input for byte-alignment.">ByteAlignOutput</a>();
<a name="l00126"></a>00126 
<a name="l00131"></a>00131         <span class="comment">//void OutputVarLengthUint(const unsigned int&amp; value);</span>
<a name="l00132"></a>00132         <span class="keywordtype">void</span> <a class="code" href="a00016.html#540c5586d4e62cc16ad2e8caac836f15" title="Ouputs an unsigned integer in interleaved exp Golomb format.">WriteUint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> value);
<a name="l00133"></a>00133 
<a name="l00137"></a><a class="code" href="a00016.html#9e24c698603c7402ff35e7846e6351f4">00137</a>          <span class="keywordtype">void</span> <a class="code" href="a00016.html#9e24c698603c7402ff35e7846e6351f4" title="Sets input size in bits.">SetBitsLeft</a>(<span class="keywordtype">int</span> left_bits) { <a class="code" href="a00016.html#107471494a3589b4c9744b052cfdc7eb" title="num bits left to read">m_bits_left</a> = left_bits; }
<a name="l00138"></a>00138 
<a name="l00142"></a><a class="code" href="a00016.html#d1bc447203b8868fe18e4b125a30686c">00142</a>          <span class="keywordtype">int</span> <a class="code" href="a00016.html#d1bc447203b8868fe18e4b125a30686c" title="Sets input size in bits.">BitsLeft</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> <a class="code" href="a00016.html#107471494a3589b4c9744b052cfdc7eb" title="num bits left to read">m_bits_left</a>; }
<a name="l00143"></a>00143 
<a name="l00144"></a>00144     <span class="keyword">protected</span>:
<a name="l00145"></a>00145 
<a name="l00146"></a><a class="code" href="a00016.html#d48276ed9a97dd5b1523770a7b179bb8">00146</a>         <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00016.html#d48276ed9a97dd5b1523770a7b179bb8">CanRead</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span>(!<a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a>-&gt;eof()); }
<a name="l00147"></a>00147 
<a name="l00148"></a><a class="code" href="a00016.html#58a533748a9a6092403338ecebda52d7">00148</a>         <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00016.html#58a533748a9a6092403338ecebda52d7">GetBit</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>&amp; c, <span class="keywordtype">int</span> pos)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (c &amp; <a class="code" href="a00168.html#99cc5a998dfeebc3567baec59b4a77a3">BIT_IN_CHAR</a>(pos)); }
<a name="l00149"></a>00149 
<a name="l00150"></a><a class="code" href="a00016.html#d6e3bb4656d8f0f7c0425089b7ff0b4e">00150</a>         <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="a00016.html#d6e3bb4656d8f0f7c0425089b7ff0b4e">SetBit</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>&amp; c, <span class="keywordtype">int</span> pos)<span class="keyword"> const </span>{ c |= <a class="code" href="a00168.html#99cc5a998dfeebc3567baec59b4a77a3">BIT_IN_CHAR</a>(pos); }
<a name="l00151"></a>00151 
<a name="l00152"></a><a class="code" href="a00016.html#5076eab8b19c9165efba38a18787ea32">00152</a>         <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="a00016.html#5076eab8b19c9165efba38a18787ea32">SetBits</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>&amp; c, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> bits)<span class="keyword"> const </span>{ c |= bits; }
<a name="l00153"></a>00153 
<a name="l00157"></a>00157         <span class="keywordtype">void</span> <a class="code" href="a00016.html#466f9161786ae8850c2456dc7fca8265" title="Sync input for byte-alignment.">ByteAlignInput</a>();
<a name="l00158"></a>00158 
<a name="l00159"></a>00159 
<a name="l00163"></a>00163         <span class="keywordtype">bool</span> <a class="code" href="a00016.html#c7091d45d726fde33178fbcdd154a176" title="Reads boolean value.">ReadBool</a>();
<a name="l00164"></a>00164 
<a name="l00168"></a>00168         <span class="keywordtype">bool</span> <a class="code" href="a00016.html#e3af442f684c2030f7742c655e4597a6" title="Reads boolean value - bounded i/o.">ReadBoolB</a>();
<a name="l00169"></a>00169 
<a name="l00173"></a>00173         <span class="keywordtype">int</span> <a class="code" href="a00016.html#5145781bdbe6b8c8c36d9d639eccd84f" title="Reads next bit.">ReadBit</a>();
<a name="l00174"></a>00174 
<a name="l00178"></a>00178         <span class="keywordtype">int</span> <a class="code" href="a00016.html#7846a39d6f9dafe4756277db914326c7" title="Reads next bit - bounded i/o.">ReadBitB</a>();
<a name="l00179"></a>00179 
<a name="l00185"></a>00185         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="a00016.html#583c98d246f85246ceb938d6909f850c" title="Reads next &amp;#39;count&amp;#39; bits.">ReadNBits</a>(<span class="keywordtype">int</span> count);
<a name="l00186"></a>00186 
<a name="l00192"></a><a class="code" href="a00016.html#dc1a91d01c26030fe4a95d57612b0b6f">00192</a>         <span class="keywordtype">void</span> <a class="code" href="a00016.html#dc1a91d01c26030fe4a95d57612b0b6f" title="Reads from stream.">InputBytes</a>(<span class="keywordtype">char</span>* data, <span class="keywordtype">int</span> count)
<a name="l00193"></a>00193         {
<a name="l00194"></a>00194             <span class="comment">//int j=mp_stream-&gt;tellg();</span>
<a name="l00195"></a>00195             <a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a>-&gt;read(data, count);
<a name="l00196"></a>00196 
<a name="l00197"></a>00197             <span class="comment">//int h=mp_stream-&gt;tellg();</span>
<a name="l00198"></a>00198         }
<a name="l00199"></a>00199 
<a name="l00203"></a>00203         <span class="keywordtype">void</span> <a class="code" href="a00016.html#389efbc28d12b8a2587868e4f9f1a9ce" title="Flushes the bounde input.">FlushInputB</a>();
<a name="l00204"></a>00204 
<a name="l00209"></a>00209         <span class="comment">//int InputVarLengthInt();</span>
<a name="l00210"></a>00210         <span class="keywordtype">int</span> <a class="code" href="a00016.html#9854294a504337c68de44de88bb2c269" title="Reads a signed integer in interleaved exp-Golomb format return Signed integer read...">ReadSint</a>();
<a name="l00211"></a>00211 
<a name="l00216"></a>00216         <span class="keywordtype">int</span> <a class="code" href="a00016.html#9c9fcce79d165aa1e68fb1fa8bdbec5f" title="Reads a signed integer in interleaved exp-Golomb format from bounded input return...">ReadSintB</a>();
<a name="l00217"></a>00217 
<a name="l00222"></a>00222         <span class="comment">//unsigned int InputVarLengthUint();</span>
<a name="l00223"></a>00223         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="a00016.html#ec1b938f3888a508116c85189d09b1d5" title="Reads an unsigned integer in interleaved exp Golomb format.">ReadUint</a>();
<a name="l00224"></a>00224 
<a name="l00229"></a>00229         <span class="comment">//unsigned int InputVarLengthUint();</span>
<a name="l00230"></a>00230         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="a00016.html#3c1e9ccdd249ea155d8ab8814df6656e" title="Reads an unsigned integer in interleaved exp Golomb format from bounded input.">ReadUintB</a>();
<a name="l00231"></a>00231 
<a name="l00237"></a>00237         <span class="comment">//inline unsigned int InputFixedLengthUint(const int byte_size) { </span>
<a name="l00238"></a><a class="code" href="a00016.html#7af5190d77084133723ed478aba8501b">00238</a>         <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="a00016.html#7af5190d77084133723ed478aba8501b" title="Reads a fixed length unsigned integer from the stream in big endian.">ReadUintLit</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> byte_size) { 
<a name="l00239"></a>00239            <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> val=0; 
<a name="l00240"></a>00240            <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i &lt; byte_size; ++i)
<a name="l00241"></a>00241            {
<a name="l00242"></a>00242                val &lt;&lt;= 8;
<a name="l00243"></a>00243                val += (<span class="keywordtype">unsigned</span> char)<a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a>-&gt;get();
<a name="l00244"></a>00244            }
<a name="l00245"></a>00245            <a class="code" href="a00016.html#97d628c7c0231104f6fa384119523935" title="Number of bytes processed.">m_num_bytes</a>+=byte_size;
<a name="l00246"></a>00246            <span class="keywordflow">return</span> val;
<a name="l00247"></a>00247         } 
<a name="l00248"></a>00248 
<a name="l00252"></a><a class="code" href="a00016.html#989126d52ec21cba34f5953cd50902d8">00252</a>         <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="a00016.html#989126d52ec21cba34f5953cd50902d8" title="Reads a byte from the stream.">InputUnByte</a>() {<a class="code" href="a00016.html#97d628c7c0231104f6fa384119523935" title="Number of bytes processed.">m_num_bytes</a>++ ; <span class="keywordflow">return</span> <a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a>-&gt;get(); }
<a name="l00253"></a>00253 
<a name="l00257"></a><a class="code" href="a00016.html#271c375df6d3301d72bd6b8a47db7f0e">00257</a>         <span class="keyword">inline</span> std::string <a class="code" href="a00016.html#271c375df6d3301d72bd6b8a47db7f0e" title="Reads a series of bytes from a stream.">InputUnString</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> count) 
<a name="l00258"></a>00258         {
<a name="l00259"></a>00259             std::string str;
<a name="l00260"></a>00260             <span class="keywordflow">for</span>(<span class="keywordtype">int</span> index=0; index &lt; count; ++index)
<a name="l00261"></a>00261                 str.push_back(<a class="code" href="a00016.html#989126d52ec21cba34f5953cd50902d8" title="Reads a byte from the stream.">InputUnByte</a>());
<a name="l00262"></a>00262             <span class="keywordflow">return</span> str;
<a name="l00263"></a>00263         }
<a name="l00264"></a>00264 
<a name="l00269"></a>00269         <span class="keywordtype">void</span> <a class="code" href="a00016.html#0ac5a730dab2ed232eff97b49055151e" title="Outputs a bit.">WriteBit</a>(<span class="keyword">const</span> <span class="keywordtype">bool</span>&amp; bit);
<a name="l00270"></a>00270 
<a name="l00276"></a>00276         <span class="keywordtype">int</span> <a class="code" href="a00016.html#d28f4baa6032ec38d82bc54951c07356" title="Outputs an unsigned integer.">WriteNBits</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> val);
<a name="l00277"></a>00277 
<a name="l00283"></a>00283         <span class="keywordtype">void</span> <a class="code" href="a00016.html#d28f4baa6032ec38d82bc54951c07356" title="Outputs an unsigned integer.">WriteNBits</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> val, <span class="keywordtype">int</span> count);
<a name="l00284"></a>00284 
<a name="l00285"></a>00285 
<a name="l00286"></a>00286 
<a name="l00290"></a><a class="code" href="a00016.html#ecb00e80507d2d013d33fb2a0cf466aa">00290</a>         <span class="keywordtype">void</span> <a class="code" href="a00016.html#ecb00e80507d2d013d33fb2a0cf466aa" title="Outputs a series of bytes.">OutputBytes</a>(<span class="keyword">const</span> std::string&amp; bytes) {
<a name="l00291"></a>00291            <span class="keywordtype">int</span> cur_pos = <a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a>-&gt;tellg();
<a name="l00292"></a>00292           <a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a>-&gt;str(<a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a>-&gt;str()+bytes);
<a name="l00293"></a>00293            <a class="code" href="a00016.html#97d628c7c0231104f6fa384119523935" title="Number of bytes processed.">m_num_bytes</a>+=bytes.size();
<a name="l00294"></a>00294         <span class="comment">//   *mp_stream &lt;&lt; bytes;</span>
<a name="l00295"></a>00295            <a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a>-&gt;seekg(std::max(cur_pos,0), std::ios_base::beg);
<a name="l00296"></a>00296         }
<a name="l00297"></a>00297 
<a name="l00301"></a><a class="code" href="a00016.html#33993235fd567050240030e248f20939">00301</a>         <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="a00016.html#33993235fd567050240030e248f20939" title="Outputs current byte contents.">OutputCurrentByte</a>()
<a name="l00302"></a>00302         {
<a name="l00303"></a>00303             <span class="keywordflow">if</span> (<a class="code" href="a00016.html#18c019ab837877b04029da7771d6e95e" title="Used to set individual bit within the current header byte.">m_current_pos</a>)
<a name="l00304"></a>00304             {
<a name="l00305"></a>00305                 *<a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a> &lt;&lt; (<a class="code" href="a00016.html#3df0a16d8af48ed48fc3ebd15d2b81de" title="Char used for temporary storage of op data bits.">m_current_byte</a>);
<a name="l00306"></a>00306                 ++<a class="code" href="a00016.html#97d628c7c0231104f6fa384119523935" title="Number of bytes processed.">m_num_bytes</a>;
<a name="l00307"></a>00307                 <a class="code" href="a00016.html#18c019ab837877b04029da7771d6e95e" title="Used to set individual bit within the current header byte.">m_current_pos</a> = 0;
<a name="l00308"></a>00308                 <a class="code" href="a00016.html#3df0a16d8af48ed48fc3ebd15d2b81de" title="Char used for temporary storage of op data bits.">m_current_byte</a> = 0;
<a name="l00309"></a>00309             }
<a name="l00310"></a>00310         };
<a name="l00311"></a>00311 
<a name="l00316"></a>00316        <span class="comment">//void OutputVarLengthInt(const int val);</span>
<a name="l00317"></a>00317        <span class="keywordtype">void</span> <a class="code" href="a00016.html#4c438a84b3bb41584e3108248668ad19" title="Outputs an integer in Golomb signed integer format.">WriteSint</a>(<span class="keywordtype">int</span> val);
<a name="l00318"></a>00318 
<a name="l00324"></a>00324        <span class="comment">//inline void OutputFixedLengthUint(const unsigned int&amp; value, const int&amp; length)</span>
<a name="l00325"></a><a class="code" href="a00016.html#5ab33e6a82d617f64d23289c7ed47491">00325</a>        <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="a00016.html#5ab33e6a82d617f64d23289c7ed47491" title="Output unsigned int value in big endian format.">WriteUintLit</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>&amp; value, <span class="keyword">const</span> <span class="keywordtype">int</span>&amp; length)
<a name="l00326"></a>00326        {
<a name="l00327"></a>00327            <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=length-1; i &gt;=0 ; --i)
<a name="l00328"></a>00328            {
<a name="l00329"></a>00329               <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> cp = (value&gt;&gt;(i*8))&amp;0xff; 
<a name="l00330"></a>00330                *<a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a> &lt;&lt; cp;
<a name="l00331"></a>00331            }
<a name="l00332"></a>00332            <a class="code" href="a00016.html#97d628c7c0231104f6fa384119523935" title="Number of bytes processed.">m_num_bytes</a>+=length;
<a name="l00333"></a>00333        }
<a name="l00334"></a>00334        
<a name="l00339"></a>00339        <span class="keywordtype">void</span> <a class="code" href="a00016.html#155c4c97a602d7d7646bfaae08164625" title="Removes portion of byte-stream no longer required.">RemoveRedundantBytes</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> count);
<a name="l00340"></a>00340 
<a name="l00341"></a><a class="code" href="a00016.html#86e7df2ca2543ae879d5f35bc4915e73">00341</a>        <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="a00016.html#86e7df2ca2543ae879d5f35bc4915e73">SeekGet</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> offset, std::ios_base::seekdir dir) 
<a name="l00342"></a>00342        {
<a name="l00343"></a>00343            <a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a>-&gt;seekg(offset, dir);
<a name="l00344"></a>00344        }
<a name="l00345"></a>00345 
<a name="l00349"></a><a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0">00349</a>        std::stringstream*    <a class="code" href="a00016.html#b172abdf991b8cab7d2b20de666385d0" title="Input/output steam.">mp_stream</a>;
<a name="l00350"></a>00350 
<a name="l00351"></a>00351 
<a name="l00352"></a>00352    <span class="keyword">private</span>:
<a name="l00353"></a>00353        
<a name="l00357"></a><a class="code" href="a00016.html#324130cc8ade9aec0cf733ee3b310fc5">00357</a>        <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="a00002.html">ArithCodecBase</a>;
<a name="l00358"></a>00358 
<a name="l00362"></a><a class="code" href="a00016.html#de6691bce9ce5bb6b270ae86901ef976">00362</a>        <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="a00003.html">ArithCodecToVLCAdapter</a>;
<a name="l00363"></a>00363 
<a name="l00367"></a><a class="code" href="a00016.html#3df0a16d8af48ed48fc3ebd15d2b81de">00367</a>        <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="a00016.html#3df0a16d8af48ed48fc3ebd15d2b81de" title="Char used for temporary storage of op data bits.">m_current_byte</a>;
<a name="l00368"></a>00368             
<a name="l00372"></a><a class="code" href="a00016.html#18c019ab837877b04029da7771d6e95e">00372</a>        <span class="keywordtype">int</span> <a class="code" href="a00016.html#18c019ab837877b04029da7771d6e95e" title="Used to set individual bit within the current header byte.">m_current_pos</a>;
<a name="l00373"></a>00373 
<a name="l00377"></a><a class="code" href="a00016.html#97d628c7c0231104f6fa384119523935">00377</a>        <span class="keywordtype">int</span> <a class="code" href="a00016.html#97d628c7c0231104f6fa384119523935" title="Number of bytes processed.">m_num_bytes</a>;
<a name="l00378"></a>00378        
<a name="l00382"></a><a class="code" href="a00016.html#3c386246cb890c919548f4afc3fb2198">00382</a>        <span class="keywordtype">bool</span> <a class="code" href="a00016.html#3c386246cb890c919548f4afc3fb2198" title="stream alloc flag">m_new_stream</a>;
<a name="l00383"></a>00383         
<a name="l00387"></a><a class="code" href="a00016.html#107471494a3589b4c9744b052cfdc7eb">00387</a>        <span class="keywordtype">int</span> <a class="code" href="a00016.html#107471494a3589b4c9744b052cfdc7eb" title="num bits left to read">m_bits_left</a>;
<a name="l00388"></a>00388    <span class="keyword">protected</span>:
<a name="l00389"></a>00389 
<a name="l00390"></a>00390         
<a name="l00391"></a>00391    };
<a name="l00392"></a>00392 
<a name="l00393"></a>00393 
<a name="l00394"></a>00394 
<a name="l00395"></a>00395 } <span class="comment">// namespace dirac</span>
<a name="l00396"></a>00396 
<a name="l00397"></a>00397 <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>