예제 #1
0
            public void WriteTree(DeflaterHuffman.Tree blTree)
            {
                int num = -1;
                int i   = 0;

                while (i < this.numCodes)
                {
                    int num2 = 1;
                    int num3 = (int)this.length[i];
                    int num4;
                    int num5;
                    if (num3 == 0)
                    {
                        num4 = 138;
                        num5 = 3;
                    }
                    else
                    {
                        num4 = 6;
                        num5 = 3;
                        if (num != num3)
                        {
                            blTree.WriteSymbol(num3);
                            num2 = 0;
                        }
                    }
                    num = num3;
                    i++;
                    while (i < this.numCodes && num == (int)this.length[i])
                    {
                        i++;
                        if (++num2 >= num4)
                        {
                            break;
                        }
                    }
                    if (num2 < num5)
                    {
                        while (num2-- > 0)
                        {
                            blTree.WriteSymbol(num);
                        }
                    }
                    else if (num != 0)
                    {
                        blTree.WriteSymbol(16);
                        this.dh.pending.WriteBits(num2 - 3, 2);
                    }
                    else if (num2 <= 10)
                    {
                        blTree.WriteSymbol(17);
                        this.dh.pending.WriteBits(num2 - 3, 3);
                    }
                    else
                    {
                        blTree.WriteSymbol(18);
                        this.dh.pending.WriteBits(num2 - 11, 7);
                    }
                }
            }
예제 #2
0
            public void CalcBLFreq(DeflaterHuffman.Tree blTree)
            {
                int num = -1;
                int i   = 0;

                while (i < this.numCodes)
                {
                    int num2 = 1;
                    int num3 = (int)this.length[i];
                    int num4;
                    int num5;
                    if (num3 == 0)
                    {
                        num4 = 138;
                        num5 = 3;
                    }
                    else
                    {
                        num4 = 6;
                        num5 = 3;
                        if (num != num3)
                        {
                            short[] array = blTree.freqs;
                            int     num6  = num3;
                            array[num6] += 1;
                            num2         = 0;
                        }
                    }
                    num = num3;
                    i++;
                    while (i < this.numCodes && num == (int)this.length[i])
                    {
                        i++;
                        if (++num2 >= num4)
                        {
                            break;
                        }
                    }
                    if (num2 < num5)
                    {
                        short[] array2 = blTree.freqs;
                        int     num7   = num;
                        array2[num7] += (short)num2;
                    }
                    else if (num != 0)
                    {
                        short[] array3 = blTree.freqs;
                        int     num8   = 16;
                        array3[num8] += 1;
                    }
                    else if (num2 <= 10)
                    {
                        short[] array4 = blTree.freqs;
                        int     num9   = 17;
                        array4[num9] += 1;
                    }
                    else
                    {
                        short[] array5 = blTree.freqs;
                        int     num10  = 18;
                        array5[num10] += 1;
                    }
                }
            }