Пример #1
0
 internal override VorbisFloor.PacketData UnpackPacket(DataPacket packet, int blockSize)
 {
     VorbisFloor.Floor1.PacketData1 packetData1_1 = new VorbisFloor.Floor1.PacketData1();
     packetData1_1.BlockSize = blockSize;
     VorbisFloor.Floor1.PacketData1 packetData1_2 = packetData1_1;
     if (packet.ReadBit())
     {
         try
         {
             int   index1   = 2;
             int[] numArray = ACache.Get <int>(64);
             numArray[0] = (int)packet.ReadBits(this._yBits);
             numArray[1] = (int)packet.ReadBits(this._yBits);
             for (int index2 = 0; index2 < this._partitionClass.Length; ++index2)
             {
                 int  index3 = this._partitionClass[index2];
                 int  num1   = this._classDimensions[index3];
                 int  num2   = this._classSubclasses[index3];
                 int  num3   = (1 << num2) - 1;
                 uint num4   = 0U;
                 if (num2 > 0)
                 {
                     num4 = (uint)this._classMasterbooks[index3].DecodeScalar(packet);
                 }
                 for (int index4 = 0; index4 < num1; ++index4)
                 {
                     VorbisCodebook vorbisCodebook = this._subclassBooks[index3][(long)num4 & (long)num3];
                     num4 >>= num2;
                     if (vorbisCodebook != null)
                     {
                         numArray[index1] = vorbisCodebook.DecodeScalar(packet);
                     }
                     ++index1;
                 }
             }
             packetData1_2.Posts     = numArray;
             packetData1_2.PostCount = index1;
         }
         catch (EndOfStreamException ex)
         {
         }
     }
     return((VorbisFloor.PacketData)packetData1_2);
 }
Пример #2
0
            internal override void Apply(VorbisFloor.PacketData packetData, float[] residue)
            {
                VorbisFloor.Floor1.PacketData1 data = packetData as VorbisFloor.Floor1.PacketData1;
                if (data == null)
                {
                    throw new InvalidDataException("Incorrect packet data!");
                }
                if (data.Posts == null)
                {
                    return;
                }
                bool[] buffer = this.UnwrapPosts(data);
                int    num1   = data.BlockSize / 2;
                int    x0     = 0;
                int    num2   = data.Posts[0] * this._multiplier;

                for (int index1 = 1; index1 < data.PostCount; ++index1)
                {
                    int index2 = this._sortIdx[index1];
                    if (buffer[index2])
                    {
                        int val1 = this._xList[index2];
                        int y1   = data.Posts[index2] * this._multiplier;
                        if (x0 < num1)
                        {
                            this.RenderLineMulti(x0, num2, Math.Min(val1, num1), y1, residue);
                        }
                        x0   = val1;
                        num2 = y1;
                    }
                    if (x0 >= num1)
                    {
                        break;
                    }
                }
                ACache.Return <bool>(ref buffer);
                if (x0 < num1)
                {
                    this.RenderLineMulti(x0, num2, num1, num2, residue);
                }
                ACache.Return <int>(ref data.Posts);
            }
Пример #3
0
 private bool[] UnwrapPosts(VorbisFloor.Floor1.PacketData1 data)
 {
     bool[] flagArray = ACache.Get <bool>(data.PostCount, false);
     flagArray[0] = true;
     flagArray[1] = true;
     int[] buffer = ACache.Get <int>(data.PostCount);
     buffer[0] = data.Posts[0];
     buffer[1] = data.Posts[1];
     for (int index1 = 2; index1 < data.PostCount; ++index1)
     {
         int index2 = this._lNeigh[index1];
         int index3 = this._hNeigh[index1];
         int num1   = this.RenderPoint(this._xList[index2], buffer[index2], this._xList[index3], buffer[index3], this._xList[index1]);
         int num2   = data.Posts[index1];
         int num3   = this._range - num1;
         int num4   = num1;
         int num5   = num3 >= num4 ? num4 * 2 : num3 * 2;
         if (num2 != 0)
         {
             flagArray[index2] = true;
             flagArray[index3] = true;
             flagArray[index1] = true;
             buffer[index1]    = num2 < num5 ? (num2 % 2 != 1 ? num1 + num2 / 2 : num1 - (num2 + 1) / 2) : (num3 <= num4 ? num1 - num2 + num3 - 1 : num2 - num4 + num1);
         }
         else
         {
             flagArray[index1] = false;
             buffer[index1]    = num1;
         }
     }
     for (int index = 0; index < data.PostCount; ++index)
     {
         data.Posts[index] = buffer[index];
     }
     ACache.Return <int>(ref buffer);
     return(flagArray);
 }
Пример #4
0
 internal override VorbisFloor.PacketData UnpackPacket(DataPacket packet, int blockSize)
 {
   VorbisFloor.Floor1.PacketData1 packetData1_1 = new VorbisFloor.Floor1.PacketData1();
   packetData1_1.BlockSize = blockSize;
   VorbisFloor.Floor1.PacketData1 packetData1_2 = packetData1_1;
   if (packet.ReadBit())
   {
     try
     {
       int index1 = 2;
       int[] numArray = ACache.Get<int>(64);
       numArray[0] = (int) packet.ReadBits(this._yBits);
       numArray[1] = (int) packet.ReadBits(this._yBits);
       for (int index2 = 0; index2 < this._partitionClass.Length; ++index2)
       {
         int index3 = this._partitionClass[index2];
         int num1 = this._classDimensions[index3];
         int num2 = this._classSubclasses[index3];
         int num3 = (1 << num2) - 1;
         uint num4 = 0U;
         if (num2 > 0)
           num4 = (uint) this._classMasterbooks[index3].DecodeScalar(packet);
         for (int index4 = 0; index4 < num1; ++index4)
         {
           VorbisCodebook vorbisCodebook = this._subclassBooks[index3][(long) num4 & (long) num3];
           num4 >>= num2;
           if (vorbisCodebook != null)
             numArray[index1] = vorbisCodebook.DecodeScalar(packet);
           ++index1;
         }
       }
       packetData1_2.Posts = numArray;
       packetData1_2.PostCount = index1;
     }
     catch (EndOfStreamException ex)
     {
     }
   }
   return (VorbisFloor.PacketData) packetData1_2;
 }