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(); }
public Coder(BitWriter writer) { Writer = writer; arithmeticModel = new Model(TOTAL_SYMBOLS); }