source: trunk/src/3rdparty/libmng/libmng_jpeg.c

Last change on this file was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 43.0 KB
Line 
1/* ************************************************************************** */
2/* * For conditions of distribution and use, * */
3/* * see copyright notice in libmng.h * */
4/* ************************************************************************** */
5/* * * */
6/* * project : libmng * */
7/* * file : libmng_jpeg.c copyright (c) 2000 G.Juyn * */
8/* * version : 1.0.4 * */
9/* * * */
10/* * purpose : JPEG library interface (implementation) * */
11/* * * */
12/* * author : G.Juyn * */
13/* * web : http://www.3-t.com * */
14/* * email : mailto:info@3-t.com * */
15/* * * */
16/* * comment : implementation of the JPEG library interface * */
17/* * * */
18/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
19/* * - changed strict-ANSI stuff * */
20/* * * */
21/* * 0.5.2 - 05/22/2000 - G.Juyn * */
22/* * - implemented all the JNG routines * */
23/* * * */
24/* * 0.5.3 - 06/17/2000 - G.Juyn * */
25/* * - added tracing of JPEG calls * */
26/* * 0.5.3 - 06/24/2000 - G.Juyn * */
27/* * - fixed inclusion of IJG read/write code * */
28/* * 0.5.3 - 06/29/2000 - G.Juyn * */
29/* * - fixed some 64-bit warnings * */
30/* * * */
31/* * 0.9.2 - 08/05/2000 - G.Juyn * */
32/* * - changed file-prefixes * */
33/* * * */
34/* * 0.9.3 - 10/16/2000 - G.Juyn * */
35/* * - added support for JDAA * */
36/* * * */
37/* * 1.0.1 - 04/19/2001 - G.Juyn * */
38/* * - added export of JPEG functions for DLL * */
39/* * 1.0.1 - 04/22/2001 - G.Juyn * */
40/* * - fixed memory-leaks (Thanks Gregg!) * */
41/* * * */
42/* * 1.0.4 - 06/22/2002 - G.Juyn * */
43/* * - B526138 - returned IJGSRC6B calling convention to * */
44/* * default for MSVC * */
45/* * * */
46/* ************************************************************************** */
47
48#include "libmng.h"
49#include "libmng_data.h"
50#include "libmng_error.h"
51#include "libmng_trace.h"
52#ifdef __BORLANDC__
53#pragma hdrstop
54#endif
55#include "libmng_memory.h"
56#include "libmng_pixels.h"
57#include "libmng_jpeg.h"
58
59#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
60#pragma option -A /* force ANSI-C */
61#endif
62
63/* ************************************************************************** */
64
65#ifdef MNG_INCLUDE_JNG
66
67/* ************************************************************************** */
68/* * * */
69/* * Local IJG callback routines (source-manager, error-manager and such) * */
70/* * * */
71/* ************************************************************************** */
72
73#ifdef MNG_INCLUDE_IJG6B
74
75/* ************************************************************************** */
76
77#ifdef MNG_INCLUDE_JNG_READ
78#ifdef MNG_DEFINE_JPEG_STDCALL
79void MNG_DECL mng_init_source (j_decompress_ptr cinfo)
80#else
81void mng_init_source (j_decompress_ptr cinfo)
82#endif
83{
84 return; /* nothing needed */
85}
86#endif /* MNG_INCLUDE_JNG_READ */
87
88/* ************************************************************************** */
89
90#ifdef MNG_INCLUDE_JNG_READ
91#ifdef MNG_DEFINE_JPEG_STDCALL
92boolean MNG_DECL mng_fill_input_buffer (j_decompress_ptr cinfo)
93#else
94boolean mng_fill_input_buffer (j_decompress_ptr cinfo)
95#endif
96{
97 return FALSE; /* force IJG routine to return to caller */
98}
99#endif /* MNG_INCLUDE_JNG_READ */
100
101/* ************************************************************************** */
102
103#ifdef MNG_INCLUDE_JNG_READ
104#ifdef MNG_DEFINE_JPEG_STDCALL
105void MNG_DECL mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
106#else
107void mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
108#endif
109{
110 if (num_bytes > 0) /* ignore fony calls */
111 { /* address my generic structure */
112 mng_datap pData = (mng_datap)cinfo->client_data;
113 /* address source manager */
114 mngjpeg_sourcep pSrc = pData->pJPEGdinfo->src;
115 /* problem scenario ? */
116 if (pSrc->bytes_in_buffer < (size_t)num_bytes)
117 { /* tell the boss we need to skip some data! */
118 pData->iJPEGtoskip = (mng_uint32)((size_t)num_bytes - pSrc->bytes_in_buffer);
119
120 pSrc->bytes_in_buffer = 0; /* let the JPEG lib suspend */
121 pSrc->next_input_byte = MNG_NULL;
122 }
123 else
124 { /* simply advance in the buffer */
125 pSrc->bytes_in_buffer -= num_bytes;
126 pSrc->next_input_byte += num_bytes;
127 }
128 }
129
130 return;
131}
132#endif /* MNG_INCLUDE_JNG_READ */
133
134/* ************************************************************************** */
135
136#ifdef MNG_INCLUDE_JNG_READ
137#ifdef MNG_DEFINE_JPEG_STDCALL
138void MNG_DECL mng_skip_input_data2 (j_decompress_ptr cinfo, long num_bytes)
139#else
140void mng_skip_input_data2 (j_decompress_ptr cinfo, long num_bytes)
141#endif
142{
143 if (num_bytes > 0) /* ignore fony calls */
144 { /* address my generic structure */
145 mng_datap pData = (mng_datap)cinfo->client_data;
146 /* address source manager */
147 mngjpeg_sourcep pSrc = pData->pJPEGdinfo2->src;
148 /* problem scenario ? */
149 if (pSrc->bytes_in_buffer < (size_t)num_bytes)
150 { /* tell the boss we need to skip some data! */
151 pData->iJPEGtoskip2 = (mng_uint32)((size_t)num_bytes - pSrc->bytes_in_buffer);
152
153 pSrc->bytes_in_buffer = 0; /* let the JPEG lib suspend */
154 pSrc->next_input_byte = MNG_NULL;
155 }
156 else
157 { /* simply advance in the buffer */
158 pSrc->bytes_in_buffer -= num_bytes;
159 pSrc->next_input_byte += num_bytes;
160 }
161 }
162
163 return;
164}
165#endif /* MNG_INCLUDE_JNG_READ */
166
167/* ************************************************************************** */
168
169#ifdef MNG_INCLUDE_JNG_READ
170#ifdef MNG_DEFINE_JPEG_STDCALL
171void MNG_DECL mng_term_source (j_decompress_ptr cinfo)
172#else
173void mng_term_source (j_decompress_ptr cinfo)
174#endif
175{
176 return; /* nothing needed */
177}
178#endif /* MNG_INCLUDE_JNG_READ */
179
180/* ************************************************************************** */
181
182#ifdef MNG_USE_SETJMP
183#ifdef MNG_DEFINE_JPEG_STDCALL
184void MNG_DECL mng_error_exit (j_common_ptr cinfo)
185#else
186void mng_error_exit (j_common_ptr cinfo)
187#endif
188{ /* address my generic structure */
189 mng_datap pData = (mng_datap)cinfo->client_data;
190
191#ifdef MNG_ERROR_TELLTALE /* fill the message text ??? */
192 (*cinfo->err->output_message) (cinfo);
193#endif
194 /* return to the point of no return... */
195 longjmp (pData->sErrorbuf, cinfo->err->msg_code);
196}
197#endif /* MNG_USE_SETJMP */
198
199/* ************************************************************************** */
200
201#ifdef MNG_USE_SETJMP
202#ifdef MNG_DEFINE_JPEG_STDCALL
203void MNG_DECL mng_output_message (j_common_ptr cinfo)
204#else
205void mng_output_message (j_common_ptr cinfo)
206#endif
207{
208 return; /* just do nothing ! */
209}
210#endif /* MNG_USE_SETJMP */
211
212/* ************************************************************************** */
213
214#endif /* MNG_INCLUDE_IJG6B */
215
216/* ************************************************************************** */
217/* * * */
218/* * Global JPEG routines * */
219/* * * */
220/* ************************************************************************** */
221
222mng_retcode mngjpeg_initialize (mng_datap pData)
223{
224#ifdef MNG_SUPPORT_TRACE
225 MNG_TRACE (pData, MNG_FN_JPEG_INITIALIZE, MNG_LC_START)
226#endif
227 /* allocate space for JPEG structures if necessary */
228#ifdef MNG_INCLUDE_JNG_READ
229 if (pData->pJPEGderr == MNG_NULL)
230 MNG_ALLOC (pData, pData->pJPEGderr, sizeof (mngjpeg_error ))
231 if (pData->pJPEGdsrc == MNG_NULL)
232 MNG_ALLOC (pData, pData->pJPEGdsrc, sizeof (mngjpeg_source))
233 if (pData->pJPEGdinfo == MNG_NULL)
234 MNG_ALLOC (pData, pData->pJPEGdinfo, sizeof (mngjpeg_decomp))
235 /* enable reverse addressing */
236 pData->pJPEGdinfo->client_data = pData;
237
238 if (pData->pJPEGderr2 == MNG_NULL)
239 MNG_ALLOC (pData, pData->pJPEGderr2, sizeof (mngjpeg_error ))
240 if (pData->pJPEGdsrc2 == MNG_NULL)
241 MNG_ALLOC (pData, pData->pJPEGdsrc2, sizeof (mngjpeg_source))
242 if (pData->pJPEGdinfo2 == MNG_NULL)
243 MNG_ALLOC (pData, pData->pJPEGdinfo2, sizeof (mngjpeg_decomp))
244 /* enable reverse addressing */
245 pData->pJPEGdinfo2->client_data = pData;
246#endif
247
248#ifdef MNG_INCLUDE_JNG_WRITE
249 if (pData->pJPEGcerr == MNG_NULL)
250 MNG_ALLOC (pData, pData->pJPEGcerr, sizeof (mngjpeg_error ))
251 if (pData->pJPEGcinfo == MNG_NULL)
252 MNG_ALLOC (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp ))
253 /* enable reverse addressing */
254 pData->pJPEGcinfo->client_data = pData;
255#endif
256
257 if (pData->pJPEGbuf == MNG_NULL) /* initialize temporary buffers */
258 {
259 pData->iJPEGbufmax = MNG_JPEG_MAXBUF;
260 MNG_ALLOC (pData, pData->pJPEGbuf, pData->iJPEGbufmax)
261 }
262
263 if (pData->pJPEGbuf2 == MNG_NULL)
264 {
265 pData->iJPEGbufmax2 = MNG_JPEG_MAXBUF;
266 MNG_ALLOC (pData, pData->pJPEGbuf2, pData->iJPEGbufmax2)
267 }
268
269 pData->pJPEGcurrent = pData->pJPEGbuf;
270 pData->iJPEGbufremain = 0;
271 pData->pJPEGrow = MNG_NULL;
272 pData->iJPEGrowlen = 0;
273 pData->iJPEGtoskip = 0;
274
275 pData->pJPEGcurrent2 = pData->pJPEGbuf2;
276 pData->iJPEGbufremain2 = 0;
277 pData->pJPEGrow2 = MNG_NULL;
278 pData->iJPEGrowlen2 = 0;
279 pData->iJPEGtoskip2 = 0;
280 /* not doing anything yet ! */
281 pData->bJPEGcompress = MNG_FALSE;
282
283 pData->bJPEGdecompress = MNG_FALSE;
284 pData->bJPEGhasheader = MNG_FALSE;
285 pData->bJPEGdecostarted = MNG_FALSE;
286 pData->bJPEGscanstarted = MNG_FALSE;
287
288 pData->bJPEGdecompress2 = MNG_FALSE;
289 pData->bJPEGhasheader2 = MNG_FALSE;
290 pData->bJPEGdecostarted2 = MNG_FALSE;
291 pData->bJPEGscanstarted2 = MNG_FALSE;
292
293 pData->iJPEGrow = 0; /* zero input/output lines */
294 pData->iJPEGalpharow = 0;
295 pData->iJPEGrgbrow = 0;
296 pData->iJPEGdisprow = 0;
297
298#ifdef MNG_SUPPORT_TRACE
299 MNG_TRACE (pData, MNG_FN_JPEG_INITIALIZE, MNG_LC_END)
300#endif
301
302 return MNG_NOERROR;
303}
304
305/* ************************************************************************** */
306
307mng_retcode mngjpeg_cleanup (mng_datap pData)
308{
309#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
310 mng_retcode iRetcode;
311#endif
312
313#ifdef MNG_SUPPORT_TRACE
314 MNG_TRACE (pData, MNG_FN_JPEG_CLEANUP, MNG_LC_START)
315#endif
316
317#ifdef MNG_INCLUDE_IJG6B
318#ifdef MNG_USE_SETJMP
319 iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */
320 if (iRetcode != 0) /* got here from longjmp ? */
321 MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
322#endif
323
324#ifdef MNG_INCLUDE_JNG_READ /* still decompressing something ? */
325 if (pData->bJPEGdecompress)
326 jpeg_destroy_decompress (pData->pJPEGdinfo);
327 if (pData->bJPEGdecompress2)
328 jpeg_destroy_decompress (pData->pJPEGdinfo2);
329#endif
330
331#ifdef MNG_INCLUDE_JNG_WRITE
332 if (pData->bJPEGcompress) /* still compressing something ? */
333 jpeg_destroy_compress (pData->pJPEGcinfo);
334#endif
335
336#endif /* MNG_INCLUDE_IJG6B */
337 /* cleanup temporary buffers */
338 MNG_FREE (pData, pData->pJPEGbuf2, pData->iJPEGbufmax2)
339 MNG_FREE (pData, pData->pJPEGbuf, pData->iJPEGbufmax)
340 /* cleanup space for JPEG structures */
341#ifdef MNG_INCLUDE_JNG_WRITE
342 MNG_FREE (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp ))
343 MNG_FREE (pData, pData->pJPEGcerr, sizeof (mngjpeg_error ))
344#endif
345
346#ifdef MNG_INCLUDE_JNG_READ
347 MNG_FREE (pData, pData->pJPEGdinfo, sizeof (mngjpeg_decomp))
348 MNG_FREE (pData, pData->pJPEGdsrc, sizeof (mngjpeg_source))
349 MNG_FREE (pData, pData->pJPEGderr, sizeof (mngjpeg_error ))
350 MNG_FREE (pData, pData->pJPEGdinfo2, sizeof (mngjpeg_decomp))
351 MNG_FREE (pData, pData->pJPEGdsrc2, sizeof (mngjpeg_source))
352 MNG_FREE (pData, pData->pJPEGderr2, sizeof (mngjpeg_error ))
353#endif
354
355 MNG_FREE (pData, pData->pJPEGrow2, pData->iJPEGrowlen2)
356 MNG_FREE (pData, pData->pJPEGrow, pData->iJPEGrowlen)
357 /* whatever we were doing ... */
358 /* we don't anymore ... */
359 pData->bJPEGcompress = MNG_FALSE;
360
361 pData->bJPEGdecompress = MNG_FALSE;
362 pData->bJPEGhasheader = MNG_FALSE;
363 pData->bJPEGdecostarted = MNG_FALSE;
364 pData->bJPEGscanstarted = MNG_FALSE;
365
366 pData->bJPEGdecompress2 = MNG_FALSE;
367 pData->bJPEGhasheader2 = MNG_FALSE;
368 pData->bJPEGdecostarted2 = MNG_FALSE;
369 pData->bJPEGscanstarted2 = MNG_FALSE;
370
371#ifdef MNG_SUPPORT_TRACE
372 MNG_TRACE (pData, MNG_FN_JPEG_CLEANUP, MNG_LC_END)
373#endif
374
375 return MNG_NOERROR;
376}
377
378/* ************************************************************************** */
379/* * * */
380/* * JPEG decompression routines (JDAT) * */
381/* * * */
382/* ************************************************************************** */
383
384#ifdef MNG_INCLUDE_JNG_READ
385mng_retcode mngjpeg_decompressinit (mng_datap pData)
386{
387#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
388 mng_retcode iRetcode;
389#endif
390
391#ifdef MNG_SUPPORT_TRACE
392 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_START)
393#endif
394
395#ifdef MNG_INCLUDE_IJG6B
396 /* allocate and initialize a JPEG decompression object */
397 pData->pJPEGdinfo->err = jpeg_std_error (pData->pJPEGderr);
398
399#ifdef MNG_USE_SETJMP /* setup local JPEG error-routines */
400 pData->pJPEGderr->error_exit = mng_error_exit;
401 pData->pJPEGderr->output_message = mng_output_message;
402
403 iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */
404 if (iRetcode != 0) /* got here from longjmp ? */
405 MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
406#endif /* MNG_USE_SETJMP */
407
408 /* allocate and initialize a JPEG decompression object (continued) */
409#ifdef MNG_SUPPORT_TRACE
410 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_JPEG_CREATE_DECOMPRESS)
411#endif
412 jpeg_create_decompress (pData->pJPEGdinfo);
413
414 pData->bJPEGdecompress = MNG_TRUE; /* indicate it's initialized */
415
416 /* specify the source of the compressed data (eg, a file) */
417 /* no, not a file; we have buffered input */
418 pData->pJPEGdinfo->src = pData->pJPEGdsrc;
419 /* use the default handler */
420 pData->pJPEGdinfo->src->resync_to_restart = jpeg_resync_to_restart;
421 /* setup local source routine & parms */
422 pData->pJPEGdinfo->src->init_source = mng_init_source;
423 pData->pJPEGdinfo->src->fill_input_buffer = mng_fill_input_buffer;
424 pData->pJPEGdinfo->src->skip_input_data = mng_skip_input_data;
425 pData->pJPEGdinfo->src->term_source = mng_term_source;
426 pData->pJPEGdinfo->src->next_input_byte = pData->pJPEGcurrent;
427 pData->pJPEGdinfo->src->bytes_in_buffer = pData->iJPEGbufremain;
428
429#endif /* MNG_INCLUDE_IJG6B */
430
431#ifdef MNG_SUPPORT_TRACE
432 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_END)
433#endif
434
435 return MNG_NOERROR;
436}
437#endif /* MNG_INCLUDE_JNG_READ */
438
439/* ************************************************************************** */
440
441#ifdef MNG_INCLUDE_JNG_READ
442mng_retcode mngjpeg_decompressdata (mng_datap pData,
443 mng_uint32 iRawsize,
444 mng_uint8p pRawdata)
445{
446 mng_retcode iRetcode;
447 mng_uint32 iRemain;
448 mng_uint8p pWork;
449
450#ifdef MNG_SUPPORT_TRACE
451 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_START)
452#endif
453
454#if defined (MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
455 iRetcode = setjmp (pData->sErrorbuf);/* initialize local JPEG error-recovery */
456 if (iRetcode != 0) /* got here from longjmp ? */
457 MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
458#endif
459
460 pWork = pRawdata;
461 iRemain = iRawsize;
462
463 if (pData->iJPEGtoskip) /* JPEG-lib told us to skip some more data ? */
464 {
465 if (iRemain > pData->iJPEGtoskip) /* enough data in this buffer ? */
466 {
467 iRemain -= pData->iJPEGtoskip; /* skip enough to access the next byte */
468 pWork += pData->iJPEGtoskip;
469
470 pData->iJPEGtoskip = 0; /* no more to skip then */
471 }
472 else
473 {
474 pData->iJPEGtoskip -= iRemain; /* skip all data in the buffer */
475 iRemain = 0; /* and indicate this accordingly */
476 }
477 /* the skip set current-pointer to NULL ! */
478 pData->pJPEGcurrent = pData->pJPEGbuf;
479 }
480
481 while (iRemain) /* repeat until no more input-bytes */
482 { /* need to shift anything ? */
483 if ((pData->pJPEGcurrent > pData->pJPEGbuf) &&
484 (pData->pJPEGcurrent - pData->pJPEGbuf + pData->iJPEGbufremain + iRemain > pData->iJPEGbufmax))
485 {
486 if (pData->iJPEGbufremain > 0) /* then do so */
487 MNG_COPY (pData->pJPEGbuf, pData->pJPEGcurrent, pData->iJPEGbufremain)
488
489 pData->pJPEGcurrent = pData->pJPEGbuf;
490 }
491 /* does the remaining input fit into the buffer ? */
492 if (pData->iJPEGbufremain + iRemain <= pData->iJPEGbufmax)
493 { /* move the lot */
494 MNG_COPY ((pData->pJPEGcurrent + pData->iJPEGbufremain), pWork, iRemain)
495
496 pData->iJPEGbufremain += iRemain;/* adjust remaining_bytes counter */
497 iRemain = 0; /* and indicate there's no input left */
498 }
499 else
500 { /* calculate what does fit */
501 mng_uint32 iFits = pData->iJPEGbufmax - pData->iJPEGbufremain;
502
503 if (iFits <= 0) /* no space is just bugger 'm all */
504 MNG_ERROR (pData, MNG_JPEGBUFTOOSMALL)
505 /* move that */
506 MNG_COPY ((pData->pJPEGcurrent + pData->iJPEGbufremain), pWork, iFits)
507
508 pData->iJPEGbufremain += iFits; /* adjust remain_bytes counter */
509 iRemain -= iFits; /* and the input-parms */
510 pWork += iFits;
511 }
512
513#ifdef MNG_INCLUDE_IJG6B
514 pData->pJPEGdinfo->src->next_input_byte = pData->pJPEGcurrent;
515 pData->pJPEGdinfo->src->bytes_in_buffer = pData->iJPEGbufremain;
516
517 if (!pData->bJPEGhasheader) /* haven't got the header yet ? */
518 {
519 /* call jpeg_read_header() to obtain image info */
520#ifdef MNG_SUPPORT_TRACE
521 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_HEADER)
522#endif
523 if (jpeg_read_header (pData->pJPEGdinfo, TRUE) != JPEG_SUSPENDED)
524 { /* indicate the header's oke */
525 pData->bJPEGhasheader = MNG_TRUE;
526 /* let's do some sanity checks ! */
527 if ((pData->pJPEGdinfo->image_width != pData->iDatawidth ) ||
528 (pData->pJPEGdinfo->image_height != pData->iDataheight) )
529 MNG_ERROR (pData, MNG_JPEGPARMSERR)
530
531 if ( ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAY ) ||
532 (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) ) &&
533 (pData->pJPEGdinfo->jpeg_color_space != JCS_GRAYSCALE ) )
534 MNG_ERROR (pData, MNG_JPEGPARMSERR)
535
536 if ( ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLOR ) ||
537 (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) &&
538 (pData->pJPEGdinfo->jpeg_color_space != JCS_YCbCr ) )
539 MNG_ERROR (pData, MNG_JPEGPARMSERR)
540 /* indicate whether or not it's progressive */
541 pData->bJPEGprogressive = (mng_bool)jpeg_has_multiple_scans (pData->pJPEGdinfo);
542 /* progressive+alpha can't display "on-the-fly"!! */
543 if ((pData->bJPEGprogressive) &&
544 ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) ||
545 (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ))
546 pData->fDisplayrow = MNG_NULL;
547 /* allocate a row of JPEG-samples */
548 if (pData->pJPEGdinfo->jpeg_color_space == JCS_YCbCr)
549 pData->iJPEGrowlen = pData->pJPEGdinfo->image_width * 3;
550 else
551 pData->iJPEGrowlen = pData->pJPEGdinfo->image_width;
552
553 MNG_ALLOC (pData, pData->pJPEGrow, pData->iJPEGrowlen)
554
555 pData->iJPEGrgbrow = 0; /* quite empty up to now */
556 }
557
558 pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
559 pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
560 }
561 /* decompress not started ? */
562 if ((pData->bJPEGhasheader) && (!pData->bJPEGdecostarted))
563 {
564 /* set parameters for decompression */
565
566 if (pData->bJPEGprogressive) /* progressive display ? */
567 pData->pJPEGdinfo->buffered_image = TRUE;
568
569 /* jpeg_start_decompress(...); */
570#ifdef MNG_SUPPORT_TRACE
571 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_DECOMPRESS)
572#endif
573 if (jpeg_start_decompress (pData->pJPEGdinfo) == TRUE)
574 /* indicate it started */
575 pData->bJPEGdecostarted = MNG_TRUE;
576
577 pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
578 pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
579 }
580 /* process some scanlines ? */
581 if ((pData->bJPEGhasheader) && (pData->bJPEGdecostarted) &&
582 ((!jpeg_input_complete (pData->pJPEGdinfo)) ||
583 (pData->pJPEGdinfo->output_scanline < pData->pJPEGdinfo->output_height)))
584 {
585 mng_int32 iLines;
586
587 /* for (each output pass) */
588 do
589 { /* address the row output buffer */
590 JSAMPROW pRow = (JSAMPROW)pData->pJPEGrow;
591
592 /* init new pass ? */
593 if ((pData->bJPEGprogressive) &&
594 ((!pData->bJPEGscanstarted) ||
595 (pData->pJPEGdinfo->output_scanline >= pData->pJPEGdinfo->output_height)))
596 {
597 pData->bJPEGscanstarted = MNG_TRUE;
598
599 /* adjust output decompression parameters if required */
600 /* nop */
601
602 /* start a new output pass */
603#ifdef MNG_SUPPORT_TRACE
604 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_OUTPUT)
605#endif
606 jpeg_start_output (pData->pJPEGdinfo, pData->pJPEGdinfo->input_scan_number);
607
608 pData->iJPEGrow = 0; /* start at row 0 in the image again */
609 }
610
611 /* while (scan lines remain to be read) */
612 do
613 {
614 /* jpeg_read_scanlines(...); */
615#ifdef MNG_SUPPORT_TRACE
616 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_SCANLINES)
617#endif
618 iLines = jpeg_read_scanlines (pData->pJPEGdinfo, (JSAMPARRAY)&pRow, 1);
619
620 pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
621 pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
622
623 if (iLines > 0) /* got something ? */
624 {
625 if (pData->fStorerow2) /* store in object ? */
626 {
627 iRetcode = ((mng_storerow)pData->fStorerow2) (pData);
628
629 if (iRetcode) /* on error bail out */
630 return iRetcode;
631
632 }
633 }
634 }
635 while ((pData->pJPEGdinfo->output_scanline < pData->pJPEGdinfo->output_height) &&
636 (iLines > 0)); /* until end-of-image or not enough input-data */
637
638 /* terminate output pass */
639 if ((pData->bJPEGprogressive) &&
640 (pData->pJPEGdinfo->output_scanline >= pData->pJPEGdinfo->output_height))
641 {
642#ifdef MNG_SUPPORT_TRACE
643 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_OUTPUT)
644#endif
645 jpeg_finish_output (pData->pJPEGdinfo);
646 /* this scan has ended */
647 pData->bJPEGscanstarted = MNG_FALSE;
648 }
649 }
650 while ((!jpeg_input_complete (pData->pJPEGdinfo)) && (iLines > 0));
651 }
652 /* end of image ? */
653 if ((pData->bJPEGhasheader) && (pData->bJPEGdecostarted) &&
654 (jpeg_input_complete (pData->pJPEGdinfo)) &&
655 (pData->pJPEGdinfo->input_scan_number == pData->pJPEGdinfo->output_scan_number))
656 {
657 /* jpeg_finish_decompress(...); */
658#ifdef MNG_SUPPORT_TRACE
659 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_DECOMPRESS)
660#endif
661 if (jpeg_finish_decompress (pData->pJPEGdinfo) == TRUE)
662 { /* indicate it's done */
663 pData->bJPEGhasheader = MNG_FALSE;
664 pData->bJPEGdecostarted = MNG_FALSE;
665 pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
666 pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
667 /* remaining fluff is an error ! */
668 if ((pData->iJPEGbufremain > 0) || (iRemain > 0))
669 MNG_ERROR (pData, MNG_TOOMUCHJDAT)
670 }
671 }
672#endif /* MNG_INCLUDE_IJG6B */
673 }
674
675#ifdef MNG_SUPPORT_TRACE
676 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_END)
677#endif
678
679 return MNG_NOERROR;
680}
681#endif /* MNG_INCLUDE_JNG_READ */
682
683/* ************************************************************************** */
684
685#ifdef MNG_INCLUDE_JNG_READ
686mng_retcode mngjpeg_decompressfree (mng_datap pData)
687{
688#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
689 mng_retcode iRetcode;
690#endif
691
692#ifdef MNG_SUPPORT_TRACE
693 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_START)
694#endif
695
696#ifdef MNG_INCLUDE_IJG6B
697#ifdef MNG_USE_SETJMP
698 iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */
699 if (iRetcode != 0) /* got here from longjmp ? */
700 MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
701#endif
702 /* free the row of JPEG-samples*/
703 MNG_FREE (pData, pData->pJPEGrow, pData->iJPEGrowlen)
704
705 /* release the JPEG decompression object */
706#ifdef MNG_SUPPORT_TRACE
707 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_JPEG_DESTROY_DECOMPRESS)
708#endif
709 jpeg_destroy_decompress (pData->pJPEGdinfo);
710
711 pData->bJPEGdecompress = MNG_FALSE; /* indicate it's done */
712
713#endif /* MNG_INCLUDE_IJG6B */
714
715#ifdef MNG_SUPPORT_TRACE
716 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_END)
717#endif
718
719 return MNG_NOERROR;
720}
721#endif /* MNG_INCLUDE_JNG_READ */
722
723/* ************************************************************************** */
724/* * * */
725/* * JPEG decompression routines (JDAA) * */
726/* * * */
727/* ************************************************************************** */
728
729#ifdef MNG_INCLUDE_JNG_READ
730mng_retcode mngjpeg_decompressinit2 (mng_datap pData)
731{
732#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
733 mng_retcode iRetcode;
734#endif
735
736#ifdef MNG_SUPPORT_TRACE
737 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_START)
738#endif
739
740#ifdef MNG_INCLUDE_IJG6B
741 /* allocate and initialize a JPEG decompression object */
742 pData->pJPEGdinfo2->err = jpeg_std_error (pData->pJPEGderr2);
743
744#ifdef MNG_USE_SETJMP /* setup local JPEG error-routines */
745 pData->pJPEGderr2->error_exit = mng_error_exit;
746 pData->pJPEGderr2->output_message = mng_output_message;
747
748 iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */
749 if (iRetcode != 0) /* got here from longjmp ? */
750 MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
751#endif /* MNG_USE_SETJMP */
752
753 /* allocate and initialize a JPEG decompression object (continued) */
754#ifdef MNG_SUPPORT_TRACE
755 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_JPEG_CREATE_DECOMPRESS)
756#endif
757 jpeg_create_decompress (pData->pJPEGdinfo2);
758
759 pData->bJPEGdecompress2 = MNG_TRUE; /* indicate it's initialized */
760
761 /* specify the source of the compressed data (eg, a file) */
762 /* no, not a file; we have buffered input */
763 pData->pJPEGdinfo2->src = pData->pJPEGdsrc2;
764 /* use the default handler */
765 pData->pJPEGdinfo2->src->resync_to_restart = jpeg_resync_to_restart;
766 /* setup local source routine & parms */
767 pData->pJPEGdinfo2->src->init_source = mng_init_source;
768 pData->pJPEGdinfo2->src->fill_input_buffer = mng_fill_input_buffer;
769 pData->pJPEGdinfo2->src->skip_input_data = mng_skip_input_data2;
770 pData->pJPEGdinfo2->src->term_source = mng_term_source;
771 pData->pJPEGdinfo2->src->next_input_byte = pData->pJPEGcurrent2;
772 pData->pJPEGdinfo2->src->bytes_in_buffer = pData->iJPEGbufremain2;
773
774#endif /* MNG_INCLUDE_IJG6B */
775
776#ifdef MNG_SUPPORT_TRACE
777 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_END)
778#endif
779
780 return MNG_NOERROR;
781}
782#endif /* MNG_INCLUDE_JNG_READ */
783
784/* ************************************************************************** */
785
786#ifdef MNG_INCLUDE_JNG_READ
787mng_retcode mngjpeg_decompressdata2 (mng_datap pData,
788 mng_uint32 iRawsize,
789 mng_uint8p pRawdata)
790{
791 mng_retcode iRetcode;
792 mng_uint32 iRemain;
793 mng_uint8p pWork;
794
795#ifdef MNG_SUPPORT_TRACE
796 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_START)
797#endif
798
799#if defined (MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
800 iRetcode = setjmp (pData->sErrorbuf);/* initialize local JPEG error-recovery */
801 if (iRetcode != 0) /* got here from longjmp ? */
802 MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
803#endif
804
805 pWork = pRawdata;
806 iRemain = iRawsize;
807
808 if (pData->iJPEGtoskip2) /* JPEG-lib told us to skip some more data ? */
809 {
810 if (iRemain > pData->iJPEGtoskip2) /* enough data in this buffer ? */
811 {
812 iRemain -= pData->iJPEGtoskip2; /* skip enough to access the next byte */
813 pWork += pData->iJPEGtoskip2;
814
815 pData->iJPEGtoskip2 = 0; /* no more to skip then */
816 }
817 else
818 {
819 pData->iJPEGtoskip2 -= iRemain; /* skip all data in the buffer */
820 iRemain = 0; /* and indicate this accordingly */
821 }
822 /* the skip set current-pointer to NULL ! */
823 pData->pJPEGcurrent2 = pData->pJPEGbuf2;
824 }
825
826 while (iRemain) /* repeat until no more input-bytes */
827 { /* need to shift anything ? */
828 if ((pData->pJPEGcurrent2 > pData->pJPEGbuf2) &&
829 (pData->pJPEGcurrent2 - pData->pJPEGbuf2 + pData->iJPEGbufremain2 + iRemain > pData->iJPEGbufmax2))
830 {
831 if (pData->iJPEGbufremain2 > 0) /* then do so */
832 MNG_COPY (pData->pJPEGbuf2, pData->pJPEGcurrent2, pData->iJPEGbufremain2)
833
834 pData->pJPEGcurrent2 = pData->pJPEGbuf2;
835 }
836 /* does the remaining input fit into the buffer ? */
837 if (pData->iJPEGbufremain2 + iRemain <= pData->iJPEGbufmax2)
838 { /* move the lot */
839 MNG_COPY ((pData->pJPEGcurrent2 + pData->iJPEGbufremain2), pWork, iRemain)
840 /* adjust remaining_bytes counter */
841 pData->iJPEGbufremain2 += iRemain;
842 iRemain = 0; /* and indicate there's no input left */
843 }
844 else
845 { /* calculate what does fit */
846 mng_uint32 iFits = pData->iJPEGbufmax2 - pData->iJPEGbufremain2;
847
848 if (iFits <= 0) /* no space is just bugger 'm all */
849 MNG_ERROR (pData, MNG_JPEGBUFTOOSMALL)
850 /* move that */
851 MNG_COPY ((pData->pJPEGcurrent2 + pData->iJPEGbufremain2), pWork, iFits)
852
853 pData->iJPEGbufremain2 += iFits; /* adjust remain_bytes counter */
854 iRemain -= iFits; /* and the input-parms */
855 pWork += iFits;
856 }
857
858#ifdef MNG_INCLUDE_IJG6B
859 pData->pJPEGdinfo2->src->next_input_byte = pData->pJPEGcurrent2;
860 pData->pJPEGdinfo2->src->bytes_in_buffer = pData->iJPEGbufremain2;
861
862 if (!pData->bJPEGhasheader2) /* haven't got the header yet ? */
863 {
864 /* call jpeg_read_header() to obtain image info */
865#ifdef MNG_SUPPORT_TRACE
866 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_HEADER)
867#endif
868 if (jpeg_read_header (pData->pJPEGdinfo2, TRUE) != JPEG_SUSPENDED)
869 { /* indicate the header's oke */
870 pData->bJPEGhasheader2 = MNG_TRUE;
871 /* let's do some sanity checks ! */
872 if ((pData->pJPEGdinfo2->image_width != pData->iDatawidth ) ||
873 (pData->pJPEGdinfo2->image_height != pData->iDataheight) )
874 MNG_ERROR (pData, MNG_JPEGPARMSERR)
875
876 if (pData->pJPEGdinfo2->jpeg_color_space != JCS_GRAYSCALE)
877 MNG_ERROR (pData, MNG_JPEGPARMSERR)
878 /* indicate whether or not it's progressive */
879 pData->bJPEGprogressive2 = (mng_bool)jpeg_has_multiple_scans (pData->pJPEGdinfo2);
880
881 if (pData->bJPEGprogressive2) /* progressive alphachannel not allowed !!! */
882 MNG_ERROR (pData, MNG_JPEGPARMSERR)
883 /* allocate a row of JPEG-samples */
884 if (pData->pJPEGdinfo2->jpeg_color_space == JCS_YCbCr)
885 pData->iJPEGrowlen2 = pData->pJPEGdinfo2->image_width * 3;
886 else
887 pData->iJPEGrowlen2 = pData->pJPEGdinfo2->image_width;
888
889 MNG_ALLOC (pData, pData->pJPEGrow2, pData->iJPEGrowlen2)
890
891 pData->iJPEGalpharow = 0; /* quite empty up to now */
892 }
893
894 pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte;
895 pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer;
896 }
897 /* decompress not started ? */
898 if ((pData->bJPEGhasheader2) && (!pData->bJPEGdecostarted2))
899 {
900 /* set parameters for decompression */
901
902 if (pData->bJPEGprogressive2) /* progressive display ? */
903 pData->pJPEGdinfo2->buffered_image = TRUE;
904
905 /* jpeg_start_decompress(...); */
906#ifdef MNG_SUPPORT_TRACE
907 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_DECOMPRESS)
908#endif
909 if (jpeg_start_decompress (pData->pJPEGdinfo2) == TRUE)
910 /* indicate it started */
911 pData->bJPEGdecostarted2 = MNG_TRUE;
912
913 pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte;
914 pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer;
915 }
916 /* process some scanlines ? */
917 if ((pData->bJPEGhasheader2) && (pData->bJPEGdecostarted2) &&
918 ((!jpeg_input_complete (pData->pJPEGdinfo2)) ||
919 (pData->pJPEGdinfo2->output_scanline < pData->pJPEGdinfo2->output_height)))
920 {
921 mng_int32 iLines;
922
923 /* for (each output pass) */
924 do
925 { /* address the row output buffer */
926 JSAMPROW pRow = (JSAMPROW)pData->pJPEGrow2;
927
928 /* init new pass ? */
929 if ((pData->bJPEGprogressive2) &&
930 ((!pData->bJPEGscanstarted2) ||
931 (pData->pJPEGdinfo2->output_scanline >= pData->pJPEGdinfo2->output_height)))
932 {
933 pData->bJPEGscanstarted2 = MNG_TRUE;
934
935 /* adjust output decompression parameters if required */
936 /* nop */
937
938 /* start a new output pass */
939#ifdef MNG_SUPPORT_TRACE
940 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_OUTPUT)
941#endif
942 jpeg_start_output (pData->pJPEGdinfo2, pData->pJPEGdinfo2->input_scan_number);
943
944 pData->iJPEGrow = 0; /* start at row 0 in the image again */
945 }
946
947 /* while (scan lines remain to be read) */
948 do
949 {
950 /* jpeg_read_scanlines(...); */
951#ifdef MNG_SUPPORT_TRACE
952 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_SCANLINES)
953#endif
954 iLines = jpeg_read_scanlines (pData->pJPEGdinfo2, (JSAMPARRAY)&pRow, 1);
955
956 pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte;
957 pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer;
958
959 if (iLines > 0) /* got something ? */
960 {
961 if (pData->fStorerow3) /* store in object ? */
962 {
963 iRetcode = ((mng_storerow)pData->fStorerow3) (pData);
964
965 if (iRetcode) /* on error bail out */
966 return iRetcode;
967
968 }
969 }
970 }
971 while ((pData->pJPEGdinfo2->output_scanline < pData->pJPEGdinfo2->output_height) &&
972 (iLines > 0)); /* until end-of-image or not enough input-data */
973
974 /* terminate output pass */
975 if ((pData->bJPEGprogressive2) &&
976 (pData->pJPEGdinfo2->output_scanline >= pData->pJPEGdinfo2->output_height))
977 {
978#ifdef MNG_SUPPORT_TRACE
979 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_OUTPUT)
980#endif
981 jpeg_finish_output (pData->pJPEGdinfo2);
982 /* this scan has ended */
983 pData->bJPEGscanstarted2 = MNG_FALSE;
984 }
985 }
986 while ((!jpeg_input_complete (pData->pJPEGdinfo2)) && (iLines > 0));
987 }
988 /* end of image ? */
989 if ((pData->bJPEGhasheader2) && (pData->bJPEGdecostarted2) &&
990 (jpeg_input_complete (pData->pJPEGdinfo2)) &&
991 (pData->pJPEGdinfo2->input_scan_number == pData->pJPEGdinfo2->output_scan_number))
992 {
993 /* jpeg_finish_decompress(...); */
994#ifdef MNG_SUPPORT_TRACE
995 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_DECOMPRESS)
996#endif
997 if (jpeg_finish_decompress (pData->pJPEGdinfo2) == TRUE)
998 { /* indicate it's done */
999 pData->bJPEGhasheader2 = MNG_FALSE;
1000 pData->bJPEGdecostarted2 = MNG_FALSE;
1001 pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte;
1002 pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer;
1003 /* remaining fluff is an error ! */
1004 if ((pData->iJPEGbufremain2 > 0) || (iRemain > 0))
1005 MNG_ERROR (pData, MNG_TOOMUCHJDAT)
1006 }
1007 }
1008#endif /* MNG_INCLUDE_IJG6B */
1009 }
1010
1011#ifdef MNG_SUPPORT_TRACE
1012 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_END)
1013#endif
1014
1015 return MNG_NOERROR;
1016}
1017#endif /* MNG_INCLUDE_JNG_READ */
1018
1019/* ************************************************************************** */
1020
1021#ifdef MNG_INCLUDE_JNG_READ
1022mng_retcode mngjpeg_decompressfree2 (mng_datap pData)
1023{
1024#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
1025 mng_retcode iRetcode;
1026#endif
1027
1028#ifdef MNG_SUPPORT_TRACE
1029 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_START)
1030#endif
1031
1032#ifdef MNG_INCLUDE_IJG6B
1033#ifdef MNG_USE_SETJMP
1034 iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */
1035 if (iRetcode != 0) /* got here from longjmp ? */
1036 MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
1037#endif
1038 /* free the row of JPEG-samples*/
1039 MNG_FREE (pData, pData->pJPEGrow2, pData->iJPEGrowlen2)
1040
1041 /* release the JPEG decompression object */
1042#ifdef MNG_SUPPORT_TRACE
1043 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_JPEG_DESTROY_DECOMPRESS)
1044#endif
1045 jpeg_destroy_decompress (pData->pJPEGdinfo2);
1046
1047 pData->bJPEGdecompress2 = MNG_FALSE; /* indicate it's done */
1048
1049#endif /* MNG_INCLUDE_IJG6B */
1050
1051#ifdef MNG_SUPPORT_TRACE
1052 MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_END)
1053#endif
1054
1055 return MNG_NOERROR;
1056}
1057#endif /* MNG_INCLUDE_JNG_READ */
1058
1059/* ************************************************************************** */
1060
1061#endif /* MNG_INCLUDE_JNG */
1062
1063/* ************************************************************************** */
1064/* * end of file * */
1065/* ************************************************************************** */
1066
Note: See TracBrowser for help on using the repository browser.