コード例 #1
0
        public void DecodePacket()
        {
            VorbisMapping.CouplingStep[] couplingSteps = _mode.Mapping.CouplingSteps;
            int num = _mode.BlockSize / 2;

            for (int num2 = couplingSteps.Length - 1; num2 >= 0; num2--)
            {
                if (_floorData[couplingSteps[num2].Angle].ExecuteChannel || _floorData[couplingSteps[num2].Magnitude].ExecuteChannel)
                {
                    float[] array  = _residue[couplingSteps[num2].Magnitude];
                    float[] array2 = _residue[couplingSteps[num2].Angle];
                    for (int i = 0; i < num; i++)
                    {
                        float num3;
                        float num4;
                        if (array[i] > 0f)
                        {
                            if (array2[i] > 0f)
                            {
                                num3 = array[i];
                                num4 = array[i] - array2[i];
                            }
                            else
                            {
                                num4 = array[i];
                                num3 = array[i] + array2[i];
                            }
                        }
                        else if (array2[i] > 0f)
                        {
                            num3 = array[i];
                            num4 = array[i] + array2[i];
                        }
                        else
                        {
                            num4 = array[i];
                            num3 = array[i] - array2[i];
                        }
                        array[i]  = num3;
                        array2[i] = num4;
                    }
                }
            }
            for (int j = 0; j < _channels; j++)
            {
                VorbisFloor.PacketData packetData = _floorData[j];
                float[] array3 = _residue[j];
                if (packetData.ExecuteChannel)
                {
                    _mode.Mapping.ChannelSubmap[j].Floor.Apply(packetData, array3);
                    Mdct.Reverse(array3, _mode.BlockSize);
                }
                else
                {
                    Array.Clear(array3, num, num);
                }
            }
        }
コード例 #2
0
            internal override void Apply(VorbisFloor.PacketData packetData, float[] residue)
            {
                VorbisFloor.Floor0.PacketData0 packetData0 = packetData as VorbisFloor.Floor0.PacketData0;
                if (packetData0 == null)
                {
                    throw new ArgumentException("Incorrect packet data!");
                }
                if ((double)packetData0.Amp <= 0.0)
                {
                    return;
                }
                float[] numArray = this._barkMaps[packetData0.BlockSize];
                int     index    = 0;

label_9:
                if (index >= packetData0.BlockSize)
                {
                    return;
                }
                double d = Math.PI * (double)numArray[index] / (double)this._bark_map_size;
                float  num1;
                int    num2;
                float  num3;
                int    num4;

                if (this._order % 2 == 1)
                {
                    num1 = (float)(1.0 - Math.Pow(Math.Cos(d), 2.0));
                    num2 = 3;
                    num3 = 0.25f;
                    num4 = 1;
                }
                else
                {
                    num1 = (float)(1.0 - Math.Cos(d));
                    num2 = 2;
                    num3 = (float)(1.0 + Math.Cos(d));
                    num4 = 2;
                }
                double num5 = (double)num1 * (double)(this._order - num2) / (4.0 * Math.Pow(Math.Cos((double)packetData0.Coeff[1]) - Math.Cos(d), 2.0) * (4.0 * Math.Pow(Math.Cos((double)packetData0.Coeff[3]) - Math.Cos(d), 2.0)) * (4.0 * Math.Pow(Math.Cos((double)packetData0.Coeff[5]) - Math.Cos(d), 2.0)));
                double num6 = (double)num3 * (double)(this._order - num4) / (4.0 * Math.Pow(Math.Cos((double)packetData0.Coeff[0]) - Math.Cos(d), 2.0) * (4.0 * Math.Pow(Math.Cos((double)packetData0.Coeff[2]) - Math.Cos(d), 2.0)) * (4.0 * Math.Pow(Math.Cos((double)packetData0.Coeff[4]) - Math.Cos(d), 2.0)));
                float  num7 = (float)Math.Exp(0.11512925 * ((double)packetData0.Amp * (double)this._ampOfs / ((double)((1 << this._ampBits) - 1) * Math.Sqrt(num5 + num6)) - (double)this._ampOfs));
                float  num8;

                do
                {
                    num8            = numArray[index];
                    residue[index] *= num7;
                    ++index;
                }while ((double)numArray[index] == (double)num8);
                goto label_9;
            }
コード例 #3
0
        private int DecodePacket(VorbisStreamDecoder.PacketDecodeInfo pdi)
        {
            VorbisMapping.CouplingStep[] couplingStepArray = pdi.Mode.Mapping.CouplingSteps;
            int num1 = pdi.Mode.BlockSize / 2;

            for (int index1 = couplingStepArray.Length - 1; index1 >= 0; --index1)
            {
                float[] numArray1 = pdi.Residue[couplingStepArray[index1].Magnitude];
                float[] numArray2 = pdi.Residue[couplingStepArray[index1].Angle];
                for (int index2 = 0; index2 < num1; ++index2)
                {
                    float num2;
                    float num3;
                    if ((double)numArray1[index2] > 0.0)
                    {
                        if ((double)numArray2[index2] > 0.0)
                        {
                            num2 = numArray1[index2];
                            num3 = numArray1[index2] - numArray2[index2];
                        }
                        else
                        {
                            num3 = numArray1[index2];
                            num2 = numArray1[index2] + numArray2[index2];
                        }
                    }
                    else if ((double)numArray2[index2] > 0.0)
                    {
                        num2 = numArray1[index2];
                        num3 = numArray1[index2] + numArray2[index2];
                    }
                    else
                    {
                        num3 = numArray1[index2];
                        num2 = numArray1[index2] - numArray2[index2];
                    }
                    numArray1[index2] = num2;
                    numArray2[index2] = num3;
                }
            }
            for (int index = 0; index < this._channels; ++index)
            {
                VorbisFloor.PacketData packetData = pdi.FloorData[index];
                float[] numArray = pdi.Residue[index];
                if (packetData.ExecuteChannel)
                {
                    pdi.Mode.Mapping.ChannelSubmap[index].Floor.Apply(packetData, numArray);
                    Mdct.Reverse(numArray);
                }
            }
            return(this.WindowSamples(pdi));
        }
コード例 #4
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);
            }
コード例 #5
0
 internal abstract void Apply(VorbisFloor.PacketData packetData, float[] residue);