コード例 #1
0
ファイル: ZStream.cs プロジェクト: GodLesZ/svn-dump
		public int deflateEnd() {
			if( this.dstate == null ) {
				return -2;
			}
			int num = this.dstate.deflateEnd();
			this.dstate = null;
			return num;
		}
コード例 #2
0
ファイル: ZStream.cs プロジェクト: hakanaku2009/svn-dump
        public int deflateEnd()
        {
            if (this.dstate == null)
            {
                return(-2);
            }
            int num = this.dstate.deflateEnd();

            this.dstate = null;
            return(num);
        }
コード例 #3
0
ファイル: ZStream.cs プロジェクト: GodLesZ/svn-dump
		public int deflateInit( int level, int bits ) {
			this.dstate = new Deflate();
			return this.dstate.deflateInit( this, level, bits );
		}
コード例 #4
0
        internal void gen_bitlen(Deflate s)
        {
            int num4;

            short[] numArray  = this.dyn_tree;
            short[] numArray2 = this.stat_desc.static_tree;
            int[]   numArray3 = this.stat_desc.extra_bits;
            int     num       = this.stat_desc.extra_base;
            int     index     = this.stat_desc.max_length;
            int     num9      = 0;
            int     num6      = 0;

            while (num6 <= 15)
            {
                s.bl_count[num6] = 0;
                num6++;
            }
            numArray[(s.heap[s.heap_max] * 2) + 1] = 0;
            int num3 = s.heap_max + 1;

            while (num3 < HEAP_SIZE)
            {
                num4 = s.heap[num3];
                num6 = numArray[(numArray[(num4 * 2) + 1] * 2) + 1] + 1;
                if (num6 > index)
                {
                    num6 = index;
                    num9++;
                }
                numArray[(num4 * 2) + 1] = (short)num6;
                if (num4 <= this.max_code)
                {
                    s.bl_count[num6] = (short)(s.bl_count[num6] + 1);
                    int num7 = 0;
                    if (num4 >= num)
                    {
                        num7 = numArray3[num4 - num];
                    }
                    short num8 = numArray[num4 * 2];
                    s.opt_len += num8 * (num6 + num7);
                    if (numArray2 != null)
                    {
                        s.static_len += num8 * (numArray2[(num4 * 2) + 1] + num7);
                    }
                }
                num3++;
            }
            if (num9 != 0)
            {
                do
                {
                    num6 = index - 1;
                    while (s.bl_count[num6] == 0)
                    {
                        num6--;
                    }
                    s.bl_count[num6]     = (short)(s.bl_count[num6] - 1);
                    s.bl_count[num6 + 1] = (short)(s.bl_count[num6 + 1] + 2);
                    s.bl_count[index]    = (short)(s.bl_count[index] - 1);
                    num9 -= 2;
                }while(num9 > 0);
                for (num6 = index; num6 != 0; num6--)
                {
                    num4 = s.bl_count[num6];
                    while (num4 != 0)
                    {
                        int num5 = s.heap[--num3];
                        if (num5 <= this.max_code)
                        {
                            if (numArray[(num5 * 2) + 1] != num6)
                            {
                                s.opt_len += (num6 - numArray[(num5 * 2) + 1]) * numArray[num5 * 2];
                                numArray[(num5 * 2) + 1] = (short)num6;
                            }
                            num4--;
                        }
                    }
                }
            }
        }
コード例 #5
0
        internal void build_tree(Deflate s)
        {
            int num2;
            int num5;

            short[] tree      = this.dyn_tree;
            short[] numArray2 = this.stat_desc.static_tree;
            int     elems     = this.stat_desc.elems;
            int     num4      = -1;

            s.heap_len = 0;
            s.heap_max = HEAP_SIZE;
            for (num2 = 0; num2 < elems; num2++)
            {
                if (tree[num2 * 2] != 0)
                {
                    s.heap[++s.heap_len] = num4 = num2;
                    s.depth[num2]        = 0;
                }
                else
                {
                    tree[(num2 * 2) + 1] = 0;
                }
            }
            while (s.heap_len < 2)
            {
                num5           = s.heap[++s.heap_len] = (num4 < 2) ? ++num4 : 0;
                tree[num5 * 2] = 1;
                s.depth[num5]  = 0;
                s.opt_len--;
                if (numArray2 != null)
                {
                    s.static_len -= numArray2[(num5 * 2) + 1];
                }
            }
            this.max_code = num4;
            num2          = s.heap_len / 2;
            while (num2 >= 1)
            {
                s.pqdownheap(tree, num2);
                num2--;
            }
            num5 = elems;
            do
            {
                num2      = s.heap[1];
                s.heap[1] = s.heap[s.heap_len--];
                s.pqdownheap(tree, 1);
                int index = s.heap[1];
                s.heap[--s.heap_max] = num2;
                s.heap[--s.heap_max] = index;
                tree[num5 * 2]       = (short)(tree[num2 * 2] + tree[index * 2]);
                s.depth[num5]        = (byte)(Math.Max(s.depth[num2], s.depth[index]) + 1);
                tree[(num2 * 2) + 1] = tree[(index * 2) + 1] = (short)num5;
                s.heap[1]            = num5++;
                s.pqdownheap(tree, 1);
            }while(s.heap_len >= 2);
            s.heap[--s.heap_max] = s.heap[1];
            this.gen_bitlen(s);
            gen_codes(tree, num4, s.bl_count);
        }
