~ubuntu-branches/ubuntu/trusty/bmagic/trusty-proposed

« back to all changes in this revision

Viewing changes to doc/html/a00091_source.html

  • Committer: Bazaar Package Importer
  • Author(s): Roberto C. Sanchez
  • Date: 2009-12-09 16:02:55 UTC
  • mfrom: (4.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20091209160255-hu2bnjrbncl92z5w
Tags: 3.6.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
2
<html xmlns="http://www.w3.org/1999/xhtml">
 
3
<head>
 
4
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
 
5
<title>BitMagic: bmgamma.h Source File</title>
 
6
<link href="tabs.css" rel="stylesheet" type="text/css"/>
 
7
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
 
8
</head>
 
9
<body>
 
10
<!-- Generated by Doxygen 1.6.1 -->
 
11
<div class="navigation" id="top">
 
12
  <div class="tabs">
 
13
    <ul>
 
14
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
 
15
      <li><a href="modules.html"><span>Modules</span></a></li>
 
16
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
 
17
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
 
18
      <li class="current"><a href="files.html"><span>Files</span></a></li>
 
19
      <li><a href="examples.html"><span>Examples</span></a></li>
 
20
    </ul>
 
21
  </div>
 
22
  <div class="tabs">
 
23
    <ul>
 
24
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
 
25
      <li><a href="globals.html"><span>Globals</span></a></li>
 
26
    </ul>
 
27
  </div>
 
28
<h1>bmgamma.h</h1><a href="a00091.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
 
29
<a name="l00002"></a>00002 <span class="comment">Copyright(c) 2002-2009 Anatoliy Kuznetsov(anatoliy_kuznetsov at yahoo.com)</span>
 
30
<a name="l00003"></a>00003 <span class="comment"></span>
 
31
<a name="l00004"></a>00004 <span class="comment">Permission is hereby granted, free of charge, to any person </span>
 
32
<a name="l00005"></a>00005 <span class="comment">obtaining a copy of this software and associated documentation </span>
 
33
<a name="l00006"></a>00006 <span class="comment">files (the &quot;Software&quot;), to deal in the Software without restriction, </span>
 
34
<a name="l00007"></a>00007 <span class="comment">including without limitation the rights to use, copy, modify, merge, </span>
 
35
<a name="l00008"></a>00008 <span class="comment">publish, distribute, sublicense, and/or sell copies of the Software, </span>
 
36
<a name="l00009"></a>00009 <span class="comment">and to permit persons to whom the Software is furnished to do so, </span>
 
37
<a name="l00010"></a>00010 <span class="comment">subject to the following conditions:</span>
 
38
<a name="l00011"></a>00011 <span class="comment"></span>
 
39
<a name="l00012"></a>00012 <span class="comment">The above copyright notice and this permission notice shall be included </span>
 
40
<a name="l00013"></a>00013 <span class="comment">in all copies or substantial portions of the Software.</span>
 
41
<a name="l00014"></a>00014 <span class="comment"></span>
 
42
<a name="l00015"></a>00015 <span class="comment">THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, </span>
 
43
<a name="l00016"></a>00016 <span class="comment">EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES </span>
 
44
<a name="l00017"></a>00017 <span class="comment">OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. </span>
 
45
<a name="l00018"></a>00018 <span class="comment">IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, </span>
 
46
<a name="l00019"></a>00019 <span class="comment">DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, </span>
 
47
<a name="l00020"></a>00020 <span class="comment">ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR </span>
 
48
<a name="l00021"></a>00021 <span class="comment">OTHER DEALINGS IN THE SOFTWARE.</span>
 
49
<a name="l00022"></a>00022 <span class="comment"></span>
 
50
<a name="l00023"></a>00023 <span class="comment">For more information please visit:  http://bmagic.sourceforge.net</span>
 
51
<a name="l00024"></a>00024 <span class="comment"></span>
 
52
<a name="l00025"></a>00025 <span class="comment">*/</span>
 
53
<a name="l00026"></a>00026 
 
54
<a name="l00027"></a>00027 <span class="preprocessor">#ifndef BMGAMMAENC__H__INCLUDED__</span>
 
55
<a name="l00028"></a>00028 <span class="preprocessor"></span><span class="preprocessor">#define BMGAMMAENC__H__INCLUDED__</span>
 
56
<a name="l00029"></a>00029 <span class="preprocessor"></span>
 
57
<a name="l00030"></a>00030 
 
58
<a name="l00031"></a>00031 <span class="keyword">namespace </span>bm
 
59
<a name="l00032"></a>00032 {
 
60
<a name="l00033"></a>00033 
 
61
<a name="l00034"></a>00034 <span class="comment"></span>
 
62
<a name="l00035"></a>00035 <span class="comment">/**</span>
 
63
<a name="l00036"></a>00036 <span class="comment">    Elias Gamma decoder</span>
 
64
<a name="l00037"></a>00037 <span class="comment">*/</span>
 
65
<a name="l00038"></a>00038 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> TBitIO&gt;
 
66
<a name="l00039"></a>00039 <span class="keyword">class </span>gamma_decoder
 
67
<a name="l00040"></a>00040 {
 
68
<a name="l00041"></a>00041 <span class="keyword">public</span>:
 
69
<a name="l00042"></a><a class="code" href="a00064.html#af60ec7612ed672274332c3e2ad957dbb">00042</a>     <a class="code" href="a00064.html#af60ec7612ed672274332c3e2ad957dbb">gamma_decoder</a>(TBitIO&amp; bin) : bin_(bin) 
 
70
<a name="l00043"></a>00043     {}
 
71
<a name="l00044"></a>00044     <span class="comment"></span>
 
72
<a name="l00045"></a>00045 <span class="comment">    /**</span>
 
73
<a name="l00046"></a>00046 <span class="comment">        Start encoding sequence</span>
 
74
<a name="l00047"></a>00047 <span class="comment">    */</span>
 
75
<a name="l00048"></a><a class="code" href="a00064.html#a2664246d51693ed9b42d90781b9f99dd">00048</a>     <span class="keywordtype">void</span> <a class="code" href="a00064.html#a2664246d51693ed9b42d90781b9f99dd" title="Start encoding sequence.">start</a>()
 
76
<a name="l00049"></a>00049     {}
 
77
<a name="l00050"></a>00050     <span class="comment"></span>
 
78
<a name="l00051"></a>00051 <span class="comment">    /**</span>
 
79
<a name="l00052"></a>00052 <span class="comment">        Stop decoding sequence</span>
 
80
<a name="l00053"></a>00053 <span class="comment">    */</span>
 
81
<a name="l00054"></a><a class="code" href="a00064.html#a14e761fa781cc3cb738a5485baad7c88">00054</a>     <span class="keywordtype">void</span> <a class="code" href="a00064.html#a14e761fa781cc3cb738a5485baad7c88" title="Stop decoding sequence.">stop</a>()
 
82
<a name="l00055"></a>00055     {}
 
83
<a name="l00056"></a>00056     <span class="comment"></span>
 
84
<a name="l00057"></a>00057 <span class="comment">    /**</span>
 
85
<a name="l00058"></a>00058 <span class="comment">        Decode word</span>
 
86
<a name="l00059"></a>00059 <span class="comment">    */</span>
 
87
<a name="l00060"></a><a class="code" href="a00064.html#adcc43680aa92a036bce01b60accbe419">00060</a>     T <a class="code" href="a00064.html#adcc43680aa92a036bce01b60accbe419" title="Decode word.">operator()</a>(<span class="keywordtype">void</span>)
 
88
<a name="l00061"></a>00061     {
 
89
<a name="l00062"></a>00062         <span class="keywordtype">unsigned</span> l = bin_.eat_zero_bits();
 
90
<a name="l00063"></a>00063         bin_.get_bit(); <span class="comment">// get border bit</span>
 
91
<a name="l00064"></a>00064         T current = 0;
 
92
<a name="l00065"></a>00065         <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; l; ++i)
 
93
<a name="l00066"></a>00066         {
 
94
<a name="l00067"></a>00067             <span class="keywordflow">if</span> (bin_.get_bit())
 
95
<a name="l00068"></a>00068             {
 
96
<a name="l00069"></a>00069                 current += 1 &lt;&lt; i;
 
97
<a name="l00070"></a>00070             }
 
98
<a name="l00071"></a>00071         }
 
99
<a name="l00072"></a>00072         current |= (1 &lt;&lt; l);
 
100
<a name="l00073"></a>00073         <span class="keywordflow">return</span> current;
 
101
<a name="l00074"></a>00074     }
 
102
<a name="l00075"></a>00075 <span class="keyword">private</span>:
 
103
<a name="l00076"></a>00076     <a class="code" href="a00064.html#af60ec7612ed672274332c3e2ad957dbb">gamma_decoder</a>(<span class="keyword">const</span> <a class="code" href="a00064.html" title="Elias Gamma decoder.">gamma_decoder</a>&amp;);
 
104
<a name="l00077"></a>00077     <a class="code" href="a00064.html" title="Elias Gamma decoder.">gamma_decoder</a>&amp; operator=(<span class="keyword">const</span> <a class="code" href="a00064.html" title="Elias Gamma decoder.">gamma_decoder</a>&amp;);
 
105
<a name="l00078"></a>00078 <span class="keyword">private</span>:
 
106
<a name="l00079"></a>00079     TBitIO&amp;  bin_;
 
107
<a name="l00080"></a>00080 };
 
108
<a name="l00081"></a>00081 
 
109
<a name="l00082"></a>00082 
 
110
<a name="l00083"></a>00083 
 
111
<a name="l00084"></a>00084 } <span class="comment">// bm</span>
 
112
<a name="l00085"></a>00085 
 
113
<a name="l00086"></a>00086 <span class="preprocessor">#endif</span>
 
114
<a name="l00087"></a>00087 <span class="preprocessor"></span>
 
115
</pre></div></div>
 
116
<hr size="1"/><address style="text-align: right;"><small>Generated on Sun Nov 22 10:49:35 2009 for BitMagic by&nbsp;
 
117
<a href="http://www.doxygen.org/index.html">
 
118
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
 
119
</body>
 
120
</html>