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);
                    }
                }
            }
Esempio n. 2
0
            public void WriteTree(DeflaterHuffman.Tree blTree)
            {
                int code  = -1;
                int index = 0;

                while (index < this.numCodes)
                {
                    int num;
                    int num2;
                    int num3 = 1;
                    int num6 = this.length[index];
                    if (num6 == 0)
                    {
                        num  = 0x8a;
                        num2 = 3;
                    }
                    else
                    {
                        num  = 6;
                        num2 = 3;
                        if (code != num6)
                        {
                            blTree.WriteSymbol(num6);
                            num3 = 0;
                        }
                    }
                    code = num6;
                    index++;
                    while ((index < this.numCodes) && (code == this.length[index]))
                    {
                        index++;
                        if (++num3 >= num)
                        {
                            break;
                        }
                    }
                    if (num3 < num2)
                    {
                        while (num3-- > 0)
                        {
                            blTree.WriteSymbol(code);
                        }
                    }
                    else if (code != 0)
                    {
                        blTree.WriteSymbol(0x10);
                        this.dh.pending.WriteBits(num3 - 3, 2);
                    }
                    else if (num3 <= 10)
                    {
                        blTree.WriteSymbol(0x11);
                        this.dh.pending.WriteBits(num3 - 3, 3);
                    }
                    else
                    {
                        blTree.WriteSymbol(0x12);
                        this.dh.pending.WriteBits(num3 - 11, 7);
                    }
                }
            }
Esempio n. 3
0
            public void CalcBLFreq(DeflaterHuffman.Tree blTree)
            {
                int num4  = -1;
                int index = 0;

                while (index < this.numCodes)
                {
                    int     num;
                    int     num2;
                    short[] numArray;
                    IntPtr  ptr;
                    int     num3 = 1;
                    int     num6 = this.length[index];
                    if (num6 == 0)
                    {
                        num  = 0x8a;
                        num2 = 3;
                    }
                    else
                    {
                        num  = 6;
                        num2 = 3;
                        if (num4 != num6)
                        {
                            (numArray = blTree.freqs)[(int)(ptr = (IntPtr)num6)] = (short)(numArray[(int)ptr] + 1);
                            num3 = 0;
                        }
                    }
                    num4 = num6;
                    index++;
                    while ((index < this.numCodes) && (num4 == this.length[index]))
                    {
                        index++;
                        if (++num3 >= num)
                        {
                            break;
                        }
                    }
                    if (num3 < num2)
                    {
                        (numArray = blTree.freqs)[(int)(ptr = (IntPtr)num4)] = (short)(numArray[(int)ptr] + ((short)num3));
                    }
                    else
                    {
                        if (num4 != 0)
                        {
                            (numArray = blTree.freqs)[(int)(ptr = (IntPtr)DeflaterHuffman.REP_3_6)] = (short)(numArray[(int)ptr] + 1);
                            continue;
                        }
                        if (num3 <= 10)
                        {
                            (numArray = blTree.freqs)[(int)(ptr = (IntPtr)DeflaterHuffman.REP_3_10)] = (short)(numArray[(int)ptr] + 1);
                            continue;
                        }
                        (numArray = blTree.freqs)[(int)(ptr = (IntPtr)DeflaterHuffman.REP_11_138)] = (short)(numArray[(int)ptr] + 1);
                    }
                }
            }
 public DeflaterHuffman(DeflaterPending pending)
 {
     this.pending     = pending;
     this.literalTree = new DeflaterHuffman.Tree(this, 286, 257, 15);
     this.distTree    = new DeflaterHuffman.Tree(this, 30, 1, 15);
     this.blTree      = new DeflaterHuffman.Tree(this, 19, 4, 7);
     this.d_buf       = new short[16384];
     this.l_buf       = new byte[16384];
 }
