2010-07-31 06:52:47 +04:00
|
|
|
/*
|
|
|
|
* The Python Imaging Library.
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* declarations for the IJG JPEG codec interface.
|
|
|
|
*
|
|
|
|
* Copyright (c) 1995-2001 by Secret Labs AB
|
|
|
|
* Copyright (c) 1995-1996 by Fredrik Lundh
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "jpeglib.h"
|
|
|
|
|
|
|
|
#include <setjmp.h>
|
|
|
|
|
|
|
|
typedef struct {
|
2021-01-03 06:17:51 +03:00
|
|
|
struct jpeg_error_mgr pub; /* "public" fields */
|
|
|
|
jmp_buf setjmp_buffer; /* for return to caller */
|
2010-07-31 06:52:47 +04:00
|
|
|
} JPEGERROR;
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
2020-05-01 15:08:57 +03:00
|
|
|
/* Decoder */
|
2010-07-31 06:52:47 +04:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
struct jpeg_source_mgr pub;
|
|
|
|
int skip;
|
|
|
|
} JPEGSOURCE;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
/* CONFIGURATION */
|
|
|
|
|
|
|
|
/* Jpeg file mode (empty if not known) */
|
2021-01-03 06:17:51 +03:00
|
|
|
char jpegmode[8 + 1];
|
2010-07-31 06:52:47 +04:00
|
|
|
|
|
|
|
/* Converter output mode (input to the shuffler). If empty,
|
|
|
|
convert conversions are disabled */
|
2021-01-03 06:17:51 +03:00
|
|
|
char rawmode[8 + 1];
|
2010-07-31 06:52:47 +04:00
|
|
|
|
|
|
|
/* If set, trade quality for speed */
|
|
|
|
int draft;
|
|
|
|
|
|
|
|
/* Scale factor (1, 2, 4, 8) */
|
|
|
|
int scale;
|
|
|
|
|
|
|
|
/* PRIVATE CONTEXT (set by decoder) */
|
|
|
|
|
|
|
|
struct jpeg_decompress_struct cinfo;
|
|
|
|
|
|
|
|
JPEGERROR error;
|
|
|
|
|
|
|
|
JPEGSOURCE source;
|
|
|
|
|
|
|
|
} JPEGSTATE;
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
2020-05-01 15:08:57 +03:00
|
|
|
/* Encoder */
|
2010-07-31 06:52:47 +04:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
struct jpeg_destination_mgr pub;
|
|
|
|
/* might add something some other day */
|
|
|
|
} JPEGDESTINATION;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
/* CONFIGURATION */
|
|
|
|
|
2020-02-21 14:05:44 +03:00
|
|
|
/* Quality (0-100, -1 means default) */
|
2010-07-31 06:52:47 +04:00
|
|
|
int quality;
|
|
|
|
|
|
|
|
/* Progressive mode */
|
|
|
|
int progressive;
|
|
|
|
|
|
|
|
/* Smoothing factor (1-100, 0 means none) */
|
|
|
|
int smooth;
|
|
|
|
|
|
|
|
/* Optimize Huffman tables (slow) */
|
|
|
|
int optimize;
|
|
|
|
|
|
|
|
/* Stream type (0=full, 1=tables only, 2=image only) */
|
|
|
|
int streamtype;
|
|
|
|
|
2016-08-31 13:12:07 +03:00
|
|
|
/* DPI setting (0=square pixels, otherwise DPI) */
|
2010-07-31 06:52:47 +04:00
|
|
|
int xdpi, ydpi;
|
|
|
|
|
|
|
|
/* Chroma Subsampling (-1=default, 0=none, 1=medium, 2=high) */
|
|
|
|
int subsampling;
|
|
|
|
|
2017-08-11 04:10:55 +03:00
|
|
|
/* Converter input mode (input to the shuffler) */
|
2021-01-03 06:17:51 +03:00
|
|
|
char rawmode[8 + 1];
|
2017-08-11 04:10:55 +03:00
|
|
|
|
2013-03-07 05:23:02 +04:00
|
|
|
/* Custom quantization tables () */
|
2014-09-23 09:30:00 +04:00
|
|
|
unsigned int *qtables;
|
|
|
|
|
|
|
|
/* in factors of DCTSIZE2 */
|
2014-09-23 09:22:30 +04:00
|
|
|
int qtablesLen;
|
2013-03-07 05:23:02 +04:00
|
|
|
|
2010-07-31 06:52:47 +04:00
|
|
|
/* Extra data (to be injected after header) */
|
2021-01-03 06:17:51 +03:00
|
|
|
char *extra;
|
|
|
|
int extra_size;
|
2010-07-31 06:52:47 +04:00
|
|
|
|
|
|
|
/* PRIVATE CONTEXT (set by encoder) */
|
|
|
|
|
|
|
|
struct jpeg_compress_struct cinfo;
|
|
|
|
|
|
|
|
JPEGERROR error;
|
|
|
|
|
|
|
|
JPEGDESTINATION destination;
|
|
|
|
|
|
|
|
int extra_offset;
|
2013-07-01 02:42:19 +04:00
|
|
|
|
2021-01-03 06:17:51 +03:00
|
|
|
size_t rawExifLen; /* EXIF data length */
|
|
|
|
char *rawExif; /* EXIF buffer pointer */
|
2010-07-31 06:52:47 +04:00
|
|
|
|
|
|
|
} JPEGENCODERSTATE;
|