1
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
74
75
76
77
78
82
86
87
88
89
90
91
92
96
97
98
99
100
101
102
103
104
105
106
107
108
109
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
135
136
137
138
139
140
/* ... */
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo));
/* ... */
GLOBAL(jvirt_barray_ptr *)
jpeg_read_coefficients (j_decompress_ptr cinfo)
{
if (cinfo->global_state == DSTATE_READY) {
transdecode_master_selection(cinfo);
cinfo->global_state = DSTATE_RDCOEFS;
}if (cinfo->global_state == DSTATE_READY) { ... }
if (cinfo->global_state == DSTATE_RDCOEFS) {
for (;;) {
int retcode;
if (cinfo->progress != NULL)
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
retcode = (*cinfo->inputctl->consume_input) (cinfo);
if (retcode == JPEG_SUSPENDED)
return NULL;
if (retcode == JPEG_REACHED_EOI)
break;
if (cinfo->progress != NULL &&
(retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
}if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { ... }
}if (cinfo->progress != NULL && (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { ... }
}for (;;) { ... }
cinfo->global_state = DSTATE_STOPPING;
}if (cinfo->global_state == DSTATE_RDCOEFS) { ... }
/* ... */
if ((cinfo->global_state == DSTATE_STOPPING ||
cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) {
return cinfo->coef->coef_arrays;
}if ((cinfo->global_state == DSTATE_STOPPING || cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) { ... }
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
return NULL;
}{ ... }
/* ... */
LOCAL(void)
transdecode_master_selection (j_decompress_ptr cinfo)
{
cinfo->buffered_image = TRUE;
jpeg_core_output_dimensions(cinfo);
if (cinfo->arith_code)
jinit_arith_decoder(cinfo);
else {
jinit_huff_decoder(cinfo);
}else { ... }
jinit_d_coef_controller(cinfo, TRUE);
(*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
(*cinfo->inputctl->start_input_pass) (cinfo);
if (cinfo->progress != NULL) {
int nscans;
if (cinfo->progressive_mode) {
nscans = 2 + 3 * cinfo->num_components;
}if (cinfo->progressive_mode) { ... } else if (cinfo->inputctl->has_multiple_scans) {
nscans = cinfo->num_components;
}else if (cinfo->inputctl->has_multiple_scans) { ... } else {
nscans = 1;
}else { ... }
cinfo->progress->pass_counter = 0L;
cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
cinfo->progress->completed_passes = 0;
cinfo->progress->total_passes = 1;
}if (cinfo->progress != NULL) { ... }
}{ ... }