Changeset 4187 for SigProc/trunk/SigProc/fec_conv.cpp
- Timestamp:
- 06/15/07 19:17:26 (6 years ago)
- Files:
-
- 1 modified
-
SigProc/trunk/SigProc/fec_conv.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
SigProc/trunk/SigProc/fec_conv.cpp
r4184 r4187 228 228 if (theTrellis!=NULL){ 229 229 for (unsigned int i = 0; i < theTrellisTable->numberOfTrellisStates; i++){ 230 delete theTrellis[i];230 delete []theTrellis[i]; 231 231 }; 232 232 … … 255 255 void fec_conv_decoder::SetNoOfSymbols2TraceBack(unsigned int traceBackLength){ 256 256 //std::cout<<theTrellis; 257 if (theTrellis!=NULL){ 257 258 if (fec_conv_decoder::noOfSymbols2TraceBack!=traceBackLength){ 259 fec_conv_decoder::noOfSymbols2TraceBack=traceBackLength; 260 if (theTrellis!=NULL){ 261 for (unsigned int i = 0; i < theTrellisTable->numberOfTrellisStates; i++){ 262 delete []theTrellis[i]; 263 }; 264 delete []theTrellis; 265 theTrellis=NULL; 266 } 267 //std::cout<<theTrellis; 268 //int dummy; 269 //std::cin>>dummy; 270 271 272 273 theTrellis= new TrellisEntry*[theTrellisTable->numberOfTrellisStates]; 258 274 for (unsigned int i = 0; i < theTrellisTable->numberOfTrellisStates; i++){ 259 delete theTrellis[i];275 theTrellis[i] =new TrellisEntry[noOfSymbols2TraceBack+1]; 260 276 }; 261 delete []theTrellis; 262 theTrellis=NULL; 263 } 264 //std::cout<<theTrellis; 265 //int dummy; 266 //std::cin>>dummy; 267 268 fec_conv_decoder::noOfSymbols2TraceBack=traceBackLength; 269 270 theTrellis= new TrellisEntry*[theTrellisTable->numberOfTrellisStates]; 271 for (unsigned int i = 0; i < theTrellisTable->numberOfTrellisStates; i++){ 272 theTrellis[i] =new TrellisEntry[noOfSymbols2TraceBack+1]; 273 }; 274 275 if (tracedBackSymbols!=NULL){ 276 delete []tracedBackSymbols; 277 tracedBackSymbols=NULL; 278 }; 277 278 if (tracedBackSymbols!=NULL){ 279 delete []tracedBackSymbols; 280 tracedBackSymbols=NULL; 281 }; 279 282 tracedBackSymbols = new unsigned int [noOfSymbols2TraceBack]; 280 283 284 } 285 /* 281 286 currentTrellisIndex=0; 282 287 for (unsigned int i=0;i<theTrellisTable->numberOfTrellisStates;i++) … … 287 292 } 288 293 theTrellis[0][0].distance=0; 289 294 */ 295 fec_conv_decoder::Reset(); 290 296 } 291 297 … … 297 303 signed int distance; 298 304 299 inbits=0;305 // inbits=0; 300 306 for (unsigned short int i=0;i<theTrellisTable->n;i++){ 301 307 tmp=inputData[i]; … … 315 321 }; 316 322 317 if (inbits>(unsigned int)(pow( theTrellisTable->n,2)-1)){323 if (inbits>(unsigned int)(pow(2.0,(float)theTrellisTable->n)-1)){ 318 324 std::cout<<"ERROR:fec_conv_decoder::Symbol2Decode inbits>2^n-1\n"; 319 std::cout<<"inbits:"<<inbits<<" numberOfInputStates:"<<pow(theTrellisTable->n,2)-1; 325 std::cout<<"inbits:"<<inbits<<" 2^n-1: "<<(unsigned int)pow(2.0,(float)theTrellisTable->n)-1 326 <<"n="<<theTrellisTable->n<<"\n"; 320 327 throw 0; 321 328 };