PageRenderTime 65ms CodeModel.GetById 16ms app.highlight 42ms RepoModel.GetById 1ms app.codeStats 0ms

/src/FreeImage/Source/LibMNG/libmng_data.h

https://bitbucket.org/cabalistic/ogredeps/
C++ Header | 1029 lines | 674 code | 126 blank | 229 comment | 7 complexity | dd2a163a6bcfdd838994e454071e17d7 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1/* ************************************************************************** */
  2/* *             For conditions of distribution and use,                    * */
  3/* *                see copyright notice in libmng.h                        * */
  4/* ************************************************************************** */
  5/* *                                                                        * */
  6/* * project   : libmng                                                     * */
  7/* * file      : libmng_data.h             copyright (c) 2000-2007 G.Juyn   * */
  8/* * version   : 1.0.10                                                     * */
  9/* *                                                                        * */
 10/* * purpose   : main data structure definition                             * */
 11/* *                                                                        * */
 12/* * author    : G.Juyn                                                     * */
 13/* *                                                                        * */
 14/* * comment   : Definition of the library main data structure              * */
 15/* *                                                                        * */
 16/* * changes   : 0.5.1 - 05/04/2000 - G.Juyn                                * */
 17/* *             - added CRC table to main structure (for thread-safety)    * */
 18/* *             0.5.1 - 05/06/2000 - G.Juyn                                * */
 19/* *             - added iPLTEentries for checking hIST-length              * */
 20/* *             0.5.1 - 05/08/2000 - G.Juyn                                * */
 21/* *             - changed palette definition to exported palette-type      * */
 22/* *             - removed frozen indicator                                 * */
 23/* *             - added create/write indicators                            * */
 24/* *             - changed strict-ANSI stuff                                * */
 25/* *             0.5.1 - 05/13/2000 - G.Juyn                                * */
 26/* *             - added eMNGma hack (will be removed in 1.0.0 !!!)         * */
 27/* *             - added TERM animation object pointer (easier reference)   * */
 28/* *             - added saved-data structure for SAVE/SEEK processing      * */
 29/* *                                                                        * */
 30/* *             0.5.2 - 05/18/2000 - G.Juyn                                * */
 31/* *             - added fields for JNG support (IJG-based)                 * */
 32/* *             0.5.2 - 05/24/2000 - G.Juyn                                * */
 33/* *             - changed global tRNS definition                           * */
 34/* *             0.5.2 - 05/30/2000 - G.Juyn                                * */
 35/* *             - added delta-image fields                                 * */
 36/* *             0.5.2 - 06/01/2000 - G.Juyn                                * */
 37/* *             - added internal delta-image processing callbacks          * */
 38/* *             0.5.2 - 06/02/2000 - G.Juyn                                * */
 39/* *             - changed SWAP_ENDIAN to BIGENDIAN_SUPPORTED               * */
 40/* *               (contributed by Tim Rowley)                              * */
 41/* *             - added getalphaline callback for RGB8_A8 canvasstyle      * */
 42/* *             0.5.2 - 06/06/2000 - G.Juyn                                * */
 43/* *             - added parameter for delayed buffer-processing            * */
 44/* *                                                                        * */
 45/* *             0.5.3 - 06/16/2000 - G.Juyn                                * */
 46/* *             - added update-region parms for refresh calback            * */
 47/* *             - added Needrefresh parameter                              * */
 48/* *             0.5.3 - 06/17/2000 - G.Juyn                                * */
 49/* *             - added Deltaimmediate parm for faster delta-processing    * */
 50/* *             0.5.3 - 06/21/2000 - G.Juyn                                * */
 51/* *             - added Speed parameter to facilitate testing              * */
 52/* *             - added Imagelevel parameter for processtext callback      * */
 53/* *             0.5.3 - 06/26/2000 - G.Juyn                                * */
 54/* *             - changed userdata variable to mng_ptr                     * */
 55/* *                                                                        * */
 56/* *             0.9.1 - 07/07/2000 - G.Juyn                                * */
 57/* *             - added variables for go_xxxx processing                   * */
 58/* *             0.9.1 - 07/08/2000 - G.Juyn                                * */
 59/* *             - added variables for improved timing support              * */
 60/* *             0.9.1 - 07/15/2000 - G.Juyn                                * */
 61/* *             - added callbacks for SAVE/SEEK processing                 * */
 62/* *             - added variable for NEEDSECTIONWAIT breaks                * */
 63/* *             - added variable for freeze & reset processing             * */
 64/* *             0.9.1 - 07/17/2000 - G.Juyn                                * */
 65/* *             - fixed suspension-buffering for 32K+ chunks               * */
 66/* *                                                                        * */
 67/* *             0.9.2 - 07/29/2000 - G.Juyn                                * */
 68/* *             - removed Nextbackxxx fields (no longer used)              * */
 69/* *             0.9.2 - 07/31/2000 - G.Juyn                                * */
 70/* *             - fixed wrapping of suspension parameters                  * */
 71/* *             0.9.2 - 08/04/2000 - G.Juyn                                * */
 72/* *             - B111096 - fixed large-buffer read-suspension             * */
 73/* *             0.9.2 - 08/05/2000 - G.Juyn                                * */
 74/* *             - changed file-prefixes                                    * */
 75/* *                                                                        * */
 76/* *             0.9.3 - 08/26/2000 - G.Juyn                                * */
 77/* *             - added MAGN chunk                                         * */
 78/* *             0.9.3 - 09/07/2000 - G.Juyn                                * */
 79/* *             - added support for new filter_types                       * */
 80/* *             0.9.3 - 09/10/2000 - G.Juyn                                * */
 81/* *             - fixed DEFI behavior                                      * */
 82/* *             0.9.3 - 10/10/2000 - G.Juyn                                * */
 83/* *             - added support for alpha-depth prediction                 * */
 84/* *             0.9.3 - 10/11/2000 - G.Juyn                                * */
 85/* *             - added support for nEED                                   * */
 86/* *             0.9.3 - 10/16/2000 - G.Juyn                                * */
 87/* *             - added optional support for bKGD for PNG images           * */
 88/* *             - added support for JDAA                                   * */
 89/* *             0.9.3 - 10/17/2000 - G.Juyn                                * */
 90/* *             - added callback to process non-critical unknown chunks    * */
 91/* *             - fixed support for bKGD                                   * */
 92/* *             0.9.3 - 10/19/2000 - G.Juyn                                * */
 93/* *             - implemented delayed delta-processing                     * */
 94/* *             0.9.4 - 12/16/2000 - G.Juyn                                * */
 95/* *             - fixed mixup of data- & function-pointers (thanks Dimitri)* */
 96/* *                                                                        * */
 97/* *             1.0.1 - 02/08/2001 - G.Juyn                                * */
 98/* *             - added MEND processing callback                           * */
 99/* *             1.0.1 - 02/13/2001 - G.Juyn                                * */
