Ejemplo n.º 1
0
 public int Process(byte incomingBit)
 {
     DataArray[CurrentInIndex++] += (byte)((incomingBit == 0) ? -1 : 1); if (CurrentInIndex >= MaxBits)
     {
         CurrentInIndex = 0;
     }
     CurrentBGCounter--;
     if (CurrentBGCounter <= 0)
     {
         BitGroup bg = BGArray[CurrentBitGroupIndex++]; if (CurrentBitGroupIndex >= MaxBitGroupIndex)
         {
             CurrentBitGroupIndex = 0;
         }
         CurrentInIndex = CurrentFrame - bg.Position; if (CurrentInIndex < 0)
         {
             CurrentInIndex += MaxBits;
         }
         CurrentBGCounter = bg.Size;
     }
     CurrentInCounter++;
     if (CurrentInCounter >= NumBitsIn)
     {
         CurrentInCounter = 0;
         // Output data
         for (int i = 0; i < NumBitsOut; i++)
         {
             OutputData.Add((byte)((DataArray[CurrentFrame++] > 0) ? 1 : 0)); if (CurrentFrame >= MaxBits)
             {
                 CurrentFrame = 0;
             }
         }
         Array.Clear(DataArray, CurrentFrame, NumBitsOut);
     }
     return(this.OutputData.Count);
 }
Ejemplo n.º 2
0
        public override void Init()
        {
            Array.Clear(DataArray, 0, MaxBits);
            OutputData.Clear();
            CurrentBitGroupIndex = 0;
            CurrentInCounter     = 0;
            CurrentFrame         = 0;
            BitGroup bg = BGArray[CurrentBitGroupIndex++];

            CurrentInIndex = CurrentFrame - bg.Position; if (CurrentInIndex < 0)
            {
                CurrentInIndex += MaxBits;
            }
            CurrentBGCounter = bg.Size;
        }
Ejemplo n.º 3
0
 public void Process(CNTRL_MSG controlParam, byte incomingBit)
 {
     if (controlParam == CNTRL_MSG.DATA_IN)
     {
         DataArray[CurrentInIndex++] += (byte)((incomingBit == 0) ? -1 : 1); if (CurrentInIndex >= MaxBits)
         {
             CurrentInIndex = 0;
         }
         CurrentBGCounter--;
         if (CurrentBGCounter <= 0)
         {
             BitGroup bg = BGArray[CurrentBitGroupIndex++]; if (CurrentBitGroupIndex >= MaxBitGroupIndex)
             {
                 CurrentBitGroupIndex = 0;
             }
             CurrentInIndex = CurrentFrame - bg.Position; if (CurrentInIndex < 0)
             {
                 CurrentInIndex += MaxBits;
             }
             CurrentBGCounter = bg.Size;
         }
         CurrentInCounter++;
         if (CurrentInCounter >= NumBitsIn)
         {
             CurrentInCounter = 0;
             // Output data
             for (int i = 0; i < NumBitsOut; i++)
             {
                 DataOut.Process((byte)((DataArray[CurrentFrame++] > 0) ? 1 : 0)); if (CurrentFrame >= MaxBits)
                 {
                     CurrentFrame = 0;
                 }
             }
             Array.Clear(DataArray, CurrentFrame, NumBitsOut);
         }
     }
 }