Ejemplo n.º 1
0
 void ProcessData()
 {
     foreach (int Data in DataBlock)
     {
         // Send every bit of the symbol individually into the interleaver
         for (int BitShift = 0; BitShift < CurrentMode.BitsPerSymbol; BitShift++)
         {
             int DataBit = (Data >> BitShift) & 0x0001;
             Interleaver.ProcessDecode((byte)DataBit);
             if (Interleaver.IsDataReady)
             {
                 // Interleaver is full - get the data from it into the buffer
                 int numOutputBits = Interleaver.Count;
                 Interleaver.GetData(FECBuffer);
                 // Process thru Viterby FEC decoder
                 int nBits;
                 if (FECDecoder == null)
                 {
                     nBits = numOutputBits;
                 }
                 else
                 {
                     FECDecoder.Process(FECBuffer, 0, numOutputBits);
                     FECDecoder.Finish();
                     nBits = FECDecoder.GetData(FECBuffer);
                     FECDecoder.Init();
                 }
                 // Add new bytes into the output array
                 // If EOM was found - only copy those bytes up to EOM
                 // ATTENTION!!!!!!
                 //  It will only work when the EOM symbol lies exactly within the interleaver block
                 // If it spans across the interleaver boundaries - then it will not work!!!!!!!
                 EOMDetector.Process(FECBuffer, 0, nBits);
                 if (EOMDetector.IsMatchFound)
                 {
                     nBits -= EOMDetector.TargetIndex;
                 }
                 for (int i = 0; i < nBits; i++)
                 {
                     OutputData.Enqueue(FECBuffer[i]);
                 }
                 Interleaver.Init();
             }
         }
     }
 }