100/* *             - fixed first FRAM_MODE=4 timing problem                   * */
101/* *                                                                        * */
102/* *             1.0.2 - 06/23/2001 - G.Juyn                                * */
103/* *             - added optimization option for MNG-video playback         * */
104/* *             - added processterm callback                               * */
105/* *             1.0.2 - 06/25/2001 - G.Juyn                                * */
106/* *             - added option to turn off progressive refresh             * */
107/* *                                                                        * */
108/* *             1.0.5 - 07/08/2002 - G.Juyn                                * */
109/* *             - B578572 - removed eMNGma hack (thanks Dimitri!)          * */
110/* *             1.0.5 - 07/16/2002 - G.Juyn                                * */
111/* *             - B581625 - large chunks fail with suspension reads        * */
112/* *             1.0.5 - 08/15/2002 - G.Juyn                                * */
113/* *             - completed PROM support                                   * */
114/* *             1.0.5 - 09/15/2002 - G.Juyn                                * */
115/* *             - fixed LOOP iteration=0 special case                      * */
116/* *             1.0.5 - 09/20/2002 - G.Juyn                                * */
117/* *             - finished support for BACK image & tiling                 * */
118/* *             1.0.5 - 10/07/2002 - G.Juyn                                * */
119/* *             - added another fix for misplaced TERM chunk               * */
120/* *             - completed support for condition=2 in TERM chunk          * */
121/* *             1.0.5 - 10/20/2002 - G.Juyn                                * */
122/* *             - fixed processing for multiple objects in MAGN            * */
123/* *             - fixed display of visible target of PAST operation        * */
124/* *             1.0.5 - 11/07/2002 - G.Juyn                                * */
125/* *             - added support to get totals after mng_read()             * */
126/* *             1.0.5 - 24/02/2003 - G.Juyn                                * */
127/* *             - B683152 - libjpeg suspension not always honored correctly* */
128/* *                                                                        * */
129/* *             1.0.6 - 04/11/2003 - G.Juyn                                * */
130/* *             - B719420 - fixed several MNG_APP_CMS problems             * */
131/* *             1.0.6 - 07/05/2003 - G. R-P                                * */
132/* *             - optionally use zlib's crc32() function                   * */
133/* *             1.0.6 - 07/29/2003 - G.R-P                                 * */
134/* *             - added SKIPCHUNK conditionals around PAST chunk support   * */
135/* *             1.0.6 - 08/17/2003 - G.R-P                                 * */
136/* *             - added iPNGdepth member to pData structure                * */
137/* *                                                                        * */
138/* *             1.0.7 - 03/10/2004 - G.R-P                                 * */
139/* *             - added conditionals around openstream/closestream         * */
140/* *             1.0.7 - 03/24/2004 - G.R-P                                 * */
141/* *             - added more SKIPCHUNK conditionals                        * */
142/* *                                                                        * */
143/* *             1.0.8 - 04/02/2004 - G.Juyn                                * */
144/* *             - added CRC existence & checking flags                     * */
145/* *             1.0.8 - 04/10/2004 - G.Juyn                                * */
146/* *             - added data-push mechanisms for specialized decoders      * */
147/* *                                                                        * */
148/* *             1.0.9 - 12/11/2004 - G.Juyn                                * */
149/* *             - added conditional MNG_OPTIMIZE_DISPLAYCALLS              * */
150/* *                                                                        * */
151/* *             1.0.10 - 04/08/2007 - G.Juyn                               * */
152/* *             - added support for mPNG proposal                          * */
153/* *             1.0.10 - 04/12/2007 - G.Juyn                               * */
154/* *             - added support for ANG proposal                           * */
155/* *                                                                        * */
156/* ************************************************************************** */
157
158#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
159#pragma option -A                      /* force ANSI-C */
160#endif
161
162#ifndef _libmng_data_h_
163#define _libmng_data_h_
164
165/* ************************************************************************** */
166
167#define MNG_MAGIC 0x52530a0aL
168
169/* ************************************************************************** */
170/* *                                                                        * */
171/* * Internal structures                                                    * */
172/* *                                                                        * */
173/* ************************************************************************** */
174
175typedef mng_palette8 mng_rgbpaltab;
176
177/* ************************************************************************** */
178/* *                                                                        * */
179/* * The saved_data structure                                               * */
180/* *                                                                        * */
181/* * This contains the saved data after a SAVE chunk has been processed.    * */
182/* * The data is saved from the main data structure during SAVE processing, * */
183/* * and restored to the main data structure during SEEK processing.        * */
184/* *                                                                        * */
185/* ************************************************************************** */
186
187typedef struct mng_savedata_struct {
188
189#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
190           mng_bool          bHasglobalPLTE;     /* global PLTE chunk processed */
191           mng_bool          bHasglobalTRNS;     /* global tRNS chunk processed */
192           mng_bool          bHasglobalGAMA;     /* global gAMA chunk processed */
193           mng_bool          bHasglobalCHRM;     /* global cHRM chunk processed */
194           mng_bool          bHasglobalSRGB;     /* global sRGB chunk processed */
195           mng_bool          bHasglobalICCP;     /* global iCCP chunk processed */
196           mng_bool          bHasglobalBKGD;     /* global bKGD chunk processed */
197#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
198
199#ifdef MNG_SUPPORT_DISPLAY
200           mng_uint16        iBACKred;           /* BACK fields */
201           mng_uint16        iBACKgreen;
202           mng_uint16        iBACKblue;
203           mng_uint8         iBACKmandatory;
204           mng_uint16        iBACKimageid;
205           mng_uint8         iBACKtile;
206
207           mng_uint8         iFRAMmode;          /* FRAM fields (global) */
208           mng_uint32        iFRAMdelay;
209           mng_uint32        iFRAMtimeout;
210           mng_bool          bFRAMclipping;
211           mng_int32         iFRAMclipl;
212           mng_int32         iFRAMclipr;
213           mng_int32         iFRAMclipt;
214           mng_int32         iFRAMclipb;
215
216           mng_uint32        iGlobalPLTEcount;   /* global PLTE fields */
217           mng_rgbpaltab     aGlobalPLTEentries;
218
219           mng_uint32        iGlobalTRNSrawlen;  /* global tRNS fields */
220           mng_uint8arr      aGlobalTRNSrawdata;
221
222           mng_uint32        iGlobalGamma;       /* global gAMA fields */
223
224#ifndef MNG_SKIPCHUNK_cHRM
225           mng_uint32        iGlobalWhitepointx; /* global cHRM fields */
226           mng_uint32        iGlobalWhitepointy;
227           mng_uint32        iGlobalPrimaryredx;
228           mng_uint32        iGlobalPrimaryredy;
229           mng_uint32        iGlobalPrimarygreenx;
230           mng_uint32        iGlobalPrimarygreeny;
231           mng_uint32        iGlobalPrimarybluex;
232           mng_uint32        iGlobalPrimarybluey;
233#endif
234
235           mng_uint8         iGlobalRendintent;  /* global sRGB fields */
236
237           mng_uint32        iGlobalProfilesize; /* global iCCP fields */
238           mng_ptr           pGlobalProfile;
239
240           mng_uint16        iGlobalBKGDred;     /* global bKGD fields */
241           mng_uint16        iGlobalBKGDgreen;
242           mng_uint16        iGlobalBKGDblue;
243#endif /* MNG_SUPPORT_DISPLAY */
244
245        } mng_savedata;
246
247typedef mng_savedata * mng_savedatap;
248
249/* ************************************************************************** */
250/* *                                                                        * */
251/* * Internal buffer structure for data push mechanisms                     * */
252/* *                                                                        * */
253/* ************************************************************************** */
254
255typedef struct {
256           mng_ptr           pNext;              /* for linked list */
257           mng_ptr           pData;              /* used for chunks & data */
258           mng_uint32        iLength;
259           mng_bool          bOwned;
260           mng_uint8p        pDatanext;          /* only used for data */
261           mng_uint32        iRemaining;
262        } mng_pushdata;
263typedef mng_pushdata * mng_pushdatap;
264
265/* ************************************************************************** */
266/* *                                                                        * */
267/* * The main libmng data structure                                         * */
268/* *                                                                        * */
269/* * The handle used in all functions points to this structure which        * */
270/* * contains all volatile data necessary to process the network graphic.   * */
271/* *                                                                        * */
272/* ************************************************************************** */
273
274typedef struct mng_data_struct {
275
276           mng_uint32        iMagic;             /* magic number to validate
277                                                    a given handle */     
278           mng_ptr           pUserdata;          /* application workdata */
279
280           mng_imgtype       eSigtype;           /* image information */
281           mng_imgtype       eImagetype;         /* initially zeroed */
282           mng_uint32        iWidth;             /* filled after header is processed */
283           mng_uint32        iHeight;
284           mng_uint32        iTicks;             /* these only after MHDR */
285           mng_uint32        iLayercount;
286           mng_uint32        iFramecount;
287           mng_uint32        iPlaytime;
288           mng_uint32        iSimplicity;
289           mng_uint8         iAlphadepth;        /* indicates expected alpha-depth */
290
291           mng_uint32        iImagelevel;        /* level of image inside a stream */
292
293           mng_uint32        iCanvasstyle;       /* layout of the drawing-canvas */
294           mng_uint32        iBkgdstyle;         /* layout of the background-canvas */
295
296           mng_int8          iMagnify;           /* magnification factor (not used yet) */
297           mng_uint32        iOffsetx;           /* x-offset for extremely large image */
298           mng_uint32        iOffsety;           /* y-offset for extremely large image */
299           mng_uint32        iCanvaswidth;       /* real canvas size */
300           mng_uint32        iCanvasheight;      /* must be set by processheader callback */
301
302           mng_uint16        iBGred;             /* default background color */
303           mng_uint16        iBGgreen;           /* initially "black" */
304           mng_uint16        iBGblue;
305           mng_bool          bUseBKGD;           /* preferred use of bKGD for PNG */
306
307           mng_bool          bIssRGB;            /* indicates sRGB system */
308
309#ifdef MNG_FULL_CMS                              /* little CMS variables */
310           mng_cmsprof       hProf1;             /* image input profile */
311           mng_cmsprof       hProf2;             /* default output profile */
312           mng_cmsprof       hProf3;             /* default sRGB profile */
313           mng_cmstrans      hTrans;             /* current transformation handle */
314#endif
315
316           mng_float         dViewgamma;         /* gamma calculation variables */
317           mng_float         dDisplaygamma;      /* initially set for sRGB conditions */
318           mng_float         dDfltimggamma;
319
320           mng_bool          bStorechunks;       /* switch for storing chunkdata */
321           mng_bool          bSectionbreaks;     /* indicate NEEDSECTIONWAIT breaks */
322           mng_bool          bCacheplayback;     /* switch to cache playback info */
323           mng_bool          bDoProgressive;     /* progressive refresh for large images */
324           mng_uint32        iCrcmode;           /* CRC existence & checking flags */
325
326           mng_speedtype     iSpeed;             /* speed-modifier for animations */
327
328           mng_uint32        iMaxwidth;          /* maximum canvas size */
329           mng_uint32        iMaxheight;         /* initially set to 1024 x 1024 */
330
331           mng_int32         iErrorcode;         /* error reporting fields */
332           mng_int8          iSeverity;
333           mng_int32         iErrorx1;
334           mng_int32         iErrorx2;
335           mng_pchar         zErrortext;
336
337           mng_memalloc      fMemalloc;          /* callback pointers */
338           mng_memfree       fMemfree;           /* initially nulled */
339           mng_releasedata   fReleasedata;
340#ifndef MNG_NO_OPEN_CLOSE_STREAM
341           mng_openstream    fOpenstream;
342           mng_closestream   fClosestream;
343#endif
344           mng_readdata      fReaddata;
345           mng_writedata     fWritedata;
346           mng_errorproc     fErrorproc;
347           mng_traceproc     fTraceproc;
348           mng_processheader fProcessheader;
349           mng_processtext   fProcesstext;
350           mng_processsave   fProcesssave;
351           mng_processseek   fProcessseek;
352           mng_processneed   fProcessneed;
353           mng_processmend   fProcessmend;
354           mng_processunknown fProcessunknown;
355           mng_processterm   fProcessterm;
356           mng_getcanvasline fGetcanvasline;
357           mng_getbkgdline   fGetbkgdline;
358           mng_getalphaline  fGetalphaline;
359           mng_refresh       fRefresh;
360           mng_gettickcount  fGettickcount;
361           mng_settimer      fSettimer;
362           mng_processgamma  fProcessgamma;
363           mng_processchroma fProcesschroma;
364           mng_processsrgb   fProcesssrgb;
365           mng_processiccp   fProcessiccp;
366           mng_processarow   fProcessarow;
367
368#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
369#ifndef MNG_NO_OLD_VERSIONS
370           mng_bool          bPreDraft48;        /* flags ancient style draft */
371#endif
372
373           mng_chunkid       iChunkname;         /* read/write-state variables */
374           mng_uint32        iChunkseq;
375           mng_chunkp        pFirstchunk;        /* double-linked list of */
376           mng_chunkp        pLastchunk;         /* stored chunk-structures */
377
378           mng_bool          bHasheader;         /* first header chunk processed */
379           mng_bool          bHasMHDR;           /* inside a MHDR-MEND sequence */
380           mng_bool          bHasIHDR;           /* inside a IHDR-IEND sequence */
381           mng_bool          bHasBASI;           /* inside a BASI-IEND sequence */
382           mng_bool          bHasDHDR;           /* inside a DHDR-IEND sequence */
383#ifdef MNG_INCLUDE_JNG
384           mng_bool          bHasJHDR;           /* inside a JHDR-IEND sequence */
385           mng_bool          bHasJSEP;           /* passed the JSEP separator */
386           mng_bool          bHasJDAA;           /* at least 1 JDAA processed */
387           mng_bool          bHasJDAT;           /* at least 1 JDAT processed */
388#endif
389           mng_bool          bHasPLTE;           /* PLTE chunk processed */
390           mng_bool          bHasTRNS;           /* tRNS chunk processed */
391           mng_bool          bHasGAMA;           /* gAMA chunk processed */
392           mng_bool          bHasCHRM;           /* cHRM chunk processed */
393           mng_bool          bHasSRGB;           /* sRGB chunk processed */
394           mng_bool          bHasICCP;           /* iCCP chunk processed */
395           mng_bool          bHasBKGD;           /* bKGD chunk processed */
396           mng_bool          bHasIDAT;           /* at least 1 IDAT processed */
397           
398           mng_bool          bHasSAVE;           /* SAVE chunk processed */
399           mng_bool          bHasBACK;           /* BACK chunk processed */
400           mng_bool          bHasFRAM;           /* FRAM chunk processed */
401           mng_bool          bHasTERM;           /* TERM chunk processed */
402           mng_bool          bHasLOOP;           /* at least 1 LOOP open */
403
404           mng_bool          bHasglobalPLTE;     /* global PLTE chunk processed */
405           mng_bool          bHasglobalTRNS;     /* global tRNS chunk processed */
406           mng_bool          bHasglobalGAMA;     /* global gAMA chunk processed */
407           mng_bool          bHasglobalCHRM;     /* global cHRM chunk processed */
408           mng_bool          bHasglobalSRGB;     /* global sRGB chunk processed */
409           mng_bool          bHasglobalICCP;     /* global iCCP chunk processed */
410           mng_bool          bHasglobalBKGD;     /* global bKGD chunk processed */
411
412           mng_uint32        iDatawidth;         /* IHDR/BASI/DHDR fields */
413           mng_uint32        iDataheight;        /* valid if inside IHDR-IEND, */
414           mng_uint8         iBitdepth;          /* BASI-IEND or DHDR-IEND */
415           mng_uint8         iColortype;
416           mng_uint8         iCompression;
417           mng_uint8         iFilter;
418           mng_uint8         iInterlace;
419
420           mng_uint32        iPLTEcount;         /* PLTE fields */
421
422#ifdef MNG_INCLUDE_JNG
423           mng_uint8         iJHDRcolortype;     /* JHDR fields */
424           mng_uint8         iJHDRimgbitdepth;   /* valid if inside JHDR-IEND */
425           mng_uint8         iJHDRimgcompression;
426           mng_uint8         iJHDRimginterlace;
427           mng_uint8         iJHDRalphabitdepth;
428           mng_uint8         iJHDRalphacompression;
429           mng_uint8         iJHDRalphafilter;
430           mng_uint8         iJHDRalphainterlace;
431#endif
432
433#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
434
435#ifdef MNG_SUPPORT_READ
436           mng_bool          bReading;           /* read processing variables */
437           mng_bool          bHavesig;
438           mng_bool          bEOF;
439           mng_uint32        iReadbufsize;
440           mng_uint8p        pReadbuf;
441
442           mng_uint32        iLargebufsize;      /* temp for very large chunks */
443           mng_uint8p        pLargebuf;
444
445           mng_uint32        iSuspendtime;       /* tickcount at last suspension */
446           mng_bool          bSuspended;         /* input-reading has been suspended;
447                                                    we're expecting a call to
448                                                    mng_read_resume! */
449           mng_uint8         iSuspendpoint;      /* indicates at which point the flow
450                                                    was broken to suspend input-reading */
451                                                    
452           mng_bool          bSuspensionmode;    /* I/O-suspension variables */
453           mng_uint32        iSuspendbufsize;
454           mng_uint8p        pSuspendbuf;
455           mng_uint8p        pSuspendbufnext;
456           mng_uint32        iSuspendbufleft;
457           mng_uint32        iChunklen;          /* chunk length */
458           mng_uint8p        pReadbufnext;       /* 32K+ suspension-processing */
459           mng_uint8p        pLargebufnext;
460
461           mng_pushdatap     pFirstpushchunk;    /* variables for push mechanisms */
462           mng_pushdatap     pLastpushchunk;
463           mng_pushdatap     pFirstpushdata;
464           mng_pushdatap     pLastpushdata;
465#endif /* MNG_SUPPORT_READ */
466
467#ifdef MNG_SUPPORT_WRITE
468           mng_bool          bCreating;          /* create/write processing variables */
469           mng_bool          bWriting;
470           mng_chunkid       iFirstchunkadded;
471           mng_uint32        iWritebufsize;
472           mng_uint8p        pWritebuf;
473#endif
474
475#ifdef MNG_SUPPORT_DISPLAY
476           mng_bool          bDisplaying;        /* display-state variables */
477           mng_bool          bFramedone;
478           mng_uint32        iFrameseq;
479           mng_uint32        iLayerseq;
480           mng_uint32        iFrametime;         /* millisecs */
481
482           mng_uint32        iTotalframes;       /* end-totals after mng_read() */
483           mng_uint32        iTotallayers;
484           mng_uint32        iTotalplaytime;     /* millisecs */
485
486           mng_bool          bSkipping;          /* LOOP iteration=0 */
487           
488#ifdef MNG_SUPPORT_DYNAMICMNG
489           mng_bool          bDynamic;           /* MNG is dynamic (eg. has events) */
490           mng_bool          bRunningevent;      /* currently processing an event */
491           mng_bool          bStopafterseek;     /* stop after next SEEK */
492           mng_int32         iEventx;            /* X/Y of current event */
493           mng_int32         iEventy;
494           mng_objectp       pLastmousemove;     /* last event triggered */
495#endif
496
497           mng_uint32        iRequestframe;      /* go_xxxx variables */
498           mng_uint32        iRequestlayer;
499           mng_uint32        iRequesttime;
500           mng_bool          bSearching;
501
502           mng_bool          bRestorebkgd;       /* flags restore required before IDAT/JDAT */
503
504           mng_uint32        iRuntime;           /* millisecs since start */
505           mng_uint32        iSynctime;          /* tickcount at last framesync */
506           mng_uint32        iStarttime;         /* tickcount at start */
507           mng_uint32        iEndtime;           /* tickcount at end */
508           mng_bool          bRunning;           /* animation is active */
509           mng_bool          bTimerset;          /* the timer has been set;
510                                                    we're expecting a call to
511                                                    mng_display_resume! */
512           mng_uint8         iBreakpoint;        /* indicates at which point the
513                                                    flow was broken to run the timer */
514           mng_bool          bSectionwait;       /* indicates a section break */
515           mng_bool          bFreezing;          /* indicates app requested a freeze */   
516           mng_bool          bResetting;         /* indicates app requested a reset */   
517           mng_bool          bNeedrefresh;       /* indicates screen-refresh is needed */
518           mng_bool          bMisplacedTERM;     /* indicates TERM is out of place */
519           mng_bool          bOnlyfirstframe;    /* show first frame after TERM and stop */
520           mng_uint32        iFramesafterTERM;   /* determines frame-count after TERM */          
521           mng_objectp       pCurrentobj;        /* current "object" */
522           mng_objectp       pCurraniobj;        /* current animation object
523                                                    "to be"/"being" processed */
524           mng_objectp       pTermaniobj;        /* TERM animation object */
525           mng_uint32        iIterations;        /* TERM/MEND iteration count */
526           mng_objectp       pObjzero;           /* "on-the-fly" image (object = 0) */
527           mng_objectp       pLastclone;         /* last clone */
528           mng_objectp       pStoreobj;          /* current store object for row routines */
529           mng_objectp       pStorebuf;          /* current store object-buffer for row routines */
530           mng_objectp       pRetrieveobj;       /* current retrieve object for row routines */
531           mng_savedatap     pSavedata;          /* pointer to saved data (after SAVE) */
532
533           mng_uint32        iUpdateleft;        /* update region for refresh */
534           mng_uint32        iUpdateright;
535           mng_uint32        iUpdatetop;
536           mng_uint32        iUpdatebottom;
537
538           mng_int8          iPass;              /* current interlacing pass;
539                                                    negative value means no interlace */
540           mng_int32         iRow;               /* current row counter */
541           mng_int32         iRowinc;            /* row increment for this pass */
542           mng_int32         iCol;               /* current starting column */
543           mng_int32         iColinc;            /* column increment for this pass */
544           mng_int32         iRowsamples;        /* nr. of samples in current workrow */
545           mng_int32         iSamplemul;         /* needed to calculate rowsize */
546           mng_int32         iSampleofs;            /* from rowsamples */
547           mng_int32         iSamplediv;
548           mng_int32         iRowsize;           /* size of actual data in work row */
549           mng_int32         iRowmax;            /* maximum size of data in work row */
550           mng_int32         iFilterofs;         /* offset to filter-byte in work row */
551           mng_int32         iPixelofs;          /* offset to pixel-bytes in work row */
552           mng_uint32        iLevel0;            /* leveling variables */
553           mng_uint32        iLevel1;
554           mng_uint32        iLevel2;
555           mng_uint32        iLevel3;
556           mng_uint8p        pWorkrow;           /* working row of pixel-data */
557           mng_uint8p        pPrevrow;           /* previous row of pixel-data */
558           mng_uint8p        pRGBArow;           /* intermediate row of RGBA8 or RGBA16 data */
559           mng_bool          bIsRGBA16;          /* indicates intermediate row is RGBA16 */
560           mng_bool          bIsOpaque;          /* indicates intermediate row is fully opaque */
561           mng_int32         iFilterbpp;         /* bpp index for filtering routines */
562
563           mng_int32         iSourcel;           /* variables for showing objects */
564           mng_int32         iSourcer;
565           mng_int32         iSourcet;
566           mng_int32         iSourceb;
567           mng_int32         iDestl;
568           mng_int32         iDestr;
569           mng_int32         iDestt;
570           mng_int32         iDestb;
571
572           mng_objectp       pFirstimgobj;       /* double-linked list of */
573           mng_objectp       pLastimgobj;        /* image-object structures */
574           mng_objectp       pFirstaniobj;       /* double-linked list of */
575           mng_objectp       pLastaniobj;        /* animation-object structures */
576#ifdef MNG_SUPPORT_DYNAMICMNG
577           mng_objectp       pFirstevent;        /* double-linked list of */
578           mng_objectp       pLastevent;         /* event-object structures */
579#endif
580
581#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS) || defined(MNG_APP_CMS)
582           mng_uint8         aGammatab[256];     /* precomputed gamma lookup table */
583           mng_float         dLastgamma;         /* last gamma used to compute table */
584#endif
585
586           mng_fptr          fDisplayrow;        /* internal callback to display an
587                                                    uncompressed/unfiltered/
588                                                    color-corrected row */
589           mng_fptr          fRestbkgdrow;       /* internal callback for restore-
590                                                    background processing of a row */
591           mng_fptr          fCorrectrow;        /* internal callback to color-correct an
592                                                    uncompressed/unfiltered row */
593           mng_fptr          fRetrieverow;       /* internal callback to retrieve an
594                                                    uncompressed/unfiltered row of data */
595           mng_fptr          fStorerow;          /* internal callback to store an
596                                                    uncompressed/unfiltered row of data */
597           mng_fptr          fProcessrow;        /* internal callback to process an
598                                                    uncompressed row of data */
599           mng_fptr          fDifferrow;         /* internal callback to perform
600                                                    added filter leveling and
601                                                    differing on an unfiltered row */
602           mng_fptr          fScalerow;          /* internal callback to scale a
603                                                    delta-row to the bitdepth of its target */
604           mng_fptr          fDeltarow;          /* internal callback to execute a
605                                                    delta-row onto a target */
606#ifndef MNG_SKIPCHUNK_PAST
607           mng_fptr          fFliprow;           /* internal callback to flip a row of pixels
608                                                    left<->right for a PAST operation */
609           mng_fptr          fTilerow;           /* internal callback to tile a row of pixels
610                                                    during a PAST operation */
611#endif
612           mng_fptr          fInitrowproc;       /* internal callback to initialize
613                                                    the row processing */
614
615           mng_uint16        iDEFIobjectid;      /* DEFI fields */
616           mng_bool          bDEFIhasdonotshow;
617           mng_uint8         iDEFIdonotshow;
618           mng_bool          bDEFIhasconcrete;
619           mng_uint8         iDEFIconcrete;
620           mng_bool          bDEFIhasloca;
621           mng_int32         iDEFIlocax;
622           mng_int32         iDEFIlocay;
623           mng_bool          bDEFIhasclip;
624           mng_int32         iDEFIclipl;
625           mng_int32         iDEFIclipr;
626           mng_int32         iDEFIclipt;
627           mng_int32         iDEFIclipb;
628
629           mng_uint16        iBACKred;           /* BACK fields */
630           mng_uint16        iBACKgreen;
631           mng_uint16        iBACKblue;
632           mng_uint8         iBACKmandatory;
633           mng_uint16        iBACKimageid;
634           mng_uint8         iBACKtile;
635
636           mng_int32         iBackimgoffsx;      /* temp variables for restore_bkgd */
637           mng_int32         iBackimgoffsy;
638           mng_uint32        iBackimgwidth;
639           mng_uint32        iBackimgheight;
640
641#ifndef MNG_SKIPCHUNK_FRAM
642           mng_uint8         iFRAMmode;          /* FRAM fields (global) */
643           mng_uint32        iFRAMdelay;
644           mng_uint32        iFRAMtimeout;
645           mng_bool          bFRAMclipping;
646           mng_int32         iFRAMclipl;
647           mng_int32         iFRAMclipr;
648           mng_int32         iFRAMclipt;
649           mng_int32         iFRAMclipb;
650
651           mng_uint8         iFramemode;         /* current subframe variables */
652           mng_uint32        iFramedelay;
653           mng_uint32        iFrametimeout;
654           mng_bool          bFrameclipping;
655           mng_int32         iFrameclipl;
656           mng_int32         iFrameclipr;
657           mng_int32         iFrameclipt;
658           mng_int32         iFrameclipb;
659
660           mng_uint32        iNextdelay;         /* delay *after* next image */
661#endif
662
663#ifndef MNG_SKIPCHUNK_SHOW
664           mng_uint8         iSHOWmode;          /* SHOW fields */
665           mng_uint16        iSHOWfromid;
666           mng_uint16        iSHOWtoid;
667           mng_uint16        iSHOWnextid;
668           mng_int16         iSHOWskip;
669#endif
670
671           mng_uint32        iGlobalPLTEcount;   /* global PLTE fields */
672           mng_rgbpaltab     aGlobalPLTEentries;
673
674           mng_uint32        iGlobalTRNSrawlen;  /* global tRNS fields */
675           mng_uint8arr      aGlobalTRNSrawdata;
676
677           mng_uint32        iGlobalGamma;       /* global gAMA fields */
678
679#ifndef MNG_SKIPCHUNK_cHRM
680           mng_uint32        iGlobalWhitepointx; /* global cHRM fields */
681           mng_uint32        iGlobalWhitepointy;
682           mng_uint32        iGlobalPrimaryredx;
683           mng_uint32        iGlobalPrimaryredy;
684           mng_uint32        iGlobalPrimarygreenx;
685           mng_uint32        iGlobalPrimarygreeny;
686           mng_uint32        iGlobalPrimarybluex;
687           mng_uint32        iGlobalPrimarybluey;
688#endif
689
690           mng_uint8         iGlobalRendintent;  /* global sRGB fields */
691
692#ifndef MNG_SKIPCHUNK_iCCP
693           mng_uint32        iGlobalProfilesize; /* global iCCP fields */
694           mng_ptr           pGlobalProfile;
695#endif
696
697           mng_uint16        iGlobalBKGDred;     /* global bKGD fields */
698           mng_uint16        iGlobalBKGDgreen;
699           mng_uint16        iGlobalBKGDblue;
700
701           mng_ptr           pDeltaImage;        /* delta-image fields */
702           mng_uint8         iDeltaImagetype;
703#endif /* MNG_SUPPORT_DISPLAY */
704           mng_uint8         iDeltatype;         /* need this one in read processing !! */
705#ifdef MNG_SUPPORT_DISPLAY
706           mng_uint32        iDeltaBlockwidth;
707           mng_uint32        iDeltaBlockheight;
708           mng_uint32        iDeltaBlockx;
709           mng_uint32        iDeltaBlocky;
710           mng_bool          bDeltaimmediate;
711
712           mng_fptr          fDeltagetrow;       /* internal delta-proc callbacks */
713           mng_fptr          fDeltaaddrow;
714           mng_fptr          fDeltareplacerow;
715           mng_fptr          fDeltaputrow;
716
717#ifndef MNG_SKIPCHUNK_PROM
718           mng_fptr          fPromoterow;        /* internal PROM fields */
719           mng_fptr          fPromBitdepth;
720           mng_ptr           pPromBuf;
721           mng_uint8         iPromColortype;
722           mng_uint8         iPromBitdepth;
723           mng_uint8         iPromFilltype;
724           mng_uint32        iPromWidth;
725           mng_ptr           pPromSrc;
726           mng_ptr           pPromDst;
727#endif
728
729#ifndef MNG_SKIPCHUNK_MAGN
730           mng_uint16        iMAGNfromid;
731           mng_uint16        iMAGNcurrentid;
732           mng_uint16        iMAGNtoid;
733#endif
734
735#ifndef MNG_SKIPCHUNK_PAST
736           mng_uint16        iPASTid;
737           mng_int32         iPastx;             /* target x/y of last PAST */
738           mng_int32         iPasty;
739#endif
740
741           mng_objectp       pLastseek;          /* last processed ani_seek object */
742
743#ifdef MNG_INCLUDE_MPNG_PROPOSAL
744           mng_objectp       pMPNG;              /* mpNG object if available */
745#endif
746#ifdef MNG_INCLUDE_ANG_PROPOSAL
747           mng_objectp       pANG;               /* ANG object if available */
748#endif
749
750#endif /* MNG_SUPPORT_DISPLAY */
751
752#ifdef MNG_INCLUDE_ZLIB
753           z_stream          sZlib;              /* zlib (de)compression variables */
754
755           mng_int32         iZlevel;            /* zlib compression parameters */
756           mng_int32         iZmethod;
757           mng_int32         iZwindowbits;
758           mng_int32         iZmemlevel;
759           mng_int32         iZstrategy;
760
761           mng_uint32        iMaxIDAT;           /* maximum size of IDAT data */
762
763           mng_bool          bInflating;         /* indicates "inflate" in progress */
764           mng_bool          bDeflating;         /* indicates "deflate" in progress */
765#endif /* MNG_INCLUDE_ZLIB */
766
767#ifdef MNG_INCLUDE_JNG
768           mngjpeg_dctmethod eJPEGdctmethod;     /* IJG compression variables */
769           mng_int32         iJPEGquality;
770           mng_int32         iJPEGsmoothing;
771           mng_bool          bJPEGcompressprogr;
772           mng_bool          bJPEGcompressopt;
773
774           mng_uint32        iMaxJDAT;           /* maximum size of JDAT/JDAA data */
775
776           mngjpeg_compp     pJPEGcinfo;         /* compression structure */
777           mngjpeg_errorp    pJPEGcerr;          /* error-manager compress */
778
779           mngjpeg_decompp   pJPEGdinfo;         /* decompression structure (JDAT) */
780           mngjpeg_errorp    pJPEGderr;          /* error-manager decompress (JDAT) */
781           mngjpeg_sourcep   pJPEGdsrc;          /* source-manager decompress (JDAT) */
782
783           mngjpeg_decompp   pJPEGdinfo2;        /* decompression structure (JDAA) */
784           mngjpeg_errorp    pJPEGderr2;         /* error-manager decompress (JDAA) */
785           mngjpeg_sourcep   pJPEGdsrc2;         /* source-manager decompress (JDAA) */
786
787           mng_uint8p        pJPEGbuf;           /* buffer for JPEG (de)compression (JDAT) */
788           mng_uint32        iJPEGbufmax;        /* allocated space for buffer (JDAT) */
789           mng_uint8p        pJPEGcurrent;       /* current pointer into buffer (JDAT) */
790           mng_uint32        iJPEGbufremain;     /* remaining bytes in buffer (JDAT) */
791           mng_uint32        iJPEGtoskip;        /* bytes to skip on next input-block (JDAT) */
792
793           mng_uint8p        pJPEGbuf2;          /* buffer for JPEG (de)compression (JDAA) */
794           mng_uint32        iJPEGbufmax2;       /* allocated space for buffer (JDAA) */
795           mng_uint8p        pJPEGcurrent2;      /* current pointer into buffer (JDAA) */
796           mng_uint32        iJPEGbufremain2;    /* remaining bytes in buffer (JDAA) */
797           mng_uint32        iJPEGtoskip2;       /* bytes to skip on next input-block (JDAA) */
798
799           mng_uint8p        pJPEGrow;           /* buffer for a JPEG row of samples (JDAT) */
800           mng_uint32        iJPEGrowlen;
801
802           mng_uint8p        pJPEGrow2;          /* buffer for a JPEG row of samples (JDAA) */
803           mng_uint32        iJPEGrowlen2;
804
805           mng_bool          bJPEGcompress;      /* indicates "compress" initialized */
806
807           mng_bool          bJPEGdecompress;    /* indicates "decompress" initialized (JDAT) */
808           mng_bool          bJPEGhasheader;     /* indicates "readheader" succeeded (JDAT) */
809           mng_bool          bJPEGdecostarted;   /* indicates "decompress" started (JDAT) */
810           mng_bool          bJPEGscanstarted;   /* indicates "first scan" started (JDAT) */
811           mng_bool          bJPEGscanending;    /* indicates "finish_output" suspended (JDAT) */
812           mng_bool          bJPEGprogressive;   /* indicates a progressive image (JDAT) */
813
814           mng_bool          bJPEGdecompress2;   /* indicates "decompress" initialized (JDAA) */
815           mng_bool          bJPEGhasheader2;    /* indicates "readheader" succeeded (JDAA) */
816           mng_bool          bJPEGdecostarted2;  /* indicates "decompress" started (JDAA) */
817           mng_bool          bJPEGscanstarted2;  /* indicates "first scan" started (JDAA) */
818           mng_bool          bJPEGprogressive2;  /* indicates a progressive image (JDAA) */
819
820           mng_fptr          fStorerow2;         /* internal callback to store an
821                                                    uncompressed/unfiltered row of JPEG-data (JDAT) */
822
823           mng_fptr          fStorerow3;         /* internal callback to store an
824                                                    uncompressed/unfiltered row of JPEG-data (JDAA) */
825
826           mng_uint32        iJPEGrow;           /* row-number for current JPEG row */
827           mng_uint32        iJPEGalpharow;      /* nr. of rows filled with alpha */
828           mng_uint32        iJPEGrgbrow;        /* nr. of rows filled with 'color'-info */
829           mng_uint32        iJPEGdisprow;       /* nr. of rows already displayed "on-the-fly" */
830
831#if defined(MNG_USE_SETJMP) && defined (MNG_INCLUDE_IJG6B)
832           jmp_buf           sErrorbuf;          /* setjmp/longjmp buffer (error-recovery) */
833#endif
834
835#endif /* MNG_INCLUDE_JNG */
836
837#ifndef MNG_USE_ZLIB_CRC
838           mng_uint32        aCRCtable [256];    /* CRC prefab table */
839           mng_bool          bCRCcomputed;       /* "has been built" indicator */
840#endif
841
842#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
843           png_imgtype       ePng_imgtype;
844#endif
845
846#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT)
847           mng_uint8         iPNGdepth;          /* Real input depth */
848           mng_uint8         iPNGmult;
849#endif
850
851#ifdef MNG_OPTIMIZE_DISPLAYCALLS
852           mng_uint32        iRawlen;            /* temp vars for display processing */
853           mng_uint8p        pRawdata;
854#ifndef MNG_SKIPCHUNK_BASI
855           mng_uint16        iBASIred;
856           mng_uint16        iBASIgreen;
857           mng_uint16        iBASIblue;
858           mng_bool          bBASIhasalpha;
859           mng_uint16        iBASIalpha;
860           mng_uint8         iBASIviewable;
861#endif
862#ifndef MNG_SKIPCHUNK_CLON
863           mng_uint16        iCLONsourceid;
864           mng_uint16        iCLONcloneid;
865           mng_uint8         iCLONclonetype;
866           mng_bool          bCLONhasdonotshow;
867           mng_uint8         iCLONdonotshow;
868           mng_uint8         iCLONconcrete;
869           mng_bool          bCLONhasloca;
870           mng_uint8         iCLONlocationtype;
871           mng_int32         iCLONlocationx;
872           mng_int32         iCLONlocationy;
873#endif
874#ifndef MNG_SKIPCHUNK_DISC
875           mng_uint32        iDISCcount;
876           mng_uint16p       pDISCids;
877#endif
878#ifndef MNG_SKIPCHUNK_FRAM
879           mng_uint8         iTempFramemode;
880           mng_uint8         iTempChangedelay;
881           mng_uint32        iTempDelay;
882           mng_uint8         iTempChangetimeout;
883           mng_uint32        iTempTimeout;
884           mng_uint8         iTempChangeclipping;
885           mng_uint8         iTempCliptype;
886           mng_int32         iTempClipl;
887           mng_int32         iTempClipr;
888           mng_int32         iTempClipt;
889           mng_int32      

Large files files are truncated, but you can click here to view the full file