97 jpeg_marker_parser_method process_APPn[16];
101 unsigned int length_limit_APPn[16];
121#define INPUT_VARS(cinfo) \
122 struct jpeg_source_mgr * datasrc = (cinfo)->src; \
123 const JOCTET * next_input_byte = datasrc->next_input_byte; \
124 size_t bytes_in_buffer = datasrc->bytes_in_buffer
127#define INPUT_SYNC(cinfo) \
128 ( datasrc->next_input_byte = next_input_byte, \
129 datasrc->bytes_in_buffer = bytes_in_buffer )
132#define INPUT_RELOAD(cinfo) \
133 ( next_input_byte = datasrc->next_input_byte, \
134 bytes_in_buffer = datasrc->bytes_in_buffer )
140#define MAKE_BYTE_AVAIL(cinfo,action) \
141 if (bytes_in_buffer == 0) { \
142 if (! (*datasrc->fill_input_buffer) (cinfo)) \
144 INPUT_RELOAD(cinfo); \
150#define INPUT_BYTE(cinfo,V,action) \
151 MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
153 V = GETJOCTET(*next_input_byte++); )
158#define INPUT_2BYTES(cinfo,V,action) \
159 MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
161 V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \
162 MAKE_BYTE_AVAIL(cinfo,action); \
164 V += GETJOCTET(*next_input_byte++); )
206 if (cinfo->marker->saw_SOI)
207 ERREXIT(cinfo, JERR_SOI_DUPLICATE);
212 cinfo->arith_dc_L[
i] = 0;
213 cinfo->arith_dc_U[
i] = 1;
214 cinfo->arith_ac_K[
i] = 5;
216 cinfo->restart_interval = 0;
222 cinfo->CCIR601_sampling =
FALSE;
224 cinfo->saw_JFIF_marker =
FALSE;
225 cinfo->JFIF_major_version = 1;
226 cinfo->JFIF_minor_version = 1;
227 cinfo->density_unit = 0;
228 cinfo->X_density = 1;
229 cinfo->Y_density = 1;
230 cinfo->saw_Adobe_marker =
FALSE;
231 cinfo->Adobe_transform = 0;
233 cinfo->marker->saw_SOI =
TRUE;
249 cinfo->is_baseline = is_baseline;
250 cinfo->progressive_mode = is_prog;
251 cinfo->arith_code = is_arith;
262 TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
263 (
int) cinfo->image_width, (
int) cinfo->image_height,
264 cinfo->num_components);
266 if (cinfo->marker->saw_SOF)
267 ERREXIT(cinfo, JERR_SOF_DUPLICATE);
272 if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
273 cinfo->num_components <= 0)
274 ERREXIT(cinfo, JERR_EMPTY_IMAGE);
276 if (
length != (cinfo->num_components * 3))
277 ERREXIT(cinfo, JERR_BAD_LENGTH);
279 if (cinfo->comp_info ==
NULL)
284 for (ci = 0; ci < cinfo->num_components; ci++) {
309 TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
314 cinfo->marker->saw_SOF =
TRUE;
330 if (! cinfo->marker->saw_SOF)
331 ERREXITS(cinfo, JERR_SOF_BEFORE,
"SOS");
340 (
n == 0 && !cinfo->progressive_mode))
342 ERREXIT(cinfo, JERR_BAD_LENGTH);
344 cinfo->comps_in_scan =
n;
348 for (
i = 0;
i <
n;
i++) {
356 for (ci = 0; ci <
i; ci++) {
357 if (
c == cinfo->cur_comp_info[ci]->component_id) {
358 c = cinfo->cur_comp_info[0]->component_id;
359 for (ci = 1; ci <
i; ci++) {
360 compptr = cinfo->cur_comp_info[ci];
368 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
374 ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID,
c);
393 cinfo->Ah = (
c >> 4) & 15;
394 cinfo->Al = (
c ) & 15;
396 TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
397 cinfo->Ah, cinfo->Al);
400 cinfo->marker->next_restart_num = 0;
403 if (
n) cinfo->input_scan_number++;
410#ifdef D_ARITH_CODING_SUPPORTED
445 ERREXIT(cinfo, JERR_BAD_LENGTH);
453#define get_dac(cinfo) skip_variable(cinfo)
479 for (
i = 1;
i <= 16;
i++) {
497 ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
506 htblptr = &cinfo->ac_huff_tbl_ptrs[
index];
508 htblptr = &cinfo->dc_huff_tbl_ptrs[
index];
514 if (*htblptr ==
NULL)
523 ERREXIT(cinfo, JERR_BAD_LENGTH);
538 const int *natural_order;
555 if (cinfo->quant_tbl_ptrs[
n] ==
NULL)
557 quant_ptr = cinfo->quant_tbl_ptrs[
n];
579 switch ((
int)
count) {
598 if (cinfo->err->trace_level >= 2) {
613 ERREXIT(cinfo, JERR_BAD_LENGTH);
631 ERREXIT(cinfo, JERR_BAD_LENGTH);
637 cinfo->restart_interval = tmp;
653 if (! cinfo->marker->saw_SOF)
654 ERREXITS(cinfo, JERR_SOF_BEFORE,
"LSE");
656 if (cinfo->num_components < 3)
goto bad;
661 ERREXIT(cinfo, JERR_BAD_LENGTH);
665 ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
669 if (tmp != 3)
goto bad;
671 if (
cid != cinfo->comp_info[1].component_id)
goto bad;
673 if (
cid != cinfo->comp_info[0].component_id)
goto bad;
675 if (
cid != cinfo->comp_info[2].component_id)
goto bad;
677 if (tmp != 0x80)
goto bad;
679 if (tmp != 0)
goto bad;
681 if (tmp != 0)
goto bad;
683 if (tmp != 0)
goto bad;
685 if (tmp != 1)
goto bad;
687 if (tmp != 0)
goto bad;
689 if (tmp != 0)
goto bad;
691 if (tmp != 1)
goto bad;
695 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
713#define APP0_DATA_LEN 14
714#define APP14_DATA_LEN 12
715#define APPN_DATA_LEN 14
735 cinfo->saw_JFIF_marker =
TRUE;
748 if (cinfo->JFIF_major_version != 1 && cinfo->JFIF_major_version != 2)
749 WARNMS2(cinfo, JWRN_JFIF_MAJOR,
750 cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
753 cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
754 cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
757 TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL,
762 TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (
int) totallen);
775 TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (
int) totallen);
778 TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (
int) totallen);
781 TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (
int) totallen);
784 TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION,
789 TRACEMS1(cinfo, 1, JTRC_APP0, (
int) totallen);
816 cinfo->saw_Adobe_marker =
TRUE;
831 unsigned int i, numtoread;
844 for (
i = 0;
i < numtoread;
i++)
849 switch (cinfo->unread_marker) {
858 ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
864 (*cinfo->src->skip_input_data) (cinfo, (
long)
length);
870#ifdef SAVE_MARKERS_SUPPORTED
878 unsigned int bytes_read, data_length;
883 if (cur_marker ==
NULL) {
900 cur_marker->next =
NULL;
902 cur_marker->original_length = (
unsigned int)
length;
903 cur_marker->data_length =
limit;
906 marker->cur_marker = cur_marker;
912 bytes_read = data_length = 0;
917 bytes_read =
marker->bytes_read;
918 data_length = cur_marker->data_length;
919 data = cur_marker->data + bytes_read;
922 while (bytes_read < data_length) {
924 marker->bytes_read = bytes_read;
928 while (bytes_read < data_length && bytes_in_buffer > 0) {
929 *
data++ = *next_input_byte++;
936 if (cur_marker !=
NULL) {
942 while (prev->next !=
NULL)
944 prev->next = cur_marker;
947 data = cur_marker->data;
948 length = cur_marker->original_length - data_length;
963 (
int) (data_length +
length));
969 (*cinfo->
src->skip_input_data) (cinfo, (
long)
length);
987 TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (
int)
length);
991 (*cinfo->src->skip_input_data) (cinfo, (
long)
length);
1020 cinfo->marker->discarded_bytes++;
1031 }
while (
c == 0xFF);
1037 cinfo->marker->discarded_bytes += 2;
1041 if (cinfo->marker->discarded_bytes != 0) {
1042 WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes,
c);
1043 cinfo->marker->discarded_bytes = 0;
1046 cinfo->unread_marker =
c;
1067 if (
c != 0xFF || c2 != (
int)
M_SOI)
1070 cinfo->unread_marker = c2;
1096 if (cinfo->unread_marker == 0) {
1097 if (! cinfo->marker->saw_SOI) {
1109 switch (cinfo->unread_marker) {
1150 ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
1156 cinfo->unread_marker = 0;
1161 cinfo->unread_marker = 0;
1206 cinfo->unread_marker - (
int)
M_APP0]) (cinfo))
1211 if (! (*((
my_marker_ptr) cinfo->marker)->process_COM) (cinfo))
1224 TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
1238 ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
1241 cinfo->unread_marker = 0;
1263 if (cinfo->unread_marker == 0) {
1268 if (cinfo->unread_marker ==
1269 ((
int)
M_RST0 + cinfo->marker->next_restart_num)) {
1271 TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
1272 cinfo->unread_marker = 0;
1276 if (! (*cinfo->src->resync_to_restart) (cinfo,
1277 cinfo->marker->next_restart_num))
1282 cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
1340 int marker = cinfo->unread_marker;
1366 cinfo->unread_marker = 0;
1372 marker = cinfo->unread_marker;
1392 cinfo->comp_info =
NULL;
1393 cinfo->input_scan_number = 0;
1394 cinfo->unread_marker = 0;
1397 marker->pub.discarded_bytes = 0;
1416 cinfo->marker = &
marker->pub;
1426 marker->length_limit_COM = 0;
1427 for (
i = 0;
i < 16;
i++) {
1429 marker->length_limit_APPn[
i] = 0;
1442#ifdef SAVE_MARKERS_SUPPORTED
1450 jpeg_marker_parser_method processor;
1463 processor = save_marker;
1477 marker->process_COM = processor;
1495 jpeg_marker_parser_method
routine)
static const WCHAR version[]
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLuint GLenum GLenum transform
GLboolean GLboolean GLboolean b
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
jpeg_alloc_quant_table(j_common_ptr cinfo)
jpeg_alloc_huff_table(j_common_ptr cinfo)
jpeg_component_info * compptr
get_sof(j_decompress_ptr cinfo, boolean is_baseline, boolean is_prog, boolean is_arith)
jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired)
#define INPUT_BYTE(cinfo, V, action)
reset_marker_reader(j_decompress_ptr cinfo)
read_restart_marker(j_decompress_ptr cinfo)
#define INPUT_2BYTES(cinfo, V, action)
get_lse(j_decompress_ptr cinfo)
#define INPUT_VARS(cinfo)
my_marker_reader * my_marker_ptr
jinit_marker_reader(j_decompress_ptr cinfo)
read_markers(j_decompress_ptr cinfo)
examine_app0(j_decompress_ptr cinfo, JOCTET FAR *data, unsigned int datalen, INT32 remaining)
jpeg_set_marker_processor(j_decompress_ptr cinfo, int marker_code, jpeg_marker_parser_method routine)
#define INPUT_SYNC(cinfo)
get_dri(j_decompress_ptr cinfo)
get_dht(j_decompress_ptr cinfo)
get_interesting_appn(j_decompress_ptr cinfo)
examine_app14(j_decompress_ptr cinfo, JOCTET FAR *data, unsigned int datalen, INT32 remaining)
get_dqt(j_decompress_ptr cinfo)
get_sos(j_decompress_ptr cinfo)
#define MAKE_BYTE_AVAIL(cinfo, action)
get_soi(j_decompress_ptr cinfo)
#define TRACEMS8(cinfo, lvl, code, p1, p2, p3, p4, p5, p6, p7, p8)
#define WARNMS2(cinfo, code, p1, p2)
#define ERREXITS(cinfo, code, str)
#define TRACEMS1(cinfo, lvl, code, p1)
#define TRACEMS(cinfo, lvl, code)
#define TRACEMS5(cinfo, lvl, code, p1, p2, p3, p4, p5)
#define TRACEMS2(cinfo, lvl, code, p1, p2)
#define TRACEMS4(cinfo, lvl, code, p1, p2, p3, p4)
#define ERREXIT1(cinfo, code, p1)
#define ERREXIT2(cinfo, code, p1, p2)
#define TRACEMS3(cinfo, lvl, code, p1, p2, p3)
#define MEMCOPY(dest, src, size)
struct jpeg_common_struct * j_common_ptr
struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr
int const JOCTET unsigned int datalen
int unsigned int length_limit
int jpeg_marker_parser_method routine
#define MAX_COMPS_IN_SCAN
const int jpeg_natural_order4[4 *4+16]
const int jpeg_natural_order[DCTSIZE2+16]
const int jpeg_natural_order2[2 *2+16]
const int jpeg_natural_order5[5 *5+16]
const int jpeg_natural_order7[7 *7+16]
const int jpeg_natural_order6[6 *6+16]
const int jpeg_natural_order3[3 *3+16]
static void skip_variable(void)
static int first_marker(void)
static int next_marker(void)
UINT16 quantval[DCTSIZE2]
jpeg_saved_marker_ptr marker_list
struct jpeg_marker_reader * marker
UINT8 arith_dc_L[NUM_ARITH_TBLS]
UINT8 arith_ac_K[NUM_ARITH_TBLS]
struct jpeg_source_mgr * src
UINT8 arith_dc_U[NUM_ARITH_TBLS]
jpeg_marker_parser_method process_COM
jpeg_saved_marker_ptr cur_marker
unsigned int length_limit_COM