Esempio n. 5
0
            public void CalcBLFreq(DeflaterHuffman.Tree blTree)
            {
                int index = -1;
                int num5  = 0;

                while (num5 < this.numCodes)
                {
                    int num;
                    int num2;
                    int num3 = 1;
                    int num6 = this.length[num5];
                    if (num6 == 0)
                    {
                        num  = 0x8a;
                        num2 = 3;
                    }
                    else
                    {
                        num  = 6;
                        num2 = 3;
                        if (index != num6)
                        {
                            blTree.freqs[num6] = (short)(blTree.freqs[num6] + 1);
                            num3 = 0;
                        }
                    }
                    index = num6;
                    num5++;
                    while ((num5 < this.numCodes) && (index == this.length[num5]))
                    {
                        num5++;
                        if (++num3 >= num)
                        {
                            break;
                        }
                    }
                    if (num3 < num2)
                    {
                        blTree.freqs[index] = (short)(blTree.freqs[index] + ((short)num3));
                    }
                    else
                    {
                        if (index != 0)
                        {
                            blTree.freqs[0x10] = (short)(blTree.freqs[0x10] + 1);
                            continue;
                        }
                        if (num3 <= 10)
                        {
                            blTree.freqs[0x11] = (short)(blTree.freqs[0x11] + 1);
                            continue;
                        }
                        blTree.freqs[0x12] = (short)(blTree.freqs[0x12] + 1);
                    }
                }
            }
            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[] expr_44_cp_0 = blTree.freqs;
                            int     expr_44_cp_1 = num3;
                            expr_44_cp_0[expr_44_cp_1] += 1;
                            num2 = 0;
                        }
                    }
                    num = num3;
                    i++;
                    while (i < this.numCodes && num == (int)this.length[i])
                    {
                        i++;
                        if (++num2 >= num4)
                        {
                            break;
                        }
                    }
                    if (num2 < num5)
                    {
                        short[] expr_9F_cp_0 = blTree.freqs;
                        int     expr_9F_cp_1 = num;
                        expr_9F_cp_0[expr_9F_cp_1] += (short)num2;
                    }
                    else if (num != 0)
                    {
                        short[] expr_BE_cp_0 = blTree.freqs;
                        int     expr_BE_cp_1 = 16;
                        expr_BE_cp_0[expr_BE_cp_1] += 1;
                    }
                    else if (num2 <= 10)
                    {
                        short[] expr_DE_cp_0 = blTree.freqs;
                        int     expr_DE_cp_1 = 17;
                        expr_DE_cp_0[expr_DE_cp_1] += 1;
                    }
                    else
                    {
                        short[] expr_F6_cp_0 = blTree.freqs;
                        int     expr_F6_cp_1 = 18;
                        expr_F6_cp_0[expr_F6_cp_1] += 1;
                    }
                }
            }
Esempio n. 7
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;
                    }
                }
            }
Esempio n. 8
0
            public unsafe void CalcBLFreq(DeflaterHuffman.Tree blTree)
            {
                int index = -1;
                int num5  = 0;

                while (num5 < this.numCodes)
                {
                    int num;
                    int num2;
                    int num3 = 1;
                    int num6 = this.length[num5];
                    if (num6 == 0)
                    {
                        num  = 0x8a;
                        num2 = 3;
                    }
                    else
                    {
                        num  = 6;
                        num2 = 3;
                        if (index != num6)
                        {
                            short *numPtr1 = &(blTree.freqs[num6]);
                            numPtr1[0] = (short)(numPtr1[0] + 1);
                            num3       = 0;
                        }
                    }
                    index = num6;
                    num5++;
                    while (true)
                    {
                        if ((num5 < this.numCodes) && (index == this.length[num5]))
                        {
                            num5++;
                            if (++num3 < num)
                            {
                                continue;
                            }
                        }
                        if (num3 < num2)
                        {
                            short *numPtr2 = &(blTree.freqs[index]);
                            numPtr2[0] = (short)(numPtr2[0] + ((short)num3));
                        }
                        else if (index != 0)
                        {
                            short *numPtr3 = &(blTree.freqs[0x10]);
                            numPtr3[0] = (short)(numPtr3[0] + 1);
                        }
                        else if (num3 <= 10)
                        {
                            short *numPtr4 = &(blTree.freqs[0x11]);
                            numPtr4[0] = (short)(numPtr4[0] + 1);
                        }
                        else
                        {
                            short *numPtr5 = &(blTree.freqs[0x12]);
                            numPtr5[0] = (short)(numPtr5[0] + 1);
                        }
                        break;
                    }
                }
            }