-- Decompress.mesa
-- Copyright (C) Xerox Corporation 1984. All rights reserved.
-- last edited by: castillo   20-Dec-84 15:46:12


-- Defines Procedure types that can be used for decompression in cases
-- where maxSampleValue = 1 and the result is a series of scanlines of
-- [0..1] bits in contiguous memory, padded with 0's to the next doubleword 
-- there will be a separate implementation for each flavor of compression
-- Decompression occurs at the time the samples vector is needed
-- i.e. MakeSampledBlack or MaskPixel

DIRECTORY
  Environment USING [Block];
  
Decompress: DEFINITIONS =
BEGIN

  DecompressFlavor: TYPE = -- the first 3 direct from the RES standard
         {adaptive, ccitt, compressed,  -- formerly IMG
	   -- those below non-standard and 'modified'
	  huffman, read};

  DecompressInfo: TYPE = RECORD [
    scanLength: NATURAL,      -- number of pixels (in this case, bits) in scanline
    flavor:     DecompressFlavor,
    private:    LONG POINTER];   -- to impl's private data

  DecompressHandle: TYPE = LONG POINTER TO DecompressInfo;
  
  
  Error: ERROR [line: CARDINAL];
  		-- error while decompressing. The decompressor should free up
		-- the resources allocated before raising this error.


  Init: TYPE = PROCEDURE [v: Environment.Block] RETURNS [h: DecompressHandle];
     -- v points to the data bytes in a sequenceLargeVector where bytesInInt = 2
     -- and the vector may have been of a one of the compressed flavors
  
  Done: TYPE = PROCEDURE [h: DecompressHandle];

  NextLine: TYPE = PROCEDURE [h: DecompressHandle, out: LONG POINTER]
                   RETURNS [valid: BOOLEAN];
    -- caller assures "out" points to space enough for one scanline
    -- valid = TRUE up through last scan line
  


  AdaptiveInit: Init;
  AdaptiveNextLine: NextLine;
  AdaptiveDone: Done;

  CcittInit: Init;
  CcittNextLine: NextLine;
  CcittDone: Done;

  CompressedInit: Init;
  CompressedNextLine: NextLine;
  CompressedDone: Done;

  HuffmanInit: Init;
  HuffmanNextLine: NextLine;
  HuffmanDone: Done;

  ReadInit: Init;
  ReadNextLine: NextLine;
  ReadDone: Done;

  
END.

LOG
 5Nov84 - castillo.
Newlin  5-Nov-84  modify flavor names, add RETURNS to NextLine & add specific PROCS.
16Nov84 - castillo - changed Init parms, added Error.
20Dec84 - castillo - changed the LONG POINTER in Init for a Env.BLock.