コード例 #6
0
ファイル: Tree.cs プロジェクト: GodLesZ/svn-dump
		internal void gen_bitlen( Deflate s ) {
			int num4;
			short[] numArray = this.dyn_tree;
			short[] numArray2 = this.stat_desc.static_tree;
			int[] numArray3 = this.stat_desc.extra_bits;
			int num = this.stat_desc.extra_base;
			int index = this.stat_desc.max_length;
			int num9 = 0;
			int num6 = 0;
			while( num6 <= 15 ) {
				s.bl_count[ num6 ] = 0;
				num6++;
			}
			numArray[ ( s.heap[ s.heap_max ] * 2 ) + 1 ] = 0;
			int num3 = s.heap_max + 1;
			while( num3 < HEAP_SIZE ) {
				num4 = s.heap[ num3 ];
				num6 = numArray[ ( numArray[ ( num4 * 2 ) + 1 ] * 2 ) + 1 ] + 1;
				if( num6 > index ) {
					num6 = index;
					num9++;
				}
				numArray[ ( num4 * 2 ) + 1 ] = (short)num6;
				if( num4 <= this.max_code ) {
					s.bl_count[ num6 ] = (short)( s.bl_count[ num6 ] + 1 );
					int num7 = 0;
					if( num4 >= num ) {
						num7 = numArray3[ num4 - num ];
					}
					short num8 = numArray[ num4 * 2 ];
					s.opt_len += num8 * ( num6 + num7 );
					if( numArray2 != null ) {
						s.static_len += num8 * ( numArray2[ ( num4 * 2 ) + 1 ] + num7 );
					}
				}
				num3++;
			}
			if( num9 != 0 ) {
				do {
					num6 = index - 1;
					while( s.bl_count[ num6 ] == 0 ) {
						num6--;
					}
					s.bl_count[ num6 ] = (short)( s.bl_count[ num6 ] - 1 );
					s.bl_count[ num6 + 1 ] = (short)( s.bl_count[ num6 + 1 ] + 2 );
					s.bl_count[ index ] = (short)( s.bl_count[ index ] - 1 );
					num9 -= 2;
				}
				while( num9 > 0 );
				for( num6 = index; num6 != 0; num6-- ) {
					num4 = s.bl_count[ num6 ];
					while( num4 != 0 ) {
						int num5 = s.heap[ --num3 ];
						if( num5 <= this.max_code ) {
							if( numArray[ ( num5 * 2 ) + 1 ] != num6 ) {
								s.opt_len += ( num6 - numArray[ ( num5 * 2 ) + 1 ] ) * numArray[ num5 * 2 ];
								numArray[ ( num5 * 2 ) + 1 ] = (short)num6;
							}
							num4--;
						}
					}
				}
			}
		}
コード例 #7
0
ファイル: Tree.cs プロジェクト: GodLesZ/svn-dump
		internal void build_tree( Deflate s ) {
			int num2;
			int num5;
			short[] tree = this.dyn_tree;
			short[] numArray2 = this.stat_desc.static_tree;
			int elems = this.stat_desc.elems;
			int num4 = -1;
			s.heap_len = 0;
			s.heap_max = HEAP_SIZE;
			for( num2 = 0; num2 < elems; num2++ ) {
				if( tree[ num2 * 2 ] != 0 ) {
					s.heap[ ++s.heap_len ] = num4 = num2;
					s.depth[ num2 ] = 0;
				} else {
					tree[ ( num2 * 2 ) + 1 ] = 0;
				}
			}
			while( s.heap_len < 2 ) {
				num5 = s.heap[ ++s.heap_len ] = ( num4 < 2 ) ? ++num4 : 0;
				tree[ num5 * 2 ] = 1;
				s.depth[ num5 ] = 0;
				s.opt_len--;
				if( numArray2 != null ) {
					s.static_len -= numArray2[ ( num5 * 2 ) + 1 ];
				}
			}
			this.max_code = num4;
			num2 = s.heap_len / 2;
			while( num2 >= 1 ) {
				s.pqdownheap( tree, num2 );
				num2--;
			}
			num5 = elems;
			do {
				num2 = s.heap[ 1 ];
				s.heap[ 1 ] = s.heap[ s.heap_len-- ];
				s.pqdownheap( tree, 1 );
				int index = s.heap[ 1 ];
				s.heap[ --s.heap_max ] = num2;
				s.heap[ --s.heap_max ] = index;
				tree[ num5 * 2 ] = (short)( tree[ num2 * 2 ] + tree[ index * 2 ] );
				s.depth[ num5 ] = (byte)( Math.Max( s.depth[ num2 ], s.depth[ index ] ) + 1 );
				tree[ ( num2 * 2 ) + 1 ] = tree[ ( index * 2 ) + 1 ] = (short)num5;
				s.heap[ 1 ] = num5++;
				s.pqdownheap( tree, 1 );
			}
			while( s.heap_len >= 2 );
			s.heap[ --s.heap_max ] = s.heap[ 1 ];
			this.gen_bitlen( s );
			gen_codes( tree, num4, s.bl_count );
		}
コード例 #8
0
ファイル: ZStream.cs プロジェクト: hakanaku2009/svn-dump
 public int deflateInit(int level, int bits)
 {
     this.dstate = new Deflate();
     return(this.dstate.deflateInit(this, level, bits));
 }