<!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>band_vlc.h</h1><a href="a00165.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: band_vlc.h,v 1.8 2009/02/09 09:44:56 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): Thomas Davies (Original Author),</span> <a name="l00024"></a>00024 <span class="comment">* Scott R Ladd,</span> <a name="l00025"></a>00025 <span class="comment">* Steve Bearcroft</span> <a name="l00026"></a>00026 <span class="comment">* Andrew Kennedy</span> <a name="l00027"></a>00027 <span class="comment">*</span> <a name="l00028"></a>00028 <span class="comment">* Alternatively, the contents of this file may be used under the terms of</span> <a name="l00029"></a>00029 <span class="comment">* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser</span> <a name="l00030"></a>00030 <span class="comment">* Public License Version 2.1 (the "LGPL"), in which case the provisions of</span> <a name="l00031"></a>00031 <span class="comment">* the GPL or the LGPL are applicable instead of those above. If you wish to</span> <a name="l00032"></a>00032 <span class="comment">* allow use of your version of this file only under the terms of the either</span> <a name="l00033"></a>00033 <span class="comment">* the GPL or LGPL and not to allow others to use your version of this file</span> <a name="l00034"></a>00034 <span class="comment">* under the MPL, indicate your decision by deleting the provisions above</span> <a name="l00035"></a>00035 <span class="comment">* and replace them with the notice and other provisions required by the GPL</span> <a name="l00036"></a>00036 <span class="comment">* or LGPL. If you do not delete the provisions above, a recipient may use</span> <a name="l00037"></a>00037 <span class="comment">* your version of this file under the terms of any one of the MPL, the GPL</span> <a name="l00038"></a>00038 <span class="comment">* or the LGPL.</span> <a name="l00039"></a>00039 <span class="comment">* ***** END LICENSE BLOCK ***** */</span> <a name="l00040"></a>00040 <a name="l00041"></a>00041 <span class="preprocessor">#ifndef _BAND_VLC_H</span> <a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#define _BAND_VLC_H</span> <a name="l00043"></a>00043 <span class="preprocessor"></span> <a name="l00044"></a>00044 <span class="preprocessor">#include <<a class="code" href="a00233.html">libdirac_common/wavelet_utils.h</a>></span> <a name="l00045"></a>00045 <span class="preprocessor">#include <<a class="code" href="a00163.html">libdirac_common/band_codec.h</a>></span> <a name="l00046"></a>00046 <a name="l00047"></a>00047 <a name="l00048"></a>00048 <span class="keyword">namespace </span>dirac <a name="l00049"></a>00049 { <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="keyword">class </span>SubbandByteIO; <a name="l00052"></a>00052 <span class="keyword">class </span>ByteIO; <a name="l00053"></a>00053 <a name="l00055"></a><a class="code" href="a00003.html">00055</a> <span class="keyword">class </span><a class="code" href="a00003.html">ArithCodecToVLCAdapter</a> <a name="l00056"></a>00056 { <a name="l00057"></a>00057 <span class="keyword">public</span>: <a name="l00059"></a>00059 <a class="code" href="a00003.html#4223279554db1f9d5afbc3b487d32080">ArithCodecToVLCAdapter</a>(<a class="code" href="a00141.html" title="Subband Dirac-bytestream input/output.">SubbandByteIO</a>* subband_byteio, <span class="keywordtype">size_t</span> number_of_contexts); <a name="l00060"></a>00060 <a name="l00062"></a><a class="code" href="a00003.html#66efae8257b1d629910d3e132f71b320">00062</a> <span class="keyword">virtual</span> <a class="code" href="a00003.html#66efae8257b1d629910d3e132f71b320">~ArithCodecToVLCAdapter</a>(){} <a name="l00063"></a>00063 <a name="l00064"></a>00064 <span class="comment">/* Compresses the input and returns the number of bits written */</span> <a name="l00065"></a>00065 <span class="keywordtype">int</span> <a class="code" href="a00003.html#dabbbfdd6e84625189933919fe32631a">Compress</a> (<a class="code" href="a00021.html" title="A class for wavelet coefficient data.">CoeffArray</a> &in_data); <a name="l00066"></a>00066 <a name="l00067"></a>00067 <span class="comment">/* Decompresses the bitstream */</span> <a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="a00003.html#9bef936850f05b4dc9790e2fa93b4c48">Decompress</a> (<a class="code" href="a00021.html" title="A class for wavelet coefficient data.">CoeffArray</a>& out_data, <span class="keywordtype">int</span> num_bytes); <a name="l00069"></a>00069 <a name="l00070"></a>00070 <span class="comment">/* Encodes a symbol and writes to the output */</span> <a name="l00071"></a><a class="code" href="a00003.html#91d081b672cdf12d7f1153a66cecaeda">00071</a> <span class="keywordtype">void</span> <a class="code" href="a00003.html#91d081b672cdf12d7f1153a66cecaeda">EncodeSymbol</a>(<span class="keywordtype">bool</span> val, <span class="keywordtype">int</span> <span class="comment">/*context_num*/</span>) <a name="l00072"></a>00072 { <a name="l00073"></a>00073 <a class="code" href="a00003.html#0d20c9a839be66800b060dc47055f086">m_byteio</a>-><a class="code" href="a00016.html#0ac5a730dab2ed232eff97b49055151e" title="Outputs a bit.">WriteBit</a>(val); <a name="l00074"></a>00074 } <a name="l00075"></a>00075 <a name="l00076"></a>00076 <span class="comment">/* Decodes a symbol */</span> <a name="l00077"></a><a class="code" href="a00003.html#674c27f56364a77ca1fb8804e008dbe3">00077</a> <span class="keywordtype">bool</span> <a class="code" href="a00003.html#674c27f56364a77ca1fb8804e008dbe3">DecodeSymbol</a>(<span class="keywordtype">int</span> <span class="comment">/*context_num*/</span>) <a name="l00078"></a>00078 { <a name="l00079"></a>00079 <span class="keywordflow">return</span> <a class="code" href="a00003.html#0d20c9a839be66800b060dc47055f086">m_byteio</a>-><a class="code" href="a00016.html#e3af442f684c2030f7742c655e4597a6" title="Reads boolean value - bounded i/o.">ReadBoolB</a>(); <a name="l00080"></a>00080 } <a name="l00081"></a>00081 <a name="l00083"></a>00083 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00003.html#4cc61486752a07699cf83d20b6144555">DoWorkCode</a>(<a class="code" href="a00021.html" title="A class for wavelet coefficient data.">CoeffArray</a> &in_data) = 0; <a name="l00084"></a>00084 <a name="l00086"></a>00086 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00003.html#843b412a79dd58a5ce7f712538003783">DoWorkDecode</a>(<a class="code" href="a00021.html" title="A class for wavelet coefficient data.">CoeffArray</a> &out_data) = 0; <a name="l00087"></a>00087 <a name="l00088"></a>00088 <span class="keyword">protected</span>: <a name="l00090"></a><a class="code" href="a00003.html#0d20c9a839be66800b060dc47055f086">00090</a> <a class="code" href="a00016.html" title="Class ByteIO - top-level class for reading/writing bytes to a stream.">ByteIO</a> *<a class="code" href="a00003.html#0d20c9a839be66800b060dc47055f086">m_byteio</a>; <a name="l00091"></a>00091 <a name="l00092"></a>00092 <span class="keyword">private</span>: <a name="l00094"></a>00094 <a class="code" href="a00003.html#4223279554db1f9d5afbc3b487d32080">ArithCodecToVLCAdapter</a>(<span class="keyword">const</span> <a class="code" href="a00003.html">ArithCodecToVLCAdapter</a>& cpy); <a name="l00096"></a>00096 <a class="code" href="a00003.html">ArithCodecToVLCAdapter</a>& <a class="code" href="a00003.html#6ec7955850794b60c76ee821541965d5" title="Private, bodyless copy operator=: class should not be assigned.">operator=</a>(<span class="keyword">const</span> <a class="code" href="a00003.html">ArithCodecToVLCAdapter</a>& rhs); <a name="l00097"></a>00097 }; <a name="l00098"></a>00098 <a name="l00099"></a>00099 <a name="l00101"></a>00101 <a name="l00104"></a><a class="code" href="a00234.html#4bd9b7a041afdefe41ae2afeaf8535fe">00104</a> <span class="keyword">typedef</span> <a class="code" href="a00074.html">GenericBandCodec<ArithCodecToVLCAdapter></a> <a class="code" href="a00074.html">BandVLC</a>; <a name="l00105"></a>00105 <a name="l00107"></a>00107 <span class="comment">//Finally,special class incorporating prediction for the DC band of intra frames//</span> <a name="l00109"></a>00109 <span class="comment"></span> <a name="l00111"></a>00111 <a name="l00115"></a><a class="code" href="a00080.html">00115</a> <span class="keyword">class </span><a class="code" href="a00080.html" title="A class specially for coding the DC subband of Intra frames.">IntraDCBandVLC</a>: <span class="keyword">public</span> <a class="code" href="a00075.html" title="A template class specially for coding the DC subband of Intra frames.">GenericIntraDCBandCodec</a><ArithCodecToVLCAdapter> <a name="l00116"></a>00116 { <a name="l00117"></a>00117 <span class="keyword">public</span>: <a name="l00119"></a>00119 <a name="l00124"></a>00124 <a class="code" href="a00080.html#101c4e10097da210ce5567ebbdd81503" title="Constructor.">IntraDCBandVLC</a>(<a class="code" href="a00141.html" title="Subband Dirac-bytestream input/output.">SubbandByteIO</a>* subband_byteio, <a name="l00125"></a>00125 <span class="keyword">const</span> <a class="code" href="a00142.html" title="A class encapulating all the subbands produced by a transform.">SubbandList</a>& band_list); <a name="l00126"></a>00126 <span class="keyword">private</span>: <a name="l00128"></a>00128 <span class="keywordtype">void</span> <a class="code" href="a00080.html#03cf887d209572cc51bdf395ca2f5044" title="Encode a single coefficient using error-feedback DC quantization.">CodeCoeff</a>(<a class="code" href="a00021.html" title="A class for wavelet coefficient data.">CoeffArray</a>& in_data, <span class="keyword">const</span> <span class="keywordtype">int</span> xpos, <span class="keyword">const</span> <span class="keywordtype">int</span> ypos); <a name="l00129"></a>00129 <a name="l00130"></a>00130 <span class="keyword">private</span>: <a name="l00132"></a>00132 <a class="code" href="a00080.html#101c4e10097da210ce5567ebbdd81503" title="Constructor.">IntraDCBandVLC</a> (<span class="keyword">const</span> <a class="code" href="a00080.html" title="A class specially for coding the DC subband of Intra frames.">IntraDCBandVLC</a>& cpy); <a name="l00133"></a>00133 <a name="l00135"></a>00135 <a class="code" href="a00080.html" title="A class specially for coding the DC subband of Intra frames.">IntraDCBandVLC</a>& <a class="code" href="a00080.html#a57afa67ebd578a4556ae354019d3a64" title="Private, bodyless copy operator=: class should not be assigned.">operator=</a>(<span class="keyword">const</span> <a class="code" href="a00080.html" title="A class specially for coding the DC subband of Intra frames.">IntraDCBandVLC</a>& rhs); <a name="l00136"></a>00136 }; <a name="l00137"></a>00137 <a name="l00138"></a>00138 <a name="l00139"></a>00139 }<span class="comment">// end namespace dirac</span> <a name="l00140"></a>00140 <span class="preprocessor">#endif</span> </pre></div></div> <hr> <p align="center"><small> © 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>