root/doc/html/convcode_8h-source.html @ 353

Revision 353, 40.8 kB (checked in by smidl, 16 years ago)

doc

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: convcode.h Source File</title>
4<link href="tabs.css" rel="stylesheet" type="text/css">
5<link href="doxygen.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.8 -->
8<script type="text/javascript">
9<!--
10function changeDisplayState (e){
11  var num=this.id.replace(/[^[0-9]/g,'');
12  var button=this.firstChild;
13  var sectionDiv=document.getElementById('dynsection'+num);
14  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
15    sectionDiv.style.display='block';
16    button.src='open.gif';
17  }else{
18    sectionDiv.style.display='none';
19    button.src='closed.gif';
20  }
21}
22function initDynSections(){
23  var divs=document.getElementsByTagName('div');
24  var sectionCounter=1;
25  for(var i=0;i<divs.length-1;i++){
26    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
27      var header=divs[i];
28      var section=divs[i+1];
29      var button=header.firstChild;
30      if (button!='IMG'){
31        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
32        button=document.createElement('img');
33        divs[i].insertBefore(button,divs[i].firstChild);
34      }
35      header.style.cursor='pointer';
36      header.onclick=changeDisplayState;
37      header.id='dynheader'+sectionCounter;
38      button.src='closed.gif';
39      section.id='dynsection'+sectionCounter;
40      section.style.display='none';
41      section.style.marginLeft='14px';
42      sectionCounter++;
43    }
44  }
45}
46window.onload = initDynSections;
47-->
48</script>
49<div class="navigation" id="top">
50  <div class="tabs">
51    <ul>
52      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
53      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
54      <li><a href="modules.html"><span>Modules</span></a></li>
55      <li><a href="annotated.html"><span>Classes</span></a></li>
56      <li class="current"><a href="files.html"><span>Files</span></a></li>
57    </ul>
58  </div>
59  <div class="tabs">
60    <ul>
61      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
62      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
63    </ul>
64  </div>
65<h1>convcode.h</h1><a href="convcode_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
66<a name="l00029"></a>00029 <span class="preprocessor">#ifndef CONVCODE_H</span>
67<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define CONVCODE_H</span>
68<a name="l00031"></a>00031 <span class="preprocessor"></span>
69<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;<a class="code" href="vec_8h.html" title="Templated Vector Class Definitions.">itpp/base/vec.h</a>&gt;</span>
70<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;<a class="code" href="mat_8h.html" title="Matrix Class Definitions.">itpp/base/mat.h</a>&gt;</span>
71<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;<a class="code" href="array_8h.html" title="Definition of Array class (container).">itpp/base/array.h</a>&gt;</span>
72<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;<a class="code" href="binary_8h.html" title="Binary class definition.">itpp/base/binary.h</a>&gt;</span>
73<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;<a class="code" href="channel__code_8h.html" title="Channel Code class virtual interface.">itpp/comm/channel_code.h</a>&gt;</span>
74<a name="l00037"></a>00037
75<a name="l00038"></a>00038
76<a name="l00039"></a>00039 <span class="keyword">namespace </span>itpp
77<a name="l00040"></a>00040 {
78<a name="l00041"></a>00041
79<a name="l00046"></a><a class="code" href="group__fec.html#ge9651aa649deec69310af24cd89b8729">00046</a> <span class="keyword">enum</span> <a class="code" href="group__fec.html#ge9651aa649deec69310af24cd89b8729" title="Type of Convolutional Code.">CONVOLUTIONAL_CODE_TYPE</a> {MFD, ODS};
80<a name="l00047"></a>00047
81<a name="l00052"></a><a class="code" href="group__fec.html#ge22fe2744a6f00b512ee75e304d72a82">00052</a> <span class="keyword">enum</span> <a class="code" href="group__fec.html#ge22fe2744a6f00b512ee75e304d72a82" title="Encoding and decoding methods for Convolutional codes.">CONVOLUTIONAL_CODE_METHOD</a> {Trunc, Tail, Tailbite};
82<a name="l00053"></a>00053
83<a name="l00102"></a><a class="code" href="classitpp_1_1Convolutional__Code.html">00102</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1Convolutional__Code.html" title="Binary Convolutional rate 1/n class.">Convolutional_Code</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1Channel__Code.html" title="Generic Channel Code class.">Channel_Code</a>
84<a name="l00103"></a>00103 {
85<a name="l00104"></a>00104 <span class="keyword">public</span>:
86<a name="l00106"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#7fa593431fe01986a69247a493d88bae">00106</a>   <a class="code" href="classitpp_1_1Convolutional__Code.html#7fa593431fe01986a69247a493d88bae" title="Default constructor - sets (0133,0171) code with tail.">Convolutional_Code</a>(<span class="keywordtype">void</span>): <a class="code" href="classitpp_1_1Convolutional__Code.html#63430f36f9dc2c9d78b9a0ce145a8f2d" title="Constraint length.">K</a>(0), <a class="code" href="classitpp_1_1Convolutional__Code.html#7bfc69c7f70316fe051e2802c9f09ee3" title="The encoder start state.">start_state</a>(0), <a class="code" href="classitpp_1_1Convolutional__Code.html#df24ee075bc58e4b277c44cfd146d84b" title="encoding and decoding method">cc_method</a>(Tail) {
87<a name="l00107"></a>00107     <a class="code" href="classitpp_1_1Convolutional__Code.html#9860c6e22e6f7a58c020534045a432d0" title="Set the code according to built-in tables.">set_code</a>(MFD, 2, 7);
88<a name="l00108"></a>00108     <a class="code" href="classitpp_1_1Convolutional__Code.html#9ef6fc1934531d3c12123ed90c5b4c40" title="Initialise internal encoder state with start state. Has no effect on Tail and Tailbite...">init_encoder</a>();
89<a name="l00109"></a>00109   }
90<a name="l00110"></a>00110
91<a name="l00112"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#7e2a367b256e504f8c229afa677d8d23">00112</a>   <span class="keyword">virtual</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#7e2a367b256e504f8c229afa677d8d23" title="Destructor.">~Convolutional_Code</a>(<span class="keywordtype">void</span>) {}
92<a name="l00113"></a>00113
93<a name="l00115"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#1c49283f24dddf4e8cee2835f9d26afe">00115</a>   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#1c49283f24dddf4e8cee2835f9d26afe" title="Set encoding and decoding method (Trunc, Tail, or Tailbite).">set_method</a>(<span class="keyword">const</span> <a class="code" href="group__fec.html#ge22fe2744a6f00b512ee75e304d72a82" title="Encoding and decoding methods for Convolutional codes.">CONVOLUTIONAL_CODE_METHOD</a> method) {
94<a name="l00116"></a>00116     <a class="code" href="classitpp_1_1Convolutional__Code.html#df24ee075bc58e4b277c44cfd146d84b" title="encoding and decoding method">cc_method</a> = method;
95<a name="l00117"></a>00117   }
96<a name="l00118"></a>00118
97<a name="l00126"></a>00126   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#9860c6e22e6f7a58c020534045a432d0" title="Set the code according to built-in tables.">set_code</a>(<span class="keyword">const</span> <a class="code" href="group__fec.html#ge9651aa649deec69310af24cd89b8729" title="Type of Convolutional Code.">CONVOLUTIONAL_CODE_TYPE</a> type_of_code, <span class="keywordtype">int</span> inverse_rate,
98<a name="l00127"></a>00127                 <span class="keywordtype">int</span> constraint_length);
99<a name="l00128"></a>00128
100<a name="l00130"></a>00130   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#b8ca18ab14b3b6a1e1a1132f0386c84f" title="Set generator polynomials. Given in Proakis integer form.">set_generator_polynomials</a>(<span class="keyword">const</span> ivec &amp;gen, <span class="keywordtype">int</span> constraint_length);
101<a name="l00132"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#342e071696583197507b85fb45146bc6">00132</a>   ivec <a class="code" href="classitpp_1_1Convolutional__Code.html#342e071696583197507b85fb45146bc6" title="Get generator polynomials.">get_generator_polynomials</a>(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#e5b54f1bab039f8480c7ae0013f3f5fe" title="Generator polynomials.">gen_pol</a>; }
102<a name="l00133"></a>00133
103<a name="l00135"></a>00135   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#6ac83f0a1be7b4f6f06a1b4d7b45489a" title="Reset encoder and decoder states.">reset</a>();
104<a name="l00136"></a>00136
105<a name="l00137"></a>00137
106<a name="l00139"></a>00139
107<a name="l00140"></a>00140   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#f9d5354b5ea7f2a090a488b383e995ef" title="Encode an input binary vector using specified method (Tail by default).">encode</a>(<span class="keyword">const</span> bvec &amp;input, bvec &amp;output);
108<a name="l00141"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#fbed8d23cbffca2d0802234592b034b4">00141</a>   <span class="keyword">virtual</span> bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#fbed8d23cbffca2d0802234592b034b4" title="Encode a bvec of input.">encode</a>(<span class="keyword">const</span> bvec &amp;input) {
109<a name="l00142"></a>00142     bvec output;
110<a name="l00143"></a>00143     <a class="code" href="classitpp_1_1Convolutional__Code.html#f9d5354b5ea7f2a090a488b383e995ef" title="Encode an input binary vector using specified method (Tail by default).">encode</a>(input, output);
111<a name="l00144"></a>00144     <span class="keywordflow">return</span> output;
112<a name="l00145"></a>00145   }
113<a name="l00147"></a>00147
114<a name="l00149"></a>00149
115<a name="l00155"></a>00155   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#b2acc3b632782ff035fa1b5b2b122153" title="Encode a binary vector starting from the previous encoder state.">encode_trunc</a>(<span class="keyword">const</span> bvec &amp;input, bvec &amp;output);
116<a name="l00156"></a>00156   bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#b2acc3b632782ff035fa1b5b2b122153" title="Encode a binary vector starting from the previous encoder state.">encode_trunc</a>(<span class="keyword">const</span> bvec &amp;input) {
117<a name="l00157"></a>00157     bvec output;
118<a name="l00158"></a>00158     <a class="code" href="classitpp_1_1Convolutional__Code.html#b2acc3b632782ff035fa1b5b2b122153" title="Encode a binary vector starting from the previous encoder state.">encode_trunc</a>(input, output);
119<a name="l00159"></a>00159     <span class="keywordflow">return</span> output;
120<a name="l00160"></a>00160   }
121<a name="l00162"></a>00162
122<a name="l00164"></a>00164
123<a name="l00174"></a>00174   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#47230acfea5aa32cb31e63abca1d222e" title="Encoding that starts and ends in the zero state.">encode_tail</a>(<span class="keyword">const</span> bvec &amp;input, bvec &amp;output);
124<a name="l00175"></a>00175   bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#47230acfea5aa32cb31e63abca1d222e" title="Encoding that starts and ends in the zero state.">encode_tail</a>(<span class="keyword">const</span> bvec &amp;input) {
125<a name="l00176"></a>00176     bvec output;
126<a name="l00177"></a>00177     <a class="code" href="classitpp_1_1Convolutional__Code.html#47230acfea5aa32cb31e63abca1d222e" title="Encoding that starts and ends in the zero state.">encode_tail</a>(input, output);
127<a name="l00178"></a>00178     <span class="keywordflow">return</span> output;
128<a name="l00179"></a>00179   }
129<a name="l00181"></a>00181
130<a name="l00183"></a>00183
131<a name="l00197"></a>00197   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#34e2691d01bc0b35d81f109f27bedfa2" title="Encode an input binary vector using tailbiting.">encode_tailbite</a>(<span class="keyword">const</span> bvec &amp;input, bvec &amp;output);
132<a name="l00198"></a>00198   bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#34e2691d01bc0b35d81f109f27bedfa2" title="Encode an input binary vector using tailbiting.">encode_tailbite</a>(<span class="keyword">const</span> bvec &amp;input) {
133<a name="l00199"></a>00199     bvec output;
134<a name="l00200"></a>00200     <a class="code" href="classitpp_1_1Convolutional__Code.html#34e2691d01bc0b35d81f109f27bedfa2" title="Encode an input binary vector using tailbiting.">encode_tailbite</a>(input, output);
135<a name="l00201"></a>00201     <span class="keywordflow">return</span> output;
136<a name="l00202"></a>00202   }
137<a name="l00204"></a>00204
138<a name="l00206"></a>00206
139<a name="l00211"></a>00211   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#a6884e3f60678177fbf60e22d2447a5b" title="Encode a binary bit starting from the internal encoder state.">encode_bit</a>(<span class="keyword">const</span> bin &amp;input, bvec &amp;output);
140<a name="l00212"></a>00212   bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#a6884e3f60678177fbf60e22d2447a5b" title="Encode a binary bit starting from the internal encoder state.">encode_bit</a>(<span class="keyword">const</span> bin &amp;input) {
141<a name="l00213"></a>00213     bvec output;
142<a name="l00214"></a>00214     <a class="code" href="classitpp_1_1Convolutional__Code.html#a6884e3f60678177fbf60e22d2447a5b" title="Encode a binary bit starting from the internal encoder state.">encode_bit</a>(input, output);
143<a name="l00215"></a>00215     <span class="keywordflow">return</span> output;
144<a name="l00216"></a>00216   }
145<a name="l00218"></a>00218
146<a name="l00219"></a>00219   <span class="comment">// ------------ Hard-decision decoding is not implemented ----------------</span>
147<a name="l00220"></a>00220   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#f3bf2206a471342563a4080e42d6b435" title="Decode a bvec of coded data.">decode</a>(<span class="keyword">const</span> bvec &amp;coded_bits, bvec &amp;decoded_bits);
148<a name="l00221"></a>00221   <span class="keyword">virtual</span> bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#f3bf2206a471342563a4080e42d6b435" title="Decode a bvec of coded data.">decode</a>(<span class="keyword">const</span> bvec &amp;coded_bits);
149<a name="l00222"></a>00222
150<a name="l00224"></a>00224
151<a name="l00225"></a>00225   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#f3bf2206a471342563a4080e42d6b435" title="Decode a bvec of coded data.">decode</a>(<span class="keyword">const</span> vec &amp;received_signal, bvec &amp;output);
152<a name="l00226"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#fbeada8e8cbeccdababfb26658faa02a">00226</a>   <span class="keyword">virtual</span> bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#fbeada8e8cbeccdababfb26658faa02a" title="Decode a vec of received data.">decode</a>(<span class="keyword">const</span> vec &amp;received_signal) {
153<a name="l00227"></a>00227     bvec output;
154<a name="l00228"></a>00228     <a class="code" href="classitpp_1_1Convolutional__Code.html#f3bf2206a471342563a4080e42d6b435" title="Decode a bvec of coded data.">decode</a>(received_signal, output);
155<a name="l00229"></a>00229     <span class="keywordflow">return</span> output;
156<a name="l00230"></a>00230   }
157<a name="l00232"></a>00232
158<a name="l00234"></a>00234
159<a name="l00240"></a>00240   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#9f42d8c8bdb51460ebc7d43deb93bad7" title="Decode a block of encoded data where encode_tail has been used.">decode_tail</a>(<span class="keyword">const</span> vec &amp;received_signal, bvec &amp;output);
160<a name="l00241"></a>00241   <span class="keyword">virtual</span> bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#9f42d8c8bdb51460ebc7d43deb93bad7" title="Decode a block of encoded data where encode_tail has been used.">decode_tail</a>(<span class="keyword">const</span> vec &amp;received_signal) {
161<a name="l00242"></a>00242     bvec output;
162<a name="l00243"></a>00243     <a class="code" href="classitpp_1_1Convolutional__Code.html#9f42d8c8bdb51460ebc7d43deb93bad7" title="Decode a block of encoded data where encode_tail has been used.">decode_tail</a>(received_signal, output);
163<a name="l00244"></a>00244     <span class="keywordflow">return</span> output;
164<a name="l00245"></a>00245   }
165<a name="l00247"></a>00247
166<a name="l00249"></a>00249
167<a name="l00257"></a>00257   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#94f2b7f77dc08fc0fb975735762be742" title="Decode a block of encoded data where encode_tailbite has been used.">decode_tailbite</a>(<span class="keyword">const</span> vec &amp;received_signal, bvec &amp;output);
168<a name="l00258"></a>00258   <span class="keyword">virtual</span> bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#94f2b7f77dc08fc0fb975735762be742" title="Decode a block of encoded data where encode_tailbite has been used.">decode_tailbite</a>(<span class="keyword">const</span> vec &amp;received_signal) {
169<a name="l00259"></a>00259     bvec output;
170<a name="l00260"></a>00260     <a class="code" href="classitpp_1_1Convolutional__Code.html#94f2b7f77dc08fc0fb975735762be742" title="Decode a block of encoded data where encode_tailbite has been used.">decode_tailbite</a>(received_signal, output);
171<a name="l00261"></a>00261     <span class="keywordflow">return</span> output;
172<a name="l00262"></a>00262   }
173<a name="l00264"></a>00264
174<a name="l00266"></a>00266
175<a name="l00267"></a>00267   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#d92e8a3b194cc00bf29e060fb90b666a" title="Viterbi decoding using truncation of memory (default = 5*K).">decode_trunc</a>(<span class="keyword">const</span> vec &amp;received_signal, bvec &amp;output);
176<a name="l00268"></a>00268   <span class="keyword">virtual</span> bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#d92e8a3b194cc00bf29e060fb90b666a" title="Viterbi decoding using truncation of memory (default = 5*K).">decode_trunc</a>(<span class="keyword">const</span> vec &amp;received_signal) {
177<a name="l00269"></a>00269     bvec output;
178<a name="l00270"></a>00270     <a class="code" href="classitpp_1_1Convolutional__Code.html#d92e8a3b194cc00bf29e060fb90b666a" title="Viterbi decoding using truncation of memory (default = 5*K).">decode_trunc</a>(received_signal, output);
179<a name="l00271"></a>00271     <span class="keywordflow">return</span> output;
180<a name="l00272"></a>00272   }
181<a name="l00274"></a>00274
182<a name="l00275"></a>00275
183<a name="l00277"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#e7e892230d677d7b64917cd6f8e7b823">00277</a>   <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#e7e892230d677d7b64917cd6f8e7b823" title="Return rate of code (not including the rate-loss).">get_rate</a>(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#0e92407956851a04cffa5f89f2fd39a5" title="The rate of the code.">rate</a>; }
184<a name="l00278"></a>00278
185<a name="l00279"></a>00279
186<a name="l00281"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#6316d7d75c01471aa44d533fdaa586c1">00281</a>   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#6316d7d75c01471aa44d533fdaa586c1" title="Set encoder default start state.">set_start_state</a>(<span class="keywordtype">int</span> state) {
187<a name="l00282"></a>00282     <a class="code" href="group__errorhandlingfunc.html#g0dfeed1c189885b05ebebe78abcc9785" title="Abort if t is true.">it_error_if</a>((state &lt; 0) || ((state &gt;= (1 &lt;&lt; <a class="code" href="classitpp_1_1Convolutional__Code.html#b93371ece607184c04780de0e05d7abc" title="Memory of the encoder.">m</a>)) &amp;&amp; <a class="code" href="classitpp_1_1Convolutional__Code.html#b93371ece607184c04780de0e05d7abc" title="Memory of the encoder.">m</a> != 0),
188<a name="l00283"></a>00283                 <span class="stringliteral">"Convolutional_Code::set_start_state(): Invalid start state"</span>);
189<a name="l00284"></a>00284     <a class="code" href="classitpp_1_1Convolutional__Code.html#7bfc69c7f70316fe051e2802c9f09ee3" title="The encoder start state.">start_state</a> = state;
190<a name="l00285"></a>00285   }
191<a name="l00286"></a>00286
192<a name="l00291"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#9ef6fc1934531d3c12123ed90c5b4c40">00291</a>   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#9ef6fc1934531d3c12123ed90c5b4c40" title="Initialise internal encoder state with start state. Has no effect on Tail and Tailbite...">init_encoder</a>() { <a class="code" href="classitpp_1_1Convolutional__Code.html#04a91848197a2624c5dbdbcd5224166a" title="The current encoder state.">encoder_state</a> = <a class="code" href="classitpp_1_1Convolutional__Code.html#7bfc69c7f70316fe051e2802c9f09ee3" title="The encoder start state.">start_state</a>; }
193<a name="l00292"></a>00292
194<a name="l00294"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#22321baddd7afddcd255356debaf0fb8">00294</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#22321baddd7afddcd255356debaf0fb8" title="Get the current encoder state.">get_encoder_state</a>(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#04a91848197a2624c5dbdbcd5224166a" title="The current encoder state.">encoder_state</a>; }
195<a name="l00295"></a>00295
196<a name="l00296"></a>00296
197<a name="l00298"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#a1929841dfb95d406fa1a16867f144bb">00298</a>   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#a1929841dfb95d406fa1a16867f144bb" title="Set memory truncation length. Must be at least K.">set_truncation_length</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="group__matrix__functions.html#g97bb6b35d6d4c683c7558842e4500c2d" title="Length of vector.">length</a>) {
198<a name="l00299"></a>00299     <a class="code" href="group__errorhandlingfunc.html#g0dfeed1c189885b05ebebe78abcc9785" title="Abort if t is true.">it_error_if</a>(length &lt; <a class="code" href="classitpp_1_1Convolutional__Code.html#63430f36f9dc2c9d78b9a0ce145a8f2d" title="Constraint length.">K</a>, <span class="stringliteral">"Convolutional_Code::set_truncation_length(): "</span>
199<a name="l00300"></a>00300                 <span class="stringliteral">"Truncation length shorter than K"</span>);
200<a name="l00301"></a>00301     <a class="code" href="classitpp_1_1Convolutional__Code.html#57ef97ff464b7f36a284540426a26ce3" title="The decoder truncation length.">trunc_length</a> = length;
201<a name="l00302"></a>00302   }
202<a name="l00303"></a>00303
203<a name="l00305"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#35d7ef525f88707e4ff2c6ed05469c00">00305</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#35d7ef525f88707e4ff2c6ed05469c00" title="Get memory truncation length.">get_truncation_length</a>(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#57ef97ff464b7f36a284540426a26ce3" title="The decoder truncation length.">trunc_length</a>; }
204<a name="l00306"></a>00306
205<a name="l00307"></a>00307
206<a name="l00309"></a>00309   <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#7fbeb36821dcd85d981ae99bc106cba8" title="Check if catastrophic. Returns true if catastrophic.">catastrophic</a>(<span class="keywordtype">void</span>);
207<a name="l00310"></a>00310
208<a name="l00311"></a>00311
209<a name="l00320"></a>00320   <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#635406cac085c188709234c688ce2c68" title="Calculate the inverse sequence.">inverse_tail</a>(<span class="keyword">const</span> bvec coded_sequence, bvec &amp;input);
210<a name="l00321"></a>00321
211<a name="l00322"></a>00322
212<a name="l00325"></a>00325   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#e99bf2f2d1973c7626214ad93222cbcf" title="Calculate distance profile. If reverse = true calculate for the reverse code instead...">distance_profile</a>(ivec &amp;dist_prof, <span class="keywordtype">int</span> dmax = 100000,
213<a name="l00326"></a>00326                         <span class="keywordtype">bool</span> <a class="code" href="group__reshaping.html#ge53eb5ba319eb6a25649576deeb9bca8" title="Reverse the input vector.">reverse</a> = <span class="keyword">false</span>);
214<a name="l00327"></a>00327
215<a name="l00343"></a>00343   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#3f442fd4218c746dc046ea996f301cf7" title="Calculate spectrum.">calculate_spectrum</a>(<a class="code" href="classitpp_1_1Array.html">Array&lt;ivec&gt;</a> &amp;<a class="code" href="group__sigproc.html#g24804e1227fb135d6117652a417b44c0" title="Power spectrum calculation.">spectrum</a>, <span class="keywordtype">int</span> dmax, <span class="keywordtype">int</span> no_terms);
216<a name="l00344"></a>00344
217<a name="l00367"></a>00367   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#8217a8922992b1fb4faa28d86f21e6d7" title="Cederwall&amp;#39;s fast algorithm.">fast</a>(<a class="code" href="classitpp_1_1Array.html">Array&lt;ivec&gt;</a> &amp;<a class="code" href="group__sigproc.html#g24804e1227fb135d6117652a417b44c0" title="Power spectrum calculation.">spectrum</a>, <span class="keyword">const</span> <span class="keywordtype">int</span> dfree, <span class="keyword">const</span> <span class="keywordtype">int</span> no_terms,
218<a name="l00368"></a>00368            <span class="keyword">const</span> <span class="keywordtype">int</span> Cdfree = 1000000, <span class="keyword">const</span> <span class="keywordtype">bool</span> test_catastrophic = <span class="keyword">false</span>);
219<a name="l00369"></a>00369
220<a name="l00370"></a>00370 <span class="keyword">protected</span>:
221<a name="l00372"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#31df4741737f7b87b848ce95505f80fc">00372</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#31df4741737f7b87b848ce95505f80fc" title="Next state from instate given the input.">next_state</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> instate, <span class="keyword">const</span> <span class="keywordtype">int</span> input) {
222<a name="l00373"></a>00373     <span class="keywordflow">return</span> ((instate &gt;&gt; 1) | (input &lt;&lt; (<a class="code" href="classitpp_1_1Convolutional__Code.html#b93371ece607184c04780de0e05d7abc" title="Memory of the encoder.">m</a> - 1)));
223<a name="l00374"></a>00374   }
224<a name="l00376"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#7bdfde49b386946dcd7476fbd2488dd8">00376</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#7bdfde49b386946dcd7476fbd2488dd8" title="The previous state from state given the input.">previous_state</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> state, <span class="keyword">const</span> <span class="keywordtype">int</span> input) {
225<a name="l00377"></a>00377     <span class="keywordflow">return</span> (((state &lt;&lt; 1) | input) &amp; ((1 &lt;&lt; <a class="code" href="classitpp_1_1Convolutional__Code.html#b93371ece607184c04780de0e05d7abc" title="Memory of the encoder.">m</a>) - 1));
226<a name="l00378"></a>00378   }
227<a name="l00380"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#681ad623bd14abcaabfa317d6fd0bdad">00380</a>   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#681ad623bd14abcaabfa317d6fd0bdad" title="The previous state from state given the input.">previous_state</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> state, <span class="keywordtype">int</span> &amp;S0, <span class="keywordtype">int</span> &amp;S1) {
228<a name="l00381"></a>00381     S0 = (state &lt;&lt; 1) &amp; (<a class="code" href="classitpp_1_1Convolutional__Code.html#8c164aac0932007e5eeaa502d5bdb1ca" title="Number of states.">no_states</a> - 1);
229<a name="l00382"></a>00382     S1 = S0 | 1;
230<a name="l00383"></a>00383   }
231<a name="l00385"></a>00385   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#ceb3aadcb9da39f2330d5e9870bda5af" title="The weight of the transition from given state with the input given.">weight</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> state, <span class="keyword">const</span> <span class="keywordtype">int</span> input);
232<a name="l00387"></a>00387   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#ceb3aadcb9da39f2330d5e9870bda5af" title="The weight of the transition from given state with the input given.">weight</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> state, <span class="keywordtype">int</span> &amp;w0, <span class="keywordtype">int</span> &amp;w1);
233<a name="l00390"></a>00390   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#f600390d130ce3cb7aa2e33037560626" title="The weight (of the reverse code) of the transition from given state with the input...">weight_reverse</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> state, <span class="keyword">const</span> <span class="keywordtype">int</span> input);
234<a name="l00393"></a>00393   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#f600390d130ce3cb7aa2e33037560626" title="The weight (of the reverse code) of the transition from given state with the input...">weight_reverse</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> state, <span class="keywordtype">int</span> &amp;w0, <span class="keywordtype">int</span> &amp;w1);
235<a name="l00395"></a>00395   bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#f286a1fb3897e5fd78e749b03aaadff6" title="Output on transition (backwards) with input from state.">output_reverse</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> state, <span class="keyword">const</span> <span class="keywordtype">int</span> input);
236<a name="l00397"></a>00397   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#f286a1fb3897e5fd78e749b03aaadff6" title="Output on transition (backwards) with input from state.">output_reverse</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> state, bvec &amp;zero_output, bvec &amp;one_output);
237<a name="l00399"></a>00399   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#f286a1fb3897e5fd78e749b03aaadff6" title="Output on transition (backwards) with input from state.">output_reverse</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> state, <span class="keywordtype">int</span> &amp;zero_output, <span class="keywordtype">int</span> &amp;one_output);
238<a name="l00401"></a>00401   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#5860dd3376bf2b0971e8e2a45b755b04" title="Calculate delta metrics for 0 and 1 input branches reaching state.">calc_metric_reverse</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> state, <span class="keyword">const</span> vec &amp;rx_codeword,
239<a name="l00402"></a>00402                            <span class="keywordtype">double</span> &amp;zero_metric, <span class="keywordtype">double</span> &amp;one_metric);
240<a name="l00404"></a>00404   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#79f47928875683c5b2d91c50220ff3d6" title="Calculate delta metrics for all possible codewords.">calc_metric</a>(<span class="keyword">const</span> vec &amp;rx_codeword, vec &amp;delta_metrics);
241<a name="l00406"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#028a1867c118c4fc5f8fea9b404bf20d">00406</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#028a1867c118c4fc5f8fea9b404bf20d" title="Returns the input that results in state, that is the MSB of state.">get_input</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> state) { <span class="keywordflow">return</span> (state &gt;&gt; (<a class="code" href="classitpp_1_1Convolutional__Code.html#b93371ece607184c04780de0e05d7abc" title="Memory of the encoder.">m</a> - 1)); }
242<a name="l00407"></a>00407
243<a name="l00409"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#b314ab153e137a68c8a0ca6e1bbbdbee">00409</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#b314ab153e137a68c8a0ca6e1bbbdbee" title="Number of generators.">n</a>;
244<a name="l00411"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#63430f36f9dc2c9d78b9a0ce145a8f2d">00411</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#63430f36f9dc2c9d78b9a0ce145a8f2d" title="Constraint length.">K</a>;
245<a name="l00413"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#b93371ece607184c04780de0e05d7abc">00413</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#b93371ece607184c04780de0e05d7abc" title="Memory of the encoder.">m</a>;
246<a name="l00415"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#8c164aac0932007e5eeaa502d5bdb1ca">00415</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#8c164aac0932007e5eeaa502d5bdb1ca" title="Number of states.">no_states</a>;
247<a name="l00417"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#e5b54f1bab039f8480c7ae0013f3f5fe">00417</a>   ivec <a class="code" href="classitpp_1_1Convolutional__Code.html#e5b54f1bab039f8480c7ae0013f3f5fe" title="Generator polynomials.">gen_pol</a>;
248<a name="l00419"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#d072282520c19e64e8a88e0e79d91b96">00419</a>   ivec <a class="code" href="classitpp_1_1Convolutional__Code.html#d072282520c19e64e8a88e0e79d91b96" title="Generator polynomials for the reverse code.">gen_pol_rev</a>;
249<a name="l00421"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#04a91848197a2624c5dbdbcd5224166a">00421</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#04a91848197a2624c5dbdbcd5224166a" title="The current encoder state.">encoder_state</a>;
250<a name="l00423"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#7bfc69c7f70316fe051e2802c9f09ee3">00423</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#7bfc69c7f70316fe051e2802c9f09ee3" title="The encoder start state.">start_state</a>;
251<a name="l00425"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#57ef97ff464b7f36a284540426a26ce3">00425</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#57ef97ff464b7f36a284540426a26ce3" title="The decoder truncation length.">trunc_length</a>;
252<a name="l00427"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#0e92407956851a04cffa5f89f2fd39a5">00427</a>   <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#0e92407956851a04cffa5f89f2fd39a5" title="The rate of the code.">rate</a>;
253<a name="l00429"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#e31e1e09af8f51be5eb37ffca507d232">00429</a>   bvec <a class="code" href="classitpp_1_1Convolutional__Code.html#e31e1e09af8f51be5eb37ffca507d232" title="Auxilary table used by the codec.">xor_int_table</a>;
254<a name="l00431"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#7e63597801ab594d590234192eed3da4">00431</a>   imat <a class="code" href="classitpp_1_1Convolutional__Code.html#7e63597801ab594d590234192eed3da4" title="output in int format for a given state and input">output_reverse_int</a>;
255<a name="l00433"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#df24ee075bc58e4b277c44cfd146d84b">00433</a>   <a class="code" href="group__fec.html#ge22fe2744a6f00b512ee75e304d72a82" title="Encoding and decoding methods for Convolutional codes.">CONVOLUTIONAL_CODE_METHOD</a> <a class="code" href="classitpp_1_1Convolutional__Code.html#df24ee075bc58e4b277c44cfd146d84b" title="encoding and decoding method">cc_method</a>;
256<a name="l00435"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#2be7d32bc57f8be15b9e45993d88253b">00435</a>   imat <a class="code" href="classitpp_1_1Convolutional__Code.html#2be7d32bc57f8be15b9e45993d88253b" title="Path memory (trellis).">path_memory</a>;
257<a name="l00437"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#e840a45790781563ef45047652bf794b">00437</a>   <a class="code" href="classitpp_1_1Array.html">Array&lt;bool&gt;</a> <a class="code" href="classitpp_1_1Convolutional__Code.html#e840a45790781563ef45047652bf794b" title="Visited states.">visited_state</a>;
258<a name="l00439"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#2a894772cc027542c600f5b86fe17173">00439</a>   vec <a class="code" href="classitpp_1_1Convolutional__Code.html#2a894772cc027542c600f5b86fe17173" title="Metrics accumulator.">sum_metric</a>;
259<a name="l00441"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#89b0d6ba21457e1aab73f53631a5cb7f">00441</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#89b0d6ba21457e1aab73f53631a5cb7f" title="Truncated path memory pointer.">trunc_ptr</a>;
260<a name="l00443"></a><a class="code" href="classitpp_1_1Convolutional__Code.html#d26ed837b36f7313277a2b1dcc7b0c4c">00443</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1Convolutional__Code.html#d26ed837b36f7313277a2b1dcc7b0c4c" title="Truncated memory fill state.">trunc_state</a>;
261<a name="l00444"></a>00444 };
262<a name="l00445"></a>00445
263<a name="l00446"></a>00446 <span class="comment">// --------------- Some other functions that maybe should be moved -----------</span>
264<a name="l00451"></a>00451 <span class="comment"></span><span class="keywordtype">int</span> <a class="code" href="namespaceitpp.html#6d6ebeede5e097577c8cde4067ef1f48">reverse_int</a>(<span class="keywordtype">int</span> <a class="code" href="group__matrix__functions.html#g97bb6b35d6d4c683c7558842e4500c2d" title="Length of vector.">length</a>, <span class="keywordtype">int</span> in);
265<a name="l00452"></a>00452
266<a name="l00457"></a>00457 <span class="keywordtype">int</span> <a class="code" href="namespaceitpp.html#22d2d63c46e60c535dd6487e9176971e">weight_int</a>(<span class="keywordtype">int</span> <a class="code" href="group__matrix__functions.html#g97bb6b35d6d4c683c7558842e4500c2d" title="Length of vector.">length</a>, <span class="keywordtype">int</span> in);
267<a name="l00458"></a>00458
268<a name="l00463"></a>00463 <span class="keywordtype">int</span> <a class="code" href="namespaceitpp.html#2858a6589ac32422f9426b8949ea4116">compare_spectra</a>(ivec v1, ivec v2);
269<a name="l00464"></a>00464
270<a name="l00471"></a>00471 <span class="keywordtype">int</span> <a class="code" href="namespaceitpp.html#2858a6589ac32422f9426b8949ea4116">compare_spectra</a>(ivec v1, ivec v2, vec weight_profile);
271<a name="l00472"></a>00472
272<a name="l00473"></a>00473 } <span class="comment">// namespace itpp</span>
273<a name="l00474"></a>00474
274<a name="l00475"></a>00475 <span class="preprocessor">#endif // #ifndef CONVCODE_H</span>
275</pre></div></div>
276<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:11 2009 for mixpp by&nbsp;
277<a href="http://www.doxygen.org/index.html">
278<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
279</body>
280</html>
Note: See TracBrowser for help on using the browser.