示例#1
0
        public static void DecompressFile(string inputFile, string outputFile)
        {
            BitReader reader  = new BitReader(inputFile);
            BitWriter writer  = new BitWriter(outputFile);
            Decoder   decoder = new Decoder(reader);


            // reading loop...
            for (; ;)
            {
                uint symbol = decoder.DecodeSymbol();
                if (symbol == EOF)
                {
                    break;
                }
                writer.WriteNBits(symbol, 8);
                decoder.arithmeticModel.UpdateModel(symbol);
            }

            reader.Dispose();
            writer.WriteNBits(1, 7);
            writer.Dispose();
        }
示例#2
0
 public Coder(BitWriter writer)
 {
     Writer          = writer;
     arithmeticModel = new Model(TOTAL_SYMBOLS);
 }