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

  1. #ifndef __JPEG_H
  2. #define __JPEG_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:  JPEG Definitions and Utility Functions
  17. //
  18. //  Author:  John M. Miano  miano@colosseumbuilders.com
  19. //
  20.  
  21. #include "datatype.h"
  22. #include "jpmarker.h"
  23.  
  24. // Table B.5
  25. const int JpegMaxHuffmanTables = 4 ;
  26. // Table B.4
  27. const int MaxQuantizationTables = 4 ;
  28.  
  29. // Table B.2
  30. const int JpegMaxComponentsPerFrame = 255 ;
  31. // Table B.3
  32. const int JpegMaxComponentsPerScan = 4 ;
  33.  
  34. // Table B.2
  35. const int JpegMinSamplingFrequency = 1 ;
  36. const int JpegMaxSamplingFrequency = 4 ;
  37.  
  38.  
  39. // A.1.3
  40. const int JpegSampleWidth = 8 ;
  41. const int JpegSampleSize = JpegSampleWidth * JpegSampleWidth ;
  42.  
  43. // Functions to convert to Zig-Zag order
  44. unsigned int JpegZigZagInputOrder (unsigned int item) ;
  45. unsigned int JpegZigZagOutputOrder (unsigned int item) ;
  46.  
  47. // Datatype used to represent a sample value.
  48. typedef UBYTE1 JPEGSAMPLE ; // For 12-Bits this would be UBYTE2
  49. typedef BYTE1 JPEGCOEFFICIENT ;
  50.  
  51. const int JpegMinSampleValue = 0 ;
  52. const int JpegMaxSampleValue = 255 ; // For 12-Bits this would be 4095
  53. const int JpegMidpointSampleValue = 128 ; // For 12-Bits this 2048
  54.  
  55.  
  56. // Table B.5
  57. const unsigned int JpegMaxHuffmanCodeLength = 16 ;
  58. const unsigned int JpegMaxNumberOfHuffmanCodes = 256 ;
  59.  
  60. // B.2.3
  61. const int JpegMaxDataUnitsPerMCU = 10 ;
  62.  
  63. // Section B.2.3 Table B.3
  64. const int JpegMaxSuccessiveApproximation = 13 ;
  65.  
  66. // Section B.2.4.1 Table B.4
  67.  
  68. const int JpegMax8BitQuantizationValue = 255 ;
  69. const int JpegMinQuantizationValue = 1 ;
  70.  
  71. extern const unsigned int JpegZigZagInputOrderCodes [JpegSampleSize] ;
  72. extern const unsigned int JpegZigZagOutputOrderCodes [JpegSampleSize] ;
  73.  
  74. inline unsigned int JpegZigZagInputOrder (unsigned int item)
  75. {
  76.   return JpegZigZagInputOrderCodes [item] ;
  77. }
  78.  
  79. inline unsigned int JpegZigZagOutputOrder (unsigned int item)
  80. {
  81.   return JpegZigZagOutputOrderCodes [item] ;
  82. }
  83.  
  84.  
  85. #endif
  86.