Jpeg.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * The Python Imaging Library.
  3. * $Id$
  4. *
  5. * declarations for the IJG JPEG codec interface.
  6. *
  7. * Copyright (c) 1995-2001 by Secret Labs AB
  8. * Copyright (c) 1995-1996 by Fredrik Lundh
  9. */
  10. #include "jpeglib.h"
  11. #include <setjmp.h>
  12. typedef struct {
  13. struct jpeg_error_mgr pub; /* "public" fields */
  14. jmp_buf setjmp_buffer; /* for return to caller */
  15. } JPEGERROR;
  16. /* -------------------------------------------------------------------- */
  17. /* Decoder */
  18. typedef struct {
  19. struct jpeg_source_mgr pub;
  20. int skip;
  21. } JPEGSOURCE;
  22. typedef struct {
  23. /* CONFIGURATION */
  24. /* Jpeg file mode (empty if not known) */
  25. char jpegmode[8+1];
  26. /* Converter output mode (input to the shuffler). If empty,
  27. convert conversions are disabled */
  28. char rawmode[8+1];
  29. /* If set, trade quality for speed */
  30. int draft;
  31. /* Scale factor (1, 2, 4, 8) */
  32. int scale;
  33. /* PRIVATE CONTEXT (set by decoder) */
  34. struct jpeg_decompress_struct cinfo;
  35. JPEGERROR error;
  36. JPEGSOURCE source;
  37. } JPEGSTATE;
  38. /* -------------------------------------------------------------------- */
  39. /* Encoder */
  40. typedef struct {
  41. struct jpeg_destination_mgr pub;
  42. /* might add something some other day */
  43. } JPEGDESTINATION;
  44. typedef struct {
  45. /* CONFIGURATION */
  46. /* Quality (1-100, 0 means default) */
  47. int quality;
  48. /* Progressive mode */
  49. int progressive;
  50. /* Smoothing factor (1-100, 0 means none) */
  51. int smooth;
  52. /* Optimize Huffman tables (slow) */
  53. int optimize;
  54. /* Stream type (0=full, 1=tables only, 2=image only) */
  55. int streamtype;
  56. /* DPI setting (0=square pixels, otherwise DPI) */
  57. int xdpi, ydpi;
  58. /* Chroma Subsampling (-1=default, 0=none, 1=medium, 2=high) */
  59. int subsampling;
  60. /* Converter input mode (input to the shuffler) */
  61. char rawmode[8+1];
  62. /* Custom quantization tables () */
  63. unsigned int *qtables;
  64. /* in factors of DCTSIZE2 */
  65. int qtablesLen;
  66. /* Extra data (to be injected after header) */
  67. char* extra; int extra_size;
  68. /* PRIVATE CONTEXT (set by encoder) */
  69. struct jpeg_compress_struct cinfo;
  70. JPEGERROR error;
  71. JPEGDESTINATION destination;
  72. int extra_offset;
  73. int rawExifLen; /* EXIF data length */
  74. char* rawExif; /* EXIF buffer pointer */
  75. } JPEGENCODERSTATE;