Beispiel #1
0
		void ReadTrees ()
		{
			Console.WriteLine ("Building huffman trees (from position {0:x}, length {1:x}):", stream.Position, treesSize);
			byte[] tree_buf = new byte[treesSize];
			stream.Read (tree_buf, 0, (int)treesSize);

			BitStream bs = new BitStream (tree_buf);

			int tag;

			BitStream.debug = true;
#if false
			tag = bs.ReadBit ();
			if (tag == 1) {
#endif
				Console.WriteLine (" + MMap");
				mmap_Tree = new Dynamic16HuffmanTree ();
				mmap_Tree.Build (bs);
				Console.WriteLine (" + After MMap tree, read {0} bytes", bs.ReadCount);
#if false
			}
#endif
			BitStream.debug = false;

			bs.ZeroReadCount ();
#if false
			tag = bs.ReadBit ();
			if (tag == 1) {
#endif
				Console.WriteLine (" + MClr");
				mclr_Tree = new Dynamic16HuffmanTree ();
				mclr_Tree.Build (bs);
				Console.WriteLine (" + After MClr tree, read {0} bytes", bs.ReadCount);
#if false
			}

			bs.ZeroReadCount ();
			tag = bs.ReadBit ();
			if (tag == 1) {
#endif
				Console.WriteLine (" + Full");
				full_Tree = new Dynamic16HuffmanTree ();
				full_Tree.Build (bs);
				Console.WriteLine (" + After Full tree, read {0} bytes", bs.ReadCount);
#if false
			}

			bs.ZeroReadCount ();
			tag = bs.ReadBit ();
			if (tag == 1) {
#endif
				Console.WriteLine (" + Type");
				type_Tree = new Dynamic16HuffmanTree ();
				type_Tree.Build (bs);
				Console.WriteLine (" + After Type tree, read {0} bytes", bs.ReadCount);
#if false
			}
#endif

			Console.WriteLine ("done (read {0} out of {1} bytes).", bs.ReadCount, treesSize);
		}
Beispiel #2
0
        void ReadTrees()
        {
            Console.WriteLine("Building huffman trees (from position {0:x}, length {1:x}):", stream.Position, treesSize);
            byte[] tree_buf = new byte[treesSize];
            stream.Read(tree_buf, 0, (int)treesSize);

            BitStream bs = new BitStream(tree_buf);

            int tag;

            BitStream.debug = true;
#if false
            tag = bs.ReadBit();
            if (tag == 1)
            {
#endif
            Console.WriteLine(" + MMap");
            mmap_Tree = new Dynamic16HuffmanTree();
            mmap_Tree.Build(bs);
            Console.WriteLine(" + After MMap tree, read {0} bytes", bs.ReadCount);
#if false
        }
#endif
            BitStream.debug = false;

            bs.ZeroReadCount();
#if false
            tag = bs.ReadBit();
            if (tag == 1)
            {
#endif
            Console.WriteLine(" + MClr");
            mclr_Tree = new Dynamic16HuffmanTree();
            mclr_Tree.Build(bs);
            Console.WriteLine(" + After MClr tree, read {0} bytes", bs.ReadCount);
#if false
        }

        bs.ZeroReadCount();
        tag = bs.ReadBit();
        if (tag == 1)
        {
#endif
            Console.WriteLine(" + Full");
            full_Tree = new Dynamic16HuffmanTree();
            full_Tree.Build(bs);
            Console.WriteLine(" + After Full tree, read {0} bytes", bs.ReadCount);
#if false
        }

        bs.ZeroReadCount();
        tag = bs.ReadBit();
        if (tag == 1)
        {
#endif
            Console.WriteLine(" + Type");
            type_Tree = new Dynamic16HuffmanTree();
            type_Tree.Build(bs);
            Console.WriteLine(" + After Type tree, read {0} bytes", bs.ReadCount);
#if false
        }
#endif

            Console.WriteLine("done (read {0} out of {1} bytes).", bs.ReadCount, treesSize);
        }