home *** CD-ROM | disk | FTP | other *** search
/ Compressed Image File Formats / CompressedImageFileFormatsJohnMiano.iso / pc / Library / include / pnghuffd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-12-17  |  1.6 KB  |  63 lines

  1. #ifndef __PNGHUFFD_H
  2. #define __PNGHUFFD_H
  3. //
  4. // Copyright (c) 1997,1998 Colosseum Builders, Inc.
  5. // All rights reserved.
  6. //
  7. // Colosseum Builders, Inc. makes no warranty, expressed or implied
  8. // with regards to this software. It is provided as is.
  9. //
  10. // See the README.TXT file that came with this software for restrictions
  11. // on the use and redistribution of this file or send E-mail to
  12. // info@colosseumbuilders.com
  13. //
  14.  
  15. //
  16. //  Title:  PngHuffmanDecoder definition
  17. //
  18. //  Author:  John M. Miano  miano@colosseumbuilders.com
  19. //
  20. //  Description:
  21. //
  22. //    This class handles Huffman decoding for PNG images.
  23. //
  24.  
  25. #include "datatype.h"
  26. #include "pngpvt.h"
  27.  
  28. class PngDecoder ;
  29.  
  30. class PngHuffmanDecoder
  31. {
  32. public:
  33.   PngHuffmanDecoder () {}
  34.   virtual ~PngHuffmanDecoder () {}
  35.  
  36.   // DECODING FUNCTIONS
  37.   void MakeTable (unsigned int lengthcount, const unsigned int huffbits []) ;
  38.  
  39.   // This is a debugging function that writes the Huffman table
  40.   // to cout.
  41.   void Dump () const ;
  42.  
  43.   int Decode (PngDecoder &) ;
  44. private:
  45.   PngHuffmanDecoder (const PngHuffmanDecoder &) ;
  46.   PngHuffmanDecoder &operator=(const PngHuffmanDecoder &) ;
  47.  
  48.   enum { MaxHuffmanCodeLength = 15, } ;
  49.  
  50.   // Maximum Huffman code value of length N
  51.   int maxcode [MaxHuffmanCodeLength] ;
  52.   // Minimum Huffman code value of length N
  53.   int mincode [MaxHuffmanCodeLength] ;
  54.   // Index into "values" for minimum code of length N
  55.   UBYTE2 valptr [MaxHuffmanCodeLength] ;
  56.   // Huffman values
  57.   UBYTE2 huff_values [PngMaxNumberOfHuffmanCodes] ;
  58.  
  59.   unsigned int value_count ;
  60. } ;
  61.  
  62. #endif
  63.