home *** CD-ROM | disk | FTP | other *** search
/ Compressed Image File Formats / CompressedImageFileFormatsJohnMiano.iso / pc / Examples / c05 / inc / jfif.h next >
Encoding:
C/C++ Source or Header  |  1998-12-17  |  1.4 KB  |  58 lines

  1. #ifndef __JFIF_H
  2. #define __JFIF_H
  3. //
  4. //  Title:  JPEG Definitions and Utility Functions
  5. //
  6. //  Author:  John M. Miano  miano@colosseumbuilders.com
  7. //
  8.  
  9.  
  10. //
  11. //  JFIF Definitions
  12. //
  13. //  Author:  John M. Miano  miano@colosseumbuilders.com
  14. //
  15. //  These definitions match version 1.02 of the
  16. //  "JPEG File Interchange Format Specification" by Eric Hamilton
  17. //
  18.  
  19. #include "jpeg.h"
  20.  
  21. struct JfifHeader
  22. {
  23.   UBYTE2 length ;
  24.   UBYTE1 identifier [5] ;
  25.   UBYTE1 version [2] ;
  26.   UBYTE1 units ;
  27.   UBYTE2 xdensity ;
  28.   UBYTE2 ydensity ;
  29.   UBYTE1 xthumbnail ;
  30.   UBYTE1 ythumbnail ;
  31.   // 3 * xthumbnail * ythumbnail bytes of thumbnail data follow.
  32. } ;
  33.  
  34. struct JfifExtension
  35. {
  36.   UBYTE2 length ;
  37.   UBYTE1 identifier [5] ;
  38.   UBYTE1 extension_code ;
  39.   enum { JpegThumbnail = 0x10,
  40.          OneByteThumbnail = 0x11,
  41.          ThreeByteThumbnail = 0x13, } ;
  42.   // Extension Data follows
  43. } ;
  44.  
  45. // To implement 12-bit data the return values would have to be
  46. // at least 12 bits wide.
  47.  
  48. // Functions for YCbCr/RGB colorspace conversion
  49. JPEGSAMPLE YCbCrToR (int yy, int cb, int cr) ;
  50. JPEGSAMPLE YCbCrToG (int yy, int cb, int cr) ;
  51. JPEGSAMPLE YCbCrToB (int yy, int cb, int cr) ;
  52.  
  53. JPEGSAMPLE RGBToY (JPEGSAMPLE red, JPEGSAMPLE green, JPEGSAMPLE blue) ;
  54. JPEGSAMPLE RGBToCb (JPEGSAMPLE red, JPEGSAMPLE green, JPEGSAMPLE blue) ;
  55. JPEGSAMPLE RGBToCr (JPEGSAMPLE red, JPEGSAMPLE green, JPEGSAMPLE blue) ;
  56.  
  57. #endif
  58.