Changeset 4178
- Timestamp:
- 06/14/07 16:26:19 (6 years ago)
- Location:
- experimental/components/Conv_Dec
- Files:
-
- 4 modified
-
Conv_Dec.cpp (modified) (8 diffs)
-
Conv_Dec.h (modified) (1 diff)
-
Conv_Dec.prf.xml (modified) (1 diff)
-
documentation.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
experimental/components/Conv_Dec/Conv_Dec.cpp
r4158 r4178 32 32 dataOut_0 = new standardInterfaces_i::realChar_u("decoded_bits"); 33 33 34 34 trellisTables=NULL; 35 35 inputGeneratorPolynomialsLength = 2; 36 36 inputGeneratorPolynomials = new unsigned int[inputGeneratorPolynomialsLength]; … … 38 38 inputGeneratorPolynomials[1]=0; 39 39 decoder=new SigProc::fec_conv_decoder; 40 configured=false; 40 41 41 42 //Create the thread for the writer's processing function … … 52 53 delete dataOut_0; 53 54 delete []inputGeneratorPolynomials; 55 delete trellisTables; 54 56 } 55 57 … … 124 126 props[i].value >>= simple_temp; 125 127 rate_index = simple_temp; 126 }127 128 if (strcmp(props[i].id, "DCE:ac364768-a06a-49f0-b74c-c4ad22183301") == 0)129 {130 CORBA::Short simple_temp;131 props[i].value >>= simple_temp;132 block_size = simple_temp;133 128 } 134 129 … … 188 183 DEBUG(3, Conv_Dec, "Configure is done, generate the trellis etc") 189 184 190 191 TrellisTables=new SigProc::trellisTable(inputGeneratorPolynomials, 192 (short unsigned int) k, 193 (short unsigned int)n, 194 (short unsigned int)K); 195 196 DEBUG(3, Conv_Dec, "trellis table generated") 197 198 decoder->SetTrellisTable(TrellisTables); 185 switch (rate_index){ 186 unsigned int genPoly[10]; 187 case 0: 188 trellisTables=new SigProc::trellisTable(inputGeneratorPolynomials, 189 (short unsigned int)k, 190 (short unsigned int)n, 191 (short unsigned int)K); 192 193 DEBUG(3, Conv_Dec, "custom trellis table generated") 194 break; 195 case 1: 196 //Rate 1, no trellis needed; 197 198 break; 199 case 2: 200 //4/5 201 genPoly[0]=159; 202 genPoly[1]=188; 203 genPoly[2]=110; 204 genPoly[3]=173; 205 genPoly[4]=223; 206 trellisTables=new SigProc::trellisTable(genPoly, 207 (short unsigned int)4, 208 (short unsigned int)5, 209 (short unsigned int)2); 210 DEBUG(3, Conv_Dec, "4/5 trellis table generated") 211 break; 212 case 3: 213 //2/3 214 genPoly[0]=158; 215 genPoly[1]=109; 216 genPoly[2]=223; 217 trellisTables=new SigProc::trellisTable(genPoly, 218 (short unsigned int)2, 219 (short unsigned int)3, 220 (short unsigned int)4); 221 DEBUG(3, Conv_Dec, "2/3 trellis table generated") 222 break; 223 case 4: 224 //1/2 225 genPoly[0]=91; 226 genPoly[1]=121; 227 trellisTables=new SigProc::trellisTable(genPoly, 228 (short unsigned int)1, 229 (short unsigned int)2, 230 (short unsigned int)7); 231 DEBUG(3, Conv_Dec, "1/2 trellis table generated") 232 break; 233 case 5: 234 //1/3 235 genPoly[0]=91; 236 genPoly[1]=101; 237 genPoly[2]=125; 238 trellisTables=new SigProc::trellisTable(genPoly, 239 (short unsigned int)1, 240 (short unsigned int)3, 241 (short unsigned int)7); 242 DEBUG(3, Conv_Dec, "1/3 trellis table generated") 243 break; 244 case 6: 245 //1/4 246 genPoly[0]=93; 247 genPoly[1]=93; 248 genPoly[2]=103; 249 genPoly[3]=115; 250 trellisTables=new SigProc::trellisTable(genPoly, 251 (short unsigned int)1, 252 (short unsigned int)4, 253 (short unsigned int)7); 254 DEBUG(3, Conv_Dec, "1/4 trellis table generated") 255 break; 256 case 7: 257 //1/5 258 genPoly[0]=125; 259 genPoly[1]=89; 260 genPoly[2]=93; 261 genPoly[3]=93; 262 genPoly[4]=103; 263 264 trellisTables=new SigProc::trellisTable(genPoly, 265 (short unsigned int)1, 266 (short unsigned int)5, 267 (short unsigned int)7); 268 DEBUG(3, Conv_Dec, "1/5 trellis table generated") 269 break; 270 case 8: 271 //1/6 272 genPoly[0]=123; 273 genPoly[1]=105; 274 genPoly[2]=93; 275 genPoly[3]=93; 276 genPoly[4]=115; 277 genPoly[5]=95; 278 279 trellisTables=new SigProc::trellisTable(genPoly, 280 (short unsigned int)1, 281 (short unsigned int)6, 282 (short unsigned int)7); 283 DEBUG(3, Conv_Dec, "1/6 trellis table generated") 284 break; 285 case 9: 286 //1/7 287 genPoly[0]=117; 288 genPoly[1]=101; 289 genPoly[2]=123; 290 genPoly[3]=93; 291 genPoly[4]=93; 292 genPoly[5]=103; 293 genPoly[6]=95; 294 295 trellisTables=new SigProc::trellisTable(genPoly, 296 (short unsigned int)1, 297 (short unsigned int)7, 298 (short unsigned int)7); 299 DEBUG(3, Conv_Dec, "1/7 trellis table generated") 300 break; 301 case 10: 302 //1/8 303 genPoly[0]=107; 304 genPoly[1]=73; 305 genPoly[2]=117; 306 genPoly[3]=123; 307 genPoly[4]=93; 308 genPoly[5]=93; 309 genPoly[6]=103; 310 genPoly[7]=95; 311 trellisTables=new SigProc::trellisTable(genPoly, 312 (short unsigned int)1, 313 (short unsigned int)8, 314 (short unsigned int)7); 315 DEBUG(3, Conv_Dec, "1/8 trellis table generated") 316 break; 317 default: 318 //Unknown rate 319 throw 0; 320 }; 321 if (rate_index!=1) { 322 decoder->SetTrellisTable(trellisTables); 199 323 200 324 DEBUG(4, Conv_Dec, "the trellis was sent to the decoder") 325 } 326 configured=true; 201 327 202 328 } … … 211 337 PortTypes::CharSequence *I_in_0(NULL); 212 338 CORBA::UShort I_in_0_length; 213 unsigned short int data2Dec[20],decData[20],noOfSymbols ;339 unsigned short int data2Dec[20],decData[20],noOfSymbols=0; 214 340 //signed short int tmp; 215 unsigned short int numberOfBits , blockIndex;341 unsigned short int numberOfBits=0; 216 342 SigProc::trellisTable *theTrellisTable; 217 theTrellisTable= TrellisTables;218 blockIndex=0;219 DEBUG(4, Conv_Dec, "Before decoder reset")220 //decoder->Reset();221 DEBUG(4, Conv_Dec, "After decoder reset")343 theTrellisTable=trellisTables; 344 345 //DEBUG(4, Conv_Dec, "Before decoder reset") 346 // decoder->Reset(); 347 //DEBUG(4, Conv_Dec, "After decoder reset") 222 348 while(1) 223 349 { 224 blockIndex++; 350 225 351 dataIn_0->getData(I_in_0); 226 352 if (!configured) throw 0; 353 DEBUG(4, Conv_Dec, numberOfBits <<" getData Executed") 227 354 I_in_0_length = I_in_0->length(); 228 355 … … 230 357 DEBUG(4, Conv_Dec, numberOfBits <<" bits received") 231 358 359 if (rate_index==1){ 360 I_out_0.length(I_in_0_length); 361 for (unsigned int i=0;i<I_in_0_length;i++) { 362 I_out_0[i]=(*I_in_0)[i]; 363 }; 364 DEBUG(4, Conv_Dec, "Pass through mode, no decoding done") 365 } 366 else { 232 367 noOfSymbols=numberOfBits/theTrellisTable->n; 233 368 DEBUG(5, Conv_Dec, "Number of symbols:"<<noOfSymbols) … … 256 391 } 257 392 } 258 259 DEBUG(4, Conv_Dec, noOfSymbols*theTrellisTable->n<<"Dec Bits sent to the next component") 393 DEBUG(5, Conv_Dec, "Will reset the decoder") 394 decoder->Reset(); 395 DEBUG(5, Conv_Dec, "The decoder was reset") 396 } 397 DEBUG(4, Conv_Dec, noOfSymbols*theTrellisTable->k<<"Dec Bits sent to the next component") 398 399 400 dataOut_0->pushPacket(I_out_0); 260 401 dataIn_0->bufferEmptied(); 261 dataOut_0->pushPacket(I_out_0);262 402 } 263 403 } -
experimental/components/Conv_Dec/Conv_Dec.h
r4158 r4178 90 90 91 91 CORBA::Short rate_index; 92 CORBA::Short block_size;93 92 CORBA::Short mode; 94 93 CORBA::Short k; 95 94 CORBA::Short K; 96 CORBA::Short n; 95 CORBA::Short n; 97 96 98 97 unsigned short int inputGeneratorPolynomialsLength; 99 98 unsigned int*inputGeneratorPolynomials; 99 100 bool configured; 100 101 101 SigProc::trellisTable * TrellisTables;102 SigProc::trellisTable *trellisTables; 102 103 SigProc::fec_conv_decoder * decoder; 103 104 -
experimental/components/Conv_Dec/Conv_Dec.prf.xml
r4158 r4178 6 6 <simple type="short" id="DCE:0e756459-63b7-4f5e-8b15-e5fbe3bf200f" name="rate_index" mode="readwrite"> 7 7 <description>The index of the decoding rate from the supported rates table. For a custom rate use rate_index=0</description> 8 <value>0</value> 9 <kind kindtype="configure"/> 10 </simple> 11 <simple type="short" id="DCE:ac364768-a06a-49f0-b74c-c4ad22183301" name="block_size" mode="readwrite"> 12 <description>The number of bits that were encoded for each block</description> 13 <value>1024</value> 8 <value>1</value> 14 9 <kind kindtype="configure"/> 15 10 </simple> -
experimental/components/Conv_Dec/documentation.txt
r4158 r4178 24 24 25 25 \section description Basic description 26 Include a basic description of the Conv_Dec component here 26 The Conv_Dec is a convolutional encoder 27 27 28 28 \section properties Properties 29 29 This section details the properties 30 30 31 \subsection prop_property_name Property Name (DCE:xxxx-xxx-xxx-xxx-xxxx) 31 \subsection rate_index Rate Index (DCE:0e756459-63b7-4f5e-8b15-e5fbe3bf200f) 32 The index of the desired decoding rate from the supported rates list 33 34 -Rates List: 35 - 0: Custom rate (need to use k,K,n and generatorPolynomials properties) 36 - 1: Pass through (no decoding) 37 - 2: 4/5 K=2 38 - 3: 2/3 K=4 39 - 4: 1/2 K=7 40 - 5: 1/3 K=7 41 - 6: 1/4 K=7 42 - 7: 1/5 K=7 43 - 8: 1/6 K=7 44 - 9: 1/7 K=7 45 - 10:1/8 K=7 46 47 \subsection mode mode(DCE:8fd6f6e3-41d0-40b4-a26a-5ebdd6514931) 48 mode 0 means the encoder started at the zero state 49 mode 1 means that the encoder both started and finished at the zero state (not fully implemented yet) 50 51 \subsection k k(DCE:c8638626-7377-4b2e-a2a4-85de280eac05) 52 Input bits at a time (for the custom rate rate_index=0) The encoder rate = k/n 53 54 \subsection K K(DCE:91b1454d-f5b7-4049-a60c-cf5d587f3149) 55 Constrain length for the custom rate. (rate_index=0) 56 57 \subsection n n(DCE:6fa08774-471e-4761-aa7b-a37ba2166cf9) 58 Output bits at a time for the custom rate index, has to match the number of suplied polynomials (rate_index=0) The encoder rate = k/n 59 60 \subsection generatorPolynomials generatorPolynomials(DCE:7a4234e2-fe15-44e0-bedb-cffc9e2ec78d) 61 A list of generator polynomials in DECIMAL for the custom rate (rate_index=0) 32 62 33 63 \section interfaces Interfaces … … 37 67 38 68 \section dependencies Software build dependencies 39 - Dependency 1 40 - Dependency 2 69 - SigProc 41 70 42 71 \section algorithm Detailed Description of Algorithm 72 Convolutioal Encoder 43 73 44 74 \section status Status and history 75 Needs testing 45 76 46 77 \section references References 47 78 Proakis Digital Communications 4th Edition 48 79 */