diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcapimin.c')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcapimin.c | 576 |
1 files changed, 288 insertions, 288 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcapimin.c b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcapimin.c index 3382d91..639ce86 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcapimin.c +++ b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcapimin.c | |||
@@ -1,288 +1,288 @@ | |||
1 | /* | 1 | /* |
2 | * jcapimin.c | 2 | * jcapimin.c |
3 | * | 3 | * |
4 | * Copyright (C) 1994-1998, Thomas G. Lane. | 4 | * Copyright (C) 1994-1998, Thomas G. Lane. |
5 | * Modified 2003-2010 by Guido Vollbeding. | 5 | * Modified 2003-2010 by Guido Vollbeding. |
6 | * This file is part of the Independent JPEG Group's software. | 6 | * This file is part of the Independent JPEG Group's software. |
7 | * For conditions of distribution and use, see the accompanying README file. | 7 | * For conditions of distribution and use, see the accompanying README file. |
8 | * | 8 | * |
9 | * This file contains application interface code for the compression half | 9 | * This file contains application interface code for the compression half |
10 | * of the JPEG library. These are the "minimum" API routines that may be | 10 | * of the JPEG library. These are the "minimum" API routines that may be |
11 | * needed in either the normal full-compression case or the transcoding-only | 11 | * needed in either the normal full-compression case or the transcoding-only |
12 | * case. | 12 | * case. |
13 | * | 13 | * |
14 | * Most of the routines intended to be called directly by an application | 14 | * Most of the routines intended to be called directly by an application |
15 | * are in this file or in jcapistd.c. But also see jcparam.c for | 15 | * are in this file or in jcapistd.c. But also see jcparam.c for |
16 | * parameter-setup helper routines, jcomapi.c for routines shared by | 16 | * parameter-setup helper routines, jcomapi.c for routines shared by |
17 | * compression and decompression, and jctrans.c for the transcoding case. | 17 | * compression and decompression, and jctrans.c for the transcoding case. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define JPEG_INTERNALS | 20 | #define JPEG_INTERNALS |
21 | #include "jinclude.h" | 21 | #include "jinclude.h" |
22 | #include "jpeglib.h" | 22 | #include "jpeglib.h" |
23 | 23 | ||
24 | 24 | ||
25 | /* | 25 | /* |
26 | * Initialization of a JPEG compression object. | 26 | * Initialization of a JPEG compression object. |
27 | * The error manager must already be set up (in case memory manager fails). | 27 | * The error manager must already be set up (in case memory manager fails). |
28 | */ | 28 | */ |
29 | 29 | ||
30 | GLOBAL(void) | 30 | GLOBAL(void) |
31 | jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) | 31 | jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) |
32 | { | 32 | { |
33 | int i; | 33 | int i; |
34 | 34 | ||
35 | /* Guard against version mismatches between library and caller. */ | 35 | /* Guard against version mismatches between library and caller. */ |
36 | cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ | 36 | cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ |
37 | if (version != JPEG_LIB_VERSION) | 37 | if (version != JPEG_LIB_VERSION) |
38 | ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); | 38 | ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); |
39 | if (structsize != SIZEOF(struct jpeg_compress_struct)) | 39 | if (structsize != SIZEOF(struct jpeg_compress_struct)) |
40 | ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, | 40 | ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, |
41 | (int) SIZEOF(struct jpeg_compress_struct), (int) structsize); | 41 | (int) SIZEOF(struct jpeg_compress_struct), (int) structsize); |
42 | 42 | ||
43 | /* For debugging purposes, we zero the whole master structure. | 43 | /* For debugging purposes, we zero the whole master structure. |
44 | * But the application has already set the err pointer, and may have set | 44 | * But the application has already set the err pointer, and may have set |
45 | * client_data, so we have to save and restore those fields. | 45 | * client_data, so we have to save and restore those fields. |
46 | * Note: if application hasn't set client_data, tools like Purify may | 46 | * Note: if application hasn't set client_data, tools like Purify may |
47 | * complain here. | 47 | * complain here. |
48 | */ | 48 | */ |
49 | { | 49 | { |
50 | struct jpeg_error_mgr * err = cinfo->err; | 50 | struct jpeg_error_mgr * err = cinfo->err; |
51 | void * client_data = cinfo->client_data; /* ignore Purify complaint here */ | 51 | void * client_data = cinfo->client_data; /* ignore Purify complaint here */ |
52 | MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct)); | 52 | MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct)); |
53 | cinfo->err = err; | 53 | cinfo->err = err; |
54 | cinfo->client_data = client_data; | 54 | cinfo->client_data = client_data; |
55 | } | 55 | } |
56 | cinfo->is_decompressor = FALSE; | 56 | cinfo->is_decompressor = FALSE; |
57 | 57 | ||
58 | /* Initialize a memory manager instance for this object */ | 58 | /* Initialize a memory manager instance for this object */ |
59 | jinit_memory_mgr((j_common_ptr) cinfo); | 59 | jinit_memory_mgr((j_common_ptr) cinfo); |
60 | 60 | ||
61 | /* Zero out pointers to permanent structures. */ | 61 | /* Zero out pointers to permanent structures. */ |
62 | cinfo->progress = NULL; | 62 | cinfo->progress = NULL; |
63 | cinfo->dest = NULL; | 63 | cinfo->dest = NULL; |
64 | 64 | ||
65 | cinfo->comp_info = NULL; | 65 | cinfo->comp_info = NULL; |
66 | 66 | ||
67 | for (i = 0; i < NUM_QUANT_TBLS; i++) { | 67 | for (i = 0; i < NUM_QUANT_TBLS; i++) { |
68 | cinfo->quant_tbl_ptrs[i] = NULL; | 68 | cinfo->quant_tbl_ptrs[i] = NULL; |
69 | cinfo->q_scale_factor[i] = 100; | 69 | cinfo->q_scale_factor[i] = 100; |
70 | } | 70 | } |
71 | 71 | ||
72 | for (i = 0; i < NUM_HUFF_TBLS; i++) { | 72 | for (i = 0; i < NUM_HUFF_TBLS; i++) { |
73 | cinfo->dc_huff_tbl_ptrs[i] = NULL; | 73 | cinfo->dc_huff_tbl_ptrs[i] = NULL; |
74 | cinfo->ac_huff_tbl_ptrs[i] = NULL; | 74 | cinfo->ac_huff_tbl_ptrs[i] = NULL; |
75 | } | 75 | } |
76 | 76 | ||
77 | /* Must do it here for emit_dqt in case jpeg_write_tables is used */ | 77 | /* Must do it here for emit_dqt in case jpeg_write_tables is used */ |
78 | cinfo->block_size = DCTSIZE; | 78 | cinfo->block_size = DCTSIZE; |
79 | cinfo->natural_order = jpeg_natural_order; | 79 | cinfo->natural_order = jpeg_natural_order; |
80 | cinfo->lim_Se = DCTSIZE2-1; | 80 | cinfo->lim_Se = DCTSIZE2-1; |
81 | 81 | ||
82 | cinfo->script_space = NULL; | 82 | cinfo->script_space = NULL; |
83 | 83 | ||
84 | cinfo->input_gamma = 1.0; /* in case application forgets */ | 84 | cinfo->input_gamma = 1.0; /* in case application forgets */ |
85 | 85 | ||
86 | /* OK, I'm ready */ | 86 | /* OK, I'm ready */ |
87 | cinfo->global_state = CSTATE_START; | 87 | cinfo->global_state = CSTATE_START; |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | /* | 91 | /* |
92 | * Destruction of a JPEG compression object | 92 | * Destruction of a JPEG compression object |
93 | */ | 93 | */ |
94 | 94 | ||
95 | GLOBAL(void) | 95 | GLOBAL(void) |
96 | jpeg_destroy_compress (j_compress_ptr cinfo) | 96 | jpeg_destroy_compress (j_compress_ptr cinfo) |
97 | { | 97 | { |
98 | jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ | 98 | jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | /* | 102 | /* |
103 | * Abort processing of a JPEG compression operation, | 103 | * Abort processing of a JPEG compression operation, |
104 | * but don't destroy the object itself. | 104 | * but don't destroy the object itself. |
105 | */ | 105 | */ |
106 | 106 | ||
107 | GLOBAL(void) | 107 | GLOBAL(void) |
108 | jpeg_abort_compress (j_compress_ptr cinfo) | 108 | jpeg_abort_compress (j_compress_ptr cinfo) |
109 | { | 109 | { |
110 | jpeg_abort((j_common_ptr) cinfo); /* use common routine */ | 110 | jpeg_abort((j_common_ptr) cinfo); /* use common routine */ |
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | /* | 114 | /* |
115 | * Forcibly suppress or un-suppress all quantization and Huffman tables. | 115 | * Forcibly suppress or un-suppress all quantization and Huffman tables. |
116 | * Marks all currently defined tables as already written (if suppress) | 116 | * Marks all currently defined tables as already written (if suppress) |
117 | * or not written (if !suppress). This will control whether they get emitted | 117 | * or not written (if !suppress). This will control whether they get emitted |
118 | * by a subsequent jpeg_start_compress call. | 118 | * by a subsequent jpeg_start_compress call. |
119 | * | 119 | * |
120 | * This routine is exported for use by applications that want to produce | 120 | * This routine is exported for use by applications that want to produce |
121 | * abbreviated JPEG datastreams. It logically belongs in jcparam.c, but | 121 | * abbreviated JPEG datastreams. It logically belongs in jcparam.c, but |
122 | * since it is called by jpeg_start_compress, we put it here --- otherwise | 122 | * since it is called by jpeg_start_compress, we put it here --- otherwise |
123 | * jcparam.o would be linked whether the application used it or not. | 123 | * jcparam.o would be linked whether the application used it or not. |
124 | */ | 124 | */ |
125 | 125 | ||
126 | GLOBAL(void) | 126 | GLOBAL(void) |
127 | jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress) | 127 | jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress) |
128 | { | 128 | { |
129 | int i; | 129 | int i; |
130 | JQUANT_TBL * qtbl; | 130 | JQUANT_TBL * qtbl; |
131 | JHUFF_TBL * htbl; | 131 | JHUFF_TBL * htbl; |
132 | 132 | ||
133 | for (i = 0; i < NUM_QUANT_TBLS; i++) { | 133 | for (i = 0; i < NUM_QUANT_TBLS; i++) { |
134 | if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL) | 134 | if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL) |
135 | qtbl->sent_table = suppress; | 135 | qtbl->sent_table = suppress; |
136 | } | 136 | } |
137 | 137 | ||
138 | for (i = 0; i < NUM_HUFF_TBLS; i++) { | 138 | for (i = 0; i < NUM_HUFF_TBLS; i++) { |
139 | if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL) | 139 | if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL) |
140 | htbl->sent_table = suppress; | 140 | htbl->sent_table = suppress; |
141 | if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL) | 141 | if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL) |
142 | htbl->sent_table = suppress; | 142 | htbl->sent_table = suppress; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | /* | 147 | /* |
148 | * Finish JPEG compression. | 148 | * Finish JPEG compression. |
149 | * | 149 | * |
150 | * If a multipass operating mode was selected, this may do a great deal of | 150 | * If a multipass operating mode was selected, this may do a great deal of |
151 | * work including most of the actual output. | 151 | * work including most of the actual output. |
152 | */ | 152 | */ |
153 | 153 | ||
154 | GLOBAL(void) | 154 | GLOBAL(void) |
155 | jpeg_finish_compress (j_compress_ptr cinfo) | 155 | jpeg_finish_compress (j_compress_ptr cinfo) |
156 | { | 156 | { |
157 | JDIMENSION iMCU_row; | 157 | JDIMENSION iMCU_row; |
158 | 158 | ||
159 | if (cinfo->global_state == CSTATE_SCANNING || | 159 | if (cinfo->global_state == CSTATE_SCANNING || |
160 | cinfo->global_state == CSTATE_RAW_OK) { | 160 | cinfo->global_state == CSTATE_RAW_OK) { |
161 | /* Terminate first pass */ | 161 | /* Terminate first pass */ |
162 | if (cinfo->next_scanline < cinfo->image_height) | 162 | if (cinfo->next_scanline < cinfo->image_height) |
163 | ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); | 163 | ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); |
164 | (*cinfo->master->finish_pass) (cinfo); | 164 | (*cinfo->master->finish_pass) (cinfo); |
165 | } else if (cinfo->global_state != CSTATE_WRCOEFS) | 165 | } else if (cinfo->global_state != CSTATE_WRCOEFS) |
166 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 166 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
167 | /* Perform any remaining passes */ | 167 | /* Perform any remaining passes */ |
168 | while (! cinfo->master->is_last_pass) { | 168 | while (! cinfo->master->is_last_pass) { |
169 | (*cinfo->master->prepare_for_pass) (cinfo); | 169 | (*cinfo->master->prepare_for_pass) (cinfo); |
170 | for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) { | 170 | for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) { |
171 | if (cinfo->progress != NULL) { | 171 | if (cinfo->progress != NULL) { |
172 | cinfo->progress->pass_counter = (long) iMCU_row; | 172 | cinfo->progress->pass_counter = (long) iMCU_row; |
173 | cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows; | 173 | cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows; |
174 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); | 174 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); |
175 | } | 175 | } |
176 | /* We bypass the main controller and invoke coef controller directly; | 176 | /* We bypass the main controller and invoke coef controller directly; |
177 | * all work is being done from the coefficient buffer. | 177 | * all work is being done from the coefficient buffer. |
178 | */ | 178 | */ |
179 | if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL)) | 179 | if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL)) |
180 | ERREXIT(cinfo, JERR_CANT_SUSPEND); | 180 | ERREXIT(cinfo, JERR_CANT_SUSPEND); |
181 | } | 181 | } |
182 | (*cinfo->master->finish_pass) (cinfo); | 182 | (*cinfo->master->finish_pass) (cinfo); |
183 | } | 183 | } |
184 | /* Write EOI, do final cleanup */ | 184 | /* Write EOI, do final cleanup */ |
185 | (*cinfo->marker->write_file_trailer) (cinfo); | 185 | (*cinfo->marker->write_file_trailer) (cinfo); |
186 | (*cinfo->dest->term_destination) (cinfo); | 186 | (*cinfo->dest->term_destination) (cinfo); |
187 | /* We can use jpeg_abort to release memory and reset global_state */ | 187 | /* We can use jpeg_abort to release memory and reset global_state */ |
188 | jpeg_abort((j_common_ptr) cinfo); | 188 | jpeg_abort((j_common_ptr) cinfo); |
189 | } | 189 | } |
190 | 190 | ||
191 | 191 | ||
192 | /* | 192 | /* |
193 | * Write a special marker. | 193 | * Write a special marker. |
194 | * This is only recommended for writing COM or APPn markers. | 194 | * This is only recommended for writing COM or APPn markers. |
195 | * Must be called after jpeg_start_compress() and before | 195 | * Must be called after jpeg_start_compress() and before |
196 | * first call to jpeg_write_scanlines() or jpeg_write_raw_data(). | 196 | * first call to jpeg_write_scanlines() or jpeg_write_raw_data(). |
197 | */ | 197 | */ |
198 | 198 | ||
199 | GLOBAL(void) | 199 | GLOBAL(void) |
200 | jpeg_write_marker (j_compress_ptr cinfo, int marker, | 200 | jpeg_write_marker (j_compress_ptr cinfo, int marker, |
201 | const JOCTET *dataptr, unsigned int datalen) | 201 | const JOCTET *dataptr, unsigned int datalen) |
202 | { | 202 | { |
203 | JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val)); | 203 | JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val)); |
204 | 204 | ||
205 | if (cinfo->next_scanline != 0 || | 205 | if (cinfo->next_scanline != 0 || |
206 | (cinfo->global_state != CSTATE_SCANNING && | 206 | (cinfo->global_state != CSTATE_SCANNING && |
207 | cinfo->global_state != CSTATE_RAW_OK && | 207 | cinfo->global_state != CSTATE_RAW_OK && |
208 | cinfo->global_state != CSTATE_WRCOEFS)) | 208 | cinfo->global_state != CSTATE_WRCOEFS)) |
209 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 209 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
210 | 210 | ||
211 | (*cinfo->marker->write_marker_header) (cinfo, marker, datalen); | 211 | (*cinfo->marker->write_marker_header) (cinfo, marker, datalen); |
212 | write_marker_byte = cinfo->marker->write_marker_byte; /* copy for speed */ | 212 | write_marker_byte = cinfo->marker->write_marker_byte; /* copy for speed */ |
213 | while (datalen--) { | 213 | while (datalen--) { |
214 | (*write_marker_byte) (cinfo, *dataptr); | 214 | (*write_marker_byte) (cinfo, *dataptr); |
215 | dataptr++; | 215 | dataptr++; |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | /* Same, but piecemeal. */ | 219 | /* Same, but piecemeal. */ |
220 | 220 | ||
221 | GLOBAL(void) | 221 | GLOBAL(void) |
222 | jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen) | 222 | jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen) |
223 | { | 223 | { |
224 | if (cinfo->next_scanline != 0 || | 224 | if (cinfo->next_scanline != 0 || |
225 | (cinfo->global_state != CSTATE_SCANNING && | 225 | (cinfo->global_state != CSTATE_SCANNING && |
226 | cinfo->global_state != CSTATE_RAW_OK && | 226 | cinfo->global_state != CSTATE_RAW_OK && |
227 | cinfo->global_state != CSTATE_WRCOEFS)) | 227 | cinfo->global_state != CSTATE_WRCOEFS)) |
228 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 228 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
229 | 229 | ||
230 | (*cinfo->marker->write_marker_header) (cinfo, marker, datalen); | 230 | (*cinfo->marker->write_marker_header) (cinfo, marker, datalen); |
231 | } | 231 | } |
232 | 232 | ||
233 | GLOBAL(void) | 233 | GLOBAL(void) |
234 | jpeg_write_m_byte (j_compress_ptr cinfo, int val) | 234 | jpeg_write_m_byte (j_compress_ptr cinfo, int val) |
235 | { | 235 | { |
236 | (*cinfo->marker->write_marker_byte) (cinfo, val); | 236 | (*cinfo->marker->write_marker_byte) (cinfo, val); |
237 | } | 237 | } |
238 | 238 | ||
239 | 239 | ||
240 | /* | 240 | /* |
241 | * Alternate compression function: just write an abbreviated table file. | 241 | * Alternate compression function: just write an abbreviated table file. |
242 | * Before calling this, all parameters and a data destination must be set up. | 242 | * Before calling this, all parameters and a data destination must be set up. |
243 | * | 243 | * |
244 | * To produce a pair of files containing abbreviated tables and abbreviated | 244 | * To produce a pair of files containing abbreviated tables and abbreviated |
245 | * image data, one would proceed as follows: | 245 | * image data, one would proceed as follows: |
246 | * | 246 | * |
247 | * initialize JPEG object | 247 | * initialize JPEG object |
248 | * set JPEG parameters | 248 | * set JPEG parameters |
249 | * set destination to table file | 249 | * set destination to table file |
250 | * jpeg_write_tables(cinfo); | 250 | * jpeg_write_tables(cinfo); |
251 | * set destination to image file | 251 | * set destination to image file |
252 | * jpeg_start_compress(cinfo, FALSE); | 252 | * jpeg_start_compress(cinfo, FALSE); |
253 | * write data... | 253 | * write data... |
254 | * jpeg_finish_compress(cinfo); | 254 | * jpeg_finish_compress(cinfo); |
255 | * | 255 | * |
256 | * jpeg_write_tables has the side effect of marking all tables written | 256 | * jpeg_write_tables has the side effect of marking all tables written |
257 | * (same as jpeg_suppress_tables(..., TRUE)). Thus a subsequent start_compress | 257 | * (same as jpeg_suppress_tables(..., TRUE)). Thus a subsequent start_compress |
258 | * will not re-emit the tables unless it is passed write_all_tables=TRUE. | 258 | * will not re-emit the tables unless it is passed write_all_tables=TRUE. |
259 | */ | 259 | */ |
260 | 260 | ||
261 | GLOBAL(void) | 261 | GLOBAL(void) |
262 | jpeg_write_tables (j_compress_ptr cinfo) | 262 | jpeg_write_tables (j_compress_ptr cinfo) |
263 | { | 263 | { |
264 | if (cinfo->global_state != CSTATE_START) | 264 | if (cinfo->global_state != CSTATE_START) |
265 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 265 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
266 | 266 | ||
267 | /* (Re)initialize error mgr and destination modules */ | 267 | /* (Re)initialize error mgr and destination modules */ |
268 | (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); | 268 | (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); |
269 | (*cinfo->dest->init_destination) (cinfo); | 269 | (*cinfo->dest->init_destination) (cinfo); |
270 | /* Initialize the marker writer ... bit of a crock to do it here. */ | 270 | /* Initialize the marker writer ... bit of a crock to do it here. */ |
271 | jinit_marker_writer(cinfo); | 271 | jinit_marker_writer(cinfo); |
272 | /* Write them tables! */ | 272 | /* Write them tables! */ |
273 | (*cinfo->marker->write_tables_only) (cinfo); | 273 | (*cinfo->marker->write_tables_only) (cinfo); |
274 | /* And clean up. */ | 274 | /* And clean up. */ |
275 | (*cinfo->dest->term_destination) (cinfo); | 275 | (*cinfo->dest->term_destination) (cinfo); |
276 | /* | 276 | /* |
277 | * In library releases up through v6a, we called jpeg_abort() here to free | 277 | * In library releases up through v6a, we called jpeg_abort() here to free |
278 | * any working memory allocated by the destination manager and marker | 278 | * any working memory allocated by the destination manager and marker |
279 | * writer. Some applications had a problem with that: they allocated space | 279 | * writer. Some applications had a problem with that: they allocated space |
280 | * of their own from the library memory manager, and didn't want it to go | 280 | * of their own from the library memory manager, and didn't want it to go |
281 | * away during write_tables. So now we do nothing. This will cause a | 281 | * away during write_tables. So now we do nothing. This will cause a |
282 | * memory leak if an app calls write_tables repeatedly without doing a full | 282 | * memory leak if an app calls write_tables repeatedly without doing a full |
283 | * compression cycle or otherwise resetting the JPEG object. However, that | 283 | * compression cycle or otherwise resetting the JPEG object. However, that |
284 | * seems less bad than unexpectedly freeing memory in the normal case. | 284 | * seems less bad than unexpectedly freeing memory in the normal case. |
285 | * An app that prefers the old behavior can call jpeg_abort for itself after | 285 | * An app that prefers the old behavior can call jpeg_abort for itself after |
286 | * each call to jpeg_write_tables(). | 286 | * each call to jpeg_write_tables(). |
287 | */ | 287 | */ |
288 | } | 288 | } |