Changeset 4182

Show
Ignore:
Timestamp:
06/14/07 21:31:28 (6 years ago)
Author:
hvolos
Message:

Now it *should not* crash

Location:
experimental/components/Conv_Enc
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • experimental/components/Conv_Enc/Conv_Enc.cpp

    r4179 r4182  
    3636    inputGeneratorPolynomials[0]=0; 
    3737    inputGeneratorPolynomials[1]=0; 
    38     encoder=new SigProc::fec_conv_encoder; 
     38    encoder=new SigProc::fec_conv_encoder(); 
    3939    configured=false; 
    4040    //Create the thread for the writer's processing function  
     
    5252    delete []inputGeneratorPolynomials; 
    5353    delete trellisTables; 
     54    delete encoder; 
    5455} 
    5556 
     
    190191                (short unsigned int)K); 
    191192 
    192                 DEBUG(3, Conv_Dec, "custom trellis table generated") 
     193                DEBUG(3, Conv_Enc, "custom trellis table generated") 
    193194                break; 
    194195            case 1: 
    195196                //Rate 1, no trellis needed;            
    196              
     197                DEBUG(3, Conv_Enc, "Pass through mode") 
    197198                break; 
    198199            case 2: 
     
    207208                (short unsigned int)5, 
    208209                (short unsigned int)2); 
    209                 DEBUG(3, Conv_Dec, "4/5 trellis table generated") 
     210                DEBUG(3, Conv_Enc, "4/5 trellis table generated") 
    210211                break; 
    211212            case 3: 
     
    218219                (short unsigned int)3, 
    219220                (short unsigned int)4); 
    220                 DEBUG(3, Conv_Dec, "2/3 trellis table generated") 
     221                DEBUG(3, Conv_Enc, "2/3 trellis table generated") 
    221222                break; 
    222223            case 4: 
     
    228229                (short unsigned int)2, 
    229230                (short unsigned int)7); 
    230                 DEBUG(3, Conv_Dec, "1/2 trellis table generated") 
     231                DEBUG(3, Conv_Enc, "1/2 trellis table generated") 
    231232                break; 
    232233            case 5: 
     
    239240                (short unsigned int)3, 
    240241                (short unsigned int)7); 
    241                 DEBUG(3, Conv_Dec, "1/3 trellis table generated") 
     242                DEBUG(3, Conv_Enc, "1/3 trellis table generated") 
    242243                break; 
    243244            case 6:    
     
    251252                (short unsigned int)4, 
    252253                (short unsigned int)7); 
    253                 DEBUG(3, Conv_Dec, "1/4 trellis table generated") 
     254                DEBUG(3, Conv_Enc, "1/4 trellis table generated") 
    254255                break; 
    255256            case 7: 
     
    265266                (short unsigned int)5, 
    266267                (short unsigned int)7); 
    267                 DEBUG(3, Conv_Dec, "1/5 trellis table generated") 
     268                DEBUG(3, Conv_Enc, "1/5 trellis table generated") 
    268269                break; 
    269270            case 8: 
     
    280281                (short unsigned int)6, 
    281282                (short unsigned int)7); 
    282                 DEBUG(3, Conv_Dec, "1/6 trellis table generated") 
     283                DEBUG(3, Conv_Enc, "1/6 trellis table generated") 
    283284                break; 
    284285            case 9: 
     
    296297                (short unsigned int)7, 
    297298                (short unsigned int)7); 
    298                 DEBUG(3, Conv_Dec, "1/7 trellis table generated") 
     299                DEBUG(3, Conv_Enc, "1/7 trellis table generated") 
    299300                break; 
    300301            case 10: 
     
    312313                (short unsigned int)8, 
    313314                (short unsigned int)7); 
    314                 DEBUG(3, Conv_Dec, "1/8 trellis table generated") 
     315                DEBUG(3, Conv_Enc, "1/8 trellis table generated") 
    315316                break; 
    316317            default: 
     
    321322            encoder->SetTrellisTable(trellisTables); 
    322323 
    323              DEBUG(4, Conv_Dec, "the trellis was sent to the encoder") 
     324             DEBUG(4, Conv_Enc, "the trellis was sent to the encoder") 
    324325            } 
    325326            configured=true; 
     
    340341    unsigned short int numberOfBits; 
    341342    SigProc::trellisTable *theTrellisTable; 
    342     theTrellisTable=trellisTables; 
     343 
    343344 
    344345 
    345346    while(1) 
    346347    {  
    347          
     348                 
    348349        dataIn_0->getData(I_in_0); 
     350             
    349351         
    350352        if (!configured) throw 0; 
     
    359361                I_out_0[i]=(*I_in_0)[i]; 
    360362            }; 
    361             DEBUG(4, Conv_Enc, "Pass through mode, no encoding done") 
     363            DEBUG(4, Conv_Enc, "Pass through mode, no encoding will done") 
    362364        }else { 
    363365 
    364         DEBUG(4, Conv_Enc, numberOfBits<<" bits received") 
    365         noOfSymbols=numberOfBits/theTrellisTable->k; 
    366         I_out_0.length(noOfSymbols*theTrellisTable->n); 
    367         DEBUG(6, Conv_Enc, " Output length set to:"<<noOfSymbols*theTrellisTable->n) 
    368         encoder->ResetState(); 
    369         DEBUG(6, Conv_Enc, " Encoder state was reset") 
    370         /*insert code here to do work*/ 
    371         for (unsigned int i=0;i<noOfSymbols;i++){ 
    372             for (unsigned int j=0;j<theTrellisTable->k;j++){ 
    373                 data2Enc[j]=(*I_in_0)[i*theTrellisTable->k +j]; 
    374             } 
     366            DEBUG(4, Conv_Enc, numberOfBits<<" bits received") 
     367            theTrellisTable=trellisTables;             
     368            noOfSymbols=numberOfBits/theTrellisTable->k; 
     369            I_out_0.length(noOfSymbols*theTrellisTable->n); 
     370            DEBUG(6, Conv_Enc, " Output length set to:"<<noOfSymbols*theTrellisTable->n) 
     371            encoder->ResetState(); 
     372            DEBUG(6, Conv_Enc, " Encoder state was reset") 
     373            /*insert code here to do work*/ 
     374            for (unsigned int i=0;i<noOfSymbols;i++){ 
     375                 for (unsigned int j=0;j<theTrellisTable->k;j++){ 
     376                    data2Enc[j]=(*I_in_0)[i*theTrellisTable->k +j]; 
     377                 } 
    375378            DEBUG(11, Conv_Enc, i+1<<" symbol to be encoded") 
    376         encoder->Encode(data2Enc,encData); 
     379             
     380            encoder->Encode(data2Enc,encData); 
    377381         
    378382            for (int j=0;j<theTrellisTable->n;j++){ 
     
    380384                 I_out_0[i*theTrellisTable->n+j]=tmp; 
    381385             } 
    382         DEBUG(11, Conv_Enc, i+1<<" symbol encoded") 
    383         } 
    384  
    385         } 
    386  
    387  
     386            DEBUG(11, Conv_Enc, i+1<<" symbol encoded") 
     387            } 
     388 
     389        } 
     390 
     391        DEBUG(6, Conv_Enc, "Trying to push packet") 
    388392        dataOut_0->pushPacket(I_out_0); 
     393         
     394        DEBUG(6, Conv_Enc, "Now trying to empty the buffer") 
    389395        dataIn_0->bufferEmptied(); 
    390        DEBUG(4, Conv_Enc, noOfSymbols*theTrellisTable->n<<" Bits sent to the next component") 
     396         
     397        DEBUG(6, Conv_Enc, "buffer emptied")                 
     398                 
     399        if (rate_index!=1){ 
     400        DEBUG(4, Conv_Enc, noOfSymbols*theTrellisTable->n<<" Bits sent to the next component") 
     401                 
     402        } else { 
     403        DEBUG(4, Conv_Enc, numberOfBits<<" Bits sent to the next component")         
     404        } 
    391405    } 
    392406} 
  • experimental/components/Conv_Enc/Conv_Enc.prf.xml

    r4179 r4182  
    55<properties> 
    66    <simple type="short" id="DCE:345df262-1611-11dc-a219-0016769e497b" name="rate_index" mode="readwrite"> 
    7         <description>The index of the desired encoding rate from the supported rates table. For a custom rate use rate_index=0</description>  
    8         <value>1</value>  
     7        <description>The index of the desired encoding rate from the supported rates table. For a custom rate use rate_index 0</description>  
     8        <value>2</value>  
    99        <kind kindtype="configure"/> 
    1010    </simple>