]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
compiles on OSX (10.4.10 Intel)
authorTTimo <ttimo@ttimo.net>
Sat, 3 Nov 2007 15:00:38 +0000 (15:00 +0000)
committerTTimo <ttimo@ttimo.net>
Sat, 3 Nov 2007 15:00:38 +0000 (15:00 +0000)
git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant@181 8a3a26a2-13c4-0310-b231-cf6edde360e5

38 files changed:
config.py
libs/jpeg6/.cvsignore [deleted file]
libs/jpeg6/.cvswrappers [deleted file]
libs/jpeg6/jchuff.h [deleted file]
libs/jpeg6/jcomapi.cpp [deleted file]
libs/jpeg6/jconfig.h [deleted file]
libs/jpeg6/jdapimin.cpp [deleted file]
libs/jpeg6/jdapistd.cpp [deleted file]
libs/jpeg6/jdatasrc.cpp [deleted file]
libs/jpeg6/jdcoefct.cpp [deleted file]
libs/jpeg6/jdcolor.cpp [deleted file]
libs/jpeg6/jdct.h [deleted file]
libs/jpeg6/jddctmgr.cpp [deleted file]
libs/jpeg6/jdhuff.cpp [deleted file]
libs/jpeg6/jdhuff.h [deleted file]
libs/jpeg6/jdinput.cpp [deleted file]
libs/jpeg6/jdmainct.cpp [deleted file]
libs/jpeg6/jdmarker.cpp [deleted file]
libs/jpeg6/jdmaster.cpp [deleted file]
libs/jpeg6/jdpostct.cpp [deleted file]
libs/jpeg6/jdsample.cpp [deleted file]
libs/jpeg6/jdtrans.cpp [deleted file]
libs/jpeg6/jerror.cpp [deleted file]
libs/jpeg6/jerror.h [deleted file]
libs/jpeg6/jfdctflt.cpp [deleted file]
libs/jpeg6/jidctflt.cpp [deleted file]
libs/jpeg6/jinclude.h [deleted file]
libs/jpeg6/jmemmgr.cpp [deleted file]
libs/jpeg6/jmemnobs.cpp [deleted file]
libs/jpeg6/jmemsys.h [deleted file]
libs/jpeg6/jmorecfg.h [deleted file]
libs/jpeg6/jpeg6.vcproj [deleted file]
libs/jpeg6/jpegint.h [deleted file]
libs/jpeg6/jpgload.cpp [deleted file]
libs/jpeg6/jutils.cpp [deleted file]
libs/jpeg6/jversion.h [deleted file]
libs/radiant_jpeglib.h [deleted file]
utils.py

index fb9c34fe1c4951373cff7adb18f934cb644d7ffe..9b7e370db6f944b32b04540b8942448c0041e80d 100644 (file)
--- a/config.py
+++ b/config.py
@@ -1,4 +1,4 @@
-import sys, traceback, platform, re, commands
+import sys, traceback, platform, re, commands, platform
 
 if __name__ != '__main__':
        from SCons.Script import *
@@ -25,8 +25,13 @@ class Config:
                self.target_selected = [ 'radiant' ]
                self.config_selected = [ 'release' ]
                # those are global to each config
-               self.cc = 'gcc-4.1'
-               self.cxx = 'g++-4.1'
+               self.platform = platform.system()
+               if ( self.platform == 'Darwin' ):
+                       self.cc = 'gcc'
+                       self.cxx = 'g++'
+               else:
+                       self.cc = 'gcc-4.1'
+                       self.cxx = 'g++-4.1'
 
        def __repr__( self ):
                return 'config: target=%s config=%s' % ( self.target_selected, self.config_selected )
@@ -108,6 +113,10 @@ class Config:
                env.Append( LINKFLAGS = xml2libs.split( ' ' ) )
                baseflags = [ '-pipe', '-Wall', '-fmessage-length=0', '-fvisibility=hidden', xml2.split( ' ' ) ]
 #              baseflags += [ '-m32' ]
+
+               if ( self.platform == 'Darwin' ):
+                       env.Append( CPPPATH = [ '/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include' ] )
+
                if ( useGtk ):
                        ( ret, gtk2 ) = commands.getstatusoutput( 'pkg-config gtk+-2.0 --cflags' )
                        if ( ret != 0 ):
@@ -125,6 +134,7 @@ class Config:
                        baseflags += glib.split( ' ' )
                        gliblibs = commands.getoutput( 'pkg-config glib-2.0 --libs' )
                        env.Append( LINKFLAGS = gliblibs.split( ' ' ) )
+
                if ( useGtkGL ):
                        ( ret, gtkgl ) = commands.getstatusoutput( 'pkg-config gtkglext-1.0 --cflags' )
                        if ( ret != 0 ):
diff --git a/libs/jpeg6/.cvsignore b/libs/jpeg6/.cvsignore
deleted file mode 100644 (file)
index face6ad..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-Debug
-Release
-*.ncb
-*.opt
-*.plg
-*.001
-*.BAK
-.consign
diff --git a/libs/jpeg6/.cvswrappers b/libs/jpeg6/.cvswrappers
deleted file mode 100644 (file)
index cdfd6d4..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-*.dsp  -m 'COPY' -k 'b'\r
-*.dsw  -m 'COPY' -k 'b'\r
-*.scc  -m 'COPY' -k 'b'\r
diff --git a/libs/jpeg6/jchuff.h b/libs/jpeg6/jchuff.h
deleted file mode 100644 (file)
index 7ae05e8..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*\r
-\r
- * jchuff.h\r
-\r
- *\r
-\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains declarations for Huffman entropy encoding routines\r
-\r
- * that are shared between the sequential encoder (jchuff.c) and the\r
-\r
- * progressive encoder (jcphuff.c).  No other modules need to see these.\r
-\r
- */\r
-\r
-\r
-\r
-/* Derived data constructed for each Huffman table */\r
-\r
-\r
-\r
-typedef struct {\r
-\r
-  unsigned int ehufco[256];    /* code for each symbol */\r
-\r
-  char ehufsi[256];            /* length of code for each symbol */\r
-\r
-  /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */\r
-\r
-} c_derived_tbl;\r
-\r
-\r
-\r
-/* Short forms of external names for systems with brain-damaged linkers. */\r
-\r
-\r
-\r
-#ifdef NEED_SHORT_EXTERNAL_NAMES\r
-\r
-#define jpeg_make_c_derived_tbl        jMkCDerived\r
-\r
-#define jpeg_gen_optimal_table jGenOptTbl\r
-\r
-#endif /* NEED_SHORT_EXTERNAL_NAMES */\r
-\r
-\r
-\r
-/* Expand a Huffman table definition into the derived format */\r
-\r
-EXTERN void jpeg_make_c_derived_tbl JPP((j_compress_ptr cinfo,\r
-\r
-                               JHUFF_TBL * htbl, c_derived_tbl ** pdtbl));\r
-\r
-\r
-\r
-/* Generate an optimal table definition given the specified counts */\r
-\r
-EXTERN void jpeg_gen_optimal_table JPP((j_compress_ptr cinfo,\r
-\r
-                                       JHUFF_TBL * htbl, long freq[]));\r
-\r
diff --git a/libs/jpeg6/jcomapi.cpp b/libs/jpeg6/jcomapi.cpp
deleted file mode 100644 (file)
index ebf2d79..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*\r
-\r
- * jcomapi.c\r
-\r
- *\r
-\r
- * Copyright (C) 1994, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains application interface routines that are used for both\r
-\r
- * compression and decompression.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Abort processing of a JPEG compression or decompression operation,\r
-\r
- * but don't destroy the object itself.\r
-\r
- *\r
-\r
- * For this, we merely clean up all the nonpermanent memory pools.\r
-\r
- * Note that temp files (virtual arrays) are not allowed to belong to\r
-\r
- * the permanent pool, so we will be able to close all temp files here.\r
-\r
- * Closing a data source or destination, if necessary, is the application's\r
-\r
- * responsibility.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_abort (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  int pool;\r
-\r
-\r
-\r
-  /* Releasing pools in reverse order might help avoid fragmentation\r
-\r
-   * with some (brain-damaged) malloc libraries.\r
-\r
-   */\r
-\r
-  for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) {\r
-\r
-    (*cinfo->mem->free_pool) (cinfo, pool);\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Reset overall state for possible reuse of object */\r
-\r
-  cinfo->global_state = (cinfo->is_decompressor ? DSTATE_START : CSTATE_START);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Destruction of a JPEG object.\r
-\r
- *\r
-\r
- * Everything gets deallocated except the master jpeg_compress_struct itself\r
-\r
- * and the error manager struct.  Both of these are supplied by the application\r
-\r
- * and must be freed, if necessary, by the application.  (Often they are on\r
-\r
- * the stack and so don't need to be freed anyway.)\r
-\r
- * Closing a data source or destination, if necessary, is the application's\r
-\r
- * responsibility.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_destroy (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  /* We need only tell the memory manager to release everything. */\r
-\r
-  /* NB: mem pointer is NULL if memory mgr failed to initialize. */\r
-\r
-  if (cinfo->mem != NULL)\r
-\r
-    (*cinfo->mem->self_destruct) (cinfo);\r
-\r
-  cinfo->mem = NULL;           /* be safe if jpeg_destroy is called twice */\r
-\r
-  cinfo->global_state = 0;     /* mark it destroyed */\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Convenience routines for allocating quantization and Huffman tables.\r
-\r
- * (Would jutils.c be a more reasonable place to put these?)\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL JQUANT_TBL *\r
-\r
-jpeg_alloc_quant_table (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  JQUANT_TBL *tbl;\r
-\r
-\r
-\r
-  tbl = (JQUANT_TBL *)\r
-\r
-    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL));\r
-\r
-  tbl->sent_table = FALSE;     /* make sure this is false in any new table */\r
-\r
-  return tbl;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-GLOBAL JHUFF_TBL *\r
-\r
-jpeg_alloc_huff_table (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  JHUFF_TBL *tbl;\r
-\r
-\r
-\r
-  tbl = (JHUFF_TBL *)\r
-\r
-    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL));\r
-\r
-  tbl->sent_table = FALSE;     /* make sure this is false in any new table */\r
-\r
-  return tbl;\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jconfig.h b/libs/jpeg6/jconfig.h
deleted file mode 100644 (file)
index c727519..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/* jconfig.wat --- jconfig.h for Watcom C/C++ on MS-DOS or OS/2. */\r
-\r
-/* see jconfig.doc for explanations */\r
-\r
-\r
-\r
-#define HAVE_PROTOTYPES\r
-\r
-#define HAVE_UNSIGNED_CHAR\r
-\r
-#define HAVE_UNSIGNED_SHORT\r
-\r
-/* #define void char */\r
-\r
-/* #define const */\r
-\r
-#define CHAR_IS_UNSIGNED\r
-\r
-#define HAVE_STDDEF_H\r
-\r
-#define HAVE_STDLIB_H\r
-\r
-#undef NEED_BSD_STRINGS\r
-\r
-#undef NEED_SYS_TYPES_H\r
-\r
-#undef NEED_FAR_POINTERS       /* Watcom uses flat 32-bit addressing */\r
-\r
-#undef NEED_SHORT_EXTERNAL_NAMES\r
-\r
-#undef INCOMPLETE_TYPES_BROKEN\r
-\r
-\r
-\r
-#define JDCT_DEFAULT  JDCT_FLOAT\r
-\r
-#define JDCT_FASTEST  JDCT_FLOAT\r
-\r
-\r
-\r
-#ifdef JPEG_INTERNALS\r
-\r
-\r
-\r
-#undef RIGHT_SHIFT_IS_UNSIGNED\r
-\r
-\r
-\r
-#endif /* JPEG_INTERNALS */\r
-\r
-\r
-\r
-#ifdef JPEG_CJPEG_DJPEG\r
-\r
-\r
-\r
-#define BMP_SUPPORTED          /* BMP image file format */\r
-\r
-#define GIF_SUPPORTED          /* GIF image file format */\r
-\r
-#define PPM_SUPPORTED          /* PBMPLUS PPM/PGM image file format */\r
-\r
-#undef RLE_SUPPORTED           /* Utah RLE image file format */\r
-\r
-#define TARGA_SUPPORTED                /* Targa image file format */\r
-\r
-\r
-\r
-#undef TWO_FILE_COMMANDLINE    /* optional */\r
-\r
-#define USE_SETMODE            /* Needed to make one-file style work in Watcom */\r
-\r
-#undef NEED_SIGNAL_CATCHER     /* Define this if you use jmemname.c */\r
-\r
-#undef DONT_USE_B_MODE\r
-\r
-#undef PROGRESS_REPORT         /* optional */\r
-\r
-\r
-\r
-#endif /* JPEG_CJPEG_DJPEG */\r
-\r
diff --git a/libs/jpeg6/jdapimin.cpp b/libs/jpeg6/jdapimin.cpp
deleted file mode 100644 (file)
index 9086b49..0000000
+++ /dev/null
@@ -1,800 +0,0 @@
-/*\r
-\r
- * jdapimin.c\r
-\r
- *\r
-\r
- * Copyright (C) 1994-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains application interface code for the decompression half\r
-\r
- * of the JPEG library.  These are the "minimum" API routines that may be\r
-\r
- * needed in either the normal full-decompression case or the\r
-\r
- * transcoding-only case.\r
-\r
- *\r
-\r
- * Most of the routines intended to be called directly by an application\r
-\r
- * are in this file or in jdapistd.c.  But also see jcomapi.c for routines\r
-\r
- * shared by compression and decompression, and jdtrans.c for the transcoding\r
-\r
- * case.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialization of a JPEG decompression object.\r
-\r
- * The error manager must already be set up (in case memory manager fails).\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_create_decompress (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  int i;\r
-\r
-\r
-\r
-  /* For debugging purposes, zero the whole master structure.\r
-\r
-   * But error manager pointer is already there, so save and restore it.\r
-\r
-   */\r
-\r
-  {\r
-\r
-    struct jpeg_error_mgr * err = cinfo->err;\r
-\r
-    i = sizeof(struct jpeg_decompress_struct);\r
-\r
-    i = SIZEOF(struct jpeg_decompress_struct);\r
-\r
-    MEMZERO(cinfo, SIZEOF(struct jpeg_decompress_struct));\r
-\r
-    cinfo->err = err;\r
-\r
-  }\r
-\r
-  cinfo->is_decompressor = TRUE;\r
-\r
-\r
-\r
-  /* Initialize a memory manager instance for this object */\r
-\r
-  jinit_memory_mgr((j_common_ptr) cinfo);\r
-\r
-\r
-\r
-  /* Zero out pointers to permanent structures. */\r
-\r
-  cinfo->progress = NULL;\r
-\r
-  cinfo->src = NULL;\r
-\r
-\r
-\r
-  for (i = 0; i < NUM_QUANT_TBLS; i++)\r
-\r
-    cinfo->quant_tbl_ptrs[i] = NULL;\r
-\r
-\r
-\r
-  for (i = 0; i < NUM_HUFF_TBLS; i++) {\r
-\r
-    cinfo->dc_huff_tbl_ptrs[i] = NULL;\r
-\r
-    cinfo->ac_huff_tbl_ptrs[i] = NULL;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Initialize marker processor so application can override methods\r
-\r
-   * for COM, APPn markers before calling jpeg_read_header.\r
-\r
-   */\r
-\r
-  jinit_marker_reader(cinfo);\r
-\r
-\r
-\r
-  /* And initialize the overall input controller. */\r
-\r
-  jinit_input_controller(cinfo);\r
-\r
-\r
-\r
-  /* OK, I'm ready */\r
-\r
-  cinfo->global_state = DSTATE_START;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Destruction of a JPEG decompression object\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_destroy_decompress (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  jpeg_destroy((j_common_ptr) cinfo); /* use common routine */\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Abort processing of a JPEG decompression operation,\r
-\r
- * but don't destroy the object itself.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_abort_decompress (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  jpeg_abort((j_common_ptr) cinfo); /* use common routine */\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Install a special processing method for COM or APPn markers.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code,\r
-\r
-                          jpeg_marker_parser_method routine)\r
-\r
-{\r
-\r
-  if (marker_code == JPEG_COM)\r
-\r
-    cinfo->marker->process_COM = routine;\r
-\r
-  else if (marker_code >= JPEG_APP0 && marker_code <= JPEG_APP0+15)\r
-\r
-    cinfo->marker->process_APPn[marker_code-JPEG_APP0] = routine;\r
-\r
-  else\r
-\r
-    ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Set default decompression parameters.\r
-\r
- */\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-default_decompress_parms (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  /* Guess the input colorspace, and set output colorspace accordingly. */\r
-\r
-  /* (Wish JPEG committee had provided a real way to specify this...) */\r
-\r
-  /* Note application may override our guesses. */\r
-\r
-  switch (cinfo->num_components) {\r
-\r
-  case 1:\r
-\r
-    cinfo->jpeg_color_space = JCS_GRAYSCALE;\r
-\r
-    cinfo->out_color_space = JCS_GRAYSCALE;\r
-\r
-    break;\r
-\r
-    \r
-\r
-  case 3:\r
-\r
-    if (cinfo->saw_JFIF_marker) {\r
-\r
-      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */\r
-\r
-    } else if (cinfo->saw_Adobe_marker) {\r
-\r
-      switch (cinfo->Adobe_transform) {\r
-\r
-      case 0:\r
-\r
-       cinfo->jpeg_color_space = JCS_RGB;\r
-\r
-       break;\r
-\r
-      case 1:\r
-\r
-       cinfo->jpeg_color_space = JCS_YCbCr;\r
-\r
-       break;\r
-\r
-      default:\r
-\r
-       WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);\r
-\r
-       cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */\r
-\r
-       break;\r
-\r
-      }\r
-\r
-    } else {\r
-\r
-      /* Saw no special markers, try to guess from the component IDs */\r
-\r
-      int cid0 = cinfo->comp_info[0].component_id;\r
-\r
-      int cid1 = cinfo->comp_info[1].component_id;\r
-\r
-      int cid2 = cinfo->comp_info[2].component_id;\r
-\r
-\r
-\r
-      if (cid0 == 1 && cid1 == 2 && cid2 == 3)\r
-\r
-       cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */\r
-\r
-      else if (cid0 == 82 && cid1 == 71 && cid2 == 66)\r
-\r
-       cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */\r
-\r
-      else {\r
-\r
-       TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);\r
-\r
-       cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */\r
-\r
-      }\r
-\r
-    }\r
-\r
-    /* Always guess RGB is proper output colorspace. */\r
-\r
-    cinfo->out_color_space = JCS_RGB;\r
-\r
-    break;\r
-\r
-    \r
-\r
-  case 4:\r
-\r
-    if (cinfo->saw_Adobe_marker) {\r
-\r
-      switch (cinfo->Adobe_transform) {\r
-\r
-      case 0:\r
-\r
-       cinfo->jpeg_color_space = JCS_CMYK;\r
-\r
-       break;\r
-\r
-      case 2:\r
-\r
-       cinfo->jpeg_color_space = JCS_YCCK;\r
-\r
-       break;\r
-\r
-      default:\r
-\r
-       WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);\r
-\r
-       cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */\r
-\r
-       break;\r
-\r
-      }\r
-\r
-    } else {\r
-\r
-      /* No special markers, assume straight CMYK. */\r
-\r
-      cinfo->jpeg_color_space = JCS_CMYK;\r
-\r
-    }\r
-\r
-    cinfo->out_color_space = JCS_CMYK;\r
-\r
-    break;\r
-\r
-    \r
-\r
-  default:\r
-\r
-    cinfo->jpeg_color_space = JCS_UNKNOWN;\r
-\r
-    cinfo->out_color_space = JCS_UNKNOWN;\r
-\r
-    break;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Set defaults for other decompression parameters. */\r
-\r
-  cinfo->scale_num = 1;                /* 1:1 scaling */\r
-\r
-  cinfo->scale_denom = 1;\r
-\r
-  cinfo->output_gamma = 1.0;\r
-\r
-  cinfo->buffered_image = FALSE;\r
-\r
-  cinfo->raw_data_out = FALSE;\r
-\r
-  cinfo->dct_method = JDCT_DEFAULT;\r
-\r
-  cinfo->do_fancy_upsampling = TRUE;\r
-\r
-  cinfo->do_block_smoothing = TRUE;\r
-\r
-  cinfo->quantize_colors = FALSE;\r
-\r
-  /* We set these in case application only sets quantize_colors. */\r
-\r
-  cinfo->dither_mode = JDITHER_FS;\r
-\r
-#ifdef QUANT_2PASS_SUPPORTED\r
-\r
-  cinfo->two_pass_quantize = TRUE;\r
-\r
-#else\r
-\r
-  cinfo->two_pass_quantize = FALSE;\r
-\r
-#endif\r
-\r
-  cinfo->desired_number_of_colors = 256;\r
-\r
-  cinfo->colormap = NULL;\r
-\r
-  /* Initialize for no mode change in buffered-image mode. */\r
-\r
-  cinfo->enable_1pass_quant = FALSE;\r
-\r
-  cinfo->enable_external_quant = FALSE;\r
-\r
-  cinfo->enable_2pass_quant = FALSE;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Decompression startup: read start of JPEG datastream to see what's there.\r
-\r
- * Need only initialize JPEG object and supply a data source before calling.\r
-\r
- *\r
-\r
- * This routine will read as far as the first SOS marker (ie, actual start of\r
-\r
- * compressed data), and will save all tables and parameters in the JPEG\r
-\r
- * object.  It will also initialize the decompression parameters to default\r
-\r
- * values, and finally return JPEG_HEADER_OK.  On return, the application may\r
-\r
- * adjust the decompression parameters and then call jpeg_start_decompress.\r
-\r
- * (Or, if the application only wanted to determine the image parameters,\r
-\r
- * the data need not be decompressed.  In that case, call jpeg_abort or\r
-\r
- * jpeg_destroy to release any temporary space.)\r
-\r
- * If an abbreviated (tables only) datastream is presented, the routine will\r
-\r
- * return JPEG_HEADER_TABLES_ONLY upon reaching EOI.  The application may then\r
-\r
- * re-use the JPEG object to read the abbreviated image datastream(s).\r
-\r
- * It is unnecessary (but OK) to call jpeg_abort in this case.\r
-\r
- * The JPEG_SUSPENDED return code only occurs if the data source module\r
-\r
- * requests suspension of the decompressor.  In this case the application\r
-\r
- * should load more source data and then re-call jpeg_read_header to resume\r
-\r
- * processing.\r
-\r
- * If a non-suspending data source is used and require_image is TRUE, then the\r
-\r
- * return code need not be inspected since only JPEG_HEADER_OK is possible.\r
-\r
- *\r
-\r
- * This routine is now just a front end to jpeg_consume_input, with some\r
-\r
- * extra error checking.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL int\r
-\r
-jpeg_read_header (j_decompress_ptr cinfo, boolean require_image)\r
-\r
-{\r
-\r
-  int retcode;\r
-\r
-\r
-\r
-  if (cinfo->global_state != DSTATE_START &&\r
-\r
-      cinfo->global_state != DSTATE_INHEADER)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-\r
-\r
-  retcode = jpeg_consume_input(cinfo);\r
-\r
-\r
-\r
-  switch (retcode) {\r
-\r
-  case JPEG_REACHED_SOS:\r
-\r
-    retcode = JPEG_HEADER_OK;\r
-\r
-    break;\r
-\r
-  case JPEG_REACHED_EOI:\r
-\r
-    if (require_image)         /* Complain if application wanted an image */\r
-\r
-      ERREXIT(cinfo, JERR_NO_IMAGE);\r
-\r
-    /* Reset to start state; it would be safer to require the application to\r
-\r
-     * call jpeg_abort, but we can't change it now for compatibility reasons.\r
-\r
-     * A side effect is to free any temporary memory (there shouldn't be any).\r
-\r
-     */\r
-\r
-    jpeg_abort((j_common_ptr) cinfo); /* sets state = DSTATE_START */\r
-\r
-    retcode = JPEG_HEADER_TABLES_ONLY;\r
-\r
-    break;\r
-\r
-  case JPEG_SUSPENDED:\r
-\r
-    /* no work */\r
-\r
-    break;\r
-\r
-  }\r
-\r
-\r
-\r
-  return retcode;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Consume data in advance of what the decompressor requires.\r
-\r
- * This can be called at any time once the decompressor object has\r
-\r
- * been created and a data source has been set up.\r
-\r
- *\r
-\r
- * This routine is essentially a state machine that handles a couple\r
-\r
- * of critical state-transition actions, namely initial setup and\r
-\r
- * transition from header scanning to ready-for-start_decompress.\r
-\r
- * All the actual input is done via the input controller's consume_input\r
-\r
- * method.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL int\r
-\r
-jpeg_consume_input (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  int retcode = JPEG_SUSPENDED;\r
-\r
-\r
-\r
-  /* NB: every possible DSTATE value should be listed in this switch */\r
-\r
-  switch (cinfo->global_state) {\r
-\r
-  case DSTATE_START:\r
-\r
-    /* Start-of-datastream actions: reset appropriate modules */\r
-\r
-    (*cinfo->inputctl->reset_input_controller) (cinfo);\r
-\r
-    /* Initialize application's data source module */\r
-\r
-    (*cinfo->src->init_source) (cinfo);\r
-\r
-    cinfo->global_state = DSTATE_INHEADER;\r
-\r
-    /*FALLTHROUGH*/\r
-\r
-  case DSTATE_INHEADER:\r
-\r
-    retcode = (*cinfo->inputctl->consume_input) (cinfo);\r
-\r
-    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */\r
-\r
-      /* Set up default parameters based on header data */\r
-\r
-      default_decompress_parms(cinfo);\r
-\r
-      /* Set global state: ready for start_decompress */\r
-\r
-      cinfo->global_state = DSTATE_READY;\r
-\r
-    }\r
-\r
-    break;\r
-\r
-  case DSTATE_READY:\r
-\r
-    /* Can't advance past first SOS until start_decompress is called */\r
-\r
-    retcode = JPEG_REACHED_SOS;\r
-\r
-    break;\r
-\r
-  case DSTATE_PRELOAD:\r
-\r
-  case DSTATE_PRESCAN:\r
-\r
-  case DSTATE_SCANNING:\r
-\r
-  case DSTATE_RAW_OK:\r
-\r
-  case DSTATE_BUFIMAGE:\r
-\r
-  case DSTATE_BUFPOST:\r
-\r
-  case DSTATE_STOPPING:\r
-\r
-    retcode = (*cinfo->inputctl->consume_input) (cinfo);\r
-\r
-    break;\r
-\r
-  default:\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-  }\r
-\r
-  return retcode;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Have we finished reading the input file?\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL boolean\r
-\r
-jpeg_input_complete (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  /* Check for valid jpeg object */\r
-\r
-  if (cinfo->global_state < DSTATE_START ||\r
-\r
-      cinfo->global_state > DSTATE_STOPPING)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-  return cinfo->inputctl->eoi_reached;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Is there more than one scan?\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL boolean\r
-\r
-jpeg_has_multiple_scans (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  /* Only valid after jpeg_read_header completes */\r
-\r
-  if (cinfo->global_state < DSTATE_READY ||\r
-\r
-      cinfo->global_state > DSTATE_STOPPING)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-  return cinfo->inputctl->has_multiple_scans;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Finish JPEG decompression.\r
-\r
- *\r
-\r
- * This will normally just verify the file trailer and release temp storage.\r
-\r
- *\r
-\r
- * Returns FALSE if suspended.  The return value need be inspected only if\r
-\r
- * a suspending data source is used.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL boolean\r
-\r
-jpeg_finish_decompress (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  if ((cinfo->global_state == DSTATE_SCANNING ||\r
-\r
-       cinfo->global_state == DSTATE_RAW_OK) && ! cinfo->buffered_image) {\r
-\r
-    /* Terminate final pass of non-buffered mode */\r
-\r
-    if (cinfo->output_scanline < cinfo->output_height)\r
-\r
-      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);\r
-\r
-    (*cinfo->master->finish_output_pass) (cinfo);\r
-\r
-    cinfo->global_state = DSTATE_STOPPING;\r
-\r
-  } else if (cinfo->global_state == DSTATE_BUFIMAGE) {\r
-\r
-    /* Finishing after a buffered-image operation */\r
-\r
-    cinfo->global_state = DSTATE_STOPPING;\r
-\r
-  } else if (cinfo->global_state != DSTATE_STOPPING) {\r
-\r
-    /* STOPPING = repeat call after a suspension, anything else is error */\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-  }\r
-\r
-  /* Read until EOI */\r
-\r
-  while (! cinfo->inputctl->eoi_reached) {\r
-\r
-    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)\r
-\r
-      return FALSE;            /* Suspend, come back later */\r
-\r
-  }\r
-\r
-  /* Do final cleanup */\r
-\r
-  (*cinfo->src->term_source) (cinfo);\r
-\r
-  /* We can use jpeg_abort to release memory and reset global_state */\r
-\r
-  jpeg_abort((j_common_ptr) cinfo);\r
-\r
-  return TRUE;\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jdapistd.cpp b/libs/jpeg6/jdapistd.cpp
deleted file mode 100644 (file)
index 0718fb3..0000000
+++ /dev/null
@@ -1,550 +0,0 @@
-/*\r
-\r
- * jdapistd.c\r
-\r
- *\r
-\r
- * Copyright (C) 1994-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains application interface code for the decompression half\r
-\r
- * of the JPEG library.  These are the "standard" API routines that are\r
-\r
- * used in the normal full-decompression case.  They are not used by a\r
-\r
- * transcoding-only application.  Note that if an application links in\r
-\r
- * jpeg_start_decompress, it will end up linking in the entire decompressor.\r
-\r
- * We thus must separate this file from jdapimin.c to avoid linking the\r
-\r
- * whole decompression library into a transcoder.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-\r
-\r
-/* Forward declarations */\r
-\r
-LOCAL boolean output_pass_setup JPP((j_decompress_ptr cinfo));\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Decompression initialization.\r
-\r
- * jpeg_read_header must be completed before calling this.\r
-\r
- *\r
-\r
- * If a multipass operating mode was selected, this will do all but the\r
-\r
- * last pass, and thus may take a great deal of time.\r
-\r
- *\r
-\r
- * Returns FALSE if suspended.  The return value need be inspected only if\r
-\r
- * a suspending data source is used.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL boolean\r
-\r
-jpeg_start_decompress (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  if (cinfo->global_state == DSTATE_READY) {\r
-\r
-    /* First call: initialize master control, select active modules */\r
-\r
-    jinit_master_decompress(cinfo);\r
-\r
-    if (cinfo->buffered_image) {\r
-\r
-      /* No more work here; expecting jpeg_start_output next */\r
-\r
-      cinfo->global_state = DSTATE_BUFIMAGE;\r
-\r
-      return TRUE;\r
-\r
-    }\r
-\r
-    cinfo->global_state = DSTATE_PRELOAD;\r
-\r
-  }\r
-\r
-  if (cinfo->global_state == DSTATE_PRELOAD) {\r
-\r
-    /* If file has multiple scans, absorb them all into the coef buffer */\r
-\r
-    if (cinfo->inputctl->has_multiple_scans) {\r
-\r
-#ifdef D_MULTISCAN_FILES_SUPPORTED\r
-\r
-      for (;;) {\r
-\r
-       int retcode;\r
-\r
-       /* Call progress monitor hook if present */\r
-\r
-       if (cinfo->progress != NULL)\r
-\r
-         (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);\r
-\r
-       /* Absorb some more input */\r
-\r
-       retcode = (*cinfo->inputctl->consume_input) (cinfo);\r
-\r
-       if (retcode == JPEG_SUSPENDED)\r
-\r
-         return FALSE;\r
-\r
-       if (retcode == JPEG_REACHED_EOI)\r
-\r
-         break;\r
-\r
-       /* Advance progress counter if appropriate */\r
-\r
-       if (cinfo->progress != NULL &&\r
-\r
-           (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {\r
-\r
-         if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {\r
-\r
-           /* jdmaster underestimated number of scans; ratchet up one scan */\r
-\r
-           cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;\r
-\r
-         }\r
-\r
-       }\r
-\r
-      }\r
-\r
-#else\r
-\r
-      ERREXIT(cinfo, JERR_NOT_COMPILED);\r
-\r
-#endif /* D_MULTISCAN_FILES_SUPPORTED */\r
-\r
-    }\r
-\r
-    cinfo->output_scan_number = cinfo->input_scan_number;\r
-\r
-  } else if (cinfo->global_state != DSTATE_PRESCAN)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-  /* Perform any dummy output passes, and set up for the final pass */\r
-\r
-  return output_pass_setup(cinfo);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Set up for an output pass, and perform any dummy pass(es) needed.\r
-\r
- * Common subroutine for jpeg_start_decompress and jpeg_start_output.\r
-\r
- * Entry: global_state = DSTATE_PRESCAN only if previously suspended.\r
-\r
- * Exit: If done, returns TRUE and sets global_state for proper output mode.\r
-\r
- *       If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN.\r
-\r
- */\r
-\r
-\r
-\r
-LOCAL boolean\r
-\r
-output_pass_setup (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  if (cinfo->global_state != DSTATE_PRESCAN) {\r
-\r
-    /* First call: do pass setup */\r
-\r
-    (*cinfo->master->prepare_for_output_pass) (cinfo);\r
-\r
-    cinfo->output_scanline = 0;\r
-\r
-    cinfo->global_state = DSTATE_PRESCAN;\r
-\r
-  }\r
-\r
-  /* Loop over any required dummy passes */\r
-\r
-  while (cinfo->master->is_dummy_pass) {\r
-\r
-#ifdef QUANT_2PASS_SUPPORTED\r
-\r
-    /* Crank through the dummy pass */\r
-\r
-    while (cinfo->output_scanline < cinfo->output_height) {\r
-\r
-      JDIMENSION last_scanline;\r
-\r
-      /* Call progress monitor hook if present */\r
-\r
-      if (cinfo->progress != NULL) {\r
-\r
-       cinfo->progress->pass_counter = (long) cinfo->output_scanline;\r
-\r
-       cinfo->progress->pass_limit = (long) cinfo->output_height;\r
-\r
-       (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);\r
-\r
-      }\r
-\r
-      /* Process some data */\r
-\r
-      last_scanline = cinfo->output_scanline;\r
-\r
-      (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL,\r
-\r
-                                   &cinfo->output_scanline, (JDIMENSION) 0);\r
-\r
-      if (cinfo->output_scanline == last_scanline)\r
-\r
-       return FALSE;           /* No progress made, must suspend */\r
-\r
-    }\r
-\r
-    /* Finish up dummy pass, and set up for another one */\r
-\r
-    (*cinfo->master->finish_output_pass) (cinfo);\r
-\r
-    (*cinfo->master->prepare_for_output_pass) (cinfo);\r
-\r
-    cinfo->output_scanline = 0;\r
-\r
-#else\r
-\r
-    ERREXIT(cinfo, JERR_NOT_COMPILED);\r
-\r
-#endif /* QUANT_2PASS_SUPPORTED */\r
-\r
-  }\r
-\r
-  /* Ready for application to drive output pass through\r
-\r
-   * jpeg_read_scanlines or jpeg_read_raw_data.\r
-\r
-   */\r
-\r
-  cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;\r
-\r
-  return TRUE;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Read some scanlines of data from the JPEG decompressor.\r
-\r
- *\r
-\r
- * The return value will be the number of lines actually read.\r
-\r
- * This may be less than the number requested in several cases,\r
-\r
- * including bottom of image, data source suspension, and operating\r
-\r
- * modes that emit multiple scanlines at a time.\r
-\r
- *\r
-\r
- * Note: we warn about excess calls to jpeg_read_scanlines() since\r
-\r
- * this likely signals an application programmer error.  However,\r
-\r
- * an oversize buffer (max_lines > scanlines remaining) is not an error.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL JDIMENSION\r
-\r
-jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,\r
-\r
-                    JDIMENSION max_lines)\r
-\r
-{\r
-\r
-  JDIMENSION row_ctr;\r
-\r
-\r
-\r
-  if (cinfo->global_state != DSTATE_SCANNING)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-  if (cinfo->output_scanline >= cinfo->output_height) {\r
-\r
-    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);\r
-\r
-    return 0;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Call progress monitor hook if present */\r
-\r
-  if (cinfo->progress != NULL) {\r
-\r
-    cinfo->progress->pass_counter = (long) cinfo->output_scanline;\r
-\r
-    cinfo->progress->pass_limit = (long) cinfo->output_height;\r
-\r
-    (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Process some data */\r
-\r
-  row_ctr = 0;\r
-\r
-  (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines);\r
-\r
-  cinfo->output_scanline += row_ctr;\r
-\r
-  return row_ctr;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Alternate entry point to read raw data.\r
-\r
- * Processes exactly one iMCU row per call, unless suspended.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL JDIMENSION\r
-\r
-jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,\r
-\r
-                   JDIMENSION max_lines)\r
-\r
-{\r
-\r
-  JDIMENSION lines_per_iMCU_row;\r
-\r
-\r
-\r
-  if (cinfo->global_state != DSTATE_RAW_OK)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-  if (cinfo->output_scanline >= cinfo->output_height) {\r
-\r
-    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);\r
-\r
-    return 0;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Call progress monitor hook if present */\r
-\r
-  if (cinfo->progress != NULL) {\r
-\r
-    cinfo->progress->pass_counter = (long) cinfo->output_scanline;\r
-\r
-    cinfo->progress->pass_limit = (long) cinfo->output_height;\r
-\r
-    (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Verify that at least one iMCU row can be returned. */\r
-\r
-  lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size;\r
-\r
-  if (max_lines < lines_per_iMCU_row)\r
-\r
-    ERREXIT(cinfo, JERR_BUFFER_SIZE);\r
-\r
-\r
-\r
-  /* Decompress directly into user's buffer. */\r
-\r
-  if (! (*cinfo->coef->decompress_data) (cinfo, data))\r
-\r
-    return 0;                  /* suspension forced, can do nothing more */\r
-\r
-\r
-\r
-  /* OK, we processed one iMCU row. */\r
-\r
-  cinfo->output_scanline += lines_per_iMCU_row;\r
-\r
-  return lines_per_iMCU_row;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/* Additional entry points for buffered-image mode. */\r
-\r
-\r
-\r
-#ifdef D_MULTISCAN_FILES_SUPPORTED\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize for an output pass in buffered-image mode.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL boolean\r
-\r
-jpeg_start_output (j_decompress_ptr cinfo, int scan_number)\r
-\r
-{\r
-\r
-  if (cinfo->global_state != DSTATE_BUFIMAGE &&\r
-\r
-      cinfo->global_state != DSTATE_PRESCAN)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-  /* Limit scan number to valid range */\r
-\r
-  if (scan_number <= 0)\r
-\r
-    scan_number = 1;\r
-\r
-  if (cinfo->inputctl->eoi_reached &&\r
-\r
-      scan_number > cinfo->input_scan_number)\r
-\r
-    scan_number = cinfo->input_scan_number;\r
-\r
-  cinfo->output_scan_number = scan_number;\r
-\r
-  /* Perform any dummy output passes, and set up for the real pass */\r
-\r
-  return output_pass_setup(cinfo);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Finish up after an output pass in buffered-image mode.\r
-\r
- *\r
-\r
- * Returns FALSE if suspended.  The return value need be inspected only if\r
-\r
- * a suspending data source is used.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL boolean\r
-\r
-jpeg_finish_output (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  if ((cinfo->global_state == DSTATE_SCANNING ||\r
-\r
-       cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) {\r
-\r
-    /* Terminate this pass. */\r
-\r
-    /* We do not require the whole pass to have been completed. */\r
-\r
-    (*cinfo->master->finish_output_pass) (cinfo);\r
-\r
-    cinfo->global_state = DSTATE_BUFPOST;\r
-\r
-  } else if (cinfo->global_state != DSTATE_BUFPOST) {\r
-\r
-    /* BUFPOST = repeat call after a suspension, anything else is error */\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-  }\r
-\r
-  /* Read markers looking for SOS or EOI */\r
-\r
-  while (cinfo->input_scan_number <= cinfo->output_scan_number &&\r
-\r
-        ! cinfo->inputctl->eoi_reached) {\r
-\r
-    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)\r
-\r
-      return FALSE;            /* Suspend, come back later */\r
-\r
-  }\r
-\r
-  cinfo->global_state = DSTATE_BUFIMAGE;\r
-\r
-  return TRUE;\r
-\r
-}\r
-\r
-\r
-\r
-#endif /* D_MULTISCAN_FILES_SUPPORTED */\r
-\r
diff --git a/libs/jpeg6/jdatasrc.cpp b/libs/jpeg6/jdatasrc.cpp
deleted file mode 100644 (file)
index ae95d21..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*\r
- * jdatasrc.c\r
- *\r
- * Copyright (C) 1994, Thomas G. Lane.\r
- * This file is part of the Independent JPEG Group's software.\r
- * For conditions of distribution and use, see the accompanying README file.\r
- *\r
- * This file contains decompression data source routines for the case of\r
- * reading JPEG data from a file (or any stdio stream).  While these routines\r
- * are sufficient for most applications, some will want to use a different\r
- * source manager.\r
- * IMPORTANT: we assume that fread() will correctly transcribe an array of\r
- * JOCTETs from 8-bit-wide elements on external storage.  If char is wider\r
- * than 8 bits on your machine, you may need to do some tweaking.\r
- */\r
-\r
-\r
-/* this is not a core library module, so it doesn't define JPEG_INTERNALS */\r
-#include "jinclude.h"\r
-#include "radiant_jpeglib.h"\r
-#include "jerror.h"\r
-\r
-//extern int leo_buf_size; // FIXME ? merged in from Alpha - replaced by my_source_mgr->src_size\r
-\r
-/* Expanded data source object for stdio input */\r
-\r
-typedef struct {\r
-  struct jpeg_source_mgr pub;  /* public fields */\r
-  int src_size; // FIXME ? merged from Alpha\r
-  unsigned char *infile;               /* source stream */\r
-  JOCTET * buffer;             /* start of buffer */\r
-  boolean start_of_file;       /* have we gotten any data yet? */\r
-} my_source_mgr;\r
-\r
-typedef my_source_mgr * my_src_ptr;\r
-\r
-#define INPUT_BUF_SIZE  4096   /* choose an efficiently fread'able size */\r
-\r
-\r
-/*\r
- * Initialize source --- called by jpeg_read_header\r
- * before any data is actually read.\r
- */\r
-\r
-METHODDEF void\r
-init_source (j_decompress_ptr cinfo)\r
-{\r
-  my_src_ptr src = (my_src_ptr) cinfo->src;\r
-\r
-  /* We reset the empty-input-file flag for each image,\r
-   * but we don't clear the input buffer.\r
-   * This is correct behavior for reading a series of images from one source.\r
-   */\r
-  src->start_of_file = TRUE;\r
-}\r
-\r
-\r
-/*\r
- * Fill the input buffer --- called whenever buffer is emptied.\r
- *\r
- * In typical applications, this should read fresh data into the buffer\r
- * (ignoring the current state of next_input_byte & bytes_in_buffer),\r
- * reset the pointer & count to the start of the buffer, and return TRUE\r
- * indicating that the buffer has been reloaded.  It is not necessary to\r
- * fill the buffer entirely, only to obtain at least one more byte.\r
- *\r
- * There is no such thing as an EOF return.  If the end of the file has been\r
- * reached, the routine has a choice of ERREXIT() or inserting fake data into\r
- * the buffer.  In most cases, generating a warning message and inserting a\r
- * fake EOI marker is the best course of action --- this will allow the\r
- * decompressor to output however much of the image is there.  However,\r
- * the resulting error message is misleading if the real problem is an empty\r
- * input file, so we handle that case specially.\r
- *\r
- * In applications that need to be able to suspend compression due to input\r
- * not being available yet, a FALSE return indicates that no more data can be\r
- * obtained right now, but more may be forthcoming later.  In this situation,\r
- * the decompressor will return to its caller (with an indication of the\r
- * number of scanlines it has read, if any).  The application should resume\r
- * decompression after it has loaded more data into the input buffer.  Note\r
- * that there are substantial restrictions on the use of suspension --- see\r
- * the documentation.\r
- *\r
- * When suspending, the decompressor will back up to a convenient restart point\r
- * (typically the start of the current MCU). next_input_byte & bytes_in_buffer\r
- * indicate where the restart point will be if the current call returns FALSE.\r
- * Data beyond this point must be rescanned after resumption, so move it to\r
- * the front of the buffer rather than discarding it.\r
- */\r
-\r
-METHODDEF boolean\r
-// FIXME ? merged in from Alpha\r
-fill_input_buffer (j_decompress_ptr cinfo)\r
-{\r
-  my_src_ptr src = (my_src_ptr) cinfo->src;\r
-  size_t nbytes;\r
\r
-  if (src->src_size > INPUT_BUF_SIZE)\r
-    nbytes = INPUT_BUF_SIZE;\r
-  else\r
-    nbytes = src->src_size;\r
-\r
-  memcpy (src->buffer, src->infile, nbytes);\r
-\r
-  src->infile += nbytes;\r
-  src->src_size -= nbytes;\r
-\r
-  src->pub.next_input_byte = src->buffer;\r
-  src->pub.bytes_in_buffer = nbytes;\r
-  src->start_of_file = FALSE;\r
-\r
-  return TRUE;\r
-}\r
-\r
-\r
-/*\r
- * Skip data --- used to skip over a potentially large amount of\r
- * uninteresting data (such as an APPn marker).\r
- *\r
- * Writers of suspendable-input applications must note that skip_input_data\r
- * is not granted the right to give a suspension return.  If the skip extends\r
- * beyond the data currently in the buffer, the buffer can be marked empty so\r
- * that the next read will cause a fill_input_buffer call that can suspend.\r
- * Arranging for additional bytes to be discarded before reloading the input\r
- * buffer is the application writer's problem.\r
- */\r
-\r
-METHODDEF void\r
-skip_input_data (j_decompress_ptr cinfo, long num_bytes)\r
-{\r
-  my_src_ptr src = (my_src_ptr) cinfo->src;\r
-\r
-  /* Just a dumb implementation for now.  Could use fseek() except\r
-   * it doesn't work on pipes.  Not clear that being smart is worth\r
-   * any trouble anyway --- large skips are infrequent.\r
-   */\r
-  if (num_bytes > 0) {\r
-    while (num_bytes > (long) src->pub.bytes_in_buffer) {\r
-      num_bytes -= (long) src->pub.bytes_in_buffer;\r
-      (void) fill_input_buffer(cinfo);\r
-      /* note we assume that fill_input_buffer will never return FALSE,\r
-       * so suspension need not be handled.\r
-       */\r
-    }\r
-    src->pub.next_input_byte += (size_t) num_bytes;\r
-    src->pub.bytes_in_buffer -= (size_t) num_bytes;\r
-  }\r
-}\r
-\r
-\r
-/*\r
- * An additional method that can be provided by data source modules is the\r
- * resync_to_restart method for error recovery in the presence of RST markers.\r
- * For the moment, this source module just uses the default resync method\r
- * provided by the JPEG library.  That method assumes that no backtracking\r
- * is possible.\r
- */\r
-\r
-\r
-/*\r
- * Terminate source --- called by jpeg_finish_decompress\r
- * after all data has been read.  Often a no-op.\r
- *\r
- * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding\r
- * application must deal with any cleanup that should happen even\r
- * for error exit.\r
- */\r
-\r
-METHODDEF void\r
-term_source (j_decompress_ptr cinfo)\r
-{\r
-  /* no work necessary here */\r
-}\r
-\r
-\r
-/*\r
- * Prepare for input from a stdio stream.\r
- * The caller must have already opened the stream, and is responsible\r
- * for closing it after finishing decompression.\r
- */\r
-\r
-GLOBAL void\r
-jpeg_stdio_src (j_decompress_ptr cinfo, unsigned char *infile, int bufsize)\r
-{\r
-  my_src_ptr src;\r
-\r
-  /* The source object and input buffer are made permanent so that a series\r
-   * of JPEG images can be read from the same file by calling jpeg_stdio_src\r
-   * only before the first one.  (If we discarded the buffer at the end of\r
-   * one image, we'd likely lose the start of the next one.)\r
-   * This makes it unsafe to use this manager and a different source\r
-   * manager serially with the same JPEG object.  Caveat programmer.\r
-   */\r
-  if (cinfo->src == NULL) {    /* first time for this JPEG object? */\r
-    cinfo->src = (struct jpeg_source_mgr *)\r
-      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,\r
-                                 SIZEOF(my_source_mgr));\r
-    src = (my_src_ptr) cinfo->src;\r
-    src->buffer = (JOCTET *)\r
-      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,\r
-                                 INPUT_BUF_SIZE * SIZEOF(JOCTET));\r
-  }\r
-\r
-  src = (my_src_ptr) cinfo->src;\r
-  src->pub.init_source = init_source;\r
-  src->pub.fill_input_buffer = fill_input_buffer;\r
-  src->pub.skip_input_data = skip_input_data;\r
-  src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */\r
-  src->pub.term_source = term_source;\r
-  src->infile = infile;\r
-  src->src_size = bufsize; // FIXME ? merged from Alpha\r
-  src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */\r
-  src->pub.next_input_byte = NULL; /* until buffer loaded */\r
-}\r
-\r
diff --git a/libs/jpeg6/jdcoefct.cpp b/libs/jpeg6/jdcoefct.cpp
deleted file mode 100644 (file)
index f9a1f7e..0000000
+++ /dev/null
@@ -1,1450 +0,0 @@
-/*\r
-\r
- * jdcoefct.c\r
-\r
- *\r
-\r
- * Copyright (C) 1994-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains the coefficient buffer controller for decompression.\r
-\r
- * This controller is the top level of the JPEG decompressor proper.\r
-\r
- * The coefficient buffer lies between entropy decoding and inverse-DCT steps.\r
-\r
- *\r
-\r
- * In buffered-image mode, this controller is the interface between\r
-\r
- * input-oriented processing and output-oriented processing.\r
-\r
- * Also, the input side (only) is used when reading a file for transcoding.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-/* Block smoothing is only applicable for progressive JPEG, so: */\r
-\r
-#ifndef D_PROGRESSIVE_SUPPORTED\r
-\r
-#undef BLOCK_SMOOTHING_SUPPORTED\r
-\r
-#endif\r
-\r
-\r
-\r
-/* Private buffer controller object */\r
-\r
-\r
-\r
-typedef struct {\r
-\r
-  struct jpeg_d_coef_controller pub; /* public fields */\r
-\r
-\r
-\r
-  /* These variables keep track of the current location of the input side. */\r
-\r
-  /* cinfo->input_iMCU_row is also used for this. */\r
-\r
-  JDIMENSION MCU_ctr;          /* counts MCUs processed in current row */\r
-\r
-  int MCU_vert_offset;         /* counts MCU rows within iMCU row */\r
-\r
-  int MCU_rows_per_iMCU_row;   /* number of such rows needed */\r
-\r
-\r
-\r
-  /* The output side's location is represented by cinfo->output_iMCU_row. */\r
-\r
-\r
-\r
-  /* In single-pass modes, it's sufficient to buffer just one MCU.\r
-\r
-   * We allocate a workspace of D_MAX_BLOCKS_IN_MCU coefficient blocks,\r
-\r
-   * and let the entropy decoder write into that workspace each time.\r
-\r
-   * (On 80x86, the workspace is FAR even though it's not really very big;\r
-\r
-   * this is to keep the module interfaces unchanged when a large coefficient\r
-\r
-   * buffer is necessary.)\r
-\r
-   * In multi-pass modes, this array points to the current MCU's blocks\r
-\r
-   * within the virtual arrays; it is used only by the input side.\r
-\r
-   */\r
-\r
-  JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU];\r
-\r
-\r
-\r
-#ifdef D_MULTISCAN_FILES_SUPPORTED\r
-\r
-  /* In multi-pass modes, we need a virtual block array for each component. */\r
-\r
-  jvirt_barray_ptr whole_image[MAX_COMPONENTS];\r
-\r
-#endif\r
-\r
-\r
-\r
-#ifdef BLOCK_SMOOTHING_SUPPORTED\r
-\r
-  /* When doing block smoothing, we latch coefficient Al values here */\r
-\r
-  int * coef_bits_latch;\r
-\r
-#define SAVED_COEFS  6         /* we save coef_bits[0..5] */\r
-\r
-#endif\r
-\r
-} my_coef_controller;\r
-\r
-\r
-\r
-typedef my_coef_controller * my_coef_ptr;\r
-\r
-\r
-\r
-/* Forward declarations */\r
-\r
-METHODDEF int decompress_onepass\r
-\r
-       JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));\r
-\r
-#ifdef D_MULTISCAN_FILES_SUPPORTED\r
-\r
-METHODDEF int decompress_data\r
-\r
-       JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));\r
-\r
-#endif\r
-\r
-#ifdef BLOCK_SMOOTHING_SUPPORTED\r
-\r
-LOCAL boolean smoothing_ok JPP((j_decompress_ptr cinfo));\r
-\r
-METHODDEF int decompress_smooth_data\r
-\r
-       JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-start_iMCU_row (j_decompress_ptr cinfo)\r
-\r
-/* Reset within-iMCU-row counters for a new row (input side) */\r
-\r
-{\r
-\r
-  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\r
-\r
-\r
-\r
-  /* In an interleaved scan, an MCU row is the same as an iMCU row.\r
-\r
-   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.\r
-\r
-   * But at the bottom of the image, process only what's left.\r
-\r
-   */\r
-\r
-  if (cinfo->comps_in_scan > 1) {\r
-\r
-    coef->MCU_rows_per_iMCU_row = 1;\r
-\r
-  } else {\r
-\r
-    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))\r
-\r
-      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;\r
-\r
-    else\r
-\r
-      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;\r
-\r
-  }\r
-\r
-\r
-\r
-  coef->MCU_ctr = 0;\r
-\r
-  coef->MCU_vert_offset = 0;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize for an input processing pass.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-start_input_pass (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  cinfo->input_iMCU_row = 0;\r
-\r
-  start_iMCU_row(cinfo);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize for an output processing pass.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-start_output_pass (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-#ifdef BLOCK_SMOOTHING_SUPPORTED\r
-\r
-  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\r
-\r
-\r
-\r
-  /* If multipass, check to see whether to use block smoothing on this pass */\r
-\r
-  if (coef->pub.coef_arrays != NULL) {\r
-\r
-    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))\r
-\r
-      coef->pub.decompress_data = decompress_smooth_data;\r
-\r
-    else\r
-\r
-      coef->pub.decompress_data = decompress_data;\r
-\r
-  }\r
-\r
-#endif\r
-\r
-  cinfo->output_iMCU_row = 0;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Decompress and return some data in the single-pass case.\r
-\r
- * Always attempts to emit one fully interleaved MCU row ("iMCU" row).\r
-\r
- * Input and output must run in lockstep since we have only a one-MCU buffer.\r
-\r
- * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.\r
-\r
- *\r
-\r
- * NB: output_buf contains a plane for each component in image.\r
-\r
- * For single pass, this is the same as the components in the scan.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF int\r
-\r
-decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)\r
-\r
-{\r
-\r
-  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\r
-\r
-  JDIMENSION MCU_col_num;      /* index of current MCU within row */\r
-\r
-  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;\r
-\r
-  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;\r
-\r
-  int blkn, ci, xindex, yindex, yoffset, useful_width;\r
-\r
-  JSAMPARRAY output_ptr;\r
-\r
-  JDIMENSION start_col, output_col;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-  inverse_DCT_method_ptr inverse_DCT;\r
-\r
-\r
-\r
-  /* Loop to process as much as one whole iMCU row */\r
-\r
-  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;\r
-\r
-       yoffset++) {\r
-\r
-    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;\r
-\r
-        MCU_col_num++) {\r
-\r
-      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */\r
-\r
-      jzero_far((void FAR *) coef->MCU_buffer[0],\r
-\r
-               (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK)));\r
-\r
-      if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {\r
-\r
-       /* Suspension forced; update state counters and exit */\r
-\r
-       coef->MCU_vert_offset = yoffset;\r
-\r
-       coef->MCU_ctr = MCU_col_num;\r
-\r
-       return JPEG_SUSPENDED;\r
-\r
-      }\r
-\r
-      /* Determine where data should go in output_buf and do the IDCT thing.\r
-\r
-       * We skip dummy blocks at the right and bottom edges (but blkn gets\r
-\r
-       * incremented past them!).  Note the inner loop relies on having\r
-\r
-       * allocated the MCU_buffer[] blocks sequentially.\r
-\r
-       */\r
-\r
-      blkn = 0;                        /* index of current DCT block within MCU */\r
-\r
-      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {\r
-\r
-       compptr = cinfo->cur_comp_info[ci];\r
-\r
-       /* Don't bother to IDCT an uninteresting component. */\r
-\r
-       if (! compptr->component_needed) {\r
-\r
-         blkn += compptr->MCU_blocks;\r
-\r
-         continue;\r
-\r
-       }\r
-\r
-       inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];\r
-\r
-       useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width\r
-\r
-                                                   : compptr->last_col_width;\r
-\r
-       output_ptr = output_buf[ci] + yoffset * compptr->DCT_scaled_size;\r
-\r
-       start_col = MCU_col_num * compptr->MCU_sample_width;\r
-\r
-       for (yindex = 0; yindex < compptr->MCU_height; yindex++) {\r
-\r
-         if (cinfo->input_iMCU_row < last_iMCU_row ||\r
-\r
-             yoffset+yindex < compptr->last_row_height) {\r
-\r
-           output_col = start_col;\r
-\r
-           for (xindex = 0; xindex < useful_width; xindex++) {\r
-\r
-             (*inverse_DCT) (cinfo, compptr,\r
-\r
-                             (JCOEFPTR) coef->MCU_buffer[blkn+xindex],\r
-\r
-                             output_ptr, output_col);\r
-\r
-             output_col += compptr->DCT_scaled_size;\r
-\r
-           }\r
-\r
-         }\r
-\r
-         blkn += compptr->MCU_width;\r
-\r
-         output_ptr += compptr->DCT_scaled_size;\r
-\r
-       }\r
-\r
-      }\r
-\r
-    }\r
-\r
-    /* Completed an MCU row, but perhaps not an iMCU row */\r
-\r
-    coef->MCU_ctr = 0;\r
-\r
-  }\r
-\r
-  /* Completed the iMCU row, advance counters for next one */\r
-\r
-  cinfo->output_iMCU_row++;\r
-\r
-  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {\r
-\r
-    start_iMCU_row(cinfo);\r
-\r
-    return JPEG_ROW_COMPLETED;\r
-\r
-  }\r
-\r
-  /* Completed the scan */\r
-\r
-  (*cinfo->inputctl->finish_input_pass) (cinfo);\r
-\r
-  return JPEG_SCAN_COMPLETED;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Dummy consume-input routine for single-pass operation.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF int\r
-\r
-dummy_consume_data (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  return JPEG_SUSPENDED;       /* Always indicate nothing was done */\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-#ifdef D_MULTISCAN_FILES_SUPPORTED\r
-\r
-\r
-\r
-/*\r
-\r
- * Consume input data and store it in the full-image coefficient buffer.\r
-\r
- * We read as much as one fully interleaved MCU row ("iMCU" row) per call,\r
-\r
- * ie, v_samp_factor block rows for each component in the scan.\r
-\r
- * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF int\r
-\r
-consume_data (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\r
-\r
-  JDIMENSION MCU_col_num;      /* index of current MCU within row */\r
-\r
-  int blkn, ci, xindex, yindex, yoffset;\r
-\r
-  JDIMENSION start_col;\r
-\r
-  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];\r
-\r
-  JBLOCKROW buffer_ptr;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-\r
-\r
-  /* Align the virtual buffers for the components used in this scan. */\r
-\r
-  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {\r
-\r
-    compptr = cinfo->cur_comp_info[ci];\r
-\r
-    buffer[ci] = (*cinfo->mem->access_virt_barray)\r
-\r
-      ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],\r
-\r
-       cinfo->input_iMCU_row * compptr->v_samp_factor,\r
-\r
-       (JDIMENSION) compptr->v_samp_factor, TRUE);\r
-\r
-    /* Note: entropy decoder expects buffer to be zeroed,\r
-\r
-     * but this is handled automatically by the memory manager\r
-\r
-     * because we requested a pre-zeroed array.\r
-\r
-     */\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Loop to process one whole iMCU row */\r
-\r
-  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;\r
-\r
-       yoffset++) {\r
-\r
-    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;\r
-\r
-        MCU_col_num++) {\r
-\r
-      /* Construct list of pointers to DCT blocks belonging to this MCU */\r
-\r
-      blkn = 0;                        /* index of current DCT block within MCU */\r
-\r
-      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {\r
-\r
-       compptr = cinfo->cur_comp_info[ci];\r
-\r
-       start_col = MCU_col_num * compptr->MCU_width;\r
-\r
-       for (yindex = 0; yindex < compptr->MCU_height; yindex++) {\r
-\r
-         buffer_ptr = buffer[ci][yindex+yoffset] + start_col;\r
-\r
-         for (xindex = 0; xindex < compptr->MCU_width; xindex++) {\r
-\r
-           coef->MCU_buffer[blkn++] = buffer_ptr++;\r
-\r
-         }\r
-\r
-       }\r
-\r
-      }\r
-\r
-      /* Try to fetch the MCU. */\r
-\r
-      if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {\r
-\r
-       /* Suspension forced; update state counters and exit */\r
-\r
-       coef->MCU_vert_offset = yoffset;\r
-\r
-       coef->MCU_ctr = MCU_col_num;\r
-\r
-       return JPEG_SUSPENDED;\r
-\r
-      }\r
-\r
-    }\r
-\r
-    /* Completed an MCU row, but perhaps not an iMCU row */\r
-\r
-    coef->MCU_ctr = 0;\r
-\r
-  }\r
-\r
-  /* Completed the iMCU row, advance counters for next one */\r
-\r
-  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {\r
-\r
-    start_iMCU_row(cinfo);\r
-\r
-    return JPEG_ROW_COMPLETED;\r
-\r
-  }\r
-\r
-  /* Completed the scan */\r
-\r
-  (*cinfo->inputctl->finish_input_pass) (cinfo);\r
-\r
-  return JPEG_SCAN_COMPLETED;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Decompress and return some data in the multi-pass case.\r
-\r
- * Always attempts to emit one fully interleaved MCU row ("iMCU" row).\r
-\r
- * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.\r
-\r
- *\r
-\r
- * NB: output_buf contains a plane for each component in image.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF int\r
-\r
-decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)\r
-\r
-{\r
-\r
-  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\r
-\r
-  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;\r
-\r
-  JDIMENSION block_num;\r
-\r
-  int ci, block_row, block_rows;\r
-\r
-  JBLOCKARRAY buffer;\r
-\r
-  JBLOCKROW buffer_ptr;\r
-\r
-  JSAMPARRAY output_ptr;\r
-\r
-  JDIMENSION output_col;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-  inverse_DCT_method_ptr inverse_DCT;\r
-\r
-\r
-\r
-  /* Force some input to be done if we are getting ahead of the input. */\r
-\r
-  while (cinfo->input_scan_number < cinfo->output_scan_number ||\r
-\r
-        (cinfo->input_scan_number == cinfo->output_scan_number &&\r
-\r
-         cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {\r
-\r
-    if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)\r
-\r
-      return JPEG_SUSPENDED;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* OK, output from the virtual arrays. */\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    /* Don't bother to IDCT an uninteresting component. */\r
-\r
-    if (! compptr->component_needed)\r
-\r
-      continue;\r
-\r
-    /* Align the virtual buffer for this component. */\r
-\r
-    buffer = (*cinfo->mem->access_virt_barray)\r
-\r
-      ((j_common_ptr) cinfo, coef->whole_image[ci],\r
-\r
-       cinfo->output_iMCU_row * compptr->v_samp_factor,\r
-\r
-       (JDIMENSION) compptr->v_samp_factor, FALSE);\r
-\r
-    /* Count non-dummy DCT block rows in this iMCU row. */\r
-\r
-    if (cinfo->output_iMCU_row < last_iMCU_row)\r
-\r
-      block_rows = compptr->v_samp_factor;\r
-\r
-    else {\r
-\r
-      /* NB: can't use last_row_height here; it is input-side-dependent! */\r
-\r
-      block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);\r
-\r
-      if (block_rows == 0) block_rows = compptr->v_samp_factor;\r
-\r
-    }\r
-\r
-    inverse_DCT = cinfo->idct->inverse_DCT[ci];\r
-\r
-    output_ptr = output_buf[ci];\r
-\r
-    /* Loop over all DCT blocks to be processed. */\r
-\r
-    for (block_row = 0; block_row < block_rows; block_row++) {\r
-\r
-      buffer_ptr = buffer[block_row];\r
-\r
-      output_col = 0;\r
-\r
-      for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) {\r
-\r
-       (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr,\r
-\r
-                       output_ptr, output_col);\r
-\r
-       buffer_ptr++;\r
-\r
-       output_col += compptr->DCT_scaled_size;\r
-\r
-      }\r
-\r
-      output_ptr += compptr->DCT_scaled_size;\r
-\r
-    }\r
-\r
-  }\r
-\r
-\r
-\r
-  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)\r
-\r
-    return JPEG_ROW_COMPLETED;\r
-\r
-  return JPEG_SCAN_COMPLETED;\r
-\r
-}\r
-\r
-\r
-\r
-#endif /* D_MULTISCAN_FILES_SUPPORTED */\r
-\r
-\r
-\r
-\r
-\r
-#ifdef BLOCK_SMOOTHING_SUPPORTED\r
-\r
-\r
-\r
-/*\r
-\r
- * This code applies interblock smoothing as described by section K.8\r
-\r
- * of the JPEG standard: the first 5 AC coefficients are estimated from\r
-\r
- * the DC values of a DCT block and its 8 neighboring blocks.\r
-\r
- * We apply smoothing only for progressive JPEG decoding, and only if\r
-\r
- * the coefficients it can estimate are not yet known to full precision.\r
-\r
- */\r
-\r
-\r
-\r
-/*\r
-\r
- * Determine whether block smoothing is applicable and safe.\r
-\r
- * We also latch the current states of the coef_bits[] entries for the\r
-\r
- * AC coefficients; otherwise, if the input side of the decompressor\r
-\r
- * advances into a new scan, we might think the coefficients are known\r
-\r
- * more accurately than they really are.\r
-\r
- */\r
-\r
-\r
-\r
-LOCAL boolean\r
-\r
-smoothing_ok (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\r
-\r
-  boolean smoothing_useful = FALSE;\r
-\r
-  int ci, coefi;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-  JQUANT_TBL * qtable;\r
-\r
-  int * coef_bits;\r
-\r
-  int * coef_bits_latch;\r
-\r
-\r
-\r
-  if (! cinfo->progressive_mode || cinfo->coef_bits == NULL)\r
-\r
-    return FALSE;\r
-\r
-\r
-\r
-  /* Allocate latch area if not already done */\r
-\r
-  if (coef->coef_bits_latch == NULL)\r
-\r
-    coef->coef_bits_latch = (int *)\r
-\r
-      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                                 cinfo->num_components *\r
-\r
-                                 (SAVED_COEFS * SIZEOF(int)));\r
-\r
-  coef_bits_latch = coef->coef_bits_latch;\r
-\r
-\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    /* All components' quantization values must already be latched. */\r
-\r
-    if ((qtable = compptr->quant_table) == NULL)\r
-\r
-      return FALSE;\r
-\r
-    /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */\r
-\r
-    for (coefi = 0; coefi <= 5; coefi++) {\r
-\r
-      if (qtable->quantval[coefi] == 0)\r
-\r
-       return FALSE;\r
-\r
-    }\r
-\r
-    /* DC values must be at least partly known for all components. */\r
-\r
-    coef_bits = cinfo->coef_bits[ci];\r
-\r
-    if (coef_bits[0] < 0)\r
-\r
-      return FALSE;\r
-\r
-    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */\r
-\r
-    for (coefi = 1; coefi <= 5; coefi++) {\r
-\r
-      coef_bits_latch[coefi] = coef_bits[coefi];\r
-\r
-      if (coef_bits[coefi] != 0)\r
-\r
-       smoothing_useful = TRUE;\r
-\r
-    }\r
-\r
-    coef_bits_latch += SAVED_COEFS;\r
-\r
-  }\r
-\r
-\r
-\r
-  return smoothing_useful;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Variant of decompress_data for use when doing block smoothing.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF int\r
-\r
-decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)\r
-\r
-{\r
-\r
-  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\r
-\r
-  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;\r
-\r
-  JDIMENSION block_num, last_block_column;\r
-\r
-  int ci, block_row, block_rows, access_rows;\r
-\r
-  JBLOCKARRAY buffer;\r
-\r
-  JBLOCKROW buffer_ptr, prev_block_row, next_block_row;\r
-\r
-  JSAMPARRAY output_ptr;\r
-\r
-  JDIMENSION output_col;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-  inverse_DCT_method_ptr inverse_DCT;\r
-\r
-  boolean first_row, last_row;\r
-\r
-  JBLOCK workspace;\r
-\r
-  int *coef_bits;\r
-\r
-  JQUANT_TBL *quanttbl;\r
-\r
-  INT32 Q00,Q01,Q02,Q10,Q11,Q20, num;\r
-\r
-  int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9;\r
-\r
-  int Al, pred;\r
-\r
-\r
-\r
-  /* Force some input to be done if we are getting ahead of the input. */\r
-\r
-  while (cinfo->input_scan_number <= cinfo->output_scan_number &&\r
-\r
-        ! cinfo->inputctl->eoi_reached) {\r
-\r
-    if (cinfo->input_scan_number == cinfo->output_scan_number) {\r
-\r
-      /* If input is working on current scan, we ordinarily want it to\r
-\r
-       * have completed the current row.  But if input scan is DC,\r
-\r
-       * we want it to keep one row ahead so that next block row's DC\r
-\r
-       * values are up to date.\r
-\r
-       */\r
-\r
-      JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0;\r
-\r
-      if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta)\r
-\r
-       break;\r
-\r
-    }\r
-\r
-    if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)\r
-\r
-      return JPEG_SUSPENDED;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* OK, output from the virtual arrays. */\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    /* Don't bother to IDCT an uninteresting component. */\r
-\r
-    if (! compptr->component_needed)\r
-\r
-      continue;\r
-\r
-    /* Count non-dummy DCT block rows in this iMCU row. */\r
-\r
-    if (cinfo->output_iMCU_row < last_iMCU_row) {\r
-\r
-      block_rows = compptr->v_samp_factor;\r
-\r
-      access_rows = block_rows * 2; /* this and next iMCU row */\r
-\r
-      last_row = FALSE;\r
-\r
-    } else {\r
-\r
-      /* NB: can't use last_row_height here; it is input-side-dependent! */\r
-\r
-      block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);\r
-\r
-      if (block_rows == 0) block_rows = compptr->v_samp_factor;\r
-\r
-      access_rows = block_rows; /* this iMCU row only */\r
-\r
-      last_row = TRUE;\r
-\r
-    }\r
-\r
-    /* Align the virtual buffer for this component. */\r
-\r
-    if (cinfo->output_iMCU_row > 0) {\r
-\r
-      access_rows += compptr->v_samp_factor; /* prior iMCU row too */\r
-\r
-      buffer = (*cinfo->mem->access_virt_barray)\r
-\r
-       ((j_common_ptr) cinfo, coef->whole_image[ci],\r
-\r
-        (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,\r
-\r
-        (JDIMENSION) access_rows, FALSE);\r
-\r
-      buffer += compptr->v_samp_factor;        /* point to current iMCU row */\r
-\r
-      first_row = FALSE;\r
-\r
-    } else {\r
-\r
-      buffer = (*cinfo->mem->access_virt_barray)\r
-\r
-       ((j_common_ptr) cinfo, coef->whole_image[ci],\r
-\r
-        (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE);\r
-\r
-      first_row = TRUE;\r
-\r
-    }\r
-\r
-    /* Fetch component-dependent info */\r
-\r
-    coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);\r
-\r
-    quanttbl = compptr->quant_table;\r
-\r
-    Q00 = quanttbl->quantval[0];\r
-\r
-    Q01 = quanttbl->quantval[1];\r
-\r
-    Q10 = quanttbl->quantval[2];\r
-\r
-    Q20 = quanttbl->quantval[3];\r
-\r
-    Q11 = quanttbl->quantval[4];\r
-\r
-    Q02 = quanttbl->quantval[5];\r
-\r
-    inverse_DCT = cinfo->idct->inverse_DCT[ci];\r
-\r
-    output_ptr = output_buf[ci];\r
-\r
-    /* Loop over all DCT blocks to be processed. */\r
-\r
-    for (block_row = 0; block_row < block_rows; block_row++) {\r
-\r
-      buffer_ptr = buffer[block_row];\r
-\r
-      if (first_row && block_row == 0)\r
-\r
-       prev_block_row = buffer_ptr;\r
-\r
-      else\r
-\r
-       prev_block_row = buffer[block_row-1];\r
-\r
-      if (last_row && block_row == block_rows-1)\r
-\r
-       next_block_row = buffer_ptr;\r
-\r
-      else\r
-\r
-       next_block_row = buffer[block_row+1];\r
-\r
-      /* We fetch the surrounding DC values using a sliding-register approach.\r
-\r
-       * Initialize all nine here so as to do the right thing on narrow pics.\r
-\r
-       */\r
-\r
-      DC1 = DC2 = DC3 = (int) prev_block_row[0][0];\r
-\r
-      DC4 = DC5 = DC6 = (int) buffer_ptr[0][0];\r
-\r
-      DC7 = DC8 = DC9 = (int) next_block_row[0][0];\r
-\r
-      output_col = 0;\r
-\r
-      last_block_column = compptr->width_in_blocks - 1;\r
-\r
-      for (block_num = 0; block_num <= last_block_column; block_num++) {\r
-\r
-       /* Fetch current DCT block into workspace so we can modify it. */\r
-\r
-       jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1);\r
-\r
-       /* Update DC values */\r
-\r
-       if (block_num < last_block_column) {\r
-\r
-         DC3 = (int) prev_block_row[1][0];\r
-\r
-         DC6 = (int) buffer_ptr[1][0];\r
-\r
-         DC9 = (int) next_block_row[1][0];\r
-\r
-       }\r
-\r
-       /* Compute coefficient estimates per K.8.\r
-\r
-        * An estimate is applied only if coefficient is still zero,\r
-\r
-        * and is not known to be fully accurate.\r
-\r
-        */\r
-\r
-       /* AC01 */\r
-\r
-       if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) {\r
-\r
-         num = 36 * Q00 * (DC4 - DC6);\r
-\r
-         if (num >= 0) {\r
-\r
-           pred = (int) (((Q01<<7) + num) / (Q01<<8));\r
-\r
-           if (Al > 0 && pred >= (1<<Al))\r
-\r
-             pred = (1<<Al)-1;\r
-\r
-         } else {\r
-\r
-           pred = (int) (((Q01<<7) - num) / (Q01<<8));\r
-\r
-           if (Al > 0 && pred >= (1<<Al))\r
-\r
-             pred = (1<<Al)-1;\r
-\r
-           pred = -pred;\r
-\r
-         }\r
-\r
-         workspace[1] = (JCOEF) pred;\r
-\r
-       }\r
-\r
-       /* AC10 */\r
-\r
-       if ((Al=coef_bits[2]) != 0 && workspace[8] == 0) {\r
-\r
-         num = 36 * Q00 * (DC2 - DC8);\r
-\r
-         if (num >= 0) {\r
-\r
-           pred = (int) (((Q10<<7) + num) / (Q10<<8));\r
-\r
-           if (Al > 0 && pred >= (1<<Al))\r
-\r
-             pred = (1<<Al)-1;\r
-\r
-         } else {\r
-\r
-           pred = (int) (((Q10<<7) - num) / (Q10<<8));\r
-\r
-           if (Al > 0 && pred >= (1<<Al))\r
-\r
-             pred = (1<<Al)-1;\r
-\r
-           pred = -pred;\r
-\r
-         }\r
-\r
-         workspace[8] = (JCOEF) pred;\r
-\r
-       }\r
-\r
-       /* AC20 */\r
-\r
-       if ((Al=coef_bits[3]) != 0 && workspace[16] == 0) {\r
-\r
-         num = 9 * Q00 * (DC2 + DC8 - 2*DC5);\r
-\r
-         if (num >= 0) {\r
-\r
-           pred = (int) (((Q20<<7) + num) / (Q20<<8));\r
-\r
-           if (Al > 0 && pred >= (1<<Al))\r
-\r
-             pred = (1<<Al)-1;\r
-\r
-         } else {\r
-\r
-           pred = (int) (((Q20<<7) - num) / (Q20<<8));\r
-\r
-           if (Al > 0 && pred >= (1<<Al))\r
-\r
-             pred = (1<<Al)-1;\r
-\r
-           pred = -pred;\r
-\r
-         }\r
-\r
-         workspace[16] = (JCOEF) pred;\r
-\r
-       }\r
-\r
-       /* AC11 */\r
-\r
-       if ((Al=coef_bits[4]) != 0 && workspace[9] == 0) {\r
-\r
-         num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9);\r
-\r
-         if (num >= 0) {\r
-\r
-           pred = (int) (((Q11<<7) + num) / (Q11<<8));\r
-\r
-           if (Al > 0 && pred >= (1<<Al))\r
-\r
-             pred = (1<<Al)-1;\r
-\r
-         } else {\r
-\r
-           pred = (int) (((Q11<<7) - num) / (Q11<<8));\r
-\r
-           if (Al > 0 && pred >= (1<<Al))\r
-\r
-             pred = (1<<Al)-1;\r
-\r
-           pred = -pred;\r
-\r
-         }\r
-\r
-         workspace[9] = (JCOEF) pred;\r
-\r
-       }\r
-\r
-       /* AC02 */\r
-\r
-       if ((Al=coef_bits[5]) != 0 && workspace[2] == 0) {\r
-\r
-         num = 9 * Q00 * (DC4 + DC6 - 2*DC5);\r
-\r
-         if (num >= 0) {\r
-\r
-           pred = (int) (((Q02<<7) + num) / (Q02<<8));\r
-\r
-           if (Al > 0 && pred >= (1<<Al))\r
-\r
-             pred = (1<<Al)-1;\r
-\r
-         } else {\r
-\r
-           pred = (int) (((Q02<<7) - num) / (Q02<<8));\r
-\r
-           if (Al > 0 && pred >= (1<<Al))\r
-\r
-             pred = (1<<Al)-1;\r
-\r
-           pred = -pred;\r
-\r
-         }\r
-\r
-         workspace[2] = (JCOEF) pred;\r
-\r
-       }\r
-\r
-       /* OK, do the IDCT */\r
-\r
-       (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace,\r
-\r
-                       output_ptr, output_col);\r
-\r
-       /* Advance for next column */\r
-\r
-       DC1 = DC2; DC2 = DC3;\r
-\r
-       DC4 = DC5; DC5 = DC6;\r
-\r
-       DC7 = DC8; DC8 = DC9;\r
-\r
-       buffer_ptr++, prev_block_row++, next_block_row++;\r
-\r
-       output_col += compptr->DCT_scaled_size;\r
-\r
-      }\r
-\r
-      output_ptr += compptr->DCT_scaled_size;\r
-\r
-    }\r
-\r
-  }\r
-\r
-\r
-\r
-  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)\r
-\r
-    return JPEG_ROW_COMPLETED;\r
-\r
-  return JPEG_SCAN_COMPLETED;\r
-\r
-}\r
-\r
-\r
-\r
-#endif /* BLOCK_SMOOTHING_SUPPORTED */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize coefficient buffer controller.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)\r
-\r
-{\r
-\r
-  my_coef_ptr coef;\r
-\r
-\r
-\r
-  coef = (my_coef_ptr)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                               SIZEOF(my_coef_controller));\r
-\r
-  cinfo->coef = (struct jpeg_d_coef_controller *) coef;\r
-\r
-  coef->pub.start_input_pass = start_input_pass;\r
-\r
-  coef->pub.start_output_pass = start_output_pass;\r
-\r
-#ifdef BLOCK_SMOOTHING_SUPPORTED\r
-\r
-  coef->coef_bits_latch = NULL;\r
-\r
-#endif\r
-\r
-\r
-\r
-  /* Create the coefficient buffer. */\r
-\r
-  if (need_full_buffer) {\r
-\r
-#ifdef D_MULTISCAN_FILES_SUPPORTED\r
-\r
-    /* Allocate a full-image virtual array for each component, */\r
-\r
-    /* padded to a multiple of samp_factor DCT blocks in each direction. */\r
-\r
-    /* Note we ask for a pre-zeroed array. */\r
-\r
-    int ci, access_rows;\r
-\r
-    jpeg_component_info *compptr;\r
-\r
-\r
-\r
-    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-        ci++, compptr++) {\r
-\r
-      access_rows = compptr->v_samp_factor;\r
-\r
-#ifdef BLOCK_SMOOTHING_SUPPORTED\r
-\r
-      /* If block smoothing could be used, need a bigger window */\r
-\r
-      if (cinfo->progressive_mode)\r
-\r
-       access_rows *= 3;\r
-\r
-#endif\r
-\r
-      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)\r
-\r
-       ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE,\r
-\r
-        (JDIMENSION) jround_up((long) compptr->width_in_blocks,\r
-\r
-                               (long) compptr->h_samp_factor),\r
-\r
-        (JDIMENSION) jround_up((long) compptr->height_in_blocks,\r
-\r
-                               (long) compptr->v_samp_factor),\r
-\r
-        (JDIMENSION) access_rows);\r
-\r
-    }\r
-\r
-    coef->pub.consume_data = consume_data;\r
-\r
-    coef->pub.decompress_data = decompress_data;\r
-\r
-    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */\r
-\r
-#else\r
-\r
-    ERREXIT(cinfo, JERR_NOT_COMPILED);\r
-\r
-#endif\r
-\r
-  } else {\r
-\r
-    /* We only need a single-MCU buffer. */\r
-\r
-    JBLOCKROW buffer;\r
-\r
-    int i;\r
-\r
-\r
-\r
-    buffer = (JBLOCKROW)\r
-\r
-      (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                                 D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));\r
-\r
-    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {\r
-\r
-      coef->MCU_buffer[i] = buffer + i;\r
-\r
-    }\r
-\r
-    coef->pub.consume_data = dummy_consume_data;\r
-\r
-    coef->pub.decompress_data = decompress_onepass;\r
-\r
-    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */\r
-\r
-  }\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jdcolor.cpp b/libs/jpeg6/jdcolor.cpp
deleted file mode 100644 (file)
index 5c17359..0000000
+++ /dev/null
@@ -1,734 +0,0 @@
-/*\r
-\r
- * jdcolor.c\r
-\r
- *\r
-\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains output colorspace conversion routines.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-\r
-\r
-/* Private subobject */\r
-\r
-\r
-\r
-typedef struct {\r
-\r
-  struct jpeg_color_deconverter pub; /* public fields */\r
-\r
-\r
-\r
-  /* Private state for YCC->RGB conversion */\r
-\r
-  int * Cr_r_tab;              /* => table for Cr to R conversion */\r
-\r
-  int * Cb_b_tab;              /* => table for Cb to B conversion */\r
-\r
-  INT32 * Cr_g_tab;            /* => table for Cr to G conversion */\r
-\r
-  INT32 * Cb_g_tab;            /* => table for Cb to G conversion */\r
-\r
-} my_color_deconverter;\r
-\r
-\r
-\r
-typedef my_color_deconverter * my_cconvert_ptr;\r
-\r
-\r
-\r
-\r
-\r
-/**************** YCbCr -> RGB conversion: most common case **************/\r
-\r
-\r
-\r
-/*\r
-\r
- * YCbCr is defined per CCIR 601-1, except that Cb and Cr are\r
-\r
- * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.\r
-\r
- * The conversion equations to be implemented are therefore\r
-\r
- *     R = Y                + 1.40200 * Cr\r
-\r
- *     G = Y - 0.34414 * Cb - 0.71414 * Cr\r
-\r
- *     B = Y + 1.77200 * Cb\r
-\r
- * where Cb and Cr represent the incoming values less CENTERJSAMPLE.\r
-\r
- * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)\r
-\r
- *\r
-\r
- * To avoid floating-point arithmetic, we represent the fractional constants\r
-\r
- * as integers scaled up by 2^16 (about 4 digits precision); we have to divide\r
-\r
- * the products by 2^16, with appropriate rounding, to get the correct answer.\r
-\r
- * Notice that Y, being an integral input, does not contribute any fraction\r
-\r
- * so it need not participate in the rounding.\r
-\r
- *\r
-\r
- * For even more speed, we avoid doing any multiplications in the inner loop\r
-\r
- * by precalculating the constants times Cb and Cr for all possible values.\r
-\r
- * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);\r
-\r
- * for 12-bit samples it is still acceptable.  It's not very reasonable for\r
-\r
- * 16-bit samples, but if you want lossless storage you shouldn't be changing\r
-\r
- * colorspace anyway.\r
-\r
- * The Cr=>R and Cb=>B values can be rounded to integers in advance; the\r
-\r
- * values for the G calculation are left scaled up, since we must add them\r
-\r
- * together before rounding.\r
-\r
- */\r
-\r
-\r
-\r
-#define SCALEBITS      16      /* speediest right-shift on some machines */\r
-\r
-#define ONE_HALF       ((INT32) 1 << (SCALEBITS-1))\r
-\r
-#define FIX(x)         ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize tables for YCC->RGB colorspace conversion.\r
-\r
- */\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-build_ycc_rgb_table (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;\r
-\r
-  int i;\r
-\r
-  INT32 x;\r
-\r
-  SHIFT_TEMPS\r
-\r
-\r
-\r
-  cconvert->Cr_r_tab = (int *)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                               (MAXJSAMPLE+1) * SIZEOF(int));\r
-\r
-  cconvert->Cb_b_tab = (int *)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                               (MAXJSAMPLE+1) * SIZEOF(int));\r
-\r
-  cconvert->Cr_g_tab = (INT32 *)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                               (MAXJSAMPLE+1) * SIZEOF(INT32));\r
-\r
-  cconvert->Cb_g_tab = (INT32 *)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                               (MAXJSAMPLE+1) * SIZEOF(INT32));\r
-\r
-\r
-\r
-  for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {\r
-\r
-    /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */\r
-\r
-    /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */\r
-\r
-    /* Cr=>R value is nearest int to 1.40200 * x */\r
-\r
-    cconvert->Cr_r_tab[i] = (int)\r
-\r
-                   RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);\r
-\r
-    /* Cb=>B value is nearest int to 1.77200 * x */\r
-\r
-    cconvert->Cb_b_tab[i] = (int)\r
-\r
-                   RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);\r
-\r
-    /* Cr=>G value is scaled-up -0.71414 * x */\r
-\r
-    cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x;\r
-\r
-    /* Cb=>G value is scaled-up -0.34414 * x */\r
-\r
-    /* We also add in ONE_HALF so that need not do it in inner loop */\r
-\r
-    cconvert->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Convert some rows of samples to the output colorspace.\r
-\r
- *\r
-\r
- * Note that we change from noninterleaved, one-plane-per-component format\r
-\r
- * to interleaved-pixel format.  The output buffer is therefore three times\r
-\r
- * as wide as the input buffer.\r
-\r
- * A starting row offset is provided only for the input buffer.  The caller\r
-\r
- * can easily adjust the passed output_buf value to accommodate any row\r
-\r
- * offset required on that side.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-ycc_rgb_convert (j_decompress_ptr cinfo,\r
-\r
-                JSAMPIMAGE input_buf, JDIMENSION input_row,\r
-\r
-                JSAMPARRAY output_buf, int num_rows)\r
-\r
-{\r
-\r
-  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;\r
-\r
-  register int y, cb, cr;\r
-\r
-  register JSAMPROW outptr;\r
-\r
-  register JSAMPROW inptr0, inptr1, inptr2;\r
-\r
-  register JDIMENSION col;\r
-\r
-  JDIMENSION num_cols = cinfo->output_width;\r
-\r
-  /* copy these pointers into registers if possible */\r
-\r
-  register JSAMPLE * range_limit = cinfo->sample_range_limit;\r
-\r
-  register int * Crrtab = cconvert->Cr_r_tab;\r
-\r
-  register int * Cbbtab = cconvert->Cb_b_tab;\r
-\r
-  register INT32 * Crgtab = cconvert->Cr_g_tab;\r
-\r
-  register INT32 * Cbgtab = cconvert->Cb_g_tab;\r
-\r
-  SHIFT_TEMPS\r
-\r
-\r
-\r
-  while (--num_rows >= 0) {\r
-\r
-    inptr0 = input_buf[0][input_row];\r
-\r
-    inptr1 = input_buf[1][input_row];\r
-\r
-    inptr2 = input_buf[2][input_row];\r
-\r
-    input_row++;\r
-\r
-    outptr = *output_buf++;\r
-\r
-    for (col = 0; col < num_cols; col++) {\r
-\r
-      y  = GETJSAMPLE(inptr0[col]);\r
-\r
-      cb = GETJSAMPLE(inptr1[col]);\r
-\r
-      cr = GETJSAMPLE(inptr2[col]);\r
-\r
-      /* Range-limiting is essential due to noise introduced by DCT losses. */\r
-\r
-      outptr[RGB_RED] =   range_limit[y + Crrtab[cr]];\r
-\r
-      outptr[RGB_GREEN] = range_limit[y +\r
-\r
-                             ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],\r
-\r
-                                                SCALEBITS))];\r
-\r
-      outptr[RGB_BLUE] =  range_limit[y + Cbbtab[cb]];\r
-\r
-      outptr += RGB_PIXELSIZE;\r
-\r
-    }\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/**************** Cases other than YCbCr -> RGB **************/\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Color conversion for no colorspace change: just copy the data,\r
-\r
- * converting from separate-planes to interleaved representation.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-null_convert (j_decompress_ptr cinfo,\r
-\r
-             JSAMPIMAGE input_buf, JDIMENSION input_row,\r
-\r
-             JSAMPARRAY output_buf, int num_rows)\r
-\r
-{\r
-\r
-  register JSAMPROW inptr, outptr;\r
-\r
-  register JDIMENSION count;\r
-\r
-  register int num_components = cinfo->num_components;\r
-\r
-  JDIMENSION num_cols = cinfo->output_width;\r
-\r
-  int ci;\r
-\r
-\r
-\r
-  while (--num_rows >= 0) {\r
-\r
-    for (ci = 0; ci < num_components; ci++) {\r
-\r
-      inptr = input_buf[ci][input_row];\r
-\r
-      outptr = output_buf[0] + ci;\r
-\r
-      for (count = num_cols; count > 0; count--) {\r
-\r
-       *outptr = *inptr++;     /* needn't bother with GETJSAMPLE() here */\r
-\r
-       outptr += num_components;\r
-\r
-      }\r
-\r
-    }\r
-\r
-    input_row++;\r
-\r
-    output_buf++;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Color conversion for grayscale: just copy the data.\r
-\r
- * This also works for YCbCr -> grayscale conversion, in which\r
-\r
- * we just copy the Y (luminance) component and ignore chrominance.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-grayscale_convert (j_decompress_ptr cinfo,\r
-\r
-                  JSAMPIMAGE input_buf, JDIMENSION input_row,\r
-\r
-                  JSAMPARRAY output_buf, int num_rows)\r
-\r
-{\r
-\r
-  jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0,\r
-\r
-                   num_rows, cinfo->output_width);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Adobe-style YCCK->CMYK conversion.\r
-\r
- * We convert YCbCr to R=1-C, G=1-M, and B=1-Y using the same\r
-\r
- * conversion as above, while passing K (black) unchanged.\r
-\r
- * We assume build_ycc_rgb_table has been called.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-ycck_cmyk_convert (j_decompress_ptr cinfo,\r
-\r
-                  JSAMPIMAGE input_buf, JDIMENSION input_row,\r
-\r
-                  JSAMPARRAY output_buf, int num_rows)\r
-\r
-{\r
-\r
-  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;\r
-\r
-  register int y, cb, cr;\r
-\r
-  register JSAMPROW outptr;\r
-\r
-  register JSAMPROW inptr0, inptr1, inptr2, inptr3;\r
-\r
-  register JDIMENSION col;\r
-\r
-  JDIMENSION num_cols = cinfo->output_width;\r
-\r
-  /* copy these pointers into registers if possible */\r
-\r
-  register JSAMPLE * range_limit = cinfo->sample_range_limit;\r
-\r
-  register int * Crrtab = cconvert->Cr_r_tab;\r
-\r
-  register int * Cbbtab = cconvert->Cb_b_tab;\r
-\r
-  register INT32 * Crgtab = cconvert->Cr_g_tab;\r
-\r
-  register INT32 * Cbgtab = cconvert->Cb_g_tab;\r
-\r
-  SHIFT_TEMPS\r
-\r
-\r
-\r
-  while (--num_rows >= 0) {\r
-\r
-    inptr0 = input_buf[0][input_row];\r
-\r
-    inptr1 = input_buf[1][input_row];\r
-\r
-    inptr2 = input_buf[2][input_row];\r
-\r
-    inptr3 = input_buf[3][input_row];\r
-\r
-    input_row++;\r
-\r
-    outptr = *output_buf++;\r
-\r
-    for (col = 0; col < num_cols; col++) {\r
-\r
-      y  = GETJSAMPLE(inptr0[col]);\r
-\r
-      cb = GETJSAMPLE(inptr1[col]);\r
-\r
-      cr = GETJSAMPLE(inptr2[col]);\r
-\r
-      /* Range-limiting is essential due to noise introduced by DCT losses. */\r
-\r
-      outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])];  /* red */\r
-\r
-      outptr[1] = range_limit[MAXJSAMPLE - (y +                        /* green */\r
-\r
-                             ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],\r
-\r
-                                                SCALEBITS)))];\r
-\r
-      outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])];  /* blue */\r
-\r
-      /* K passes through unchanged */\r
-\r
-      outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */\r
-\r
-      outptr += 4;\r
-\r
-    }\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Empty method for start_pass.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-start_pass_dcolor (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  /* no work needed */\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Module initialization routine for output colorspace conversion.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jinit_color_deconverter (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  my_cconvert_ptr cconvert;\r
-\r
-  int ci;\r
-\r
-\r
-\r
-  cconvert = (my_cconvert_ptr)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                               SIZEOF(my_color_deconverter));\r
-\r
-  cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert;\r
-\r
-  cconvert->pub.start_pass = start_pass_dcolor;\r
-\r
-\r
-\r
-  /* Make sure num_components agrees with jpeg_color_space */\r
-\r
-  switch (cinfo->jpeg_color_space) {\r
-\r
-  case JCS_GRAYSCALE:\r
-\r
-    if (cinfo->num_components != 1)\r
-\r
-      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);\r
-\r
-    break;\r
-\r
-\r
-\r
-  case JCS_RGB:\r
-\r
-  case JCS_YCbCr:\r
-\r
-    if (cinfo->num_components != 3)\r
-\r
-      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);\r
-\r
-    break;\r
-\r
-\r
-\r
-  case JCS_CMYK:\r
-\r
-  case JCS_YCCK:\r
-\r
-    if (cinfo->num_components != 4)\r
-\r
-      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);\r
-\r
-    break;\r
-\r
-\r
-\r
-  default:                     /* JCS_UNKNOWN can be anything */\r
-\r
-    if (cinfo->num_components < 1)\r
-\r
-      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);\r
-\r
-    break;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Set out_color_components and conversion method based on requested space.\r
-\r
-   * Also clear the component_needed flags for any unused components,\r
-\r
-   * so that earlier pipeline stages can avoid useless computation.\r
-\r
-   */\r
-\r
-\r
-\r
-  switch (cinfo->out_color_space) {\r
-\r
-  case JCS_GRAYSCALE:\r
-\r
-    cinfo->out_color_components = 1;\r
-\r
-    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||\r
-\r
-       cinfo->jpeg_color_space == JCS_YCbCr) {\r
-\r
-      cconvert->pub.color_convert = grayscale_convert;\r
-\r
-      /* For color->grayscale conversion, only the Y (0) component is needed */\r
-\r
-      for (ci = 1; ci < cinfo->num_components; ci++)\r
-\r
-       cinfo->comp_info[ci].component_needed = FALSE;\r
-\r
-    } else\r
-\r
-      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);\r
-\r
-    break;\r
-\r
-\r
-\r
-  case JCS_RGB:\r
-\r
-    cinfo->out_color_components = RGB_PIXELSIZE;\r
-\r
-    if (cinfo->jpeg_color_space == JCS_YCbCr) {\r
-\r
-      cconvert->pub.color_convert = ycc_rgb_convert;\r
-\r
-      build_ycc_rgb_table(cinfo);\r
-\r
-    } else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) {\r
-\r
-      cconvert->pub.color_convert = null_convert;\r
-\r
-    } else\r
-\r
-      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);\r
-\r
-    break;\r
-\r
-\r
-\r
-  case JCS_CMYK:\r
-\r
-    cinfo->out_color_components = 4;\r
-\r
-    if (cinfo->jpeg_color_space == JCS_YCCK) {\r
-\r
-      cconvert->pub.color_convert = ycck_cmyk_convert;\r
-\r
-      build_ycc_rgb_table(cinfo);\r
-\r
-    } else if (cinfo->jpeg_color_space == JCS_CMYK) {\r
-\r
-      cconvert->pub.color_convert = null_convert;\r
-\r
-    } else\r
-\r
-      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);\r
-\r
-    break;\r
-\r
-\r
-\r
-  default:\r
-\r
-    /* Permit null conversion to same output space */\r
-\r
-    if (cinfo->out_color_space == cinfo->jpeg_color_space) {\r
-\r
-      cinfo->out_color_components = cinfo->num_components;\r
-\r
-      cconvert->pub.color_convert = null_convert;\r
-\r
-    } else                     /* unsupported non-null conversion */\r
-\r
-      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);\r
-\r
-    break;\r
-\r
-  }\r
-\r
-\r
-\r
-  if (cinfo->quantize_colors)\r
-\r
-    cinfo->output_components = 1; /* single colormapped output component */\r
-\r
-  else\r
-\r
-    cinfo->output_components = cinfo->out_color_components;\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jdct.h b/libs/jpeg6/jdct.h
deleted file mode 100644 (file)
index cebb118..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-/*\r
-\r
- * jdct.h\r
-\r
- *\r
-\r
- * Copyright (C) 1994, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This include file contains common declarations for the forward and\r
-\r
- * inverse DCT modules.  These declarations are private to the DCT managers\r
-\r
- * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms.\r
-\r
- * The individual DCT algorithms are kept in separate files to ease \r
-\r
- * machine-dependent tuning (e.g., assembly coding).\r
-\r
- */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * A forward DCT routine is given a pointer to a work area of type DCTELEM[];\r
-\r
- * the DCT is to be performed in-place in that buffer.  Type DCTELEM is int\r
-\r
- * for 8-bit samples, INT32 for 12-bit samples.  (NOTE: Floating-point DCT\r
-\r
- * implementations use an array of type FAST_FLOAT, instead.)\r
-\r
- * The DCT inputs are expected to be signed (range +-CENTERJSAMPLE).\r
-\r
- * The DCT outputs are returned scaled up by a factor of 8; they therefore\r
-\r
- * have a range of +-8K for 8-bit data, +-128K for 12-bit data.  This\r
-\r
- * convention improves accuracy in integer implementations and saves some\r
-\r
- * work in floating-point ones.\r
-\r
- * Quantization of the output coefficients is done by jcdctmgr.c.\r
-\r
- */\r
-\r
-\r
-\r
-#if BITS_IN_JSAMPLE == 8\r
-\r
-typedef int DCTELEM;           /* 16 or 32 bits is fine */\r
-\r
-#else\r
-\r
-typedef INT32 DCTELEM;         /* must have 32 bits */\r
-\r
-#endif\r
-\r
-\r
-\r
-typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data));\r
-\r
-typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data));\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer\r
-\r
- * to an output sample array.  The routine must dequantize the input data as\r
-\r
- * well as perform the IDCT; for dequantization, it uses the multiplier table\r
-\r
- * pointed to by compptr->dct_table.  The output data is to be placed into the\r
-\r
- * sample array starting at a specified column.  (Any row offset needed will\r
-\r
- * be applied to the array pointer before it is passed to the IDCT code.)\r
-\r
- * Note that the number of samples emitted by the IDCT routine is\r
-\r
- * DCT_scaled_size * DCT_scaled_size.\r
-\r
- */\r
-\r
-\r
-\r
-/* typedef inverse_DCT_method_ptr is declared in jpegint.h */\r
-\r
-\r
-\r
-/*\r
-\r
- * Each IDCT routine has its own ideas about the best dct_table element type.\r
-\r
- */\r
-\r
-\r
-\r
-typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */\r
-\r
-#if BITS_IN_JSAMPLE == 8\r
-\r
-typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */\r
-\r
-#define IFAST_SCALE_BITS  2    /* fractional bits in scale factors */\r
-\r
-#else\r
-\r
-typedef INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */\r
-\r
-#define IFAST_SCALE_BITS  13   /* fractional bits in scale factors */\r
-\r
-#endif\r
-\r
-typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Each IDCT routine is responsible for range-limiting its results and\r
-\r
- * converting them to unsigned form (0..MAXJSAMPLE).  The raw outputs could\r
-\r
- * be quite far out of range if the input data is corrupt, so a bulletproof\r
-\r
- * range-limiting step is required.  We use a mask-and-table-lookup method\r
-\r
- * to do the combined operations quickly.  See the comments with\r
-\r
- * prepare_range_limit_table (in jdmaster.c) for more info.\r
-\r
- */\r
-\r
-\r
-\r
-#define IDCT_range_limit(cinfo)  ((cinfo)->sample_range_limit + CENTERJSAMPLE)\r
-\r
-\r
-\r
-#define RANGE_MASK  (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */\r
-\r
-\r
-\r
-\r
-\r
-/* Short forms of external names for systems with brain-damaged linkers. */\r
-\r
-\r
-\r
-#ifdef NEED_SHORT_EXTERNAL_NAMES\r
-\r
-#define jpeg_fdct_islow                jFDislow\r
-\r
-#define jpeg_fdct_ifast                jFDifast\r
-\r
-#define jpeg_fdct_float                jFDfloat\r
-\r
-#define jpeg_idct_islow                jRDislow\r
-\r
-#define jpeg_idct_ifast                jRDifast\r
-\r
-#define jpeg_idct_float                jRDfloat\r
-\r
-#define jpeg_idct_4x4          jRD4x4\r
-\r
-#define jpeg_idct_2x2          jRD2x2\r
-\r
-#define jpeg_idct_1x1          jRD1x1\r
-\r
-#endif /* NEED_SHORT_EXTERNAL_NAMES */\r
-\r
-\r
-\r
-/* Extern declarations for the forward and inverse DCT routines. */\r
-\r
-\r
-\r
-EXTERN void jpeg_fdct_islow JPP((DCTELEM * data));\r
-\r
-EXTERN void jpeg_fdct_ifast JPP((DCTELEM * data));\r
-\r
-EXTERN void jpeg_fdct_float JPP((FAST_FLOAT * data));\r
-\r
-\r
-\r
-EXTERN void jpeg_idct_islow\r
-\r
-    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-        JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
-\r
-EXTERN void jpeg_idct_ifast\r
-\r
-    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-        JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
-\r
-EXTERN void jpeg_idct_float\r
-\r
-    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-        JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
-\r
-EXTERN void jpeg_idct_4x4\r
-\r
-    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-        JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
-\r
-EXTERN void jpeg_idct_2x2\r
-\r
-    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-        JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
-\r
-EXTERN void jpeg_idct_1x1\r
-\r
-    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-        JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Macros for handling fixed-point arithmetic; these are used by many\r
-\r
- * but not all of the DCT/IDCT modules.\r
-\r
- *\r
-\r
- * All values are expected to be of type INT32.\r
-\r
- * Fractional constants are scaled left by CONST_BITS bits.\r
-\r
- * CONST_BITS is defined within each module using these macros,\r
-\r
- * and may differ from one module to the next.\r
-\r
- */\r
-\r
-\r
-\r
-#define ONE    ((INT32) 1)\r
-\r
-#define CONST_SCALE (ONE << CONST_BITS)\r
-\r
-\r
-\r
-/* Convert a positive real constant to an integer scaled by CONST_SCALE.\r
-\r
- * Caution: some C compilers fail to reduce "FIX(constant)" at compile time,\r
-\r
- * thus causing a lot of useless floating-point operations at run time.\r
-\r
- */\r
-\r
-\r
-\r
-#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))\r
-\r
-\r
-\r
-/* Descale and correctly round an INT32 value that's scaled by N bits.\r
-\r
- * We assume RIGHT_SHIFT rounds towards minus infinity, so adding\r
-\r
- * the fudge factor is correct for either sign of X.\r
-\r
- */\r
-\r
-\r
-\r
-#define DESCALE(x,n)  RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)\r
-\r
-\r
-\r
-/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.\r
-\r
- * This macro is used only when the two inputs will actually be no more than\r
-\r
- * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a\r
-\r
- * full 32x32 multiply.  This provides a useful speedup on many machines.\r
-\r
- * Unfortunately there is no way to specify a 16x16->32 multiply portably\r
-\r
- * in C, but some C compilers will do the right thing if you provide the\r
-\r
- * correct combination of casts.\r
-\r
- */\r
-\r
-\r
-\r
-#ifdef SHORTxSHORT_32          /* may work if 'int' is 32 bits */\r
-\r
-#define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT16) (const)))\r
-\r
-#endif\r
-\r
-#ifdef SHORTxLCONST_32         /* known to work with Microsoft C 6.0 */\r
-\r
-#define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT32) (const)))\r
-\r
-#endif\r
-\r
-\r
-\r
-#ifndef MULTIPLY16C16          /* default definition */\r
-\r
-#define MULTIPLY16C16(var,const)  ((var) * (const))\r
-\r
-#endif\r
-\r
-\r
-\r
-/* Same except both inputs are variables. */\r
-\r
-\r
-\r
-#ifdef SHORTxSHORT_32          /* may work if 'int' is 32 bits */\r
-\r
-#define MULTIPLY16V16(var1,var2)  (((INT16) (var1)) * ((INT16) (var2)))\r
-\r
-#endif\r
-\r
-\r
-\r
-#ifndef MULTIPLY16V16          /* default definition */\r
-\r
-#define MULTIPLY16V16(var1,var2)  ((var1) * (var2))\r
-\r
-#endif\r
-\r
diff --git a/libs/jpeg6/jddctmgr.cpp b/libs/jpeg6/jddctmgr.cpp
deleted file mode 100644 (file)
index cdf107e..0000000
+++ /dev/null
@@ -1,540 +0,0 @@
-/*\r
-\r
- * jddctmgr.c\r
-\r
- *\r
-\r
- * Copyright (C) 1994-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains the inverse-DCT management logic.\r
-\r
- * This code selects a particular IDCT implementation to be used,\r
-\r
- * and it performs related housekeeping chores.  No code in this file\r
-\r
- * is executed per IDCT step, only during output pass setup.\r
-\r
- *\r
-\r
- * Note that the IDCT routines are responsible for performing coefficient\r
-\r
- * dequantization as well as the IDCT proper.  This module sets up the\r
-\r
- * dequantization multiplier table needed by the IDCT routine.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-#include "jdct.h"              /* Private declarations for DCT subsystem */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * The decompressor input side (jdinput.c) saves away the appropriate\r
-\r
- * quantization table for each component at the start of the first scan\r
-\r
- * involving that component.  (This is necessary in order to correctly\r
-\r
- * decode files that reuse Q-table slots.)\r
-\r
- * When we are ready to make an output pass, the saved Q-table is converted\r
-\r
- * to a multiplier table that will actually be used by the IDCT routine.\r
-\r
- * The multiplier table contents are IDCT-method-dependent.  To support\r
-\r
- * application changes in IDCT method between scans, we can remake the\r
-\r
- * multiplier tables if necessary.\r
-\r
- * In buffered-image mode, the first output pass may occur before any data\r
-\r
- * has been seen for some components, and thus before their Q-tables have\r
-\r
- * been saved away.  To handle this case, multiplier tables are preset\r
-\r
- * to zeroes; the result of the IDCT will be a neutral gray level.\r
-\r
- */\r
-\r
-\r
-\r
-\r
-\r
-/* Private subobject for this module */\r
-\r
-\r
-\r
-typedef struct {\r
-\r
-  struct jpeg_inverse_dct pub; /* public fields */\r
-\r
-\r
-\r
-  /* This array contains the IDCT method code that each multiplier table\r
-\r
-   * is currently set up for, or -1 if it's not yet set up.\r
-\r
-   * The actual multiplier tables are pointed to by dct_table in the\r
-\r
-   * per-component comp_info structures.\r
-\r
-   */\r
-\r
-  int cur_method[MAX_COMPONENTS];\r
-\r
-} my_idct_controller;\r
-\r
-\r
-\r
-typedef my_idct_controller * my_idct_ptr;\r
-\r
-\r
-\r
-\r
-\r
-/* Allocated multiplier tables: big enough for any supported variant */\r
-\r
-\r
-\r
-typedef union {\r
-\r
-  ISLOW_MULT_TYPE islow_array[DCTSIZE2];\r
-\r
-#ifdef DCT_IFAST_SUPPORTED\r
-\r
-  IFAST_MULT_TYPE ifast_array[DCTSIZE2];\r
-\r
-#endif\r
-\r
-#ifdef DCT_FLOAT_SUPPORTED\r
-\r
-  FLOAT_MULT_TYPE float_array[DCTSIZE2];\r
-\r
-#endif\r
-\r
-} multiplier_table;\r
-\r
-\r
-\r
-\r
-\r
-/* The current scaled-IDCT routines require ISLOW-style multiplier tables,\r
-\r
- * so be sure to compile that code if either ISLOW or SCALING is requested.\r
-\r
- */\r
-\r
-#ifdef DCT_ISLOW_SUPPORTED\r
-\r
-#define PROVIDE_ISLOW_TABLES\r
-\r
-#else\r
-\r
-#ifdef IDCT_SCALING_SUPPORTED\r
-\r
-#define PROVIDE_ISLOW_TABLES\r
-\r
-#endif\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Prepare for an output pass.\r
-\r
- * Here we select the proper IDCT routine for each component and build\r
-\r
- * a matching multiplier table.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-start_pass (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  my_idct_ptr idct = (my_idct_ptr) cinfo->idct;\r
-\r
-  int ci, i;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-  int method = 0;\r
-\r
-  inverse_DCT_method_ptr method_ptr = NULL;\r
-\r
-  JQUANT_TBL * qtbl;\r
-\r
-\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    /* Select the proper IDCT routine for this component's scaling */\r
-\r
-    switch (compptr->DCT_scaled_size) {\r
-\r
-#ifdef IDCT_SCALING_SUPPORTED\r
-\r
-    case 1:\r
-\r
-      method_ptr = jpeg_idct_1x1;\r
-\r
-      method = JDCT_ISLOW;     /* jidctred uses islow-style table */\r
-\r
-      break;\r
-\r
-    case 2:\r
-\r
-      method_ptr = jpeg_idct_2x2;\r
-\r
-      method = JDCT_ISLOW;     /* jidctred uses islow-style table */\r
-\r
-      break;\r
-\r
-    case 4:\r
-\r
-      method_ptr = jpeg_idct_4x4;\r
-\r
-      method = JDCT_ISLOW;     /* jidctred uses islow-style table */\r
-\r
-      break;\r
-\r
-#endif\r
-\r
-    case DCTSIZE:\r
-\r
-      switch (cinfo->dct_method) {\r
-\r
-#ifdef DCT_ISLOW_SUPPORTED\r
-\r
-      case JDCT_ISLOW:\r
-\r
-       method_ptr = jpeg_idct_islow;\r
-\r
-       method = JDCT_ISLOW;\r
-\r
-       break;\r
-\r
-#endif\r
-\r
-#ifdef DCT_IFAST_SUPPORTED\r
-\r
-      case JDCT_IFAST:\r
-\r
-       method_ptr = jpeg_idct_ifast;\r
-\r
-       method = JDCT_IFAST;\r
-\r
-       break;\r
-\r
-#endif\r
-\r
-#ifdef DCT_FLOAT_SUPPORTED\r
-\r
-      case JDCT_FLOAT:\r
-\r
-       method_ptr = jpeg_idct_float;\r
-\r
-       method = JDCT_FLOAT;\r
-\r
-       break;\r
-\r
-#endif\r
-\r
-      default:\r
-\r
-       ERREXIT(cinfo, JERR_NOT_COMPILED);\r
-\r
-       break;\r
-\r
-      }\r
-\r
-      break;\r
-\r
-    default:\r
-\r
-      ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->DCT_scaled_size);\r
-\r
-      break;\r
-\r
-    }\r
-\r
-    idct->pub.inverse_DCT[ci] = method_ptr;\r
-\r
-    /* Create multiplier table from quant table.\r
-\r
-     * However, we can skip this if the component is uninteresting\r
-\r
-     * or if we already built the table.  Also, if no quant table\r
-\r
-     * has yet been saved for the component, we leave the\r
-\r
-     * multiplier table all-zero; we'll be reading zeroes from the\r
-\r
-     * coefficient controller's buffer anyway.\r
-\r
-     */\r
-\r
-    if (! compptr->component_needed || idct->cur_method[ci] == method)\r
-\r
-      continue;\r
-\r
-    qtbl = compptr->quant_table;\r
-\r
-    if (qtbl == NULL)          /* happens if no data yet for component */\r
-\r
-      continue;\r
-\r
-    idct->cur_method[ci] = method;\r
-\r
-    switch (method) {\r
-\r
-#ifdef PROVIDE_ISLOW_TABLES\r
-\r
-    case JDCT_ISLOW:\r
-\r
-      {\r
-\r
-       /* For LL&M IDCT method, multipliers are equal to raw quantization\r
-\r
-        * coefficients, but are stored in natural order as ints.\r
-\r
-        */\r
-\r
-       ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table;\r
-\r
-       for (i = 0; i < DCTSIZE2; i++) {\r
-\r
-         ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[jpeg_zigzag_order[i]];\r
-\r
-       }\r
-\r
-      }\r
-\r
-      break;\r
-\r
-#endif\r
-\r
-#ifdef DCT_IFAST_SUPPORTED\r
-\r
-    case JDCT_IFAST:\r
-\r
-      {\r
-\r
-       /* For AA&N IDCT method, multipliers are equal to quantization\r
-\r
-        * coefficients scaled by scalefactor[row]*scalefactor[col], where\r
-\r
-        *   scalefactor[0] = 1\r
-\r
-        *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7\r
-\r
-        * For integer operation, the multiplier table is to be scaled by\r
-\r
-        * IFAST_SCALE_BITS.  The multipliers are stored in natural order.\r
-\r
-        */\r
-\r
-       IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table;\r
-\r
-#define CONST_BITS 14\r
-\r
-       static const INT16 aanscales[DCTSIZE2] = {\r
-\r
-         /* precomputed values scaled up by 14 bits */\r
-\r
-         16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,\r
-\r
-         22725, 31521, 29692, 26722, 22725, 17855, 12299,  6270,\r
-\r
-         21407, 29692, 27969, 25172, 21407, 16819, 11585,  5906,\r
-\r
-         19266, 26722, 25172, 22654, 19266, 15137, 10426,  5315,\r
-\r
-         16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,\r
-\r
-         12873, 17855, 16819, 15137, 12873, 10114,  6967,  3552,\r
-\r
-          8867, 12299, 11585, 10426,  8867,  6967,  4799,  2446,\r
-\r
-          4520,  6270,  5906,  5315,  4520,  3552,  2446,  1247\r
-\r
-       };\r
-\r
-       SHIFT_TEMPS\r
-\r
-\r
-\r
-       for (i = 0; i < DCTSIZE2; i++) {\r
-\r
-         ifmtbl[i] = (IFAST_MULT_TYPE)\r
-\r
-           DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[jpeg_zigzag_order[i]],\r
-\r
-                                 (INT32) aanscales[i]),\r
-\r
-                   CONST_BITS-IFAST_SCALE_BITS);\r
-\r
-       }\r
-\r
-      }\r
-\r
-      break;\r
-\r
-#endif\r
-\r
-#ifdef DCT_FLOAT_SUPPORTED\r
-\r
-    case JDCT_FLOAT:\r
-\r
-      {\r
-\r
-       /* For float AA&N IDCT method, multipliers are equal to quantization\r
-\r
-        * coefficients scaled by scalefactor[row]*scalefactor[col], where\r
-\r
-        *   scalefactor[0] = 1\r
-\r
-        *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7\r
-\r
-        * The multipliers are stored in natural order.\r
-\r
-        */\r
-\r
-       FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table;\r
-\r
-       int row, col;\r
-\r
-       static const double aanscalefactor[DCTSIZE] = {\r
-\r
-         1.0, 1.387039845, 1.306562965, 1.175875602,\r
-\r
-         1.0, 0.785694958, 0.541196100, 0.275899379\r
-\r
-       };\r
-\r
-\r
-\r
-       i = 0;\r
-\r
-       for (row = 0; row < DCTSIZE; row++) {\r
-\r
-         for (col = 0; col < DCTSIZE; col++) {\r
-\r
-           fmtbl[i] = (FLOAT_MULT_TYPE)\r
-\r
-             ((double) qtbl->quantval[jpeg_zigzag_order[i]] *\r
-\r
-              aanscalefactor[row] * aanscalefactor[col]);\r
-\r
-           i++;\r
-\r
-         }\r
-\r
-       }\r
-\r
-      }\r
-\r
-      break;\r
-\r
-#endif\r
-\r
-    default:\r
-\r
-      ERREXIT(cinfo, JERR_NOT_COMPILED);\r
-\r
-      break;\r
-\r
-    }\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize IDCT manager.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jinit_inverse_dct (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  my_idct_ptr idct;\r
-\r
-  int ci;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-\r
-\r
-  idct = (my_idct_ptr)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                               SIZEOF(my_idct_controller));\r
-\r
-  cinfo->idct = (struct jpeg_inverse_dct *) idct;\r
-\r
-  idct->pub.start_pass = start_pass;\r
-\r
-\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    /* Allocate and pre-zero a multiplier table for each component */\r
-\r
-    compptr->dct_table =\r
-\r
-      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                                 SIZEOF(multiplier_table));\r
-\r
-    MEMZERO(compptr->dct_table, SIZEOF(multiplier_table));\r
-\r
-    /* Mark multiplier table not yet set up for any method */\r
-\r
-    idct->cur_method[ci] = -1;\r
-\r
-  }\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jdhuff.cpp b/libs/jpeg6/jdhuff.cpp
deleted file mode 100644 (file)
index 4ed8bc3..0000000
+++ /dev/null
@@ -1,574 +0,0 @@
-/*\r
- * jdhuff.c\r
- *\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
- * This file is part of the Independent JPEG Group's software.\r
- * For conditions of distribution and use, see the accompanying README file.\r
- *\r
- * This file contains Huffman entropy decoding routines.\r
- *\r
- * Much of the complexity here has to do with supporting input suspension.\r
- * If the data source module demands suspension, we want to be able to back\r
- * up to the start of the current MCU.  To do this, we copy state variables\r
- * into local working storage, and update them back to the permanent\r
- * storage only upon successful completion of an MCU.\r
- */\r
-\r
-#define JPEG_INTERNALS\r
-#include "jinclude.h"\r
-#include "radiant_jpeglib.h"\r
-#include "jdhuff.h"            /* Declarations shared with jdphuff.c */\r
-\r
-\r
-/*\r
- * Expanded entropy decoder object for Huffman decoding.\r
- *\r
- * The savable_state subrecord contains fields that change within an MCU,\r
- * but must not be updated permanently until we complete the MCU.\r
- */\r
-\r
-typedef struct {\r
-  int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */\r
-} savable_state;\r
-\r
-/* This macro is to work around compilers with missing or broken\r
- * structure assignment.  You'll need to fix this code if you have\r
- * such a compiler and you change MAX_COMPS_IN_SCAN.\r
- */\r
-\r
-#ifndef NO_STRUCT_ASSIGN\r
-#define ASSIGN_STATE(dest,src)  ((dest) = (src))\r
-#else\r
-#if MAX_COMPS_IN_SCAN == 4\r
-#define ASSIGN_STATE(dest,src)  \\r
-       ((dest).last_dc_val[0] = (src).last_dc_val[0], \\r
-        (dest).last_dc_val[1] = (src).last_dc_val[1], \\r
-        (dest).last_dc_val[2] = (src).last_dc_val[2], \\r
-        (dest).last_dc_val[3] = (src).last_dc_val[3])\r
-#endif\r
-#endif\r
-\r
-\r
-typedef struct {\r
-  struct jpeg_entropy_decoder pub; /* public fields */\r
-\r
-  /* These fields are loaded into local variables at start of each MCU.\r
-   * In case of suspension, we exit WITHOUT updating them.\r
-   */\r
-  bitread_perm_state bitstate; /* Bit buffer at start of MCU */\r
-  savable_state saved;         /* Other state at start of MCU */\r
-\r
-  /* These fields are NOT loaded into local working state. */\r
-  unsigned int restarts_to_go; /* MCUs left in this restart interval */\r
-\r
-  /* Pointers to derived tables (these workspaces have image lifespan) */\r
-  d_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS];\r
-  d_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS];\r
-} huff_entropy_decoder;\r
-\r
-typedef huff_entropy_decoder * huff_entropy_ptr;\r
-\r
-\r
-/*\r
- * Initialize for a Huffman-compressed scan.\r
- */\r
-\r
-METHODDEF void\r
-start_pass_huff_decoder (j_decompress_ptr cinfo)\r
-{\r
-  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;\r
-  int ci, dctbl, actbl;\r
-  jpeg_component_info * compptr;\r
-\r
-  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.\r
-   * This ought to be an error condition, but we make it a warning because\r
-   * there are some baseline files out there with all zeroes in these bytes.\r
-   */\r
-  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 ||\r
-      cinfo->Ah != 0 || cinfo->Al != 0)\r
-    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);\r
-\r
-  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {\r
-    compptr = cinfo->cur_comp_info[ci];\r
-    dctbl = compptr->dc_tbl_no;\r
-    actbl = compptr->ac_tbl_no;\r
-    /* Make sure requested tables are present */\r
-    if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS ||\r
-       cinfo->dc_huff_tbl_ptrs[dctbl] == NULL)\r
-      ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);\r
-    if (actbl < 0 || actbl >= NUM_HUFF_TBLS ||\r
-       cinfo->ac_huff_tbl_ptrs[actbl] == NULL)\r
-      ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);\r
-    /* Compute derived values for Huffman tables */\r
-    /* We may do this more than once for a table, but it's not expensive */\r
-    jpeg_make_d_derived_tbl(cinfo, cinfo->dc_huff_tbl_ptrs[dctbl],\r
-                           & entropy->dc_derived_tbls[dctbl]);\r
-    jpeg_make_d_derived_tbl(cinfo, cinfo->ac_huff_tbl_ptrs[actbl],\r
-                           & entropy->ac_derived_tbls[actbl]);\r
-    /* Initialize DC predictions to 0 */\r
-    entropy->saved.last_dc_val[ci] = 0;\r
-  }\r
-\r
-  /* Initialize bitread state variables */\r
-  entropy->bitstate.bits_left = 0;\r
-  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */\r
-  entropy->bitstate.printed_eod = FALSE;\r
-\r
-  /* Initialize restart counter */\r
-  entropy->restarts_to_go = cinfo->restart_interval;\r
-}\r
-\r
-\r
-/*\r
- * Compute the derived values for a Huffman table.\r
- * Note this is also used by jdphuff.c.\r
- */\r
-\r
-GLOBAL void\r
-jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, JHUFF_TBL * htbl,\r
-                        d_derived_tbl ** pdtbl)\r
-{\r
-  d_derived_tbl *dtbl;\r
-  int p, i, l, si;\r
-  int lookbits, ctr;\r
-  char huffsize[257];\r
-  unsigned int huffcode[257];\r
-  unsigned int code;\r
-\r
-  /* Allocate a workspace if we haven't already done so. */\r
-  if (*pdtbl == NULL)\r
-    *pdtbl = (d_derived_tbl *)\r
-      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-                                 SIZEOF(d_derived_tbl));\r
-  dtbl = *pdtbl;\r
-  dtbl->pub = htbl;            /* fill in back link */\r
-  \r
-  /* Figure C.1: make table of Huffman code length for each symbol */\r
-  /* Note that this is in code-length order. */\r
-\r
-  p = 0;\r
-  for (l = 1; l <= 16; l++) {\r
-    for (i = 1; i <= (int) htbl->bits[l]; i++)\r
-      huffsize[p++] = (char) l;\r
-  }\r
-  huffsize[p] = 0;\r
-  \r
-  /* Figure C.2: generate the codes themselves */\r
-  /* Note that this is in code-length order. */\r
-  \r
-  code = 0;\r
-  si = huffsize[0];\r
-  p = 0;\r
-  while (huffsize[p]) {\r
-    while (((int) huffsize[p]) == si) {\r
-      huffcode[p++] = code;\r
-      code++;\r
-    }\r
-    code <<= 1;\r
-    si++;\r
-  }\r
-\r
-  /* Figure F.15: generate decoding tables for bit-sequential decoding */\r
-\r
-  p = 0;\r
-  for (l = 1; l <= 16; l++) {\r
-    if (htbl->bits[l]) {\r
-      dtbl->valptr[l] = p; /* huffval[] index of 1st symbol of code length l */\r
-      dtbl->mincode[l] = huffcode[p]; /* minimum code of length l */\r
-      p += htbl->bits[l];\r
-      dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */\r
-    } else {\r
-      dtbl->maxcode[l] = -1;   /* -1 if no codes of this length */\r
-    }\r
-  }\r
-  dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */\r
-\r
-  /* Compute lookahead tables to speed up decoding.\r
-   * First we set all the table entries to 0, indicating "too long";\r
-   * then we iterate through the Huffman codes that are short enough and\r
-   * fill in all the entries that correspond to bit sequences starting\r
-   * with that code.\r
-   */\r
-\r
-  MEMZERO(dtbl->look_nbits, SIZEOF(dtbl->look_nbits));\r
-\r
-  p = 0;\r
-  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {\r
-    for (i = 1; i <= (int) htbl->bits[l]; i++, p++) {\r
-      /* l = current code's length, p = its index in huffcode[] & huffval[]. */\r
-      /* Generate left-justified code followed by all possible bit sequences */\r
-      lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l);\r
-      for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) {\r
-       dtbl->look_nbits[lookbits] = l;\r
-       dtbl->look_sym[lookbits] = htbl->huffval[p];\r
-       lookbits++;\r
-      }\r
-    }\r
-  }\r
-}\r
-\r
-\r
-/*\r
- * Out-of-line code for bit fetching (shared with jdphuff.c).\r
- * See jdhuff.h for info about usage.\r
- * Note: current values of get_buffer and bits_left are passed as parameters,\r
- * but are returned in the corresponding fields of the state struct.\r
- *\r
- * On most machines MIN_GET_BITS should be 25 to allow the full 32-bit width\r
- * of get_buffer to be used.  (On machines with wider words, an even larger\r
- * buffer could be used.)  However, on some machines 32-bit shifts are\r
- * quite slow and take time proportional to the number of places shifted.\r
- * (This is true with most PC compilers, for instance.)  In this case it may\r
- * be a win to set MIN_GET_BITS to the minimum value of 15.  This reduces the\r
- * average shift distance at the cost of more calls to jpeg_fill_bit_buffer.\r
- */\r
-\r
-#ifdef SLOW_SHIFT_32\r
-#define MIN_GET_BITS  15       /* minimum allowable value */\r
-#else\r
-#define MIN_GET_BITS  (BIT_BUF_SIZE-7)\r
-#endif\r
-\r
-\r
-GLOBAL boolean\r
-jpeg_fill_bit_buffer (bitread_working_state * state,\r
-                     register bit_buf_type get_buffer, register int bits_left,\r
-                     int nbits)\r
-/* Load up the bit buffer to a depth of at least nbits */\r
-{\r
-  /* Copy heavily used state fields into locals (hopefully registers) */\r
-  register const JOCTET * next_input_byte = state->next_input_byte;\r
-  register size_t bytes_in_buffer = state->bytes_in_buffer;\r
-  register int c;\r
-\r
-  /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */\r
-  /* (It is assumed that no request will be for more than that many bits.) */\r
-\r
-  while (bits_left < MIN_GET_BITS) {\r
-    /* Attempt to read a byte */\r
-    if (state->unread_marker != 0)\r
-      goto no_more_data;       /* can't advance past a marker */\r
-\r
-    if (bytes_in_buffer == 0) {\r
-      if (! (*state->cinfo->src->fill_input_buffer) (state->cinfo))\r
-       return FALSE;\r
-      next_input_byte = state->cinfo->src->next_input_byte;\r
-      bytes_in_buffer = state->cinfo->src->bytes_in_buffer;\r
-    }\r
-    bytes_in_buffer--;\r
-    c = GETJOCTET(*next_input_byte++);\r
-\r
-    /* If it's 0xFF, check and discard stuffed zero byte */\r
-    if (c == 0xFF) {\r
-      do {\r
-       if (bytes_in_buffer == 0) {\r
-         if (! (*state->cinfo->src->fill_input_buffer) (state->cinfo))\r
-           return FALSE;\r
-         next_input_byte = state->cinfo->src->next_input_byte;\r
-         bytes_in_buffer = state->cinfo->src->bytes_in_buffer;\r
-       }\r
-       bytes_in_buffer--;\r
-       c = GETJOCTET(*next_input_byte++);\r
-      } while (c == 0xFF);\r
-\r
-      if (c == 0) {\r
-       /* Found FF/00, which represents an FF data byte */\r
-       c = 0xFF;\r
-      } else {\r
-       /* Oops, it's actually a marker indicating end of compressed data. */\r
-       /* Better put it back for use later */\r
-       state->unread_marker = c;\r
-\r
-      no_more_data:\r
-       /* There should be enough bits still left in the data segment; */\r
-       /* if so, just break out of the outer while loop. */\r
-       if (bits_left >= nbits)\r
-         break;\r
-       /* Uh-oh.  Report corrupted data to user and stuff zeroes into\r
-        * the data stream, so that we can produce some kind of image.\r
-        * Note that this code will be repeated for each byte demanded\r
-        * for the rest of the segment.  We use a nonvolatile flag to ensure\r
-        * that only one warning message appears.\r
-        */\r
-       if (! *(state->printed_eod_ptr)) {\r
-         WARNMS(state->cinfo, JWRN_HIT_MARKER);\r
-         *(state->printed_eod_ptr) = TRUE;\r
-       }\r
-       c = 0;                  /* insert a zero byte into bit buffer */\r
-      }\r
-    }\r
-\r
-    /* OK, load c into get_buffer */\r
-    get_buffer = (get_buffer << 8) | c;\r
-    bits_left += 8;\r
-  }\r
-\r
-  /* Unload the local registers */\r
-  state->next_input_byte = next_input_byte;\r
-  state->bytes_in_buffer = bytes_in_buffer;\r
-  state->get_buffer = get_buffer;\r
-  state->bits_left = bits_left;\r
-\r
-  return TRUE;\r
-}\r
-\r
-\r
-/*\r
- * Out-of-line code for Huffman code decoding.\r
- * See jdhuff.h for info about usage.\r
- */\r
-\r
-GLOBAL int\r
-jpeg_huff_decode (bitread_working_state * state,\r
-                 register bit_buf_type get_buffer, register int bits_left,\r
-                 d_derived_tbl * htbl, int min_bits)\r
-{\r
-  register int l = min_bits;\r
-  register INT32 code;\r
-\r
-  /* HUFF_DECODE has determined that the code is at least min_bits */\r
-  /* bits long, so fetch that many bits in one swoop. */\r
-\r
-  CHECK_BIT_BUFFER(*state, l, return -1);\r
-  code = GET_BITS(l);\r
-\r
-  /* Collect the rest of the Huffman code one bit at a time. */\r
-  /* This is per Figure F.16 in the JPEG spec. */\r
-\r
-  while (code > htbl->maxcode[l]) {\r
-    code <<= 1;\r
-    CHECK_BIT_BUFFER(*state, 1, return -1);\r
-    code |= GET_BITS(1);\r
-    l++;\r
-  }\r
-\r
-  /* Unload the local registers */\r
-  state->get_buffer = get_buffer;\r
-  state->bits_left = bits_left;\r
-\r
-  /* With garbage input we may reach the sentinel value l = 17. */\r
-\r
-  if (l > 16) {\r
-    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);\r
-    return 0;                  /* fake a zero as the safest result */\r
-  }\r
-\r
-  return htbl->pub->huffval[ htbl->valptr[l] +\r
-                           ((int) (code - htbl->mincode[l])) ];\r
-}\r
-\r
-\r
-/*\r
- * Figure F.12: extend sign bit.\r
- * On some machines, a shift and add will be faster than a table lookup.\r
- */\r
-\r
-#ifdef AVOID_TABLES\r
-\r
-#define HUFF_EXTEND(x,s)  ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x))\r
-\r
-#else\r
-\r
-#define HUFF_EXTEND(x,s)  ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))\r
-\r
-static const int extend_test[16] =   /* entry n is 2**(n-1) */\r
-  { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,\r
-    0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };\r
-\r
-static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */\r
-  { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,\r
-    ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,\r
-    ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,\r
-    ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };\r
-\r
-#endif /* AVOID_TABLES */\r
-\r
-\r
-/*\r
- * Check for a restart marker & resynchronize decoder.\r
- * Returns FALSE if must suspend.\r
- */\r
-\r
-LOCAL boolean\r
-process_restart (j_decompress_ptr cinfo)\r
-{\r
-  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;\r
-  int ci;\r
-\r
-  /* Throw away any unused bits remaining in bit buffer; */\r
-  /* include any full bytes in next_marker's count of discarded bytes */\r
-  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;\r
-  entropy->bitstate.bits_left = 0;\r
-\r
-  /* Advance past the RSTn marker */\r
-  if (! (*cinfo->marker->read_restart_marker) (cinfo))\r
-    return FALSE;\r
-\r
-  /* Re-initialize DC predictions to 0 */\r
-  for (ci = 0; ci < cinfo->comps_in_scan; ci++)\r
-    entropy->saved.last_dc_val[ci] = 0;\r
-\r
-  /* Reset restart counter */\r
-  entropy->restarts_to_go = cinfo->restart_interval;\r
-\r
-  /* Next segment can get another out-of-data warning */\r
-  entropy->bitstate.printed_eod = FALSE;\r
-\r
-  return TRUE;\r
-}\r
-\r
-\r
-/*\r
- * Decode and return one MCU's worth of Huffman-compressed coefficients.\r
- * The coefficients are reordered from zigzag order into natural array order,\r
- * but are not dequantized.\r
- *\r
- * The i'th block of the MCU is stored into the block pointed to by\r
- * MCU_data[i].  WE ASSUME THIS AREA HAS BEEN ZEROED BY THE CALLER.\r
- * (Wholesale zeroing is usually a little faster than retail...)\r
- *\r
- * Returns FALSE if data source requested suspension.  In that case no\r
- * changes have been made to permanent state.  (Exception: some output\r
- * coefficients may already have been assigned.  This is harmless for\r
- * this module, since we'll just re-assign them on the next call.)\r
- */\r
-\r
-METHODDEF boolean\r
-decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)\r
-{\r
-  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;\r
-  register int s, k, r;\r
-  int blkn, ci;\r
-  JBLOCKROW block;\r
-  BITREAD_STATE_VARS;\r
-  savable_state state;\r
-  d_derived_tbl * dctbl;\r
-  d_derived_tbl * actbl;\r
-  jpeg_component_info * compptr;\r
-\r
-  /* Process restart marker if needed; may have to suspend */\r
-  if (cinfo->restart_interval) {\r
-    if (entropy->restarts_to_go == 0)\r
-      if (! process_restart(cinfo))\r
-       return FALSE;\r
-  }\r
-\r
-  /* Load up working state */\r
-  BITREAD_LOAD_STATE(cinfo,entropy->bitstate);\r
-  ASSIGN_STATE(state, entropy->saved);\r
-\r
-  /* Outer loop handles each block in the MCU */\r
-\r
-  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {\r
-    block = MCU_data[blkn];\r
-    ci = cinfo->MCU_membership[blkn];\r
-    compptr = cinfo->cur_comp_info[ci];\r
-    dctbl = entropy->dc_derived_tbls[compptr->dc_tbl_no];\r
-    actbl = entropy->ac_derived_tbls[compptr->ac_tbl_no];\r
-\r
-    /* Decode a single block's worth of coefficients */\r
-\r
-    /* Section F.2.2.1: decode the DC coefficient difference */\r
-    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);\r
-    if (s) {\r
-      CHECK_BIT_BUFFER(br_state, s, return FALSE);\r
-      r = GET_BITS(s);\r
-      s = HUFF_EXTEND(r, s);\r
-    }\r
-\r
-    /* Shortcut if component's values are not interesting */\r
-    if (! compptr->component_needed)\r
-      goto skip_ACs;\r
-\r
-    /* Convert DC difference to actual value, update last_dc_val */\r
-    s += state.last_dc_val[ci];\r
-    state.last_dc_val[ci] = s;\r
-    /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */\r
-    (*block)[0] = (JCOEF) s;\r
-\r
-    /* Do we need to decode the AC coefficients for this component? */\r
-    if (compptr->DCT_scaled_size > 1) {\r
-\r
-      /* Section F.2.2.2: decode the AC coefficients */\r
-      /* Since zeroes are skipped, output area must be cleared beforehand */\r
-      for (k = 1; k < DCTSIZE2; k++) {\r
-       HUFF_DECODE(s, br_state, actbl, return FALSE, label2);\r
-      \r
-       r = s >> 4;\r
-       s &= 15;\r
-      \r
-       if (s) {\r
-         k += r;\r
-         CHECK_BIT_BUFFER(br_state, s, return FALSE);\r
-         r = GET_BITS(s);\r
-         s = HUFF_EXTEND(r, s);\r
-         /* Output coefficient in natural (dezigzagged) order.\r
-          * Note: the extra entries in jpeg_natural_order[] will save us\r
-          * if k >= DCTSIZE2, which could happen if the data is corrupted.\r
-          */\r
-         (*block)[jpeg_natural_order[k]] = (JCOEF) s;\r
-       } else {\r
-         if (r != 15)\r
-           break;\r
-         k += 15;\r
-       }\r
-      }\r
-\r
-    } else {\r
-skip_ACs:\r
-\r
-      /* Section F.2.2.2: decode the AC coefficients */\r
-      /* In this path we just discard the values */\r
-      for (k = 1; k < DCTSIZE2; k++) {\r
-       HUFF_DECODE(s, br_state, actbl, return FALSE, label3);\r
-      \r
-       r = s >> 4;\r
-       s &= 15;\r
-      \r
-       if (s) {\r
-         k += r;\r
-         CHECK_BIT_BUFFER(br_state, s, return FALSE);\r
-         DROP_BITS(s);\r
-       } else {\r
-         if (r != 15)\r
-           break;\r
-         k += 15;\r
-       }\r
-      }\r
-\r
-    }\r
-  }\r
-\r
-  /* Completed MCU, so update state */\r
-  BITREAD_SAVE_STATE(cinfo,entropy->bitstate);\r
-  ASSIGN_STATE(entropy->saved, state);\r
-\r
-  /* Account for restart interval (no-op if not using restarts) */\r
-  entropy->restarts_to_go--;\r
-\r
-  return TRUE;\r
-}\r
-\r
-\r
-/*\r
- * Module initialization routine for Huffman entropy decoding.\r
- */\r
-\r
-GLOBAL void\r
-jinit_huff_decoder (j_decompress_ptr cinfo)\r
-{\r
-  huff_entropy_ptr entropy;\r
-  int i;\r
-\r
-  entropy = (huff_entropy_ptr)\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-                               SIZEOF(huff_entropy_decoder));\r
-  cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;\r
-  entropy->pub.start_pass = start_pass_huff_decoder;\r
-  entropy->pub.decode_mcu = decode_mcu;\r
-\r
-  /* Mark tables unallocated */\r
-  for (i = 0; i < NUM_HUFF_TBLS; i++) {\r
-    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;\r
-  }\r
-}\r
diff --git a/libs/jpeg6/jdhuff.h b/libs/jpeg6/jdhuff.h
deleted file mode 100644 (file)
index 65f3054..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/*\r
- * jdhuff.h\r
- *\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
- * This file is part of the Independent JPEG Group's software.\r
- * For conditions of distribution and use, see the accompanying README file.\r
- *\r
- * This file contains declarations for Huffman entropy decoding routines\r
- * that are shared between the sequential decoder (jdhuff.c) and the\r
- * progressive decoder (jdphuff.c).  No other modules need to see these.\r
- */\r
-\r
-/* Short forms of external names for systems with brain-damaged linkers. */\r
-\r
-#ifdef NEED_SHORT_EXTERNAL_NAMES\r
-#define jpeg_make_d_derived_tbl        jMkDDerived\r
-#define jpeg_fill_bit_buffer   jFilBitBuf\r
-#define jpeg_huff_decode       jHufDecode\r
-#endif /* NEED_SHORT_EXTERNAL_NAMES */\r
-\r
-\r
-/* Derived data constructed for each Huffman table */\r
-\r
-#define HUFF_LOOKAHEAD 8       /* # of bits of lookahead */\r
-\r
-typedef struct {\r
-  /* Basic tables: (element [0] of each array is unused) */\r
-  INT32 mincode[17];           /* smallest code of length k */\r
-  INT32 maxcode[18];           /* largest code of length k (-1 if none) */\r
-  /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */\r
-  int valptr[17];              /* huffval[] index of 1st symbol of length k */\r
-\r
-  /* Link to public Huffman table (needed only in jpeg_huff_decode) */\r
-  JHUFF_TBL *pub;\r
-\r
-  /* Lookahead tables: indexed by the next HUFF_LOOKAHEAD bits of\r
-   * the input data stream.  If the next Huffman code is no more\r
-   * than HUFF_LOOKAHEAD bits long, we can obtain its length and\r
-   * the corresponding symbol directly from these tables.\r
-   */\r
-  int look_nbits[1<<HUFF_LOOKAHEAD]; /* # bits, or 0 if too long */\r
-  UINT8 look_sym[1<<HUFF_LOOKAHEAD]; /* symbol, or unused */\r
-} d_derived_tbl;\r
-\r
-/* Expand a Huffman table definition into the derived format */\r
-EXTERN void jpeg_make_d_derived_tbl JPP((j_decompress_ptr cinfo,\r
-                               JHUFF_TBL * htbl, d_derived_tbl ** pdtbl));\r
-\r
-\r
-/*\r
- * Fetching the next N bits from the input stream is a time-critical operation\r
- * for the Huffman decoders.  We implement it with a combination of inline\r
- * macros and out-of-line subroutines.  Note that N (the number of bits\r
- * demanded at one time) never exceeds 15 for JPEG use.\r
- *\r
- * We read source bytes into get_buffer and dole out bits as needed.\r
- * If get_buffer already contains enough bits, they are fetched in-line\r
- * by the macros CHECK_BIT_BUFFER and GET_BITS.  When there aren't enough\r
- * bits, jpeg_fill_bit_buffer is called; it will attempt to fill get_buffer\r
- * as full as possible (not just to the number of bits needed; this\r
- * prefetching reduces the overhead cost of calling jpeg_fill_bit_buffer).\r
- * Note that jpeg_fill_bit_buffer may return FALSE to indicate suspension.\r
- * On TRUE return, jpeg_fill_bit_buffer guarantees that get_buffer contains\r
- * at least the requested number of bits --- dummy zeroes are inserted if\r
- * necessary.\r
- */\r
-\r
-typedef INT32 bit_buf_type;    /* type of bit-extraction buffer */\r
-#define BIT_BUF_SIZE  32       /* size of buffer in bits */\r
-\r
-/* If long is > 32 bits on your machine, and shifting/masking longs is\r
- * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE\r
- * appropriately should be a win.  Unfortunately we can't do this with\r
- * something like  #define BIT_BUF_SIZE (sizeof(bit_buf_type)*8)\r
- * because not all machines measure sizeof in 8-bit bytes.\r
- */\r
-\r
-typedef struct {               /* Bitreading state saved across MCUs */\r
-  bit_buf_type get_buffer;     /* current bit-extraction buffer */\r
-  int bits_left;               /* # of unused bits in it */\r
-  boolean printed_eod;         /* flag to suppress multiple warning msgs */\r
-} bitread_perm_state;\r
-\r
-typedef struct {               /* Bitreading working state within an MCU */\r
-  /* current data source state */\r
-  const JOCTET * next_input_byte; /* => next byte to read from source */\r
-  size_t bytes_in_buffer;      /* # of bytes remaining in source buffer */\r
-  int unread_marker;           /* nonzero if we have hit a marker */\r
-  /* bit input buffer --- note these values are kept in register variables,\r
-   * not in this struct, inside the inner loops.\r
-   */\r
-  bit_buf_type get_buffer;     /* current bit-extraction buffer */\r
-  int bits_left;               /* # of unused bits in it */\r
-  /* pointers needed by jpeg_fill_bit_buffer */\r
-  j_decompress_ptr cinfo;      /* back link to decompress master record */\r
-  boolean * printed_eod_ptr;   /* => flag in permanent state */\r
-} bitread_working_state;\r
-\r
-/* Macros to declare and load/save bitread local variables. */\r
-#define BITREAD_STATE_VARS  \\r
-       register bit_buf_type get_buffer;  \\r
-       register int bits_left;  \\r
-       bitread_working_state br_state\r
-\r
-#define BITREAD_LOAD_STATE(cinfop,permstate)  \\r
-       br_state.cinfo = cinfop; \\r
-       br_state.next_input_byte = cinfop->src->next_input_byte; \\r
-       br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \\r
-       br_state.unread_marker = cinfop->unread_marker; \\r
-       get_buffer = permstate.get_buffer; \\r
-       bits_left = permstate.bits_left; \\r
-       br_state.printed_eod_ptr = & permstate.printed_eod\r
-\r
-#define BITREAD_SAVE_STATE(cinfop,permstate)  \\r
-       cinfop->src->next_input_byte = br_state.next_input_byte; \\r
-       cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \\r
-       cinfop->unread_marker = br_state.unread_marker; \\r
-       permstate.get_buffer = get_buffer; \\r
-       permstate.bits_left = bits_left\r
-\r
-/*\r
- * These macros provide the in-line portion of bit fetching.\r
- * Use CHECK_BIT_BUFFER to ensure there are N bits in get_buffer\r
- * before using GET_BITS, PEEK_BITS, or DROP_BITS.\r
- * The variables get_buffer and bits_left are assumed to be locals,\r
- * but the state struct might not be (jpeg_huff_decode needs this).\r
- *     CHECK_BIT_BUFFER(state,n,action);\r
- *             Ensure there are N bits in get_buffer; if suspend, take action.\r
- *      val = GET_BITS(n);\r
- *             Fetch next N bits.\r
- *      val = PEEK_BITS(n);\r
- *             Fetch next N bits without removing them from the buffer.\r
- *     DROP_BITS(n);\r
- *             Discard next N bits.\r
- * The value N should be a simple variable, not an expression, because it\r
- * is evaluated multiple times.\r
- */\r
-\r
-#define CHECK_BIT_BUFFER(state,nbits,action) \\r
-       { if (bits_left < (nbits)) {  \\r
-           if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits))  \\r
-             { action; }  \\r
-           get_buffer = (state).get_buffer; bits_left = (state).bits_left; } }\r
-\r
-#define GET_BITS(nbits) \\r
-       (((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1))\r
-\r
-#define PEEK_BITS(nbits) \\r
-       (((int) (get_buffer >> (bits_left -  (nbits)))) & ((1<<(nbits))-1))\r
-\r
-#define DROP_BITS(nbits) \\r
-       (bits_left -= (nbits))\r
-\r
-/* Load up the bit buffer to a depth of at least nbits */\r
-EXTERN boolean jpeg_fill_bit_buffer JPP((bitread_working_state * state,\r
-               register bit_buf_type get_buffer, register int bits_left,\r
-               int nbits));\r
-\r
-\r
-/*\r
- * Code for extracting next Huffman-coded symbol from input bit stream.\r
- * Again, this is time-critical and we make the main paths be macros.\r
- *\r
- * We use a lookahead table to process codes of up to HUFF_LOOKAHEAD bits\r
- * without looping.  Usually, more than 95% of the Huffman codes will be 8\r
- * or fewer bits long.  The few overlength codes are handled with a loop,\r
- * which need not be inline code.\r
- *\r
- * Notes about the HUFF_DECODE macro:\r
- * 1. Near the end of the data segment, we may fail to get enough bits\r
- *    for a lookahead.  In that case, we do it the hard way.\r
- * 2. If the lookahead table contains no entry, the next code must be\r
- *    more than HUFF_LOOKAHEAD bits long.\r
- * 3. jpeg_huff_decode returns -1 if forced to suspend.\r
- */\r
-\r
-#define HUFF_DECODE(result,state,htbl,failaction,slowlabel) \\r
-{ register int nb, look; \\r
-  if (bits_left < HUFF_LOOKAHEAD) { \\r
-    if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \\r
-    get_buffer = state.get_buffer; bits_left = state.bits_left; \\r
-    if (bits_left < HUFF_LOOKAHEAD) { \\r
-      nb = 1; goto slowlabel; \\r
-    } \\r
-  } \\r
-  look = PEEK_BITS(HUFF_LOOKAHEAD); \\r
-  if ((nb = htbl->look_nbits[look]) != 0) { \\r
-    DROP_BITS(nb); \\r
-    result = htbl->look_sym[look]; \\r
-  } else { \\r
-    nb = HUFF_LOOKAHEAD+1; \\r
-slowlabel: \\r
-    if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \\r
-       { failaction; } \\r
-    get_buffer = state.get_buffer; bits_left = state.bits_left; \\r
-  } \\r
-}\r
-\r
-/* Out-of-line case for Huffman code fetching */\r
-EXTERN int jpeg_huff_decode JPP((bitread_working_state * state,\r
-               register bit_buf_type get_buffer, register int bits_left,\r
-               d_derived_tbl * htbl, int min_bits));\r
diff --git a/libs/jpeg6/jdinput.cpp b/libs/jpeg6/jdinput.cpp
deleted file mode 100644 (file)
index 4def216..0000000
+++ /dev/null
@@ -1,762 +0,0 @@
-/*\r
-\r
- * jdinput.c\r
-\r
- *\r
-\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains input control logic for the JPEG decompressor.\r
-\r
- * These routines are concerned with controlling the decompressor's input\r
-\r
- * processing (marker reading and coefficient decoding).  The actual input\r
-\r
- * reading is done in jdmarker.c, jdhuff.c, and jdphuff.c.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-\r
-\r
-/* Private state */\r
-\r
-\r
-\r
-typedef struct {\r
-\r
-  struct jpeg_input_controller pub; /* public fields */\r
-\r
-\r
-\r
-  boolean inheaders;           /* TRUE until first SOS is reached */\r
-\r
-} my_input_controller;\r
-\r
-\r
-\r
-typedef my_input_controller * my_inputctl_ptr;\r
-\r
-\r
-\r
-\r
-\r
-/* Forward declarations */\r
-\r
-METHODDEF int consume_markers JPP((j_decompress_ptr cinfo));\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Routines to calculate various quantities related to the size of the image.\r
-\r
- */\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-initial_setup (j_decompress_ptr cinfo)\r
-\r
-/* Called once, when first SOS marker is reached */\r
-\r
-{\r
-\r
-  int ci;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-\r
-\r
-  /* Make sure image isn't bigger than I can handle */\r
-\r
-  if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||\r
-\r
-      (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)\r
-\r
-    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);\r
-\r
-\r
-\r
-  /* For now, precision must match compiled-in value... */\r
-\r
-  if (cinfo->data_precision != BITS_IN_JSAMPLE)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);\r
-\r
-\r
-\r
-  /* Check that number of components won't exceed internal array sizes */\r
-\r
-  if (cinfo->num_components > MAX_COMPONENTS)\r
-\r
-    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,\r
-\r
-            MAX_COMPONENTS);\r
-\r
-\r
-\r
-  /* Compute maximum sampling factors; check factor validity */\r
-\r
-  cinfo->max_h_samp_factor = 1;\r
-\r
-  cinfo->max_v_samp_factor = 1;\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||\r
-\r
-       compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)\r
-\r
-      ERREXIT(cinfo, JERR_BAD_SAMPLING);\r
-\r
-    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,\r
-\r
-                                  compptr->h_samp_factor);\r
-\r
-    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,\r
-\r
-                                  compptr->v_samp_factor);\r
-\r
-  }\r
-\r
-\r
-\r
-  /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.\r
-\r
-   * In the full decompressor, this will be overridden by jdmaster.c;\r
-\r
-   * but in the transcoder, jdmaster.c is not used, so we must do it here.\r
-\r
-   */\r
-\r
-  cinfo->min_DCT_scaled_size = DCTSIZE;\r
-\r
-\r
-\r
-  /* Compute dimensions of components */\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    compptr->DCT_scaled_size = DCTSIZE;\r
-\r
-    /* Size in DCT blocks */\r
-\r
-    compptr->width_in_blocks = (JDIMENSION)\r
-\r
-      jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,\r
-\r
-                   (long) (cinfo->max_h_samp_factor * DCTSIZE));\r
-\r
-    compptr->height_in_blocks = (JDIMENSION)\r
-\r
-      jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,\r
-\r
-                   (long) (cinfo->max_v_samp_factor * DCTSIZE));\r
-\r
-    /* downsampled_width and downsampled_height will also be overridden by\r
-\r
-     * jdmaster.c if we are doing full decompression.  The transcoder library\r
-\r
-     * doesn't use these values, but the calling application might.\r
-\r
-     */\r
-\r
-    /* Size in samples */\r
-\r
-    compptr->downsampled_width = (JDIMENSION)\r
-\r
-      jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,\r
-\r
-                   (long) cinfo->max_h_samp_factor);\r
-\r
-    compptr->downsampled_height = (JDIMENSION)\r
-\r
-      jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,\r
-\r
-                   (long) cinfo->max_v_samp_factor);\r
-\r
-    /* Mark component needed, until color conversion says otherwise */\r
-\r
-    compptr->component_needed = TRUE;\r
-\r
-    /* Mark no quantization table yet saved for component */\r
-\r
-    compptr->quant_table = NULL;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Compute number of fully interleaved MCU rows. */\r
-\r
-  cinfo->total_iMCU_rows = (JDIMENSION)\r
-\r
-    jdiv_round_up((long) cinfo->image_height,\r
-\r
-                 (long) (cinfo->max_v_samp_factor*DCTSIZE));\r
-\r
-\r
-\r
-  /* Decide whether file contains multiple scans */\r
-\r
-  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)\r
-\r
-    cinfo->inputctl->has_multiple_scans = TRUE;\r
-\r
-  else\r
-\r
-    cinfo->inputctl->has_multiple_scans = FALSE;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-per_scan_setup (j_decompress_ptr cinfo)\r
-\r
-/* Do computations that are needed before processing a JPEG scan */\r
-\r
-/* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */\r
-\r
-{\r
-\r
-  int ci, mcublks, tmp;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-  \r
-\r
-  if (cinfo->comps_in_scan == 1) {\r
-\r
-    \r
-\r
-    /* Noninterleaved (single-component) scan */\r
-\r
-    compptr = cinfo->cur_comp_info[0];\r
-\r
-    \r
-\r
-    /* Overall image size in MCUs */\r
-\r
-    cinfo->MCUs_per_row = compptr->width_in_blocks;\r
-\r
-    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;\r
-\r
-    \r
-\r
-    /* For noninterleaved scan, always one block per MCU */\r
-\r
-    compptr->MCU_width = 1;\r
-\r
-    compptr->MCU_height = 1;\r
-\r
-    compptr->MCU_blocks = 1;\r
-\r
-    compptr->MCU_sample_width = compptr->DCT_scaled_size;\r
-\r
-    compptr->last_col_width = 1;\r
-\r
-    /* For noninterleaved scans, it is convenient to define last_row_height\r
-\r
-     * as the number of block rows present in the last iMCU row.\r
-\r
-     */\r
-\r
-    tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);\r
-\r
-    if (tmp == 0) tmp = compptr->v_samp_factor;\r
-\r
-    compptr->last_row_height = tmp;\r
-\r
-    \r
-\r
-    /* Prepare array describing MCU composition */\r
-\r
-    cinfo->blocks_in_MCU = 1;\r
-\r
-    cinfo->MCU_membership[0] = 0;\r
-\r
-    \r
-\r
-  } else {\r
-\r
-    \r
-\r
-    /* Interleaved (multi-component) scan */\r
-\r
-    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)\r
-\r
-      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,\r
-\r
-              MAX_COMPS_IN_SCAN);\r
-\r
-    \r
-\r
-    /* Overall image size in MCUs */\r
-\r
-    cinfo->MCUs_per_row = (JDIMENSION)\r
-\r
-      jdiv_round_up((long) cinfo->image_width,\r
-\r
-                   (long) (cinfo->max_h_samp_factor*DCTSIZE));\r
-\r
-    cinfo->MCU_rows_in_scan = (JDIMENSION)\r
-\r
-      jdiv_round_up((long) cinfo->image_height,\r
-\r
-                   (long) (cinfo->max_v_samp_factor*DCTSIZE));\r
-\r
-    \r
-\r
-    cinfo->blocks_in_MCU = 0;\r
-\r
-    \r
-\r
-    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {\r
-\r
-      compptr = cinfo->cur_comp_info[ci];\r
-\r
-      /* Sampling factors give # of blocks of component in each MCU */\r
-\r
-      compptr->MCU_width = compptr->h_samp_factor;\r
-\r
-      compptr->MCU_height = compptr->v_samp_factor;\r
-\r
-      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;\r
-\r
-      compptr->MCU_sample_width = compptr->MCU_width * compptr->DCT_scaled_size;\r
-\r
-      /* Figure number of non-dummy blocks in last MCU column & row */\r
-\r
-      tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);\r
-\r
-      if (tmp == 0) tmp = compptr->MCU_width;\r
-\r
-      compptr->last_col_width = tmp;\r
-\r
-      tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);\r
-\r
-      if (tmp == 0) tmp = compptr->MCU_height;\r
-\r
-      compptr->last_row_height = tmp;\r
-\r
-      /* Prepare array describing MCU composition */\r
-\r
-      mcublks = compptr->MCU_blocks;\r
-\r
-      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)\r
-\r
-       ERREXIT(cinfo, JERR_BAD_MCU_SIZE);\r
-\r
-      while (mcublks-- > 0) {\r
-\r
-       cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;\r
-\r
-      }\r
-\r
-    }\r
-\r
-    \r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Save away a copy of the Q-table referenced by each component present\r
-\r
- * in the current scan, unless already saved during a prior scan.\r
-\r
- *\r
-\r
- * In a multiple-scan JPEG file, the encoder could assign different components\r
-\r
- * the same Q-table slot number, but change table definitions between scans\r
-\r
- * so that each component uses a different Q-table.  (The IJG encoder is not\r
-\r
- * currently capable of doing this, but other encoders might.)  Since we want\r
-\r
- * to be able to dequantize all the components at the end of the file, this\r
-\r
- * means that we have to save away the table actually used for each component.\r
-\r
- * We do this by copying the table at the start of the first scan containing\r
-\r
- * the component.\r
-\r
- * The JPEG spec prohibits the encoder from changing the contents of a Q-table\r
-\r
- * slot between scans of a component using that slot.  If the encoder does so\r
-\r
- * anyway, this decoder will simply use the Q-table values that were current\r
-\r
- * at the start of the first scan for the component.\r
-\r
- *\r
-\r
- * The decompressor output side looks only at the saved quant tables,\r
-\r
- * not at the current Q-table slots.\r
-\r
- */\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-latch_quant_tables (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  int ci, qtblno;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-  JQUANT_TBL * qtbl;\r
-\r
-\r
-\r
-  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {\r
-\r
-    compptr = cinfo->cur_comp_info[ci];\r
-\r
-    /* No work if we already saved Q-table for this component */\r
-\r
-    if (compptr->quant_table != NULL)\r
-\r
-      continue;\r
-\r
-    /* Make sure specified quantization table is present */\r
-\r
-    qtblno = compptr->quant_tbl_no;\r
-\r
-    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||\r
-\r
-       cinfo->quant_tbl_ptrs[qtblno] == NULL)\r
-\r
-      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);\r
-\r
-    /* OK, save away the quantization table */\r
-\r
-    qtbl = (JQUANT_TBL *)\r
-\r
-      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                                 SIZEOF(JQUANT_TBL));\r
-\r
-    MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL));\r
-\r
-    compptr->quant_table = qtbl;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize the input modules to read a scan of compressed data.\r
-\r
- * The first call to this is done by jdmaster.c after initializing\r
-\r
- * the entire decompressor (during jpeg_start_decompress).\r
-\r
- * Subsequent calls come from consume_markers, below.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-start_input_pass (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  per_scan_setup(cinfo);\r
-\r
-  latch_quant_tables(cinfo);\r
-\r
-  (*cinfo->entropy->start_pass) (cinfo);\r
-\r
-  (*cinfo->coef->start_input_pass) (cinfo);\r
-\r
-  cinfo->inputctl->consume_input = cinfo->coef->consume_data;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Finish up after inputting a compressed-data scan.\r
-\r
- * This is called by the coefficient controller after it's read all\r
-\r
- * the expected data of the scan.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-finish_input_pass (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  cinfo->inputctl->consume_input = consume_markers;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Read JPEG markers before, between, or after compressed-data scans.\r
-\r
- * Change state as necessary when a new scan is reached.\r
-\r
- * Return value is JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.\r
-\r
- *\r
-\r
- * The consume_input method pointer points either here or to the\r
-\r
- * coefficient controller's consume_data routine, depending on whether\r
-\r
- * we are reading a compressed data segment or inter-segment markers.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF int\r
-\r
-consume_markers (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;\r
-\r
-  int val;\r
-\r
-\r
-\r
-  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */\r
-\r
-    return JPEG_REACHED_EOI;\r
-\r
-\r
-\r
-  val = (*cinfo->marker->read_markers) (cinfo);\r
-\r
-\r
-\r
-  switch (val) {\r
-\r
-  case JPEG_REACHED_SOS:       /* Found SOS */\r
-\r
-    if (inputctl->inheaders) { /* 1st SOS */\r
-\r
-      initial_setup(cinfo);\r
-\r
-      inputctl->inheaders = FALSE;\r
-\r
-      /* Note: start_input_pass must be called by jdmaster.c\r
-\r
-       * before any more input can be consumed.  jdapi.c is\r
-\r
-       * responsible for enforcing this sequencing.\r
-\r
-       */\r
-\r
-    } else {                   /* 2nd or later SOS marker */\r
-\r
-      if (! inputctl->pub.has_multiple_scans)\r
-\r
-       ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */\r
-\r
-      start_input_pass(cinfo);\r
-\r
-    }\r
-\r
-    break;\r
-\r
-  case JPEG_REACHED_EOI:       /* Found EOI */\r
-\r
-    inputctl->pub.eoi_reached = TRUE;\r
-\r
-    if (inputctl->inheaders) { /* Tables-only datastream, apparently */\r
-\r
-      if (cinfo->marker->saw_SOF)\r
-\r
-       ERREXIT(cinfo, JERR_SOF_NO_SOS);\r
-\r
-    } else {\r
-\r
-      /* Prevent infinite loop in coef ctlr's decompress_data routine\r
-\r
-       * if user set output_scan_number larger than number of scans.\r
-\r
-       */\r
-\r
-      if (cinfo->output_scan_number > cinfo->input_scan_number)\r
-\r
-       cinfo->output_scan_number = cinfo->input_scan_number;\r
-\r
-    }\r
-\r
-    break;\r
-\r
-  case JPEG_SUSPENDED:\r
-\r
-    break;\r
-\r
-  }\r
-\r
-\r
-\r
-  return val;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Reset state to begin a fresh datastream.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-reset_input_controller (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;\r
-\r
-\r
-\r
-  inputctl->pub.consume_input = consume_markers;\r
-\r
-  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */\r
-\r
-  inputctl->pub.eoi_reached = FALSE;\r
-\r
-  inputctl->inheaders = TRUE;\r
-\r
-  /* Reset other modules */\r
-\r
-  (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);\r
-\r
-  (*cinfo->marker->reset_marker_reader) (cinfo);\r
-\r
-  /* Reset progression state -- would be cleaner if entropy decoder did this */\r
-\r
-  cinfo->coef_bits = NULL;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize the input controller module.\r
-\r
- * This is called only once, when the decompression object is created.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jinit_input_controller (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  my_inputctl_ptr inputctl;\r
-\r
-\r
-\r
-  /* Create subobject in permanent pool */\r
-\r
-  inputctl = (my_inputctl_ptr)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,\r
-\r
-                               SIZEOF(my_input_controller));\r
-\r
-  cinfo->inputctl = (struct jpeg_input_controller *) inputctl;\r
-\r
-  /* Initialize method pointers */\r
-\r
-  inputctl->pub.consume_input = consume_markers;\r
-\r
-  inputctl->pub.reset_input_controller = reset_input_controller;\r
-\r
-  inputctl->pub.start_input_pass = start_input_pass;\r
-\r
-  inputctl->pub.finish_input_pass = finish_input_pass;\r
-\r
-  /* Initialize state: can't use reset_input_controller since we don't\r
-\r
-   * want to try to reset other modules yet.\r
-\r
-   */\r
-\r
-  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */\r
-\r
-  inputctl->pub.eoi_reached = FALSE;\r
-\r
-  inputctl->inheaders = TRUE;\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jdmainct.cpp b/libs/jpeg6/jdmainct.cpp
deleted file mode 100644 (file)
index 7b4c255..0000000
+++ /dev/null
@@ -1,1024 +0,0 @@
-/*\r
-\r
- * jdmainct.c\r
-\r
- *\r
-\r
- * Copyright (C) 1994-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains the main buffer controller for decompression.\r
-\r
- * The main buffer lies between the JPEG decompressor proper and the\r
-\r
- * post-processor; it holds downsampled data in the JPEG colorspace.\r
-\r
- *\r
-\r
- * Note that this code is bypassed in raw-data mode, since the application\r
-\r
- * supplies the equivalent of the main buffer in that case.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * In the current system design, the main buffer need never be a full-image\r
-\r
- * buffer; any full-height buffers will be found inside the coefficient or\r
-\r
- * postprocessing controllers.  Nonetheless, the main controller is not\r
-\r
- * trivial.  Its responsibility is to provide context rows for upsampling/\r
-\r
- * rescaling, and doing this in an efficient fashion is a bit tricky.\r
-\r
- *\r
-\r
- * Postprocessor input data is counted in "row groups".  A row group\r
-\r
- * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size)\r
-\r
- * sample rows of each component.  (We require DCT_scaled_size values to be\r
-\r
- * chosen such that these numbers are integers.  In practice DCT_scaled_size\r
-\r
- * values will likely be powers of two, so we actually have the stronger\r
-\r
- * condition that DCT_scaled_size / min_DCT_scaled_size is an integer.)\r
-\r
- * Upsampling will typically produce max_v_samp_factor pixel rows from each\r
-\r
- * row group (times any additional scale factor that the upsampler is\r
-\r
- * applying).\r
-\r
- *\r
-\r
- * The coefficient controller will deliver data to us one iMCU row at a time;\r
-\r
- * each iMCU row contains v_samp_factor * DCT_scaled_size sample rows, or\r
-\r
- * exactly min_DCT_scaled_size row groups.  (This amount of data corresponds\r
-\r
- * to one row of MCUs when the image is fully interleaved.)  Note that the\r
-\r
- * number of sample rows varies across components, but the number of row\r
-\r
- * groups does not.  Some garbage sample rows may be included in the last iMCU\r
-\r
- * row at the bottom of the image.\r
-\r
- *\r
-\r
- * Depending on the vertical scaling algorithm used, the upsampler may need\r
-\r
- * access to the sample row(s) above and below its current input row group.\r
-\r
- * The upsampler is required to set need_context_rows TRUE at global selection\r
-\r
- * time if so.  When need_context_rows is FALSE, this controller can simply\r
-\r
- * obtain one iMCU row at a time from the coefficient controller and dole it\r
-\r
- * out as row groups to the postprocessor.\r
-\r
- *\r
-\r
- * When need_context_rows is TRUE, this controller guarantees that the buffer\r
-\r
- * passed to postprocessing contains at least one row group's worth of samples\r
-\r
- * above and below the row group(s) being processed.  Note that the context\r
-\r
- * rows "above" the first passed row group appear at negative row offsets in\r
-\r
- * the passed buffer.  At the top and bottom of the image, the required\r
-\r
- * context rows are manufactured by duplicating the first or last real sample\r
-\r
- * row; this avoids having special cases in the upsampling inner loops.\r
-\r
- *\r
-\r
- * The amount of context is fixed at one row group just because that's a\r
-\r
- * convenient number for this controller to work with.  The existing\r
-\r
- * upsamplers really only need one sample row of context.  An upsampler\r
-\r
- * supporting arbitrary output rescaling might wish for more than one row\r
-\r
- * group of context when shrinking the image; tough, we don't handle that.\r
-\r
- * (This is justified by the assumption that downsizing will be handled mostly\r
-\r
- * by adjusting the DCT_scaled_size values, so that the actual scale factor at\r
-\r
- * the upsample step needn't be much less than one.)\r
-\r
- *\r
-\r
- * To provide the desired context, we have to retain the last two row groups\r
-\r
- * of one iMCU row while reading in the next iMCU row.  (The last row group\r
-\r
- * can't be processed until we have another row group for its below-context,\r
-\r
- * and so we have to save the next-to-last group too for its above-context.)\r
-\r
- * We could do this most simply by copying data around in our buffer, but\r
-\r
- * that'd be very slow.  We can avoid copying any data by creating a rather\r
-\r
- * strange pointer structure.  Here's how it works.  We allocate a workspace\r
-\r
- * consisting of M+2 row groups (where M = min_DCT_scaled_size is the number\r
-\r
- * of row groups per iMCU row).  We create two sets of redundant pointers to\r
-\r
- * the workspace.  Labeling the physical row groups 0 to M+1, the synthesized\r
-\r
- * pointer lists look like this:\r
-\r
- *                   M+1                          M-1\r
-\r
- * master pointer --> 0         master pointer --> 0\r
-\r
- *                    1                            1\r
-\r
- *                   ...                          ...\r
-\r
- *                   M-3                          M-3\r
-\r
- *                   M-2                           M\r
-\r
- *                   M-1                          M+1\r
-\r
- *                    M                           M-2\r
-\r
- *                   M+1                          M-1\r
-\r
- *                    0                            0\r
-\r
- * We read alternate iMCU rows using each master pointer; thus the last two\r
-\r
- * row groups of the previous iMCU row remain un-overwritten in the workspace.\r
-\r
- * The pointer lists are set up so that the required context rows appear to\r
-\r
- * be adjacent to the proper places when we pass the pointer lists to the\r
-\r
- * upsampler.\r
-\r
- *\r
-\r
- * The above pictures describe the normal state of the pointer lists.\r
-\r
- * At top and bottom of the image, we diddle the pointer lists to duplicate\r
-\r
- * the first or last sample row as necessary (this is cheaper than copying\r
-\r
- * sample rows around).\r
-\r
- *\r
-\r
- * This scheme breaks down if M < 2, ie, min_DCT_scaled_size is 1.  In that\r
-\r
- * situation each iMCU row provides only one row group so the buffering logic\r
-\r
- * must be different (eg, we must read two iMCU rows before we can emit the\r
-\r
- * first row group).  For now, we simply do not support providing context\r
-\r
- * rows when min_DCT_scaled_size is 1.  That combination seems unlikely to\r
-\r
- * be worth providing --- if someone wants a 1/8th-size preview, they probably\r
-\r
- * want it quick and dirty, so a context-free upsampler is sufficient.\r
-\r
- */\r
-\r
-\r
-\r
-\r
-\r
-/* Private buffer controller object */\r
-\r
-\r
-\r
-typedef struct {\r
-\r
-  struct jpeg_d_main_controller pub; /* public fields */\r
-\r
-\r
-\r
-  /* Pointer to allocated workspace (M or M+2 row groups). */\r
-\r
-  JSAMPARRAY buffer[MAX_COMPONENTS];\r
-\r
-\r
-\r
-  boolean buffer_full;         /* Have we gotten an iMCU row from decoder? */\r
-\r
-  JDIMENSION rowgroup_ctr;     /* counts row groups output to postprocessor */\r
-\r
-\r
-\r
-  /* Remaining fields are only used in the context case. */\r
-\r
-\r
-\r
-  /* These are the master pointers to the funny-order pointer lists. */\r
-\r
-  JSAMPIMAGE xbuffer[2];       /* pointers to weird pointer lists */\r
-\r
-\r
-\r
-  int whichptr;                        /* indicates which pointer set is now in use */\r
-\r
-  int context_state;           /* process_data state machine status */\r
-\r
-  JDIMENSION rowgroups_avail;  /* row groups available to postprocessor */\r
-\r
-  JDIMENSION iMCU_row_ctr;     /* counts iMCU rows to detect image top/bot */\r
-\r
-} my_main_controller;\r
-\r
-\r
-\r
-typedef my_main_controller * my_main_ptr;\r
-\r
-\r
-\r
-/* context_state values: */\r
-\r
-#define CTX_PREPARE_FOR_IMCU   0       /* need to prepare for MCU row */\r
-\r
-#define CTX_PROCESS_IMCU       1       /* feeding iMCU to postprocessor */\r
-\r
-#define CTX_POSTPONED_ROW      2       /* feeding postponed row group */\r
-\r
-\r
-\r
-\r
-\r
-/* Forward declarations */\r
-\r
-METHODDEF void process_data_simple_main\r
-\r
-       JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf,\r
-\r
-            JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail));\r
-\r
-METHODDEF void process_data_context_main\r
-\r
-       JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf,\r
-\r
-            JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail));\r
-\r
-#ifdef QUANT_2PASS_SUPPORTED\r
-\r
-METHODDEF void process_data_crank_post\r
-\r
-       JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf,\r
-\r
-            JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail));\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-alloc_funny_pointers (j_decompress_ptr cinfo)\r
-\r
-/* Allocate space for the funny pointer lists.\r
-\r
- * This is done only once, not once per pass.\r
-\r
- */\r
-\r
-{\r
-\r
-  my_main_ptr main = (my_main_ptr) cinfo->main;\r
-\r
-  int ci, rgroup;\r
-\r
-  int M = cinfo->min_DCT_scaled_size;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-  JSAMPARRAY xbuf;\r
-\r
-\r
-\r
-  /* Get top-level space for component array pointers.\r
-\r
-   * We alloc both arrays with one call to save a few cycles.\r
-\r
-   */\r
-\r
-  main->xbuffer[0] = (JSAMPIMAGE)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                               cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));\r
-\r
-  main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components;\r
-\r
-\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /\r
-\r
-      cinfo->min_DCT_scaled_size; /* height of a row group of component */\r
-\r
-    /* Get space for pointer lists --- M+4 row groups in each list.\r
-\r
-     * We alloc both pointer lists with one call to save a few cycles.\r
-\r
-     */\r
-\r
-    xbuf = (JSAMPARRAY)\r
-\r
-      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                                 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));\r
-\r
-    xbuf += rgroup;            /* want one row group at negative offsets */\r
-\r
-    main->xbuffer[0][ci] = xbuf;\r
-\r
-    xbuf += rgroup * (M + 4);\r
-\r
-    main->xbuffer[1][ci] = xbuf;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-make_funny_pointers (j_decompress_ptr cinfo)\r
-\r
-/* Create the funny pointer lists discussed in the comments above.\r
-\r
- * The actual workspace is already allocated (in main->buffer),\r
-\r
- * and the space for the pointer lists is allocated too.\r
-\r
- * This routine just fills in the curiously ordered lists.\r
-\r
- * This will be repeated at the beginning of each pass.\r
-\r
- */\r
-\r
-{\r
-\r
-  my_main_ptr main = (my_main_ptr) cinfo->main;\r
-\r
-  int ci, i, rgroup;\r
-\r
-  int M = cinfo->min_DCT_scaled_size;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-  JSAMPARRAY buf, xbuf0, xbuf1;\r
-\r
-\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /\r
-\r
-      cinfo->min_DCT_scaled_size; /* height of a row group of component */\r
-\r
-    xbuf0 = main->xbuffer[0][ci];\r
-\r
-    xbuf1 = main->xbuffer[1][ci];\r
-\r
-    /* First copy the workspace pointers as-is */\r
-\r
-    buf = main->buffer[ci];\r
-\r
-    for (i = 0; i < rgroup * (M + 2); i++) {\r
-\r
-      xbuf0[i] = xbuf1[i] = buf[i];\r
-\r
-    }\r
-\r
-    /* In the second list, put the last four row groups in swapped order */\r
-\r
-    for (i = 0; i < rgroup * 2; i++) {\r
-\r
-      xbuf1[rgroup*(M-2) + i] = buf[rgroup*M + i];\r
-\r
-      xbuf1[rgroup*M + i] = buf[rgroup*(M-2) + i];\r
-\r
-    }\r
-\r
-    /* The wraparound pointers at top and bottom will be filled later\r
-\r
-     * (see set_wraparound_pointers, below).  Initially we want the "above"\r
-\r
-     * pointers to duplicate the first actual data line.  This only needs\r
-\r
-     * to happen in xbuffer[0].\r
-\r
-     */\r
-\r
-    for (i = 0; i < rgroup; i++) {\r
-\r
-      xbuf0[i - rgroup] = xbuf0[0];\r
-\r
-    }\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-set_wraparound_pointers (j_decompress_ptr cinfo)\r
-\r
-/* Set up the "wraparound" pointers at top and bottom of the pointer lists.\r
-\r
- * This changes the pointer list state from top-of-image to the normal state.\r
-\r
- */\r
-\r
-{\r
-\r
-  my_main_ptr main = (my_main_ptr) cinfo->main;\r
-\r
-  int ci, i, rgroup;\r
-\r
-  int M = cinfo->min_DCT_scaled_size;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-  JSAMPARRAY xbuf0, xbuf1;\r
-\r
-\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /\r
-\r
-      cinfo->min_DCT_scaled_size; /* height of a row group of component */\r
-\r
-    xbuf0 = main->xbuffer[0][ci];\r
-\r
-    xbuf1 = main->xbuffer[1][ci];\r
-\r
-    for (i = 0; i < rgroup; i++) {\r
-\r
-      xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i];\r
-\r
-      xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i];\r
-\r
-      xbuf0[rgroup*(M+2) + i] = xbuf0[i];\r
-\r
-      xbuf1[rgroup*(M+2) + i] = xbuf1[i];\r
-\r
-    }\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-set_bottom_pointers (j_decompress_ptr cinfo)\r
-\r
-/* Change the pointer lists to duplicate the last sample row at the bottom\r
-\r
- * of the image.  whichptr indicates which xbuffer holds the final iMCU row.\r
-\r
- * Also sets rowgroups_avail to indicate number of nondummy row groups in row.\r
-\r
- */\r
-\r
-{\r
-\r
-  my_main_ptr main = (my_main_ptr) cinfo->main;\r
-\r
-  int ci, i, rgroup, iMCUheight, rows_left;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-  JSAMPARRAY xbuf;\r
-\r
-\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    /* Count sample rows in one iMCU row and in one row group */\r
-\r
-    iMCUheight = compptr->v_samp_factor * compptr->DCT_scaled_size;\r
-\r
-    rgroup = iMCUheight / cinfo->min_DCT_scaled_size;\r
-\r
-    /* Count nondummy sample rows remaining for this component */\r
-\r
-    rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight);\r
-\r
-    if (rows_left == 0) rows_left = iMCUheight;\r
-\r
-    /* Count nondummy row groups.  Should get same answer for each component,\r
-\r
-     * so we need only do it once.\r
-\r
-     */\r
-\r
-    if (ci == 0) {\r
-\r
-      main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);\r
-\r
-    }\r
-\r
-    /* Duplicate the last real sample row rgroup*2 times; this pads out the\r
-\r
-     * last partial rowgroup and ensures at least one full rowgroup of context.\r
-\r
-     */\r
-\r
-    xbuf = main->xbuffer[main->whichptr][ci];\r
-\r
-    for (i = 0; i < rgroup * 2; i++) {\r
-\r
-      xbuf[rows_left + i] = xbuf[rows_left-1];\r
-\r
-    }\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize for a processing pass.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)\r
-\r
-{\r
-\r
-  my_main_ptr main = (my_main_ptr) cinfo->main;\r
-\r
-\r
-\r
-  switch (pass_mode) {\r
-\r
-  case JBUF_PASS_THRU:\r
-\r
-    if (cinfo->upsample->need_context_rows) {\r
-\r
-      main->pub.process_data = process_data_context_main;\r
-\r
-      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */\r
-\r
-      main->whichptr = 0;      /* Read first iMCU row into xbuffer[0] */\r
-\r
-      main->context_state = CTX_PREPARE_FOR_IMCU;\r
-\r
-      main->iMCU_row_ctr = 0;\r
-\r
-    } else {\r
-\r
-      /* Simple case with no context needed */\r
-\r
-      main->pub.process_data = process_data_simple_main;\r
-\r
-    }\r
-\r
-    main->buffer_full = FALSE; /* Mark buffer empty */\r
-\r
-    main->rowgroup_ctr = 0;\r
-\r
-    break;\r
-\r
-#ifdef QUANT_2PASS_SUPPORTED\r
-\r
-  case JBUF_CRANK_DEST:\r
-\r
-    /* For last pass of 2-pass quantization, just crank the postprocessor */\r
-\r
-    main->pub.process_data = process_data_crank_post;\r
-\r
-    break;\r
-\r
-#endif\r
-\r
-  default:\r
-\r
-    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);\r
-\r
-    break;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Process some data.\r
-\r
- * This handles the simple case where no context is required.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-process_data_simple_main (j_decompress_ptr cinfo,\r
-\r
-                         JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,\r
-\r
-                         JDIMENSION out_rows_avail)\r
-\r
-{\r
-\r
-  my_main_ptr main = (my_main_ptr) cinfo->main;\r
-\r
-  JDIMENSION rowgroups_avail;\r
-\r
-\r
-\r
-  /* Read input data if we haven't filled the main buffer yet */\r
-\r
-  if (! main->buffer_full) {\r
-\r
-    if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer))\r
-\r
-      return;                  /* suspension forced, can do nothing more */\r
-\r
-    main->buffer_full = TRUE;  /* OK, we have an iMCU row to work with */\r
-\r
-  }\r
-\r
-\r
-\r
-  /* There are always min_DCT_scaled_size row groups in an iMCU row. */\r
-\r
-  rowgroups_avail = (JDIMENSION) cinfo->min_DCT_scaled_size;\r
-\r
-  /* Note: at the bottom of the image, we may pass extra garbage row groups\r
-\r
-   * to the postprocessor.  The postprocessor has to check for bottom\r
-\r
-   * of image anyway (at row resolution), so no point in us doing it too.\r
-\r
-   */\r
-\r
-\r
-\r
-  /* Feed the postprocessor */\r
-\r
-  (*cinfo->post->post_process_data) (cinfo, main->buffer,\r
-\r
-                                    &main->rowgroup_ctr, rowgroups_avail,\r
-\r
-                                    output_buf, out_row_ctr, out_rows_avail);\r
-\r
-\r
-\r
-  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */\r
-\r
-  if (main->rowgroup_ctr >= rowgroups_avail) {\r
-\r
-    main->buffer_full = FALSE;\r
-\r
-    main->rowgroup_ctr = 0;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Process some data.\r
-\r
- * This handles the case where context rows must be provided.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-process_data_context_main (j_decompress_ptr cinfo,\r
-\r
-                          JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,\r
-\r
-                          JDIMENSION out_rows_avail)\r
-\r
-{\r
-\r
-  my_main_ptr main = (my_main_ptr) cinfo->main;\r
-\r
-\r
-\r
-  /* Read input data if we haven't filled the main buffer yet */\r
-\r
-  if (! main->buffer_full) {\r
-\r
-    if (! (*cinfo->coef->decompress_data) (cinfo,\r
-\r
-                                          main->xbuffer[main->whichptr]))\r
-\r
-      return;                  /* suspension forced, can do nothing more */\r
-\r
-    main->buffer_full = TRUE;  /* OK, we have an iMCU row to work with */\r
-\r
-    main->iMCU_row_ctr++;      /* count rows received */\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Postprocessor typically will not swallow all the input data it is handed\r
-\r
-   * in one call (due to filling the output buffer first).  Must be prepared\r
-\r
-   * to exit and restart.  This switch lets us keep track of how far we got.\r
-\r
-   * Note that each case falls through to the next on successful completion.\r
-\r
-   */\r
-\r
-  switch (main->context_state) {\r
-\r
-  case CTX_POSTPONED_ROW:\r
-\r
-    /* Call postprocessor using previously set pointers for postponed row */\r
-\r
-    (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],\r
-\r
-                       &main->rowgroup_ctr, main->rowgroups_avail,\r
-\r
-                       output_buf, out_row_ctr, out_rows_avail);\r
-\r
-    if (main->rowgroup_ctr < main->rowgroups_avail)\r
-\r
-      return;                  /* Need to suspend */\r
-\r
-    main->context_state = CTX_PREPARE_FOR_IMCU;\r
-\r
-    if (*out_row_ctr >= out_rows_avail)\r
-\r
-      return;                  /* Postprocessor exactly filled output buf */\r
-\r
-    /*FALLTHROUGH*/\r
-\r
-  case CTX_PREPARE_FOR_IMCU:\r
-\r
-    /* Prepare to process first M-1 row groups of this iMCU row */\r
-\r
-    main->rowgroup_ctr = 0;\r
-\r
-    main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size - 1);\r
-\r
-    /* Check for bottom of image: if so, tweak pointers to "duplicate"\r
-\r
-     * the last sample row, and adjust rowgroups_avail to ignore padding rows.\r
-\r
-     */\r
-\r
-    if (main->iMCU_row_ctr == cinfo->total_iMCU_rows)\r
-\r
-      set_bottom_pointers(cinfo);\r
-\r
-    main->context_state = CTX_PROCESS_IMCU;\r
-\r
-    /*FALLTHROUGH*/\r
-\r
-  case CTX_PROCESS_IMCU:\r
-\r
-    /* Call postprocessor using previously set pointers */\r
-\r
-    (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],\r
-\r
-                       &main->rowgroup_ctr, main->rowgroups_avail,\r
-\r
-                       output_buf, out_row_ctr, out_rows_avail);\r
-\r
-    if (main->rowgroup_ctr < main->rowgroups_avail)\r
-\r
-      return;                  /* Need to suspend */\r
-\r
-    /* After the first iMCU, change wraparound pointers to normal state */\r
-\r
-    if (main->iMCU_row_ctr == 1)\r
-\r
-      set_wraparound_pointers(cinfo);\r
-\r
-    /* Prepare to load new iMCU row using other xbuffer list */\r
-\r
-    main->whichptr ^= 1;       /* 0=>1 or 1=>0 */\r
-\r
-    main->buffer_full = FALSE;\r
-\r
-    /* Still need to process last row group of this iMCU row, */\r
-\r
-    /* which is saved at index M+1 of the other xbuffer */\r
-\r
-    main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_scaled_size + 1);\r
-\r
-    main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size + 2);\r
-\r
-    main->context_state = CTX_POSTPONED_ROW;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Process some data.\r
-\r
- * Final pass of two-pass quantization: just call the postprocessor.\r
-\r
- * Source data will be the postprocessor controller's internal buffer.\r
-\r
- */\r
-\r
-\r
-\r
-#ifdef QUANT_2PASS_SUPPORTED\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-process_data_crank_post (j_decompress_ptr cinfo,\r
-\r
-                        JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,\r
-\r
-                        JDIMENSION out_rows_avail)\r
-\r
-{\r
-\r
-  (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE) NULL,\r
-\r
-                                    (JDIMENSION *) NULL, (JDIMENSION) 0,\r
-\r
-                                    output_buf, out_row_ctr, out_rows_avail);\r
-\r
-}\r
-\r
-\r
-\r
-#endif /* QUANT_2PASS_SUPPORTED */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize main buffer controller.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)\r
-\r
-{\r
-\r
-  my_main_ptr main;\r
-\r
-  int ci, rgroup, ngroups;\r
-\r
-  jpeg_component_info *compptr;\r
-\r
-\r
-\r
-  main = (my_main_ptr)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                               SIZEOF(my_main_controller));\r
-\r
-  cinfo->main = (struct jpeg_d_main_controller *) main;\r
-\r
-  main->pub.start_pass = start_pass_main;\r
-\r
-\r
-\r
-  if (need_full_buffer)                /* shouldn't happen */\r
-\r
-    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);\r
-\r
-\r
-\r
-  /* Allocate the workspace.\r
-\r
-   * ngroups is the number of row groups we need.\r
-\r
-   */\r
-\r
-  if (cinfo->upsample->need_context_rows) {\r
-\r
-    if (cinfo->min_DCT_scaled_size < 2) /* unsupported, see comments above */\r
-\r
-      ERREXIT(cinfo, JERR_NOTIMPL);\r
-\r
-    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */\r
-\r
-    ngroups = cinfo->min_DCT_scaled_size + 2;\r
-\r
-  } else {\r
-\r
-    ngroups = cinfo->min_DCT_scaled_size;\r
-\r
-  }\r
-\r
-\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /\r
-\r
-      cinfo->min_DCT_scaled_size; /* height of a row group of component */\r
-\r
-    main->buffer[ci] = (*cinfo->mem->alloc_sarray)\r
-\r
-                       ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                        compptr->width_in_blocks * compptr->DCT_scaled_size,\r
-\r
-                        (JDIMENSION) (rgroup * ngroups));\r
-\r
-  }\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jdmarker.cpp b/libs/jpeg6/jdmarker.cpp
deleted file mode 100644 (file)
index 1576098..0000000
+++ /dev/null
@@ -1,1052 +0,0 @@
-/*\r
- * jdmarker.c\r
- *\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
- * This file is part of the Independent JPEG Group's software.\r
- * For conditions of distribution and use, see the accompanying README file.\r
- *\r
- * This file contains routines to decode JPEG datastream markers.\r
- * Most of the complexity arises from our desire to support input\r
- * suspension: if not all of the data for a marker is available,\r
- * we must exit back to the application.  On resumption, we reprocess\r
- * the marker.\r
- */\r
-\r
-#define JPEG_INTERNALS\r
-#include "jinclude.h"\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-typedef enum {                 /* JPEG marker codes */\r
-  M_SOF0  = 0xc0,\r
-  M_SOF1  = 0xc1,\r
-  M_SOF2  = 0xc2,\r
-  M_SOF3  = 0xc3,\r
-  \r
-  M_SOF5  = 0xc5,\r
-  M_SOF6  = 0xc6,\r
-  M_SOF7  = 0xc7,\r
-  \r
-  M_JPG   = 0xc8,\r
-  M_SOF9  = 0xc9,\r
-  M_SOF10 = 0xca,\r
-  M_SOF11 = 0xcb,\r
-  \r
-  M_SOF13 = 0xcd,\r
-  M_SOF14 = 0xce,\r
-  M_SOF15 = 0xcf,\r
-  \r
-  M_DHT   = 0xc4,\r
-  \r
-  M_DAC   = 0xcc,\r
-  \r
-  M_RST0  = 0xd0,\r
-  M_RST1  = 0xd1,\r
-  M_RST2  = 0xd2,\r
-  M_RST3  = 0xd3,\r
-  M_RST4  = 0xd4,\r
-  M_RST5  = 0xd5,\r
-  M_RST6  = 0xd6,\r
-  M_RST7  = 0xd7,\r
-  \r
-  M_SOI   = 0xd8,\r
-  M_EOI   = 0xd9,\r
-  M_SOS   = 0xda,\r
-  M_DQT   = 0xdb,\r
-  M_DNL   = 0xdc,\r
-  M_DRI   = 0xdd,\r
-  M_DHP   = 0xde,\r
-  M_EXP   = 0xdf,\r
-  \r
-  M_APP0  = 0xe0,\r
-  M_APP1  = 0xe1,\r
-  M_APP2  = 0xe2,\r
-  M_APP3  = 0xe3,\r
-  M_APP4  = 0xe4,\r
-  M_APP5  = 0xe5,\r
-  M_APP6  = 0xe6,\r
-  M_APP7  = 0xe7,\r
-  M_APP8  = 0xe8,\r
-  M_APP9  = 0xe9,\r
-  M_APP10 = 0xea,\r
-  M_APP11 = 0xeb,\r
-  M_APP12 = 0xec,\r
-  M_APP13 = 0xed,\r
-  M_APP14 = 0xee,\r
-  M_APP15 = 0xef,\r
-  \r
-  M_JPG0  = 0xf0,\r
-  M_JPG13 = 0xfd,\r
-  M_COM   = 0xfe,\r
-  \r
-  M_TEM   = 0x01,\r
-  \r
-  M_ERROR = 0x100\r
-} JPEG_MARKER;\r
-\r
-\r
-/*\r
- * Macros for fetching data from the data source module.\r
- *\r
- * At all times, cinfo->src->next_input_byte and ->bytes_in_buffer reflect\r
- * the current restart point; we update them only when we have reached a\r
- * suitable place to restart if a suspension occurs.\r
- */\r
-\r
-/* Declare and initialize local copies of input pointer/count */\r
-#define INPUT_VARS(cinfo)  \\r
-       struct jpeg_source_mgr * datasrc = (cinfo)->src;  \\r
-       const JOCTET * next_input_byte = datasrc->next_input_byte;  \\r
-       size_t bytes_in_buffer = datasrc->bytes_in_buffer\r
-\r
-/* Unload the local copies --- do this only at a restart boundary */\r
-#define INPUT_SYNC(cinfo)  \\r
-       ( datasrc->next_input_byte = next_input_byte,  \\r
-         datasrc->bytes_in_buffer = bytes_in_buffer )\r
-\r
-/* Reload the local copies --- seldom used except in MAKE_BYTE_AVAIL */\r
-#define INPUT_RELOAD(cinfo)  \\r
-       ( next_input_byte = datasrc->next_input_byte,  \\r
-         bytes_in_buffer = datasrc->bytes_in_buffer )\r
-\r
-/* Internal macro for INPUT_BYTE and INPUT_2BYTES: make a byte available.\r
- * Note we do *not* do INPUT_SYNC before calling fill_input_buffer,\r
- * but we must reload the local copies after a successful fill.\r
- */\r
-#define MAKE_BYTE_AVAIL(cinfo,action)  \\r
-       if (bytes_in_buffer == 0) {  \\r
-         if (! (*datasrc->fill_input_buffer) (cinfo))  \\r
-           { action; }  \\r
-         INPUT_RELOAD(cinfo);  \\r
-       }  \\r
-       bytes_in_buffer--\r
-\r
-/* Read a byte into variable V.\r
- * If must suspend, take the specified action (typically "return FALSE").\r
- */\r
-#define INPUT_BYTE(cinfo,V,action)  \\r
-       MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \\r
-                 V = GETJOCTET(*next_input_byte++); )\r
-\r
-/* As above, but read two bytes interpreted as an unsigned 16-bit integer.\r
- * V should be declared unsigned int or perhaps INT32.\r
- */\r
-#define INPUT_2BYTES(cinfo,V,action)  \\r
-       MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \\r
-                 V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \\r
-                 MAKE_BYTE_AVAIL(cinfo,action); \\r
-                 V += GETJOCTET(*next_input_byte++); )\r
-\r
-\r
-/*\r
- * Routines to process JPEG markers.\r
- *\r
- * Entry condition: JPEG marker itself has been read and its code saved\r
- *   in cinfo->unread_marker; input restart point is just after the marker.\r
- *\r
- * Exit: if return TRUE, have read and processed any parameters, and have\r
- *   updated the restart point to point after the parameters.\r
- *   If return FALSE, was forced to suspend before reaching end of\r
- *   marker parameters; restart point has not been moved.  Same routine\r
- *   will be called again after application supplies more input data.\r
- *\r
- * This approach to suspension assumes that all of a marker's parameters can\r
- * fit into a single input bufferload.  This should hold for "normal"\r
- * markers.  Some COM/APPn markers might have large parameter segments,\r
- * but we use skip_input_data to get past those, and thereby put the problem\r
- * on the source manager's shoulders.\r
- *\r
- * Note that we don't bother to avoid duplicate trace messages if a\r
- * suspension occurs within marker parameters.  Other side effects\r
- * require more care.\r
- */\r
-\r
-\r
-LOCAL boolean\r
-get_soi (j_decompress_ptr cinfo)\r
-/* Process an SOI marker */\r
-{\r
-  int i;\r
-  \r
-  TRACEMS(cinfo, 1, JTRC_SOI);\r
-\r
-  if (cinfo->marker->saw_SOI)\r
-    ERREXIT(cinfo, JERR_SOI_DUPLICATE);\r
-\r
-  /* Reset all parameters that are defined to be reset by SOI */\r
-\r
-  for (i = 0; i < NUM_ARITH_TBLS; i++) {\r
-    cinfo->arith_dc_L[i] = 0;\r
-    cinfo->arith_dc_U[i] = 1;\r
-    cinfo->arith_ac_K[i] = 5;\r
-  }\r
-  cinfo->restart_interval = 0;\r
-\r
-  /* Set initial assumptions for colorspace etc */\r
-\r
-  cinfo->jpeg_color_space = JCS_UNKNOWN;\r
-  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */\r
-\r
-  cinfo->saw_JFIF_marker = FALSE;\r
-  cinfo->density_unit = 0;     /* set default JFIF APP0 values */\r
-  cinfo->X_density = 1;\r
-  cinfo->Y_density = 1;\r
-  cinfo->saw_Adobe_marker = FALSE;\r
-  cinfo->Adobe_transform = 0;\r
-\r
-  cinfo->marker->saw_SOI = TRUE;\r
-\r
-  return TRUE;\r
-}\r
-\r
-\r
-LOCAL boolean\r
-get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)\r
-/* Process a SOFn marker */\r
-{\r
-  INT32 length;\r
-  int c, ci;\r
-  jpeg_component_info * compptr;\r
-  INPUT_VARS(cinfo);\r
-\r
-  cinfo->progressive_mode = is_prog;\r
-  cinfo->arith_code = is_arith;\r
-\r
-  INPUT_2BYTES(cinfo, length, return FALSE);\r
-\r
-  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);\r
-  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);\r
-  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);\r
-  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);\r
-\r
-  length -= 8;\r
-\r
-  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,\r
-          (int) cinfo->image_width, (int) cinfo->image_height,\r
-          cinfo->num_components);\r
-\r
-  if (cinfo->marker->saw_SOF)\r
-    ERREXIT(cinfo, JERR_SOF_DUPLICATE);\r
-\r
-  /* We don't support files in which the image height is initially specified */\r
-  /* as 0 and is later redefined by DNL.  As long as we have to check that,  */\r
-  /* might as well have a general sanity check. */\r
-  if (cinfo->image_height <= 0 || cinfo->image_width <= 0\r
-      || cinfo->num_components <= 0)\r
-    ERREXIT(cinfo, JERR_EMPTY_IMAGE);\r
-\r
-  if (length != (cinfo->num_components * 3))\r
-    ERREXIT(cinfo, JERR_BAD_LENGTH);\r
-\r
-  if (cinfo->comp_info == NULL)        /* do only once, even if suspend */\r
-    cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small)\r
-                       ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-                        cinfo->num_components * SIZEOF(jpeg_component_info));\r
-  \r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-       ci++, compptr++) {\r
-    compptr->component_index = ci;\r
-    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);\r
-    INPUT_BYTE(cinfo, c, return FALSE);\r
-    compptr->h_samp_factor = (c >> 4) & 15;\r
-    compptr->v_samp_factor = (c     ) & 15;\r
-    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);\r
-\r
-    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,\r
-            compptr->component_id, compptr->h_samp_factor,\r
-            compptr->v_samp_factor, compptr->quant_tbl_no);\r
-  }\r
-\r
-  cinfo->marker->saw_SOF = TRUE;\r
-\r
-  INPUT_SYNC(cinfo);\r
-  return TRUE;\r
-}\r
-\r
-\r
-LOCAL boolean\r
-get_sos (j_decompress_ptr cinfo)\r
-/* Process a SOS marker */\r
-{\r
-  INT32 length;\r
-  int i, ci, n, c, cc;\r
-  jpeg_component_info * compptr;\r
-  INPUT_VARS(cinfo);\r
-\r
-  if (! cinfo->marker->saw_SOF)\r
-    ERREXIT(cinfo, JERR_SOS_NO_SOF);\r
-\r
-  INPUT_2BYTES(cinfo, length, return FALSE);\r
-\r
-  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */\r
-\r
-  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)\r
-    ERREXIT(cinfo, JERR_BAD_LENGTH);\r
-\r
-  TRACEMS1(cinfo, 1, JTRC_SOS, n);\r
-\r
-  cinfo->comps_in_scan = n;\r
-\r
-  /* Collect the component-spec parameters */\r
-\r
-  for (i = 0; i < n; i++) {\r
-    INPUT_BYTE(cinfo, cc, return FALSE);\r
-    INPUT_BYTE(cinfo, c, return FALSE);\r
-    \r
-    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-        ci++, compptr++) {\r
-      if (cc == compptr->component_id)\r
-       goto id_found;\r
-    }\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);\r
-\r
-  id_found:\r
-\r
-    cinfo->cur_comp_info[i] = compptr;\r
-    compptr->dc_tbl_no = (c >> 4) & 15;\r
-    compptr->ac_tbl_no = (c     ) & 15;\r
-    \r
-    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,\r
-            compptr->dc_tbl_no, compptr->ac_tbl_no);\r
-  }\r
-\r
-  /* Collect the additional scan parameters Ss, Se, Ah/Al. */\r
-  INPUT_BYTE(cinfo, c, return FALSE);\r
-  cinfo->Ss = c;\r
-  INPUT_BYTE(cinfo, c, return FALSE);\r
-  cinfo->Se = c;\r
-  INPUT_BYTE(cinfo, c, return FALSE);\r
-  cinfo->Ah = (c >> 4) & 15;\r
-  cinfo->Al = (c     ) & 15;\r
-\r
-  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,\r
-          cinfo->Ah, cinfo->Al);\r
-\r
-  /* Prepare to scan data & restart markers */\r
-  cinfo->marker->next_restart_num = 0;\r
-\r
-  /* Count another SOS marker */\r
-  cinfo->input_scan_number++;\r
-\r
-  INPUT_SYNC(cinfo);\r
-  return TRUE;\r
-}\r
-\r
-\r
-METHODDEF boolean\r
-get_app0 (j_decompress_ptr cinfo)\r
-/* Process an APP0 marker */\r
-{\r
-#define JFIF_LEN 14\r
-  INT32 length;\r
-  UINT8 b[JFIF_LEN];\r
-  int buffp;\r
-  INPUT_VARS(cinfo);\r
-\r
-  INPUT_2BYTES(cinfo, length, return FALSE);\r
-  length -= 2;\r
-\r
-  /* See if a JFIF APP0 marker is present */\r
-\r
-  if (length >= JFIF_LEN) {\r
-    for (buffp = 0; buffp < JFIF_LEN; buffp++)\r
-      INPUT_BYTE(cinfo, b[buffp], return FALSE);\r
-    length -= JFIF_LEN;\r
-\r
-    if (b[0]==0x4A && b[1]==0x46 && b[2]==0x49 && b[3]==0x46 && b[4]==0) {\r
-      /* Found JFIF APP0 marker: check version */\r
-      /* Major version must be 1, anything else signals an incompatible change.\r
-       * We used to treat this as an error, but now it's a nonfatal warning,\r
-       * because some bozo at Hijaak couldn't read the spec.\r
-       * Minor version should be 0..2, but process anyway if newer.\r
-       */\r
-      if (b[5] != 1)\r
-       WARNMS2(cinfo, JWRN_JFIF_MAJOR, b[5], b[6]);\r
-      else if (b[6] > 2)\r
-       TRACEMS2(cinfo, 1, JTRC_JFIF_MINOR, b[5], b[6]);\r
-      /* Save info */\r
-      cinfo->saw_JFIF_marker = TRUE;\r
-      cinfo->density_unit = b[7];\r
-      cinfo->X_density = (b[8] << 8) + b[9];\r
-      cinfo->Y_density = (b[10] << 8) + b[11];\r
-      TRACEMS3(cinfo, 1, JTRC_JFIF,\r
-              cinfo->X_density, cinfo->Y_density, cinfo->density_unit);\r
-      if (b[12] | b[13])\r
-       TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, b[12], b[13]);\r
-      if (length != ((INT32) b[12] * (INT32) b[13] * (INT32) 3))\r
-       TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) length);\r
-    } else {\r
-      /* Start of APP0 does not match "JFIF" */\r
-      TRACEMS1(cinfo, 1, JTRC_APP0, (int) length + JFIF_LEN);\r
-    }\r
-  } else {\r
-    /* Too short to be JFIF marker */\r
-    TRACEMS1(cinfo, 1, JTRC_APP0, (int) length);\r
-  }\r
-\r
-  INPUT_SYNC(cinfo);\r
-  if (length > 0)              /* skip any remaining data -- could be lots */\r
-    (*cinfo->src->skip_input_data) (cinfo, (long) length);\r
-\r
-  return TRUE;\r
-}\r
-\r
-\r
-METHODDEF boolean\r
-get_app14 (j_decompress_ptr cinfo)\r
-/* Process an APP14 marker */\r
-{\r
-#define ADOBE_LEN 12\r
-  INT32 length;\r
-  UINT8 b[ADOBE_LEN];\r
-  int buffp;\r
-  unsigned int version, flags0, flags1, transform;\r
-  INPUT_VARS(cinfo);\r
-\r
-  INPUT_2BYTES(cinfo, length, return FALSE);\r
-  length -= 2;\r
-\r
-  /* See if an Adobe APP14 marker is present */\r
-\r
-  if (length >= ADOBE_LEN) {\r
-    for (buffp = 0; buffp < ADOBE_LEN; buffp++)\r
-      INPUT_BYTE(cinfo, b[buffp], return FALSE);\r
-    length -= ADOBE_LEN;\r
-\r
-    if (b[0]==0x41 && b[1]==0x64 && b[2]==0x6F && b[3]==0x62 && b[4]==0x65) {\r
-      /* Found Adobe APP14 marker */\r
-      version = (b[5] << 8) + b[6];\r
-      flags0 = (b[7] << 8) + b[8];\r
-      flags1 = (b[9] << 8) + b[10];\r
-      transform = b[11];\r
-      TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);\r
-      cinfo->saw_Adobe_marker = TRUE;\r
-      cinfo->Adobe_transform = (UINT8) transform;\r
-    } else {\r
-      /* Start of APP14 does not match "Adobe" */\r
-      TRACEMS1(cinfo, 1, JTRC_APP14, (int) length + ADOBE_LEN);\r
-    }\r
-  } else {\r
-    /* Too short to be Adobe marker */\r
-    TRACEMS1(cinfo, 1, JTRC_APP14, (int) length);\r
-  }\r
-\r
-  INPUT_SYNC(cinfo);\r
-  if (length > 0)              /* skip any remaining data -- could be lots */\r
-    (*cinfo->src->skip_input_data) (cinfo, (long) length);\r
-\r
-  return TRUE;\r
-}\r
-\r
-\r
-LOCAL boolean\r
-get_dac (j_decompress_ptr cinfo)\r
-/* Process a DAC marker */\r
-{\r
-  INT32 length;\r
-  int index, val;\r
-  INPUT_VARS(cinfo);\r
-\r
-  INPUT_2BYTES(cinfo, length, return FALSE);\r
-  length -= 2;\r
-  \r
-  while (length > 0) {\r
-    INPUT_BYTE(cinfo, index, return FALSE);\r
-    INPUT_BYTE(cinfo, val, return FALSE);\r
-\r
-    length -= 2;\r
-\r
-    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);\r
-\r
-    if (index < 0 || index >= (2*NUM_ARITH_TBLS))\r
-      ERREXIT1(cinfo, JERR_DAC_INDEX, index);\r
-\r
-    if (index >= NUM_ARITH_TBLS) { /* define AC table */\r
-      cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val;\r
-    } else {                   /* define DC table */\r
-      cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F);\r
-      cinfo->arith_dc_U[index] = (UINT8) (val >> 4);\r
-      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])\r
-       ERREXIT1(cinfo, JERR_DAC_VALUE, val);\r
-    }\r
-  }\r
-\r
-  INPUT_SYNC(cinfo);\r
-  return TRUE;\r
-}\r
-\r
-\r
-LOCAL boolean\r
-get_dht (j_decompress_ptr cinfo)\r
-/* Process a DHT marker */\r
-{\r
-  INT32 length;\r
-  UINT8 bits[17];\r
-  UINT8 huffval[256];\r
-  int i, index, count;\r
-  JHUFF_TBL **htblptr;\r
-  INPUT_VARS(cinfo);\r
-\r
-  INPUT_2BYTES(cinfo, length, return FALSE);\r
-  length -= 2;\r
-  \r
-  while (length > 0) {\r
-    INPUT_BYTE(cinfo, index, return FALSE);\r
-\r
-    TRACEMS1(cinfo, 1, JTRC_DHT, index);\r
-      \r
-    bits[0] = 0;\r
-    count = 0;\r
-    for (i = 1; i <= 16; i++) {\r
-      INPUT_BYTE(cinfo, bits[i], return FALSE);\r
-      count += bits[i];\r
-    }\r
-\r
-    length -= 1 + 16;\r
-\r
-    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,\r
-            bits[1], bits[2], bits[3], bits[4],\r
-            bits[5], bits[6], bits[7], bits[8]);\r
-    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,\r
-            bits[9], bits[10], bits[11], bits[12],\r
-            bits[13], bits[14], bits[15], bits[16]);\r
-\r
-    if (count > 256 || ((INT32) count) > length)\r
-      ERREXIT(cinfo, JERR_DHT_COUNTS);\r
-\r
-    for (i = 0; i < count; i++)\r
-      INPUT_BYTE(cinfo, huffval[i], return FALSE);\r
-\r
-    length -= count;\r
-\r
-    if (index & 0x10) {                /* AC table definition */\r
-      index -= 0x10;\r
-      htblptr = &cinfo->ac_huff_tbl_ptrs[index];\r
-    } else {                   /* DC table definition */\r
-      htblptr = &cinfo->dc_huff_tbl_ptrs[index];\r
-    }\r
-\r
-    if (index < 0 || index >= NUM_HUFF_TBLS)\r
-      ERREXIT1(cinfo, JERR_DHT_INDEX, index);\r
-\r
-    if (*htblptr == NULL)\r
-      *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);\r
-  \r
-    MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));\r
-    MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval));\r
-  }\r
-\r
-  INPUT_SYNC(cinfo);\r
-  return TRUE;\r
-}\r
-\r
-\r
-LOCAL boolean\r
-get_dqt (j_decompress_ptr cinfo)\r
-/* Process a DQT marker */\r
-{\r
-  INT32 length;\r
-  int n, i, prec;\r
-  unsigned int tmp;\r
-  JQUANT_TBL *quant_ptr;\r
-  INPUT_VARS(cinfo);\r
-\r
-  INPUT_2BYTES(cinfo, length, return FALSE);\r
-  length -= 2;\r
-\r
-  while (length > 0) {\r
-    INPUT_BYTE(cinfo, n, return FALSE);\r
-    prec = n >> 4;\r
-    n &= 0x0F;\r
-\r
-    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);\r
-\r
-    if (n >= NUM_QUANT_TBLS)\r
-      ERREXIT1(cinfo, JERR_DQT_INDEX, n);\r
-      \r
-    if (cinfo->quant_tbl_ptrs[n] == NULL)\r
-      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo);\r
-    quant_ptr = cinfo->quant_tbl_ptrs[n];\r
-\r
-    for (i = 0; i < DCTSIZE2; i++) {\r
-      if (prec)\r
-       INPUT_2BYTES(cinfo, tmp, return FALSE);\r
-      else\r
-       INPUT_BYTE(cinfo, tmp, return FALSE);\r
-      quant_ptr->quantval[i] = (UINT16) tmp;\r
-    }\r
-\r
-    for (i = 0; i < DCTSIZE2; i += 8) {\r
-      TRACEMS8(cinfo, 2, JTRC_QUANTVALS,\r
-              quant_ptr->quantval[i  ], quant_ptr->quantval[i+1],\r
-              quant_ptr->quantval[i+2], quant_ptr->quantval[i+3],\r
-              quant_ptr->quantval[i+4], quant_ptr->quantval[i+5],\r
-              quant_ptr->quantval[i+6], quant_ptr->quantval[i+7]);\r
-    }\r
-\r
-    length -= DCTSIZE2+1;\r
-    if (prec) length -= DCTSIZE2;\r
-  }\r
-\r
-  INPUT_SYNC(cinfo);\r
-  return TRUE;\r
-}\r
-\r
-\r
-LOCAL boolean\r
-get_dri (j_decompress_ptr cinfo)\r
-/* Process a DRI marker */\r
-{\r
-  INT32 length;\r
-  unsigned int tmp;\r
-  INPUT_VARS(cinfo);\r
-\r
-  INPUT_2BYTES(cinfo, length, return FALSE);\r
-  \r
-  if (length != 4)\r
-    ERREXIT(cinfo, JERR_BAD_LENGTH);\r
-\r
-  INPUT_2BYTES(cinfo, tmp, return FALSE);\r
-\r
-  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);\r
-\r
-  cinfo->restart_interval = tmp;\r
-\r
-  INPUT_SYNC(cinfo);\r
-  return TRUE;\r
-}\r
-\r
-\r
-METHODDEF boolean\r
-skip_variable (j_decompress_ptr cinfo)\r
-/* Skip over an unknown or uninteresting variable-length marker */\r
-{\r
-  INT32 length;\r
-  INPUT_VARS(cinfo);\r
-\r
-  INPUT_2BYTES(cinfo, length, return FALSE);\r
-  \r
-  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length);\r
-\r
-  INPUT_SYNC(cinfo);           /* do before skip_input_data */\r
-  (*cinfo->src->skip_input_data) (cinfo, (long) length - 2L);\r
-\r
-  return TRUE;\r
-}\r
-\r
-\r
-/*\r
- * Find the next JPEG marker, save it in cinfo->unread_marker.\r
- * Returns FALSE if had to suspend before reaching a marker;\r
- * in that case cinfo->unread_marker is unchanged.\r
- *\r
- * Note that the result might not be a valid marker code,\r
- * but it will never be 0 or FF.\r
- */\r
-\r
-LOCAL boolean\r
-next_marker (j_decompress_ptr cinfo)\r
-{\r
-  int c;\r
-  INPUT_VARS(cinfo);\r
-\r
-  for (;;) {\r
-    INPUT_BYTE(cinfo, c, return FALSE);\r
-    /* Skip any non-FF bytes.\r
-     * This may look a bit inefficient, but it will not occur in a valid file.\r
-     * We sync after each discarded byte so that a suspending data source\r
-     * can discard the byte from its buffer.\r
-     */\r
-    while (c != 0xFF) {\r
-      cinfo->marker->discarded_bytes++;\r
-      INPUT_SYNC(cinfo);\r
-      INPUT_BYTE(cinfo, c, return FALSE);\r
-    }\r
-    /* This loop swallows any duplicate FF bytes.  Extra FFs are legal as\r
-     * pad bytes, so don't count them in discarded_bytes.  We assume there\r
-     * will not be so many consecutive FF bytes as to overflow a suspending\r
-     * data source's input buffer.\r
-     */\r
-    do {\r
-      INPUT_BYTE(cinfo, c, return FALSE);\r
-    } while (c == 0xFF);\r
-    if (c != 0)\r
-      break;                   /* found a valid marker, exit loop */\r
-    /* Reach here if we found a stuffed-zero data sequence (FF/00).\r
-     * Discard it and loop back to try again.\r
-     */\r
-    cinfo->marker->discarded_bytes += 2;\r
-    INPUT_SYNC(cinfo);\r
-  }\r
-\r
-  if (cinfo->marker->discarded_bytes != 0) {\r
-    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);\r
-    cinfo->marker->discarded_bytes = 0;\r
-  }\r
-\r
-  cinfo->unread_marker = c;\r
-\r
-  INPUT_SYNC(cinfo);\r
-  return TRUE;\r
-}\r
-\r
-\r
-LOCAL boolean\r
-first_marker (j_decompress_ptr cinfo)\r
-/* Like next_marker, but used to obtain the initial SOI marker. */\r
-/* For this marker, we do not allow preceding garbage or fill; otherwise,\r
- * we might well scan an entire input file before realizing it ain't JPEG.\r
- * If an application wants to process non-JFIF files, it must seek to the\r
- * SOI before calling the JPEG library.\r
- */\r
-{\r
-  int c, c2;\r
-  INPUT_VARS(cinfo);\r
-\r
-  INPUT_BYTE(cinfo, c, return FALSE);\r
-  INPUT_BYTE(cinfo, c2, return FALSE);\r
-  if (c != 0xFF || c2 != (int) M_SOI)\r
-    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);\r
-\r
-  cinfo->unread_marker = c2;\r
-\r
-  INPUT_SYNC(cinfo);\r
-  return TRUE;\r
-}\r
-\r
-\r
-/*\r
- * Read markers until SOS or EOI.\r
- *\r
- * Returns same codes as are defined for jpeg_consume_input:\r
- * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.\r
- */\r
-\r
-METHODDEF int\r
-read_markers (j_decompress_ptr cinfo)\r
-{\r
-  /* Outer loop repeats once for each marker. */\r
-  for (;;) {\r
-    /* Collect the marker proper, unless we already did. */\r
-    /* NB: first_marker() enforces the requirement that SOI appear first. */\r
-    if (cinfo->unread_marker == 0) {\r
-      if (! cinfo->marker->saw_SOI) {\r
-       if (! first_marker(cinfo))\r
-         return JPEG_SUSPENDED;\r
-      } else {\r
-       if (! next_marker(cinfo))\r
-         return JPEG_SUSPENDED;\r
-      }\r
-    }\r
-    /* At this point cinfo->unread_marker contains the marker code and the\r
-     * input point is just past the marker proper, but before any parameters.\r
-     * A suspension will cause us to return with this state still true.\r
-     */\r
-    switch (cinfo->unread_marker) {\r
-    case M_SOI:\r
-      if (! get_soi(cinfo))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-\r
-    case M_SOF0:               /* Baseline */\r
-    case M_SOF1:               /* Extended sequential, Huffman */\r
-      if (! get_sof(cinfo, FALSE, FALSE))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-\r
-    case M_SOF2:               /* Progressive, Huffman */\r
-      if (! get_sof(cinfo, TRUE, FALSE))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-\r
-    case M_SOF9:               /* Extended sequential, arithmetic */\r
-      if (! get_sof(cinfo, FALSE, TRUE))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-\r
-    case M_SOF10:              /* Progressive, arithmetic */\r
-      if (! get_sof(cinfo, TRUE, TRUE))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-\r
-    /* Currently unsupported SOFn types */\r
-    case M_SOF3:               /* Lossless, Huffman */\r
-    case M_SOF5:               /* Differential sequential, Huffman */\r
-    case M_SOF6:               /* Differential progressive, Huffman */\r
-    case M_SOF7:               /* Differential lossless, Huffman */\r
-    case M_JPG:                        /* Reserved for JPEG extensions */\r
-    case M_SOF11:              /* Lossless, arithmetic */\r
-    case M_SOF13:              /* Differential sequential, arithmetic */\r
-    case M_SOF14:              /* Differential progressive, arithmetic */\r
-    case M_SOF15:              /* Differential lossless, arithmetic */\r
-      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);\r
-      break;\r
-\r
-    case M_SOS:\r
-      if (! get_sos(cinfo))\r
-       return JPEG_SUSPENDED;\r
-      cinfo->unread_marker = 0;        /* processed the marker */\r
-      return JPEG_REACHED_SOS;\r
-    \r
-    case M_EOI:\r
-      TRACEMS(cinfo, 1, JTRC_EOI);\r
-      cinfo->unread_marker = 0;        /* processed the marker */\r
-      return JPEG_REACHED_EOI;\r
-      \r
-    case M_DAC:\r
-      if (! get_dac(cinfo))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-      \r
-    case M_DHT:\r
-      if (! get_dht(cinfo))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-      \r
-    case M_DQT:\r
-      if (! get_dqt(cinfo))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-      \r
-    case M_DRI:\r
-      if (! get_dri(cinfo))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-      \r
-    case M_APP0:\r
-    case M_APP1:\r
-    case M_APP2:\r
-    case M_APP3:\r
-    case M_APP4:\r
-    case M_APP5:\r
-    case M_APP6:\r
-    case M_APP7:\r
-    case M_APP8:\r
-    case M_APP9:\r
-    case M_APP10:\r
-    case M_APP11:\r
-    case M_APP12:\r
-    case M_APP13:\r
-    case M_APP14:\r
-    case M_APP15:\r
-      if (! (*cinfo->marker->process_APPn[cinfo->unread_marker - (int) M_APP0]) (cinfo))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-      \r
-    case M_COM:\r
-      if (! (*cinfo->marker->process_COM) (cinfo))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-\r
-    case M_RST0:               /* these are all parameterless */\r
-    case M_RST1:\r
-    case M_RST2:\r
-    case M_RST3:\r
-    case M_RST4:\r
-    case M_RST5:\r
-    case M_RST6:\r
-    case M_RST7:\r
-    case M_TEM:\r
-      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);\r
-      break;\r
-\r
-    case M_DNL:                        /* Ignore DNL ... perhaps the wrong thing */\r
-      if (! skip_variable(cinfo))\r
-       return JPEG_SUSPENDED;\r
-      break;\r
-\r
-    default:                   /* must be DHP, EXP, JPGn, or RESn */\r
-      /* For now, we treat the reserved markers as fatal errors since they are\r
-       * likely to be used to signal incompatible JPEG Part 3 extensions.\r
-       * Once the JPEG 3 version-number marker is well defined, this code\r
-       * ought to change!\r
-       */\r
-      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);\r
-      break;\r
-    }\r
-    /* Successfully processed marker, so reset state variable */\r
-    cinfo->unread_marker = 0;\r
-  } /* end loop */\r
-}\r
-\r
-\r
-/*\r
- * Read a restart marker, which is expected to appear next in the datastream;\r
- * if the marker is not there, take appropriate recovery action.\r
- * Returns FALSE if suspension is required.\r
- *\r
- * This is called by the entropy decoder after it has read an appropriate\r
- * number of MCUs.  cinfo->unread_marker may be nonzero if the entropy decoder\r
- * has already read a marker from the data source.  Under normal conditions\r
- * cinfo->unread_marker will be reset to 0 before returning; if not reset,\r
- * it holds a marker which the decoder will be unable to read past.\r
- */\r
-\r
-METHODDEF boolean\r
-read_restart_marker (j_decompress_ptr cinfo)\r
-{\r
-  /* Obtain a marker unless we already did. */\r
-  /* Note that next_marker will complain if it skips any data. */\r
-  if (cinfo->unread_marker == 0) {\r
-    if (! next_marker(cinfo))\r
-      return FALSE;\r
-  }\r
-\r
-  if (cinfo->unread_marker ==\r
-      ((int) M_RST0 + cinfo->marker->next_restart_num)) {\r
-    /* Normal case --- swallow the marker and let entropy decoder continue */\r
-    TRACEMS1(cinfo, 2, JTRC_RST, cinfo->marker->next_restart_num);\r
-    cinfo->unread_marker = 0;\r
-  } else {\r
-    /* Uh-oh, the restart markers have been messed up. */\r
-    /* Let the data source manager determine how to resync. */\r
-    if (! (*cinfo->src->resync_to_restart) (cinfo,\r
-                                           cinfo->marker->next_restart_num))\r
-      return FALSE;\r
-  }\r
-\r
-  /* Update next-restart state */\r
-  cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;\r
-\r
-  return TRUE;\r
-}\r
-\r
-\r
-/*\r
- * This is the default resync_to_restart method for data source managers\r
- * to use if they don't have any better approach.  Some data source managers\r
- * may be able to back up, or may have additional knowledge about the data\r
- * which permits a more intelligent recovery strategy; such managers would\r
- * presumably supply their own resync method.\r
- *\r
- * read_restart_marker calls resync_to_restart if it finds a marker other than\r
- * the restart marker it was expecting.  (This code is *not* used unless\r
- * a nonzero restart interval has been declared.)  cinfo->unread_marker is\r
- * the marker code actually found (might be anything, except 0 or FF).\r
- * The desired restart marker number (0..7) is passed as a parameter.\r
- * This routine is supposed to apply whatever error recovery strategy seems\r
- * appropriate in order to position the input stream to the next data segment.\r
- * Note that cinfo->unread_marker is treated as a marker appearing before\r
- * the current data-source input point; usually it should be reset to zero\r
- * before returning.\r
- * Returns FALSE if suspension is required.\r
- *\r
- * This implementation is substantially constrained by wanting to treat the\r
- * input as a data stream; this means we can't back up.  Therefore, we have\r
- * only the following actions to work with:\r
- *   1. Simply discard the marker and let the entropy decoder resume at next\r
- *      byte of file.\r
- *   2. Read forward until we find another marker, discarding intervening\r
- *      data.  (In theory we could look ahead within the current bufferload,\r
- *      without having to discard data if we don't find the desired marker.\r
- *      This idea is not implemented here, in part because it makes behavior\r
- *      dependent on buffer size and chance buffer-boundary positions.)\r
- *   3. Leave the marker unread (by failing to zero cinfo->unread_marker).\r
- *      This will cause the entropy decoder to process an empty data segment,\r
- *      inserting dummy zeroes, and then we will reprocess the marker.\r
- *\r
- * #2 is appropriate if we think the desired marker lies ahead, while #3 is\r
- * appropriate if the found marker is a future restart marker (indicating\r
- * that we have missed the desired restart marker, probably because it got\r
- * corrupted).\r
- * We apply #2 or #3 if the found marker is a restart marker no more than\r
- * two counts behind or ahead of the expected one.  We also apply #2 if the\r
- * found marker is not a legal JPEG marker code (it's certainly bogus data).\r
- * If the found marker is a restart marker more than 2 counts away, we do #1\r
- * (too much risk that the marker is erroneous; with luck we will be able to\r
- * resync at some future point).\r
- * For any valid non-restart JPEG marker, we apply #3.  This keeps us from\r
- * overrunning the end of a scan.  An implementation limited to single-scan\r
- * files might find it better to apply #2 for markers other than EOI, since\r
- * any other marker would have to be bogus data in that case.\r
- */\r
-\r
-GLOBAL boolean\r
-jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired)\r
-{\r
-  int marker = cinfo->unread_marker;\r
-  int action = 1;\r
-  \r
-  /* Always put up a warning. */\r
-  WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);\r
-  \r
-  /* Outer loop handles repeated decision after scanning forward. */\r
-  for (;;) {\r
-    if (marker < (int) M_SOF0)\r
-      action = 2;              /* invalid marker */\r
-    else if (marker < (int) M_RST0 || marker > (int) M_RST7)\r
-      action = 3;              /* valid non-restart marker */\r
-    else {\r
-      if (marker == ((int) M_RST0 + ((desired+1) & 7)) ||\r
-         marker == ((int) M_RST0 + ((desired+2) & 7)))\r
-       action = 3;             /* one of the next two expected restarts */\r
-      else if (marker == ((int) M_RST0 + ((desired-1) & 7)) ||\r
-              marker == ((int) M_RST0 + ((desired-2) & 7)))\r
-       action = 2;             /* a prior restart, so advance */\r
-      else\r
-       action = 1;             /* desired restart or too far away */\r
-    }\r
-    TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);\r
-    switch (action) {\r
-    case 1:\r
-      /* Discard marker and let entropy decoder resume processing. */\r
-      cinfo->unread_marker = 0;\r
-      return TRUE;\r
-    case 2:\r
-      /* Scan to the next marker, and repeat the decision loop. */\r
-      if (! next_marker(cinfo))\r
-       return FALSE;\r
-      marker = cinfo->unread_marker;\r
-      break;\r
-    case 3:\r
-      /* Return without advancing past this marker. */\r
-      /* Entropy decoder will be forced to process an empty segment. */\r
-      return TRUE;\r
-    }\r
-  } /* end loop */\r
-}\r
-\r
-\r
-/*\r
- * Reset marker processing state to begin a fresh datastream.\r
- */\r
-\r
-METHODDEF void\r
-reset_marker_reader (j_decompress_ptr cinfo)\r
-{\r
-  cinfo->comp_info = NULL;             /* until allocated by get_sof */\r
-  cinfo->input_scan_number = 0;                /* no SOS seen yet */\r
-  cinfo->unread_marker = 0;            /* no pending marker */\r
-  cinfo->marker->saw_SOI = FALSE;      /* set internal state too */\r
-  cinfo->marker->saw_SOF = FALSE;\r
-  cinfo->marker->discarded_bytes = 0;\r
-}\r
-\r
-\r
-/*\r
- * Initialize the marker reader module.\r
- * This is called only once, when the decompression object is created.\r
- */\r
-\r
-GLOBAL void\r
-jinit_marker_reader (j_decompress_ptr cinfo)\r
-{\r
-  int i;\r
-\r
-  /* Create subobject in permanent pool */\r
-  cinfo->marker = (struct jpeg_marker_reader *)\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,\r
-                               SIZEOF(struct jpeg_marker_reader));\r
-  /* Initialize method pointers */\r
-  cinfo->marker->reset_marker_reader = reset_marker_reader;\r
-  cinfo->marker->read_markers = read_markers;\r
-  cinfo->marker->read_restart_marker = read_restart_marker;\r
-  cinfo->marker->process_COM = skip_variable;\r
-  for (i = 0; i < 16; i++)\r
-    cinfo->marker->process_APPn[i] = skip_variable;\r
-  cinfo->marker->process_APPn[0] = get_app0;\r
-  cinfo->marker->process_APPn[14] = get_app14;\r
-  /* Reset marker processing state */\r
-  reset_marker_reader(cinfo);\r
-}\r
diff --git a/libs/jpeg6/jdmaster.cpp b/libs/jpeg6/jdmaster.cpp
deleted file mode 100644 (file)
index 9d88bb2..0000000
+++ /dev/null
@@ -1,558 +0,0 @@
-/*\r
- * jdmaster.c\r
- *\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
- * This file is part of the Independent JPEG Group's software.\r
- * For conditions of distribution and use, see the accompanying README file.\r
- *\r
- * This file contains master control logic for the JPEG decompressor.\r
- * These routines are concerned with selecting the modules to be executed\r
- * and with determining the number of passes and the work to be done in each\r
- * pass.\r
- */\r
-\r
-#define JPEG_INTERNALS\r
-#include "jinclude.h"\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-/* Private state */\r
-\r
-typedef struct {\r
-  struct jpeg_decomp_master pub; /* public fields */\r
-\r
-  int pass_number;             /* # of passes completed */\r
-\r
-  boolean using_merged_upsample; /* TRUE if using merged upsample/cconvert */\r
-\r
-  /* Saved references to initialized quantizer modules,\r
-   * in case we need to switch modes.\r
-   */\r
-  struct jpeg_color_quantizer * quantizer_1pass;\r
-  struct jpeg_color_quantizer * quantizer_2pass;\r
-} my_decomp_master;\r
-\r
-typedef my_decomp_master * my_master_ptr;\r
-\r
-\r
-/*\r
- * Determine whether merged upsample/color conversion should be used.\r
- * CRUCIAL: this must match the actual capabilities of jdmerge.c!\r
- */\r
-\r
-LOCAL boolean\r
-use_merged_upsample (j_decompress_ptr cinfo)\r
-{\r
-#ifdef UPSAMPLE_MERGING_SUPPORTED\r
-  /* Merging is the equivalent of plain box-filter upsampling */\r
-  if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)\r
-    return FALSE;\r
-  /* jdmerge.c only supports YCC=>RGB color conversion */\r
-  if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 ||\r
-      cinfo->out_color_space != JCS_RGB ||\r
-      cinfo->out_color_components != RGB_PIXELSIZE)\r
-    return FALSE;\r
-  /* and it only handles 2h1v or 2h2v sampling ratios */\r
-  if (cinfo->comp_info[0].h_samp_factor != 2 ||\r
-      cinfo->comp_info[1].h_samp_factor != 1 ||\r
-      cinfo->comp_info[2].h_samp_factor != 1 ||\r
-      cinfo->comp_info[0].v_samp_factor >  2 ||\r
-      cinfo->comp_info[1].v_samp_factor != 1 ||\r
-      cinfo->comp_info[2].v_samp_factor != 1)\r
-    return FALSE;\r
-  /* furthermore, it doesn't work if we've scaled the IDCTs differently */\r
-  if (cinfo->comp_info[0].DCT_scaled_size != cinfo->min_DCT_scaled_size ||\r
-      cinfo->comp_info[1].DCT_scaled_size != cinfo->min_DCT_scaled_size ||\r
-      cinfo->comp_info[2].DCT_scaled_size != cinfo->min_DCT_scaled_size)\r
-    return FALSE;\r
-  /* ??? also need to test for upsample-time rescaling, when & if supported */\r
-  return TRUE;                 /* by golly, it'll work... */\r
-#else\r
-  return FALSE;\r
-#endif\r
-}\r
-\r
-\r
-/*\r
- * Compute output image dimensions and related values.\r
- * NOTE: this is exported for possible use by application.\r
- * Hence it mustn't do anything that can't be done twice.\r
- * Also note that it may be called before the master module is initialized!\r
- */\r
-\r
-GLOBAL void\r
-jpeg_calc_output_dimensions (j_decompress_ptr cinfo)\r
-/* Do computations that are needed before master selection phase */\r
-{\r
-#if 0  // JDC: commented out to remove warning\r
-  int ci;\r
-  jpeg_component_info *compptr;\r
-#endif\r
-\r
-  /* Prevent application from calling me at wrong times */\r
-  if (cinfo->global_state != DSTATE_READY)\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-#ifdef IDCT_SCALING_SUPPORTED\r
-\r
-  /* Compute actual output image dimensions and DCT scaling choices. */\r
-  if (cinfo->scale_num * 8 <= cinfo->scale_denom) {\r
-    /* Provide 1/8 scaling */\r
-    cinfo->output_width = (JDIMENSION)\r
-      jdiv_round_up((long) cinfo->image_width, 8L);\r
-    cinfo->output_height = (JDIMENSION)\r
-      jdiv_round_up((long) cinfo->image_height, 8L);\r
-    cinfo->min_DCT_scaled_size = 1;\r
-  } else if (cinfo->scale_num * 4 <= cinfo->scale_denom) {\r
-    /* Provide 1/4 scaling */\r
-    cinfo->output_width = (JDIMENSION)\r
-      jdiv_round_up((long) cinfo->image_width, 4L);\r
-    cinfo->output_height = (JDIMENSION)\r
-      jdiv_round_up((long) cinfo->image_height, 4L);\r
-    cinfo->min_DCT_scaled_size = 2;\r
-  } else if (cinfo->scale_num * 2 <= cinfo->scale_denom) {\r
-    /* Provide 1/2 scaling */\r
-    cinfo->output_width = (JDIMENSION)\r
-      jdiv_round_up((long) cinfo->image_width, 2L);\r
-    cinfo->output_height = (JDIMENSION)\r
-      jdiv_round_up((long) cinfo->image_height, 2L);\r
-    cinfo->min_DCT_scaled_size = 4;\r
-  } else {\r
-    /* Provide 1/1 scaling */\r
-    cinfo->output_width = cinfo->image_width;\r
-    cinfo->output_height = cinfo->image_height;\r
-    cinfo->min_DCT_scaled_size = DCTSIZE;\r
-  }\r
-  /* In selecting the actual DCT scaling for each component, we try to\r
-   * scale up the chroma components via IDCT scaling rather than upsampling.\r
-   * This saves time if the upsampler gets to use 1:1 scaling.\r
-   * Note this code assumes that the supported DCT scalings are powers of 2.\r
-   */\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-       ci++, compptr++) {\r
-    int ssize = cinfo->min_DCT_scaled_size;\r
-    while (ssize < DCTSIZE &&\r
-          (compptr->h_samp_factor * ssize * 2 <=\r
-           cinfo->max_h_samp_factor * cinfo->min_DCT_scaled_size) &&\r
-          (compptr->v_samp_factor * ssize * 2 <=\r
-           cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size)) {\r
-      ssize = ssize * 2;\r
-    }\r
-    compptr->DCT_scaled_size = ssize;\r
-  }\r
-\r
-  /* Recompute downsampled dimensions of components;\r
-   * application needs to know these if using raw downsampled data.\r
-   */\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-       ci++, compptr++) {\r
-    /* Size in samples, after IDCT scaling */\r
-    compptr->downsampled_width = (JDIMENSION)\r
-      jdiv_round_up((long) cinfo->image_width *\r
-                   (long) (compptr->h_samp_factor * compptr->DCT_scaled_size),\r
-                   (long) (cinfo->max_h_samp_factor * DCTSIZE));\r
-    compptr->downsampled_height = (JDIMENSION)\r
-      jdiv_round_up((long) cinfo->image_height *\r
-                   (long) (compptr->v_samp_factor * compptr->DCT_scaled_size),\r
-                   (long) (cinfo->max_v_samp_factor * DCTSIZE));\r
-  }\r
-\r
-#else /* !IDCT_SCALING_SUPPORTED */\r
-\r
-  /* Hardwire it to "no scaling" */\r
-  cinfo->output_width = cinfo->image_width;\r
-  cinfo->output_height = cinfo->image_height;\r
-  /* jdinput.c has already initialized DCT_scaled_size to DCTSIZE,\r
-   * and has computed unscaled downsampled_width and downsampled_height.\r
-   */\r
-\r
-#endif /* IDCT_SCALING_SUPPORTED */\r
-\r
-  /* Report number of components in selected colorspace. */\r
-  /* Probably this should be in the color conversion module... */\r
-  switch (cinfo->out_color_space) {\r
-  case JCS_GRAYSCALE:\r
-    cinfo->out_color_components = 1;\r
-    break;\r
-  case JCS_RGB:\r
-#if RGB_PIXELSIZE != 3\r
-    cinfo->out_color_components = RGB_PIXELSIZE;\r
-    break;\r
-#endif /* else share code with YCbCr */\r
-  case JCS_YCbCr:\r
-    cinfo->out_color_components = 3;\r
-    break;\r
-  case JCS_CMYK:\r
-  case JCS_YCCK:\r
-    cinfo->out_color_components = 4;\r
-    break;\r
-  default:                     /* else must be same colorspace as in file */\r
-    cinfo->out_color_components = cinfo->num_components;\r
-    break;\r
-  }\r
-  cinfo->output_components = (cinfo->quantize_colors ? 1 :\r
-                             cinfo->out_color_components);\r
-\r
-  /* See if upsampler will want to emit more than one row at a time */\r
-  if (use_merged_upsample(cinfo))\r
-    cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;\r
-  else\r
-    cinfo->rec_outbuf_height = 1;\r
-}\r
-\r
-\r
-/*\r
- * Several decompression processes need to range-limit values to the range\r
- * 0..MAXJSAMPLE; the input value may fall somewhat outside this range\r
- * due to noise introduced by quantization, roundoff error, etc.  These\r
- * processes are inner loops and need to be as fast as possible.  On most\r
- * machines, particularly CPUs with pipelines or instruction prefetch,\r
- * a (subscript-check-less) C table lookup\r
- *             x = sample_range_limit[x];\r
- * is faster than explicit tests\r
- *             if (x < 0)  x = 0;\r
- *             else if (x > MAXJSAMPLE)  x = MAXJSAMPLE;\r
- * These processes all use a common table prepared by the routine below.\r
- *\r
- * For most steps we can mathematically guarantee that the initial value\r
- * of x is within MAXJSAMPLE+1 of the legal range, so a table running from\r
- * -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient.  But for the initial\r
- * limiting step (just after the IDCT), a wildly out-of-range value is \r
- * possible if the input data is corrupt.  To avoid any chance of indexing\r
- * off the end of memory and getting a bad-pointer trap, we perform the\r
- * post-IDCT limiting thus:\r
- *             x = range_limit[x & MASK];\r
- * where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit\r
- * samples.  Under normal circumstances this is more than enough range and\r
- * a correct output will be generated; with bogus input data the mask will\r
- * cause wraparound, and we will safely generate a bogus-but-in-range output.\r
- * For the post-IDCT step, we want to convert the data from signed to unsigned\r
- * representation by adding CENTERJSAMPLE at the same time that we limit it.\r
- * So the post-IDCT limiting table ends up looking like this:\r
- *   CENTERJSAMPLE,CENTERJSAMPLE+1,...,MAXJSAMPLE,\r
- *   MAXJSAMPLE (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times),\r
- *   0          (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times),\r
- *   0,1,...,CENTERJSAMPLE-1\r
- * Negative inputs select values from the upper half of the table after\r
- * masking.\r
- *\r
- * We can save some space by overlapping the start of the post-IDCT table\r
- * with the simpler range limiting table.  The post-IDCT table begins at\r
- * sample_range_limit + CENTERJSAMPLE.\r
- *\r
- * Note that the table is allocated in near data space on PCs; it's small\r
- * enough and used often enough to justify this.\r
- */\r
-\r
-LOCAL void\r
-prepare_range_limit_table (j_decompress_ptr cinfo)\r
-/* Allocate and fill in the sample_range_limit table */\r
-{\r
-  JSAMPLE * table;\r
-  int i;\r
-\r
-  table = (JSAMPLE *)\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-               (5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE));\r
-  table += (MAXJSAMPLE+1);     /* allow negative subscripts of simple table */\r
-  cinfo->sample_range_limit = table;\r
-  /* First segment of "simple" table: limit[x] = 0 for x < 0 */\r
-  MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));\r
-  /* Main part of "simple" table: limit[x] = x */\r
-  for (i = 0; i <= MAXJSAMPLE; i++)\r
-    table[i] = (JSAMPLE) i;\r
-  table += CENTERJSAMPLE;      /* Point to where post-IDCT table starts */\r
-  /* End of simple table, rest of first half of post-IDCT table */\r
-  for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++)\r
-    table[i] = MAXJSAMPLE;\r
-  /* Second half of post-IDCT table */\r
-  MEMZERO(table + (2 * (MAXJSAMPLE+1)),\r
-         (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE));\r
-  MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE),\r
-         cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE));\r
-}\r
-\r
-\r
-/*\r
- * Master selection of decompression modules.\r
- * This is done once at jpeg_start_decompress time.  We determine\r
- * which modules will be used and give them appropriate initialization calls.\r
- * We also initialize the decompressor input side to begin consuming data.\r
- *\r
- * Since jpeg_read_header has finished, we know what is in the SOF\r
- * and (first) SOS markers.  We also have all the application parameter\r
- * settings.\r
- */\r
-\r
-LOCAL void\r
-master_selection (j_decompress_ptr cinfo)\r
-{\r
-  my_master_ptr master = (my_master_ptr) cinfo->master;\r
-  boolean use_c_buffer;\r
-  long samplesperrow;\r
-  JDIMENSION jd_samplesperrow;\r
-\r
-  /* Initialize dimensions and other stuff */\r
-  jpeg_calc_output_dimensions(cinfo);\r
-  prepare_range_limit_table(cinfo);\r
-\r
-  /* Width of an output scanline must be representable as JDIMENSION. */\r
-  samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components;\r
-  jd_samplesperrow = (JDIMENSION) samplesperrow;\r
-  if ((long) jd_samplesperrow != samplesperrow)\r
-    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);\r
-\r
-  /* Initialize my private state */\r
-  master->pass_number = 0;\r
-  master->using_merged_upsample = use_merged_upsample(cinfo);\r
-\r
-  /* Color quantizer selection */\r
-  master->quantizer_1pass = NULL;\r
-  master->quantizer_2pass = NULL;\r
-  /* No mode changes if not using buffered-image mode. */\r
-  if (! cinfo->quantize_colors || ! cinfo->buffered_image) {\r
-    cinfo->enable_1pass_quant = FALSE;\r
-    cinfo->enable_external_quant = FALSE;\r
-    cinfo->enable_2pass_quant = FALSE;\r
-  }\r
-  if (cinfo->quantize_colors) {\r
-    if (cinfo->raw_data_out)\r
-      ERREXIT(cinfo, JERR_NOTIMPL);\r
-    /* 2-pass quantizer only works in 3-component color space. */\r
-    if (cinfo->out_color_components != 3) {\r
-      cinfo->enable_1pass_quant = TRUE;\r
-      cinfo->enable_external_quant = FALSE;\r
-      cinfo->enable_2pass_quant = FALSE;\r
-      cinfo->colormap = NULL;\r
-    } else if (cinfo->colormap != NULL) {\r
-      cinfo->enable_external_quant = TRUE;\r
-    } else if (cinfo->two_pass_quantize) {\r
-      cinfo->enable_2pass_quant = TRUE;\r
-    } else {\r
-      cinfo->enable_1pass_quant = TRUE;\r
-    }\r
-\r
-    if (cinfo->enable_1pass_quant) {\r
-#ifdef QUANT_1PASS_SUPPORTED\r
-      jinit_1pass_quantizer(cinfo);\r
-      master->quantizer_1pass = cinfo->cquantize;\r
-#else\r
-      ERREXIT(cinfo, JERR_NOT_COMPILED);\r
-#endif\r
-    }\r
-\r
-    /* We use the 2-pass code to map to external colormaps. */\r
-    if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) {\r
-#ifdef QUANT_2PASS_SUPPORTED\r
-      jinit_2pass_quantizer(cinfo);\r
-      master->quantizer_2pass = cinfo->cquantize;\r
-#else\r
-      ERREXIT(cinfo, JERR_NOT_COMPILED);\r
-#endif\r
-    }\r
-    /* If both quantizers are initialized, the 2-pass one is left active;\r
-     * this is necessary for starting with quantization to an external map.\r
-     */\r
-  }\r
-\r
-  /* Post-processing: in particular, color conversion first */\r
-  if (! cinfo->raw_data_out) {\r
-    if (master->using_merged_upsample) {\r
-#ifdef UPSAMPLE_MERGING_SUPPORTED\r
-      jinit_merged_upsampler(cinfo); /* does color conversion too */\r
-#else\r
-      ERREXIT(cinfo, JERR_NOT_COMPILED);\r
-#endif\r
-    } else {\r
-      jinit_color_deconverter(cinfo);\r
-      jinit_upsampler(cinfo);\r
-    }\r
-    jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant);\r
-  }\r
-  /* Inverse DCT */\r
-  jinit_inverse_dct(cinfo);\r
-  /* Entropy decoding: either Huffman or arithmetic coding. */\r
-  if (cinfo->arith_code) {\r
-    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);\r
-  } else {\r
-    if (cinfo->progressive_mode) {\r
-#ifdef D_PROGRESSIVE_SUPPORTED\r
-      jinit_phuff_decoder(cinfo);\r
-#else\r
-      ERREXIT(cinfo, JERR_NO_PROGRESSIVE);\r
-#endif\r
-    } else\r
-      jinit_huff_decoder(cinfo);\r
-  }\r
-\r
-  /* Initialize principal buffer controllers. */\r
-  use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image;\r
-  jinit_d_coef_controller(cinfo, use_c_buffer);\r
-\r
-  if (! cinfo->raw_data_out)\r
-    jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);\r
-\r
-  /* We can now tell the memory manager to allocate virtual arrays. */\r
-  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);\r
-\r
-  /* Initialize input side of decompressor to consume first scan. */\r
-  (*cinfo->inputctl->start_input_pass) (cinfo);\r
-\r
-#ifdef D_MULTISCAN_FILES_SUPPORTED\r
-  /* If jpeg_start_decompress will read the whole file, initialize\r
-   * progress monitoring appropriately.  The input step is counted\r
-   * as one pass.\r
-   */\r
-  if (cinfo->progress != NULL && ! cinfo->buffered_image &&\r
-      cinfo->inputctl->has_multiple_scans) {\r
-    int nscans;\r
-    /* Estimate number of scans to set pass_limit. */\r
-    if (cinfo->progressive_mode) {\r
-      /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */\r
-      nscans = 2 + 3 * cinfo->num_components;\r
-    } else {\r
-      /* For a nonprogressive multiscan file, estimate 1 scan per component. */\r
-      nscans = cinfo->num_components;\r
-    }\r
-    cinfo->progress->pass_counter = 0L;\r
-    cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;\r
-    cinfo->progress->completed_passes = 0;\r
-    cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);\r
-    /* Count the input pass as done */\r
-    master->pass_number++;\r
-  }\r
-#endif /* D_MULTISCAN_FILES_SUPPORTED */\r
-}\r
-\r
-\r
-/*\r
- * Per-pass setup.\r
- * This is called at the beginning of each output pass.  We determine which\r
- * modules will be active during this pass and give them appropriate\r
- * start_pass calls.  We also set is_dummy_pass to indicate whether this\r
- * is a "real" output pass or a dummy pass for color quantization.\r
- * (In the latter case, jdapi.c will crank the pass to completion.)\r
- */\r
-\r
-METHODDEF void\r
-prepare_for_output_pass (j_decompress_ptr cinfo)\r
-{\r
-  my_master_ptr master = (my_master_ptr) cinfo->master;\r
-\r
-  if (master->pub.is_dummy_pass) {\r
-#ifdef QUANT_2PASS_SUPPORTED\r
-    /* Final pass of 2-pass quantization */\r
-    master->pub.is_dummy_pass = FALSE;\r
-    (*cinfo->cquantize->start_pass) (cinfo, FALSE);\r
-    (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST);\r
-    (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST);\r
-#else\r
-    ERREXIT(cinfo, JERR_NOT_COMPILED);\r
-#endif /* QUANT_2PASS_SUPPORTED */\r
-  } else {\r
-    if (cinfo->quantize_colors && cinfo->colormap == NULL) {\r
-      /* Select new quantization method */\r
-      if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) {\r
-       cinfo->cquantize = master->quantizer_2pass;\r
-       master->pub.is_dummy_pass = TRUE;\r
-      } else if (cinfo->enable_1pass_quant) {\r
-       cinfo->cquantize = master->quantizer_1pass;\r
-      } else {\r
-       ERREXIT(cinfo, JERR_MODE_CHANGE);\r
-      }\r
-    }\r
-    (*cinfo->idct->start_pass) (cinfo);\r
-    (*cinfo->coef->start_output_pass) (cinfo);\r
-    if (! cinfo->raw_data_out) {\r
-      if (! master->using_merged_upsample)\r
-       (*cinfo->cconvert->start_pass) (cinfo);\r
-      (*cinfo->upsample->start_pass) (cinfo);\r
-      if (cinfo->quantize_colors)\r
-       (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass);\r
-      (*cinfo->post->start_pass) (cinfo,\r
-           (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));\r
-      (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);\r
-    }\r
-  }\r
-\r
-  /* Set up progress monitor's pass info if present */\r
-  if (cinfo->progress != NULL) {\r
-    cinfo->progress->completed_passes = master->pass_number;\r
-    cinfo->progress->total_passes = master->pass_number +\r
-                                   (master->pub.is_dummy_pass ? 2 : 1);\r
-    /* In buffered-image mode, we assume one more output pass if EOI not\r
-     * yet reached, but no more passes if EOI has been reached.\r
-     */\r
-    if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) {\r
-      cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1);\r
-    }\r
-  }\r
-}\r
-\r
-\r
-/*\r
- * Finish up at end of an output pass.\r
- */\r
-\r
-METHODDEF void\r
-finish_output_pass (j_decompress_ptr cinfo)\r
-{\r
-  my_master_ptr master = (my_master_ptr) cinfo->master;\r
-\r
-  if (cinfo->quantize_colors)\r
-    (*cinfo->cquantize->finish_pass) (cinfo);\r
-  master->pass_number++;\r
-}\r
-\r
-\r
-#ifdef D_MULTISCAN_FILES_SUPPORTED\r
-\r
-/*\r
- * Switch to a new external colormap between output passes.\r
- */\r
-\r
-GLOBAL void\r
-jpeg_new_colormap (j_decompress_ptr cinfo)\r
-{\r
-  my_master_ptr master = (my_master_ptr) cinfo->master;\r
-\r
-  /* Prevent application from calling me at wrong times */\r
-  if (cinfo->global_state != DSTATE_BUFIMAGE)\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-  if (cinfo->quantize_colors && cinfo->enable_external_quant &&\r
-      cinfo->colormap != NULL) {\r
-    /* Select 2-pass quantizer for external colormap use */\r
-    cinfo->cquantize = master->quantizer_2pass;\r
-    /* Notify quantizer of colormap change */\r
-    (*cinfo->cquantize->new_color_map) (cinfo);\r
-    master->pub.is_dummy_pass = FALSE; /* just in case */\r
-  } else\r
-    ERREXIT(cinfo, JERR_MODE_CHANGE);\r
-}\r
-\r
-#endif /* D_MULTISCAN_FILES_SUPPORTED */\r
-\r
-\r
-/*\r
- * Initialize master decompression control and select active modules.\r
- * This is performed at the start of jpeg_start_decompress.\r
- */\r
-\r
-GLOBAL void\r
-jinit_master_decompress (j_decompress_ptr cinfo)\r
-{\r
-  my_master_ptr master;\r
-\r
-  master = (my_master_ptr)\r
-      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-                                 SIZEOF(my_decomp_master));\r
-  cinfo->master = (struct jpeg_decomp_master *) master;\r
-  master->pub.prepare_for_output_pass = prepare_for_output_pass;\r
-  master->pub.finish_output_pass = finish_output_pass;\r
-\r
-  master->pub.is_dummy_pass = FALSE;\r
-\r
-  master_selection(cinfo);\r
-}\r
-\r
diff --git a/libs/jpeg6/jdpostct.cpp b/libs/jpeg6/jdpostct.cpp
deleted file mode 100644 (file)
index 3aba0a3..0000000
+++ /dev/null
@@ -1,580 +0,0 @@
-/*\r
-\r
- * jdpostct.c\r
-\r
- *\r
-\r
- * Copyright (C) 1994-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains the decompression postprocessing controller.\r
-\r
- * This controller manages the upsampling, color conversion, and color\r
-\r
- * quantization/reduction steps; specifically, it controls the buffering\r
-\r
- * between upsample/color conversion and color quantization/reduction.\r
-\r
- *\r
-\r
- * If no color quantization/reduction is required, then this module has no\r
-\r
- * work to do, and it just hands off to the upsample/color conversion code.\r
-\r
- * An integrated upsample/convert/quantize process would replace this module\r
-\r
- * entirely.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-\r
-\r
-/* Private buffer controller object */\r
-\r
-\r
-\r
-typedef struct {\r
-\r
-  struct jpeg_d_post_controller pub; /* public fields */\r
-\r
-\r
-\r
-  /* Color quantization source buffer: this holds output data from\r
-\r
-   * the upsample/color conversion step to be passed to the quantizer.\r
-\r
-   * For two-pass color quantization, we need a full-image buffer;\r
-\r
-   * for one-pass operation, a strip buffer is sufficient.\r
-\r
-   */\r
-\r
-  jvirt_sarray_ptr whole_image;        /* virtual array, or NULL if one-pass */\r
-\r
-  JSAMPARRAY buffer;           /* strip buffer, or current strip of virtual */\r
-\r
-  JDIMENSION strip_height;     /* buffer size in rows */\r
-\r
-  /* for two-pass mode only: */\r
-\r
-  JDIMENSION starting_row;     /* row # of first row in current strip */\r
-\r
-  JDIMENSION next_row;         /* index of next row to fill/empty in strip */\r
-\r
-} my_post_controller;\r
-\r
-\r
-\r
-typedef my_post_controller * my_post_ptr;\r
-\r
-\r
-\r
-\r
-\r
-/* Forward declarations */\r
-\r
-METHODDEF void post_process_1pass\r
-\r
-       JPP((j_decompress_ptr cinfo,\r
-\r
-            JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,\r
-\r
-            JDIMENSION in_row_groups_avail,\r
-\r
-            JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,\r
-\r
-            JDIMENSION out_rows_avail));\r
-\r
-#ifdef QUANT_2PASS_SUPPORTED\r
-\r
-METHODDEF void post_process_prepass\r
-\r
-       JPP((j_decompress_ptr cinfo,\r
-\r
-            JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,\r
-\r
-            JDIMENSION in_row_groups_avail,\r
-\r
-            JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,\r
-\r
-            JDIMENSION out_rows_avail));\r
-\r
-METHODDEF void post_process_2pass\r
-\r
-       JPP((j_decompress_ptr cinfo,\r
-\r
-            JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,\r
-\r
-            JDIMENSION in_row_groups_avail,\r
-\r
-            JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,\r
-\r
-            JDIMENSION out_rows_avail));\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize for a processing pass.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)\r
-\r
-{\r
-\r
-  my_post_ptr post = (my_post_ptr) cinfo->post;\r
-\r
-\r
-\r
-  switch (pass_mode) {\r
-\r
-  case JBUF_PASS_THRU:\r
-\r
-    if (cinfo->quantize_colors) {\r
-\r
-      /* Single-pass processing with color quantization. */\r
-\r
-      post->pub.post_process_data = post_process_1pass;\r
-\r
-      /* We could be doing buffered-image output before starting a 2-pass\r
-\r
-       * color quantization; in that case, jinit_d_post_controller did not\r
-\r
-       * allocate a strip buffer.  Use the virtual-array buffer as workspace.\r
-\r
-       */\r
-\r
-      if (post->buffer == NULL) {\r
-\r
-       post->buffer = (*cinfo->mem->access_virt_sarray)\r
-\r
-         ((j_common_ptr) cinfo, post->whole_image,\r
-\r
-          (JDIMENSION) 0, post->strip_height, TRUE);\r
-\r
-      }\r
-\r
-    } else {\r
-\r
-      /* For single-pass processing without color quantization,\r
-\r
-       * I have no work to do; just call the upsampler directly.\r
-\r
-       */\r
-\r
-      post->pub.post_process_data = cinfo->upsample->upsample;\r
-\r
-    }\r
-\r
-    break;\r
-\r
-#ifdef QUANT_2PASS_SUPPORTED\r
-\r
-  case JBUF_SAVE_AND_PASS:\r
-\r
-    /* First pass of 2-pass quantization */\r
-\r
-    if (post->whole_image == NULL)\r
-\r
-      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);\r
-\r
-    post->pub.post_process_data = post_process_prepass;\r
-\r
-    break;\r
-\r
-  case JBUF_CRANK_DEST:\r
-\r
-    /* Second pass of 2-pass quantization */\r
-\r
-    if (post->whole_image == NULL)\r
-\r
-      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);\r
-\r
-    post->pub.post_process_data = post_process_2pass;\r
-\r
-    break;\r
-\r
-#endif /* QUANT_2PASS_SUPPORTED */\r
-\r
-  default:\r
-\r
-    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);\r
-\r
-    break;\r
-\r
-  }\r
-\r
-  post->starting_row = post->next_row = 0;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Process some data in the one-pass (strip buffer) case.\r
-\r
- * This is used for color precision reduction as well as one-pass quantization.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-post_process_1pass (j_decompress_ptr cinfo,\r
-\r
-                   JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,\r
-\r
-                   JDIMENSION in_row_groups_avail,\r
-\r
-                   JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,\r
-\r
-                   JDIMENSION out_rows_avail)\r
-\r
-{\r
-\r
-  my_post_ptr post = (my_post_ptr) cinfo->post;\r
-\r
-  JDIMENSION num_rows, max_rows;\r
-\r
-\r
-\r
-  /* Fill the buffer, but not more than what we can dump out in one go. */\r
-\r
-  /* Note we rely on the upsampler to detect bottom of image. */\r
-\r
-  max_rows = out_rows_avail - *out_row_ctr;\r
-\r
-  if (max_rows > post->strip_height)\r
-\r
-    max_rows = post->strip_height;\r
-\r
-  num_rows = 0;\r
-\r
-  (*cinfo->upsample->upsample) (cinfo,\r
-\r
-               input_buf, in_row_group_ctr, in_row_groups_avail,\r
-\r
-               post->buffer, &num_rows, max_rows);\r
-\r
-  /* Quantize and emit data. */\r
-\r
-  (*cinfo->cquantize->color_quantize) (cinfo,\r
-\r
-               post->buffer, output_buf + *out_row_ctr, (int) num_rows);\r
-\r
-  *out_row_ctr += num_rows;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-#ifdef QUANT_2PASS_SUPPORTED\r
-\r
-\r
-\r
-/*\r
-\r
- * Process some data in the first pass of 2-pass quantization.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-post_process_prepass (j_decompress_ptr cinfo,\r
-\r
-                     JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,\r
-\r
-                     JDIMENSION in_row_groups_avail,\r
-\r
-                     JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,\r
-\r
-                     JDIMENSION out_rows_avail)\r
-\r
-{\r
-\r
-  my_post_ptr post = (my_post_ptr) cinfo->post;\r
-\r
-  JDIMENSION old_next_row, num_rows;\r
-\r
-\r
-\r
-  /* Reposition virtual buffer if at start of strip. */\r
-\r
-  if (post->next_row == 0) {\r
-\r
-    post->buffer = (*cinfo->mem->access_virt_sarray)\r
-\r
-       ((j_common_ptr) cinfo, post->whole_image,\r
-\r
-        post->starting_row, post->strip_height, TRUE);\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Upsample some data (up to a strip height's worth). */\r
-\r
-  old_next_row = post->next_row;\r
-\r
-  (*cinfo->upsample->upsample) (cinfo,\r
-\r
-               input_buf, in_row_group_ctr, in_row_groups_avail,\r
-\r
-               post->buffer, &post->next_row, post->strip_height);\r
-\r
-\r
-\r
-  /* Allow quantizer to scan new data.  No data is emitted, */\r
-\r
-  /* but we advance out_row_ctr so outer loop can tell when we're done. */\r
-\r
-  if (post->next_row > old_next_row) {\r
-\r
-    num_rows = post->next_row - old_next_row;\r
-\r
-    (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + old_next_row,\r
-\r
-                                        (JSAMPARRAY) NULL, (int) num_rows);\r
-\r
-    *out_row_ctr += num_rows;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Advance if we filled the strip. */\r
-\r
-  if (post->next_row >= post->strip_height) {\r
-\r
-    post->starting_row += post->strip_height;\r
-\r
-    post->next_row = 0;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Process some data in the second pass of 2-pass quantization.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-post_process_2pass (j_decompress_ptr cinfo,\r
-\r
-                   JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,\r
-\r
-                   JDIMENSION in_row_groups_avail,\r
-\r
-                   JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,\r
-\r
-                   JDIMENSION out_rows_avail)\r
-\r
-{\r
-\r
-  my_post_ptr post = (my_post_ptr) cinfo->post;\r
-\r
-  JDIMENSION num_rows, max_rows;\r
-\r
-\r
-\r
-  /* Reposition virtual buffer if at start of strip. */\r
-\r
-  if (post->next_row == 0) {\r
-\r
-    post->buffer = (*cinfo->mem->access_virt_sarray)\r
-\r
-       ((j_common_ptr) cinfo, post->whole_image,\r
-\r
-        post->starting_row, post->strip_height, FALSE);\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Determine number of rows to emit. */\r
-\r
-  num_rows = post->strip_height - post->next_row; /* available in strip */\r
-\r
-  max_rows = out_rows_avail - *out_row_ctr; /* available in output area */\r
-\r
-  if (num_rows > max_rows)\r
-\r
-    num_rows = max_rows;\r
-\r
-  /* We have to check bottom of image here, can't depend on upsampler. */\r
-\r
-  max_rows = cinfo->output_height - post->starting_row;\r
-\r
-  if (num_rows > max_rows)\r
-\r
-    num_rows = max_rows;\r
-\r
-\r
-\r
-  /* Quantize and emit data. */\r
-\r
-  (*cinfo->cquantize->color_quantize) (cinfo,\r
-\r
-               post->buffer + post->next_row, output_buf + *out_row_ctr,\r
-\r
-               (int) num_rows);\r
-\r
-  *out_row_ctr += num_rows;\r
-\r
-\r
-\r
-  /* Advance if we filled the strip. */\r
-\r
-  post->next_row += num_rows;\r
-\r
-  if (post->next_row >= post->strip_height) {\r
-\r
-    post->starting_row += post->strip_height;\r
-\r
-    post->next_row = 0;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-#endif /* QUANT_2PASS_SUPPORTED */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize postprocessing controller.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer)\r
-\r
-{\r
-\r
-  my_post_ptr post;\r
-\r
-\r
-\r
-  post = (my_post_ptr)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                               SIZEOF(my_post_controller));\r
-\r
-  cinfo->post = (struct jpeg_d_post_controller *) post;\r
-\r
-  post->pub.start_pass = start_pass_dpost;\r
-\r
-  post->whole_image = NULL;    /* flag for no virtual arrays */\r
-\r
-  post->buffer = NULL;         /* flag for no strip buffer */\r
-\r
-\r
-\r
-  /* Create the quantization buffer, if needed */\r
-\r
-  if (cinfo->quantize_colors) {\r
-\r
-    /* The buffer strip height is max_v_samp_factor, which is typically\r
-\r
-     * an efficient number of rows for upsampling to return.\r
-\r
-     * (In the presence of output rescaling, we might want to be smarter?)\r
-\r
-     */\r
-\r
-    post->strip_height = (JDIMENSION) cinfo->max_v_samp_factor;\r
-\r
-    if (need_full_buffer) {\r
-\r
-      /* Two-pass color quantization: need full-image storage. */\r
-\r
-      /* We round up the number of rows to a multiple of the strip height. */\r
-\r
-#ifdef QUANT_2PASS_SUPPORTED\r
-\r
-      post->whole_image = (*cinfo->mem->request_virt_sarray)\r
-\r
-       ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,\r
-\r
-        cinfo->output_width * cinfo->out_color_components,\r
-\r
-        (JDIMENSION) jround_up((long) cinfo->output_height,\r
-\r
-                               (long) post->strip_height),\r
-\r
-        post->strip_height);\r
-\r
-#else\r
-\r
-      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);\r
-\r
-#endif /* QUANT_2PASS_SUPPORTED */\r
-\r
-    } else {\r
-\r
-      /* One-pass color quantization: just make a strip buffer. */\r
-\r
-      post->buffer = (*cinfo->mem->alloc_sarray)\r
-\r
-       ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-        cinfo->output_width * cinfo->out_color_components,\r
-\r
-        post->strip_height);\r
-\r
-    }\r
-\r
-  }\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jdsample.cpp b/libs/jpeg6/jdsample.cpp
deleted file mode 100644 (file)
index a15e252..0000000
+++ /dev/null
@@ -1,956 +0,0 @@
-/*\r
-\r
- * jdsample.c\r
-\r
- *\r
-\r
- * Copyright (C) 1991-1994, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains upsampling routines.\r
-\r
- *\r
-\r
- * Upsampling input data is counted in "row groups".  A row group\r
-\r
- * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size)\r
-\r
- * sample rows of each component.  Upsampling will normally produce\r
-\r
- * max_v_samp_factor pixel rows from each row group (but this could vary\r
-\r
- * if the upsampler is applying a scale factor of its own).\r
-\r
- *\r
-\r
- * An excellent reference for image resampling is\r
-\r
- *   Digital Image Warping, George Wolberg, 1990.\r
-\r
- *   Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-\r
-\r
-/* Pointer to routine to upsample a single component */\r
-\r
-typedef JMETHOD(void, upsample1_ptr,\r
-\r
-               (j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-                JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr));\r
-\r
-\r
-\r
-/* Private subobject */\r
-\r
-\r
-\r
-typedef struct {\r
-\r
-  struct jpeg_upsampler pub;   /* public fields */\r
-\r
-\r
-\r
-  /* Color conversion buffer.  When using separate upsampling and color\r
-\r
-   * conversion steps, this buffer holds one upsampled row group until it\r
-\r
-   * has been color converted and output.\r
-\r
-   * Note: we do not allocate any storage for component(s) which are full-size,\r
-\r
-   * ie do not need rescaling.  The corresponding entry of color_buf[] is\r
-\r
-   * simply set to point to the input data array, thereby avoiding copying.\r
-\r
-   */\r
-\r
-  JSAMPARRAY color_buf[MAX_COMPONENTS];\r
-\r
-\r
-\r
-  /* Per-component upsampling method pointers */\r
-\r
-  upsample1_ptr methods[MAX_COMPONENTS];\r
-\r
-\r
-\r
-  int next_row_out;            /* counts rows emitted from color_buf */\r
-\r
-  JDIMENSION rows_to_go;       /* counts rows remaining in image */\r
-\r
-\r
-\r
-  /* Height of an input row group for each component. */\r
-\r
-  int rowgroup_height[MAX_COMPONENTS];\r
-\r
-\r
-\r
-  /* These arrays save pixel expansion factors so that int_expand need not\r
-\r
-   * recompute them each time.  They are unused for other upsampling methods.\r
-\r
-   */\r
-\r
-  UINT8 h_expand[MAX_COMPONENTS];\r
-\r
-  UINT8 v_expand[MAX_COMPONENTS];\r
-\r
-} my_upsampler;\r
-\r
-\r
-\r
-typedef my_upsampler * my_upsample_ptr;\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Initialize for an upsampling pass.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-start_pass_upsample (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;\r
-\r
-\r
-\r
-  /* Mark the conversion buffer empty */\r
-\r
-  upsample->next_row_out = cinfo->max_v_samp_factor;\r
-\r
-  /* Initialize total-height counter for detecting bottom of image */\r
-\r
-  upsample->rows_to_go = cinfo->output_height;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Control routine to do upsampling (and color conversion).\r
-\r
- *\r
-\r
- * In this version we upsample each component independently.\r
-\r
- * We upsample one row group into the conversion buffer, then apply\r
-\r
- * color conversion a row at a time.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-sep_upsample (j_decompress_ptr cinfo,\r
-\r
-             JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,\r
-\r
-             JDIMENSION in_row_groups_avail,\r
-\r
-             JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,\r
-\r
-             JDIMENSION out_rows_avail)\r
-\r
-{\r
-\r
-  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;\r
-\r
-  int ci;\r
-\r
-  jpeg_component_info * compptr;\r
-\r
-  JDIMENSION num_rows;\r
-\r
-\r
-\r
-  /* Fill the conversion buffer, if it's empty */\r
-\r
-  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {\r
-\r
-    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-        ci++, compptr++) {\r
-\r
-      /* Invoke per-component upsample method.  Notice we pass a POINTER\r
-\r
-       * to color_buf[ci], so that fullsize_upsample can change it.\r
-\r
-       */\r
-\r
-      (*upsample->methods[ci]) (cinfo, compptr,\r
-\r
-       input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),\r
-\r
-       upsample->color_buf + ci);\r
-\r
-    }\r
-\r
-    upsample->next_row_out = 0;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Color-convert and emit rows */\r
-\r
-\r
-\r
-  /* How many we have in the buffer: */\r
-\r
-  num_rows = (JDIMENSION) (cinfo->max_v_samp_factor - upsample->next_row_out);\r
-\r
-  /* Not more than the distance to the end of the image.  Need this test\r
-\r
-   * in case the image height is not a multiple of max_v_samp_factor:\r
-\r
-   */\r
-\r
-  if (num_rows > upsample->rows_to_go) \r
-\r
-    num_rows = upsample->rows_to_go;\r
-\r
-  /* And not more than what the client can accept: */\r
-\r
-  out_rows_avail -= *out_row_ctr;\r
-\r
-  if (num_rows > out_rows_avail)\r
-\r
-    num_rows = out_rows_avail;\r
-\r
-\r
-\r
-  (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf,\r
-\r
-                                    (JDIMENSION) upsample->next_row_out,\r
-\r
-                                    output_buf + *out_row_ctr,\r
-\r
-                                    (int) num_rows);\r
-\r
-\r
-\r
-  /* Adjust counts */\r
-\r
-  *out_row_ctr += num_rows;\r
-\r
-  upsample->rows_to_go -= num_rows;\r
-\r
-  upsample->next_row_out += num_rows;\r
-\r
-  /* When the buffer is emptied, declare this input row group consumed */\r
-\r
-  if (upsample->next_row_out >= cinfo->max_v_samp_factor)\r
-\r
-    (*in_row_group_ctr)++;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * These are the routines invoked by sep_upsample to upsample pixel values\r
-\r
- * of a single component.  One row group is processed per call.\r
-\r
- */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * For full-size components, we just make color_buf[ci] point at the\r
-\r
- * input buffer, and thus avoid copying any data.  Note that this is\r
-\r
- * safe only because sep_upsample doesn't declare the input row group\r
-\r
- * "consumed" until we are done color converting and emitting it.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-                  JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)\r
-\r
-{\r
-\r
-  *output_data_ptr = input_data;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * This is a no-op version used for "uninteresting" components.\r
-\r
- * These components will not be referenced by color conversion.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-              JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)\r
-\r
-{\r
-\r
-  *output_data_ptr = NULL;     /* safety check */\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * This version handles any integral sampling ratios.\r
-\r
- * This is not used for typical JPEG files, so it need not be fast.\r
-\r
- * Nor, for that matter, is it particularly accurate: the algorithm is\r
-\r
- * simple replication of the input pixel onto the corresponding output\r
-\r
- * pixels.  The hi-falutin sampling literature refers to this as a\r
-\r
- * "box filter".  A box filter tends to introduce visible artifacts,\r
-\r
- * so if you are actually going to use 3:1 or 4:1 sampling ratios\r
-\r
- * you would be well advised to improve this code.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-             JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)\r
-\r
-{\r
-\r
-  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;\r
-\r
-  JSAMPARRAY output_data = *output_data_ptr;\r
-\r
-  register JSAMPROW inptr, outptr;\r
-\r
-  register JSAMPLE invalue;\r
-\r
-  register int h;\r
-\r
-  JSAMPROW outend;\r
-\r
-  int h_expand, v_expand;\r
-\r
-  int inrow, outrow;\r
-\r
-\r
-\r
-  h_expand = upsample->h_expand[compptr->component_index];\r
-\r
-  v_expand = upsample->v_expand[compptr->component_index];\r
-\r
-\r
-\r
-  inrow = outrow = 0;\r
-\r
-  while (outrow < cinfo->max_v_samp_factor) {\r
-\r
-    /* Generate one output row with proper horizontal expansion */\r
-\r
-    inptr = input_data[inrow];\r
-\r
-    outptr = output_data[outrow];\r
-\r
-    outend = outptr + cinfo->output_width;\r
-\r
-    while (outptr < outend) {\r
-\r
-      invalue = *inptr++;      /* don't need GETJSAMPLE() here */\r
-\r
-      for (h = h_expand; h > 0; h--) {\r
-\r
-       *outptr++ = invalue;\r
-\r
-      }\r
-\r
-    }\r
-\r
-    /* Generate any additional output rows by duplicating the first one */\r
-\r
-    if (v_expand > 1) {\r
-\r
-      jcopy_sample_rows(output_data, outrow, output_data, outrow+1,\r
-\r
-                       v_expand-1, cinfo->output_width);\r
-\r
-    }\r
-\r
-    inrow++;\r
-\r
-    outrow += v_expand;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Fast processing for the common case of 2:1 horizontal and 1:1 vertical.\r
-\r
- * It's still a box filter.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-              JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)\r
-\r
-{\r
-\r
-  JSAMPARRAY output_data = *output_data_ptr;\r
-\r
-  register JSAMPROW inptr, outptr;\r
-\r
-  register JSAMPLE invalue;\r
-\r
-  JSAMPROW outend;\r
-\r
-  int inrow;\r
-\r
-\r
-\r
-  for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {\r
-\r
-    inptr = input_data[inrow];\r
-\r
-    outptr = output_data[inrow];\r
-\r
-    outend = outptr + cinfo->output_width;\r
-\r
-    while (outptr < outend) {\r
-\r
-      invalue = *inptr++;      /* don't need GETJSAMPLE() here */\r
-\r
-      *outptr++ = invalue;\r
-\r
-      *outptr++ = invalue;\r
-\r
-    }\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Fast processing for the common case of 2:1 horizontal and 2:1 vertical.\r
-\r
- * It's still a box filter.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-              JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)\r
-\r
-{\r
-\r
-  JSAMPARRAY output_data = *output_data_ptr;\r
-\r
-  register JSAMPROW inptr, outptr;\r
-\r
-  register JSAMPLE invalue;\r
-\r
-  JSAMPROW outend;\r
-\r
-  int inrow, outrow;\r
-\r
-\r
-\r
-  inrow = outrow = 0;\r
-\r
-  while (outrow < cinfo->max_v_samp_factor) {\r
-\r
-    inptr = input_data[inrow];\r
-\r
-    outptr = output_data[outrow];\r
-\r
-    outend = outptr + cinfo->output_width;\r
-\r
-    while (outptr < outend) {\r
-\r
-      invalue = *inptr++;      /* don't need GETJSAMPLE() here */\r
-\r
-      *outptr++ = invalue;\r
-\r
-      *outptr++ = invalue;\r
-\r
-    }\r
-\r
-    jcopy_sample_rows(output_data, outrow, output_data, outrow+1,\r
-\r
-                     1, cinfo->output_width);\r
-\r
-    inrow++;\r
-\r
-    outrow += 2;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Fancy processing for the common case of 2:1 horizontal and 1:1 vertical.\r
-\r
- *\r
-\r
- * The upsampling algorithm is linear interpolation between pixel centers,\r
-\r
- * also known as a "triangle filter".  This is a good compromise between\r
-\r
- * speed and visual quality.  The centers of the output pixels are 1/4 and 3/4\r
-\r
- * of the way between input pixel centers.\r
-\r
- *\r
-\r
- * A note about the "bias" calculations: when rounding fractional values to\r
-\r
- * integer, we do not want to always round 0.5 up to the next integer.\r
-\r
- * If we did that, we'd introduce a noticeable bias towards larger values.\r
-\r
- * Instead, this code is arranged so that 0.5 will be rounded up or down at\r
-\r
- * alternate pixel locations (a simple ordered dither pattern).\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-                    JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)\r
-\r
-{\r
-\r
-  JSAMPARRAY output_data = *output_data_ptr;\r
-\r
-  register JSAMPROW inptr, outptr;\r
-\r
-  register int invalue;\r
-\r
-  register JDIMENSION colctr;\r
-\r
-  int inrow;\r
-\r
-\r
-\r
-  for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {\r
-\r
-    inptr = input_data[inrow];\r
-\r
-    outptr = output_data[inrow];\r
-\r
-    /* Special case for first column */\r
-\r
-    invalue = GETJSAMPLE(*inptr++);\r
-\r
-    *outptr++ = (JSAMPLE) invalue;\r
-\r
-    *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(*inptr) + 2) >> 2);\r
-\r
-\r
-\r
-    for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {\r
-\r
-      /* General case: 3/4 * nearer pixel + 1/4 * further pixel */\r
-\r
-      invalue = GETJSAMPLE(*inptr++) * 3;\r
-\r
-      *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(inptr[-2]) + 1) >> 2);\r
-\r
-      *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(*inptr) + 2) >> 2);\r
-\r
-    }\r
-\r
-\r
-\r
-    /* Special case for last column */\r
-\r
-    invalue = GETJSAMPLE(*inptr);\r
-\r
-    *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(inptr[-1]) + 1) >> 2);\r
-\r
-    *outptr++ = (JSAMPLE) invalue;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Fancy processing for the common case of 2:1 horizontal and 2:1 vertical.\r
-\r
- * Again a triangle filter; see comments for h2v1 case, above.\r
-\r
- *\r
-\r
- * It is OK for us to reference the adjacent input rows because we demanded\r
-\r
- * context from the main buffer controller (see initialization code).\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-                    JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)\r
-\r
-{\r
-\r
-  JSAMPARRAY output_data = *output_data_ptr;\r
-\r
-  register JSAMPROW inptr0, inptr1, outptr;\r
-\r
-#if BITS_IN_JSAMPLE == 8\r
-\r
-  register int thiscolsum, lastcolsum, nextcolsum;\r
-\r
-#else\r
-\r
-  register INT32 thiscolsum, lastcolsum, nextcolsum;\r
-\r
-#endif\r
-\r
-  register JDIMENSION colctr;\r
-\r
-  int inrow, outrow, v;\r
-\r
-\r
-\r
-  inrow = outrow = 0;\r
-\r
-  while (outrow < cinfo->max_v_samp_factor) {\r
-\r
-    for (v = 0; v < 2; v++) {\r
-\r
-      /* inptr0 points to nearest input row, inptr1 points to next nearest */\r
-\r
-      inptr0 = input_data[inrow];\r
-\r
-      if (v == 0)              /* next nearest is row above */\r
-\r
-       inptr1 = input_data[inrow-1];\r
-\r
-      else                     /* next nearest is row below */\r
-\r
-       inptr1 = input_data[inrow+1];\r
-\r
-      outptr = output_data[outrow++];\r
-\r
-\r
-\r
-      /* Special case for first column */\r
-\r
-      thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);\r
-\r
-      nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);\r
-\r
-      *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 8) >> 4);\r
-\r
-      *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);\r
-\r
-      lastcolsum = thiscolsum; thiscolsum = nextcolsum;\r
-\r
-\r
-\r
-      for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {\r
-\r
-       /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */\r
-\r
-       /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */\r
-\r
-       nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);\r
-\r
-       *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);\r
-\r
-       *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);\r
-\r
-       lastcolsum = thiscolsum; thiscolsum = nextcolsum;\r
-\r
-      }\r
-\r
-\r
-\r
-      /* Special case for last column */\r
-\r
-      *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);\r
-\r
-      *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 7) >> 4);\r
-\r
-    }\r
-\r
-    inrow++;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Module initialization routine for upsampling.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jinit_upsampler (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  my_upsample_ptr upsample;\r
-\r
-  int ci;\r
-\r
-  jpeg_component_info * compptr;\r
-\r
-  boolean need_buffer, do_fancy;\r
-\r
-  int h_in_group, v_in_group, h_out_group, v_out_group;\r
-\r
-\r
-\r
-  upsample = (my_upsample_ptr)\r
-\r
-    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-                               SIZEOF(my_upsampler));\r
-\r
-  cinfo->upsample = (struct jpeg_upsampler *) upsample;\r
-\r
-  upsample->pub.start_pass = start_pass_upsample;\r
-\r
-  upsample->pub.upsample = sep_upsample;\r
-\r
-  upsample->pub.need_context_rows = FALSE; /* until we find out differently */\r
-\r
-\r
-\r
-  if (cinfo->CCIR601_sampling) /* this isn't supported */\r
-\r
-    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);\r
-\r
-\r
-\r
-  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,\r
-\r
-   * so don't ask for it.\r
-\r
-   */\r
-\r
-  do_fancy = cinfo->do_fancy_upsampling && cinfo->min_DCT_scaled_size > 1;\r
-\r
-\r
-\r
-  /* Verify we can handle the sampling factors, select per-component methods,\r
-\r
-   * and create storage as needed.\r
-\r
-   */\r
-\r
-  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\r
-\r
-       ci++, compptr++) {\r
-\r
-    /* Compute size of an "input group" after IDCT scaling.  This many samples\r
-\r
-     * are to be converted to max_h_samp_factor * max_v_samp_factor pixels.\r
-\r
-     */\r
-\r
-    h_in_group = (compptr->h_samp_factor * compptr->DCT_scaled_size) /\r
-\r
-                cinfo->min_DCT_scaled_size;\r
-\r
-    v_in_group = (compptr->v_samp_factor * compptr->DCT_scaled_size) /\r
-\r
-                cinfo->min_DCT_scaled_size;\r
-\r
-    h_out_group = cinfo->max_h_samp_factor;\r
-\r
-    v_out_group = cinfo->max_v_samp_factor;\r
-\r
-    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */\r
-\r
-    need_buffer = TRUE;\r
-\r
-    if (! compptr->component_needed) {\r
-\r
-      /* Don't bother to upsample an uninteresting component. */\r
-\r
-      upsample->methods[ci] = noop_upsample;\r
-\r
-      need_buffer = FALSE;\r
-\r
-    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {\r
-\r
-      /* Fullsize components can be processed without any work. */\r
-\r
-      upsample->methods[ci] = fullsize_upsample;\r
-\r
-      need_buffer = FALSE;\r
-\r
-    } else if (h_in_group * 2 == h_out_group &&\r
-\r
-              v_in_group == v_out_group) {\r
-\r
-      /* Special cases for 2h1v upsampling */\r
-\r
-      if (do_fancy && compptr->downsampled_width > 2)\r
-\r
-       upsample->methods[ci] = h2v1_fancy_upsample;\r
-\r
-      else\r
-\r
-       upsample->methods[ci] = h2v1_upsample;\r
-\r
-    } else if (h_in_group * 2 == h_out_group &&\r
-\r
-              v_in_group * 2 == v_out_group) {\r
-\r
-      /* Special cases for 2h2v upsampling */\r
-\r
-      if (do_fancy && compptr->downsampled_width > 2) {\r
-\r
-       upsample->methods[ci] = h2v2_fancy_upsample;\r
-\r
-       upsample->pub.need_context_rows = TRUE;\r
-\r
-      } else\r
-\r
-       upsample->methods[ci] = h2v2_upsample;\r
-\r
-    } else if ((h_out_group % h_in_group) == 0 &&\r
-\r
-              (v_out_group % v_in_group) == 0) {\r
-\r
-      /* Generic integral-factors upsampling method */\r
-\r
-      upsample->methods[ci] = int_upsample;\r
-\r
-      upsample->h_expand[ci] = (UINT8) (h_out_group / h_in_group);\r
-\r
-      upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group);\r
-\r
-    } else\r
-\r
-      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);\r
-\r
-    if (need_buffer) {\r
-\r
-      upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray)\r
-\r
-       ((j_common_ptr) cinfo, JPOOL_IMAGE,\r
-\r
-        (JDIMENSION) jround_up((long) cinfo->output_width,\r
-\r
-                               (long) cinfo->max_h_samp_factor),\r
-\r
-        (JDIMENSION) cinfo->max_v_samp_factor);\r
-\r
-    }\r
-\r
-  }\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jdtrans.cpp b/libs/jpeg6/jdtrans.cpp
deleted file mode 100644 (file)
index 70e6737..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-/*\r
-\r
- * jdtrans.c\r
-\r
- *\r
-\r
- * Copyright (C) 1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains library routines for transcoding decompression,\r
-\r
- * that is, reading raw DCT coefficient arrays from an input JPEG file.\r
-\r
- * The routines in jdapimin.c will also be needed by a transcoder.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-\r
-\r
-/* Forward declarations */\r
-\r
-LOCAL void transdecode_master_selection JPP((j_decompress_ptr cinfo));\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Read the coefficient arrays from a JPEG file.\r
-\r
- * jpeg_read_header must be completed before calling this.\r
-\r
- *\r
-\r
- * The entire image is read into a set of virtual coefficient-block arrays,\r
-\r
- * one per component.  The return value is a pointer to the array of\r
-\r
- * virtual-array descriptors.  These can be manipulated directly via the\r
-\r
- * JPEG memory manager, or handed off to jpeg_write_coefficients().\r
-\r
- * To release the memory occupied by the virtual arrays, call\r
-\r
- * jpeg_finish_decompress() when done with the data.\r
-\r
- *\r
-\r
- * Returns NULL if suspended.  This case need be checked only if\r
-\r
- * a suspending data source is used.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL jvirt_barray_ptr *\r
-\r
-jpeg_read_coefficients (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  if (cinfo->global_state == DSTATE_READY) {\r
-\r
-    /* First call: initialize active modules */\r
-\r
-    transdecode_master_selection(cinfo);\r
-\r
-    cinfo->global_state = DSTATE_RDCOEFS;\r
-\r
-  } else if (cinfo->global_state != DSTATE_RDCOEFS)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);\r
-\r
-  /* Absorb whole file into the coef buffer */\r
-\r
-  for (;;) {\r
-\r
-    int retcode;\r
-\r
-    /* Call progress monitor hook if present */\r
-\r
-    if (cinfo->progress != NULL)\r
-\r
-      (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);\r
-\r
-    /* Absorb some more input */\r
-\r
-    retcode = (*cinfo->inputctl->consume_input) (cinfo);\r
-\r
-    if (retcode == JPEG_SUSPENDED)\r
-\r
-      return NULL;\r
-\r
-    if (retcode == JPEG_REACHED_EOI)\r
-\r
-      break;\r
-\r
-    /* Advance progress counter if appropriate */\r
-\r
-    if (cinfo->progress != NULL &&\r
-\r
-       (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {\r
-\r
-      if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {\r
-\r
-       /* startup underestimated number of scans; ratchet up one scan */\r
-\r
-       cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;\r
-\r
-      }\r
-\r
-    }\r
-\r
-  }\r
-\r
-  /* Set state so that jpeg_finish_decompress does the right thing */\r
-\r
-  cinfo->global_state = DSTATE_STOPPING;\r
-\r
-  return cinfo->coef->coef_arrays;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Master selection of decompression modules for transcoding.\r
-\r
- * This substitutes for jdmaster.c's initialization of the full decompressor.\r
-\r
- */\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-transdecode_master_selection (j_decompress_ptr cinfo)\r
-\r
-{\r
-\r
-  /* Entropy decoding: either Huffman or arithmetic coding. */\r
-\r
-  if (cinfo->arith_code) {\r
-\r
-    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);\r
-\r
-  } else {\r
-\r
-    if (cinfo->progressive_mode) {\r
-\r
-#ifdef D_PROGRESSIVE_SUPPORTED\r
-\r
-      jinit_phuff_decoder(cinfo);\r
-\r
-#else\r
-\r
-      ERREXIT(cinfo, JERR_NOT_COMPILED);\r
-\r
-#endif\r
-\r
-    } else\r
-\r
-      jinit_huff_decoder(cinfo);\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Always get a full-image coefficient buffer. */\r
-\r
-  jinit_d_coef_controller(cinfo, TRUE);\r
-\r
-\r
-\r
-  /* We can now tell the memory manager to allocate virtual arrays. */\r
-\r
-  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);\r
-\r
-\r
-\r
-  /* Initialize input side of decompressor to consume first scan. */\r
-\r
-  (*cinfo->inputctl->start_input_pass) (cinfo);\r
-\r
-\r
-\r
-  /* Initialize progress monitoring. */\r
-\r
-  if (cinfo->progress != NULL) {\r
-\r
-    int nscans;\r
-\r
-    /* Estimate number of scans to set pass_limit. */\r
-\r
-    if (cinfo->progressive_mode) {\r
-\r
-      /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */\r
-\r
-      nscans = 2 + 3 * cinfo->num_components;\r
-\r
-    } else if (cinfo->inputctl->has_multiple_scans) {\r
-\r
-      /* For a nonprogressive multiscan file, estimate 1 scan per component. */\r
-\r
-      nscans = cinfo->num_components;\r
-\r
-    } else {\r
-\r
-      nscans = 1;\r
-\r
-    }\r
-\r
-    cinfo->progress->pass_counter = 0L;\r
-\r
-    cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;\r
-\r
-    cinfo->progress->completed_passes = 0;\r
-\r
-    cinfo->progress->total_passes = 1;\r
-\r
-  }\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jerror.cpp b/libs/jpeg6/jerror.cpp
deleted file mode 100644 (file)
index e4f65f7..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-/*\r
- * jerror.c\r
- *\r
- * Copyright (C) 1991-1994, Thomas G. Lane.\r
- * This file is part of the Independent JPEG Group's software.\r
- * For conditions of distribution and use, see the accompanying README file.\r
- *\r
- * This file contains simple error-reporting and trace-message routines.\r
- * These are suitable for Unix-like systems and others where writing to\r
- * stderr is the right thing to do.  Many applications will want to replace\r
- * some or all of these routines.\r
- *\r
- * These routines are used by both the compression and decompression code.\r
- */\r
-\r
-/* this is not a core library module, so it doesn't define JPEG_INTERNALS */\r
-#include "jinclude.h"\r
-#include "radiant_jpeglib.h"\r
-#include "jversion.h"\r
-#include "jerror.h"\r
-\r
-#ifndef EXIT_FAILURE           /* define exit() codes if not provided */\r
-#define EXIT_FAILURE  1\r
-#endif\r
-\r
-\r
-/*\r
- * Create the message string table.\r
- * We do this from the master message list in jerror.h by re-reading\r
- * jerror.h with a suitable definition for macro JMESSAGE.\r
- * The message table is made an external symbol just in case any applications\r
- * want to refer to it directly.\r
- */\r
-\r
-#ifdef NEED_SHORT_EXTERNAL_NAMES\r
-#define jpeg_std_message_table jMsgTable\r
-#endif\r
-\r
-#define JMESSAGE(code,string)  string ,\r
-\r
-const char * const jpeg_std_message_table[] = {\r
-#include "jerror.h"\r
-  NULL\r
-};\r
-\r
-// Rad additions, longjmp out of the LoadJPGBuff\r
-GLOBAL jmp_buf rad_loadfailed;\r
-GLOBAL char rad_errormsg[JMSG_LENGTH_MAX];\r
-\r
-/*\r
- * Error exit handler: must not return to caller.\r
- *\r
- * Applications may override this if they want to get control back after\r
- * an error.  Typically one would longjmp somewhere instead of exiting.\r
- * The setjmp buffer can be made a private field within an expanded error\r
- * handler object.  Note that the info needed to generate an error message\r
- * is stored in the error object, so you can generate the message now or\r
- * later, at your convenience.\r
- * You should make sure that the JPEG object is cleaned up (with jpeg_abort\r
- * or jpeg_destroy) at some point.\r
- */\r
-\r
-METHODDEF void\r
-error_exit (j_common_ptr cinfo)\r
-{\r
-//  char buffer[JMSG_LENGTH_MAX];\r
-\r
-  /* Create the message */\r
-  (*cinfo->err->format_message) (cinfo,rad_errormsg);\r
-\r
-  /* Let the memory manager delete any temp files before we die */\r
-  jpeg_destroy(cinfo);\r
-\r
-  longjmp( rad_loadfailed, -1 );\r
-}\r
-\r
-\r
-/*\r
- * Actual output of an error or trace message.\r
- * Applications may override this method to send JPEG messages somewhere\r
- * other than stderr.\r
- */\r
-\r
-METHODDEF void\r
-output_message (j_common_ptr cinfo)\r
-{\r
-  char buffer[JMSG_LENGTH_MAX];\r
-\r
-  /* Create the message */\r
-  (*cinfo->err->format_message) (cinfo, buffer);\r
-\r
-  /* Send it to stderr, adding a newline */\r
-  printf("%s\n", buffer);\r
-}\r
-\r
-\r
-/*\r
- * Decide whether to emit a trace or warning message.\r
- * msg_level is one of:\r
- *   -1: recoverable corrupt-data warning, may want to abort.\r
- *    0: important advisory messages (always display to user).\r
- *    1: first level of tracing detail.\r
- *    2,3,...: successively more detailed tracing messages.\r
- * An application might override this method if it wanted to abort on warnings\r
- * or change the policy about which messages to display.\r
- */\r
-\r
-METHODDEF void\r
-emit_message (j_common_ptr cinfo, int msg_level)\r
-{\r
-  struct jpeg_error_mgr * err = cinfo->err;\r
-\r
-  if (msg_level < 0) {\r
-    /* It's a warning message.  Since corrupt files may generate many warnings,\r
-     * the policy implemented here is to show only the first warning,\r
-     * unless trace_level >= 3.\r
-     */\r
-    if (err->num_warnings == 0 || err->trace_level >= 3)\r
-      (*err->output_message) (cinfo);\r
-    /* Always count warnings in num_warnings. */\r
-    err->num_warnings++;\r
-  } else {\r
-    /* It's a trace message.  Show it if trace_level >= msg_level. */\r
-    if (err->trace_level >= msg_level)\r
-      (*err->output_message) (cinfo);\r
-  }\r
-}\r
-\r
-\r
-/*\r
- * Format a message string for the most recent JPEG error or message.\r
- * The message is stored into buffer, which should be at least JMSG_LENGTH_MAX\r
- * characters.  Note that no '\n' character is added to the string.\r
- * Few applications should need to override this method.\r
- */\r
-\r
-METHODDEF void\r
-format_message (j_common_ptr cinfo, char * buffer)\r
-{\r
-  struct jpeg_error_mgr * err = cinfo->err;\r
-  int msg_code = err->msg_code;\r
-  const char * msgtext = NULL;\r
-  const char * msgptr;\r
-  char ch;\r
-  boolean isstring;\r
-\r
-  /* Look up message string in proper table */\r
-  if (msg_code > 0 && msg_code <= err->last_jpeg_message) {\r
-    msgtext = err->jpeg_message_table[msg_code];\r
-  } else if (err->addon_message_table != NULL &&\r
-            msg_code >= err->first_addon_message &&\r
-            msg_code <= err->last_addon_message) {\r
-    msgtext = err->addon_message_table[msg_code - err->first_addon_message];\r
-  }\r
-\r
-  /* Defend against bogus message number */\r
-  if (msgtext == NULL) {\r
-    err->msg_parm.i[0] = msg_code;\r
-    msgtext = err->jpeg_message_table[0];\r
-  }\r
-\r
-  /* Check for string parameter, as indicated by %s in the message text */\r
-  isstring = FALSE;\r
-  msgptr = msgtext;\r
-  while ((ch = *msgptr++) != '\0') {\r
-    if (ch == '%') {\r
-      if (*msgptr == 's') isstring = TRUE;\r
-      break;\r
-    }\r
-  }\r
-\r
-  /* Format the message into the passed buffer */\r
-  if (isstring)\r
-    sprintf(buffer, msgtext, err->msg_parm.s);\r
-  else\r
-    sprintf(buffer, msgtext,\r
-           err->msg_parm.i[0], err->msg_parm.i[1],\r
-           err->msg_parm.i[2], err->msg_parm.i[3],\r
-           err->msg_parm.i[4], err->msg_parm.i[5],\r
-           err->msg_parm.i[6], err->msg_parm.i[7]);\r
-}\r
-\r
-\r
-/*\r
- * Reset error state variables at start of a new image.\r
- * This is called during compression startup to reset trace/error\r
- * processing to default state, without losing any application-specific\r
- * method pointers.  An application might possibly want to override\r
- * this method if it has additional error processing state.\r
- */\r
-\r
-METHODDEF void\r
-reset_error_mgr (j_common_ptr cinfo)\r
-{\r
-  cinfo->err->num_warnings = 0;\r
-  /* trace_level is not reset since it is an application-supplied parameter */\r
-  cinfo->err->msg_code = 0;    /* may be useful as a flag for "no error" */\r
-}\r
-\r
-\r
-/*\r
- * Fill in the standard error-handling methods in a jpeg_error_mgr object.\r
- * Typical call is:\r
- *     struct jpeg_compress_struct cinfo;\r
- *     struct jpeg_error_mgr err;\r
- *\r
- *     cinfo.err = jpeg_std_error(&err);\r
- * after which the application may override some of the methods.\r
- */\r
-\r
-GLOBAL struct jpeg_error_mgr *\r
-jpeg_std_error (struct jpeg_error_mgr * err)\r
-{\r
-  err->error_exit = error_exit;\r
-  err->emit_message = emit_message;\r
-  err->output_message = output_message;\r
-  err->format_message = format_message;\r
-  err->reset_error_mgr = reset_error_mgr;\r
-\r
-  err->trace_level = 0;                /* default = no tracing */\r
-  err->num_warnings = 0;       /* no warnings emitted yet */\r
-  err->msg_code = 0;           /* may be useful as a flag for "no error" */\r
-\r
-  /* Initialize message table pointers */\r
-  err->jpeg_message_table = jpeg_std_message_table;\r
-  err->last_jpeg_message = (int) JMSG_LASTMSGCODE - 1;\r
-\r
-  err->addon_message_table = NULL;\r
-  err->first_addon_message = 0;        /* for safety */\r
-  err->last_addon_message = 0;\r
-\r
-  return err;\r
-}\r
diff --git a/libs/jpeg6/jerror.h b/libs/jpeg6/jerror.h
deleted file mode 100644 (file)
index d23dfb0..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-/*\r
- * jerror.h\r
- *\r
- * Copyright (C) 1994-1995, Thomas G. Lane.\r
- * This file is part of the Independent JPEG Group's software.\r
- * For conditions of distribution and use, see the accompanying README file.\r
- *\r
- * This file defines the error and message codes for the JPEG library.\r
- * Edit this file to add new codes, or to translate the message strings to\r
- * some other language.\r
- * A set of error-reporting macros are defined too.  Some applications using\r
- * the JPEG library may wish to include this file to get the error codes\r
- * and/or the macros.\r
- */\r
-\r
-/*\r
- * To define the enum list of message codes, include this file without\r
- * defining macro JMESSAGE.  To create a message string table, include it\r
- * again with a suitable JMESSAGE definition (see jerror.c for an example).\r
- */\r
-#ifndef JMESSAGE\r
-#ifndef JERROR_H\r
-/* First time through, define the enum list */\r
-#define JMAKE_ENUM_LIST\r
-#else\r
-/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */\r
-#define JMESSAGE(code,string)\r
-#endif /* JERROR_H */\r
-#endif /* JMESSAGE */\r
-\r
-#ifdef JMAKE_ENUM_LIST\r
-\r
-typedef enum {\r
-\r
-#define JMESSAGE(code,string)  code ,\r
-\r
-#endif /* JMAKE_ENUM_LIST */\r
-\r
-JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */\r
-\r
-/* For maintenance convenience, list is alphabetical by message code name */\r
-JMESSAGE(JERR_ARITH_NOTIMPL,\r
-        "Sorry, there are legal restrictions on arithmetic coding")\r
-JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")\r
-JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")\r
-JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")\r
-JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")\r
-JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")\r
-JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")\r
-JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")\r
-JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length")\r
-JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan")\r
-JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d")\r
-JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d")\r
-JMESSAGE(JERR_BAD_PROGRESSION,\r
-        "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d")\r
-JMESSAGE(JERR_BAD_PROG_SCRIPT,\r
-        "Invalid progressive parameters at scan script entry %d")\r
-JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors")\r
-JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d")\r
-JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d")\r
-JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access")\r
-JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small")\r
-JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here")\r
-JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet")\r
-JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d")\r
-JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request")\r
-JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d")\r
-JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x")\r
-JMESSAGE(JERR_DHT_COUNTS, "Bogus DHT counts")\r
-JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d")\r
-JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d")\r
-JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)")\r
-JMESSAGE(JERR_EMS_READ, "Read from EMS failed")\r
-JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed")\r
-JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan")\r
-JMESSAGE(JERR_FILE_READ, "Input file read error")\r
-JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?")\r
-JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet")\r
-JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow")\r
-JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry")\r
-JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels")\r
-JMESSAGE(JERR_INPUT_EMPTY, "Empty input file")\r
-JMESSAGE(JERR_INPUT_EOF, "Premature end of input file")\r
-JMESSAGE(JERR_MISMATCHED_QUANT_TABLE,\r
-        "Cannot transcode due to multiple use of quantization table %d")\r
-JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")\r
-JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")\r
-JMESSAGE(JERR_NOTIMPL, "Not implemented yet")\r
-JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")\r
-JMESSAGE(JERR_NO_PROGRESSIVE, "Progressive JPEGs not supported, use regular JPEG instead")\r
-JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")\r
-JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")\r
-JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")\r
-JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined")\r
-JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x")\r
-JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)")\r
-JMESSAGE(JERR_QUANT_COMPONENTS,\r
-        "Cannot quantize more than %d color components")\r
-JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")\r
-JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")\r
-JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers")\r
-JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker")\r
-JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")\r
-JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers")\r
-JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF")\r
-JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")\r
-JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")\r
-JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")\r
-JMESSAGE(JERR_TFILE_WRITE,\r
-        "Write failed on temporary file --- out of disk space?")\r
-JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines")\r
-JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x")\r
-JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up")\r
-JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation")\r
-JMESSAGE(JERR_XMS_READ, "Read from XMS failed")\r
-JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed")\r
-JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT)\r
-JMESSAGE(JMSG_VERSION, JVERSION)\r
-JMESSAGE(JTRC_16BIT_TABLES,\r
-        "Caution: quantization tables are too coarse for baseline JPEG")\r
-JMESSAGE(JTRC_ADOBE,\r
-        "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d")\r
-JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u")\r
-JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u")\r
-JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x")\r
-JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x")\r
-JMESSAGE(JTRC_DQT, "Define Quantization Table %d  precision %d")\r
-JMESSAGE(JTRC_DRI, "Define Restart Interval %u")\r
-JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u")\r
-JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u")\r
-JMESSAGE(JTRC_EOI, "End Of Image")\r
-JMESSAGE(JTRC_HUFFBITS, "        %3d %3d %3d %3d %3d %3d %3d %3d")\r
-JMESSAGE(JTRC_JFIF, "JFIF APP0 marker, density %dx%d  %d")\r
-JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,\r
-        "Warning: thumbnail image size does not match data length %u")\r
-JMESSAGE(JTRC_JFIF_MINOR, "Unknown JFIF minor revision number %d.%02d")\r
-JMESSAGE(JTRC_JFIF_THUMBNAIL, "    with %d x %d thumbnail image")\r
-JMESSAGE(JTRC_MISC_MARKER, "Skipping marker 0x%02x, length %u")\r
-JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")\r
-JMESSAGE(JTRC_QUANTVALS, "        %4u %4u %4u %4u %4u %4u %4u %4u")\r
-JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors")\r
-JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors")\r
-JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization")\r
-JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d")\r
-JMESSAGE(JTRC_RST, "RST%d")\r
-JMESSAGE(JTRC_SMOOTH_NOTIMPL,\r
-        "Smoothing not supported with nonstandard sampling ratios")\r
-JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d")\r
-JMESSAGE(JTRC_SOF_COMPONENT, "    Component %d: %dhx%dv q=%d")\r
-JMESSAGE(JTRC_SOI, "Start of Image")\r
-JMESSAGE(JTRC_SOS, "Start Of Scan: %d components")\r
-JMESSAGE(JTRC_SOS_COMPONENT, "    Component %d: dc=%d ac=%d")\r
-JMESSAGE(JTRC_SOS_PARAMS, "  Ss=%d, Se=%d, Ah=%d, Al=%d")\r
-JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s")\r
-JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s")\r
-JMESSAGE(JTRC_UNKNOWN_IDS,\r
-        "Unrecognized component IDs %d %d %d, assuming YCbCr")\r
-JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")\r
-JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")\r
-JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")\r
-JMESSAGE(JWRN_BOGUS_PROGRESSION,\r
-        "Inconsistent progression sequence for component %d coefficient %d")\r
-JMESSAGE(JWRN_EXTRANEOUS_DATA,\r
-        "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x")\r
-JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment")\r
-JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code")\r
-JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d")\r
-JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file")\r
-JMESSAGE(JWRN_MUST_RESYNC,\r
-        "Corrupt JPEG data: found marker 0x%02x instead of RST%d")\r
-JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG")\r
-JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines")\r
-\r
-#ifdef JMAKE_ENUM_LIST\r
-\r
-  JMSG_LASTMSGCODE\r
-} J_MESSAGE_CODE;\r
-\r
-#undef JMAKE_ENUM_LIST\r
-#endif /* JMAKE_ENUM_LIST */\r
-\r
-/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */\r
-#undef JMESSAGE\r
-\r
-#ifndef JERROR_H\r
-#define JERROR_H\r
-\r
-// Rad additions, using longjmp to recover from errors\r
-#include <setjmp.h>\r
-EXTERN jmp_buf rad_loadfailed;\r
-EXTERN char rad_errormsg[JMSG_LENGTH_MAX];\r
-\r
-/* Macros to simplify using the error and trace message stuff */\r
-/* The first parameter is either type of cinfo pointer */\r
-\r
-/* Fatal errors (print message and exit) */\r
-#define ERREXIT(cinfo,code)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\r
-#define ERREXIT1(cinfo,code,p1)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   (cinfo)->err->msg_parm.i[0] = (p1), \\r
-   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\r
-#define ERREXIT2(cinfo,code,p1,p2)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   (cinfo)->err->msg_parm.i[0] = (p1), \\r
-   (cinfo)->err->msg_parm.i[1] = (p2), \\r
-   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\r
-#define ERREXIT3(cinfo,code,p1,p2,p3)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   (cinfo)->err->msg_parm.i[0] = (p1), \\r
-   (cinfo)->err->msg_parm.i[1] = (p2), \\r
-   (cinfo)->err->msg_parm.i[2] = (p3), \\r
-   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\r
-#define ERREXIT4(cinfo,code,p1,p2,p3,p4)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   (cinfo)->err->msg_parm.i[0] = (p1), \\r
-   (cinfo)->err->msg_parm.i[1] = (p2), \\r
-   (cinfo)->err->msg_parm.i[2] = (p3), \\r
-   (cinfo)->err->msg_parm.i[3] = (p4), \\r
-   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\r
-#define ERREXITS(cinfo,code,str)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \\r
-   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\r
-\r
-#define MAKESTMT(stuff)                do { stuff } while (0)\r
-\r
-/* Nonfatal errors (we can keep going, but the data is probably corrupt) */\r
-#define WARNMS(cinfo,code)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))\r
-#define WARNMS1(cinfo,code,p1)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   (cinfo)->err->msg_parm.i[0] = (p1), \\r
-   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))\r
-#define WARNMS2(cinfo,code,p1,p2)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   (cinfo)->err->msg_parm.i[0] = (p1), \\r
-   (cinfo)->err->msg_parm.i[1] = (p2), \\r
-   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))\r
-\r
-/* Informational/debugging messages */\r
-#define TRACEMS(cinfo,lvl,code)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))\r
-#define TRACEMS1(cinfo,lvl,code,p1)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   (cinfo)->err->msg_parm.i[0] = (p1), \\r
-   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))\r
-#define TRACEMS2(cinfo,lvl,code,p1,p2)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   (cinfo)->err->msg_parm.i[0] = (p1), \\r
-   (cinfo)->err->msg_parm.i[1] = (p2), \\r
-   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))\r
-#define TRACEMS3(cinfo,lvl,code,p1,p2,p3)  \\r
-  MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \\r
-          _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \\r
-          (cinfo)->err->msg_code = (code); \\r
-          (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )\r
-#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4)  \\r
-  MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \\r
-          _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \\r
-          (cinfo)->err->msg_code = (code); \\r
-          (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )\r
-#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8)  \\r
-  MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \\r
-          _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \\r
-          _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \\r
-          (cinfo)->err->msg_code = (code); \\r
-          (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )\r
-#define TRACEMSS(cinfo,lvl,code,str)  \\r
-  ((cinfo)->err->msg_code = (code), \\r
-   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \\r
-   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))\r
-\r
-#endif /* JERROR_H */\r
diff --git a/libs/jpeg6/jfdctflt.cpp b/libs/jpeg6/jfdctflt.cpp
deleted file mode 100644 (file)
index f41bff8..0000000
+++ /dev/null
@@ -1,336 +0,0 @@
-/*\r
-\r
- * jfdctflt.c\r
-\r
- *\r
-\r
- * Copyright (C) 1994, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains a floating-point implementation of the\r
-\r
- * forward DCT (Discrete Cosine Transform).\r
-\r
- *\r
-\r
- * This implementation should be more accurate than either of the integer\r
-\r
- * DCT implementations.  However, it may not give the same results on all\r
-\r
- * machines because of differences in roundoff behavior.  Speed will depend\r
-\r
- * on the hardware's floating point capacity.\r
-\r
- *\r
-\r
- * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT\r
-\r
- * on each column.  Direct algorithms are also available, but they are\r
-\r
- * much more complex and seem not to be any faster when reduced to code.\r
-\r
- *\r
-\r
- * This implementation is based on Arai, Agui, and Nakajima's algorithm for\r
-\r
- * scaled DCT.  Their original paper (Trans. IEICE E-71(11):1095) is in\r
-\r
- * Japanese, but the algorithm is described in the Pennebaker & Mitchell\r
-\r
- * JPEG textbook (see REFERENCES section in file README).  The following code\r
-\r
- * is based directly on figure 4-8 in P&M.\r
-\r
- * While an 8-point DCT cannot be done in less than 11 multiplies, it is\r
-\r
- * possible to arrange the computation so that many of the multiplies are\r
-\r
- * simple scalings of the final outputs.  These multiplies can then be\r
-\r
- * folded into the multiplications or divisions by the JPEG quantization\r
-\r
- * table entries.  The AA&N method leaves only 5 multiplies and 29 adds\r
-\r
- * to be done in the DCT itself.\r
-\r
- * The primary disadvantage of this method is that with a fixed-point\r
-\r
- * implementation, accuracy is lost due to imprecise representation of the\r
-\r
- * scaled quantization values.  However, that problem does not arise if\r
-\r
- * we use floating point arithmetic.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-#include "jdct.h"              /* Private declarations for DCT subsystem */\r
-\r
-\r
-\r
-#ifdef DCT_FLOAT_SUPPORTED\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * This module is specialized to the case DCTSIZE = 8.\r
-\r
- */\r
-\r
-\r
-\r
-#if DCTSIZE != 8\r
-\r
-  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Perform the forward DCT on one block of samples.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_fdct_float (FAST_FLOAT * data)\r
-\r
-{\r
-\r
-  FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;\r
-\r
-  FAST_FLOAT tmp10, tmp11, tmp12, tmp13;\r
-\r
-  FAST_FLOAT z1, z2, z3, z4, z5, z11, z13;\r
-\r
-  FAST_FLOAT *dataptr;\r
-\r
-  int ctr;\r
-\r
-\r
-\r
-  /* Pass 1: process rows. */\r
-\r
-\r
-\r
-  dataptr = data;\r
-\r
-  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {\r
-\r
-    tmp0 = dataptr[0] + dataptr[7];\r
-\r
-    tmp7 = dataptr[0] - dataptr[7];\r
-\r
-    tmp1 = dataptr[1] + dataptr[6];\r
-\r
-    tmp6 = dataptr[1] - dataptr[6];\r
-\r
-    tmp2 = dataptr[2] + dataptr[5];\r
-\r
-    tmp5 = dataptr[2] - dataptr[5];\r
-\r
-    tmp3 = dataptr[3] + dataptr[4];\r
-\r
-    tmp4 = dataptr[3] - dataptr[4];\r
-\r
-    \r
-\r
-    /* Even part */\r
-\r
-    \r
-\r
-    tmp10 = tmp0 + tmp3;       /* phase 2 */\r
-\r
-    tmp13 = tmp0 - tmp3;\r
-\r
-    tmp11 = tmp1 + tmp2;\r
-\r
-    tmp12 = tmp1 - tmp2;\r
-\r
-    \r
-\r
-    dataptr[0] = tmp10 + tmp11; /* phase 3 */\r
-\r
-    dataptr[4] = tmp10 - tmp11;\r
-\r
-    \r
-\r
-    z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */\r
-\r
-    dataptr[2] = tmp13 + z1;   /* phase 5 */\r
-\r
-    dataptr[6] = tmp13 - z1;\r
-\r
-    \r
-\r
-    /* Odd part */\r
-\r
-\r
-\r
-    tmp10 = tmp4 + tmp5;       /* phase 2 */\r
-\r
-    tmp11 = tmp5 + tmp6;\r
-\r
-    tmp12 = tmp6 + tmp7;\r
-\r
-\r
-\r
-    /* The rotator is modified from fig 4-8 to avoid extra negations. */\r
-\r
-    z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */\r
-\r
-    z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */\r
-\r
-    z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */\r
-\r
-    z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */\r
-\r
-\r
-\r
-    z11 = tmp7 + z3;           /* phase 5 */\r
-\r
-    z13 = tmp7 - z3;\r
-\r
-\r
-\r
-    dataptr[5] = z13 + z2;     /* phase 6 */\r
-\r
-    dataptr[3] = z13 - z2;\r
-\r
-    dataptr[1] = z11 + z4;\r
-\r
-    dataptr[7] = z11 - z4;\r
-\r
-\r
-\r
-    dataptr += DCTSIZE;                /* advance pointer to next row */\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Pass 2: process columns. */\r
-\r
-\r
-\r
-  dataptr = data;\r
-\r
-  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {\r
-\r
-    tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];\r
-\r
-    tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];\r
-\r
-    tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];\r
-\r
-    tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];\r
-\r
-    tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];\r
-\r
-    tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];\r
-\r
-    tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];\r
-\r
-    tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];\r
-\r
-    \r
-\r
-    /* Even part */\r
-\r
-    \r
-\r
-    tmp10 = tmp0 + tmp3;       /* phase 2 */\r
-\r
-    tmp13 = tmp0 - tmp3;\r
-\r
-    tmp11 = tmp1 + tmp2;\r
-\r
-    tmp12 = tmp1 - tmp2;\r
-\r
-    \r
-\r
-    dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */\r
-\r
-    dataptr[DCTSIZE*4] = tmp10 - tmp11;\r
-\r
-    \r
-\r
-    z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */\r
-\r
-    dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */\r
-\r
-    dataptr[DCTSIZE*6] = tmp13 - z1;\r
-\r
-    \r
-\r
-    /* Odd part */\r
-\r
-\r
-\r
-    tmp10 = tmp4 + tmp5;       /* phase 2 */\r
-\r
-    tmp11 = tmp5 + tmp6;\r
-\r
-    tmp12 = tmp6 + tmp7;\r
-\r
-\r
-\r
-    /* The rotator is modified from fig 4-8 to avoid extra negations. */\r
-\r
-    z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */\r
-\r
-    z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */\r
-\r
-    z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */\r
-\r
-    z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */\r
-\r
-\r
-\r
-    z11 = tmp7 + z3;           /* phase 5 */\r
-\r
-    z13 = tmp7 - z3;\r
-\r
-\r
-\r
-    dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */\r
-\r
-    dataptr[DCTSIZE*3] = z13 - z2;\r
-\r
-    dataptr[DCTSIZE*1] = z11 + z4;\r
-\r
-    dataptr[DCTSIZE*7] = z11 - z4;\r
-\r
-\r
-\r
-    dataptr++;                 /* advance pointer to next column */\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-#endif /* DCT_FLOAT_SUPPORTED */\r
-\r
diff --git a/libs/jpeg6/jidctflt.cpp b/libs/jpeg6/jidctflt.cpp
deleted file mode 100644 (file)
index 9e966da..0000000
+++ /dev/null
@@ -1,482 +0,0 @@
-/*\r
-\r
- * jidctflt.c\r
-\r
- *\r
-\r
- * Copyright (C) 1994, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains a floating-point implementation of the\r
-\r
- * inverse DCT (Discrete Cosine Transform).  In the IJG code, this routine\r
-\r
- * must also perform dequantization of the input coefficients.\r
-\r
- *\r
-\r
- * This implementation should be more accurate than either of the integer\r
-\r
- * IDCT implementations.  However, it may not give the same results on all\r
-\r
- * machines because of differences in roundoff behavior.  Speed will depend\r
-\r
- * on the hardware's floating point capacity.\r
-\r
- *\r
-\r
- * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT\r
-\r
- * on each row (or vice versa, but it's more convenient to emit a row at\r
-\r
- * a time).  Direct algorithms are also available, but they are much more\r
-\r
- * complex and seem not to be any faster when reduced to code.\r
-\r
- *\r
-\r
- * This implementation is based on Arai, Agui, and Nakajima's algorithm for\r
-\r
- * scaled DCT.  Their original paper (Trans. IEICE E-71(11):1095) is in\r
-\r
- * Japanese, but the algorithm is described in the Pennebaker & Mitchell\r
-\r
- * JPEG textbook (see REFERENCES section in file README).  The following code\r
-\r
- * is based directly on figure 4-8 in P&M.\r
-\r
- * While an 8-point DCT cannot be done in less than 11 multiplies, it is\r
-\r
- * possible to arrange the computation so that many of the multiplies are\r
-\r
- * simple scalings of the final outputs.  These multiplies can then be\r
-\r
- * folded into the multiplications or divisions by the JPEG quantization\r
-\r
- * table entries.  The AA&N method leaves only 5 multiplies and 29 adds\r
-\r
- * to be done in the DCT itself.\r
-\r
- * The primary disadvantage of this method is that with a fixed-point\r
-\r
- * implementation, accuracy is lost due to imprecise representation of the\r
-\r
- * scaled quantization values.  However, that problem does not arise if\r
-\r
- * we use floating point arithmetic.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-#include "jdct.h"              /* Private declarations for DCT subsystem */\r
-\r
-\r
-\r
-#ifdef DCT_FLOAT_SUPPORTED\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * This module is specialized to the case DCTSIZE = 8.\r
-\r
- */\r
-\r
-\r
-\r
-#if DCTSIZE != 8\r
-\r
-  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/* Dequantize a coefficient by multiplying it by the multiplier-table\r
-\r
- * entry; produce a float result.\r
-\r
- */\r
-\r
-\r
-\r
-#define DEQUANTIZE(coef,quantval)  (((FAST_FLOAT) (coef)) * (quantval))\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Perform dequantization and inverse DCT on one block of coefficients.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-                JCOEFPTR coef_block,\r
-\r
-                JSAMPARRAY output_buf, JDIMENSION output_col)\r
-\r
-{\r
-\r
-  FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;\r
-\r
-  FAST_FLOAT tmp10, tmp11, tmp12, tmp13;\r
-\r
-  FAST_FLOAT z5, z10, z11, z12, z13;\r
-\r
-  JCOEFPTR inptr;\r
-\r
-  FLOAT_MULT_TYPE * quantptr;\r
-\r
-  FAST_FLOAT * wsptr;\r
-\r
-  JSAMPROW outptr;\r
-\r
-  JSAMPLE *range_limit = IDCT_range_limit(cinfo);\r
-\r
-  int ctr;\r
-\r
-  FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */\r
-\r
-  SHIFT_TEMPS\r
-\r
-\r
-\r
-  /* Pass 1: process columns from input, store into work array. */\r
-\r
-\r
-\r
-  inptr = coef_block;\r
-\r
-  quantptr = (FLOAT_MULT_TYPE *) compptr->dct_table;\r
-\r
-  wsptr = workspace;\r
-\r
-  for (ctr = DCTSIZE; ctr > 0; ctr--) {\r
-\r
-    /* Due to quantization, we will usually find that many of the input\r
-\r
-     * coefficients are zero, especially the AC terms.  We can exploit this\r
-\r
-     * by short-circuiting the IDCT calculation for any column in which all\r
-\r
-     * the AC terms are zero.  In that case each output is equal to the\r
-\r
-     * DC coefficient (with scale factor as needed).\r
-\r
-     * With typical images and quantization tables, half or more of the\r
-\r
-     * column DCT calculations can be simplified this way.\r
-\r
-     */\r
-\r
-    \r
-\r
-    if ((inptr[DCTSIZE*1] | inptr[DCTSIZE*2] | inptr[DCTSIZE*3] |\r
-\r
-        inptr[DCTSIZE*4] | inptr[DCTSIZE*5] | inptr[DCTSIZE*6] |\r
-\r
-        inptr[DCTSIZE*7]) == 0) {\r
-\r
-      /* AC terms all zero */\r
-\r
-      FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);\r
-\r
-      \r
-\r
-      wsptr[DCTSIZE*0] = dcval;\r
-\r
-      wsptr[DCTSIZE*1] = dcval;\r
-\r
-      wsptr[DCTSIZE*2] = dcval;\r
-\r
-      wsptr[DCTSIZE*3] = dcval;\r
-\r
-      wsptr[DCTSIZE*4] = dcval;\r
-\r
-      wsptr[DCTSIZE*5] = dcval;\r
-\r
-      wsptr[DCTSIZE*6] = dcval;\r
-\r
-      wsptr[DCTSIZE*7] = dcval;\r
-\r
-      \r
-\r
-      inptr++;                 /* advance pointers to next column */\r
-\r
-      quantptr++;\r
-\r
-      wsptr++;\r
-\r
-      continue;\r
-\r
-    }\r
-\r
-    \r
-\r
-    /* Even part */\r
-\r
-\r
-\r
-    tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);\r
-\r
-    tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);\r
-\r
-    tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);\r
-\r
-    tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);\r
-\r
-\r
-\r
-    tmp10 = tmp0 + tmp2;       /* phase 3 */\r
-\r
-    tmp11 = tmp0 - tmp2;\r
-\r
-\r
-\r
-    tmp13 = tmp1 + tmp3;       /* phases 5-3 */\r
-\r
-    tmp12 = (tmp1 - tmp3) * ((FAST_FLOAT) 1.414213562) - tmp13; /* 2*c4 */\r
-\r
-\r
-\r
-    tmp0 = tmp10 + tmp13;      /* phase 2 */\r
-\r
-    tmp3 = tmp10 - tmp13;\r
-\r
-    tmp1 = tmp11 + tmp12;\r
-\r
-    tmp2 = tmp11 - tmp12;\r
-\r
-    \r
-\r
-    /* Odd part */\r
-\r
-\r
-\r
-    tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);\r
-\r
-    tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);\r
-\r
-    tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);\r
-\r
-    tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);\r
-\r
-\r
-\r
-    z13 = tmp6 + tmp5;         /* phase 6 */\r
-\r
-    z10 = tmp6 - tmp5;\r
-\r
-    z11 = tmp4 + tmp7;\r
-\r
-    z12 = tmp4 - tmp7;\r
-\r
-\r
-\r
-    tmp7 = z11 + z13;          /* phase 5 */\r
-\r
-    tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */\r
-\r
-\r
-\r
-    z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */\r
-\r
-    tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */\r
-\r
-    tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */\r
-\r
-\r
-\r
-    tmp6 = tmp12 - tmp7;       /* phase 2 */\r
-\r
-    tmp5 = tmp11 - tmp6;\r
-\r
-    tmp4 = tmp10 + tmp5;\r
-\r
-\r
-\r
-    wsptr[DCTSIZE*0] = tmp0 + tmp7;\r
-\r
-    wsptr[DCTSIZE*7] = tmp0 - tmp7;\r
-\r
-    wsptr[DCTSIZE*1] = tmp1 + tmp6;\r
-\r
-    wsptr[DCTSIZE*6] = tmp1 - tmp6;\r
-\r
-    wsptr[DCTSIZE*2] = tmp2 + tmp5;\r
-\r
-    wsptr[DCTSIZE*5] = tmp2 - tmp5;\r
-\r
-    wsptr[DCTSIZE*4] = tmp3 + tmp4;\r
-\r
-    wsptr[DCTSIZE*3] = tmp3 - tmp4;\r
-\r
-\r
-\r
-    inptr++;                   /* advance pointers to next column */\r
-\r
-    quantptr++;\r
-\r
-    wsptr++;\r
-\r
-  }\r
-\r
-  \r
-\r
-  /* Pass 2: process rows from work array, store into output array. */\r
-\r
-  /* Note that we must descale the results by a factor of 8 == 2**3. */\r
-\r
-\r
-\r
-  wsptr = workspace;\r
-\r
-  for (ctr = 0; ctr < DCTSIZE; ctr++) {\r
-\r
-    outptr = output_buf[ctr] + output_col;\r
-\r
-    /* Rows of zeroes can be exploited in the same way as we did with columns.\r
-\r
-     * However, the column calculation has created many nonzero AC terms, so\r
-\r
-     * the simplification applies less often (typically 5% to 10% of the time).\r
-\r
-     * And testing floats for zero is relatively expensive, so we don't bother.\r
-\r
-     */\r
-\r
-    \r
-\r
-    /* Even part */\r
-\r
-\r
-\r
-    tmp10 = wsptr[0] + wsptr[4];\r
-\r
-    tmp11 = wsptr[0] - wsptr[4];\r
-\r
-\r
-\r
-    tmp13 = wsptr[2] + wsptr[6];\r
-\r
-    tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13;\r
-\r
-\r
-\r
-    tmp0 = tmp10 + tmp13;\r
-\r
-    tmp3 = tmp10 - tmp13;\r
-\r
-    tmp1 = tmp11 + tmp12;\r
-\r
-    tmp2 = tmp11 - tmp12;\r
-\r
-\r
-\r
-    /* Odd part */\r
-\r
-\r
-\r
-    z13 = wsptr[5] + wsptr[3];\r
-\r
-    z10 = wsptr[5] - wsptr[3];\r
-\r
-    z11 = wsptr[1] + wsptr[7];\r
-\r
-    z12 = wsptr[1] - wsptr[7];\r
-\r
-\r
-\r
-    tmp7 = z11 + z13;\r
-\r
-    tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562);\r
-\r
-\r
-\r
-    z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */\r
-\r
-    tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */\r
-\r
-    tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */\r
-\r
-\r
-\r
-    tmp6 = tmp12 - tmp7;\r
-\r
-    tmp5 = tmp11 - tmp6;\r
-\r
-    tmp4 = tmp10 + tmp5;\r
-\r
-\r
-\r
-    /* Final output stage: scale down by a factor of 8 and range-limit */\r
-\r
-\r
-\r
-    outptr[0] = range_limit[(int) DESCALE((INT32) (tmp0 + tmp7), 3)\r
-\r
-                           & RANGE_MASK];\r
-\r
-    outptr[7] = range_limit[(int) DESCALE((INT32) (tmp0 - tmp7), 3)\r
-\r
-                           & RANGE_MASK];\r
-\r
-    outptr[1] = range_limit[(int) DESCALE((INT32) (tmp1 + tmp6), 3)\r
-\r
-                           & RANGE_MASK];\r
-\r
-    outptr[6] = range_limit[(int) DESCALE((INT32) (tmp1 - tmp6), 3)\r
-\r
-                           & RANGE_MASK];\r
-\r
-    outptr[2] = range_limit[(int) DESCALE((INT32) (tmp2 + tmp5), 3)\r
-\r
-                           & RANGE_MASK];\r
-\r
-    outptr[5] = range_limit[(int) DESCALE((INT32) (tmp2 - tmp5), 3)\r
-\r
-                           & RANGE_MASK];\r
-\r
-    outptr[4] = range_limit[(int) DESCALE((INT32) (tmp3 + tmp4), 3)\r
-\r
-                           & RANGE_MASK];\r
-\r
-    outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3)\r
-\r
-                           & RANGE_MASK];\r
-\r
-    \r
-\r
-    wsptr += DCTSIZE;          /* advance pointer to next row */\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-#endif /* DCT_FLOAT_SUPPORTED */\r
-\r
diff --git a/libs/jpeg6/jinclude.h b/libs/jpeg6/jinclude.h
deleted file mode 100644 (file)
index 5ff60fe..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*\r
- * jinclude.h\r
- *\r
- * Copyright (C) 1991-1994, Thomas G. Lane.\r
- * This file is part of the Independent JPEG Group's software.\r
- * For conditions of distribution and use, see the accompanying README file.\r
- *\r
- * This file exists to provide a single place to fix any problems with\r
- * including the wrong system include files.  (Common problems are taken\r
- * care of by the standard jconfig symbols, but on really weird systems\r
- * you may have to edit this file.)\r
- *\r
- * NOTE: this file is NOT intended to be included by applications using the\r
- * JPEG library.  Most applications need only include jpeglib.h.\r
- */\r
-\r
-\r
-/* Include auto-config file to find out which system include files we need. */\r
-\r
-#include "jconfig.h"           /* auto configuration options */\r
-#define JCONFIG_INCLUDED       /* so that jpeglib.h doesn't do it again */\r
-\r
-/*\r
- * We need the NULL macro and size_t typedef.\r
- * On an ANSI-conforming system it is sufficient to include <stddef.h>.\r
- * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to\r
- * pull in <sys/types.h> as well.\r
- * Note that the core JPEG library does not require <stdio.h>;\r
- * only the default error handler and data source/destination modules do.\r
- * But we must pull it in because of the references to FILE in jpeglib.h.\r
- * You can remove those references if you want to compile without <stdio.h>.\r
- */\r
-\r
-#ifdef HAVE_STDDEF_H\r
-#include <stddef.h>\r
-#endif\r
-\r
-#ifdef HAVE_STDLIB_H\r
-#include <stdlib.h>\r
-#endif\r
-\r
-#ifdef NEED_SYS_TYPES_H\r
-#include <sys/types.h>\r
-#endif\r
-\r
-#include <stdio.h>\r
-\r
-/*\r
- * We need memory copying and zeroing functions, plus strncpy().\r
- * ANSI and System V implementations declare these in <string.h>.\r
- * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().\r
- * Some systems may declare memset and memcpy in <memory.h>.\r
- *\r
- * NOTE: we assume the size parameters to these functions are of type size_t.\r
- * Change the casts in these macros if not!\r
- */\r
-\r
-#ifdef NEED_BSD_STRINGS\r
-\r
-#include <strings.h>\r
-#define MEMZERO(target,size)   bzero((void *)(target), (size_t)(size))\r
-#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size))\r
-\r
-#else /* not BSD, assume ANSI/SysV string lib */\r
-\r
-#include <string.h>\r
-#define MEMZERO(target,size)   memset((void *)(target), 0, (size_t)(size))\r
-#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size))\r
-\r
-#endif\r
-\r
-/*\r
- * In ANSI C, and indeed any rational implementation, size_t is also the\r
- * type returned by sizeof().  However, it seems there are some irrational\r
- * implementations out there, in which sizeof() returns an int even though\r
- * size_t is defined as long or unsigned long.  To ensure consistent results\r
- * we always use this SIZEOF() macro in place of using sizeof() directly.\r
- */\r
-\r
-#define SIZEOF(object) ((size_t) sizeof(object))\r
-\r
-/*\r
- * The modules that use fread() and fwrite() always invoke them through\r
- * these macros.  On some systems you may need to twiddle the argument casts.\r
- * CAUTION: argument order is different from underlying functions!\r
- */\r
-\r
-#define JFREAD(file,buf,sizeofbuf)  \\r
-  ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))\r
-#define JFWRITE(file,buf,sizeofbuf)  \\r
-  ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))\r
diff --git a/libs/jpeg6/jmemmgr.cpp b/libs/jpeg6/jmemmgr.cpp
deleted file mode 100644 (file)
index 9204b32..0000000
+++ /dev/null
@@ -1,2230 +0,0 @@
-/*\r
-\r
- * jmemmgr.c\r
-\r
- *\r
-\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains the JPEG system-independent memory management\r
-\r
- * routines.  This code is usable across a wide variety of machines; most\r
-\r
- * of the system dependencies have been isolated in a separate file.\r
-\r
- * The major functions provided here are:\r
-\r
- *   * pool-based allocation and freeing of memory;\r
-\r
- *   * policy decisions about how to divide available memory among the\r
-\r
- *     virtual arrays;\r
-\r
- *   * control logic for swapping virtual arrays between main memory and\r
-\r
- *     backing storage.\r
-\r
- * The separate system-dependent file provides the actual backing-storage\r
-\r
- * access code, and it contains the policy decision about how much total\r
-\r
- * main memory to use.\r
-\r
- * This file is system-dependent in the sense that some of its functions\r
-\r
- * are unnecessary in some systems.  For example, if there is enough virtual\r
-\r
- * memory so that backing storage will never be used, much of the virtual\r
-\r
- * array control logic could be removed.  (Of course, if you have that much\r
-\r
- * memory then you shouldn't care about a little bit of unused code...)\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#define AM_MEMORY_MANAGER      /* we define jvirt_Xarray_control structs */\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-#include "jmemsys.h"           /* import the system-dependent declarations */\r
-\r
-\r
-\r
-#ifndef NO_GETENV\r
-\r
-#ifndef HAVE_STDLIB_H          /* <stdlib.h> should declare getenv() */\r
-\r
-extern char * getenv JPP((const char * name));\r
-\r
-#endif\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Some important notes:\r
-\r
- *   The allocation routines provided here must never return NULL.\r
-\r
- *   They should exit to error_exit if unsuccessful.\r
-\r
- *\r
-\r
- *   It's not a good idea to try to merge the sarray and barray routines,\r
-\r
- *   even though they are textually almost the same, because samples are\r
-\r
- *   usually stored as bytes while coefficients are shorts or ints.  Thus,\r
-\r
- *   in machines where byte pointers have a different representation from\r
-\r
- *   word pointers, the resulting machine code could not be the same.\r
-\r
- */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Many machines require storage alignment: longs must start on 4-byte\r
-\r
- * boundaries, doubles on 8-byte boundaries, etc.  On such machines, malloc()\r
-\r
- * always returns pointers that are multiples of the worst-case alignment\r
-\r
- * requirement, and we had better do so too.\r
-\r
- * There isn't any really portable way to determine the worst-case alignment\r
-\r
- * requirement.  This module assumes that the alignment requirement is\r
-\r
- * multiples of sizeof(ALIGN_TYPE).\r
-\r
- * By default, we define ALIGN_TYPE as double.  This is necessary on some\r
-\r
- * workstations (where doubles really do need 8-byte alignment) and will work\r
-\r
- * fine on nearly everything.  If your machine has lesser alignment needs,\r
-\r
- * you can save a few bytes by making ALIGN_TYPE smaller.\r
-\r
- * The only place I know of where this will NOT work is certain Macintosh\r
-\r
- * 680x0 compilers that define double as a 10-byte IEEE extended float.\r
-\r
- * Doing 10-byte alignment is counterproductive because longwords won't be\r
-\r
- * aligned well.  Put "#define ALIGN_TYPE long" in jconfig.h if you have\r
-\r
- * such a compiler.\r
-\r
- */\r
-\r
-\r
-\r
-#ifndef ALIGN_TYPE             /* so can override from jconfig.h */\r
-\r
-#define ALIGN_TYPE  double\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * We allocate objects from "pools", where each pool is gotten with a single\r
-\r
- * request to jpeg_get_small() or jpeg_get_large().  There is no per-object\r
-\r
- * overhead within a pool, except for alignment padding.  Each pool has a\r
-\r
- * header with a link to the next pool of the same class.\r
-\r
- * Small and large pool headers are identical except that the latter's\r
-\r
- * link pointer must be FAR on 80x86 machines.\r
-\r
- * Notice that the "real" header fields are union'ed with a dummy ALIGN_TYPE\r
-\r
- * field.  This forces the compiler to make SIZEOF(small_pool_hdr) a multiple\r
-\r
- * of the alignment requirement of ALIGN_TYPE.\r
-\r
- */\r
-\r
-\r
-\r
-typedef union small_pool_struct * small_pool_ptr;\r
-\r
-\r
-\r
-typedef union small_pool_struct {\r
-\r
-  struct {\r
-\r
-    small_pool_ptr next;       /* next in list of pools */\r
-\r
-    size_t bytes_used;         /* how many bytes already used within pool */\r
-\r
-    size_t bytes_left;         /* bytes still available in this pool */\r
-\r
-  } hdr;\r
-\r
-  ALIGN_TYPE dummy;            /* included in union to ensure alignment */\r
-\r
-} small_pool_hdr;\r
-\r
-\r
-\r
-typedef union large_pool_struct FAR * large_pool_ptr;\r
-\r
-\r
-\r
-typedef union large_pool_struct {\r
-\r
-  struct {\r
-\r
-    large_pool_ptr next;       /* next in list of pools */\r
-\r
-    size_t bytes_used;         /* how many bytes already used within pool */\r
-\r
-    size_t bytes_left;         /* bytes still available in this pool */\r
-\r
-  } hdr;\r
-\r
-  ALIGN_TYPE dummy;            /* included in union to ensure alignment */\r
-\r
-} large_pool_hdr;\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Here is the full definition of a memory manager object.\r
-\r
- */\r
-\r
-\r
-\r
-typedef struct {\r
-\r
-  struct jpeg_memory_mgr pub;  /* public fields */\r
-\r
-\r
-\r
-  /* Each pool identifier (lifetime class) names a linked list of pools. */\r
-\r
-  small_pool_ptr small_list[JPOOL_NUMPOOLS];\r
-\r
-  large_pool_ptr large_list[JPOOL_NUMPOOLS];\r
-\r
-\r
-\r
-  /* Since we only have one lifetime class of virtual arrays, only one\r
-\r
-   * linked list is necessary (for each datatype).  Note that the virtual\r
-\r
-   * array control blocks being linked together are actually stored somewhere\r
-\r
-   * in the small-pool list.\r
-\r
-   */\r
-\r
-  jvirt_sarray_ptr virt_sarray_list;\r
-\r
-  jvirt_barray_ptr virt_barray_list;\r
-\r
-\r
-\r
-  /* This counts total space obtained from jpeg_get_small/large */\r
-\r
-  long total_space_allocated;\r
-\r
-\r
-\r
-  /* alloc_sarray and alloc_barray set this value for use by virtual\r
-\r
-   * array routines.\r
-\r
-   */\r
-\r
-  JDIMENSION last_rowsperchunk;        /* from most recent alloc_sarray/barray */\r
-\r
-} my_memory_mgr;\r
-\r
-\r
-\r
-typedef my_memory_mgr * my_mem_ptr;\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * The control blocks for virtual arrays.\r
-\r
- * Note that these blocks are allocated in the "small" pool area.\r
-\r
- * System-dependent info for the associated backing store (if any) is hidden\r
-\r
- * inside the backing_store_info struct.\r
-\r
- */\r
-\r
-\r
-\r
-struct jvirt_sarray_control {\r
-\r
-  JSAMPARRAY mem_buffer;       /* => the in-memory buffer */\r
-\r
-  JDIMENSION rows_in_array;    /* total virtual array height */\r
-\r
-  JDIMENSION samplesperrow;    /* width of array (and of memory buffer) */\r
-\r
-  JDIMENSION maxaccess;                /* max rows accessed by access_virt_sarray */\r
-\r
-  JDIMENSION rows_in_mem;      /* height of memory buffer */\r
-\r
-  JDIMENSION rowsperchunk;     /* allocation chunk size in mem_buffer */\r
-\r
-  JDIMENSION cur_start_row;    /* first logical row # in the buffer */\r
-\r
-  JDIMENSION first_undef_row;  /* row # of first uninitialized row */\r
-\r
-  boolean pre_zero;            /* pre-zero mode requested? */\r
-\r
-  boolean dirty;               /* do current buffer contents need written? */\r
-\r
-  boolean b_s_open;            /* is backing-store data valid? */\r
-\r
-  jvirt_sarray_ptr next;       /* link to next virtual sarray control block */\r
-\r
-  backing_store_info b_s_info; /* System-dependent control info */\r
-\r
-};\r
-\r
-\r
-\r
-struct jvirt_barray_control {\r
-\r
-  JBLOCKARRAY mem_buffer;      /* => the in-memory buffer */\r
-\r
-  JDIMENSION rows_in_array;    /* total virtual array height */\r
-\r
-  JDIMENSION blocksperrow;     /* width of array (and of memory buffer) */\r
-\r
-  JDIMENSION maxaccess;                /* max rows accessed by access_virt_barray */\r
-\r
-  JDIMENSION rows_in_mem;      /* height of memory buffer */\r
-\r
-  JDIMENSION rowsperchunk;     /* allocation chunk size in mem_buffer */\r
-\r
-  JDIMENSION cur_start_row;    /* first logical row # in the buffer */\r
-\r
-  JDIMENSION first_undef_row;  /* row # of first uninitialized row */\r
-\r
-  boolean pre_zero;            /* pre-zero mode requested? */\r
-\r
-  boolean dirty;               /* do current buffer contents need written? */\r
-\r
-  boolean b_s_open;            /* is backing-store data valid? */\r
-\r
-  jvirt_barray_ptr next;       /* link to next virtual barray control block */\r
-\r
-  backing_store_info b_s_info; /* System-dependent control info */\r
-\r
-};\r
-\r
-\r
-\r
-\r
-\r
-#ifdef MEM_STATS               /* optional extra stuff for statistics */\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-print_mem_stats (j_common_ptr cinfo, int pool_id)\r
-\r
-{\r
-\r
-  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;\r
-\r
-  small_pool_ptr shdr_ptr;\r
-\r
-  large_pool_ptr lhdr_ptr;\r
-\r
-\r
-\r
-  /* Since this is only a debugging stub, we can cheat a little by using\r
-\r
-   * fprintf directly rather than going through the trace message code.\r
-\r
-   * This is helpful because message parm array can't handle longs.\r
-\r
-   */\r
-\r
-  fprintf(stderr, "Freeing pool %d, total space = %ld\n",\r
-\r
-         pool_id, mem->total_space_allocated);\r
-\r
-\r
-\r
-  for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL;\r
-\r
-       lhdr_ptr = lhdr_ptr->hdr.next) {\r
-\r
-    fprintf(stderr, "  Large chunk used %ld\n",\r
-\r
-           (long) lhdr_ptr->hdr.bytes_used);\r
-\r
-  }\r
-\r
-\r
-\r
-  for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL;\r
-\r
-       shdr_ptr = shdr_ptr->hdr.next) {\r
-\r
-    fprintf(stderr, "  Small chunk used %ld free %ld\n",\r
-\r
-           (long) shdr_ptr->hdr.bytes_used,\r
-\r
-           (long) shdr_ptr->hdr.bytes_left);\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-#endif /* MEM_STATS */\r
-\r
-\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-out_of_memory (j_common_ptr cinfo, int which)\r
-\r
-/* Report an out-of-memory error and stop execution */\r
-\r
-/* If we compiled MEM_STATS support, report alloc requests before dying */\r
-\r
-{\r
-\r
-#ifdef MEM_STATS\r
-\r
-  cinfo->err->trace_level = 2; /* force self_destruct to report stats */\r
-\r
-#endif\r
-\r
-  ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, which);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Allocation of "small" objects.\r
-\r
- *\r
-\r
- * For these, we use pooled storage.  When a new pool must be created,\r
-\r
- * we try to get enough space for the current request plus a "slop" factor,\r
-\r
- * where the slop will be the amount of leftover space in the new pool.\r
-\r
- * The speed vs. space tradeoff is largely determined by the slop values.\r
-\r
- * A different slop value is provided for each pool class (lifetime),\r
-\r
- * and we also distinguish the first pool of a class from later ones.\r
-\r
- * NOTE: the values given work fairly well on both 16- and 32-bit-int\r
-\r
- * machines, but may be too small if longs are 64 bits or more.\r
-\r
- */\r
-\r
-\r
-\r
-static const size_t first_pool_slop[JPOOL_NUMPOOLS] = \r
-\r
-{\r
-\r
-       1600,                   /* first PERMANENT pool */\r
-\r
-       16000                   /* first IMAGE pool */\r
-\r
-};\r
-\r
-\r
-\r
-static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = \r
-\r
-{\r
-\r
-       0,                      /* additional PERMANENT pools */\r
-\r
-       5000                    /* additional IMAGE pools */\r
-\r
-};\r
-\r
-\r
-\r
-#define MIN_SLOP  50           /* greater than 0 to avoid futile looping */\r
-\r
-\r
-\r
-\r
-\r
-METHODDEF void *\r
-\r
-alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)\r
-\r
-/* Allocate a "small" object */\r
-\r
-{\r
-\r
-  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;\r
-\r
-  small_pool_ptr hdr_ptr, prev_hdr_ptr;\r
-\r
-  char * data_ptr;\r
-\r
-  size_t odd_bytes, min_request, slop;\r
-\r
-\r
-\r
-  /* Check for unsatisfiable request (do now to ensure no overflow below) */\r
-\r
-  if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(small_pool_hdr)))\r
-\r
-    out_of_memory(cinfo, 1);   /* request exceeds malloc's ability */\r
-\r
-\r
-\r
-  /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */\r
-\r
-  odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE);\r
-\r
-  if (odd_bytes > 0)\r
-\r
-    sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes;\r
-\r
-\r
-\r
-  /* See if space is available in any existing pool */\r
-\r
-  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);        /* safety check */\r
-\r
-  prev_hdr_ptr = NULL;\r
-\r
-  hdr_ptr = mem->small_list[pool_id];\r
-\r
-  while (hdr_ptr != NULL) {\r
-\r
-    if (hdr_ptr->hdr.bytes_left >= sizeofobject)\r
-\r
-      break;                   /* found pool with enough space */\r
-\r
-    prev_hdr_ptr = hdr_ptr;\r
-\r
-    hdr_ptr = hdr_ptr->hdr.next;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Time to make a new pool? */\r
-\r
-  if (hdr_ptr == NULL) {\r
-\r
-    /* min_request is what we need now, slop is what will be leftover */\r
-\r
-    min_request = sizeofobject + SIZEOF(small_pool_hdr);\r
-\r
-    if (prev_hdr_ptr == NULL)  /* first pool in class? */\r
-\r
-      slop = first_pool_slop[pool_id];\r
-\r
-    else\r
-\r
-      slop = extra_pool_slop[pool_id];\r
-\r
-    /* Don't ask for more than MAX_ALLOC_CHUNK */\r
-\r
-    if (slop > (size_t) (MAX_ALLOC_CHUNK-min_request))\r
-\r
-      slop = (size_t) (MAX_ALLOC_CHUNK-min_request);\r
-\r
-    /* Try to get space, if fail reduce slop and try again */\r
-\r
-    for (;;) {\r
-\r
-      hdr_ptr = (small_pool_ptr) jpeg_get_small(cinfo, min_request + slop);\r
-\r
-      if (hdr_ptr != NULL)\r
-\r
-       break;\r
-\r
-      slop /= 2;\r
-\r
-      if (slop < MIN_SLOP)     /* give up when it gets real small */\r
-\r
-       out_of_memory(cinfo, 2); /* jpeg_get_small failed */\r
-\r
-    }\r
-\r
-    mem->total_space_allocated += min_request + slop;\r
-\r
-    /* Success, initialize the new pool header and add to end of list */\r
-\r
-    hdr_ptr->hdr.next = NULL;\r
-\r
-    hdr_ptr->hdr.bytes_used = 0;\r
-\r
-    hdr_ptr->hdr.bytes_left = sizeofobject + slop;\r
-\r
-    if (prev_hdr_ptr == NULL)  /* first pool in class? */\r
-\r
-      mem->small_list[pool_id] = hdr_ptr;\r
-\r
-    else\r
-\r
-      prev_hdr_ptr->hdr.next = hdr_ptr;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* OK, allocate the object from the current pool */\r
-\r
-  data_ptr = (char *) (hdr_ptr + 1); /* point to first data byte in pool */\r
-\r
-  data_ptr += hdr_ptr->hdr.bytes_used; /* point to place for object */\r
-\r
-  hdr_ptr->hdr.bytes_used += sizeofobject;\r
-\r
-  hdr_ptr->hdr.bytes_left -= sizeofobject;\r
-\r
-\r
-\r
-  return (void *) data_ptr;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Allocation of "large" objects.\r
-\r
- *\r
-\r
- * The external semantics of these are the same as "small" objects,\r
-\r
- * except that FAR pointers are used on 80x86.  However the pool\r
-\r
- * management heuristics are quite different.  We assume that each\r
-\r
- * request is large enough that it may as well be passed directly to\r
-\r
- * jpeg_get_large; the pool management just links everything together\r
-\r
- * so that we can free it all on demand.\r
-\r
- * Note: the major use of "large" objects is in JSAMPARRAY and JBLOCKARRAY\r
-\r
- * structures.  The routines that create these structures (see below)\r
-\r
- * deliberately bunch rows together to ensure a large request size.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void FAR *\r
-\r
-alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)\r
-\r
-/* Allocate a "large" object */\r
-\r
-{\r
-\r
-  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;\r
-\r
-  large_pool_ptr hdr_ptr;\r
-\r
-  size_t odd_bytes;\r
-\r
-\r
-\r
-  /* Check for unsatisfiable request (do now to ensure no overflow below) */\r
-\r
-  if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)))\r
-\r
-    out_of_memory(cinfo, 3);   /* request exceeds malloc's ability */\r
-\r
-\r
-\r
-  /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */\r
-\r
-  odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE);\r
-\r
-  if (odd_bytes > 0)\r
-\r
-    sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes;\r
-\r
-\r
-\r
-  /* Always make a new pool */\r
-\r
-  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);        /* safety check */\r
-\r
-\r
-\r
-  hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject +\r
-\r
-                                           SIZEOF(large_pool_hdr));\r
-\r
-  if (hdr_ptr == NULL)\r
-\r
-    out_of_memory(cinfo, 4);   /* jpeg_get_large failed */\r
-\r
-  mem->total_space_allocated += sizeofobject + SIZEOF(large_pool_hdr);\r
-\r
-\r
-\r
-  /* Success, initialize the new pool header and add to list */\r
-\r
-  hdr_ptr->hdr.next = mem->large_list[pool_id];\r
-\r
-  /* We maintain space counts in each pool header for statistical purposes,\r
-\r
-   * even though they are not needed for allocation.\r
-\r
-   */\r
-\r
-  hdr_ptr->hdr.bytes_used = sizeofobject;\r
-\r
-  hdr_ptr->hdr.bytes_left = 0;\r
-\r
-  mem->large_list[pool_id] = hdr_ptr;\r
-\r
-\r
-\r
-  return (void FAR *) (hdr_ptr + 1); /* point to first data byte in pool */\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Creation of 2-D sample arrays.\r
-\r
- * The pointers are in near heap, the samples themselves in FAR heap.\r
-\r
- *\r
-\r
- * To minimize allocation overhead and to allow I/O of large contiguous\r
-\r
- * blocks, we allocate the sample rows in groups of as many rows as possible\r
-\r
- * without exceeding MAX_ALLOC_CHUNK total bytes per allocation request.\r
-\r
- * NB: the virtual array control routines, later in this file, know about\r
-\r
- * this chunking of rows.  The rowsperchunk value is left in the mem manager\r
-\r
- * object so that it can be saved away if this sarray is the workspace for\r
-\r
- * a virtual array.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF JSAMPARRAY\r
-\r
-alloc_sarray (j_common_ptr cinfo, int pool_id,\r
-\r
-             JDIMENSION samplesperrow, JDIMENSION numrows)\r
-\r
-/* Allocate a 2-D sample array */\r
-\r
-{\r
-\r
-  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;\r
-\r
-  JSAMPARRAY result;\r
-\r
-  JSAMPROW workspace;\r
-\r
-  JDIMENSION rowsperchunk, currow, i;\r
-\r
-  long ltemp;\r
-\r
-\r
-\r
-  /* Calculate max # of rows allowed in one allocation chunk */\r
-\r
-  ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /\r
-\r
-         ((long) samplesperrow * SIZEOF(JSAMPLE));\r
-\r
-  if (ltemp <= 0)\r
-\r
-    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);\r
-\r
-  if (ltemp < (long) numrows)\r
-\r
-    rowsperchunk = (JDIMENSION) ltemp;\r
-\r
-  else\r
-\r
-    rowsperchunk = numrows;\r
-\r
-  mem->last_rowsperchunk = rowsperchunk;\r
-\r
-\r
-\r
-  /* Get space for row pointers (small object) */\r
-\r
-  result = (JSAMPARRAY) alloc_small(cinfo, pool_id,\r
-\r
-                                   (size_t) (numrows * SIZEOF(JSAMPROW)));\r
-\r
-\r
-\r
-  /* Get the rows themselves (large objects) */\r
-\r
-  currow = 0;\r
-\r
-  while (currow < numrows) {\r
-\r
-    rowsperchunk = MIN(rowsperchunk, numrows - currow);\r
-\r
-    workspace = (JSAMPROW) alloc_large(cinfo, pool_id,\r
-\r
-       (size_t) ((size_t) rowsperchunk * (size_t) samplesperrow\r
-\r
-                 * SIZEOF(JSAMPLE)));\r
-\r
-    for (i = rowsperchunk; i > 0; i--) {\r
-\r
-      result[currow++] = workspace;\r
-\r
-      workspace += samplesperrow;\r
-\r
-    }\r
-\r
-  }\r
-\r
-\r
-\r
-  return result;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Creation of 2-D coefficient-block arrays.\r
-\r
- * This is essentially the same as the code for sample arrays, above.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF JBLOCKARRAY\r
-\r
-alloc_barray (j_common_ptr cinfo, int pool_id,\r
-\r
-             JDIMENSION blocksperrow, JDIMENSION numrows)\r
-\r
-/* Allocate a 2-D coefficient-block array */\r
-\r
-{\r
-\r
-  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;\r
-\r
-  JBLOCKARRAY result;\r
-\r
-  JBLOCKROW workspace;\r
-\r
-  JDIMENSION rowsperchunk, currow, i;\r
-\r
-  long ltemp;\r
-\r
-\r
-\r
-  /* Calculate max # of rows allowed in one allocation chunk */\r
-\r
-  ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /\r
-\r
-         ((long) blocksperrow * SIZEOF(JBLOCK));\r
-\r
-  if (ltemp <= 0)\r
-\r
-    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);\r
-\r
-  if (ltemp < (long) numrows)\r
-\r
-    rowsperchunk = (JDIMENSION) ltemp;\r
-\r
-  else\r
-\r
-    rowsperchunk = numrows;\r
-\r
-  mem->last_rowsperchunk = rowsperchunk;\r
-\r
-\r
-\r
-  /* Get space for row pointers (small object) */\r
-\r
-  result = (JBLOCKARRAY) alloc_small(cinfo, pool_id,\r
-\r
-                                    (size_t) (numrows * SIZEOF(JBLOCKROW)));\r
-\r
-\r
-\r
-  /* Get the rows themselves (large objects) */\r
-\r
-  currow = 0;\r
-\r
-  while (currow < numrows) {\r
-\r
-    rowsperchunk = MIN(rowsperchunk, numrows - currow);\r
-\r
-    workspace = (JBLOCKROW) alloc_large(cinfo, pool_id,\r
-\r
-       (size_t) ((size_t) rowsperchunk * (size_t) blocksperrow\r
-\r
-                 * SIZEOF(JBLOCK)));\r
-\r
-    for (i = rowsperchunk; i > 0; i--) {\r
-\r
-      result[currow++] = workspace;\r
-\r
-      workspace += blocksperrow;\r
-\r
-    }\r
-\r
-  }\r
-\r
-\r
-\r
-  return result;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * About virtual array management:\r
-\r
- *\r
-\r
- * The above "normal" array routines are only used to allocate strip buffers\r
-\r
- * (as wide as the image, but just a few rows high).  Full-image-sized buffers\r
-\r
- * are handled as "virtual" arrays.  The array is still accessed a strip at a\r
-\r
- * time, but the memory manager must save the whole array for repeated\r
-\r
- * accesses.  The intended implementation is that there is a strip buffer in\r
-\r
- * memory (as high as is possible given the desired memory limit), plus a\r
-\r
- * backing file that holds the rest of the array.\r
-\r
- *\r
-\r
- * The request_virt_array routines are told the total size of the image and\r
-\r
- * the maximum number of rows that will be accessed at once.  The in-memory\r
-\r
- * buffer must be at least as large as the maxaccess value.\r
-\r
- *\r
-\r
- * The request routines create control blocks but not the in-memory buffers.\r
-\r
- * That is postponed until realize_virt_arrays is called.  At that time the\r
-\r
- * total amount of space needed is known (approximately, anyway), so free\r
-\r
- * memory can be divided up fairly.\r
-\r
- *\r
-\r
- * The access_virt_array routines are responsible for making a specific strip\r
-\r
- * area accessible (after reading or writing the backing file, if necessary).\r
-\r
- * Note that the access routines are told whether the caller intends to modify\r
-\r
- * the accessed strip; during a read-only pass this saves having to rewrite\r
-\r
- * data to disk.  The access routines are also responsible for pre-zeroing\r
-\r
- * any newly accessed rows, if pre-zeroing was requested.\r
-\r
- *\r
-\r
- * In current usage, the access requests are usually for nonoverlapping\r
-\r
- * strips; that is, successive access start_row numbers differ by exactly\r
-\r
- * num_rows = maxaccess.  This means we can get good performance with simple\r
-\r
- * buffer dump/reload logic, by making the in-memory buffer be a multiple\r
-\r
- * of the access height; then there will never be accesses across bufferload\r
-\r
- * boundaries.  The code will still work with overlapping access requests,\r
-\r
- * but it doesn't handle bufferload overlaps very efficiently.\r
-\r
- */\r
-\r
-\r
-\r
-\r
-\r
-METHODDEF jvirt_sarray_ptr\r
-\r
-request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero,\r
-\r
-                    JDIMENSION samplesperrow, JDIMENSION numrows,\r
-\r
-                    JDIMENSION maxaccess)\r
-\r
-/* Request a virtual 2-D sample array */\r
-\r
-{\r
-\r
-  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;\r
-\r
-  jvirt_sarray_ptr result;\r
-\r
-\r
-\r
-  /* Only IMAGE-lifetime virtual arrays are currently supported */\r
-\r
-  if (pool_id != JPOOL_IMAGE)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);        /* safety check */\r
-\r
-\r
-\r
-  /* get control block */\r
-\r
-  result = (jvirt_sarray_ptr) alloc_small(cinfo, pool_id,\r
-\r
-                                         SIZEOF(struct jvirt_sarray_control));\r
-\r
-\r
-\r
-  result->mem_buffer = NULL;   /* marks array not yet realized */\r
-\r
-  result->rows_in_array = numrows;\r
-\r
-  result->samplesperrow = samplesperrow;\r
-\r
-  result->maxaccess = maxaccess;\r
-\r
-  result->pre_zero = pre_zero;\r
-\r
-  result->b_s_open = FALSE;    /* no associated backing-store object */\r
-\r
-  result->next = mem->virt_sarray_list; /* add to list of virtual arrays */\r
-\r
-  mem->virt_sarray_list = result;\r
-\r
-\r
-\r
-  return result;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-METHODDEF jvirt_barray_ptr\r
-\r
-request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero,\r
-\r
-                    JDIMENSION blocksperrow, JDIMENSION numrows,\r
-\r
-                    JDIMENSION maxaccess)\r
-\r
-/* Request a virtual 2-D coefficient-block array */\r
-\r
-{\r
-\r
-  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;\r
-\r
-  jvirt_barray_ptr result;\r
-\r
-\r
-\r
-  /* Only IMAGE-lifetime virtual arrays are currently supported */\r
-\r
-  if (pool_id != JPOOL_IMAGE)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);        /* safety check */\r
-\r
-\r
-\r
-  /* get control block */\r
-\r
-  result = (jvirt_barray_ptr) alloc_small(cinfo, pool_id,\r
-\r
-                                         SIZEOF(struct jvirt_barray_control));\r
-\r
-\r
-\r
-  result->mem_buffer = NULL;   /* marks array not yet realized */\r
-\r
-  result->rows_in_array = numrows;\r
-\r
-  result->blocksperrow = blocksperrow;\r
-\r
-  result->maxaccess = maxaccess;\r
-\r
-  result->pre_zero = pre_zero;\r
-\r
-  result->b_s_open = FALSE;    /* no associated backing-store object */\r
-\r
-  result->next = mem->virt_barray_list; /* add to list of virtual arrays */\r
-\r
-  mem->virt_barray_list = result;\r
-\r
-\r
-\r
-  return result;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-realize_virt_arrays (j_common_ptr cinfo)\r
-\r
-/* Allocate the in-memory buffers for any unrealized virtual arrays */\r
-\r
-{\r
-\r
-  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;\r
-\r
-  long space_per_minheight, maximum_space, avail_mem;\r
-\r
-  long minheights, max_minheights;\r
-\r
-  jvirt_sarray_ptr sptr;\r
-\r
-  jvirt_barray_ptr bptr;\r
-\r
-\r
-\r
-  /* Compute the minimum space needed (maxaccess rows in each buffer)\r
-\r
-   * and the maximum space needed (full image height in each buffer).\r
-\r
-   * These may be of use to the system-dependent jpeg_mem_available routine.\r
-\r
-   */\r
-\r
-  space_per_minheight = 0;\r
-\r
-  maximum_space = 0;\r
-\r
-  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {\r
-\r
-    if (sptr->mem_buffer == NULL) { /* if not realized yet */\r
-\r
-      space_per_minheight += (long) sptr->maxaccess *\r
-\r
-                            (long) sptr->samplesperrow * SIZEOF(JSAMPLE);\r
-\r
-      maximum_space += (long) sptr->rows_in_array *\r
-\r
-                      (long) sptr->samplesperrow * SIZEOF(JSAMPLE);\r
-\r
-    }\r
-\r
-  }\r
-\r
-  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {\r
-\r
-    if (bptr->mem_buffer == NULL) { /* if not realized yet */\r
-\r
-      space_per_minheight += (long) bptr->maxaccess *\r
-\r
-                            (long) bptr->blocksperrow * SIZEOF(JBLOCK);\r
-\r
-      maximum_space += (long) bptr->rows_in_array *\r
-\r
-                      (long) bptr->blocksperrow * SIZEOF(JBLOCK);\r
-\r
-    }\r
-\r
-  }\r
-\r
-\r
-\r
-  if (space_per_minheight <= 0)\r
-\r
-    return;                    /* no unrealized arrays, no work */\r
-\r
-\r
-\r
-  /* Determine amount of memory to actually use; this is system-dependent. */\r
-\r
-  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,\r
-\r
-                                mem->total_space_allocated);\r
-\r
-\r
-\r
-  /* If the maximum space needed is available, make all the buffers full\r
-\r
-   * height; otherwise parcel it out with the same number of minheights\r
-\r
-   * in each buffer.\r
-\r
-   */\r
-\r
-  if (avail_mem >= maximum_space)\r
-\r
-    max_minheights = 1000000000L;\r
-\r
-  else {\r
-\r
-    max_minheights = avail_mem / space_per_minheight;\r
-\r
-    /* If there doesn't seem to be enough space, try to get the minimum\r
-\r
-     * anyway.  This allows a "stub" implementation of jpeg_mem_available().\r
-\r
-     */\r
-\r
-    if (max_minheights <= 0)\r
-\r
-      max_minheights = 1;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Allocate the in-memory buffers and initialize backing store as needed. */\r
-\r
-\r
-\r
-  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {\r
-\r
-    if (sptr->mem_buffer == NULL) { /* if not realized yet */\r
-\r
-      minheights = ((long) sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;\r
-\r
-      if (minheights <= max_minheights) {\r
-\r
-       /* This buffer fits in memory */\r
-\r
-       sptr->rows_in_mem = sptr->rows_in_array;\r
-\r
-      } else {\r
-\r
-       /* It doesn't fit in memory, create backing store. */\r
-\r
-       sptr->rows_in_mem = (JDIMENSION) (max_minheights * sptr->maxaccess);\r
-\r
-       jpeg_open_backing_store(cinfo, & sptr->b_s_info,\r
-\r
-                               (long) sptr->rows_in_array *\r
-\r
-                               (long) sptr->samplesperrow *\r
-\r
-                               (long) SIZEOF(JSAMPLE));\r
-\r
-       sptr->b_s_open = TRUE;\r
-\r
-      }\r
-\r
-      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,\r
-\r
-                                     sptr->samplesperrow, sptr->rows_in_mem);\r
-\r
-      sptr->rowsperchunk = mem->last_rowsperchunk;\r
-\r
-      sptr->cur_start_row = 0;\r
-\r
-      sptr->first_undef_row = 0;\r
-\r
-      sptr->dirty = FALSE;\r
-\r
-    }\r
-\r
-  }\r
-\r
-\r
-\r
-  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {\r
-\r
-    if (bptr->mem_buffer == NULL) { /* if not realized yet */\r
-\r
-      minheights = ((long) bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;\r
-\r
-      if (minheights <= max_minheights) {\r
-\r
-       /* This buffer fits in memory */\r
-\r
-       bptr->rows_in_mem = bptr->rows_in_array;\r
-\r
-      } else {\r
-\r
-       /* It doesn't fit in memory, create backing store. */\r
-\r
-       bptr->rows_in_mem = (JDIMENSION) (max_minheights * bptr->maxaccess);\r
-\r
-       jpeg_open_backing_store(cinfo, & bptr->b_s_info,\r
-\r
-                               (long) bptr->rows_in_array *\r
-\r
-                               (long) bptr->blocksperrow *\r
-\r
-                               (long) SIZEOF(JBLOCK));\r
-\r
-       bptr->b_s_open = TRUE;\r
-\r
-      }\r
-\r
-      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,\r
-\r
-                                     bptr->blocksperrow, bptr->rows_in_mem);\r
-\r
-      bptr->rowsperchunk = mem->last_rowsperchunk;\r
-\r
-      bptr->cur_start_row = 0;\r
-\r
-      bptr->first_undef_row = 0;\r
-\r
-      bptr->dirty = FALSE;\r
-\r
-    }\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)\r
-\r
-/* Do backing store read or write of a virtual sample array */\r
-\r
-{\r
-\r
-  long bytesperrow, file_offset, byte_count, rows, thisrow, i;\r
-\r
-\r
-\r
-  bytesperrow = (long) ptr->samplesperrow * SIZEOF(JSAMPLE);\r
-\r
-  file_offset = ptr->cur_start_row * bytesperrow;\r
-\r
-  /* Loop to read or write each allocation chunk in mem_buffer */\r
-\r
-  for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {\r
-\r
-    /* One chunk, but check for short chunk at end of buffer */\r
-\r
-    rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i);\r
-\r
-    /* Transfer no more than is currently defined */\r
-\r
-    thisrow = (long) ptr->cur_start_row + i;\r
-\r
-    rows = MIN(rows, (long) ptr->first_undef_row - thisrow);\r
-\r
-    /* Transfer no more than fits in file */\r
-\r
-    rows = MIN(rows, (long) ptr->rows_in_array - thisrow);\r
-\r
-    if (rows <= 0)             /* this chunk might be past end of file! */\r
-\r
-      break;\r
-\r
-    byte_count = rows * bytesperrow;\r
-\r
-    if (writing)\r
-\r
-      (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info,\r
-\r
-                                           (void FAR *) ptr->mem_buffer[i],\r
-\r
-                                           file_offset, byte_count);\r
-\r
-    else\r
-\r
-      (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info,\r
-\r
-                                          (void FAR *) ptr->mem_buffer[i],\r
-\r
-                                          file_offset, byte_count);\r
-\r
-    file_offset += byte_count;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-LOCAL void\r
-\r
-do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)\r
-\r
-/* Do backing store read or write of a virtual coefficient-block array */\r
-\r
-{\r
-\r
-  long bytesperrow, file_offset, byte_count, rows, thisrow, i;\r
-\r
-\r
-\r
-  bytesperrow = (long) ptr->blocksperrow * SIZEOF(JBLOCK);\r
-\r
-  file_offset = ptr->cur_start_row * bytesperrow;\r
-\r
-  /* Loop to read or write each allocation chunk in mem_buffer */\r
-\r
-  for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {\r
-\r
-    /* One chunk, but check for short chunk at end of buffer */\r
-\r
-    rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i);\r
-\r
-    /* Transfer no more than is currently defined */\r
-\r
-    thisrow = (long) ptr->cur_start_row + i;\r
-\r
-    rows = MIN(rows, (long) ptr->first_undef_row - thisrow);\r
-\r
-    /* Transfer no more than fits in file */\r
-\r
-    rows = MIN(rows, (long) ptr->rows_in_array - thisrow);\r
-\r
-    if (rows <= 0)             /* this chunk might be past end of file! */\r
-\r
-      break;\r
-\r
-    byte_count = rows * bytesperrow;\r
-\r
-    if (writing)\r
-\r
-      (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info,\r
-\r
-                                           (void FAR *) ptr->mem_buffer[i],\r
-\r
-                                           file_offset, byte_count);\r
-\r
-    else\r
-\r
-      (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info,\r
-\r
-                                          (void FAR *) ptr->mem_buffer[i],\r
-\r
-                                          file_offset, byte_count);\r
-\r
-    file_offset += byte_count;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-METHODDEF JSAMPARRAY\r
-\r
-access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,\r
-\r
-                   JDIMENSION start_row, JDIMENSION num_rows,\r
-\r
-                   boolean writable)\r
-\r
-/* Access the part of a virtual sample array starting at start_row */\r
-\r
-/* and extending for num_rows rows.  writable is true if  */\r
-\r
-/* caller intends to modify the accessed area. */\r
-\r
-{\r
-\r
-  JDIMENSION end_row = start_row + num_rows;\r
-\r
-  JDIMENSION undef_row;\r
-\r
-\r
-\r
-  /* debugging check */\r
-\r
-  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||\r
-\r
-      ptr->mem_buffer == NULL)\r
-\r
-    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);\r
-\r
-\r
-\r
-  /* Make the desired part of the virtual array accessible */\r
-\r
-  if (start_row < ptr->cur_start_row ||\r
-\r
-      end_row > ptr->cur_start_row+ptr->rows_in_mem) {\r
-\r
-    if (! ptr->b_s_open)\r
-\r
-      ERREXIT(cinfo, JERR_VIRTUAL_BUG);\r
-\r
-    /* Flush old buffer contents if necessary */\r
-\r
-    if (ptr->dirty) {\r
-\r
-      do_sarray_io(cinfo, ptr, TRUE);\r
-\r
-      ptr->dirty = FALSE;\r
-\r
-    }\r
-\r
-    /* Decide what part of virtual array to access.\r
-\r
-     * Algorithm: if target address > current window, assume forward scan,\r
-\r
-     * load starting at target address.  If target address < current window,\r
-\r
-     * assume backward scan, load so that target area is top of window.\r
-\r
-     * Note that when switching from forward write to forward read, will have\r
-\r
-     * start_row = 0, so the limiting case applies and we load from 0 anyway.\r
-\r
-     */\r
-\r
-    if (start_row > ptr->cur_start_row) {\r
-\r
-      ptr->cur_start_row = start_row;\r
-\r
-    } else {\r
-\r
-      /* use long arithmetic here to avoid overflow & unsigned problems */\r
-\r
-      long ltemp;\r
-\r
-\r
-\r
-      ltemp = (long) end_row - (long) ptr->rows_in_mem;\r
-\r
-      if (ltemp < 0)\r
-\r
-       ltemp = 0;              /* don't fall off front end of file */\r
-\r
-      ptr->cur_start_row = (JDIMENSION) ltemp;\r
-\r
-    }\r
-\r
-    /* Read in the selected part of the array.\r
-\r
-     * During the initial write pass, we will do no actual read\r
-\r
-     * because the selected part is all undefined.\r
-\r
-     */\r
-\r
-    do_sarray_io(cinfo, ptr, FALSE);\r
-\r
-  }\r
-\r
-  /* Ensure the accessed part of the array is defined; prezero if needed.\r
-\r
-   * To improve locality of access, we only prezero the part of the array\r
-\r
-   * that the caller is about to access, not the entire in-memory array.\r
-\r
-   */\r
-\r
-  if (ptr->first_undef_row < end_row) {\r
-\r
-    if (ptr->first_undef_row < start_row) {\r
-\r
-      if (writable)            /* writer skipped over a section of array */\r
-\r
-       ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);\r
-\r
-      undef_row = start_row;   /* but reader is allowed to read ahead */\r
-\r
-    } else {\r
-\r
-      undef_row = ptr->first_undef_row;\r
-\r
-    }\r
-\r
-    if (writable)\r
-\r
-      ptr->first_undef_row = end_row;\r
-\r
-    if (ptr->pre_zero) {\r
-\r
-      size_t bytesperrow = (size_t) ptr->samplesperrow * SIZEOF(JSAMPLE);\r
-\r
-      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */\r
-\r
-      end_row -= ptr->cur_start_row;\r
-\r
-      while (undef_row < end_row) {\r
-\r
-       jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow);\r
-\r
-       undef_row++;\r
-\r
-      }\r
-\r
-    } else {\r
-\r
-      if (! writable)          /* reader looking at undefined data */\r
-\r
-       ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);\r
-\r
-    }\r
-\r
-  }\r
-\r
-  /* Flag the buffer dirty if caller will write in it */\r
-\r
-  if (writable)\r
-\r
-    ptr->dirty = TRUE;\r
-\r
-  /* Return address of proper part of the buffer */\r
-\r
-  return ptr->mem_buffer + (start_row - ptr->cur_start_row);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-METHODDEF JBLOCKARRAY\r
-\r
-access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,\r
-\r
-                   JDIMENSION start_row, JDIMENSION num_rows,\r
-\r
-                   boolean writable)\r
-\r
-/* Access the part of a virtual block array starting at start_row */\r
-\r
-/* and extending for num_rows rows.  writable is true if  */\r
-\r
-/* caller intends to modify the accessed area. */\r
-\r
-{\r
-\r
-  JDIMENSION end_row = start_row + num_rows;\r
-\r
-  JDIMENSION undef_row;\r
-\r
-\r
-\r
-  /* debugging check */\r
-\r
-  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||\r
-\r
-      ptr->mem_buffer == NULL)\r
-\r
-    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);\r
-\r
-\r
-\r
-  /* Make the desired part of the virtual array accessible */\r
-\r
-  if (start_row < ptr->cur_start_row ||\r
-\r
-      end_row > ptr->cur_start_row+ptr->rows_in_mem) {\r
-\r
-    if (! ptr->b_s_open)\r
-\r
-      ERREXIT(cinfo, JERR_VIRTUAL_BUG);\r
-\r
-    /* Flush old buffer contents if necessary */\r
-\r
-    if (ptr->dirty) {\r
-\r
-      do_barray_io(cinfo, ptr, TRUE);\r
-\r
-      ptr->dirty = FALSE;\r
-\r
-    }\r
-\r
-    /* Decide what part of virtual array to access.\r
-\r
-     * Algorithm: if target address > current window, assume forward scan,\r
-\r
-     * load starting at target address.  If target address < current window,\r
-\r
-     * assume backward scan, load so that target area is top of window.\r
-\r
-     * Note that when switching from forward write to forward read, will have\r
-\r
-     * start_row = 0, so the limiting case applies and we load from 0 anyway.\r
-\r
-     */\r
-\r
-    if (start_row > ptr->cur_start_row) {\r
-\r
-      ptr->cur_start_row = start_row;\r
-\r
-    } else {\r
-\r
-      /* use long arithmetic here to avoid overflow & unsigned problems */\r
-\r
-      long ltemp;\r
-\r
-\r
-\r
-      ltemp = (long) end_row - (long) ptr->rows_in_mem;\r
-\r
-      if (ltemp < 0)\r
-\r
-       ltemp = 0;              /* don't fall off front end of file */\r
-\r
-      ptr->cur_start_row = (JDIMENSION) ltemp;\r
-\r
-    }\r
-\r
-    /* Read in the selected part of the array.\r
-\r
-     * During the initial write pass, we will do no actual read\r
-\r
-     * because the selected part is all undefined.\r
-\r
-     */\r
-\r
-    do_barray_io(cinfo, ptr, FALSE);\r
-\r
-  }\r
-\r
-  /* Ensure the accessed part of the array is defined; prezero if needed.\r
-\r
-   * To improve locality of access, we only prezero the part of the array\r
-\r
-   * that the caller is about to access, not the entire in-memory array.\r
-\r
-   */\r
-\r
-  if (ptr->first_undef_row < end_row) {\r
-\r
-    if (ptr->first_undef_row < start_row) {\r
-\r
-      if (writable)            /* writer skipped over a section of array */\r
-\r
-       ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);\r
-\r
-      undef_row = start_row;   /* but reader is allowed to read ahead */\r
-\r
-    } else {\r
-\r
-      undef_row = ptr->first_undef_row;\r
-\r
-    }\r
-\r
-    if (writable)\r
-\r
-      ptr->first_undef_row = end_row;\r
-\r
-    if (ptr->pre_zero) {\r
-\r
-      size_t bytesperrow = (size_t) ptr->blocksperrow * SIZEOF(JBLOCK);\r
-\r
-      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */\r
-\r
-      end_row -= ptr->cur_start_row;\r
-\r
-      while (undef_row < end_row) {\r
-\r
-       jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow);\r
-\r
-       undef_row++;\r
-\r
-      }\r
-\r
-    } else {\r
-\r
-      if (! writable)          /* reader looking at undefined data */\r
-\r
-       ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);\r
-\r
-    }\r
-\r
-  }\r
-\r
-  /* Flag the buffer dirty if caller will write in it */\r
-\r
-  if (writable)\r
-\r
-    ptr->dirty = TRUE;\r
-\r
-  /* Return address of proper part of the buffer */\r
-\r
-  return ptr->mem_buffer + (start_row - ptr->cur_start_row);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Release all objects belonging to a specified pool.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-free_pool (j_common_ptr cinfo, int pool_id)\r
-\r
-{\r
-\r
-  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;\r
-\r
-  small_pool_ptr shdr_ptr;\r
-\r
-  large_pool_ptr lhdr_ptr;\r
-\r
-  size_t space_freed;\r
-\r
-\r
-\r
-  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)\r
-\r
-    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);        /* safety check */\r
-\r
-\r
-\r
-#ifdef MEM_STATS\r
-\r
-  if (cinfo->err->trace_level > 1)\r
-\r
-    print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */\r
-\r
-#endif\r
-\r
-\r
-\r
-  /* If freeing IMAGE pool, close any virtual arrays first */\r
-\r
-  if (pool_id == JPOOL_IMAGE) {\r
-\r
-    jvirt_sarray_ptr sptr;\r
-\r
-    jvirt_barray_ptr bptr;\r
-\r
-\r
-\r
-    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {\r
-\r
-      if (sptr->b_s_open) {    /* there may be no backing store */\r
-\r
-       sptr->b_s_open = FALSE; /* prevent recursive close if error */\r
-\r
-       (*sptr->b_s_info.close_backing_store) (cinfo, & sptr->b_s_info);\r
-\r
-      }\r
-\r
-    }\r
-\r
-    mem->virt_sarray_list = NULL;\r
-\r
-    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {\r
-\r
-      if (bptr->b_s_open) {    /* there may be no backing store */\r
-\r
-       bptr->b_s_open = FALSE; /* prevent recursive close if error */\r
-\r
-       (*bptr->b_s_info.close_backing_store) (cinfo, & bptr->b_s_info);\r
-\r
-      }\r
-\r
-    }\r
-\r
-    mem->virt_barray_list = NULL;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Release large objects */\r
-\r
-  lhdr_ptr = mem->large_list[pool_id];\r
-\r
-  mem->large_list[pool_id] = NULL;\r
-\r
-\r
-\r
-  while (lhdr_ptr != NULL) {\r
-\r
-    large_pool_ptr next_lhdr_ptr = lhdr_ptr->hdr.next;\r
-\r
-    space_freed = lhdr_ptr->hdr.bytes_used +\r
-\r
-                 lhdr_ptr->hdr.bytes_left +\r
-\r
-                 SIZEOF(large_pool_hdr);\r
-\r
-    jpeg_free_large(cinfo, (void FAR *) lhdr_ptr, space_freed);\r
-\r
-    mem->total_space_allocated -= space_freed;\r
-\r
-    lhdr_ptr = next_lhdr_ptr;\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Release small objects */\r
-\r
-  shdr_ptr = mem->small_list[pool_id];\r
-\r
-  mem->small_list[pool_id] = NULL;\r
-\r
-\r
-\r
-  while (shdr_ptr != NULL) {\r
-\r
-    small_pool_ptr next_shdr_ptr = shdr_ptr->hdr.next;\r
-\r
-    space_freed = shdr_ptr->hdr.bytes_used +\r
-\r
-                 shdr_ptr->hdr.bytes_left +\r
-\r
-                 SIZEOF(small_pool_hdr);\r
-\r
-    jpeg_free_small(cinfo, (void *) shdr_ptr, space_freed);\r
-\r
-    mem->total_space_allocated -= space_freed;\r
-\r
-    shdr_ptr = next_shdr_ptr;\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Close up shop entirely.\r
-\r
- * Note that this cannot be called unless cinfo->mem is non-NULL.\r
-\r
- */\r
-\r
-\r
-\r
-METHODDEF void\r
-\r
-self_destruct (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  int pool;\r
-\r
-\r
-\r
-  /* Close all backing store, release all memory.\r
-\r
-   * Releasing pools in reverse order might help avoid fragmentation\r
-\r
-   * with some (brain-damaged) malloc libraries.\r
-\r
-   */\r
-\r
-  for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) {\r
-\r
-    free_pool(cinfo, pool);\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Release the memory manager control block too. */\r
-\r
-  jpeg_free_small(cinfo, (void *) cinfo->mem, SIZEOF(my_memory_mgr));\r
-\r
-  cinfo->mem = NULL;           /* ensures I will be called only once */\r
-\r
-\r
-\r
-  jpeg_mem_term(cinfo);                /* system-dependent cleanup */\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Memory manager initialization.\r
-\r
- * When this is called, only the error manager pointer is valid in cinfo!\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jinit_memory_mgr (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  my_mem_ptr mem;\r
-\r
-  long max_to_use;\r
-\r
-  int pool;\r
-\r
-  size_t test_mac;\r
-\r
-\r
-\r
-  cinfo->mem = NULL;           /* for safety if init fails */\r
-\r
-\r
-\r
-  /* Check for configuration errors.\r
-\r
-   * SIZEOF(ALIGN_TYPE) should be a power of 2; otherwise, it probably\r
-\r
-   * doesn't reflect any real hardware alignment requirement.\r
-\r
-   * The test is a little tricky: for X>0, X and X-1 have no one-bits\r
-\r
-   * in common if and only if X is a power of 2, ie has only one one-bit.\r
-\r
-   * Some compilers may give an "unreachable code" warning here; ignore it.\r
-\r
-   */\r
-\r
-  if ((SIZEOF(ALIGN_TYPE) & (SIZEOF(ALIGN_TYPE)-1)) != 0)\r
-\r
-    ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE);\r
-\r
-  /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be\r
-\r
-   * a multiple of SIZEOF(ALIGN_TYPE).\r
-\r
-   * Again, an "unreachable code" warning may be ignored here.\r
-\r
-   * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK.\r
-\r
-   */\r
-\r
-  test_mac = (size_t) MAX_ALLOC_CHUNK;\r
-\r
-  if ((long) test_mac != MAX_ALLOC_CHUNK ||\r
-\r
-      (MAX_ALLOC_CHUNK % SIZEOF(ALIGN_TYPE)) != 0)\r
-\r
-    ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);\r
-\r
-\r
-\r
-  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */\r
-\r
-\r
-\r
-  /* Attempt to allocate memory manager's control block */\r
-\r
-  mem = (my_mem_ptr) jpeg_get_small(cinfo, SIZEOF(my_memory_mgr));\r
-\r
-\r
-\r
-  if (mem == NULL) {\r
-\r
-    jpeg_mem_term(cinfo);      /* system-dependent cleanup */\r
-\r
-    ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0);\r
-\r
-  }\r
-\r
-\r
-\r
-  /* OK, fill in the method pointers */\r
-\r
-  mem->pub.alloc_small = alloc_small;\r
-\r
-  mem->pub.alloc_large = alloc_large;\r
-\r
-  mem->pub.alloc_sarray = alloc_sarray;\r
-\r
-  mem->pub.alloc_barray = alloc_barray;\r
-\r
-  mem->pub.request_virt_sarray = request_virt_sarray;\r
-\r
-  mem->pub.request_virt_barray = request_virt_barray;\r
-\r
-  mem->pub.realize_virt_arrays = realize_virt_arrays;\r
-\r
-  mem->pub.access_virt_sarray = access_virt_sarray;\r
-\r
-  mem->pub.access_virt_barray = access_virt_barray;\r
-\r
-  mem->pub.free_pool = free_pool;\r
-\r
-  mem->pub.self_destruct = self_destruct;\r
-\r
-\r
-\r
-  /* Initialize working state */\r
-\r
-  mem->pub.max_memory_to_use = max_to_use;\r
-\r
-\r
-\r
-  for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) {\r
-\r
-    mem->small_list[pool] = NULL;\r
-\r
-    mem->large_list[pool] = NULL;\r
-\r
-  }\r
-\r
-  mem->virt_sarray_list = NULL;\r
-\r
-  mem->virt_barray_list = NULL;\r
-\r
-\r
-\r
-  mem->total_space_allocated = SIZEOF(my_memory_mgr);\r
-\r
-\r
-\r
-  /* Declare ourselves open for business */\r
-\r
-  cinfo->mem = & mem->pub;\r
-\r
-\r
-\r
-  /* Check for an environment variable JPEGMEM; if found, override the\r
-\r
-   * default max_memory setting from jpeg_mem_init.  Note that the\r
-\r
-   * surrounding application may again override this value.\r
-\r
-   * If your system doesn't support getenv(), define NO_GETENV to disable\r
-\r
-   * this feature.\r
-\r
-   */\r
-\r
-#ifndef NO_GETENV\r
-\r
-  { char * memenv;\r
-\r
-\r
-\r
-    if ((memenv = getenv("JPEGMEM")) != NULL) {\r
-\r
-      char ch = 'x';\r
-\r
-\r
-\r
-      if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {\r
-\r
-       if (ch == 'm' || ch == 'M')\r
-\r
-         max_to_use *= 1000L;\r
-\r
-       mem->pub.max_memory_to_use = max_to_use * 1000L;\r
-\r
-      }\r
-\r
-    }\r
-\r
-  }\r
-\r
-#endif\r
-\r
-\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jmemnobs.cpp b/libs/jpeg6/jmemnobs.cpp
deleted file mode 100644 (file)
index bd236e5..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*\r
-\r
- * jmemnobs.c\r
-\r
- *\r
-\r
- * Copyright (C) 1992-1994, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file provides a really simple implementation of the system-\r
-\r
- * dependent portion of the JPEG memory manager.  This implementation\r
-\r
- * assumes that no backing-store files are needed: all required space\r
-\r
- * can be obtained from ri.Malloc().\r
-\r
- * This is very portable in the sense that it'll compile on almost anything,\r
-\r
- * but you'd better have lots of main memory (or virtual memory) if you want\r
-\r
- * to process big images.\r
-\r
- * Note that the max_memory_to_use option is ignored by this implementation.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-#include "jmemsys.h"           /* import the system-dependent declarations */\r
-\r
-\r
-\r
-/*\r
-\r
- * Memory allocation and ri.Freeing are controlled by the regular library\r
-\r
- * routines ri.Malloc() and ri.Free().\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void *\r
-\r
-jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)\r
-\r
-{\r
-\r
-  return (void *) malloc(sizeofobject);\r
-\r
-}\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)\r
-\r
-{\r
-\r
-  free(object);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * "Large" objects are treated the same as "small" ones.\r
-\r
- * NB: although we include FAR keywords in the routine declarations,\r
-\r
- * this file won't actually work in 80x86 small/medium model; at least,\r
-\r
- * you probably won't be able to process useful-size images in only 64KB.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void FAR *\r
-\r
-jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)\r
-\r
-{\r
-\r
-  return (void FAR *) malloc(sizeofobject);\r
-\r
-}\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)\r
-\r
-{\r
-\r
-  free(object);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * This routine computes the total memory space available for allocation.\r
-\r
- * Here we always say, "we got all you want bud!"\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL long\r
-\r
-jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,\r
-\r
-                   long max_bytes_needed, long already_allocated)\r
-\r
-{\r
-\r
-  return max_bytes_needed;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Backing store (temporary file) management.\r
-\r
- * Since jpeg_mem_available always promised the moon,\r
-\r
- * this should never be called and we can just error out.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,\r
-\r
-                        long total_bytes_needed)\r
-\r
-{\r
-\r
-  ERREXIT(cinfo, JERR_NO_BACKING_STORE);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * These routines take care of any system-dependent initialization and\r
-\r
- * cleanup required.  Here, there isn't any.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL long\r
-\r
-jpeg_mem_init (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  return 0;                    /* just set max_memory_to_use to 0 */\r
-\r
-}\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_mem_term (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  /* no work */\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jmemsys.h b/libs/jpeg6/jmemsys.h
deleted file mode 100644 (file)
index 9c8028b..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-/*\r
-\r
- * jmemsys.h\r
-\r
- *\r
-\r
- * Copyright (C) 1992-1994, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This include file defines the interface between the system-independent\r
-\r
- * and system-dependent portions of the JPEG memory manager.  No other\r
-\r
- * modules need include it.  (The system-independent portion is jmemmgr.c;\r
-\r
- * there are several different versions of the system-dependent portion.)\r
-\r
- *\r
-\r
- * This file works as-is for the system-dependent memory managers supplied\r
-\r
- * in the IJG distribution.  You may need to modify it if you write a\r
-\r
- * custom memory manager.  If system-dependent changes are needed in\r
-\r
- * this file, the best method is to #ifdef them based on a configuration\r
-\r
- * symbol supplied in jconfig.h, as we have done with USE_MSDOS_MEMMGR.\r
-\r
- */\r
-\r
-\r
-\r
-\r
-\r
-/* Short forms of external names for systems with brain-damaged linkers. */\r
-\r
-\r
-\r
-#ifdef NEED_SHORT_EXTERNAL_NAMES\r
-\r
-#define jpeg_get_small         jGetSmall\r
-\r
-#define jpeg_free_small                jFreeSmall\r
-\r
-#define jpeg_get_large         jGetLarge\r
-\r
-#define jpeg_free_large                jFreeLarge\r
-\r
-#define jpeg_mem_available     jMemAvail\r
-\r
-#define jpeg_open_backing_store        jOpenBackStore\r
-\r
-#define jpeg_mem_init          jMemInit\r
-\r
-#define jpeg_mem_term          jMemTerm\r
-\r
-#endif /* NEED_SHORT_EXTERNAL_NAMES */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * These two functions are used to allocate and release small chunks of\r
-\r
- * memory.  (Typically the total amount requested through jpeg_get_small is\r
-\r
- * no more than 20K or so; this will be requested in chunks of a few K each.)\r
-\r
- * Behavior should be the same as for the standard library functions malloc\r
-\r
- * and free; in particular, jpeg_get_small must return NULL on failure.\r
-\r
- * On most systems, these ARE malloc and free.  jpeg_free_small is passed the\r
-\r
- * size of the object being freed, just in case it's needed.\r
-\r
- * On an 80x86 machine using small-data memory model, these manage near heap.\r
-\r
- */\r
-\r
-\r
-\r
-EXTERN void * jpeg_get_small JPP((j_common_ptr cinfo, size_t sizeofobject));\r
-\r
-EXTERN void jpeg_free_small JPP((j_common_ptr cinfo, void * object,\r
-\r
-                                size_t sizeofobject));\r
-\r
-\r
-\r
-/*\r
-\r
- * These two functions are used to allocate and release large chunks of\r
-\r
- * memory (up to the total free space designated by jpeg_mem_available).\r
-\r
- * The interface is the same as above, except that on an 80x86 machine,\r
-\r
- * far pointers are used.  On most other machines these are identical to\r
-\r
- * the jpeg_get/free_small routines; but we keep them separate anyway,\r
-\r
- * in case a different allocation strategy is desirable for large chunks.\r
-\r
- */\r
-\r
-\r
-\r
-EXTERN void FAR * jpeg_get_large JPP((j_common_ptr cinfo,size_t sizeofobject));\r
-\r
-EXTERN void jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object,\r
-\r
-                                size_t sizeofobject));\r
-\r
-\r
-\r
-/*\r
-\r
- * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may\r
-\r
- * be requested in a single call to jpeg_get_large (and jpeg_get_small for that\r
-\r
- * matter, but that case should never come into play).  This macro is needed\r
-\r
- * to model the 64Kb-segment-size limit of far addressing on 80x86 machines.\r
-\r
- * On those machines, we expect that jconfig.h will provide a proper value.\r
-\r
- * On machines with 32-bit flat address spaces, any large constant may be used.\r
-\r
- *\r
-\r
- * NB: jmemmgr.c expects that MAX_ALLOC_CHUNK will be representable as type\r
-\r
- * size_t and will be a multiple of sizeof(align_type).\r
-\r
- */\r
-\r
-\r
-\r
-#ifndef MAX_ALLOC_CHUNK                /* may be overridden in jconfig.h */\r
-\r
-#define MAX_ALLOC_CHUNK  1000000000L\r
-\r
-#endif\r
-\r
-\r
-\r
-/*\r
-\r
- * This routine computes the total space still available for allocation by\r
-\r
- * jpeg_get_large.  If more space than this is needed, backing store will be\r
-\r
- * used.  NOTE: any memory already allocated must not be counted.\r
-\r
- *\r
-\r
- * There is a minimum space requirement, corresponding to the minimum\r
-\r
- * feasible buffer sizes; jmemmgr.c will request that much space even if\r
-\r
- * jpeg_mem_available returns zero.  The maximum space needed, enough to hold\r
-\r
- * all working storage in memory, is also passed in case it is useful.\r
-\r
- * Finally, the total space already allocated is passed.  If no better\r
-\r
- * method is available, cinfo->mem->max_memory_to_use - already_allocated\r
-\r
- * is often a suitable calculation.\r
-\r
- *\r
-\r
- * It is OK for jpeg_mem_available to underestimate the space available\r
-\r
- * (that'll just lead to more backing-store access than is really necessary).\r
-\r
- * However, an overestimate will lead to failure.  Hence it's wise to subtract\r
-\r
- * a slop factor from the true available space.  5% should be enough.\r
-\r
- *\r
-\r
- * On machines with lots of virtual memory, any large constant may be returned.\r
-\r
- * Conversely, zero may be returned to always use the minimum amount of memory.\r
-\r
- */\r
-\r
-\r
-\r
-EXTERN long jpeg_mem_available JPP((j_common_ptr cinfo,\r
-\r
-                                   long min_bytes_needed,\r
-\r
-                                   long max_bytes_needed,\r
-\r
-                                   long already_allocated));\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * This structure holds whatever state is needed to access a single\r
-\r
- * backing-store object.  The read/write/close method pointers are called\r
-\r
- * by jmemmgr.c to manipulate the backing-store object; all other fields\r
-\r
- * are private to the system-dependent backing store routines.\r
-\r
- */\r
-\r
-\r
-\r
-#define TEMP_NAME_LENGTH   64  /* max length of a temporary file's name */\r
-\r
-\r
-\r
-#ifdef USE_MSDOS_MEMMGR                /* DOS-specific junk */\r
-\r
-\r
-\r
-typedef unsigned short XMSH;   /* type of extended-memory handles */\r
-\r
-typedef unsigned short EMSH;   /* type of expanded-memory handles */\r
-\r
-\r
-\r
-typedef union {\r
-\r
-  short file_handle;           /* DOS file handle if it's a temp file */\r
-\r
-  XMSH xms_handle;             /* handle if it's a chunk of XMS */\r
-\r
-  EMSH ems_handle;             /* handle if it's a chunk of EMS */\r
-\r
-} handle_union;\r
-\r
-\r
-\r
-#endif /* USE_MSDOS_MEMMGR */\r
-\r
-\r
-\r
-typedef struct backing_store_struct * backing_store_ptr;\r
-\r
-\r
-\r
-typedef struct backing_store_struct {\r
-\r
-  /* Methods for reading/writing/closing this backing-store object */\r
-\r
-  JMETHOD(void, read_backing_store, (j_common_ptr cinfo,\r
-\r
-                                    backing_store_ptr info,\r
-\r
-                                    void FAR * buffer_address,\r
-\r
-                                    long file_offset, long byte_count));\r
-\r
-  JMETHOD(void, write_backing_store, (j_common_ptr cinfo,\r
-\r
-                                     backing_store_ptr info,\r
-\r
-                                     void FAR * buffer_address,\r
-\r
-                                     long file_offset, long byte_count));\r
-\r
-  JMETHOD(void, close_backing_store, (j_common_ptr cinfo,\r
-\r
-                                     backing_store_ptr info));\r
-\r
-\r
-\r
-  /* Private fields for system-dependent backing-store management */\r
-\r
-#ifdef USE_MSDOS_MEMMGR\r
-\r
-  /* For the MS-DOS manager (jmemdos.c), we need: */\r
-\r
-  handle_union handle;         /* reference to backing-store storage object */\r
-\r
-  char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */\r
-\r
-#else\r
-\r
-  /* For a typical implementation with temp files, we need: */\r
-\r
-  FILE * temp_file;            /* stdio reference to temp file */\r
-\r
-  char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */\r
-\r
-#endif\r
-\r
-} backing_store_info;\r
-\r
-\r
-\r
-/*\r
-\r
- * Initial opening of a backing-store object.  This must fill in the\r
-\r
- * read/write/close pointers in the object.  The read/write routines\r
-\r
- * may take an error exit if the specified maximum file size is exceeded.\r
-\r
- * (If jpeg_mem_available always returns a large value, this routine can\r
-\r
- * just take an error exit.)\r
-\r
- */\r
-\r
-\r
-\r
-EXTERN void jpeg_open_backing_store JPP((j_common_ptr cinfo,\r
-\r
-                                        backing_store_ptr info,\r
-\r
-                                        long total_bytes_needed));\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * These routines take care of any system-dependent initialization and\r
-\r
- * cleanup required.  jpeg_mem_init will be called before anything is\r
-\r
- * allocated (and, therefore, nothing in cinfo is of use except the error\r
-\r
- * manager pointer).  It should return a suitable default value for\r
-\r
- * max_memory_to_use; this may subsequently be overridden by the surrounding\r
-\r
- * application.  (Note that max_memory_to_use is only important if\r
-\r
- * jpeg_mem_available chooses to consult it ... no one else will.)\r
-\r
- * jpeg_mem_term may assume that all requested memory has been freed and that\r
-\r
- * all opened backing-store objects have been closed.\r
-\r
- */\r
-\r
-\r
-\r
-EXTERN long jpeg_mem_init JPP((j_common_ptr cinfo));\r
-\r
-EXTERN void jpeg_mem_term JPP((j_common_ptr cinfo));\r
-\r
diff --git a/libs/jpeg6/jmorecfg.h b/libs/jpeg6/jmorecfg.h
deleted file mode 100644 (file)
index afb6e26..0000000
+++ /dev/null
@@ -1,693 +0,0 @@
-/*\r
-\r
- * jmorecfg.h\r
-\r
- *\r
-\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains additional configuration options that customize the\r
-\r
- * JPEG software for special applications or support machine-dependent\r
-\r
- * optimizations.  Most users will not need to touch this file.\r
-\r
- */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Define BITS_IN_JSAMPLE as either\r
-\r
- *   8   for 8-bit sample values (the usual setting)\r
-\r
- *   12  for 12-bit sample values\r
-\r
- * Only 8 and 12 are legal data precisions for lossy JPEG according to the\r
-\r
- * JPEG standard, and the IJG code does not support anything else!\r
-\r
- * We do not support run-time selection of data precision, sorry.\r
-\r
- */\r
-\r
-\r
-\r
-#define BITS_IN_JSAMPLE  8     /* use 8 or 12 */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Maximum number of components (color channels) allowed in JPEG image.\r
-\r
- * To meet the letter of the JPEG spec, set this to 255.  However, darn\r
-\r
- * few applications need more than 4 channels (maybe 5 for CMYK + alpha\r
-\r
- * mask).  We recommend 10 as a reasonable compromise; use 4 if you are\r
-\r
- * really short on memory.  (Each allowed component costs a hundred or so\r
-\r
- * bytes of storage, whether actually used in an image or not.)\r
-\r
- */\r
-\r
-\r
-\r
-#define MAX_COMPONENTS  10     /* maximum number of image components */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Basic data types.\r
-\r
- * You may need to change these if you have a machine with unusual data\r
-\r
- * type sizes; for example, "char" not 8 bits, "short" not 16 bits,\r
-\r
- * or "long" not 32 bits.  We don't care whether "int" is 16 or 32 bits,\r
-\r
- * but it had better be at least 16.\r
-\r
- */\r
-\r
-\r
-\r
-/* Representation of a single sample (pixel element value).\r
-\r
- * We frequently allocate large arrays of these, so it's important to keep\r
-\r
- * them small.  But if you have memory to burn and access to char or short\r
-\r
- * arrays is very slow on your hardware, you might want to change these.\r
-\r
- */\r
-\r
-\r
-\r
-#if BITS_IN_JSAMPLE == 8\r
-\r
-/* JSAMPLE should be the smallest type that will hold the values 0..255.\r
-\r
- * You can use a signed char by having GETJSAMPLE mask it with 0xFF.\r
-\r
- */\r
-\r
-\r
-\r
-#ifdef HAVE_UNSIGNED_CHAR\r
-\r
-\r
-\r
-typedef unsigned char JSAMPLE;\r
-\r
-#define GETJSAMPLE(value)  ((int) (value))\r
-\r
-\r
-\r
-#else /* not HAVE_UNSIGNED_CHAR */\r
-\r
-\r
-\r
-typedef char JSAMPLE;\r
-\r
-#ifdef CHAR_IS_UNSIGNED\r
-\r
-#define GETJSAMPLE(value)  ((int) (value))\r
-\r
-#else\r
-\r
-#define GETJSAMPLE(value)  ((int) (value) & 0xFF)\r
-\r
-#endif /* CHAR_IS_UNSIGNED */\r
-\r
-\r
-\r
-#endif /* HAVE_UNSIGNED_CHAR */\r
-\r
-\r
-\r
-#define MAXJSAMPLE     255\r
-\r
-#define CENTERJSAMPLE  128\r
-\r
-\r
-\r
-#endif /* BITS_IN_JSAMPLE == 8 */\r
-\r
-\r
-\r
-\r
-\r
-#if BITS_IN_JSAMPLE == 12\r
-\r
-/* JSAMPLE should be the smallest type that will hold the values 0..4095.\r
-\r
- * On nearly all machines "short" will do nicely.\r
-\r
- */\r
-\r
-\r
-\r
-typedef short JSAMPLE;\r
-\r
-#define GETJSAMPLE(value)  ((int) (value))\r
-\r
-\r
-\r
-#define MAXJSAMPLE     4095\r
-\r
-#define CENTERJSAMPLE  2048\r
-\r
-\r
-\r
-#endif /* BITS_IN_JSAMPLE == 12 */\r
-\r
-\r
-\r
-\r
-\r
-/* Representation of a DCT frequency coefficient.\r
-\r
- * This should be a signed value of at least 16 bits; "short" is usually OK.\r
-\r
- * Again, we allocate large arrays of these, but you can change to int\r
-\r
- * if you have memory to burn and "short" is really slow.\r
-\r
- */\r
-\r
-\r
-\r
-typedef short JCOEF;\r
-\r
-\r
-\r
-\r
-\r
-/* Compressed datastreams are represented as arrays of JOCTET.\r
-\r
- * These must be EXACTLY 8 bits wide, at least once they are written to\r
-\r
- * external storage.  Note that when using the stdio data source/destination\r
-\r
- * managers, this is also the data type passed to fread/fwrite.\r
-\r
- */\r
-\r
-\r
-\r
-#ifdef HAVE_UNSIGNED_CHAR\r
-\r
-\r
-\r
-typedef unsigned char JOCTET;\r
-\r
-#define GETJOCTET(value)  (value)\r
-\r
-\r
-\r
-#else /* not HAVE_UNSIGNED_CHAR */\r
-\r
-\r
-\r
-typedef char JOCTET;\r
-\r
-#ifdef CHAR_IS_UNSIGNED\r
-\r
-#define GETJOCTET(value)  (value)\r
-\r
-#else\r
-\r
-#define GETJOCTET(value)  ((value) & 0xFF)\r
-\r
-#endif /* CHAR_IS_UNSIGNED */\r
-\r
-\r
-\r
-#endif /* HAVE_UNSIGNED_CHAR */\r
-\r
-\r
-\r
-\r
-\r
-/* These typedefs are used for various table entries and so forth.\r
-\r
- * They must be at least as wide as specified; but making them too big\r
-\r
- * won't cost a huge amount of memory, so we don't provide special\r
-\r
- * extraction code like we did for JSAMPLE.  (In other words, these\r
-\r
- * typedefs live at a different point on the speed/space tradeoff curve.)\r
-\r
- */\r
-\r
-\r
-\r
-/* UINT8 must hold at least the values 0..255. */\r
-\r
-\r
-\r
-#ifdef HAVE_UNSIGNED_CHAR\r
-\r
-typedef unsigned char UINT8;\r
-\r
-#else /* not HAVE_UNSIGNED_CHAR */\r
-\r
-#ifdef CHAR_IS_UNSIGNED\r
-\r
-typedef char UINT8;\r
-\r
-#else /* not CHAR_IS_UNSIGNED */\r
-\r
-typedef short UINT8;\r
-\r
-#endif /* CHAR_IS_UNSIGNED */\r
-\r
-#endif /* HAVE_UNSIGNED_CHAR */\r
-\r
-\r
-\r
-/* UINT16 must hold at least the values 0..65535. */\r
-\r
-\r
-\r
-#ifdef HAVE_UNSIGNED_SHORT\r
-\r
-typedef unsigned short UINT16;\r
-\r
-#else /* not HAVE_UNSIGNED_SHORT */\r
-\r
-typedef unsigned int UINT16;\r
-\r
-#endif /* HAVE_UNSIGNED_SHORT */\r
-\r
-\r
-\r
-/* INT16 must hold at least the values -32768..32767. */\r
-\r
-\r
-\r
-#ifndef XMD_H                  /* X11/xmd.h correctly defines INT16 */\r
-\r
-typedef short INT16;\r
-\r
-#endif\r
-\r
-\r
-\r
-/* INT32 must hold at least signed 32-bit values. */\r
-\r
-\r
-\r
-//#ifndef XMD_H                        /* X11/xmd.h correctly defines INT32 */\r
-\r
-//typedef long INT32;\r
-\r
-//#endif\r
-\r
-\r
-\r
-/* Datatype used for image dimensions.  The JPEG standard only supports\r
-\r
- * images up to 64K*64K due to 16-bit fields in SOF markers.  Therefore\r
-\r
- * "unsigned int" is sufficient on all machines.  However, if you need to\r
-\r
- * handle larger images and you don't mind deviating from the spec, you\r
-\r
- * can change this datatype.\r
-\r
- */\r
-\r
-\r
-\r
-typedef unsigned int JDIMENSION;\r
-\r
-\r
-\r
-#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */\r
-\r
-\r
-\r
-\r
-\r
-/* These defines are used in all function definitions and extern declarations.\r
-\r
- * You could modify them if you need to change function linkage conventions.\r
-\r
- * Another application is to make all functions global for use with debuggers\r
-\r
- * or code profilers that require it.\r
-\r
- */\r
-\r
-\r
-\r
-#define METHODDEF static       /* a function called through method pointers */\r
-\r
-#define LOCAL    static        /* a function used only in its module */\r
-\r
-#define GLOBAL                 /* a function referenced thru EXTERNs */\r
-\r
-#define EXTERN   extern        /* a reference to a GLOBAL function */\r
-\r
-\r
-\r
-\r
-\r
-/* Here is the pseudo-keyword for declaring pointers that must be "far"\r
-\r
- * on 80x86 machines.  Most of the specialized coding for 80x86 is handled\r
-\r
- * by just saying "FAR *" where such a pointer is needed.  In a few places\r
-\r
- * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.\r
-\r
- */\r
-\r
-\r
-\r
-#ifdef NEED_FAR_POINTERS\r
-\r
-#undef FAR\r
-\r
-#define FAR  far\r
-\r
-#else\r
-\r
-#undef FAR\r
-\r
-#define FAR\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * On a few systems, type boolean and/or its values FALSE, TRUE may appear\r
-\r
- * in standard header files.  Or you may have conflicts with application-\r
-\r
- * specific header files that you want to include together with these files.\r
-\r
- * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.\r
-\r
- */\r
-\r
-\r
-\r
-//#ifndef HAVE_BOOLEAN\r
-\r
-//typedef int boolean;\r
-\r
-//#endif\r
-\r
-#ifndef FALSE                  /* in case these macros already exist */\r
-\r
-#define FALSE  0               /* values of boolean */\r
-\r
-#endif\r
-\r
-#ifndef TRUE\r
-\r
-#define TRUE   1\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * The remaining options affect code selection within the JPEG library,\r
-\r
- * but they don't need to be visible to most applications using the library.\r
-\r
- * To minimize application namespace pollution, the symbols won't be\r
-\r
- * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.\r
-\r
- */\r
-\r
-\r
-\r
-#ifdef JPEG_INTERNALS\r
-\r
-#define JPEG_INTERNAL_OPTIONS\r
-\r
-#endif\r
-\r
-\r
-\r
-#ifdef JPEG_INTERNAL_OPTIONS\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * These defines indicate whether to include various optional functions.\r
-\r
- * Undefining some of these symbols will produce a smaller but less capable\r
-\r
- * library.  Note that you can leave certain source files out of the\r
-\r
- * compilation/linking process if you've #undef'd the corresponding symbols.\r
-\r
- * (You may HAVE to do that if your compiler doesn't like null source files.)\r
-\r
- */\r
-\r
-\r
-\r
-/* Arithmetic coding is unsupported for legal reasons.  Complaints to IBM. */\r
-\r
-\r
-\r
-/* Capability options common to encoder and decoder: */\r
-\r
-\r
-\r
-#undef DCT_ISLOW_SUPPORTED     /* slow but accurate integer algorithm */\r
-\r
-#undef DCT_IFAST_SUPPORTED     /* faster, less accurate integer method */\r
-\r
-#define DCT_FLOAT_SUPPORTED    /* floating-point: accurate, fast on fast HW */\r
-\r
-\r
-\r
-/* Encoder capability options: */\r
-\r
-\r
-\r
-#undef  C_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */\r
-\r
-#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */\r
-\r
-#define C_PROGRESSIVE_SUPPORTED            /* Progressive JPEG? (Requires MULTISCAN)*/\r
-\r
-#define ENTROPY_OPT_SUPPORTED      /* Optimization of entropy coding parms? */\r
-\r
-/* Note: if you selected 12-bit data precision, it is dangerous to turn off\r
-\r
- * ENTROPY_OPT_SUPPORTED.  The standard Huffman tables are only good for 8-bit\r
-\r
- * precision, so jchuff.c normally uses entropy optimization to compute\r
-\r
- * usable tables for higher precision.  If you don't want to do optimization,\r
-\r
- * you'll have to supply different default Huffman tables.\r
-\r
- * The exact same statements apply for progressive JPEG: the default tables\r
-\r
- * don't work for progressive mode.  (This may get fixed, however.)\r
-\r
- */\r
-\r
-#define INPUT_SMOOTHING_SUPPORTED   /* Input image smoothing option? */\r
-\r
-\r
-\r
-/* Decoder capability options: */\r
-\r
-\r
-\r
-#undef  D_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */\r
-\r
-#undef D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */\r
-\r
-#undef D_PROGRESSIVE_SUPPORTED     /* Progressive JPEG? (Requires MULTISCAN)*/\r
-\r
-#undef BLOCK_SMOOTHING_SUPPORTED   /* Block smoothing? (Progressive only) */\r
-\r
-#undef IDCT_SCALING_SUPPORTED      /* Output rescaling via IDCT? */\r
-\r
-#undef  UPSAMPLE_SCALING_SUPPORTED  /* Output rescaling at upsample stage? */\r
-\r
-#undef UPSAMPLE_MERGING_SUPPORTED  /* Fast path for sloppy upsampling? */\r
-\r
-#undef QUANT_1PASS_SUPPORTED       /* 1-pass color quantization? */\r
-\r
-#undef QUANT_2PASS_SUPPORTED       /* 2-pass color quantization? */\r
-\r
-\r
-\r
-/* more capability options later, no doubt */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Ordering of RGB data in scanlines passed to or from the application.\r
-\r
- * If your application wants to deal with data in the order B,G,R, just\r
-\r
- * change these macros.  You can also deal with formats such as R,G,B,X\r
-\r
- * (one extra byte per pixel) by changing RGB_PIXELSIZE.  Note that changing\r
-\r
- * the offsets will also change the order in which colormap data is organized.\r
-\r
- * RESTRICTIONS:\r
-\r
- * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.\r
-\r
- * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not\r
-\r
- *    useful if you are using JPEG color spaces other than YCbCr or grayscale.\r
-\r
- * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE\r
-\r
- *    is not 3 (they don't understand about dummy color components!).  So you\r
-\r
- *    can't use color quantization if you change that value.\r
-\r
- */\r
-\r
-\r
-\r
-#define RGB_RED                0       /* Offset of Red in an RGB scanline element */\r
-\r
-#define RGB_GREEN      1       /* Offset of Green */\r
-\r
-#define RGB_BLUE       2       /* Offset of Blue */\r
-\r
-// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=900\r
-// ydnar: setting this fucks jpeg loading in q3map2, disabling "fix" (3)\r
-#define RGB_PIXELSIZE  4       /* JSAMPLEs per RGB scanline element */\r
-\r
-\r
-\r
-\r
-\r
-/* Definitions for speed-related optimizations. */\r
-\r
-\r
-\r
-\r
-\r
-/* If your compiler supports inline functions, define INLINE\r
-\r
- * as the inline keyword; otherwise define it as empty.\r
-\r
- */\r
-\r
-\r
-\r
-#ifndef INLINE\r
-\r
-#ifdef __GNUC__                        /* for instance, GNU C knows about inline */\r
-\r
-#define INLINE __inline__\r
-\r
-#endif\r
-\r
-#ifndef INLINE\r
-\r
-#define INLINE                 /* default is to define it as empty */\r
-\r
-#endif\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying\r
-\r
- * two 16-bit shorts is faster than multiplying two ints.  Define MULTIPLIER\r
-\r
- * as short on such a machine.  MULTIPLIER must be at least 16 bits wide.\r
-\r
- */\r
-\r
-\r
-\r
-#ifndef MULTIPLIER\r
-\r
-#define MULTIPLIER  int                /* type for fastest integer multiply */\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/* FAST_FLOAT should be either float or double, whichever is done faster\r
-\r
- * by your compiler.  (Note that this type is only used in the floating point\r
-\r
- * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)\r
-\r
- * Typically, float is faster in ANSI C compilers, while double is faster in\r
-\r
- * pre-ANSI compilers (because they insist on converting to double anyway).\r
-\r
- * The code below therefore chooses float if we have ANSI-style prototypes.\r
-\r
- */\r
-\r
-\r
-\r
-#ifndef FAST_FLOAT\r
-\r
-#ifdef HAVE_PROTOTYPES\r
-\r
-#define FAST_FLOAT  float\r
-\r
-#else\r
-\r
-#define FAST_FLOAT  double\r
-\r
-#endif\r
-\r
-#endif\r
-\r
-\r
-\r
-#endif /* JPEG_INTERNAL_OPTIONS */\r
diff --git a/libs/jpeg6/jpeg6.vcproj b/libs/jpeg6/jpeg6.vcproj
deleted file mode 100644 (file)
index abd17b5..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version="1.0" ?><VisualStudioProject Name="jpeg6" ProjectGUID="{B1684CA7-AB7C-46A8-92A0-D621406FE041}" ProjectType="Visual C++" RootNamespace="jpeg6" Version="8.00">\r
-       <Platforms>\r
-               <Platform Name="Win32"/>\r
-       </Platforms>\r
-       <ToolFiles>\r
-       </ToolFiles>\r
-       <Configurations>\r
-               <Configuration CharacterSet="2" ConfigurationType="4" IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)" Name="Debug|Win32" OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)\libs">\r
-                       <Tool Name="VCPreBuildEventTool"/>\r
-                       <Tool Name="VCCustomBuildTool"/>\r
-                       <Tool Name="VCXMLDataGeneratorTool"/>\r
-                       <Tool Name="VCWebServiceProxyGeneratorTool"/>\r
-                       <Tool Name="VCMIDLTool"/>\r
-                       <Tool AdditionalIncludeDirectories="&quot;$(SolutionDir)\include&quot;;&quot;$(SolutionDir)\libs&quot;;&quot;$(SolutionDir)\..\STLPort\stlport&quot;;&quot;$(SolutionDir)\..\gtk2\include&quot;;&quot;$(SolutionDir)\..\gtk2\include\glib-2.0&quot;;&quot;$(SolutionDir)\..\gtk2\lib\glib-2.0\include&quot;;&quot;$(SolutionDir)\..\libxml2\include&quot;" BasicRuntimeChecks="3" DebugInformationFormat="4" Detect64BitPortabilityProblems="true" DisableSpecificWarnings="4996;4244;4267" MinimalRebuild="true" Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="3" WarningLevel="3"/>\r
-                       <Tool Name="VCManagedResourceCompilerTool"/>\r
-                       <Tool Name="VCResourceCompilerTool"/>\r
-                       <Tool Name="VCPreLinkEventTool"/>\r
-                       <Tool Name="VCLibrarianTool"/>\r
-                       <Tool Name="VCALinkTool"/>\r
-                       <Tool Name="VCXDCMakeTool"/>\r
-                       <Tool Name="VCBscMakeTool"/>\r
-                       <Tool Name="VCFxCopTool"/>\r
-                       <Tool Name="VCPostBuildEventTool"/>\r
-               </Configuration>\r
-               <Configuration CharacterSet="2" ConfigurationType="4" IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)" Name="Release|Win32" OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)\libs" WholeProgramOptimization="1">\r
-                       <Tool Name="VCPreBuildEventTool"/>\r
-                       <Tool Name="VCCustomBuildTool"/>\r
-                       <Tool Name="VCXMLDataGeneratorTool"/>\r
-                       <Tool Name="VCWebServiceProxyGeneratorTool"/>\r
-                       <Tool Name="VCMIDLTool"/>\r
-                       <Tool AdditionalIncludeDirectories="&quot;$(SolutionDir)\include&quot;;&quot;$(SolutionDir)\libs&quot;;&quot;$(SolutionDir)\..\STLPort\stlport&quot;;&quot;$(SolutionDir)\..\gtk2\include&quot;;&quot;$(SolutionDir)\..\gtk2\include\glib-2.0&quot;;&quot;$(SolutionDir)\..\gtk2\lib\glib-2.0\include&quot;;&quot;$(SolutionDir)\..\libxml2\include&quot;" DebugInformationFormat="3" Detect64BitPortabilityProblems="true" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="2" WarningLevel="3"/>\r
-                       <Tool Name="VCManagedResourceCompilerTool"/>\r
-                       <Tool Name="VCResourceCompilerTool"/>\r
-                       <Tool Name="VCPreLinkEventTool"/>\r
-                       <Tool Name="VCLibrarianTool"/>\r
-                       <Tool Name="VCALinkTool"/>\r
-                       <Tool Name="VCXDCMakeTool"/>\r
-                       <Tool Name="VCBscMakeTool"/>\r
-                       <Tool Name="VCFxCopTool"/>\r
-                       <Tool Name="VCPostBuildEventTool"/>\r
-               </Configuration>\r
-       </Configurations>\r
-       <References>\r
-       </References>\r
-       <Files>\r
-               <File RelativePath=".\jchuff.h">\r
-               </File>\r
-               <File RelativePath=".\jcomapi.cpp">\r
-               </File>\r
-               <File RelativePath=".\jconfig.h">\r
-               </File>\r
-               <File RelativePath=".\jdapimin.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdapistd.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdatasrc.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdcoefct.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdcolor.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdct.h">\r
-               </File>\r
-               <File RelativePath=".\jddctmgr.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdhuff.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdhuff.h">\r
-               </File>\r
-               <File RelativePath=".\jdinput.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdmainct.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdmarker.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdmaster.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdpostct.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdsample.cpp">\r
-               </File>\r
-               <File RelativePath=".\jdtrans.cpp">\r
-               </File>\r
-               <File RelativePath=".\jerror.cpp">\r
-               </File>\r
-               <File RelativePath=".\jerror.h">\r
-               </File>\r
-               <File RelativePath=".\jfdctflt.cpp">\r
-               </File>\r
-               <File RelativePath=".\jidctflt.cpp">\r
-               </File>\r
-               <File RelativePath=".\jinclude.h">\r
-               </File>\r
-               <File RelativePath=".\jmemmgr.cpp">\r
-               </File>\r
-               <File RelativePath=".\jmemnobs.cpp">\r
-               </File>\r
-               <File RelativePath=".\jmemsys.h">\r
-               </File>\r
-               <File RelativePath=".\jmorecfg.h">\r
-               </File>\r
-               <File RelativePath=".\jpegint.h">\r
-               </File>\r
-               <File RelativePath=".\jpgload.cpp">\r
-               </File>\r
-               <File RelativePath=".\jutils.cpp">\r
-               </File>\r
-               <File RelativePath=".\jversion.h">\r
-               </File>\r
-       </Files>\r
-       <Globals>\r
-       </Globals>\r
-</VisualStudioProject>\r
diff --git a/libs/jpeg6/jpegint.h b/libs/jpeg6/jpegint.h
deleted file mode 100644 (file)
index 9b02525..0000000
+++ /dev/null
@@ -1,776 +0,0 @@
-/*\r
-\r
- * jpegint.h\r
-\r
- *\r
-\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file provides common declarations for the various JPEG modules.\r
-\r
- * These declarations are considered internal to the JPEG library; most\r
-\r
- * applications using the library shouldn't need to include this file.\r
-\r
- */\r
-\r
-\r
-\r
-\r
-\r
-/* Declarations for both compression & decompression */\r
-\r
-\r
-\r
-typedef enum {                 /* Operating modes for buffer controllers */\r
-\r
-       JBUF_PASS_THRU,         /* Plain stripwise operation */\r
-\r
-       /* Remaining modes require a full-image buffer to have been created */\r
-\r
-       JBUF_SAVE_SOURCE,       /* Run source subobject only, save output */\r
-\r
-       JBUF_CRANK_DEST,        /* Run dest subobject only, using saved data */\r
-\r
-       JBUF_SAVE_AND_PASS      /* Run both subobjects, save output */\r
-\r
-} J_BUF_MODE;\r
-\r
-\r
-\r
-/* Values of global_state field (jdapi.c has some dependencies on ordering!) */\r
-\r
-#define CSTATE_START   100     /* after create_compress */\r
-\r
-#define CSTATE_SCANNING        101     /* start_compress done, write_scanlines OK */\r
-\r
-#define CSTATE_RAW_OK  102     /* start_compress done, write_raw_data OK */\r
-\r
-#define CSTATE_WRCOEFS 103     /* jpeg_write_coefficients done */\r
-\r
-#define DSTATE_START   200     /* after create_decompress */\r
-\r
-#define DSTATE_INHEADER        201     /* reading header markers, no SOS yet */\r
-\r
-#define DSTATE_READY   202     /* found SOS, ready for start_decompress */\r
-\r
-#define DSTATE_PRELOAD 203     /* reading multiscan file in start_decompress*/\r
-\r
-#define DSTATE_PRESCAN 204     /* performing dummy pass for 2-pass quant */\r
-\r
-#define DSTATE_SCANNING        205     /* start_decompress done, read_scanlines OK */\r
-\r
-#define DSTATE_RAW_OK  206     /* start_decompress done, read_raw_data OK */\r
-\r
-#define DSTATE_BUFIMAGE        207     /* expecting jpeg_start_output */\r
-\r
-#define DSTATE_BUFPOST 208     /* looking for SOS/EOI in jpeg_finish_output */\r
-\r
-#define DSTATE_RDCOEFS 209     /* reading file in jpeg_read_coefficients */\r
-\r
-#define DSTATE_STOPPING        210     /* looking for EOI in jpeg_finish_decompress */\r
-\r
-\r
-\r
-\r
-\r
-/* Declarations for compression modules */\r
-\r
-\r
-\r
-/* Master control module */\r
-\r
-struct jpeg_comp_master {\r
-\r
-  JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo));\r
-\r
-  JMETHOD(void, pass_startup, (j_compress_ptr cinfo));\r
-\r
-  JMETHOD(void, finish_pass, (j_compress_ptr cinfo));\r
-\r
-\r
-\r
-  /* State variables made visible to other modules */\r
-\r
-  boolean call_pass_startup;   /* True if pass_startup must be called */\r
-\r
-  boolean is_last_pass;                /* True during last pass */\r
-\r
-};\r
-\r
-\r
-\r
-/* Main buffer control (downsampled-data buffer) */\r
-\r
-struct jpeg_c_main_controller {\r
-\r
-  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));\r
-\r
-  JMETHOD(void, process_data, (j_compress_ptr cinfo,\r
-\r
-                              JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,\r
-\r
-                              JDIMENSION in_rows_avail));\r
-\r
-};\r
-\r
-\r
-\r
-/* Compression preprocessing (downsampling input buffer control) */\r
-\r
-struct jpeg_c_prep_controller {\r
-\r
-  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));\r
-\r
-  JMETHOD(void, pre_process_data, (j_compress_ptr cinfo,\r
-\r
-                                  JSAMPARRAY input_buf,\r
-\r
-                                  JDIMENSION *in_row_ctr,\r
-\r
-                                  JDIMENSION in_rows_avail,\r
-\r
-                                  JSAMPIMAGE output_buf,\r
-\r
-                                  JDIMENSION *out_row_group_ctr,\r
-\r
-                                  JDIMENSION out_row_groups_avail));\r
-\r
-};\r
-\r
-\r
-\r
-/* Coefficient buffer control */\r
-\r
-struct jpeg_c_coef_controller {\r
-\r
-  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));\r
-\r
-  JMETHOD(boolean, compress_data, (j_compress_ptr cinfo,\r
-\r
-                                  JSAMPIMAGE input_buf));\r
-\r
-};\r
-\r
-\r
-\r
-/* Colorspace conversion */\r
-\r
-struct jpeg_color_converter {\r
-\r
-  JMETHOD(void, start_pass, (j_compress_ptr cinfo));\r
-\r
-  JMETHOD(void, color_convert, (j_compress_ptr cinfo,\r
-\r
-                               JSAMPARRAY input_buf, JSAMPIMAGE output_buf,\r
-\r
-                               JDIMENSION output_row, int num_rows));\r
-\r
-};\r
-\r
-\r
-\r
-/* Downsampling */\r
-\r
-struct jpeg_downsampler {\r
-\r
-  JMETHOD(void, start_pass, (j_compress_ptr cinfo));\r
-\r
-  JMETHOD(void, downsample, (j_compress_ptr cinfo,\r
-\r
-                            JSAMPIMAGE input_buf, JDIMENSION in_row_index,\r
-\r
-                            JSAMPIMAGE output_buf,\r
-\r
-                            JDIMENSION out_row_group_index));\r
-\r
-\r
-\r
-  boolean need_context_rows;   /* TRUE if need rows above & below */\r
-\r
-};\r
-\r
-\r
-\r
-/* Forward DCT (also controls coefficient quantization) */\r
-\r
-struct jpeg_forward_dct {\r
-\r
-  JMETHOD(void, start_pass, (j_compress_ptr cinfo));\r
-\r
-  /* perhaps this should be an array??? */\r
-\r
-  JMETHOD(void, forward_DCT, (j_compress_ptr cinfo,\r
-\r
-                             jpeg_component_info * compptr,\r
-\r
-                             JSAMPARRAY sample_data, JBLOCKROW coef_blocks,\r
-\r
-                             JDIMENSION start_row, JDIMENSION start_col,\r
-\r
-                             JDIMENSION num_blocks));\r
-\r
-};\r
-\r
-\r
-\r
-/* Entropy encoding */\r
-\r
-struct jpeg_entropy_encoder {\r
-\r
-  JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics));\r
-\r
-  JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));\r
-\r
-  JMETHOD(void, finish_pass, (j_compress_ptr cinfo));\r
-\r
-};\r
-\r
-\r
-\r
-/* Marker writing */\r
-\r
-struct jpeg_marker_writer {\r
-\r
-  /* write_any_marker is exported for use by applications */\r
-\r
-  /* Probably only COM and APPn markers should be written */\r
-\r
-  JMETHOD(void, write_any_marker, (j_compress_ptr cinfo, int marker,\r
-\r
-                                  const JOCTET *dataptr, unsigned int datalen));\r
-\r
-  JMETHOD(void, write_file_header, (j_compress_ptr cinfo));\r
-\r
-  JMETHOD(void, write_frame_header, (j_compress_ptr cinfo));\r
-\r
-  JMETHOD(void, write_scan_header, (j_compress_ptr cinfo));\r
-\r
-  JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo));\r
-\r
-  JMETHOD(void, write_tables_only, (j_compress_ptr cinfo));\r
-\r
-};\r
-\r
-\r
-\r
-\r
-\r
-/* Declarations for decompression modules */\r
-\r
-\r
-\r
-/* Master control module */\r
-\r
-struct jpeg_decomp_master {\r
-\r
-  JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo));\r
-\r
-  JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));\r
-\r
-\r
-\r
-  /* State variables made visible to other modules */\r
-\r
-  boolean is_dummy_pass;       /* True during 1st pass for 2-pass quant */\r
-\r
-};\r
-\r
-\r
-\r
-/* Input control module */\r
-\r
-struct jpeg_input_controller {\r
-\r
-  JMETHOD(int, consume_input, (j_decompress_ptr cinfo));\r
-\r
-  JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo));\r
-\r
-  JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));\r
-\r
-  JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));\r
-\r
-\r
-\r
-  /* State variables made visible to other modules */\r
-\r
-  boolean has_multiple_scans;  /* True if file has multiple scans */\r
-\r
-  boolean eoi_reached;         /* True when EOI has been consumed */\r
-\r
-};\r
-\r
-\r
-\r
-/* Main buffer control (downsampled-data buffer) */\r
-\r
-struct jpeg_d_main_controller {\r
-\r
-  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));\r
-\r
-  JMETHOD(void, process_data, (j_decompress_ptr cinfo,\r
-\r
-                              JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,\r
-\r
-                              JDIMENSION out_rows_avail));\r
-\r
-};\r
-\r
-\r
-\r
-/* Coefficient buffer control */\r
-\r
-struct jpeg_d_coef_controller {\r
-\r
-  JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));\r
-\r
-  JMETHOD(int, consume_data, (j_decompress_ptr cinfo));\r
-\r
-  JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo));\r
-\r
-  JMETHOD(int, decompress_data, (j_decompress_ptr cinfo,\r
-\r
-                                JSAMPIMAGE output_buf));\r
-\r
-  /* Pointer to array of coefficient virtual arrays, or NULL if none */\r
-\r
-  jvirt_barray_ptr *coef_arrays;\r
-\r
-};\r
-\r
-\r
-\r
-/* Decompression postprocessing (color quantization buffer control) */\r
-\r
-struct jpeg_d_post_controller {\r
-\r
-  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));\r
-\r
-  JMETHOD(void, post_process_data, (j_decompress_ptr cinfo,\r
-\r
-                                   JSAMPIMAGE input_buf,\r
-\r
-                                   JDIMENSION *in_row_group_ctr,\r
-\r
-                                   JDIMENSION in_row_groups_avail,\r
-\r
-                                   JSAMPARRAY output_buf,\r
-\r
-                                   JDIMENSION *out_row_ctr,\r
-\r
-                                   JDIMENSION out_rows_avail));\r
-\r
-};\r
-\r
-\r
-\r
-/* Marker reading & parsing */\r
-\r
-struct jpeg_marker_reader {\r
-\r
-  JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo));\r
-\r
-  /* Read markers until SOS or EOI.\r
-\r
-   * Returns same codes as are defined for jpeg_consume_input:\r
-\r
-   * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.\r
-\r
-   */\r
-\r
-  JMETHOD(int, read_markers, (j_decompress_ptr cinfo));\r
-\r
-  /* Read a restart marker --- exported for use by entropy decoder only */\r
-\r
-  jpeg_marker_parser_method read_restart_marker;\r
-\r
-  /* Application-overridable marker processing methods */\r
-\r
-  jpeg_marker_parser_method process_COM;\r
-\r
-  jpeg_marker_parser_method process_APPn[16];\r
-\r
-\r
-\r
-  /* State of marker reader --- nominally internal, but applications\r
-\r
-   * supplying COM or APPn handlers might like to know the state.\r
-\r
-   */\r
-\r
-  boolean saw_SOI;             /* found SOI? */\r
-\r
-  boolean saw_SOF;             /* found SOF? */\r
-\r
-  int next_restart_num;                /* next restart number expected (0-7) */\r
-\r
-  unsigned int discarded_bytes;        /* # of bytes skipped looking for a marker */\r
-\r
-};\r
-\r
-\r
-\r
-/* Entropy decoding */\r
-\r
-struct jpeg_entropy_decoder {\r
-\r
-  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));\r
-\r
-  JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,\r
-\r
-                               JBLOCKROW *MCU_data));\r
-\r
-};\r
-\r
-\r
-\r
-/* Inverse DCT (also performs dequantization) */\r
-\r
-typedef JMETHOD(void, inverse_DCT_method_ptr,\r
-\r
-               (j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
-\r
-                JCOEFPTR coef_block,\r
-\r
-                JSAMPARRAY output_buf, JDIMENSION output_col));\r
-\r
-\r
-\r
-struct jpeg_inverse_dct {\r
-\r
-  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));\r
-\r
-  /* It is useful to allow each component to have a separate IDCT method. */\r
-\r
-  inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];\r
-\r
-};\r
-\r
-\r
-\r
-/* Upsampling (note that upsampler must also call color converter) */\r
-\r
-struct jpeg_upsampler {\r
-\r
-  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));\r
-\r
-  JMETHOD(void, upsample, (j_decompress_ptr cinfo,\r
-\r
-                          JSAMPIMAGE input_buf,\r
-\r
-                          JDIMENSION *in_row_group_ctr,\r
-\r
-                          JDIMENSION in_row_groups_avail,\r
-\r
-                          JSAMPARRAY output_buf,\r
-\r
-                          JDIMENSION *out_row_ctr,\r
-\r
-                          JDIMENSION out_rows_avail));\r
-\r
-\r
-\r
-  boolean need_context_rows;   /* TRUE if need rows above & below */\r
-\r
-};\r
-\r
-\r
-\r
-/* Colorspace conversion */\r
-\r
-struct jpeg_color_deconverter {\r
-\r
-  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));\r
-\r
-  JMETHOD(void, color_convert, (j_decompress_ptr cinfo,\r
-\r
-                               JSAMPIMAGE input_buf, JDIMENSION input_row,\r
-\r
-                               JSAMPARRAY output_buf, int num_rows));\r
-\r
-};\r
-\r
-\r
-\r
-/* Color quantization or color precision reduction */\r
-\r
-struct jpeg_color_quantizer {\r
-\r
-  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));\r
-\r
-  JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,\r
-\r
-                                JSAMPARRAY input_buf, JSAMPARRAY output_buf,\r
-\r
-                                int num_rows));\r
-\r
-  JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));\r
-\r
-  JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));\r
-\r
-};\r
-\r
-\r
-\r
-\r
-\r
-/* Miscellaneous useful macros */\r
-\r
-\r
-\r
-#undef MAX\r
-\r
-#define MAX(a,b)       ((a) > (b) ? (a) : (b))\r
-\r
-#undef MIN\r
-\r
-#define MIN(a,b)       ((a) < (b) ? (a) : (b))\r
-\r
-\r
-\r
-\r
-\r
-/* We assume that right shift corresponds to signed division by 2 with\r
-\r
- * rounding towards minus infinity.  This is correct for typical "arithmetic\r
-\r
- * shift" instructions that shift in copies of the sign bit.  But some\r
-\r
- * C compilers implement >> with an unsigned shift.  For these machines you\r
-\r
- * must define RIGHT_SHIFT_IS_UNSIGNED.\r
-\r
- * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.\r
-\r
- * It is only applied with constant shift counts.  SHIFT_TEMPS must be\r
-\r
- * included in the variables of any routine using RIGHT_SHIFT.\r
-\r
- */\r
-\r
-\r
-\r
-#ifdef RIGHT_SHIFT_IS_UNSIGNED\r
-\r
-#define SHIFT_TEMPS    INT32 shift_temp;\r
-\r
-#define RIGHT_SHIFT(x,shft)  \\r
-\r
-       ((shift_temp = (x)) < 0 ? \\r
-\r
-        (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \\r
-\r
-        (shift_temp >> (shft)))\r
-\r
-#else\r
-\r
-#define SHIFT_TEMPS\r
-\r
-#define RIGHT_SHIFT(x,shft)    ((x) >> (shft))\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/* Short forms of external names for systems with brain-damaged linkers. */\r
-\r
-\r
-\r
-#ifdef NEED_SHORT_EXTERNAL_NAMES\r
-\r
-#define jinit_compress_master  jICompress\r
-\r
-#define jinit_c_master_control jICMaster\r
-\r
-#define jinit_c_main_controller        jICMainC\r
-\r
-#define jinit_c_prep_controller        jICPrepC\r
-\r
-#define jinit_c_coef_controller        jICCoefC\r
-\r
-#define jinit_color_converter  jICColor\r
-\r
-#define jinit_downsampler      jIDownsampler\r
-\r
-#define jinit_forward_dct      jIFDCT\r
-\r
-#define jinit_huff_encoder     jIHEncoder\r
-\r
-#define jinit_phuff_encoder    jIPHEncoder\r
-\r
-#define jinit_marker_writer    jIMWriter\r
-\r
-#define jinit_master_decompress        jIDMaster\r
-\r
-#define jinit_d_main_controller        jIDMainC\r
-\r
-#define jinit_d_coef_controller        jIDCoefC\r
-\r
-#define jinit_d_post_controller        jIDPostC\r
-\r
-#define jinit_input_controller jIInCtlr\r
-\r
-#define jinit_marker_reader    jIMReader\r
-\r
-#define jinit_huff_decoder     jIHDecoder\r
-\r
-#define jinit_phuff_decoder    jIPHDecoder\r
-\r
-#define jinit_inverse_dct      jIIDCT\r
-\r
-#define jinit_upsampler                jIUpsampler\r
-\r
-#define jinit_color_deconverter        jIDColor\r
-\r
-#define jinit_1pass_quantizer  jI1Quant\r
-\r
-#define jinit_2pass_quantizer  jI2Quant\r
-\r
-#define jinit_merged_upsampler jIMUpsampler\r
-\r
-#define jinit_memory_mgr       jIMemMgr\r
-\r
-#define jdiv_round_up          jDivRound\r
-\r
-#define jround_up              jRound\r
-\r
-#define jcopy_sample_rows      jCopySamples\r
-\r
-#define jcopy_block_row                jCopyBlocks\r
-\r
-#define jzero_far              jZeroFar\r
-\r
-#define jpeg_zigzag_order      jZIGTable\r
-\r
-#define jpeg_natural_order     jZAGTable\r
-\r
-#endif /* NEED_SHORT_EXTERNAL_NAMES */\r
-\r
-\r
-\r
-\r
-\r
-/* Compression module initialization routines */\r
-\r
-EXTERN void jinit_compress_master JPP((j_compress_ptr cinfo));\r
-\r
-EXTERN void jinit_c_master_control JPP((j_compress_ptr cinfo,\r
-\r
-                                       boolean transcode_only));\r
-\r
-EXTERN void jinit_c_main_controller JPP((j_compress_ptr cinfo,\r
-\r
-                                        boolean need_full_buffer));\r
-\r
-EXTERN void jinit_c_prep_controller JPP((j_compress_ptr cinfo,\r
-\r
-                                        boolean need_full_buffer));\r
-\r
-EXTERN void jinit_c_coef_controller JPP((j_compress_ptr cinfo,\r
-\r
-                                        boolean need_full_buffer));\r
-\r
-EXTERN void jinit_color_converter JPP((j_compress_ptr cinfo));\r
-\r
-EXTERN void jinit_downsampler JPP((j_compress_ptr cinfo));\r
-\r
-EXTERN void jinit_forward_dct JPP((j_compress_ptr cinfo));\r
-\r
-EXTERN void jinit_huff_encoder JPP((j_compress_ptr cinfo));\r
-\r
-EXTERN void jinit_phuff_encoder JPP((j_compress_ptr cinfo));\r
-\r
-EXTERN void jinit_marker_writer JPP((j_compress_ptr cinfo));\r
-\r
-/* Decompression module initialization routines */\r
-\r
-EXTERN void jinit_master_decompress JPP((j_decompress_ptr cinfo));\r
-\r
-EXTERN void jinit_d_main_controller JPP((j_decompress_ptr cinfo,\r
-\r
-                                        boolean need_full_buffer));\r
-\r
-EXTERN void jinit_d_coef_controller JPP((j_decompress_ptr cinfo,\r
-\r
-                                        boolean need_full_buffer));\r
-\r
-EXTERN void jinit_d_post_controller JPP((j_decompress_ptr cinfo,\r
-\r
-                                        boolean need_full_buffer));\r
-\r
-EXTERN void jinit_input_controller JPP((j_decompress_ptr cinfo));\r
-\r
-EXTERN void jinit_marker_reader JPP((j_decompress_ptr cinfo));\r
-\r
-EXTERN void jinit_huff_decoder JPP((j_decompress_ptr cinfo));\r
-\r
-EXTERN void jinit_phuff_decoder JPP((j_decompress_ptr cinfo));\r
-\r
-EXTERN void jinit_inverse_dct JPP((j_decompress_ptr cinfo));\r
-\r
-EXTERN void jinit_upsampler JPP((j_decompress_ptr cinfo));\r
-\r
-EXTERN void jinit_color_deconverter JPP((j_decompress_ptr cinfo));\r
-\r
-EXTERN void jinit_1pass_quantizer JPP((j_decompress_ptr cinfo));\r
-\r
-EXTERN void jinit_2pass_quantizer JPP((j_decompress_ptr cinfo));\r
-\r
-EXTERN void jinit_merged_upsampler JPP((j_decompress_ptr cinfo));\r
-\r
-/* Memory manager initialization */\r
-\r
-EXTERN void jinit_memory_mgr JPP((j_common_ptr cinfo));\r
-\r
-\r
-\r
-/* Utility routines in jutils.c */\r
-\r
-EXTERN long jdiv_round_up JPP((long a, long b));\r
-\r
-EXTERN long jround_up JPP((long a, long b));\r
-\r
-EXTERN void jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,\r
-\r
-                                  JSAMPARRAY output_array, int dest_row,\r
-\r
-                                  int num_rows, JDIMENSION num_cols));\r
-\r
-EXTERN void jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,\r
-\r
-                                JDIMENSION num_blocks));\r
-\r
-EXTERN void jzero_far JPP((void FAR * target, size_t bytestozero));\r
-\r
-/* Constant tables in jutils.c */\r
-\r
-extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */\r
-\r
-extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */\r
-\r
-\r
-\r
-/* Suppress undefined-structure complaints if necessary. */\r
-\r
-\r
-\r
-#ifdef INCOMPLETE_TYPES_BROKEN\r
-\r
-#ifndef AM_MEMORY_MANAGER      /* only jmemmgr.c defines these */\r
-\r
-struct jvirt_sarray_control { long dummy; };\r
-\r
-struct jvirt_barray_control { long dummy; };\r
-\r
-#endif\r
-\r
-#endif /* INCOMPLETE_TYPES_BROKEN */\r
-\r
diff --git a/libs/jpeg6/jpgload.cpp b/libs/jpeg6/jpgload.cpp
deleted file mode 100644 (file)
index 02c021f..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-\r
-    \r
-#include "radiant_jpeglib.h"\r
-#include "jerror.h"\r
-#include <memory.h>\r
-\r
-GLOBAL int LoadJPGBuff(unsigned char *fbuffer, int bufsize, unsigned char **pic, int *width, int *height ) \r
-{\r
-\r
-  /* This struct contains the JPEG decompression parameters and pointers to\r
-   * working space (which is allocated as needed by the JPEG library).\r
-   */\r
-  struct jpeg_decompress_struct cinfo;\r
-  /* We use our private extension JPEG error handler.\r
-   * Note that this struct must live as long as the main JPEG parameter\r
-   * struct, to avoid dangling-pointer problems.\r
-   */\r
-  /* This struct represents a JPEG error handler.  It is declared separately\r
-   * because applications often want to supply a specialized error handler\r
-   * (see the second half of this file for an example).  But here we just\r
-   * take the easy way out and use the standard error handler, which will\r
-   * print a message on stderr and call exit() if compression fails.\r
-   * Note that this struct must live as long as the main JPEG parameter\r
-   * struct, to avoid dangling-pointer problems.\r
-   */\r
-\r
-  struct jpeg_error_mgr jerr;\r
-  /* More stuff */\r
-  JSAMPARRAY buffer;           /* Output row buffer */\r
-  int row_stride;              /* physical row width in output buffer */\r
-  unsigned char *out, *bbuf;\r
-  int nSize;\r
-  int jmpret;\r
-\r
-  // Rad additions: initialize the longjmp buffer\r
-  jmpret = setjmp( rad_loadfailed );\r
-  if (jmpret != 0)\r
-  {\r
-    *pic = (unsigned char *)rad_errormsg;\r
-    return -1;\r
-  }\r
-\r
-  /* Step 1: allocate and initialize JPEG decompression object */\r
-\r
-  /* We have to set up the error handler first, in case the initialization\r
-   * step fails.  (Unlikely, but it could happen if you are out of memory.)\r
-   * This routine fills in the contents of struct jerr, and returns jerr's\r
-   * address which we place into the link field in cinfo.\r
-   */\r
-  cinfo.err = jpeg_std_error(&jerr);\r
-\r
-  /* Now we can initialize the JPEG decompression object. */\r
-  jpeg_create_decompress(&cinfo);\r
-\r
-  /* Step 2: specify data source (eg, a file) */\r
-\r
-  jpeg_stdio_src(&cinfo, fbuffer, bufsize);\r
-\r
-  /* Step 3: read file parameters with jpeg_read_header() */\r
-\r
-  (void) jpeg_read_header(&cinfo, TRUE);\r
-  /* We can ignore the return value from jpeg_read_header since\r
-   *   (a) suspension is not possible with the stdio data source, and\r
-   *   (b) we passed TRUE to reject a tables-only JPEG file as an error.\r
-   * See libjpeg.doc for more info.\r
-   */\r
-\r
-  /* Step 4: set parameters for decompression */\r
-\r
-  /* In this example, we don't need to change any of the defaults set by\r
-   * jpeg_read_header(), so we do nothing here.\r
-   */\r
-\r
-  /* Step 5: Start decompressor */\r
-\r
-  (void) jpeg_start_decompress(&cinfo);\r
-  /* We can ignore the return value since suspension is not possible\r
-   * with the stdio data source.\r
-   */\r
-  \r
-  /* ydnar: radiant only handles RGB, non-progressive format jpegs */\r
-  if( cinfo.output_components != 4 )\r
-  {\r
-       *pic = (unsigned char*) "Non-RGB JPEG encountered (unsupported)";\r
-    return -1;\r
-  }\r
-  if( cinfo.progressive_mode )\r
-  {\r
-       *pic = (unsigned char*) "Progressive JPEG encountered (unsupported)";\r
-    return -1;\r
-  }\r
-  \r
-  /* We may need to do some setup of our own at this point before reading\r
-   * the data.  After jpeg_start_decompress() we have the correct scaled\r
-   * output image dimensions available, as well as the output colormap\r
-   * if we asked for color quantization.\r
-   * In this example, we need to make an output work buffer of the right size.\r
-   */ \r
-  \r
-  /* JSAMPLEs per row in output buffer */\r
-  row_stride = cinfo.output_width * cinfo.output_components;\r
-  nSize = cinfo.output_width*cinfo.output_height*cinfo.output_components;\r
-  \r
-  out = reinterpret_cast<unsigned char*>( malloc( nSize+ 1 ) );\r
-  memset( out, 255, nSize + 1 );\r
-  \r
-  *pic = out;\r
-  *width = cinfo.output_width;\r
-  *height = cinfo.output_height;\r
-\r
-  /* Step 6: while (scan lines remain to be read) */\r
-  /*           jpeg_read_scanlines(...); */\r
-\r
-  /* Here we use the library's state variable cinfo.output_scanline as the\r
-   * loop counter, so that we don't have to keep track ourselves.\r
-   */\r
-  while (cinfo.output_scanline < cinfo.output_height)\r
-  {\r
-    /* jpeg_read_scanlines expects an array of pointers to scanlines.\r
-     * Here the array is only one element long, but you could ask for\r
-     * more than one scanline at a time if that's more convenient.\r
-     */\r
-       bbuf = out + row_stride * cinfo.output_scanline;\r
-       buffer = &bbuf;\r
-    (void) jpeg_read_scanlines( &cinfo, buffer, 1 );\r
-  }\r
-\r
-  // clear all the alphas to 255\r
-  {\r
-    int i, j;\r
-    unsigned char *buf;\r
-\r
-    buf = *pic;\r
-\r
-    j = cinfo.output_width * cinfo.output_height * 4;\r
-    for ( i = 3 ; i < j ; i+=4 ) {\r
-      buf[i] = 255;\r
-    }\r
-  }\r
-\r
-  /* Step 7: Finish decompression */\r
-\r
-  (void) jpeg_finish_decompress(&cinfo);\r
-  /* We can ignore the return value since suspension is not possible\r
-   * with the stdio data source.\r
-   */\r
-\r
-  /* Step 8: Release JPEG decompression object */\r
-\r
-  /* This is an important step since it will release a good deal of memory. */\r
-  jpeg_destroy_decompress(&cinfo);\r
-\r
-  /* After finish_decompress, we can close the input file.\r
-   * Here we postpone it until after no more JPEG errors are possible,\r
-   * so as to simplify the setjmp error logic above.  (Actually, I don't\r
-   * think that jpeg_destroy can do an error exit, but why assume anything...)\r
-   */\r
-  //free (fbuffer);\r
-\r
-  /* At this point you may want to check to see whether any corrupt-data\r
-   * warnings occurred (test whether jerr.pub.num_warnings is nonzero).\r
-   */\r
-\r
-  /* And we're done! */\r
-  return 0;\r
-}\r
-\r
diff --git a/libs/jpeg6/jutils.cpp b/libs/jpeg6/jutils.cpp
deleted file mode 100644 (file)
index f5454a6..0000000
+++ /dev/null
@@ -1,350 +0,0 @@
-/*\r
-\r
- * jutils.c\r
-\r
- *\r
-\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains tables and miscellaneous utility routines needed\r
-\r
- * for both compression and decompression.\r
-\r
- * Note we prefix all global names with "j" to minimize conflicts with\r
-\r
- * a surrounding application.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * jpeg_zigzag_order[i] is the zigzag-order position of the i'th element\r
-\r
- * of a DCT block read in natural order (left to right, top to bottom).\r
-\r
- */\r
-\r
-\r
-\r
-const int jpeg_zigzag_order[DCTSIZE2] = {\r
-\r
-   0,  1,  5,  6, 14, 15, 27, 28,\r
-\r
-   2,  4,  7, 13, 16, 26, 29, 42,\r
-\r
-   3,  8, 12, 17, 25, 30, 41, 43,\r
-\r
-   9, 11, 18, 24, 31, 40, 44, 53,\r
-\r
-  10, 19, 23, 32, 39, 45, 52, 54,\r
-\r
-  20, 22, 33, 38, 46, 51, 55, 60,\r
-\r
-  21, 34, 37, 47, 50, 56, 59, 61,\r
-\r
-  35, 36, 48, 49, 57, 58, 62, 63\r
-\r
-};\r
-\r
-\r
-\r
-/*\r
-\r
- * jpeg_natural_order[i] is the natural-order position of the i'th element\r
-\r
- * of zigzag order.\r
-\r
- *\r
-\r
- * When reading corrupted data, the Huffman decoders could attempt\r
-\r
- * to reference an entry beyond the end of this array (if the decoded\r
-\r
- * zero run length reaches past the end of the block).  To prevent\r
-\r
- * wild stores without adding an inner-loop test, we put some extra\r
-\r
- * "63"s after the real entries.  This will cause the extra coefficient\r
-\r
- * to be stored in location 63 of the block, not somewhere random.\r
-\r
- * The worst case would be a run-length of 15, which means we need 16\r
-\r
- * fake entries.\r
-\r
- */\r
-\r
-\r
-\r
-const int jpeg_natural_order[DCTSIZE2+16] = {\r
-\r
-  0,  1,  8, 16,  9,  2,  3, 10,\r
-\r
- 17, 24, 32, 25, 18, 11,  4,  5,\r
-\r
- 12, 19, 26, 33, 40, 48, 41, 34,\r
-\r
- 27, 20, 13,  6,  7, 14, 21, 28,\r
-\r
- 35, 42, 49, 56, 57, 50, 43, 36,\r
-\r
- 29, 22, 15, 23, 30, 37, 44, 51,\r
-\r
- 58, 59, 52, 45, 38, 31, 39, 46,\r
-\r
- 53, 60, 61, 54, 47, 55, 62, 63,\r
-\r
- 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */\r
-\r
- 63, 63, 63, 63, 63, 63, 63, 63\r
-\r
-};\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Arithmetic utilities\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL long\r
-\r
-jdiv_round_up (long a, long b)\r
-\r
-/* Compute a/b rounded up to next integer, ie, ceil(a/b) */\r
-\r
-/* Assumes a >= 0, b > 0 */\r
-\r
-{\r
-\r
-  return (a + b - 1L) / b;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-GLOBAL long\r
-\r
-jround_up (long a, long b)\r
-\r
-/* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */\r
-\r
-/* Assumes a >= 0, b > 0 */\r
-\r
-{\r
-\r
-  a += b - 1L;\r
-\r
-  return a - (a % b);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays\r
-\r
- * and coefficient-block arrays.  This won't work on 80x86 because the arrays\r
-\r
- * are FAR and we're assuming a small-pointer memory model.  However, some\r
-\r
- * DOS compilers provide far-pointer versions of memcpy() and memset() even\r
-\r
- * in the small-model libraries.  These will be used if USE_FMEM is defined.\r
-\r
- * Otherwise, the routines below do it the hard way.  (The performance cost\r
-\r
- * is not all that great, because these routines aren't very heavily used.)\r
-\r
- */\r
-\r
-\r
-\r
-#ifndef NEED_FAR_POINTERS      /* normal case, same as regular macros */\r
-\r
-#define FMEMCOPY(dest,src,size)        MEMCOPY(dest,src,size)\r
-\r
-#define FMEMZERO(target,size)  MEMZERO(target,size)\r
-\r
-#else                          /* 80x86 case, define if we can */\r
-\r
-#ifdef USE_FMEM\r
-\r
-#define FMEMCOPY(dest,src,size)        _fmemcpy((void FAR *)(dest), (const void FAR *)(src), (size_t)(size))\r
-\r
-#define FMEMZERO(target,size)  _fmemset((void FAR *)(target), 0, (size_t)(size))\r
-\r
-#endif\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jcopy_sample_rows (JSAMPARRAY input_array, int source_row,\r
-\r
-                  JSAMPARRAY output_array, int dest_row,\r
-\r
-                  int num_rows, JDIMENSION num_cols)\r
-\r
-/* Copy some rows of samples from one place to another.\r
-\r
- * num_rows rows are copied from input_array[source_row++]\r
-\r
- * to output_array[dest_row++]; these areas may overlap for duplication.\r
-\r
- * The source and destination arrays must be at least as wide as num_cols.\r
-\r
- */\r
-\r
-{\r
-\r
-  register JSAMPROW inptr, outptr;\r
-\r
-#ifdef FMEMCOPY\r
-\r
-  register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE));\r
-\r
-#else\r
-\r
-  register JDIMENSION count;\r
-\r
-#endif\r
-\r
-  register int row;\r
-\r
-\r
-\r
-  input_array += source_row;\r
-\r
-  output_array += dest_row;\r
-\r
-\r
-\r
-  for (row = num_rows; row > 0; row--) {\r
-\r
-    inptr = *input_array++;\r
-\r
-    outptr = *output_array++;\r
-\r
-#ifdef FMEMCOPY\r
-\r
-    FMEMCOPY(outptr, inptr, count);\r
-\r
-#else\r
-\r
-    for (count = num_cols; count > 0; count--)\r
-\r
-      *outptr++ = *inptr++;    /* needn't bother with GETJSAMPLE() here */\r
-\r
-#endif\r
-\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row,\r
-\r
-                JDIMENSION num_blocks)\r
-\r
-/* Copy a row of coefficient blocks from one place to another. */\r
-\r
-{\r
-\r
-#ifdef FMEMCOPY\r
-\r
-  FMEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF)));\r
-\r
-#else\r
-\r
-  register JCOEFPTR inptr, outptr;\r
-\r
-  register long count;\r
-\r
-\r
-\r
-  inptr = (JCOEFPTR) input_row;\r
-\r
-  outptr = (JCOEFPTR) output_row;\r
-\r
-  for (count = (long) num_blocks * DCTSIZE2; count > 0; count--) {\r
-\r
-    *outptr++ = *inptr++;\r
-\r
-  }\r
-\r
-#endif\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jzero_far (void FAR * target, size_t bytestozero)\r
-\r
-/* Zero out a chunk of FAR memory. */\r
-\r
-/* This might be sample-array data, block-array data, or alloc_large data. */\r
-\r
-{\r
-\r
-#ifdef FMEMZERO\r
-\r
-  FMEMZERO(target, bytestozero);\r
-\r
-#else\r
-\r
-  register char FAR * ptr = (char FAR *) target;\r
-\r
-  register size_t count;\r
-\r
-\r
-\r
-  for (count = bytestozero; count > 0; count--) {\r
-\r
-    *ptr++ = 0;\r
-\r
-  }\r
-\r
-#endif\r
-\r
-}\r
-\r
diff --git a/libs/jpeg6/jversion.h b/libs/jpeg6/jversion.h
deleted file mode 100644 (file)
index 784a088..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*\r
-\r
- * jversion.h\r
-\r
- *\r
-\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains software version identification.\r
-\r
- */\r
-\r
-\r
-\r
-\r
-\r
-#define JVERSION       "6  2-Aug-95"\r
-\r
-\r
-\r
-#define JCOPYRIGHT     "Copyright (C) 1995, Thomas G. Lane"\r
-\r
diff --git a/libs/radiant_jpeglib.h b/libs/radiant_jpeglib.h
deleted file mode 100644 (file)
index 7dece34..0000000
+++ /dev/null
@@ -1,1123 +0,0 @@
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-/*\r
- * jpeglib.h\r
- *\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
- * This file is part of the Independent JPEG Group's software.\r
- * For conditions of distribution and use, see the accompanying README file.\r
- *\r
- * This file defines the application interface for the JPEG library.\r
- * Most applications using the library need only include this file,\r
- * and perhaps jerror.h if they want to know the exact error codes.\r
- */\r
-\r
-#ifndef JPEGLIB_H\r
-#define JPEGLIB_H\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-// LZ: linux stuff\r
-#if defined (__linux__) || defined (__APPLE__)\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-\r
-#ifndef boolean\r
-#ifdef __cplusplus\r
-#define        boolean bool\r
-#else\r
-typedef int boolean;\r
-#endif\r
-#endif\r
-\r
-#endif\r
-\r
-#ifdef __MACOS__\r
-\r
-// JDC: stuff to make mac version compile\r
-#define        boolean qboolean\r
-#define        register\r
-#define        INT32   int\r
-\r
-#endif\r
-\r
-// rad additions\r
-// 11.29.99\r
-\r
-//#include "cmdlib.h"\r
-#ifdef _WIN32\r
-#include "windows.h"\r
-#include "stdio.h"\r
-#endif\r
-\r
-#ifndef INT32\r
-#define        INT32   int\r
-#endif\r
-\r
-// TTimo: if LoadJPGBuff returns -1, *pic is the error message\r
-extern int LoadJPGBuff(unsigned char *fbuffer, int bufsize, unsigned char **pic, int *width, int *height );\r
-// rad end\r
-\r
-\r
-/*\r
- * First we include the configuration files that record how this\r
- * installation of the JPEG library is set up.  jconfig.h can be\r
- * generated automatically for many systems.  jmorecfg.h contains\r
- * manual configuration options that most people need not worry about.\r
- */\r
-\r
-#ifndef JCONFIG_INCLUDED       /* in case jinclude.h already did */\r
-#include "jpeg6/jconfig.h"             /* widely used configuration options */\r
-#endif\r
-#include "jpeg6/jmorecfg.h"            /* seldom changed options */\r
-\r
-\r
-/* Version ID for the JPEG library.\r
- * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".\r
- */\r
-\r
-#define JPEG_LIB_VERSION  60   /* Version 6 */\r
-\r
-\r
-/* Various constants determining the sizes of things.\r
- * All of these are specified by the JPEG standard, so don't change them\r
- * if you want to be compatible.\r
- */\r
-\r
-#define DCTSIZE                    8   /* The basic DCT block is 8x8 samples */\r
-#define DCTSIZE2           64  /* DCTSIZE squared; # of elements in a block */\r
-#define NUM_QUANT_TBLS      4  /* Quantization tables are numbered 0..3 */\r
-#define NUM_HUFF_TBLS       4  /* Huffman tables are numbered 0..3 */\r
-#define NUM_ARITH_TBLS      16 /* Arith-coding tables are numbered 0..15 */\r
-#define MAX_COMPS_IN_SCAN   4  /* JPEG limit on # of components in one scan */\r
-#define MAX_SAMP_FACTOR     4  /* JPEG limit on sampling factors */\r
-/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;\r
- * the PostScript DCT filter can emit files with many more than 10 blocks/MCU.\r
- * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU\r
- * to handle it.  We even let you do this from the jconfig.h file.  However,\r
- * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe\r
- * sometimes emits noncompliant files doesn't mean you should too.\r
- */\r
-#define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on blocks per MCU */\r
-#ifndef D_MAX_BLOCKS_IN_MCU\r
-#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on blocks per MCU */\r
-#endif\r
-\r
-\r
-/* This macro is used to declare a "method", that is, a function pointer.\r
- * We want to supply prototype parameters if the compiler can cope.\r
- * Note that the arglist parameter must be parenthesized!\r
- */\r
-\r
-#ifdef HAVE_PROTOTYPES\r
-#define JMETHOD(type,methodname,arglist)  type (*methodname) arglist\r
-#else\r
-#define JMETHOD(type,methodname,arglist)  type (*methodname) ()\r
-#endif\r
-\r
-\r
-/* Data structures for images (arrays of samples and of DCT coefficients).\r
- * On 80x86 machines, the image arrays are too big for near pointers,\r
- * but the pointer arrays can fit in near memory.\r
- */\r
-\r
-typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */\r
-typedef JSAMPROW *JSAMPARRAY;  /* ptr to some rows (a 2-D sample array) */\r
-typedef JSAMPARRAY *JSAMPIMAGE;        /* a 3-D sample array: top index is color */\r
-\r
-typedef JCOEF JBLOCK[DCTSIZE2];        /* one block of coefficients */\r
-typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */\r
-typedef JBLOCKROW *JBLOCKARRAY;                /* a 2-D array of coefficient blocks */\r
-typedef JBLOCKARRAY *JBLOCKIMAGE;      /* a 3-D array of coefficient blocks */\r
-\r
-typedef JCOEF FAR *JCOEFPTR;   /* useful in a couple of places */\r
-\r
-\r
-/* Types for JPEG compression parameters and working tables. */\r
-\r
-\r
-/* DCT coefficient quantization tables. */\r
-\r
-typedef struct {\r
-  /* This field directly represents the contents of a JPEG DQT marker.\r
-   * Note: the values are always given in zigzag order.\r
-   */\r
-  UINT16 quantval[DCTSIZE2];   /* quantization step for each coefficient */\r
-  /* This field is used only during compression.  It's initialized FALSE when\r
-   * the table is created, and set TRUE when it's been output to the file.\r
-   * You could suppress output of a table by setting this to TRUE.\r
-   * (See jpeg_suppress_tables for an example.)\r
-   */\r
-  boolean sent_table;          /* TRUE when table has been output */\r
-} JQUANT_TBL;\r
-\r
-\r
-/* Huffman coding tables. */\r
-\r
-typedef struct {\r
-  /* These two fields directly represent the contents of a JPEG DHT marker */\r
-  UINT8 bits[17];              /* bits[k] = # of symbols with codes of */\r
-                               /* length k bits; bits[0] is unused */\r
-  UINT8 huffval[256];          /* The symbols, in order of incr code length */\r
-  /* This field is used only during compression.  It's initialized FALSE when\r
-   * the table is created, and set TRUE when it's been output to the file.\r
-   * You could suppress output of a table by setting this to TRUE.\r
-   * (See jpeg_suppress_tables for an example.)\r
-   */\r
-  boolean sent_table;          /* TRUE when table has been output */\r
-} JHUFF_TBL;\r
-\r
-\r
-/* Basic info about one component (color channel). */\r
-\r
-typedef struct {\r
-  /* These values are fixed over the whole image. */\r
-  /* For compression, they must be supplied by parameter setup; */\r
-  /* for decompression, they are read from the SOF marker. */\r
-  int component_id;            /* identifier for this component (0..255) */\r
-  int component_index;         /* its index in SOF or cinfo->comp_info[] */\r
-  int h_samp_factor;           /* horizontal sampling factor (1..4) */\r
-  int v_samp_factor;           /* vertical sampling factor (1..4) */\r
-  int quant_tbl_no;            /* quantization table selector (0..3) */\r
-  /* These values may vary between scans. */\r
-  /* For compression, they must be supplied by parameter setup; */\r
-  /* for decompression, they are read from the SOS marker. */\r
-  /* The decompressor output side may not use these variables. */\r
-  int dc_tbl_no;               /* DC entropy table selector (0..3) */\r
-  int ac_tbl_no;               /* AC entropy table selector (0..3) */\r
-  \r
-  /* Remaining fields should be treated as private by applications. */\r
-  \r
-  /* These values are computed during compression or decompression startup: */\r
-  /* Component's size in DCT blocks.\r
-   * Any dummy blocks added to complete an MCU are not counted; therefore\r
-   * these values do not depend on whether a scan is interleaved or not.\r
-   */\r
-  JDIMENSION width_in_blocks;\r
-  JDIMENSION height_in_blocks;\r
-  /* Size of a DCT block in samples.  Always DCTSIZE for compression.\r
-   * For decompression this is the size of the output from one DCT block,\r
-   * reflecting any scaling we choose to apply during the IDCT step.\r
-   * Values of 1,2,4,8 are likely to be supported.  Note that different\r
-   * components may receive different IDCT scalings.\r
-   */\r
-  int DCT_scaled_size;\r
-  /* The downsampled dimensions are the component's actual, unpadded number\r
-   * of samples at the main buffer (preprocessing/compression interface), thus\r
-   * downsampled_width = ceil(image_width * Hi/Hmax)\r
-   * and similarly for height.  For decompression, IDCT scaling is included, so\r
-   * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)\r
-   */\r
-  JDIMENSION downsampled_width;         /* actual width in samples */\r
-  JDIMENSION downsampled_height; /* actual height in samples */\r
-  /* This flag is used only for decompression.  In cases where some of the\r
-   * components will be ignored (eg grayscale output from YCbCr image),\r
-   * we can skip most computations for the unused components.\r
-   */\r
-  boolean component_needed;    /* do we need the value of this component? */\r
-\r
-  /* These values are computed before starting a scan of the component. */\r
-  /* The decompressor output side may not use these variables. */\r
-  int MCU_width;               /* number of blocks per MCU, horizontally */\r
-  int MCU_height;              /* number of blocks per MCU, vertically */\r
-  int MCU_blocks;              /* MCU_width * MCU_height */\r
-  int MCU_sample_width;                /* MCU width in samples, MCU_width*DCT_scaled_size */\r
-  int last_col_width;          /* # of non-dummy blocks across in last MCU */\r
-  int last_row_height;         /* # of non-dummy blocks down in last MCU */\r
-\r
-  /* Saved quantization table for component; NULL if none yet saved.\r
-   * See jdinput.c comments about the need for this information.\r
-   * This field is not currently used by the compressor.\r
-   */\r
-  JQUANT_TBL * quant_table;\r
-\r
-  /* Private per-component storage for DCT or IDCT subsystem. */\r
-  void * dct_table;\r
-} jpeg_component_info;\r
-\r
-\r
-/* The script for encoding a multiple-scan file is an array of these: */\r
-\r
-typedef struct {\r
-  int comps_in_scan;           /* number of components encoded in this scan */\r
-  int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */\r
-  int Ss, Se;                  /* progressive JPEG spectral selection parms */\r
-  int Ah, Al;                  /* progressive JPEG successive approx. parms */\r
-} jpeg_scan_info;\r
-\r
-\r
-/* Known color spaces. */\r
-\r
-typedef enum {\r
-       JCS_UNKNOWN,            /* error/unspecified */\r
-       JCS_GRAYSCALE,          /* monochrome */\r
-       JCS_RGB,                /* red/green/blue */\r
-       JCS_YCbCr,              /* Y/Cb/Cr (also known as YUV) */\r
-       JCS_CMYK,               /* C/M/Y/K */\r
-       JCS_YCCK                /* Y/Cb/Cr/K */\r
-} J_COLOR_SPACE;\r
-\r
-/* DCT/IDCT algorithm options. */\r
-\r
-typedef enum {\r
-       JDCT_ISLOW,             /* slow but accurate integer algorithm */\r
-       JDCT_IFAST,             /* faster, less accurate integer method */\r
-       JDCT_FLOAT              /* floating-point: accurate, fast on fast HW */\r
-} J_DCT_METHOD;\r
-\r
-#ifndef JDCT_DEFAULT           /* may be overridden in jconfig.h */\r
-#define JDCT_DEFAULT  JDCT_ISLOW\r
-#endif\r
-#ifndef JDCT_FASTEST           /* may be overridden in jconfig.h */\r
-#define JDCT_FASTEST  JDCT_IFAST\r
-#endif\r
-\r
-/* Dithering options for decompression. */\r
-\r
-typedef enum {\r
-       JDITHER_NONE,           /* no dithering */\r
-       JDITHER_ORDERED,        /* simple ordered dither */\r
-       JDITHER_FS              /* Floyd-Steinberg error diffusion dither */\r
-} J_DITHER_MODE;\r
-\r
-\r
-/* Common fields between JPEG compression and decompression master structs. */\r
-\r
-#define jpeg_common_fields \\r
-  struct jpeg_error_mgr * err; /* Error handler module */\\r
-  struct jpeg_memory_mgr * mem;        /* Memory manager module */\\r
-  struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\\r
-  boolean is_decompressor;     /* so common code can tell which is which */\\r
-  int global_state             /* for checking call sequence validity */\r
-\r
-/* Routines that are to be used by both halves of the library are declared\r
- * to receive a pointer to this structure.  There are no actual instances of\r
- * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.\r
- */\r
-struct jpeg_common_struct {\r
-  jpeg_common_fields;          /* Fields common to both master struct types */\r
-  /* Additional fields follow in an actual jpeg_compress_struct or\r
-   * jpeg_decompress_struct.  All three structs must agree on these\r
-   * initial fields!  (This would be a lot cleaner in C++.)\r
-   */\r
-};\r
-\r
-typedef struct jpeg_common_struct * j_common_ptr;\r
-typedef struct jpeg_compress_struct * j_compress_ptr;\r
-typedef struct jpeg_decompress_struct * j_decompress_ptr;\r
-\r
-\r
-/* Master record for a compression instance */\r
-\r
-struct jpeg_compress_struct {\r
-  jpeg_common_fields;          /* Fields shared with jpeg_decompress_struct */\r
-\r
-  /* Destination for compressed data */\r
-  struct jpeg_destination_mgr * dest;\r
-\r
-  /* Description of source image --- these fields must be filled in by\r
-   * outer application before starting compression.  in_color_space must\r
-   * be correct before you can even call jpeg_set_defaults().\r
-   */\r
-\r
-  JDIMENSION image_width;      /* input image width */\r
-  JDIMENSION image_height;     /* input image height */\r
-  int input_components;                /* # of color components in input image */\r
-  J_COLOR_SPACE in_color_space;        /* colorspace of input image */\r
-\r
-  double input_gamma;          /* image gamma of input image */\r
-\r
-  /* Compression parameters --- these fields must be set before calling\r
-   * jpeg_start_compress().  We recommend calling jpeg_set_defaults() to\r
-   * initialize everything to reasonable defaults, then changing anything\r
-   * the application specifically wants to change.  That way you won't get\r
-   * burnt when new parameters are added.  Also note that there are several\r
-   * helper routines to simplify changing parameters.\r
-   */\r
-\r
-  int data_precision;          /* bits of precision in image data */\r
-\r
-  int num_components;          /* # of color components in JPEG image */\r
-  J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */\r
-\r
-  jpeg_component_info * comp_info;\r
-  /* comp_info[i] describes component that appears i'th in SOF */\r
-  \r
-  JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];\r
-  /* ptrs to coefficient quantization tables, or NULL if not defined */\r
-  \r
-  JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];\r
-  JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];\r
-  /* ptrs to Huffman coding tables, or NULL if not defined */\r
-  \r
-  UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */\r
-  UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */\r
-  UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */\r
-\r
-  int num_scans;               /* # of entries in scan_info array */\r
-  const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */\r
-  /* The default value of scan_info is NULL, which causes a single-scan\r
-   * sequential JPEG file to be emitted.  To create a multi-scan file,\r
-   * set num_scans and scan_info to point to an array of scan definitions.\r
-   */\r
-\r
-  boolean raw_data_in;         /* TRUE=caller supplies downsampled data */\r
-  boolean arith_code;          /* TRUE=arithmetic coding, FALSE=Huffman */\r
-  boolean optimize_coding;     /* TRUE=optimize entropy encoding parms */\r
-  boolean CCIR601_sampling;    /* TRUE=first samples are cosited */\r
-  int smoothing_factor;                /* 1..100, or 0 for no input smoothing */\r
-  J_DCT_METHOD dct_method;     /* DCT algorithm selector */\r
-\r
-  /* The restart interval can be specified in absolute MCUs by setting\r
-   * restart_interval, or in MCU rows by setting restart_in_rows\r
-   * (in which case the correct restart_interval will be figured\r
-   * for each scan).\r
-   */\r
-  unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */\r
-  int restart_in_rows;         /* if > 0, MCU rows per restart interval */\r
-\r
-  /* Parameters controlling emission of special markers. */\r
-\r
-  boolean write_JFIF_header;   /* should a JFIF marker be written? */\r
-  /* These three values are not used by the JPEG code, merely copied */\r
-  /* into the JFIF APP0 marker.  density_unit can be 0 for unknown, */\r
-  /* 1 for dots/inch, or 2 for dots/cm.  Note that the pixel aspect */\r
-  /* ratio is defined by X_density/Y_density even when density_unit=0. */\r
-  UINT8 density_unit;          /* JFIF code for pixel size units */\r
-  UINT16 X_density;            /* Horizontal pixel density */\r
-  UINT16 Y_density;            /* Vertical pixel density */\r
-  boolean write_Adobe_marker;  /* should an Adobe marker be written? */\r
-  \r
-  /* State variable: index of next scanline to be written to\r
-   * jpeg_write_scanlines().  Application may use this to control its\r
-   * processing loop, e.g., "while (next_scanline < image_height)".\r
-   */\r
-\r
-  JDIMENSION next_scanline;    /* 0 .. image_height-1  */\r
-\r
-  /* Remaining fields are known throughout compressor, but generally\r
-   * should not be touched by a surrounding application.\r
-   */\r
-\r
-  /*\r
-   * These fields are computed during compression startup\r
-   */\r
-  boolean progressive_mode;    /* TRUE if scan script uses progressive mode */\r
-  int max_h_samp_factor;       /* largest h_samp_factor */\r
-  int max_v_samp_factor;       /* largest v_samp_factor */\r
-\r
-  JDIMENSION total_iMCU_rows;  /* # of iMCU rows to be input to coef ctlr */\r
-  /* The coefficient controller receives data in units of MCU rows as defined\r
-   * for fully interleaved scans (whether the JPEG file is interleaved or not).\r
-   * There are v_samp_factor * DCTSIZE sample rows of each component in an\r
-   * "iMCU" (interleaved MCU) row.\r
-   */\r
-  \r
-  /*\r
-   * These fields are valid during any one scan.\r
-   * They describe the components and MCUs actually appearing in the scan.\r
-   */\r
-  int comps_in_scan;           /* # of JPEG components in this scan */\r
-  jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];\r
-  /* *cur_comp_info[i] describes component that appears i'th in SOS */\r
-  \r
-  JDIMENSION MCUs_per_row;     /* # of MCUs across the image */\r
-  JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */\r
-  \r
-  int blocks_in_MCU;           /* # of DCT blocks per MCU */\r
-  int MCU_membership[C_MAX_BLOCKS_IN_MCU];\r
-  /* MCU_membership[i] is index in cur_comp_info of component owning */\r
-  /* i'th block in an MCU */\r
-\r
-  int Ss, Se, Ah, Al;          /* progressive JPEG parameters for scan */\r
-\r
-  /*\r
-   * Links to compression subobjects (methods and private variables of modules)\r
-   */\r
-  struct jpeg_comp_master * master;\r
-  struct jpeg_c_main_controller * main;\r
-  struct jpeg_c_prep_controller * prep;\r
-  struct jpeg_c_coef_controller * coef;\r
-  struct jpeg_marker_writer * marker;\r
-  struct jpeg_color_converter * cconvert;\r
-  struct jpeg_downsampler * downsample;\r
-  struct jpeg_forward_dct * fdct;\r
-  struct jpeg_entropy_encoder * entropy;\r
-};\r
-\r
-\r
-/* Master record for a decompression instance */\r
-\r
-struct jpeg_decompress_struct {\r
-  jpeg_common_fields;          /* Fields shared with jpeg_compress_struct */\r
-\r
-  /* Source of compressed data */\r
-  struct jpeg_source_mgr * src;\r
-\r
-  /* Basic description of image --- filled in by jpeg_read_header(). */\r
-  /* Application may inspect these values to decide how to process image. */\r
-\r
-  JDIMENSION image_width;      /* nominal image width (from SOF marker) */\r
-  JDIMENSION image_height;     /* nominal image height */\r
-  int num_components;          /* # of color components in JPEG image */\r
-  J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */\r
-\r
-  /* Decompression processing parameters --- these fields must be set before\r
-   * calling jpeg_start_decompress().  Note that jpeg_read_header() initializes\r
-   * them to default values.\r
-   */\r
-\r
-  J_COLOR_SPACE out_color_space; /* colorspace for output */\r
-\r
-  unsigned int scale_num, scale_denom; /* fraction by which to scale image */\r
-\r
-  double output_gamma;         /* image gamma wanted in output */\r
-\r
-  boolean buffered_image;      /* TRUE=multiple output passes */\r
-  boolean raw_data_out;                /* TRUE=downsampled data wanted */\r
-\r
-  J_DCT_METHOD dct_method;     /* IDCT algorithm selector */\r
-  boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */\r
-  boolean do_block_smoothing;  /* TRUE=apply interblock smoothing */\r
-\r
-  boolean quantize_colors;     /* TRUE=colormapped output wanted */\r
-  /* the following are ignored if not quantize_colors: */\r
-  J_DITHER_MODE dither_mode;   /* type of color dithering to use */\r
-  boolean two_pass_quantize;   /* TRUE=use two-pass color quantization */\r
-  int desired_number_of_colors;        /* max # colors to use in created colormap */\r
-  /* these are significant only in buffered-image mode: */\r
-  boolean enable_1pass_quant;  /* enable future use of 1-pass quantizer */\r
-  boolean enable_external_quant;/* enable future use of external colormap */\r
-  boolean enable_2pass_quant;  /* enable future use of 2-pass quantizer */\r
-\r
-  /* Description of actual output image that will be returned to application.\r
-   * These fields are computed by jpeg_start_decompress().\r
-   * You can also use jpeg_calc_output_dimensions() to determine these values\r
-   * in advance of calling jpeg_start_decompress().\r
-   */\r
-\r
-  JDIMENSION output_width;     /* scaled image width */\r
-  JDIMENSION output_height;    /* scaled image height */\r
-  int out_color_components;    /* # of color components in out_color_space */\r
-  int output_components;       /* # of color components returned */\r
-  /* output_components is 1 (a colormap index) when quantizing colors;\r
-   * otherwise it equals out_color_components.\r
-   */\r
-  int rec_outbuf_height;       /* min recommended height of scanline buffer */\r
-  /* If the buffer passed to jpeg_read_scanlines() is less than this many rows\r
-   * high, space and time will be wasted due to unnecessary data copying.\r
-   * Usually rec_outbuf_height will be 1 or 2, at most 4.\r
-   */\r
-\r
-  /* When quantizing colors, the output colormap is described by these fields.\r
-   * The application can supply a colormap by setting colormap non-NULL before\r
-   * calling jpeg_start_decompress; otherwise a colormap is created during\r
-   * jpeg_start_decompress or jpeg_start_output.\r
-   * The map has out_color_components rows and actual_number_of_colors columns.\r
-   */\r
-  int actual_number_of_colors; /* number of entries in use */\r
-  JSAMPARRAY colormap;         /* The color map as a 2-D pixel array */\r
-\r
-  /* State variables: these variables indicate the progress of decompression.\r
-   * The application may examine these but must not modify them.\r
-   */\r
-\r
-  /* Row index of next scanline to be read from jpeg_read_scanlines().\r
-   * Application may use this to control its processing loop, e.g.,\r
-   * "while (output_scanline < output_height)".\r
-   */\r
-  JDIMENSION output_scanline;  /* 0 .. output_height-1  */\r
-\r
-  /* Current input scan number and number of iMCU rows completed in scan.\r
-   * These indicate the progress of the decompressor input side.\r
-   */\r
-  int input_scan_number;       /* Number of SOS markers seen so far */\r
-  JDIMENSION input_iMCU_row;   /* Number of iMCU rows completed */\r
-\r
-  /* The "output scan number" is the notional scan being displayed by the\r
-   * output side.  The decompressor will not allow output scan/row number\r
-   * to get ahead of input scan/row, but it can fall arbitrarily far behind.\r
-   */\r
-  int output_scan_number;      /* Nominal scan number being displayed */\r
-  JDIMENSION output_iMCU_row;  /* Number of iMCU rows read */\r
-\r
-  /* Current progression status.  coef_bits[c][i] indicates the precision\r
-   * with which component c's DCT coefficient i (in zigzag order) is known.\r
-   * It is -1 when no data has yet been received, otherwise it is the point\r
-   * transform (shift) value for the most recent scan of the coefficient\r
-   * (thus, 0 at completion of the progression).\r
-   * This pointer is NULL when reading a non-progressive file.\r
-   */\r
-  int (*coef_bits)[DCTSIZE2];  /* -1 or current Al value for each coef */\r
-\r
-  /* Internal JPEG parameters --- the application usually need not look at\r
-   * these fields.  Note that the decompressor output side may not use\r
-   * any parameters that can change between scans.\r
-   */\r
-\r
-  /* Quantization and Huffman tables are carried forward across input\r
-   * datastreams when processing abbreviated JPEG datastreams.\r
-   */\r
-\r
-  JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];\r
-  /* ptrs to coefficient quantization tables, or NULL if not defined */\r
-\r
-  JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];\r
-  JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];\r
-  /* ptrs to Huffman coding tables, or NULL if not defined */\r
-\r
-  /* These parameters are never carried across datastreams, since they\r
-   * are given in SOF/SOS markers or defined to be reset by SOI.\r
-   */\r
-\r
-  int data_precision;          /* bits of precision in image data */\r
-\r
-  jpeg_component_info * comp_info;\r
-  /* comp_info[i] describes component that appears i'th in SOF */\r
-\r
-  boolean progressive_mode;    /* TRUE if SOFn specifies progressive mode */\r
-  boolean arith_code;          /* TRUE=arithmetic coding, FALSE=Huffman */\r
-\r
-  UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */\r
-  UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */\r
-  UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */\r
-\r
-  unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */\r
-\r
-  /* These fields record data obtained from optional markers recognized by\r
-   * the JPEG library.\r
-   */\r
-  boolean saw_JFIF_marker;     /* TRUE iff a JFIF APP0 marker was found */\r
-  /* Data copied from JFIF marker: */\r
-  UINT8 density_unit;          /* JFIF code for pixel size units */\r
-  UINT16 X_density;            /* Horizontal pixel density */\r
-  UINT16 Y_density;            /* Vertical pixel density */\r
-  boolean saw_Adobe_marker;    /* TRUE iff an Adobe APP14 marker was found */\r
-  UINT8 Adobe_transform;       /* Color transform code from Adobe marker */\r
-\r
-  boolean CCIR601_sampling;    /* TRUE=first samples are cosited */\r
-\r
-  /* Remaining fields are known throughout decompressor, but generally\r
-   * should not be touched by a surrounding application.\r
-   */\r
-\r
-  /*\r
-   * These fields are computed during decompression startup\r
-   */\r
-  int max_h_samp_factor;       /* largest h_samp_factor */\r
-  int max_v_samp_factor;       /* largest v_samp_factor */\r
-\r
-  int min_DCT_scaled_size;     /* smallest DCT_scaled_size of any component */\r
-\r
-  JDIMENSION total_iMCU_rows;  /* # of iMCU rows in image */\r
-  /* The coefficient controller's input and output progress is measured in\r
-   * units of "iMCU" (interleaved MCU) rows.  These are the same as MCU rows\r
-   * in fully interleaved JPEG scans, but are used whether the scan is\r
-   * interleaved or not.  We define an iMCU row as v_samp_factor DCT block\r
-   * rows of each component.  Therefore, the IDCT output contains\r
-   * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.\r
-   */\r
-\r
-  JSAMPLE * sample_range_limit; /* table for fast range-limiting */\r
-\r
-  /*\r
-   * These fields are valid during any one scan.\r
-   * They describe the components and MCUs actually appearing in the scan.\r
-   * Note that the decompressor output side must not use these fields.\r
-   */\r
-  int comps_in_scan;           /* # of JPEG components in this scan */\r
-  jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];\r
-  /* *cur_comp_info[i] describes component that appears i'th in SOS */\r
-\r
-  JDIMENSION MCUs_per_row;     /* # of MCUs across the image */\r
-  JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */\r
-\r
-  int blocks_in_MCU;           /* # of DCT blocks per MCU */\r
-  int MCU_membership[D_MAX_BLOCKS_IN_MCU];\r
-  /* MCU_membership[i] is index in cur_comp_info of component owning */\r
-  /* i'th block in an MCU */\r
-\r
-  int Ss, Se, Ah, Al;          /* progressive JPEG parameters for scan */\r
-\r
-  /* This field is shared between entropy decoder and marker parser.\r
-   * It is either zero or the code of a JPEG marker that has been\r
-   * read from the data source, but has not yet been processed.\r
-   */\r
-  int unread_marker;\r
-\r
-  /*\r
-   * Links to decompression subobjects (methods, private variables of modules)\r
-   */\r
-  struct jpeg_decomp_master * master;\r
-  struct jpeg_d_main_controller * main;\r
-  struct jpeg_d_coef_controller * coef;\r
-  struct jpeg_d_post_controller * post;\r
-  struct jpeg_input_controller * inputctl;\r
-  struct jpeg_marker_reader * marker;\r
-  struct jpeg_entropy_decoder * entropy;\r
-  struct jpeg_inverse_dct * idct;\r
-  struct jpeg_upsampler * upsample;\r
-  struct jpeg_color_deconverter * cconvert;\r
-  struct jpeg_color_quantizer * cquantize;\r
-};\r
-\r
-\r
-/* "Object" declarations for JPEG modules that may be supplied or called\r
- * directly by the surrounding application.\r
- * As with all objects in the JPEG library, these structs only define the\r
- * publicly visible methods and state variables of a module.  Additional\r
- * private fields may exist after the public ones.\r
- */\r
-\r
-\r
-/* Error handler object */\r
-\r
-struct jpeg_error_mgr {\r
-  /* Error exit handler: does not return to caller */\r
-  JMETHOD(void, error_exit, (j_common_ptr cinfo));\r
-  /* Conditionally emit a trace or warning message */\r
-  JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));\r
-  /* Routine that actually outputs a trace or error message */\r
-  JMETHOD(void, output_message, (j_common_ptr cinfo));\r
-  /* Format a message string for the most recent JPEG error or message */\r
-  JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer));\r
-#define JMSG_LENGTH_MAX  200   /* recommended size of format_message buffer */\r
-  /* Reset error state variables at start of a new image */\r
-  JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));\r
-  \r
-  /* The message ID code and any parameters are saved here.\r
-   * A message can have one string parameter or up to 8 int parameters.\r
-   */\r
-  int msg_code;\r
-#define JMSG_STR_PARM_MAX  80\r
-  union {\r
-    int i[8];\r
-    char s[JMSG_STR_PARM_MAX];\r
-  } msg_parm;\r
-  \r
-  /* Standard state variables for error facility */\r
-  \r
-  int trace_level;             /* max msg_level that will be displayed */\r
-  \r
-  /* For recoverable corrupt-data errors, we emit a warning message,\r
-   * but keep going unless emit_message chooses to abort.  emit_message\r
-   * should count warnings in num_warnings.  The surrounding application\r
-   * can check for bad data by seeing if num_warnings is nonzero at the\r
-   * end of processing.\r
-   */\r
-  long num_warnings;           /* number of corrupt-data warnings */\r
-\r
-  /* These fields point to the table(s) of error message strings.\r
-   * An application can change the table pointer to switch to a different\r
-   * message list (typically, to change the language in which errors are\r
-   * reported).  Some applications may wish to add additional error codes\r
-   * that will be handled by the JPEG library error mechanism; the second\r
-   * table pointer is used for this purpose.\r
-   *\r
-   * First table includes all errors generated by JPEG library itself.\r
-   * Error code 0 is reserved for a "no such error string" message.\r
-   */\r
-  const char * const * jpeg_message_table; /* Library errors */\r
-  int last_jpeg_message;    /* Table contains strings 0..last_jpeg_message */\r
-  /* Second table can be added by application (see cjpeg/djpeg for example).\r
-   * It contains strings numbered first_addon_message..last_addon_message.\r
-   */\r
-  const char * const * addon_message_table; /* Non-library errors */\r
-  int first_addon_message;     /* code for first string in addon table */\r
-  int last_addon_message;      /* code for last string in addon table */\r
-};\r
-\r
-\r
-/* Progress monitor object */\r
-\r
-struct jpeg_progress_mgr {\r
-  JMETHOD(void, progress_monitor, (j_common_ptr cinfo));\r
-\r
-  long pass_counter;           /* work units completed in this pass */\r
-  long pass_limit;             /* total number of work units in this pass */\r
-  int completed_passes;                /* passes completed so far */\r
-  int total_passes;            /* total number of passes expected */\r
-};\r
-\r
-\r
-/* Data destination object for compression */\r
-\r
-struct jpeg_destination_mgr {\r
-  JOCTET * next_output_byte;   /* => next byte to write in buffer */\r
-  size_t free_in_buffer;       /* # of byte spaces remaining in buffer */\r
-\r
-  JMETHOD(void, init_destination, (j_compress_ptr cinfo));\r
-  JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo));\r
-  JMETHOD(void, term_destination, (j_compress_ptr cinfo));\r
-};\r
-\r
-\r
-/* Data source object for decompression */\r
-\r
-struct jpeg_source_mgr {\r
-  const JOCTET * next_input_byte; /* => next byte to read from buffer */\r
-  size_t bytes_in_buffer;      /* # of bytes remaining in buffer */\r
-\r
-  JMETHOD(void, init_source, (j_decompress_ptr cinfo));\r
-  JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo));\r
-  JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes));\r
-  JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired));\r
-  JMETHOD(void, term_source, (j_decompress_ptr cinfo));\r
-};\r
-\r
-\r
-/* Memory manager object.\r
- * Allocates "small" objects (a few K total), "large" objects (tens of K),\r
- * and "really big" objects (virtual arrays with backing store if needed).\r
- * The memory manager does not allow individual objects to be freed; rather,\r
- * each created object is assigned to a pool, and whole pools can be freed\r
- * at once.  This is faster and more convenient than remembering exactly what\r
- * to free, especially where malloc()/free() are not too speedy.\r
- * NB: alloc routines never return NULL.  They exit to error_exit if not\r
- * successful.\r
- */\r
-\r
-#define JPOOL_PERMANENT        0       /* lasts until master record is destroyed */\r
-#define JPOOL_IMAGE    1       /* lasts until done with image/datastream */\r
-#define JPOOL_NUMPOOLS 2\r
-\r
-typedef struct jvirt_sarray_control * jvirt_sarray_ptr;\r
-typedef struct jvirt_barray_control * jvirt_barray_ptr;\r
-\r
-\r
-struct jpeg_memory_mgr {\r
-  /* Method pointers */\r
-  JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id,\r
-                               size_t sizeofobject));\r
-  JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id,\r
-                                    size_t sizeofobject));\r
-  JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,\r
-                                    JDIMENSION samplesperrow,\r
-                                    JDIMENSION numrows));\r
-  JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,\r
-                                     JDIMENSION blocksperrow,\r
-                                     JDIMENSION numrows));\r
-  JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,\r
-                                                 int pool_id,\r
-                                                 boolean pre_zero,\r
-                                                 JDIMENSION samplesperrow,\r
-                                                 JDIMENSION numrows,\r
-                                                 JDIMENSION maxaccess));\r
-  JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,\r
-                                                 int pool_id,\r
-                                                 boolean pre_zero,\r
-                                                 JDIMENSION blocksperrow,\r
-                                                 JDIMENSION numrows,\r
-                                                 JDIMENSION maxaccess));\r
-  JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo));\r
-  JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo,\r
-                                          jvirt_sarray_ptr ptr,\r
-                                          JDIMENSION start_row,\r
-                                          JDIMENSION num_rows,\r
-                                          boolean writable));\r
-  JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo,\r
-                                           jvirt_barray_ptr ptr,\r
-                                           JDIMENSION start_row,\r
-                                           JDIMENSION num_rows,\r
-                                           boolean writable));\r
-  JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id));\r
-  JMETHOD(void, self_destruct, (j_common_ptr cinfo));\r
-\r
-  /* Limit on memory allocation for this JPEG object.  (Note that this is\r
-   * merely advisory, not a guaranteed maximum; it only affects the space\r
-   * used for virtual-array buffers.)  May be changed by outer application\r
-   * after creating the JPEG object.\r
-   */\r
-  long max_memory_to_use;\r
-};\r
-\r
-\r
-/* Routine signature for application-supplied marker processing methods.\r
- * Need not pass marker code since it is stored in cinfo->unread_marker.\r
- */\r
-typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));\r
-\r
-\r
-/* Declarations for routines called by application.\r
- * The JPP macro hides prototype parameters from compilers that can't cope.\r
- * Note JPP requires double parentheses.\r
- */\r
-\r
-#ifdef HAVE_PROTOTYPES\r
-#define JPP(arglist)   arglist\r
-#else\r
-#define JPP(arglist)   ()\r
-#endif\r
-\r
-\r
-/* Short forms of external names for systems with brain-damaged linkers.\r
- * We shorten external names to be unique in the first six letters, which\r
- * is good enough for all known systems.\r
- * (If your compiler itself needs names to be unique in less than 15 \r
- * characters, you are out of luck.  Get a better compiler.)\r
- */\r
-\r
-#ifdef NEED_SHORT_EXTERNAL_NAMES\r
-#define jpeg_std_error         jStdError\r
-#define jpeg_create_compress   jCreaCompress\r
-#define jpeg_create_decompress jCreaDecompress\r
-#define jpeg_destroy_compress  jDestCompress\r
-#define jpeg_destroy_decompress        jDestDecompress\r
-#define jpeg_stdio_dest                jStdDest\r
-#define jpeg_stdio_src         jStdSrc\r
-#define jpeg_set_defaults      jSetDefaults\r
-#define jpeg_set_colorspace    jSetColorspace\r
-#define jpeg_default_colorspace        jDefColorspace\r
-#define jpeg_set_quality       jSetQuality\r
-#define jpeg_set_linear_quality        jSetLQuality\r
-#define jpeg_add_quant_table   jAddQuantTable\r
-#define jpeg_quality_scaling   jQualityScaling\r
-#define jpeg_simple_progression        jSimProgress\r
-#define jpeg_suppress_tables   jSuppressTables\r
-#define jpeg_alloc_quant_table jAlcQTable\r
-#define jpeg_alloc_huff_table  jAlcHTable\r
-#define jpeg_start_compress    jStrtCompress\r
-#define jpeg_write_scanlines   jWrtScanlines\r
-#define jpeg_finish_compress   jFinCompress\r
-#define jpeg_write_raw_data    jWrtRawData\r
-#define jpeg_write_marker      jWrtMarker\r
-#define jpeg_write_tables      jWrtTables\r
-#define jpeg_read_header       jReadHeader\r
-#define jpeg_start_decompress  jStrtDecompress\r
-#define jpeg_read_scanlines    jReadScanlines\r
-#define jpeg_finish_decompress jFinDecompress\r
-#define jpeg_read_raw_data     jReadRawData\r
-#define jpeg_has_multiple_scans        jHasMultScn\r
-#define jpeg_start_output      jStrtOutput\r
-#define jpeg_finish_output     jFinOutput\r
-#define jpeg_input_complete    jInComplete\r
-#define jpeg_new_colormap      jNewCMap\r
-#define jpeg_consume_input     jConsumeInput\r
-#define jpeg_calc_output_dimensions    jCalcDimensions\r
-#define jpeg_set_marker_processor      jSetMarker\r
-#define jpeg_read_coefficients jReadCoefs\r
-#define jpeg_write_coefficients        jWrtCoefs\r
-#define jpeg_copy_critical_parameters  jCopyCrit\r
-#define jpeg_abort_compress    jAbrtCompress\r
-#define jpeg_abort_decompress  jAbrtDecompress\r
-#define jpeg_abort             jAbort\r
-#define jpeg_destroy           jDestroy\r
-#define jpeg_resync_to_restart jResyncRestart\r
-#endif /* NEED_SHORT_EXTERNAL_NAMES */\r
-\r
-\r
-/* Default error-management setup */\r
-EXTERN struct jpeg_error_mgr *jpeg_std_error JPP((struct jpeg_error_mgr *err));\r
-\r
-/* Initialization and destruction of JPEG compression objects */\r
-/* NB: you must set up the error-manager BEFORE calling jpeg_create_xxx */\r
-EXTERN void jpeg_create_compress JPP((j_compress_ptr cinfo));\r
-EXTERN void jpeg_create_decompress JPP((j_decompress_ptr cinfo));\r
-EXTERN void jpeg_destroy_compress JPP((j_compress_ptr cinfo));\r
-EXTERN void jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));\r
-\r
-/* Standard data source and destination managers: stdio streams. */\r
-/* Caller is responsible for opening the file before and closing after. */\r
-EXTERN void jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));\r
-EXTERN void jpeg_stdio_src JPP((j_decompress_ptr cinfo, unsigned char *infile, int bufsize));\r
-\r
-/* Default parameter setup for compression */\r
-EXTERN void jpeg_set_defaults JPP((j_compress_ptr cinfo));\r
-/* Compression parameter setup aids */\r
-EXTERN void jpeg_set_colorspace JPP((j_compress_ptr cinfo,\r
-                                    J_COLOR_SPACE colorspace));\r
-EXTERN void jpeg_default_colorspace JPP((j_compress_ptr cinfo));\r
-EXTERN void jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,\r
-                                 boolean force_baseline));\r
-EXTERN void jpeg_set_linear_quality JPP((j_compress_ptr cinfo,\r
-                                        int scale_factor,\r
-                                        boolean force_baseline));\r
-EXTERN void jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,\r
-                                     const unsigned int *basic_table,\r
-                                     int scale_factor,\r
-                                     boolean force_baseline));\r
-EXTERN int jpeg_quality_scaling JPP((int quality));\r
-EXTERN void jpeg_simple_progression JPP((j_compress_ptr cinfo));\r
-EXTERN void jpeg_suppress_tables JPP((j_compress_ptr cinfo,\r
-                                     boolean suppress));\r
-EXTERN JQUANT_TBL * jpeg_alloc_quant_table JPP((j_common_ptr cinfo));\r
-EXTERN JHUFF_TBL * jpeg_alloc_huff_table JPP((j_common_ptr cinfo));\r
-\r
-/* Main entry points for compression */\r
-EXTERN void jpeg_start_compress JPP((j_compress_ptr cinfo,\r
-                                    boolean write_all_tables));\r
-EXTERN JDIMENSION jpeg_write_scanlines JPP((j_compress_ptr cinfo,\r
-                                           JSAMPARRAY scanlines,\r
-                                           JDIMENSION num_lines));\r
-EXTERN void jpeg_finish_compress JPP((j_compress_ptr cinfo));\r
-\r
-/* Replaces jpeg_write_scanlines when writing raw downsampled data. */\r
-EXTERN JDIMENSION jpeg_write_raw_data JPP((j_compress_ptr cinfo,\r
-                                          JSAMPIMAGE data,\r
-                                          JDIMENSION num_lines));\r
-\r
-/* Write a special marker.  See libjpeg.doc concerning safe usage. */\r
-EXTERN void jpeg_write_marker JPP((j_compress_ptr cinfo, int marker,\r
-                                  const JOCTET *dataptr, unsigned int datalen));\r
-\r
-/* Alternate compression function: just write an abbreviated table file */\r
-EXTERN void jpeg_write_tables JPP((j_compress_ptr cinfo));\r
-\r
-/* Decompression startup: read start of JPEG datastream to see what's there */\r
-EXTERN int jpeg_read_header JPP((j_decompress_ptr cinfo,\r
-                                boolean require_image));\r
-/* Return value is one of: */\r
-#define JPEG_SUSPENDED         0 /* Suspended due to lack of input data */\r
-#define JPEG_HEADER_OK         1 /* Found valid image datastream */\r
-#define JPEG_HEADER_TABLES_ONLY        2 /* Found valid table-specs-only datastream */\r
-/* If you pass require_image = TRUE (normal case), you need not check for\r
- * a TABLES_ONLY return code; an abbreviated file will cause an error exit.\r
- * JPEG_SUSPENDED is only possible if you use a data source module that can\r
- * give a suspension return (the stdio source module doesn't).\r
- */\r
-\r
-/* Main entry points for decompression */\r
-EXTERN boolean jpeg_start_decompress JPP((j_decompress_ptr cinfo));\r
-EXTERN JDIMENSION jpeg_read_scanlines JPP((j_decompress_ptr cinfo,\r
-                                          JSAMPARRAY scanlines,\r
-                                          JDIMENSION max_lines));\r
-EXTERN boolean jpeg_finish_decompress JPP((j_decompress_ptr cinfo));\r
-\r
-/* Replaces jpeg_read_scanlines when reading raw downsampled data. */\r
-EXTERN JDIMENSION jpeg_read_raw_data JPP((j_decompress_ptr cinfo,\r
-                                         JSAMPIMAGE data,\r
-                                         JDIMENSION max_lines));\r
-\r
-/* Additional entry points for buffered-image mode. */\r
-EXTERN boolean jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo));\r
-EXTERN boolean jpeg_start_output JPP((j_decompress_ptr cinfo,\r
-                                     int scan_number));\r
-EXTERN boolean jpeg_finish_output JPP((j_decompress_ptr cinfo));\r
-EXTERN boolean jpeg_input_complete JPP((j_decompress_ptr cinfo));\r
-EXTERN void jpeg_new_colormap JPP((j_decompress_ptr cinfo));\r
-EXTERN int jpeg_consume_input JPP((j_decompress_ptr cinfo));\r
-/* Return value is one of: */\r
-/* #define JPEG_SUSPENDED      0    Suspended due to lack of input data */\r
-#define JPEG_REACHED_SOS       1 /* Reached start of new scan */\r
-#define JPEG_REACHED_EOI       2 /* Reached end of image */\r
-#define JPEG_ROW_COMPLETED     3 /* Completed one iMCU row */\r
-#define JPEG_SCAN_COMPLETED    4 /* Completed last iMCU row of a scan */\r
-\r
-/* Precalculate output dimensions for current decompression parameters. */\r
-EXTERN void jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));\r
-\r
-/* Install a special processing method for COM or APPn markers. */\r
-EXTERN void jpeg_set_marker_processor JPP((j_decompress_ptr cinfo,\r
-                                          int marker_code,\r
-                                          jpeg_marker_parser_method routine));\r
-\r
-/* Read or write raw DCT coefficients --- useful for lossless transcoding. */\r
-EXTERN jvirt_barray_ptr * jpeg_read_coefficients JPP((j_decompress_ptr cinfo));\r
-EXTERN void jpeg_write_coefficients JPP((j_compress_ptr cinfo,\r
-                                        jvirt_barray_ptr * coef_arrays));\r
-EXTERN void jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo,\r
-                                              j_compress_ptr dstinfo));\r
-\r
-/* If you choose to abort compression or decompression before completing\r
- * jpeg_finish_(de)compress, then you need to clean up to release memory,\r
- * temporary files, etc.  You can just call jpeg_destroy_(de)compress\r
- * if you're done with the JPEG object, but if you want to clean it up and\r
- * reuse it, call this:\r
- */\r
-EXTERN void jpeg_abort_compress JPP((j_compress_ptr cinfo));\r
-EXTERN void jpeg_abort_decompress JPP((j_decompress_ptr cinfo));\r
-\r
-/* Generic versions of jpeg_abort and jpeg_destroy that work on either\r
- * flavor of JPEG object.  These may be more convenient in some places.\r
- */\r
-EXTERN void jpeg_abort JPP((j_common_ptr cinfo));\r
-EXTERN void jpeg_destroy JPP((j_common_ptr cinfo));\r
-\r
-/* Default restart-marker-resync procedure for use by data source modules */\r
-EXTERN boolean jpeg_resync_to_restart JPP((j_decompress_ptr cinfo,\r
-                                          int desired));\r
-\r
-\r
-/* These marker codes are exported since applications and data source modules\r
- * are likely to want to use them.\r
- */\r
-\r
-#define JPEG_RST0      0xD0    /* RST0 marker code */\r
-#define JPEG_EOI       0xD9    /* EOI marker code */\r
-#define JPEG_APP0      0xE0    /* APP0 marker code */\r
-#define JPEG_COM       0xFE    /* COM marker code */\r
-\r
-\r
-/* If we have a brain-damaged compiler that emits warnings (or worse, errors)\r
- * for structure definitions that are never filled in, keep it quiet by\r
- * supplying dummy definitions for the various substructures.\r
- */\r
-\r
-#ifdef INCOMPLETE_TYPES_BROKEN\r
-#ifndef JPEG_INTERNALS         /* will be defined in jpegint.h */\r
-struct jvirt_sarray_control { long dummy; };\r
-struct jvirt_barray_control { long dummy; };\r
-struct jpeg_comp_master { long dummy; };\r
-struct jpeg_c_main_controller { long dummy; };\r
-struct jpeg_c_prep_controller { long dummy; };\r
-struct jpeg_c_coef_controller { long dummy; };\r
-struct jpeg_marker_writer { long dummy; };\r
-struct jpeg_color_converter { long dummy; };\r
-struct jpeg_downsampler { long dummy; };\r
-struct jpeg_forward_dct { long dummy; };\r
-struct jpeg_entropy_encoder { long dummy; };\r
-struct jpeg_decomp_master { long dummy; };\r
-struct jpeg_d_main_controller { long dummy; };\r
-struct jpeg_d_coef_controller { long dummy; };\r
-struct jpeg_d_post_controller { long dummy; };\r
-struct jpeg_input_controller { long dummy; };\r
-struct jpeg_marker_reader { long dummy; };\r
-struct jpeg_entropy_decoder { long dummy; };\r
-struct jpeg_inverse_dct { long dummy; };\r
-struct jpeg_upsampler { long dummy; };\r
-struct jpeg_color_deconverter { long dummy; };\r
-struct jpeg_color_quantizer { long dummy; };\r
-#endif /* JPEG_INTERNALS */\r
-#endif /* INCOMPLETE_TYPES_BROKEN */\r
-\r
-\r
-/*\r
- * The JPEG library modules define JPEG_INTERNALS before including this file.\r
- * The internal structure declarations are read only when that is true.\r
- * Applications using the library should not include jpegint.h, but may wish\r
- * to include jerror.h.\r
- */\r
-\r
-#ifdef JPEG_INTERNALS\r
-#include "jpegint.h"           /* fetch private declarations */\r
-#include "jerror.h"            /* fetch error codes too */\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* JPEGLIB_H */\r
index 440a152456e31c0510249e4e80dc0ca319bee50f..f88389527e0a9c3a8dbb9dc58a05e59a8904b6a4 100644 (file)
--- a/utils.py
+++ b/utils.py
@@ -3,7 +3,7 @@
 # TTimo <ttimo@idsoftware.com>\r
 # http://scons.sourceforge.net\r
 \r
-import os, commands, platform, xml.sax, re, string\r
+import os, commands, platform, xml.sax, re, string, platform\r
 \r
 class vcproj( xml.sax.handler.ContentHandler ):\r
        def __init__( self, filepath ):\r
@@ -46,6 +46,9 @@ class vcproj( xml.sax.handler.ContentHandler ):
 # action uses LDD to verify that the source doesn't hold unresolved symbols\r
 # setup as an AddPostAction of a regular SharedLibrary call\r
 def CheckUnresolved( source, target, env ):\r
+       # TODO: implement this for OSX\r
+       if ( platform.system() == 'Darwin' ):\r
+               return None\r
        print 'CheckUnresolved %s' % target[0].abspath\r
        if ( not os.path.isfile( target[0].abspath ) ):\r
                print 'CheckUnresolved: %s does not exist' % target[0]\r