1. -- Just for fun, playing with the old Zip "Reduce" format... 
  2. -- 
  3. -- "Reduce" combines the LZ77 method with a probabilistic 
  4. -- predictor using a Markov chain. 
  5. -- 
  6. -- The format has a single block, then a single matrix, 
  7. -- for the whole data to be compressed :-(. 
  8. -- 
  9. -- NB: this compressor works in two passes, the first pass 
  10. --     serving to compute the exact optimal Markov matrix for the whole 
  11. --     data to be compressed. Hence, it is slow. However, 
  12. --     we cache the last n=LZ_cache_size bytes compressed by LZ77. 
  13. --     The result is optimal within the constraints of that format 
  14. --     (one block, poor encoding of compressed data and of the 
  15. --     compression structure, the Markov matrix itself). 
  16. -- 
  17. -- Author: G. de Montmollin, January 2009 
  18. -- 
  19.  
  20. private procedure Zip.Compress.Reduce( 
  21.   input, 
  22.   output          : Zip_Streams.Zipstream_Class; 
  23.   input_size_known: Boolean; 
  24.   input_size      : File_size_type; -- ignored if unknown 
  25.   feedback        : Feedback_proc; 
  26.   method          : Reduction_Method; 
  27.   CRC             : in out Interfaces.Unsigned_32; -- only updated here 
  28.   output_size     : out File_size_type; 
  29.   compression_ok  : out Boolean -- indicates when compressed <= uncompressed 
  30. );