完善目录结构

完善了目录结构,添加了以前的web段com组件调用的代码(在/测试目录下)(部署没有使用到)
This commit is contained in:
yanshui177
2017-05-17 20:43:16 +08:00
parent ad754709a5
commit 6dcd378738
1246 changed files with 671388 additions and 517 deletions

View File

@@ -0,0 +1,266 @@
/*
* Copyright (c) 2002-2003 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* Color Management
*
* $Id: jas_cm.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_CM_H
#define JAS_CM_H
#include <jasper/jas_config.h>
#include <jasper/jas_icc.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int jas_clrspc_t;
/* transform operations */
#define JAS_CMXFORM_OP_FWD 0
#define JAS_CMXFORM_OP_REV 1
#define JAS_CMXFORM_OP_PROOF 2
#define JAS_CMXFORM_OP_GAMUT 3
/* rendering intents */
#define JAS_CMXFORM_INTENT_PER 0
#define JAS_CMXFORM_INTENT_RELCLR 1
#define JAS_CMXFORM_INTENT_ABSCLR 2
#define JAS_CMXFORM_INTENT_SAT 3
#define JAS_CMXFORM_NUMINTENTS 4
#define JAS_CMXFORM_OPTM_SPEED 0
#define JAS_CMXFORM_OPTM_SIZE 1
#define JAS_CMXFORM_OPTM_ACC 2
#define jas_clrspc_create(fam, mbr) (((fam) << 8) | (mbr))
#define jas_clrspc_fam(clrspc) ((clrspc) >> 8)
#define jas_clrspc_mbr(clrspc) ((clrspc) & 0xff)
#define jas_clrspc_isgeneric(clrspc) (!jas_clrspc_mbr(clrspc))
#define jas_clrspc_isunknown(clrspc) ((clrspc) & JAS_CLRSPC_UNKNOWNMASK)
#define JAS_CLRSPC_UNKNOWNMASK 0x4000
/* color space families */
#define JAS_CLRSPC_FAM_UNKNOWN 0
#define JAS_CLRSPC_FAM_XYZ 1
#define JAS_CLRSPC_FAM_LAB 2
#define JAS_CLRSPC_FAM_GRAY 3
#define JAS_CLRSPC_FAM_RGB 4
#define JAS_CLRSPC_FAM_YCBCR 5
/* specific color spaces */
#define JAS_CLRSPC_UNKNOWN JAS_CLRSPC_UNKNOWNMASK
#define JAS_CLRSPC_CIEXYZ jas_clrspc_create(JAS_CLRSPC_FAM_XYZ, 1)
#define JAS_CLRSPC_CIELAB jas_clrspc_create(JAS_CLRSPC_FAM_LAB, 1)
#define JAS_CLRSPC_SGRAY jas_clrspc_create(JAS_CLRSPC_FAM_GRAY, 1)
#define JAS_CLRSPC_SRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 1)
#define JAS_CLRSPC_SYCBCR jas_clrspc_create(JAS_CLRSPC_FAM_YCBCR, 1)
/* generic color spaces */
#define JAS_CLRSPC_GENRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 0)
#define JAS_CLRSPC_GENGRAY jas_clrspc_create(JAS_CLRSPC_FAM_GRAY, 0)
#define JAS_CLRSPC_GENYCBCR jas_clrspc_create(JAS_CLRSPC_FAM_YCBCR, 0)
#define JAS_CLRSPC_CHANIND_YCBCR_Y 0
#define JAS_CLRSPC_CHANIND_YCBCR_CB 1
#define JAS_CLRSPC_CHANIND_YCBCR_CR 2
#define JAS_CLRSPC_CHANIND_RGB_R 0
#define JAS_CLRSPC_CHANIND_RGB_G 1
#define JAS_CLRSPC_CHANIND_RGB_B 2
#define JAS_CLRSPC_CHANIND_GRAY_Y 0
typedef double jas_cmreal_t;
struct jas_cmpxform_s;
typedef struct {
long *buf;
int prec;
int sgnd;
int width;
int height;
} jas_cmcmptfmt_t;
typedef struct {
int numcmpts;
jas_cmcmptfmt_t *cmptfmts;
} jas_cmpixmap_t;
typedef struct {
void (*destroy)(struct jas_cmpxform_s *pxform);
int (*apply)(struct jas_cmpxform_s *pxform, jas_cmreal_t *in, jas_cmreal_t *out, int cnt);
void (*dump)(struct jas_cmpxform_s *pxform);
} jas_cmpxformops_t;
typedef struct {
jas_cmreal_t *data;
int size;
} jas_cmshapmatlut_t;
typedef struct {
int mono;
int order;
int useluts;
int usemat;
jas_cmshapmatlut_t luts[3];
jas_cmreal_t mat[3][4];
} jas_cmshapmat_t;
typedef struct {
int order;
} jas_cmshaplut_t;
typedef struct {
int inclrspc;
int outclrspc;
} jas_cmclrspcconv_t;
#define jas_align_t double
typedef struct jas_cmpxform_s {
int refcnt;
jas_cmpxformops_t *ops;
int numinchans;
int numoutchans;
union {
jas_align_t dummy;
jas_cmshapmat_t shapmat;
jas_cmshaplut_t shaplut;
jas_cmclrspcconv_t clrspcconv;
} data;
} jas_cmpxform_t;
typedef struct {
int numpxforms;
int maxpxforms;
jas_cmpxform_t **pxforms;
} jas_cmpxformseq_t;
typedef struct {
int numinchans;
int numoutchans;
jas_cmpxformseq_t *pxformseq;
} jas_cmxform_t;
#define JAS_CMPROF_TYPE_DEV 1
#define JAS_CMPROF_TYPE_CLRSPC 2
#define JAS_CMPROF_NUMPXFORMSEQS 13
typedef struct {
int clrspc;
int numchans;
int refclrspc;
int numrefchans;
jas_iccprof_t *iccprof;
jas_cmpxformseq_t *pxformseqs[JAS_CMPROF_NUMPXFORMSEQS];
} jas_cmprof_t;
/* Create a profile. */
/* Destroy a profile. */
void jas_cmprof_destroy(jas_cmprof_t *prof);
#if 0
typedef int_fast32_t jas_cmattrname_t;
typedef int_fast32_t jas_cmattrval_t;
typedef int_fast32_t jas_cmattrtype_t;
/* Load a profile. */
int jas_cmprof_load(jas_cmprof_t *prof, jas_stream_t *in, int fmt);
/* Save a profile. */
int jas_cmprof_save(jas_cmprof_t *prof, jas_stream_t *out, int fmt);
/* Set an attribute of a profile. */
int jas_cm_prof_setattr(jas_cm_prof_t *prof, jas_cm_attrname_t name, void *val);
/* Get an attribute of a profile. */
void *jas_cm_prof_getattr(jas_cm_prof_t *prof, jas_cm_attrname_t name);
#endif
jas_cmxform_t *jas_cmxform_create(jas_cmprof_t *inprof, jas_cmprof_t *outprof,
jas_cmprof_t *proofprof, int op, int intent, int optimize);
void jas_cmxform_destroy(jas_cmxform_t *xform);
/* Apply a transform to data. */
int jas_cmxform_apply(jas_cmxform_t *xform, jas_cmpixmap_t *in,
jas_cmpixmap_t *out);
int jas_cxform_optimize(jas_cmxform_t *xform, int optimize);
int jas_clrspc_numchans(int clrspc);
jas_cmprof_t *jas_cmprof_createfromiccprof(jas_iccprof_t *iccprof);
jas_cmprof_t *jas_cmprof_createfromclrspc(int clrspc);
jas_iccprof_t *jas_iccprof_createfromcmprof(jas_cmprof_t *prof);
#define jas_cmprof_clrspc(prof) ((prof)->clrspc)
jas_cmprof_t *jas_cmprof_copy(jas_cmprof_t *prof);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,190 @@
/* src/libjasper/include/jasper/jas_config.h. Generated by configure. */
/* src/libjasper/include/jasper/jas_config.h.in. Generated from configure.ac by autoheader. */
/* Avoid problems due to multiple inclusion. */
#ifndef JAS_CONFIG_H
#define JAS_CONFIG_H
/* This preprocessor symbol identifies the version of JasPer. */
#define JAS_VERSION "1.701.0"
/* If configure is being used, this symbol will be defined automatically
at this point in the configuration header file. */
/* The preprocessor symbol JAS_WIN_MSVC_BUILD should not be defined
unless the JasPer software is being built under Microsoft Windows
using Microsoft Visual C. */
#ifndef JAS_WIN_MSVC_BUILD
/* A configure-based build is being used. */
/* Extra debugging support */
/* #undef DEBUG */
/* Debugging memory allocator */
/* #undef DEBUG_MEMALLOC */
/* Debugging overflow detection */
/* #undef DEBUG_OVERFLOW */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
/* #undef HAVE_DOPRNT */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <io.h> header file. */
/* #undef HAVE_IO_H */
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdbool.h> header file. */
#define HAVE_STDBOOL_H 1
/* Define to 1 if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Have variable length arrays */
#define HAVE_VLA 1
/* Define to 1 if you have the `vprintf' function. */
#define HAVE_VPRINTF 1
/* Define to 1 if you have the <windows.h> header file. */
/* #undef HAVE_WINDOWS_H */
/* JasPer configure */
#define JAS_CONFIGURE 1
/* JasPer version */
#define JAS_VERSION "1.701.0"
/* Name of package */
#define PACKAGE "jasper"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "jasper"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "jasper 1.701.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "jasper"
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.701.0"
/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of a `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* The size of a `long long', as computed by sizeof. */
#define SIZEOF_LONG_LONG 8
/* The size of a `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of a `unsigned int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_INT 4
/* The size of a `unsigned long', as computed by sizeof. */
#define SIZEOF_UNSIGNED_LONG 4
/* The size of a `unsigned long long', as computed by sizeof. */
#define SIZEOF_UNSIGNED_LONG_LONG 8
/* The size of a `unsigned short', as computed by sizeof. */
#define SIZEOF_UNSIGNED_SHORT 2
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "1.701.0"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
if it is not supported. */
/* #undef inline */
/* Define to `long long' if <sys/types.h> does not define. */
#define longlong long long
/* Define to `unsigned' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef ssize_t */
/* Define to `unsigned char' if <sys/types.h> does not define. */
#define uchar unsigned char
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef uint */
/* Define to `unsigned long' if <sys/types.h> does not define. */
/* #undef ulong */
/* Define to `unsigned long long' if <sys/types.h> does not define. */
#define ulonglong unsigned long long
/* Define to `unsigned short' if <sys/types.h> does not define. */
/* #undef ushort */
#else
/* A configure-based build is not being used. */
#include <jasper/jas_config2.h>
#endif
#endif

View File

@@ -0,0 +1,89 @@
/*
* Copyright (c) 2002-2003 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
#ifndef JAS_CONFIG2_H
#define JAS_CONFIG2_H
/*
* Configuration for Microsoft Windows and Microsoft Visual C.
*
* We are not using a configure-based build.
* Try to compensate for this here, by specifying the preprocessor symbols
* normally defined by configure.
*/
#define uchar unsigned char
#define ushort unsigned short
#define uint unsigned int
#define ulong unsigned long
#define longlong long long
#define ulonglong unsigned long long
/*#define ssize_t int*/
#define HAVE_FCNTL_H 1
#define HAVE_LIMITS_H 1
#define HAVE_IO_H 1
#define HAVE_WINDOWS_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STDDEF_H 1
#endif

View File

@@ -0,0 +1,114 @@
/*
* Copyright (c) 2001-2002 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* Debugging-Related Code
*
* $Id: jas_debug.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_DEBUG_H
#define JAS_DEBUG_H
/******************************************************************************\
* Includes.
\******************************************************************************/
#include <stdio.h>
#include <jasper/jas_config.h>
#include "jasper/jas_types.h"
#include "jasper/jas_debug.h"
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
* Macros and functions.
\******************************************************************************/
/* Output debugging information to standard error provided that the debug
level is set sufficiently high. */
#if defined(DEBUG)
#define JAS_DBGLOG(n, x) \
((jas_getdbglevel() >= (n)) ? (jas_eprintf x) : 0)
#else
#define JAS_DBGLOG(n, x)
#endif
/* Get the library debug level. */
int jas_getdbglevel(void);
/* Set the library debug level. */
int jas_setdbglevel(int dbglevel);
/* Perform formatted output to standard error. */
int jas_eprintf(const char *fmt, ...);
/* Dump memory to a stream. */
int jas_memdump(FILE *out, void *data, size_t len);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,358 @@
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2002 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* Fixed-Point Number Class
*
* $Id: jas_fix.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_FIX_H
#define JAS_FIX_H
/******************************************************************************\
* Includes.
\******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <jasper/jas_config.h>
#include <jasper/jas_types.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
* Constants.
\******************************************************************************/
/* The representation of the value zero. */
#define JAS_FIX_ZERO(fix_t, fracbits) \
JAS_CAST(fix_t, 0)
/* The representation of the value one. */
#define JAS_FIX_ONE(fix_t, fracbits) \
(JAS_CAST(fix_t, 1) << (fracbits))
/* The representation of the value one half. */
#define JAS_FIX_HALF(fix_t, fracbits) \
(JAS_CAST(fix_t, 1) << ((fracbits) - 1))
/******************************************************************************\
* Conversion operations.
\******************************************************************************/
/* Convert an int to a fixed-point number. */
#define JAS_INTTOFIX(fix_t, fracbits, x) \
JAS_CAST(fix_t, (x) << (fracbits))
/* Convert a fixed-point number to an int. */
#define JAS_FIXTOINT(fix_t, fracbits, x) \
JAS_CAST(int, (x) >> (fracbits))
/* Convert a fixed-point number to a double. */
#define JAS_FIXTODBL(fix_t, fracbits, x) \
(JAS_CAST(double, x) / (JAS_CAST(fix_t, 1) << (fracbits)))
/* Convert a double to a fixed-point number. */
#define JAS_DBLTOFIX(fix_t, fracbits, x) \
JAS_CAST(fix_t, ((x) * JAS_CAST(double, JAS_CAST(fix_t, 1) << (fracbits))))
/******************************************************************************\
* Basic arithmetic operations.
* All other arithmetic operations are synthesized from these basic operations.
* There are three macros for each type of arithmetic operation.
* One macro always performs overflow/underflow checking, one never performs
* overflow/underflow checking, and one is generic with its behavior
* depending on compile-time flags.
* Only the generic macros should be invoked directly by application code.
\******************************************************************************/
/* Calculate the sum of two fixed-point numbers. */
#if !defined(DEBUG_OVERFLOW)
#define JAS_FIX_ADD JAS_FIX_ADD_FAST
#else
#define JAS_FIX_ADD JAS_FIX_ADD_OFLOW
#endif
/* Calculate the sum of two fixed-point numbers without overflow checking. */
#define JAS_FIX_ADD_FAST(fix_t, fracbits, x, y) ((x) + (y))
/* Calculate the sum of two fixed-point numbers with overflow checking. */
#define JAS_FIX_ADD_OFLOW(fix_t, fracbits, x, y) \
((x) >= 0) ? \
(((y) >= 0) ? ((x) + (y) >= 0 || JAS_FIX_OFLOW(), (x) + (y)) : \
((x) + (y))) : \
(((y) >= 0) ? ((x) + (y)) : ((x) + (y) < 0 || JAS_FIX_OFLOW(), \
(x) + (y)))
/* Calculate the product of two fixed-point numbers. */
#if !defined(DEBUG_OVERFLOW)
#define JAS_FIX_MUL JAS_FIX_MUL_FAST
#else
#define JAS_FIX_MUL JAS_FIX_MUL_OFLOW
#endif
/* Calculate the product of two fixed-point numbers without overflow
checking. */
#define JAS_FIX_MUL_FAST(fix_t, fracbits, bigfix_t, x, y) \
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y)) >> \
(fracbits))
/* Calculate the product of two fixed-point numbers with overflow
checking. */
#define JAS_FIX_MUL_OFLOW(fix_t, fracbits, bigfix_t, x, y) \
((JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> (fracbits)) == \
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> \
(fracbits))) ? \
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> \
(fracbits))) : JAS_FIX_OFLOW())
/* Calculate the product of a fixed-point number and an int. */
#if !defined(DEBUG_OVERFLOW)
#define JAS_FIX_MULBYINT JAS_FIX_MULBYINT_FAST
#else
#define JAS_FIX_MULBYINT JAS_FIX_MULBYINT_OFLOW
#endif
/* Calculate the product of a fixed-point number and an int without overflow
checking. */
#define JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y) \
JAS_CAST(fix_t, ((x) * (y)))
/* Calculate the product of a fixed-point number and an int with overflow
checking. */
#define JAS_FIX_MULBYINT_OFLOW(fix_t, fracbits, x, y) \
JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y)
/* Calculate the quotient of two fixed-point numbers. */
#if !defined(DEBUG_OVERFLOW)
#define JAS_FIX_DIV JAS_FIX_DIV_FAST
#else
#define JAS_FIX_DIV JAS_FIX_DIV_UFLOW
#endif
/* Calculate the quotient of two fixed-point numbers without underflow
checking. */
#define JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y) \
JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) << (fracbits)) / (y))
/* Calculate the quotient of two fixed-point numbers with underflow
checking. */
#define JAS_FIX_DIV_UFLOW(fix_t, fracbits, bigfix_t, x, y) \
JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y)
/* Negate a fixed-point number. */
#if !defined(DEBUG_OVERFLOW)
#define JAS_FIX_NEG JAS_FIX_NEG_FAST
#else
#define JAS_FIX_NEG JAS_FIX_NEG_OFLOW
#endif
/* Negate a fixed-point number without overflow checking. */
#define JAS_FIX_NEG_FAST(fix_t, fracbits, x) \
(-(x))
/* Negate a fixed-point number with overflow checking. */
/* Yes, overflow is actually possible for two's complement representations,
although highly unlikely to occur. */
#define JAS_FIX_NEG_OFLOW(fix_t, fracbits, x) \
(((x) < 0) ? (-(x) > 0 || JAS_FIX_OFLOW(), -(x)) : (-(x)))
/* Perform an arithmetic shift left of a fixed-point number. */
#if !defined(DEBUG_OVERFLOW)
#define JAS_FIX_ASL JAS_FIX_ASL_FAST
#else
#define JAS_FIX_ASL JAS_FIX_ASL_OFLOW
#endif
/* Perform an arithmetic shift left of a fixed-point number without overflow
checking. */
#define JAS_FIX_ASL_FAST(fix_t, fracbits, x, n) \
((x) << (n))
/* Perform an arithmetic shift left of a fixed-point number with overflow
checking. */
#define JAS_FIX_ASL_OFLOW(fix_t, fracbits, x, n) \
((((x) << (n)) >> (n)) == (x) || JAS_FIX_OFLOW(), (x) << (n))
/* Perform an arithmetic shift right of a fixed-point number. */
#if !defined(DEBUG_OVERFLOW)
#define JAS_FIX_ASR JAS_FIX_ASR_FAST
#else
#define JAS_FIX_ASR JAS_FIX_ASR_UFLOW
#endif
/* Perform an arithmetic shift right of a fixed-point number without underflow
checking. */
#define JAS_FIX_ASR_FAST(fix_t, fracbits, x, n) \
((x) >> (n))
/* Perform an arithmetic shift right of a fixed-point number with underflow
checking. */
#define JAS_FIX_ASR_UFLOW(fix_t, fracbits, x, n) \
JAS_FIX_ASR_FAST(fix_t, fracbits, x, n)
/******************************************************************************\
* Other basic arithmetic operations.
\******************************************************************************/
/* Calculate the difference between two fixed-point numbers. */
#define JAS_FIX_SUB(fix_t, fracbits, x, y) \
JAS_FIX_ADD(fix_t, fracbits, x, JAS_FIX_NEG(fix_t, fracbits, y))
/* Add one fixed-point number to another. */
#define JAS_FIX_PLUSEQ(fix_t, fracbits, x, y) \
((x) = JAS_FIX_ADD(fix_t, fracbits, x, y))
/* Subtract one fixed-point number from another. */
#define JAS_FIX_MINUSEQ(fix_t, fracbits, x, y) \
((x) = JAS_FIX_SUB(fix_t, fracbits, x, y))
/* Multiply one fixed-point number by another. */
#define JAS_FIX_MULEQ(fix_t, fracbits, bigfix_t, x, y) \
((x) = JAS_FIX_MUL(fix_t, fracbits, bigfix_t, x, y))
/******************************************************************************\
* Miscellaneous operations.
\******************************************************************************/
/* Calculate the absolute value of a fixed-point number. */
#define JAS_FIX_ABS(fix_t, fracbits, x) \
(((x) >= 0) ? (x) : (JAS_FIX_NEG(fix_t, fracbits, x)))
/* Is a fixed-point number an integer? */
#define JAS_FIX_ISINT(fix_t, fracbits, x) \
(JAS_FIX_FLOOR(fix_t, fracbits, x) == (x))
/* Get the sign of a fixed-point number. */
#define JAS_FIX_SGN(fix_t, fracbits, x) \
((x) >= 0 ? 1 : (-1))
/******************************************************************************\
* Relational operations.
\******************************************************************************/
/* Compare two fixed-point numbers. */
#define JAS_FIX_CMP(fix_t, fracbits, x, y) \
((x) > (y) ? 1 : (((x) == (y)) ? 0 : (-1)))
/* Less than. */
#define JAS_FIX_LT(fix_t, fracbits, x, y) \
((x) < (y))
/* Less than or equal. */
#define JAS_FIX_LTE(fix_t, fracbits, x, y) \
((x) <= (y))
/* Greater than. */
#define JAS_FIX_GT(fix_t, fracbits, x, y) \
((x) > (y))
/* Greater than or equal. */
#define JAS_FIX_GTE(fix_t, fracbits, x, y) \
((x) >= (y))
/******************************************************************************\
* Rounding functions.
\******************************************************************************/
/* Round a fixed-point number to the nearest integer. */
#define JAS_FIX_ROUND(fix_t, fracbits, x) \
(((x) < 0) ? JAS_FIX_FLOOR(fix_t, fracbits, JAS_FIX_ADD(fix_t, fracbits, \
(x), JAS_FIX_HALF(fix_t, fracbits))) : \
JAS_FIX_NEG(fix_t, fracbits, JAS_FIX_FLOOR(fix_t, fracbits, \
JAS_FIX_ADD(fix_t, fracbits, (-(x)), JAS_FIX_HALF(fix_t, fracbits)))))
/* Round a fixed-point number to the nearest integer in the direction of
negative infinity (i.e., the floor function). */
#define JAS_FIX_FLOOR(fix_t, fracbits, x) \
((x) & (~((JAS_CAST(fix_t, 1) << (fracbits)) - 1)))
/* Round a fixed-point number to the nearest integer in the direction
of zero. */
#define JAS_FIX_TRUNC(fix_t, fracbits, x) \
(((x) >= 0) ? JAS_FIX_FLOOR(fix_t, fracbits, x) : \
JAS_FIX_CEIL(fix_t, fracbits, x))
/******************************************************************************\
* The below macros are for internal library use only. Do not invoke them
* directly in application code.
\******************************************************************************/
/* Handle overflow. */
#define JAS_FIX_OFLOW() \
fprintf(stderr, "overflow error: file %s, line %d\n", __FILE__, __LINE__)
/* Handle underflow. */
#define JAS_FIX_UFLOW() \
fprintf(stderr, "underflow error: file %s, line %d\n", __FILE__, __LINE__)
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,131 @@
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2002 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* Command Line Option Parsing Code
*
* $Id: jas_getopt.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_GETOPT_H
#define JAS_GETOPT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <jasper/jas_config.h>
/******************************************************************************\
* Constants.
\******************************************************************************/
#define JAS_GETOPT_EOF (-1)
#define JAS_GETOPT_ERR '?'
/* option flags. */
#define JAS_OPT_HASARG 0x01 /* option has argument */
/******************************************************************************\
* Types.
\******************************************************************************/
/* Command line option type. */
typedef struct {
int id;
/* The unique identifier for this option. */
char *name;
/* The name of this option. */
int flags;
/* option flags. */
} jas_opt_t;
/******************************************************************************\
* External data.
\******************************************************************************/
/* The current option index. */
extern int jas_optind;
/* The current option argument. */
extern char *jas_optarg;
/* The debug level. */
extern int jas_opterr;
/******************************************************************************\
* Prototypes.
\******************************************************************************/
/* Get the next option. */
int jas_getopt(int argc, char **argv, jas_opt_t *opts);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,407 @@
/*
* Copyright (c) 2002-2003 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
#ifndef JAS_ICC_H
#define JAS_ICC_H
#include <jasper/jas_config.h>
#include <jasper/jas_types.h>
#include <jasper/jas_stream.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Profile file signature. */
#define JAS_ICC_MAGIC 0x61637370
#define JAS_ICC_HDRLEN 128
/* Profile/device class signatures. */
#define JAS_ICC_CLAS_IN 0x73636e72 /* input device */
#define JAS_ICC_CLAS_DPY 0x6d6e7472 /* display device */
#define JAS_ICC_CLAS_OUT 0x70727472 /* output device */
#define JAS_ICC_CLAS_LNK 0x6c696e6b /* device link */
#define JAS_ICC_CLAS_CNV 0x73706163 /* color space conversion */
#define JAS_ICC_CLAS_ABS 0x61627374 /* abstract */
#define JAS_ICC_CLAS_NAM 0x6e6d636c /* named color */
/* Color space signatures. */
#define JAS_ICC_COLORSPC_XYZ 0x58595a20 /* XYZ */
#define JAS_ICC_COLORSPC_LAB 0x4c616220 /* LAB */
#define JAS_ICC_COLORSPC_LUV 0x4c757620 /* LUV */
#define JAS_ICC_COLORSPC_YCBCR 0x59436272 /* YCbCr */
#define JAS_ICC_COLORSPC_YXY 0x59787920 /* Yxy */
#define JAS_ICC_COLORSPC_RGB 0x52474220 /* RGB */
#define JAS_ICC_COLORSPC_GRAY 0x47524159 /* Gray */
#define JAS_ICC_COLORSPC_HSV 0x48535620 /* HSV */
#define JAS_ICC_COLORSPC_HLS 0x484c5320 /* HLS */
#define JAS_ICC_COLORSPC_CMYK 0x434d594b /* CMYK */
#define JAS_ICC_COLORSPC_CMY 0x434d5920 /* CMY */
#define JAS_ICC_COLORSPC_2 0x32434c52 /* 2 channel color */
#define JAS_ICC_COLORSPC_3 0x33434c52 /* 3 channel color */
#define JAS_ICC_COLORSPC_4 0x34434c52 /* 4 channel color */
#define JAS_ICC_COLORSPC_5 0x35434c52 /* 5 channel color */
#define JAS_ICC_COLORSPC_6 0x36434c52 /* 6 channel color */
#define JAS_ICC_COLORSPC_7 0x37434c52 /* 7 channel color */
#define JAS_ICC_COLORSPC_8 0x38434c52 /* 8 channel color */
#define JAS_ICC_COLORSPC_9 0x39434c52 /* 9 channel color */
#define JAS_ICC_COLORSPC_10 0x41434c52 /* 10 channel color */
#define JAS_ICC_COLORSPC_11 0x42434c52 /* 11 channel color */
#define JAS_ICC_COLORSPC_12 0x43434c52 /* 12 channel color */
#define JAS_ICC_COLORSPC_13 0x44434c52 /* 13 channel color */
#define JAS_ICC_COLORSPC_14 0x45434c52 /* 14 channel color */
#define JAS_ICC_COLORSPC_15 0x46434c52 /* 15 channel color */
/* Profile connection color space (PCS) signatures. */
#define JAS_ICC_REFCOLORSPC_XYZ 0x58595a20 /* CIE XYZ */
#define JAS_ICC_REFCOLORSPC_LAB 0x4c616220 /* CIE Lab */
/* Primary platform signatures. */
#define JAS_ICC_PLATFORM_APPL 0x4150504c /* Apple Computer */
#define JAS_ICC_PLATFORM_MSFT 0x4d534654 /* Microsoft */
#define JAS_ICC_PLATFORM_SGI 0x53474920 /* Silicon Graphics */
#define JAS_ICC_PLATFORM_SUNW 0x53554e57 /* Sun Microsystems */
#define JAS_ICC_PLATFORM_TGNT 0x54474e54 /* Taligent */
/* Profile flags. */
#define JAS_ICC_FLAGS_EMBED 0x01 /* embedded */
#define JAS_ICC_FLAGS_NOSEP 0x02 /* no separate use */
/* Attributes. */
#define JAS_ICC_ATTR_TRANS 0x01 /* transparent */
#define JAS_ICC_ATTR_MATTE 0x02 /* matte */
/* Rendering intents. */
#define JAS_ICC_INTENT_PER 0 /* perceptual */
#define JAS_ICC_INTENT_REL 1 /* relative colorimetric */
#define JAS_ICC_INTENT_SAT 2 /* saturation */
#define JAS_ICC_INTENT_ABS 3 /* absolute colorimetric */
/* Tag signatures. */
#define JAS_ICC_TAG_ATOB0 0x41324230 /* */
#define JAS_ICC_TAG_ATOB1 0x41324231 /* */
#define JAS_ICC_TAG_ATOB2 0x41324232 /* */
#define JAS_ICC_TAG_BLUMATCOL 0x6258595a /* */
#define JAS_ICC_TAG_BLUTRC 0x62545243 /* */
#define JAS_ICC_TAG_BTOA0 0x42324130 /* */
#define JAS_ICC_TAG_BTOA1 0x42324131 /* */
#define JAS_ICC_TAG_BTOA2 0x42324132 /* */
#define JAS_ICC_TAG_CALTIME 0x63616c74 /* */
#define JAS_ICC_TAG_CHARTARGET 0x74617267 /* */
#define JAS_ICC_TAG_CPYRT 0x63707274 /* */
#define JAS_ICC_TAG_CRDINFO 0x63726469 /* */
#define JAS_ICC_TAG_DEVMAKERDESC 0x646d6e64 /* */
#define JAS_ICC_TAG_DEVMODELDESC 0x646d6464 /* */
#define JAS_ICC_TAG_DEVSET 0x64657673 /* */
#define JAS_ICC_TAG_GAMUT 0x67616d74 /* */
#define JAS_ICC_TAG_GRYTRC 0x6b545243 /* */
#define JAS_ICC_TAG_GRNMATCOL 0x6758595a /* */
#define JAS_ICC_TAG_GRNTRC 0x67545243 /* */
#define JAS_ICC_TAG_LUM 0x6c756d69 /* */
#define JAS_ICC_TAG_MEASURE 0x6d656173 /* */
#define JAS_ICC_TAG_MEDIABLKPT 0x626b7074 /* */
#define JAS_ICC_TAG_MEDIAWHIPT 0x77747074 /* */
#define JAS_ICC_TAG_NAMCOLR 0x6e636f6c /* */
#define JAS_ICC_TAG_NAMCOLR2 0x6e636c32 /* */
#define JAS_ICC_TAG_OUTRESP 0x72657370 /* */
#define JAS_ICC_TAG_PREVIEW0 0x70726530 /* */
#define JAS_ICC_TAG_PREVIEW1 0x70726531 /* */
#define JAS_ICC_TAG_PREVIEW2 0x70726532 /* */
#define JAS_ICC_TAG_PROFDESC 0x64657363 /* */
#define JAS_ICC_TAG_PROFSEQDESC 0x70736571 /* */
#define JAS_ICC_TAG_PSDCRD0 0x70736430 /* */
#define JAS_ICC_TAG_PSCRDD1 0x70736431 /* */
#define JAS_ICC_TAG_PSCRDD2 0x70736432 /* */
#define JAS_ICC_TAG_PSCRDD3 0x70736433 /* */
#define JAS_ICC_TAG_PS2CSA 0x70733273 /* */
#define JAS_ICC_TAG_PS2RENINTENT 0x70733269 /* */
#define JAS_ICC_TAG_REDMATCOL 0x7258595a /* */
#define JAS_ICC_TAG_REDTRC 0x72545243 /* */
#define JAS_ICC_TAG_SCRNGDES 0x73637264 /* */
#define JAS_ICC_TAG_SCRNG 0x7363726e /* */
#define JAS_ICC_TAG_TECH 0x74656368 /* */
#define JAS_ICC_TAG_UCRBG 0x62666420 /* */
#define JAS_ICC_TAG_VIEWCONDDESC 0x76756564 /* */
#define JAS_ICC_TAG_VIEWCOND 0x76696577 /* */
/* Type signatures. */
#define JAS_ICC_TYPE_CRDINFO 0x63726469 /* CRD information */
#define JAS_ICC_TYPE_CURV 0x63757276 /* curve */
#define JAS_ICC_TYPE_DATA 0x64617461 /* data */
#define JAS_ICC_TYPE_TIME 0x6474696d /* date/time */
#define JAS_ICC_TYPE_DEVSET 0x64657673 /* device settings */
#define JAS_ICC_TYPE_LUT16 0x6d667432 /* */
#define JAS_ICC_TYPE_LUT8 0x6d667431 /* */
#define JAS_ICC_TYPE_MEASURE 0x6d656173 /* */
#define JAS_ICC_TYPE_NAMCOLR 0x6e636f6c /* */
#define JAS_ICC_TYPE_NAMCOLR2 0x6e636c32 /* */
#define JAS_ICC_TYPE_PROFSEQDESC 0x70736571 /* profile sequence description */
#define JAS_ICC_TYPE_RESPCURVSET16 0x72637332 /* response curve set 16 */
#define JAS_ICC_TYPE_SF32 0x73663332 /* signed 32-bit fixed-point */
#define JAS_ICC_TYPE_SCRNG 0x7363726e /* screening */
#define JAS_ICC_TYPE_SIG 0x73696720 /* signature */
#define JAS_ICC_TYPE_TXTDESC 0x64657363 /* text description */
#define JAS_ICC_TYPE_TXT 0x74657874 /* text */
#define JAS_ICC_TYPE_UF32 0x75663332 /* unsigned 32-bit fixed-point */
#define JAS_ICC_TYPE_UCRBG 0x62666420 /* */
#define JAS_ICC_TYPE_UI16 0x75693136 /* */
#define JAS_ICC_TYPE_UI32 0x75693332 /* */
#define JAS_ICC_TYPE_UI8 0x75693038 /* */
#define JAS_ICC_TYPE_UI64 0x75693634 /* */
#define JAS_ICC_TYPE_VIEWCOND 0x76696577 /* */
#define JAS_ICC_TYPE_XYZ 0x58595a20 /* XYZ */
typedef uint_fast8_t jas_iccuint8_t;
typedef uint_fast16_t jas_iccuint16_t;
typedef uint_fast32_t jas_iccuint32_t;
typedef int_fast32_t jas_iccsint32_t;
typedef int_fast32_t jas_iccs15fixed16_t;
typedef uint_fast32_t jas_iccu16fixed16_t;
typedef uint_fast64_t jas_iccuint64_t;
typedef uint_fast32_t jas_iccsig_t;
typedef jas_iccsig_t jas_icctagsig_t;
typedef jas_iccsig_t jas_icctagtype_t;
typedef jas_iccsig_t jas_iccattrname_t;
/* Date/time type. */
typedef struct {
jas_iccuint16_t year;
jas_iccuint16_t month;
jas_iccuint16_t day;
jas_iccuint16_t hour;
jas_iccuint16_t min;
jas_iccuint16_t sec;
} jas_icctime_t;
/* XYZ type. */
typedef struct {
jas_iccs15fixed16_t x;
jas_iccs15fixed16_t y;
jas_iccs15fixed16_t z;
} jas_iccxyz_t;
/* Curve type. */
typedef struct {
jas_iccuint32_t numents;
jas_iccuint16_t *ents;
} jas_icccurv_t;
/* Text description type. */
typedef struct {
jas_iccuint32_t asclen;
char *ascdata; /* ASCII invariant description */
jas_iccuint32_t uclangcode; /* Unicode language code */
jas_iccuint32_t uclen; /* Unicode localizable description count */
uchar *ucdata; /* Unicode localizable description */
jas_iccuint16_t sccode; /* ScriptCode code */
jas_iccuint8_t maclen; /* Localizable Macintosh description count */
uchar macdata[69]; /* Localizable Macintosh description */
} jas_icctxtdesc_t;
/* Text type. */
typedef struct {
char *string; /* ASCII character string */
} jas_icctxt_t;
typedef struct {
jas_iccuint8_t numinchans;
jas_iccuint8_t numoutchans;
jas_iccsint32_t e[3][3];
jas_iccuint8_t clutlen;
jas_iccuint8_t *clut;
jas_iccuint16_t numintabents;
jas_iccuint8_t **intabs;
jas_iccuint8_t *intabsbuf;
jas_iccuint16_t numouttabents;
jas_iccuint8_t **outtabs;
jas_iccuint8_t *outtabsbuf;
} jas_icclut8_t;
typedef struct {
jas_iccuint8_t numinchans;
jas_iccuint8_t numoutchans;
jas_iccsint32_t e[3][3];
jas_iccuint8_t clutlen;
jas_iccuint16_t *clut;
jas_iccuint16_t numintabents;
jas_iccuint16_t **intabs;
jas_iccuint16_t *intabsbuf;
jas_iccuint16_t numouttabents;
jas_iccuint16_t **outtabs;
jas_iccuint16_t *outtabsbuf;
} jas_icclut16_t;
struct jas_iccattrval_s;
typedef struct {
void (*destroy)(struct jas_iccattrval_s *);
int (*copy)(struct jas_iccattrval_s *, struct jas_iccattrval_s *);
int (*input)(struct jas_iccattrval_s *, jas_stream_t *, int);
int (*output)(struct jas_iccattrval_s *, jas_stream_t *);
int (*getsize)(struct jas_iccattrval_s *);
void (*dump)(struct jas_iccattrval_s *, FILE *);
} jas_iccattrvalops_t;
/* Attribute value type (type and value information). */
typedef struct jas_iccattrval_s {
int refcnt; /* reference count */
jas_iccsig_t type; /* type */
jas_iccattrvalops_t *ops; /* type-dependent operations */
union {
jas_iccxyz_t xyz;
jas_icccurv_t curv;
jas_icctxtdesc_t txtdesc;
jas_icctxt_t txt;
jas_icclut8_t lut8;
jas_icclut16_t lut16;
} data; /* value */
} jas_iccattrval_t;
/* Header type. */
typedef struct {
jas_iccuint32_t size; /* profile size */
jas_iccsig_t cmmtype; /* CMM type signature */
jas_iccuint32_t version; /* profile version */
jas_iccsig_t clas; /* profile/device class signature */
jas_iccsig_t colorspc; /* color space of data */
jas_iccsig_t refcolorspc; /* profile connection space */
jas_icctime_t ctime; /* creation time */
jas_iccsig_t magic; /* profile file signature */
jas_iccsig_t platform; /* primary platform */
jas_iccuint32_t flags; /* profile flags */
jas_iccsig_t maker; /* device manufacturer signature */
jas_iccsig_t model; /* device model signature */
jas_iccuint64_t attr; /* device setup attributes */
jas_iccsig_t intent; /* rendering intent */
jas_iccxyz_t illum; /* illuminant */
jas_iccsig_t creator; /* profile creator signature */
} jas_icchdr_t;
typedef struct {
jas_iccsig_t name;
jas_iccattrval_t *val;
} jas_iccattr_t;
typedef struct {
int numattrs;
int maxattrs;
jas_iccattr_t *attrs;
} jas_iccattrtab_t;
typedef struct jas_icctagtabent_s {
jas_iccuint32_t tag;
jas_iccuint32_t off;
jas_iccuint32_t len;
void *data;
struct jas_icctagtabent_s *first;
} jas_icctagtabent_t;
typedef struct {
jas_iccuint32_t numents;
jas_icctagtabent_t *ents;
} jas_icctagtab_t;
/* ICC profile type. */
typedef struct {
jas_icchdr_t hdr;
jas_icctagtab_t tagtab;
jas_iccattrtab_t *attrtab;
} jas_iccprof_t;
typedef struct {
jas_iccuint32_t type;
jas_iccattrvalops_t ops;
} jas_iccattrvalinfo_t;
jas_iccprof_t *jas_iccprof_load(jas_stream_t *in);
int jas_iccprof_save(jas_iccprof_t *prof, jas_stream_t *out);
void jas_iccprof_destroy(jas_iccprof_t *prof);
jas_iccattrval_t *jas_iccprof_getattr(jas_iccprof_t *prof,
jas_iccattrname_t name);
int jas_iccprof_setattr(jas_iccprof_t *prof, jas_iccattrname_t name,
jas_iccattrval_t *val);
void jas_iccprof_dump(jas_iccprof_t *prof, FILE *out);
jas_iccprof_t *jas_iccprof_copy(jas_iccprof_t *prof);
int jas_iccprof_gethdr(jas_iccprof_t *prof, jas_icchdr_t *hdr);
int jas_iccprof_sethdr(jas_iccprof_t *prof, jas_icchdr_t *hdr);
void jas_iccattrval_destroy(jas_iccattrval_t *attrval);
void jas_iccattrval_dump(jas_iccattrval_t *attrval, FILE *out);
int jas_iccattrval_allowmodify(jas_iccattrval_t **attrval);
jas_iccattrval_t *jas_iccattrval_clone(jas_iccattrval_t *attrval);
jas_iccattrval_t *jas_iccattrval_create(jas_iccuint32_t type);
void jas_iccattrtab_dump(jas_iccattrtab_t *attrtab, FILE *out);
extern uchar jas_iccprofdata_srgb[];
extern int jas_iccprofdata_srgblen;
extern uchar jas_iccprofdata_sgray[];
extern int jas_iccprofdata_sgraylen;
jas_iccprof_t *jas_iccprof_createfrombuf(uchar *buf, int len);
jas_iccprof_t *jas_iccprof_createfromclrspc(int clrspc);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,564 @@
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2003 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* Image Class
*
* $Id: jas_image.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_IMAGE_H
#define JAS_IMAGE_H
/******************************************************************************\
* Includes.
\******************************************************************************/
#include <jasper/jas_config.h>
#include <jasper/jas_stream.h>
#include <jasper/jas_seq.h>
#include <jasper/jas_cm.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
* Constants.
\******************************************************************************/
/*
* Miscellaneous constants.
*/
/* The threshold at which image data is no longer stored in memory. */
#define JAS_IMAGE_INMEMTHRESH (16 * 1024 * 1024)
/*
* Component types
*/
#define JAS_IMAGE_CT_UNKNOWN 0x10000
#define JAS_IMAGE_CT_COLOR(n) ((n) & 0x7fff)
#define JAS_IMAGE_CT_OPACITY 0x08000
#define JAS_IMAGE_CT_RGB_R 0
#define JAS_IMAGE_CT_RGB_G 1
#define JAS_IMAGE_CT_RGB_B 2
#define JAS_IMAGE_CT_YCBCR_Y 0
#define JAS_IMAGE_CT_YCBCR_CB 1
#define JAS_IMAGE_CT_YCBCR_CR 2
#define JAS_IMAGE_CT_GRAY_Y 0
/******************************************************************************\
* Simple types.
\******************************************************************************/
/* Image coordinate. */
typedef int_fast32_t jas_image_coord_t;
/* Color space (e.g., RGB, YCbCr). */
typedef int_fast16_t jas_image_colorspc_t;
/* Component type (e.g., color, opacity). */
typedef int_fast32_t jas_image_cmpttype_t;
/* Component sample data format (e.g., real/integer, signedness, precision). */
typedef int_fast16_t jas_image_smpltype_t;
/******************************************************************************\
* Image class and supporting classes.
\******************************************************************************/
/* Image component class. */
typedef struct {
jas_image_coord_t tlx_;
/* The x-coordinate of the top-left corner of the component. */
jas_image_coord_t tly_;
/* The y-coordinate of the top-left corner of the component. */
jas_image_coord_t hstep_;
/* The horizontal sampling period in units of the reference grid. */
jas_image_coord_t vstep_;
/* The vertical sampling period in units of the reference grid. */
jas_image_coord_t width_;
/* The component width in samples. */
jas_image_coord_t height_;
/* The component height in samples. */
#ifdef FIX_ME
int smpltype_;
#else
int prec_;
/* The precision of the sample data (i.e., the number of bits per
sample). If the samples are signed values, this quantity
includes the sign bit. */
int sgnd_;
/* The signedness of the sample data. */
#endif
jas_stream_t *stream_;
/* The stream containing the component data. */
int cps_;
/* The number of characters per sample in the stream. */
jas_image_cmpttype_t type_;
/* The type of component (e.g., opacity, red, green, blue, luma). */
} jas_image_cmpt_t;
/* Image class. */
typedef struct {
jas_image_coord_t tlx_;
/* The x-coordinate of the top-left corner of the image bounding box. */
jas_image_coord_t tly_;
/* The y-coordinate of the top-left corner of the image bounding box. */
jas_image_coord_t brx_;
/* The x-coordinate of the bottom-right corner of the image bounding
box (plus one). */
jas_image_coord_t bry_;
/* The y-coordinate of the bottom-right corner of the image bounding
box (plus one). */
int numcmpts_;
/* The number of components. */
int maxcmpts_;
/* The maximum number of components that this image can have (i.e., the
allocated size of the components array). */
jas_image_cmpt_t **cmpts_;
/* Per-component information. */
jas_clrspc_t clrspc_;
jas_cmprof_t *cmprof_;
bool inmem_;
} jas_image_t;
/* Component parameters class. */
/* This data type exists solely/mainly for the purposes of the
jas_image_create function. */
typedef struct {
jas_image_coord_t tlx;
/* The x-coordinate of the top-left corner of the component. */
jas_image_coord_t tly;
/* The y-coordinate of the top-left corner of the component. */
jas_image_coord_t hstep;
/* The horizontal sampling period in units of the reference grid. */
jas_image_coord_t vstep;
/* The vertical sampling period in units of the reference grid. */
jas_image_coord_t width;
/* The width of the component in samples. */
jas_image_coord_t height;
/* The height of the component in samples. */
#ifdef FIX_ME
int smpltype;
#else
int prec;
/* The precision of the component sample data. */
int sgnd;
/* The signedness of the component sample data. */
#endif
} jas_image_cmptparm_t;
/******************************************************************************\
* File format related classes.
\******************************************************************************/
#define JAS_IMAGE_MAXFMTS 32
/* The maximum number of image data formats supported. */
/* Image format-dependent operations. */
typedef struct {
jas_image_t *(*decode)(jas_stream_t *in, char *opts);
/* Decode image data from a stream. */
int (*encode)(jas_image_t *image, jas_stream_t *out, char *opts);
/* Encode image data to a stream. */
int (*validate)(jas_stream_t *in);
/* Determine if stream data is in a particular format. */
} jas_image_fmtops_t;
/* Image format information. */
typedef struct {
int id;
/* The ID for this format. */
char *name;
/* The name by which this format is identified. */
char *ext;
/* The file name extension associated with this format. */
char *desc;
/* A brief description of the format. */
jas_image_fmtops_t ops;
/* The operations for this format. */
} jas_image_fmtinfo_t;
/******************************************************************************\
* Image operations.
\******************************************************************************/
/* Create an image. */
jas_image_t *jas_image_create(int numcmpts,
jas_image_cmptparm_t *cmptparms, jas_clrspc_t clrspc);
/* Create an "empty" image. */
jas_image_t *jas_image_create0(void);
/* Clone an image. */
jas_image_t *jas_image_copy(jas_image_t *image);
/* Deallocate any resources associated with an image. */
void jas_image_destroy(jas_image_t *image);
/* Get the width of the image in units of the image reference grid. */
#define jas_image_width(image) \
((image)->brx_ - (image)->tlx_)
/* Get the height of the image in units of the image reference grid. */
#define jas_image_height(image) \
((image)->bry_ - (image)->tly_)
/* Get the x-coordinate of the top-left corner of the image bounding box
on the reference grid. */
#define jas_image_tlx(image) \
((image)->tlx_)
/* Get the y-coordinate of the top-left corner of the image bounding box
on the reference grid. */
#define jas_image_tly(image) \
((image)->tly_)
/* Get the x-coordinate of the bottom-right corner of the image bounding box
on the reference grid (plus one). */
#define jas_image_brx(image) \
((image)->brx_)
/* Get the y-coordinate of the bottom-right corner of the image bounding box
on the reference grid (plus one). */
#define jas_image_bry(image) \
((image)->bry_)
/* Get the number of image components. */
#define jas_image_numcmpts(image) \
((image)->numcmpts_)
/* Get the color model used by the image. */
#define jas_image_clrspc(image) \
((image)->clrspc_)
/* Set the color model for an image. */
#define jas_image_setclrspc(image, clrspc) \
((image)->clrspc_ = (clrspc))
#define jas_image_cmpttype(image, cmptno) \
((image)->cmpts_[(cmptno)]->type_)
#define jas_image_setcmpttype(image, cmptno, type) \
((image)->cmpts_[(cmptno)]->type_ = (type))
/* Get the width of a component. */
#define jas_image_cmptwidth(image, cmptno) \
((image)->cmpts_[cmptno]->width_)
/* Get the height of a component. */
#define jas_image_cmptheight(image, cmptno) \
((image)->cmpts_[cmptno]->height_)
/* Get the signedness of the sample data for a component. */
#define jas_image_cmptsgnd(image, cmptno) \
((image)->cmpts_[cmptno]->sgnd_)
/* Get the precision of the sample data for a component. */
#define jas_image_cmptprec(image, cmptno) \
((image)->cmpts_[cmptno]->prec_)
/* Get the horizontal subsampling factor for a component. */
#define jas_image_cmpthstep(image, cmptno) \
((image)->cmpts_[cmptno]->hstep_)
/* Get the vertical subsampling factor for a component. */
#define jas_image_cmptvstep(image, cmptno) \
((image)->cmpts_[cmptno]->vstep_)
/* Get the x-coordinate of the top-left corner of a component. */
#define jas_image_cmpttlx(image, cmptno) \
((image)->cmpts_[cmptno]->tlx_)
/* Get the y-coordinate of the top-left corner of a component. */
#define jas_image_cmpttly(image, cmptno) \
((image)->cmpts_[cmptno]->tly_)
/* Get the x-coordinate of the bottom-right corner of a component
(plus "one"). */
#define jas_image_cmptbrx(image, cmptno) \
((image)->cmpts_[cmptno]->tlx_ + (image)->cmpts_[cmptno]->width_ * \
(image)->cmpts_[cmptno]->hstep_)
/* Get the y-coordinate of the bottom-right corner of a component
(plus "one"). */
#define jas_image_cmptbry(image, cmptno) \
((image)->cmpts_[cmptno]->tly_ + (image)->cmpts_[cmptno]->height_ * \
(image)->cmpts_[cmptno]->vstep_)
/* Get the raw size of an image (i.e., the nominal size of the image without
any compression. */
uint_fast32_t jas_image_rawsize(jas_image_t *image);
/* Create an image from a stream in some specified format. */
jas_image_t *jas_image_decode(jas_stream_t *in, int fmt, char *optstr);
/* Write an image to a stream in a specified format. */
int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt,
char *optstr);
/* Read a rectangular region of an image component. */
/* The position and size of the rectangular region to be read is specified
relative to the component's coordinate system. */
int jas_image_readcmpt(jas_image_t *image, int cmptno,
jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
jas_matrix_t *data);
/* Write a rectangular region of an image component. */
int jas_image_writecmpt(jas_image_t *image, int cmptno,
jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
jas_matrix_t *data);
/* Delete a component from an image. */
void jas_image_delcmpt(jas_image_t *image, int cmptno);
/* Add a component to an image. */
int jas_image_addcmpt(jas_image_t *image, int cmptno,
jas_image_cmptparm_t *cmptparm);
/* Copy a component from one image to another. */
int jas_image_copycmpt(jas_image_t *dstimage, int dstcmptno,
jas_image_t *srcimage, int srccmptno);
#define JAS_IMAGE_CDT_GETSGND(dtype) (((dtype) >> 7) & 1)
#define JAS_IMAGE_CDT_SETSGND(dtype) (((dtype) & 1) << 7)
#define JAS_IMAGE_CDT_GETPREC(dtype) ((dtype) & 0x7f)
#define JAS_IMAGE_CDT_SETPREC(dtype) ((dtype) & 0x7f)
#define jas_image_cmptdtype(image, cmptno) \
(JAS_IMAGE_CDT_SETSGND((image)->cmpts_[cmptno]->sgnd_) | JAS_IMAGE_CDT_SETPREC((image)->cmpts_[cmptno]->prec_))
int jas_image_depalettize(jas_image_t *image, int cmptno, int numlutents,
int_fast32_t *lutents, int dtype, int newcmptno);
int jas_image_readcmptsample(jas_image_t *image, int cmptno, int x, int y);
void jas_image_writecmptsample(jas_image_t *image, int cmptno, int x, int y,
int_fast32_t v);
int jas_image_getcmptbytype(jas_image_t *image, int ctype);
/******************************************************************************\
* Image format-related operations.
\******************************************************************************/
/* Clear the table of image formats. */
void jas_image_clearfmts(void);
/* Add entry to table of image formats. */
int jas_image_addfmt(int id, char *name, char *ext, char *desc,
jas_image_fmtops_t *ops);
/* Get the ID for the image format with the specified name. */
int jas_image_strtofmt(char *s);
/* Get the name of the image format with the specified ID. */
char *jas_image_fmttostr(int fmt);
/* Lookup image format information by the format ID. */
jas_image_fmtinfo_t *jas_image_lookupfmtbyid(int id);
/* Lookup image format information by the format name. */
jas_image_fmtinfo_t *jas_image_lookupfmtbyname(const char *name);
/* Guess the format of an image file based on its name. */
int jas_image_fmtfromname(char *filename);
/* Get the format of image data in a stream. */
int jas_image_getfmt(jas_stream_t *in);
#define jas_image_cmprof(image) ((image)->cmprof_)
int jas_image_ishomosamp(jas_image_t *image);
int jas_image_sampcmpt(jas_image_t *image, int cmptno, int newcmptno,
jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs,
jas_image_coord_t vs, int sgnd, int prec);
int jas_image_writecmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x,
jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
long *buf);
int jas_image_readcmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x,
jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
long *buf);
#define jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof)
jas_image_t *jas_image_chclrspc(jas_image_t *image, jas_cmprof_t *outprof,
int intent);
void jas_image_dump(jas_image_t *image, FILE *out);
/******************************************************************************\
* Image format-dependent operations.
\******************************************************************************/
#if !defined(EXCLUDE_JPG_SUPPORT)
/* Format-dependent operations for JPG support. */
jas_image_t *jpg_decode(jas_stream_t *in, char *optstr);
int jpg_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
int jpg_validate(jas_stream_t *in);
#endif
#if !defined(EXCLUDE_MIF_SUPPORT)
/* Format-dependent operations for MIF support. */
jas_image_t *mif_decode(jas_stream_t *in, char *optstr);
int mif_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
int mif_validate(jas_stream_t *in);
#endif
#if !defined(EXCLUDE_PNM_SUPPORT)
/* Format-dependent operations for PNM support. */
jas_image_t *pnm_decode(jas_stream_t *in, char *optstr);
int pnm_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
int pnm_validate(jas_stream_t *in);
#endif
#if !defined(EXCLUDE_RAS_SUPPORT)
/* Format-dependent operations for Sun Rasterfile support. */
jas_image_t *ras_decode(jas_stream_t *in, char *optstr);
int ras_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
int ras_validate(jas_stream_t *in);
#endif
#if !defined(EXCLUDE_BMP_SUPPORT)
/* Format-dependent operations for BMP support. */
jas_image_t *bmp_decode(jas_stream_t *in, char *optstr);
int bmp_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
int bmp_validate(jas_stream_t *in);
#endif
#if !defined(EXCLUDE_JP2_SUPPORT)
/* Format-dependent operations for JP2 support. */
jas_image_t *jp2_decode(jas_stream_t *in, char *optstr);
int jp2_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
int jp2_validate(jas_stream_t *in);
#endif
#if !defined(EXCLUDE_JPC_SUPPORT)
/* Format-dependent operations for JPEG-2000 code stream support. */
jas_image_t *jpc_decode(jas_stream_t *in, char *optstr);
int jpc_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
int jpc_validate(jas_stream_t *in);
#endif
#if !defined(EXCLUDE_PGX_SUPPORT)
/* Format-dependent operations for PGX support. */
jas_image_t *pgx_decode(jas_stream_t *in, char *optstr);
int pgx_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
int pgx_validate(jas_stream_t *in);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,83 @@
/*
* Copyright (c) 2001-2002 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
#ifndef JAS_INIT_H
#define JAS_INIT_H
#include <jasper/jas_config.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
* Functions.
\******************************************************************************/
int jas_init(void);
void jas_cleanup(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,124 @@
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2002 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* Memory Allocator
*
* $Id: jas_malloc.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_MALLOC_H
#define JAS_MALLOC_H
/******************************************************************************\
* Includes.
\******************************************************************************/
#include <jasper/jas_config.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
* Hack follows...
\******************************************************************************/
#if defined(DEBUG_MEMALLOC)
/* This is somewhat of a hack, but it's a useful hack. :-) */
/* Use my own custom memory allocator for debugging. */
#include "../../../../local/src/memalloc.h"
#define jas_malloc MEMALLOC
#define jas_free MEMFREE
#define jas_realloc MEMREALLOC
#define jas_calloc MEMCALLOC
#endif
/******************************************************************************\
* Functions.
\******************************************************************************/
#if !defined(DEBUG_MEMALLOC)
/* Allocate memory. */
void *jas_malloc(size_t size);
/* Free memory. */
void jas_free(void *ptr);
/* Resize a block of allocated memory. */
void *jas_realloc(void *ptr, size_t size);
/* Allocate a block of memory and initialize the contents to zero. */
void *jas_calloc(size_t nmemb, size_t size);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,117 @@
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2002 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* Math-Related Code
*
* $Id: jas_math.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_MATH_H
#define JAS_MATH_H
/******************************************************************************\
* Includes
\******************************************************************************/
#include <jasper/jas_config.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
* Macros
\******************************************************************************/
/* Compute the absolute value. */
#define JAS_ABS(x) \
(((x) >= 0) ? (x) : (-(x)))
/* Compute the minimum of two values. */
#define JAS_MIN(x, y) \
(((x) < (y)) ? (x) : (y))
/* Compute the maximum of two values. */
#define JAS_MAX(x, y) \
(((x) > (y)) ? (x) : (y))
/* Compute the remainder from division (where division is defined such
that the remainder is always nonnegative). */
#define JAS_MOD(x, y) \
(((x) < 0) ? (((-x) % (y)) ? ((y) - ((-(x)) % (y))) : (0)) : ((x) % (y)))
/* Compute the integer with the specified number of least significant bits
set to one. */
#define JAS_ONES(n) \
((1 << (n)) - 1)
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,299 @@
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2002 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* Sequence/Matrix Library
*
* $Id: jas_seq.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_SEQ_H
#define JAS_SEQ_H
/******************************************************************************\
* Includes.
\******************************************************************************/
#include <jasper/jas_config.h>
#include <jasper/jas_stream.h>
#include <jasper/jas_types.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
* Constants.
\******************************************************************************/
/* This matrix is a reference to another matrix. */
#define JAS_MATRIX_REF 0x0001
/******************************************************************************\
* Types.
\******************************************************************************/
/* An element in a sequence. */
typedef int_fast32_t jas_seqent_t;
/* An element in a matrix. */
typedef int_fast32_t jas_matent_t;
/* Matrix. */
typedef struct {
/* Additional state information. */
int flags_;
/* The starting horizontal index. */
int_fast32_t xstart_;
/* The starting vertical index. */
int_fast32_t ystart_;
/* The ending horizontal index. */
int_fast32_t xend_;
/* The ending vertical index. */
int_fast32_t yend_;
/* The number of rows in the matrix. */
int_fast32_t numrows_;
/* The number of columns in the matrix. */
int_fast32_t numcols_;
/* Pointers to the start of each row. */
jas_seqent_t **rows_;
/* The allocated size of the rows array. */
int_fast32_t maxrows_;
/* The matrix data buffer. */
jas_seqent_t *data_;
/* The allocated size of the data array. */
int_fast32_t datasize_;
} jas_matrix_t;
typedef jas_matrix_t jas_seq2d_t;
typedef jas_matrix_t jas_seq_t;
/******************************************************************************\
* Functions/macros for matrix class.
\******************************************************************************/
/* Get the number of rows. */
#define jas_matrix_numrows(matrix) \
((matrix)->numrows_)
/* Get the number of columns. */
#define jas_matrix_numcols(matrix) \
((matrix)->numcols_)
/* Get a matrix element. */
#define jas_matrix_get(matrix, i, j) \
((matrix)->rows_[i][j])
/* Set a matrix element. */
#define jas_matrix_set(matrix, i, j, v) \
((matrix)->rows_[i][j] = (v))
/* Get an element from a matrix that is known to be a row or column vector. */
#define jas_matrix_getv(matrix, i) \
(((matrix)->numrows_ == 1) ? ((matrix)->rows_[0][i]) : \
((matrix)->rows_[i][0]))
/* Set an element in a matrix that is known to be a row or column vector. */
#define jas_matrix_setv(matrix, i, v) \
(((matrix)->numrows_ == 1) ? ((matrix)->rows_[0][i] = (v)) : \
((matrix)->rows_[i][0] = (v)))
/* Get the address of an element in a matrix. */
#define jas_matrix_getref(matrix, i, j) \
(&(matrix)->rows_[i][j])
#define jas_matrix_getvref(matrix, i) \
(((matrix)->numrows_ > 1) ? jas_matrix_getref(matrix, i, 0) : jas_matrix_getref(matrix, 0, i))
#define jas_matrix_length(matrix) \
(max((matrix)->numrows_, (matrix)->numcols_))
/* Create a matrix with the specified dimensions. */
jas_matrix_t *jas_matrix_create(int numrows, int numcols);
/* Destroy a matrix. */
void jas_matrix_destroy(jas_matrix_t *matrix);
/* Resize a matrix. The previous contents of the matrix are lost. */
int jas_matrix_resize(jas_matrix_t *matrix, int numrows, int numcols);
int jas_matrix_output(jas_matrix_t *matrix, FILE *out);
/* Create a matrix that references part of another matrix. */
void jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, int r0, int c0,
int r1, int c1);
/* Create a matrix that is a reference to a row of another matrix. */
#define jas_matrix_bindrow(mat0, mat1, r) \
(jas_matrix_bindsub((mat0), (mat1), (r), 0, (r), (mat1)->numcols_ - 1))
/* Create a matrix that is a reference to a column of another matrix. */
#define jas_matrix_bindcol(mat0, mat1, c) \
(jas_matrix_bindsub((mat0), (mat1), 0, (c), (mat1)->numrows_ - 1, (c)))
/* Clip the values of matrix elements to the specified range. */
void jas_matrix_clip(jas_matrix_t *matrix, jas_seqent_t minval,
jas_seqent_t maxval);
/* Arithmetic shift left of all elements in a matrix. */
void jas_matrix_asl(jas_matrix_t *matrix, int n);
/* Arithmetic shift right of all elements in a matrix. */
void jas_matrix_asr(jas_matrix_t *matrix, int n);
/* Almost-but-not-quite arithmetic shift right of all elements in a matrix. */
void jas_matrix_divpow2(jas_matrix_t *matrix, int n);
/* Set all elements of a matrix to the specified value. */
void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val);
/* The spacing between rows of a matrix. */
#define jas_matrix_rowstep(matrix) \
(((matrix)->numrows_ > 1) ? ((matrix)->rows_[1] - (matrix)->rows_[0]) : (0))
/* The spacing between columns of a matrix. */
#define jas_matrix_step(matrix) \
(((matrix)->numrows_ > 1) ? (jas_matrix_rowstep(matrix)) : (1))
/* Compare two matrices for equality. */
int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1);
jas_matrix_t *jas_matrix_copy(jas_matrix_t *x);
/******************************************************************************\
* Functions/macros for 2-D sequence class.
\******************************************************************************/
jas_seq2d_t *jas_seq2d_copy(jas_seq2d_t *x);
jas_matrix_t *jas_seq2d_create(int xstart, int ystart, int xend, int yend);
#define jas_seq2d_destroy(s) \
jas_matrix_destroy(s)
#define jas_seq2d_xstart(s) \
((s)->xstart_)
#define jas_seq2d_ystart(s) \
((s)->ystart_)
#define jas_seq2d_xend(s) \
((s)->xend_)
#define jas_seq2d_yend(s) \
((s)->yend_)
#define jas_seq2d_getref(s, x, y) \
(jas_matrix_getref(s, (y) - (s)->ystart_, (x) - (s)->xstart_))
#define jas_seq2d_get(s, x, y) \
(jas_matrix_get(s, (y) - (s)->ystart_, (x) - (s)->xstart_))
#define jas_seq2d_rowstep(s) \
jas_matrix_rowstep(s)
#define jas_seq2d_width(s) \
((s)->xend_ - (s)->xstart_)
#define jas_seq2d_height(s) \
((s)->yend_ - (s)->ystart_)
#define jas_seq2d_setshift(s, x, y) \
((s)->xstart_ = (x), (s)->ystart_ = (y), \
(s)->xend_ = (s)->xstart_ + (s)->numcols_, \
(s)->yend_ = (s)->ystart_ + (s)->numrows_)
void jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, int xstart,
int ystart, int xend, int yend);
/******************************************************************************\
* Functions/macros for 1-D sequence class.
\******************************************************************************/
#define jas_seq_create(start, end) \
(jas_seq2d_create(start, 0, end, 1))
#define jas_seq_destroy(seq) \
(jas_seq2d_destroy(seq))
#define jas_seq_set(seq, i, v) \
((seq)->rows_[0][(i) - (seq)->xstart_] = (v))
#define jas_seq_getref(seq, i) \
(&(seq)->rows_[0][(i) - (seq)->xstart_])
#define jas_seq_get(seq, i) \
((seq)->rows_[0][(i) - (seq)->xstart_])
#define jas_seq_start(seq) \
((seq)->xstart_)
#define jas_seq_end(seq) \
((seq)->xend_)
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,464 @@
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2003 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* I/O Stream Class
*
* $Id: jas_stream.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_STREAM_H
#define JAS_STREAM_H
/******************************************************************************\
* Includes.
\******************************************************************************/
#include <jasper/jas_config.h>
#include <stdio.h>
#if defined(HAVE_FCNTL_H)
#include <fcntl.h>
#endif
#include <string.h>
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#include <jasper/jas_types.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
* Constants.
\******************************************************************************/
/* On most UNIX systems, we probably need to define O_BINARY ourselves. */
#ifndef O_BINARY
#define O_BINARY 0
#endif
/*
* Stream open flags.
*/
/* The stream was opened for reading. */
#define JAS_STREAM_READ 0x0001
/* The stream was opened for writing. */
#define JAS_STREAM_WRITE 0x0002
/* The stream was opened for appending. */
#define JAS_STREAM_APPEND 0x0004
/* The stream was opened in binary mode. */
#define JAS_STREAM_BINARY 0x0008
/* The stream should be created/truncated. */
#define JAS_STREAM_CREATE 0x0010
/*
* Stream buffering flags.
*/
/* The stream is unbuffered. */
#define JAS_STREAM_UNBUF 0x0000
/* The stream is line buffered. */
#define JAS_STREAM_LINEBUF 0x0001
/* The stream is fully buffered. */
#define JAS_STREAM_FULLBUF 0x0002
/* The buffering mode mask. */
#define JAS_STREAM_BUFMODEMASK 0x000f
/* The memory associated with the buffer needs to be deallocated when the
stream is destroyed. */
#define JAS_STREAM_FREEBUF 0x0008
/* The buffer is currently being used for reading. */
#define JAS_STREAM_RDBUF 0x0010
/* The buffer is currently being used for writing. */
#define JAS_STREAM_WRBUF 0x0020
/*
* Stream error flags.
*/
/* The end-of-file has been encountered (on reading). */
#define JAS_STREAM_EOF 0x0001
/* An I/O error has been encountered on the stream. */
#define JAS_STREAM_ERR 0x0002
/* The read/write limit has been exceeded. */
#define JAS_STREAM_RWLIMIT 0x0004
/* The error mask. */
#define JAS_STREAM_ERRMASK \
(JAS_STREAM_EOF | JAS_STREAM_ERR | JAS_STREAM_RWLIMIT)
/*
* Other miscellaneous constants.
*/
/* The default buffer size (for fully-buffered operation). */
#define JAS_STREAM_BUFSIZE 8192
/* The default permission mask for file creation. */
#define JAS_STREAM_PERMS 0666
/* The maximum number of characters that can always be put back on a stream. */
#define JAS_STREAM_MAXPUTBACK 16
/******************************************************************************\
* Types.
\******************************************************************************/
/*
* Generic file object.
*/
typedef void jas_stream_obj_t;
/*
* Generic file object operations.
*/
typedef struct {
/* Read characters from a file object. */
int (*read_)(jas_stream_obj_t *obj, char *buf, int cnt);
/* Write characters to a file object. */
int (*write_)(jas_stream_obj_t *obj, char *buf, int cnt);
/* Set the position for a file object. */
long (*seek_)(jas_stream_obj_t *obj, long offset, int origin);
/* Close a file object. */
int (*close_)(jas_stream_obj_t *obj);
} jas_stream_ops_t;
/*
* Stream object.
*/
typedef struct {
/* The mode in which the stream was opened. */
int openmode_;
/* The buffering mode. */
int bufmode_;
/* The stream status. */
int flags_;
/* The start of the buffer area to use for reading/writing. */
uchar *bufbase_;
/* The start of the buffer area excluding the extra initial space for
character putback. */
uchar *bufstart_;
/* The buffer size. */
int bufsize_;
/* The current position in the buffer. */
uchar *ptr_;
/* The number of characters that must be read/written before
the buffer needs to be filled/flushed. */
int cnt_;
/* A trivial buffer to be used for unbuffered operation. */
uchar tinybuf_[JAS_STREAM_MAXPUTBACK + 1];
/* The operations for the underlying stream file object. */
jas_stream_ops_t *ops_;
/* The underlying stream file object. */
jas_stream_obj_t *obj_;
/* The number of characters read/written. */
long rwcnt_;
/* The maximum number of characters that may be read/written. */
long rwlimit_;
} jas_stream_t;
/*
* Regular file object.
*/
/*
* File descriptor file object.
*/
typedef struct {
int fd;
int flags;
char pathname[L_tmpnam + 1];
} jas_stream_fileobj_t;
#define JAS_STREAM_FILEOBJ_DELONCLOSE 0x01
#define JAS_STREAM_FILEOBJ_NOCLOSE 0x02
/*
* Memory file object.
*/
typedef struct {
/* The data associated with this file. */
uchar *buf_;
/* The allocated size of the buffer for holding file data. */
int bufsize_;
/* The length of the file. */
int_fast32_t len_;
/* The seek position. */
int_fast32_t pos_;
/* Is the buffer growable? */
int growable_;
/* Was the buffer allocated internally? */
int myalloc_;
} jas_stream_memobj_t;
/******************************************************************************\
* Macros/functions for opening and closing streams.
\******************************************************************************/
/* Open a file as a stream. */
jas_stream_t *jas_stream_fopen(const char *filename, const char *mode);
/* Open a memory buffer as a stream. */
jas_stream_t *jas_stream_memopen(char *buf, int bufsize);
/* Open a file descriptor as a stream. */
jas_stream_t *jas_stream_fdopen(int fd, const char *mode);
/* Open a stdio stream as a stream. */
jas_stream_t *jas_stream_reopen(const char *path, const char *mode, FILE *fp);
/* Open a temporary file as a stream. */
jas_stream_t *jas_stream_tmpfile(void);
/* Close a stream. */
int jas_stream_close(jas_stream_t *stream);
/******************************************************************************\
* Macros/functions for getting/setting the stream state.
\******************************************************************************/
/* Get the EOF indicator for a stream. */
#define jas_stream_eof(stream) \
(((stream)->flags_ & JAS_STREAM_EOF) != 0)
/* Get the error indicator for a stream. */
#define jas_stream_error(stream) \
(((stream)->flags_ & JAS_STREAM_ERR) != 0)
/* Clear the error indicator for a stream. */
#define jas_stream_clearerr(stream) \
((stream)->flags_ &= ~(JAS_STREAM_ERR | JAS_STREAM_EOF))
/* Get the read/write limit for a stream. */
#define jas_stream_getrwlimit(stream) \
(((const jas_stream_t *)(stream))->rwlimit_)
/* Set the read/write limit for a stream. */
int jas_stream_setrwlimit(jas_stream_t *stream, long rwlimit);
/* Get the read/write count for a stream. */
#define jas_stream_getrwcount(stream) \
(((const jas_stream_t *)(stream))->rwcnt_)
/* Set the read/write count for a stream. */
long jas_stream_setrwcount(jas_stream_t *stream, long rwcnt);
/******************************************************************************\
* Macros/functions for I/O.
\******************************************************************************/
/* Read a character from a stream. */
#if defined(DEBUG)
#define jas_stream_getc(stream) jas_stream_getc_func(stream)
#else
#define jas_stream_getc(stream) jas_stream_getc_macro(stream)
#endif
/* Write a character to a stream. */
#if defined(DEBUG)
#define jas_stream_putc(stream, c) jas_stream_putc_func(stream, c)
#else
#define jas_stream_putc(stream, c) jas_stream_putc_macro(stream, c)
#endif
/* Read characters from a stream into a buffer. */
int jas_stream_read(jas_stream_t *stream, void *buf, int cnt);
/* Write characters from a buffer to a stream. */
int jas_stream_write(jas_stream_t *stream, const void *buf, int cnt);
/* Write formatted output to a stream. */
int jas_stream_printf(jas_stream_t *stream, const char *fmt, ...);
/* Write a string to a stream. */
int jas_stream_puts(jas_stream_t *stream, const char *s);
/* Read a line of input from a stream. */
char *jas_stream_gets(jas_stream_t *stream, char *buf, int bufsize);
/* Look at the next character to be read from a stream without actually
removing it from the stream. */
#define jas_stream_peekc(stream) \
(((stream)->cnt_ <= 0) ? jas_stream_fillbuf(stream, 0) : \
((int)(*(stream)->ptr_)))
/* Put a character back on a stream. */
int jas_stream_ungetc(jas_stream_t *stream, int c);
/******************************************************************************\
* Macros/functions for getting/setting the stream position.
\******************************************************************************/
/* Is it possible to seek on this stream? */
int jas_stream_isseekable(jas_stream_t *stream);
/* Set the current position within the stream. */
long jas_stream_seek(jas_stream_t *stream, long offset, int origin);
/* Get the current position within the stream. */
long jas_stream_tell(jas_stream_t *stream);
/* Seek to the beginning of a stream. */
int jas_stream_rewind(jas_stream_t *stream);
/******************************************************************************\
* Macros/functions for flushing.
\******************************************************************************/
/* Flush any pending output to a stream. */
int jas_stream_flush(jas_stream_t *stream);
/******************************************************************************\
* Miscellaneous macros/functions.
\******************************************************************************/
/* Copy data from one stream to another. */
int jas_stream_copy(jas_stream_t *dst, jas_stream_t *src, int n);
/* Display stream contents (for debugging purposes). */
int jas_stream_display(jas_stream_t *stream, FILE *fp, int n);
/* Consume (i.e., discard) characters from stream. */
int jas_stream_gobble(jas_stream_t *stream, int n);
/* Write a character multiple times to a stream. */
int jas_stream_pad(jas_stream_t *stream, int n, int c);
/* Get the size of the file associated with the specified stream.
The specified stream must be seekable. */
long jas_stream_length(jas_stream_t *stream);
/******************************************************************************\
* Internal functions.
\******************************************************************************/
/* The following functions are for internal use only! If you call them
directly, you will die a horrible, miserable, and painful death! */
/* Read a character from a stream. */
#define jas_stream_getc_macro(stream) \
((!((stream)->flags_ & (JAS_STREAM_ERR | JAS_STREAM_EOF | \
JAS_STREAM_RWLIMIT))) ? \
(((stream)->rwlimit_ >= 0 && (stream)->rwcnt_ >= (stream)->rwlimit_) ? \
(stream->flags_ |= JAS_STREAM_RWLIMIT, EOF) : \
jas_stream_getc2(stream)) : EOF)
#define jas_stream_getc2(stream) \
((--(stream)->cnt_ < 0) ? jas_stream_fillbuf(stream, 1) : \
(++(stream)->rwcnt_, (int)(*(stream)->ptr_++)))
/* Write a character to a stream. */
#define jas_stream_putc_macro(stream, c) \
((!((stream)->flags_ & (JAS_STREAM_ERR | JAS_STREAM_EOF | \
JAS_STREAM_RWLIMIT))) ? \
(((stream)->rwlimit_ >= 0 && (stream)->rwcnt_ >= (stream)->rwlimit_) ? \
(stream->flags_ |= JAS_STREAM_RWLIMIT, EOF) : \
jas_stream_putc2(stream, c)) : EOF)
#define jas_stream_putc2(stream, c) \
(((stream)->bufmode_ |= JAS_STREAM_WRBUF, --(stream)->cnt_ < 0) ? \
jas_stream_flushbuf((stream), (uchar)(c)) : \
(++(stream)->rwcnt_, (int)(*(stream)->ptr_++ = (c))))
/* These prototypes need to be here for the sake of the stream_getc and
stream_putc macros. */
int jas_stream_fillbuf(jas_stream_t *stream, int getflag);
int jas_stream_flushbuf(jas_stream_t *stream, int c);
int jas_stream_getc_func(jas_stream_t *stream);
int jas_stream_putc_func(jas_stream_t *stream, int c);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2002 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* String Library
*
* $Id: jas_string.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_STRING_H
#define JAS_STRING_H
/******************************************************************************\
* Includes.
\******************************************************************************/
#include <jasper/jas_config.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
* Functions.
\******************************************************************************/
/* Copy a string (a la strdup). */
char *jas_strdup(const char *);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,151 @@
/*
* Copyright (c) 2001-2002 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* Tag/Value Parser
*
* $Id: jas_tvp.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_TVP_H
#define JAS_TVP_H
/******************************************************************************\
* Includes.
\******************************************************************************/
#include <jasper/jas_config.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
* Types.
\******************************************************************************/
/* Tag information type. */
typedef struct {
int id;
/* The ID for the tag. */
char *name;
/* The name of the tag. */
} jas_taginfo_t;
/* Tag-value parser type. */
typedef struct {
char *buf;
/* The parsing buffer. */
char *tag;
/* The current tag name. */
char *val;
/* The current value. */
char *pos;
/* The current position in the parsing buffer. */
} jas_tvparser_t;
/******************************************************************************\
* Tag information functions.
\******************************************************************************/
/* Lookup a tag by name. */
jas_taginfo_t *jas_taginfos_lookup(jas_taginfo_t *taginfos, const char *name);
/* This function returns a pointer to the specified taginfo object if it
exists (i.e., the pointer is nonnull); otherwise, a pointer to a dummy
object is returned. This is useful in some situations to avoid checking
for a null pointer. */
jas_taginfo_t *jas_taginfo_nonull(jas_taginfo_t *taginfo);
/******************************************************************************\
* Tag-value parser functions.
\******************************************************************************/
/* Create a tag-value parser for the specified string. */
jas_tvparser_t *jas_tvparser_create(const char *s);
/* Destroy a tag-value parser. */
void jas_tvparser_destroy(jas_tvparser_t *tvparser);
/* Get the next tag-value pair. */
int jas_tvparser_next(jas_tvparser_t *tvparser);
/* Get the tag name for the current tag-value pair. */
char *jas_tvparser_gettag(jas_tvparser_t *tvparser);
/* Get the value for the current tag-value pair. */
char *jas_tvparser_getval(jas_tvparser_t *tvparser);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,206 @@
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2003 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* Primitive Types
*
* $Id: jas_types.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_TYPES_H
#define JAS_TYPES_H
#include <jasper/jas_config.h>
#if !defined(JAS_CONFIGURE)
#if defined(WIN32) || defined(HAVE_WINDOWS_H)
/*
We are dealing with Microsoft Windows and most likely Microsoft
Visual C (MSVC). (Heaven help us.) Sadly, MSVC does not correctly
define some of the standard types specified in ISO/IEC 9899:1999.
In particular, it does not define the "long long" and "unsigned long
long" types. So, we work around this problem by using the "INT64"
and "UINT64" types that are defined in the header file "windows.h".
*/
#include <windows.h>
#undef longlong
#define longlong INT64
#undef ulonglong
#define ulonglong UINT64
#endif
#endif
#if defined(HAVE_STDLIB_H)
#include <stdlib.h>
#endif
#if defined(HAVE_STDDEF_H)
#include <stddef.h>
#endif
#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
#ifndef __cplusplus
#if defined(HAVE_STDBOOL_H)
/*
* The C language implementation does correctly provide the standard header
* file "stdbool.h".
*/
#include <stdbool.h>
#else
/*
* The C language implementation does not provide the standard header file
* "stdbool.h" as required by ISO/IEC 9899:1999. Try to compensate for this
* braindamage below.
*/
#if !defined(bool)
#define bool int
#endif
#if !defined(true)
#define true 1
#endif
#if !defined(false)
#define false 0
#endif
#endif
#endif
#if defined(HAVE_STDINT_H)
/*
* The C language implementation does correctly provide the standard header
* file "stdint.h".
*/
#include <stdint.h>
#else
/*
* The C language implementation does not provide the standard header file
* "stdint.h" as required by ISO/IEC 9899:1999. Try to compensate for this
* braindamage below.
*/
#include <limits.h>
/**********/
#if !defined(INT_FAST8_MIN)
typedef signed char int_fast8_t;
#define INT_FAST8_MIN (-127)
#define INT_FAST8_MAX 128
#endif
/**********/
#if !defined(UINT_FAST8_MAX)
typedef unsigned char uint_fast8_t;
#define UINT_FAST8_MAX 255
#endif
/**********/
#if !defined(INT_FAST16_MIN)
typedef short int_fast16_t;
#define INT_FAST16_MIN SHRT_MIN
#define INT_FAST16_MAX SHRT_MAX
#endif
/**********/
#if !defined(UINT_FAST16_MAX)
typedef unsigned short uint_fast16_t;
#define UINT_FAST16_MAX USHRT_MAX
#endif
/**********/
#if !defined(INT_FAST32_MIN)
typedef int int_fast32_t;
#define INT_FAST32_MIN INT_MIN
#define INT_FAST32_MAX INT_MAX
#endif
/**********/
#if !defined(UINT_FAST32_MAX)
typedef unsigned int uint_fast32_t;
#define UINT_FAST32_MAX UINT_MAX
#endif
/**********/
#if !defined(INT_FAST64_MIN)
typedef longlong int_fast64_t;
#define INT_FAST64_MIN LLONG_MIN
#define INT_FAST64_MAX LLONG_MAX
#endif
/**********/
#if !defined(UINT_FAST64_MAX)
typedef ulonglong uint_fast64_t;
#define UINT_FAST64_MAX ULLONG_MAX
#endif
/**********/
#endif
/* The below macro is intended to be used for type casts. By using this
macro, type casts can be easily located in the source code with
tools like "grep". */
#define JAS_CAST(t, e) \
((t) (e))
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,120 @@
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2003 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* $Id: jas_version.h,v 1.1 2006/10/11 16:48:43 vp153 Exp $
*/
#ifndef JAS_VERSION_H
#define JAS_VERSION_H
#include <jasper/jas_config.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
* Constants and types.
\******************************************************************************/
#if !defined(JAS_VERSION)
/* The version information below should match that specified in
the "configure.in" file! */
#define JAS_VERSION "unknown"
#endif
#define JAS_COPYRIGHT \
"Copyright (c) 1999-2000 Image Power, Inc. and the University of\n" \
" British Columbia.\n" \
"Copyright (c) 2001-2003 Michael David Adams.\n" \
"All rights reserved.\n"
#define JAS_NOTES \
"For more information about this software, please visit the following\n" \
"web sites/pages:\n" \
" http://www.ece.uvic.ca/~mdadams/jasper\n" \
" http://www.jpeg.org/software\n" \
"To be added to the (moderated) JasPer software announcements\n" \
"mailing list, send an email to:\n" \
" jasper-announce-subscribe@yahoogroups.com\n" \
"To be added to the (unmoderated) JasPer software discussion\n" \
"mailing list, send an email to:\n" \
" jasper-discussion-subscribe@yahoogroups.com\n" \
"Please send any bug reports to:\n" \
" mdadams@ieee.org\n"
/******************************************************************************\
* Functions.
\******************************************************************************/
const char *jas_getversion(void);
/* Get the version information for the JasPer library. */
/* Note: Since libjasper can be built as a shared library, the version
returned by this function may not necessarily correspond to JAS_VERSION. */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,92 @@
/*
* Copyright (c) 2001-2003 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
* Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
#ifndef JAS_JASPER_H
#define JAS_JASPER_H
#include <jasper/jas_config.h>
#include <jasper/jas_types.h>
#include <jasper/jas_version.h>
#include <jasper/jas_init.h>
#include <jasper/jas_cm.h>
#include <jasper/jas_icc.h>
#include <jasper/jas_fix.h>
#include <jasper/jas_debug.h>
#include <jasper/jas_getopt.h>
#include <jasper/jas_image.h>
#include <jasper/jas_icc.h>
#include <jasper/jas_math.h>
#include <jasper/jas_malloc.h>
#include <jasper/jas_seq.h>
#include <jasper/jas_stream.h>
#include <jasper/jas_string.h>
#include <jasper/jas_tvp.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,45 @@
/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */
/* see jconfig.doc for explanations */
#define HAVE_PROTOTYPES
#define HAVE_UNSIGNED_CHAR
#define HAVE_UNSIGNED_SHORT
/* #define void char */
/* #define const */
#undef CHAR_IS_UNSIGNED
#define HAVE_STDDEF_H
#define HAVE_STDLIB_H
#undef NEED_BSD_STRINGS
#undef NEED_SYS_TYPES_H
#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */
#undef NEED_SHORT_EXTERNAL_NAMES
#undef INCOMPLETE_TYPES_BROKEN
/* Define "boolean" as unsigned char, not int, per Windows custom */
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean;
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
#ifdef JPEG_INTERNALS
#undef RIGHT_SHIFT_IS_UNSIGNED
#endif /* JPEG_INTERNALS */
#ifdef JPEG_CJPEG_DJPEG
#define BMP_SUPPORTED /* BMP image file format */
#define GIF_SUPPORTED /* GIF image file format */
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
#undef RLE_SUPPORTED /* Utah RLE image file format */
#define TARGA_SUPPORTED /* Targa image file format */
#define TWO_FILE_COMMANDLINE /* optional */
#define USE_SETMODE /* Microsoft has setmode() */
#undef NEED_SIGNAL_CATCHER
#undef DONT_USE_B_MODE
#undef PROGRESS_REPORT /* optional */
#endif /* JPEG_CJPEG_DJPEG */

View File

@@ -0,0 +1,363 @@
/*
* jmorecfg.h
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains additional configuration options that customize the
* JPEG software for special applications or support machine-dependent
* optimizations. Most users will not need to touch this file.
*/
/*
* Define BITS_IN_JSAMPLE as either
* 8 for 8-bit sample values (the usual setting)
* 12 for 12-bit sample values
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
* JPEG standard, and the IJG code does not support anything else!
* We do not support run-time selection of data precision, sorry.
*/
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
/*
* Maximum number of components (color channels) allowed in JPEG image.
* To meet the letter of the JPEG spec, set this to 255. However, darn
* few applications need more than 4 channels (maybe 5 for CMYK + alpha
* mask). We recommend 10 as a reasonable compromise; use 4 if you are
* really short on memory. (Each allowed component costs a hundred or so
* bytes of storage, whether actually used in an image or not.)
*/
#define MAX_COMPONENTS 10 /* maximum number of image components */
/*
* Basic data types.
* You may need to change these if you have a machine with unusual data
* type sizes; for example, "char" not 8 bits, "short" not 16 bits,
* or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
* but it had better be at least 16.
*/
/* Representation of a single sample (pixel element value).
* We frequently allocate large arrays of these, so it's important to keep
* them small. But if you have memory to burn and access to char or short
* arrays is very slow on your hardware, you might want to change these.
*/
#if BITS_IN_JSAMPLE == 8
/* JSAMPLE should be the smallest type that will hold the values 0..255.
* You can use a signed char by having GETJSAMPLE mask it with 0xFF.
*/
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char JSAMPLE;
#define GETJSAMPLE(value) ((int) (value))
#else /* not HAVE_UNSIGNED_CHAR */
typedef char JSAMPLE;
#ifdef CHAR_IS_UNSIGNED
#define GETJSAMPLE(value) ((int) (value))
#else
#define GETJSAMPLE(value) ((int) (value) & 0xFF)
#endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */
#define MAXJSAMPLE 255
#define CENTERJSAMPLE 128
#endif /* BITS_IN_JSAMPLE == 8 */
#if BITS_IN_JSAMPLE == 12
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
* On nearly all machines "short" will do nicely.
*/
typedef short JSAMPLE;
#define GETJSAMPLE(value) ((int) (value))
#define MAXJSAMPLE 4095
#define CENTERJSAMPLE 2048
#endif /* BITS_IN_JSAMPLE == 12 */
/* Representation of a DCT frequency coefficient.
* This should be a signed value of at least 16 bits; "short" is usually OK.
* Again, we allocate large arrays of these, but you can change to int
* if you have memory to burn and "short" is really slow.
*/
typedef short JCOEF;
/* Compressed datastreams are represented as arrays of JOCTET.
* These must be EXACTLY 8 bits wide, at least once they are written to
* external storage. Note that when using the stdio data source/destination
* managers, this is also the data type passed to fread/fwrite.
*/
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char JOCTET;
#define GETJOCTET(value) (value)
#else /* not HAVE_UNSIGNED_CHAR */
typedef char JOCTET;
#ifdef CHAR_IS_UNSIGNED
#define GETJOCTET(value) (value)
#else
#define GETJOCTET(value) ((value) & 0xFF)
#endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */
/* These typedefs are used for various table entries and so forth.
* They must be at least as wide as specified; but making them too big
* won't cost a huge amount of memory, so we don't provide special
* extraction code like we did for JSAMPLE. (In other words, these
* typedefs live at a different point on the speed/space tradeoff curve.)
*/
/* UINT8 must hold at least the values 0..255. */
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char UINT8;
#else /* not HAVE_UNSIGNED_CHAR */
#ifdef CHAR_IS_UNSIGNED
typedef char UINT8;
#else /* not CHAR_IS_UNSIGNED */
typedef short UINT8;
#endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */
/* UINT16 must hold at least the values 0..65535. */
#ifdef HAVE_UNSIGNED_SHORT
typedef unsigned short UINT16;
#else /* not HAVE_UNSIGNED_SHORT */
typedef unsigned int UINT16;
#endif /* HAVE_UNSIGNED_SHORT */
/* INT16 must hold at least the values -32768..32767. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
typedef short INT16;
#endif
/* INT32 must hold at least signed 32-bit values. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
typedef long INT32;
#endif
/* Datatype used for image dimensions. The JPEG standard only supports
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
* "unsigned int" is sufficient on all machines. However, if you need to
* handle larger images and you don't mind deviating from the spec, you
* can change this datatype.
*/
typedef unsigned int JDIMENSION;
#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
/* These macros are used in all function definitions and extern declarations.
* You could modify them if you need to change function linkage conventions;
* in particular, you'll need to do that to make the library a Windows DLL.
* Another application is to make all functions global for use with debuggers
* or code profilers that require it.
*/
/* a function called through method pointers: */
#define METHODDEF(type) static type
/* a function used only in its module: */
#define LOCAL(type) static type
/* a function referenced thru EXTERNs: */
#define GLOBAL(type) type
/* a reference to a GLOBAL function: */
#define EXTERN(type) extern type
/* This macro is used to declare a "method", that is, a function pointer.
* We want to supply prototype parameters if the compiler can cope.
* Note that the arglist parameter must be parenthesized!
* Again, you can customize this if you need special linkage keywords.
*/
#ifdef HAVE_PROTOTYPES
#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
#else
#define JMETHOD(type,methodname,arglist) type (*methodname) ()
#endif
/* Here is the pseudo-keyword for declaring pointers that must be "far"
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
* by just saying "FAR *" where such a pointer is needed. In a few places
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
*/
#ifdef NEED_FAR_POINTERS
#define FAR far
#else
#define FAR
#endif
/*
* On a few systems, type boolean and/or its values FALSE, TRUE may appear
* in standard header files. Or you may have conflicts with application-
* specific header files that you want to include together with these files.
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
*/
#ifndef HAVE_BOOLEAN
typedef int boolean;
#endif
#ifndef FALSE /* in case these macros already exist */
#define FALSE 0 /* values of boolean */
#endif
#ifndef TRUE
#define TRUE 1
#endif
/*
* The remaining options affect code selection within the JPEG library,
* but they don't need to be visible to most applications using the library.
* To minimize application namespace pollution, the symbols won't be
* defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
*/
#ifdef JPEG_INTERNALS
#define JPEG_INTERNAL_OPTIONS
#endif
#ifdef JPEG_INTERNAL_OPTIONS
/*
* These defines indicate whether to include various optional functions.
* Undefining some of these symbols will produce a smaller but less capable
* library. Note that you can leave certain source files out of the
* compilation/linking process if you've #undef'd the corresponding symbols.
* (You may HAVE to do that if your compiler doesn't like null source files.)
*/
/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
/* Capability options common to encoder and decoder: */
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
/* Encoder capability options: */
#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
* precision, so jchuff.c normally uses entropy optimization to compute
* usable tables for higher precision. If you don't want to do optimization,
* you'll have to supply different default Huffman tables.
* The exact same statements apply for progressive JPEG: the default tables
* don't work for progressive mode. (This may get fixed, however.)
*/
#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
/* Decoder capability options: */
#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
/* more capability options later, no doubt */
/*
* Ordering of RGB data in scanlines passed to or from the application.
* If your application wants to deal with data in the order B,G,R, just
* change these macros. You can also deal with formats such as R,G,B,X
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
* the offsets will also change the order in which colormap data is organized.
* RESTRICTIONS:
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
* 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
* useful if you are using JPEG color spaces other than YCbCr or grayscale.
* 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
* is not 3 (they don't understand about dummy color components!). So you
* can't use color quantization if you change that value.
*/
#define RGB_RED 0 /* Offset of Red in an RGB scanline element */
#define RGB_GREEN 1 /* Offset of Green */
#define RGB_BLUE 2 /* Offset of Blue */
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
/* Definitions for speed-related optimizations. */
/* If your compiler supports inline functions, define INLINE
* as the inline keyword; otherwise define it as empty.
*/
#ifndef INLINE
#ifdef __GNUC__ /* for instance, GNU C knows about inline */
#define INLINE __inline__
#endif
#ifndef INLINE
#define INLINE /* default is to define it as empty */
#endif
#endif
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
* two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
* as short on such a machine. MULTIPLIER must be at least 16 bits wide.
*/
#ifndef MULTIPLIER
#define MULTIPLIER int /* type for fastest integer multiply */
#endif
/* FAST_FLOAT should be either float or double, whichever is done faster
* by your compiler. (Note that this type is only used in the floating point
* DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
* Typically, float is faster in ANSI C compilers, while double is faster in
* pre-ANSI compilers (because they insist on converting to double anyway).
* The code below therefore chooses float if we have ANSI-style prototypes.
*/
#ifndef FAST_FLOAT
#ifdef HAVE_PROTOTYPES
#define FAST_FLOAT float
#else
#define FAST_FLOAT double
#endif
#endif
#endif /* JPEG_INTERNAL_OPTIONS */

View File

@@ -0,0 +1,567 @@
/* $Id: tiff.h,v 1.3 2005/06/17 13:57:03 vp153 Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _TIFF_
#define _TIFF_
/*
* Tag Image File Format (TIFF)
*
* Based on Rev 6.0 from:
* Developer's Desk
* Aldus Corporation
* 411 First Ave. South
* Suite 200
* Seattle, WA 98104
* 206-622-5500
*
* (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)
*
* For Big TIFF design notes see the following link
* http://gdal.maptools.org/twiki/bin/view/libtiff/BigTIFFDesign
*/
#define TIFF_VERSION 42
#define TIFF_BIGTIFF_VERSION 43
#define TIFF_BIGENDIAN 0x4d4d
#define TIFF_LITTLEENDIAN 0x4949
/*
* The so called TIFF types conflict with definitions from inttypes.h
* included from sys/types.h on AIX (at least using VisualAge compiler).
* We try to work around this by detecting this case. Defining
* _TIFF_DATA_TYPEDEFS_ short circuits the later definitions in tiff.h, and
* we will in the holes not provided for by inttypes.h.
*
* See http://bugzilla.remotesensing.org/show_bug.cgi?id=39
*/
#if defined(_H_INTTYPES) && defined(_ALL_SOURCE) && defined(USING_VISUALAGE)
#define _TIFF_DATA_TYPEDEFS_
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
#endif
/*
* Intrinsic data types required by the file format:
*
* 8-bit quantities int8/uint8
* 16-bit quantities int16/uint16
* 32-bit quantities int32/uint32
* strings unsigned char*
*/
#ifndef _TIFF_DATA_TYPEDEFS_
#define _TIFF_DATA_TYPEDEFS_
typedef signed char int8; /* NB: non-ANSI compilers may not grok */
typedef unsigned char uint8;
typedef short int16;
typedef unsigned short uint16; /* sizeof (uint16) must == 2 */
#if defined(__alpha) || (defined(_MIPS_SZLONG) && _MIPS_SZLONG == 64) || defined(__LP64__) || defined(__arch64__)
typedef int int32;
typedef unsigned int uint32; /* sizeof (uint32) must == 4 */
#else
typedef long int32;
typedef unsigned long uint32; /* sizeof (uint32) must == 4 */
#endif
#endif /* _TIFF_DATA_TYPEDEFS_ */
/* For TIFFReassignTagToIgnore */
enum TIFFIgnoreSense /* IGNORE tag table */
{
TIS_STORE,
TIS_EXTRACT,
TIS_EMPTY
};
/*
* TIFF header.
*/
typedef struct {
uint16 tiff_magic; /* magic number (defines byte order) */
#define TIFF_MAGIC_SIZE 2
uint16 tiff_version; /* TIFF version number */
#define TIFF_VERSION_SIZE 2
uint32 tiff_diroff; /* byte offset to first directory */
#define TIFF_DIROFFSET_SIZE 4
} TIFFHeader;
/*
* TIFF Image File Directories are comprised of a table of field
* descriptors of the form shown below. The table is sorted in
* ascending order by tag. The values associated with each entry are
* disjoint and may appear anywhere in the file (so long as they are
* placed on a word boundary).
*
* If the value is 4 bytes or less, then it is placed in the offset
* field to save space. If the value is less than 4 bytes, it is
* left-justified in the offset field.
*/
typedef struct {
uint16 tdir_tag; /* see below */
uint16 tdir_type; /* data type; see below */
uint32 tdir_count; /* number of items; length in spec */
uint32 tdir_offset; /* byte offset to field data */
} TIFFDirEntry;
/*
* NB: In the comments below,
* - items marked with a + are obsoleted by revision 5.0,
* - items marked with a ! are introduced in revision 6.0.
* - items marked with a % are introduced post revision 6.0.
* - items marked with a $ are obsoleted by revision 6.0.
* - items marked with a & are introduced by Adobe DNG specification.
*/
/*
* Tag data type information.
*
* Note: RATIONALs are the ratio of two 32-bit integer values.
*/
typedef enum {
TIFF_NOTYPE = 0, /* placeholder */
TIFF_BYTE = 1, /* 8-bit unsigned integer */
TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */
TIFF_SHORT = 3, /* 16-bit unsigned integer */
TIFF_LONG = 4, /* 32-bit unsigned integer */
TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */
TIFF_SBYTE = 6, /* !8-bit signed integer */
TIFF_UNDEFINED = 7, /* !8-bit untyped data */
TIFF_SSHORT = 8, /* !16-bit signed integer */
TIFF_SLONG = 9, /* !32-bit signed integer */
TIFF_SRATIONAL = 10, /* !64-bit signed fraction */
TIFF_FLOAT = 11, /* !32-bit IEEE floating point */
TIFF_DOUBLE = 12, /* !64-bit IEEE floating point */
TIFF_IFD = 13 /* %32-bit unsigned integer (offset) */
} TIFFDataType;
/*
* TIFF Tag Definitions.
*/
#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */
#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */
#define FILETYPE_PAGE 0x2 /* one page of many */
#define FILETYPE_MASK 0x4 /* transparency mask */
#define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */
#define OFILETYPE_IMAGE 1 /* full resolution image data */
#define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */
#define OFILETYPE_PAGE 3 /* one page of many */
#define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */
#define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */
#define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */
#define TIFFTAG_COMPRESSION 259 /* data compression technique */
#define COMPRESSION_NONE 1 /* dump mode */
#define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */
#define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */
#define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6 name) */
#define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */
#define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6 name) */
#define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */
#define COMPRESSION_OJPEG 6 /* !6.0 JPEG */
#define COMPRESSION_JPEG 7 /* %JPEG DCT compression */
#define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */
#define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */
#define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */
#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */
/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
#define COMPRESSION_IT8CTPAD 32895 /* IT8 CT w/padding */
#define COMPRESSION_IT8LW 32896 /* IT8 Linework RLE */
#define COMPRESSION_IT8MP 32897 /* IT8 Monochrome picture */
#define COMPRESSION_IT8BL 32898 /* IT8 Binary line art */
/* compression codes 32908-32911 are reserved for Pixar */
#define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */
#define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */
#define COMPRESSION_DEFLATE 32946 /* Deflate compression */
#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression,
as recognized by Adobe */
/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
#define COMPRESSION_DCS 32947 /* Kodak DCS encoding */
#define COMPRESSION_JBIG 34661 /* ISO JBIG */
#define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */
#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
#define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */
#define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */
#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */
#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */
#define PHOTOMETRIC_RGB 2 /* RGB color model */
#define PHOTOMETRIC_PALETTE 3 /* color map indexed */
#define PHOTOMETRIC_MASK 4 /* $holdout mask */
#define PHOTOMETRIC_SEPARATED 5 /* !color separations */
#define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */
#define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */
#define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */
#define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */
#define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */
#define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */
#define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */
#define THRESHHOLD_BILEVEL 1 /* b&w art scan */
#define THRESHHOLD_HALFTONE 2 /* or dithered scan */
#define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */
#define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */
#define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */
#define TIFFTAG_FILLORDER 266 /* data order within a byte */
#define FILLORDER_MSB2LSB 1 /* most significant -> least */
#define FILLORDER_LSB2MSB 2 /* least significant -> most */
#define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */
#define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */
#define TIFFTAG_MAKE 271 /* scanner manufacturer name */
#define TIFFTAG_MODEL 272 /* scanner model name/number */
#define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */
#define TIFFTAG_ORIENTATION 274 /* +image orientation */
#define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */
#define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */
#define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */
#define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */
#define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */
#define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */
#define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */
#define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */
#define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */
#define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */
#define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */
#define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */
#define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */
#define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */
#define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */
#define TIFFTAG_PLANARCONFIG 284 /* storage organization */
#define PLANARCONFIG_CONTIG 1 /* single image plane */
#define PLANARCONFIG_SEPARATE 2 /* separate planes of data */
#define TIFFTAG_PAGENAME 285 /* page name image is from */
#define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */
#define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */
#define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */
#define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */
#define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */
#define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */
#define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */
#define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */
#define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
#define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */
#define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */
#define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */
#define TIFFTAG_T4OPTIONS 292 /* TIFF 6.0 proper name alias */
#define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */
#define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */
#define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */
#define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */
#define TIFFTAG_T6OPTIONS 293 /* TIFF 6.0 proper name */
#define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */
#define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */
#define RESUNIT_NONE 1 /* no meaningful units */
#define RESUNIT_INCH 2 /* english */
#define RESUNIT_CENTIMETER 3 /* metric */
#define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */
#define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */
#define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */
#define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */
#define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */
#define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
#define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */
#define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */
#define TIFFTAG_SOFTWARE 305 /* name & release */
#define TIFFTAG_DATETIME 306 /* creation date and time */
#define TIFFTAG_ARTIST 315 /* creator of image */
#define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */
#define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */
#define TIFFTAG_WHITEPOINT 318 /* image white point */
#define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */
#define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */
#define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */
#define TIFFTAG_TILEWIDTH 322 /* !tile width in pixels */
#define TIFFTAG_TILELENGTH 323 /* !tile height in pixels */
#define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */
#define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */
#define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */
#define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */
#define CLEANFAXDATA_CLEAN 0 /* no errors detected */
#define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */
#define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */
#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
#define TIFFTAG_SUBIFD 330 /* subimage descriptors */
#define TIFFTAG_INKSET 332 /* !inks in separated image */
#define INKSET_CMYK 1 /* !cyan-magenta-yellow-black color */
#define INKSET_MULTIINK 2 /* !multi-ink or hi-fi color */
#define TIFFTAG_INKNAMES 333 /* !ascii names of inks */
#define TIFFTAG_NUMBEROFINKS 334 /* !number of inks */
#define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */
#define TIFFTAG_TARGETPRINTER 337 /* !separation target */
#define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */
#define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */
#define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */
#define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */
#define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */
#define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */
#define SAMPLEFORMAT_INT 2 /* !signed integer data */
#define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */
#define SAMPLEFORMAT_VOID 4 /* !untyped data */
#define SAMPLEFORMAT_COMPLEXINT 5 /* !complex signed int */
#define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */
#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */
#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */
#define TIFFTAG_CLIPPATH 343 /* %ClipPath
[Adobe TIFF technote 2] */
#define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits
[Adobe TIFF technote 2] */
#define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits
[Adobe TIFF technote 2] */
#define TIFFTAG_INDEXED 346 /* %Indexed
[Adobe TIFF Technote 3] */
#define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */
#define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */
/*
* Tags 512-521 are obsoleted by Technical Note #2 which specifies a
* revised JPEG-in-TIFF scheme.
*/
#define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */
#define JPEGPROC_BASELINE 1 /* !baseline sequential */
#define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */
#define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */
#define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */
#define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */
#define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */
#define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */
#define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */
#define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */
#define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */
#define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */
#define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */
#define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */
#define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */
#define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */
#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */
#define TIFFTAG_XMLPACKET 700 /* %XML packet
[Adobe XMP Specification,
January 2004 */
#define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID
[Adobe TIFF technote] */
/* tags 32952-32956 are private tags registered to Island Graphics */
#define TIFFTAG_REFPTS 32953 /* image reference points */
#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */
#define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */
#define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */
/* tags 32995-32999 are private tags registered to SGI */
#define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */
#define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */
#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
#define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */
/* tags 33300-33309 are private tags registered to Pixar */
/*
* TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH
* are set when an image has been cropped out of a larger image.
* They reflect the size of the original uncropped image.
* The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used
* to determine the position of the smaller image in the larger one.
*/
#define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */
#define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */
/* Tags 33302-33306 are used to identify special image modes and data
* used by Pixar's texture formats.
*/
#define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */
#define TIFFTAG_PIXAR_WRAPMODES 33303 /* s & t wrap modes */
#define TIFFTAG_PIXAR_FOVCOT 33304 /* cotan(fov) for env. maps */
#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305
#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
/* tag 33405 is a private tag registered to Eastman Kodak */
#define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */
/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
#define TIFFTAG_COPYRIGHT 33432 /* copyright string */
/* IPTC TAG from RichTIFF specifications */
#define TIFFTAG_RICHTIFFIPTC 33723
/* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
#define TIFFTAG_IT8SITE 34016 /* site name */
#define TIFFTAG_IT8COLORSEQUENCE 34017 /* color seq. [RGB,CMYK,etc] */
#define TIFFTAG_IT8HEADER 34018 /* DDES Header */
#define TIFFTAG_IT8RASTERPADDING 34019 /* raster scanline padding */
#define TIFFTAG_IT8BITSPERRUNLENGTH 34020 /* # of bits in short run */
#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */
#define TIFFTAG_IT8COLORTABLE 34022 /* LW colortable */
#define TIFFTAG_IT8IMAGECOLORINDICATOR 34023 /* BP/BL image color switch */
#define TIFFTAG_IT8BKGCOLORINDICATOR 34024 /* BP/BL bg color switch */
#define TIFFTAG_IT8IMAGECOLORVALUE 34025 /* BP/BL image color value */
#define TIFFTAG_IT8BKGCOLORVALUE 34026 /* BP/BL bg color value */
#define TIFFTAG_IT8PIXELINTENSITYRANGE 34027 /* MP pixel intensity value */
#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */
#define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */
#define TIFFTAG_IT8HCUSAGE 34030 /* HC usage indicator */
#define TIFFTAG_IT8TRAPINDICATOR 34031 /* Trapping indicator
(untrapped=0, trapped=1) */
#define TIFFTAG_IT8CMYKEQUIVALENT 34032 /* CMYK color equivalents */
/* tags 34232-34236 are private tags registered to Texas Instruments */
#define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */
/* tag 34750 is a private tag registered to Adobe? */
#define TIFFTAG_ICCPROFILE 34675 /* ICC profile data */
/* tag 34377 is private tag registered to Adobe for PhotoShop */
#define TIFFTAG_PHOTOSHOP 34377
/* tag 34750 is a private tag registered to Pixel Magic */
#define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */
/* tags 34908-34914 are private tags registered to SGI */
#define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. parms */
#define TIFFTAG_FAXSUBADDRESS 34909 /* received SubAddr string */
#define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */
#define TIFFTAG_FAXDCS 34911 /* encoded fax ses. params, Table 2/T.30 */
/* tags 37439-37443 are registered to SGI <gregl@sgi.com> */
#define TIFFTAG_STONITS 37439 /* Sample value to Nits */
/* tag 34929 is a private tag registered to FedEx */
#define TIFFTAG_FEDEX_EDR 34929 /* unknown use */
/* tag 65535 is an undefined tag used by Eastman Kodak */
#define TIFFTAG_DCSHUESHIFTVALUES 65535 /* hue shift correction data */
/* Adobe Digital Negative format tags */
#define TIFFTAG_DNGVERSION 50706 /* &DNG version number */
#define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */
#define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */
#define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model
name */
#define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space
mapping */
#define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */
#define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */
#define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for
the BlackLevel tag */
#define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */
#define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level
differences (columns) */
#define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level
differences (rows) */
#define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding
level */
#define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */
#define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image
area */
#define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image
area */
#define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space
transformation matrix 1 */
#define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space
transformation matrix 2 */
#define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */
#define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */
#define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction
matrix 1 */
#define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction
matrix 2 */
#define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw
values*/
#define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in
linear reference space */
#define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in
x-y chromaticity
coordinates */
#define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero
point */
#define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */
#define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of
sharpening */
#define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of
the green pixels in the
blue/green rows track the
values of the green pixels
in the red/green rows */
#define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */
#define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */
#define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */
#define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the
camera's anti-alias filter */
#define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */
#define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote
tag is safe to preserve
along with the rest of the
EXIF data */
#define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */
#define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */
#define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */
/*
* The following are ``pseudo tags'' that can be used to control
* codec-specific functionality. These tags are not written to file.
* Note that these values start at 0xffff+1 so that they'll never
* collide with Aldus-assigned tags.
*
* If you want your private pseudo tags ``registered'' (i.e. added to
* this file), please post a bug report via the tracking system at
* http://www.remotesensing.org/libtiff/bugs.html with the appropriate
* C definitions to add.
*/
#define TIFFTAG_FAXMODE 65536 /* Group 3/4 format control */
#define FAXMODE_CLASSIC 0x0000 /* default, include RTC */
#define FAXMODE_NORTC 0x0001 /* no RTC at end of data */
#define FAXMODE_NOEOL 0x0002 /* no EOL code at end of row */
#define FAXMODE_BYTEALIGN 0x0004 /* byte align row */
#define FAXMODE_WORDALIGN 0x0008 /* word align row */
#define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */
#define TIFFTAG_JPEGQUALITY 65537 /* Compression quality level */
/* Note: quality level is on the IJG 0-100 scale. Default value is 75 */
#define TIFFTAG_JPEGCOLORMODE 65538 /* Auto RGB<=>YCbCr convert? */
#define JPEGCOLORMODE_RAW 0x0000 /* no conversion (default) */
#define JPEGCOLORMODE_RGB 0x0001 /* do auto conversion */
#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */
#define JPEGTABLESMODE_QUANT 0x0001 /* include quantization tbls */
#define JPEGTABLESMODE_HUFF 0x0002 /* include Huffman tbls */
/* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */
#define TIFFTAG_FAXFILLFUNC 65540 /* G3/G4 fill function */
#define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */
#define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */
#define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */
#define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */
#define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */
#define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */
#define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */
/* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */
#define TIFFTAG_DCSIMAGERTYPE 65550 /* imager model & filter */
#define DCSIMAGERMODEL_M3 0 /* M3 chip (1280 x 1024) */
#define DCSIMAGERMODEL_M5 1 /* M5 chip (1536 x 1024) */
#define DCSIMAGERMODEL_M6 2 /* M6 chip (3072 x 2048) */
#define DCSIMAGERFILTER_IR 0 /* infrared filter */
#define DCSIMAGERFILTER_MONO 1 /* monochrome filter */
#define DCSIMAGERFILTER_CFA 2 /* color filter array */
#define DCSIMAGERFILTER_OTHER 3 /* other filter */
#define TIFFTAG_DCSINTERPMODE 65551 /* interpolation mode */
#define DCSINTERPMODE_NORMAL 0x0 /* whole image, default */
#define DCSINTERPMODE_PREVIEW 0x1 /* preview of image (384x256) */
#define TIFFTAG_DCSBALANCEARRAY 65552 /* color balance values */
#define TIFFTAG_DCSCORRECTMATRIX 65553 /* color correction values */
#define TIFFTAG_DCSGAMMA 65554 /* gamma value */
#define TIFFTAG_DCSTOESHOULDERPTS 65555 /* toe & shoulder points */
#define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */
/* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */
#define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */
#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
/* 65559 is allocated to Oceana Matrix <dev@oceana.com> */
#define TIFFTAG_DCSCLIPRECTANGLE 65559 /* area of image to acquire */
#define TIFFTAG_SGILOGDATAFMT 65560 /* SGILog user data format */
#define SGILOGDATAFMT_FLOAT 0 /* IEEE float samples */
#define SGILOGDATAFMT_16BIT 1 /* 16-bit samples */
#define SGILOGDATAFMT_RAW 2 /* uninterpreted data */
#define SGILOGDATAFMT_8BIT 3 /* 8-bit RGB monitor values */
#define TIFFTAG_SGILOGENCODE 65561 /* SGILog data encoding control*/
#define SGILOGENCODE_NODITHER 0 /* do not dither encoded values*/
#define SGILOGENCODE_RANDITHER 1 /* randomly dither encd values */
#endif /* _TIFF_ */
/* vim: set ts=8 sts=8 sw=8 noet: */

View File

@@ -0,0 +1,501 @@
/* $Id: tiffio.h,v 1.3 2005/06/17 13:57:03 vp153 Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _TIFFIO_
#define _TIFFIO_
/*
* TIFF I/O Library Definitions.
*/
#include "tiff.h"
#include "tiffvers.h"
/*
* TIFF is defined as an incomplete type to hide the
* library's internal data structures from clients.
*/
typedef struct tiff TIFF;
/*
* The following typedefs define the intrinsic size of
* data types used in the *exported* interfaces. These
* definitions depend on the proper definition of types
* in tiff.h. Note also that the varargs interface used
* to pass tag types and values uses the types defined in
* tiff.h directly.
*
* NB: ttag_t is unsigned int and not unsigned short because
* ANSI C requires that the type before the ellipsis be a
* promoted type (i.e. one of int, unsigned int, pointer,
* or double) and because we defined pseudo-tags that are
* outside the range of legal Aldus-assigned tags.
* NB: tsize_t is int32 and not uint32 because some functions
* return -1.
* NB: toff_t is not off_t for many reasons; TIFFs max out at
* 32-bit file offsets being the most important, and to ensure
* that it is unsigned, rather than signed.
*/
typedef uint32 ttag_t; /* directory tag */
typedef uint16 tdir_t; /* directory index */
typedef uint16 tsample_t; /* sample number */
typedef uint32 tstrip_t; /* strip number */
typedef uint32 ttile_t; /* tile number */
typedef int32 tsize_t; /* i/o size in bytes */
typedef void* tdata_t; /* image data ref */
typedef uint32 toff_t; /* file offset */
#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
#define __WIN32__
#endif
/*
* On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
* or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
*
* By default tif_win32.c is assumed on windows if not using the cygwin
* environment.
*/
#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
# if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILIO)
# define USE_WIN32_FILEIO
# endif
#endif
#if defined(USE_WIN32_FILEIO)
# include <windows.h>
# ifdef __WIN32__
DECLARE_HANDLE(thandle_t); /* Win32 file handle */
# else
typedef HFILE thandle_t; /* client data handle */
# endif /* __WIN32__ */
#else
typedef void* thandle_t; /* client data handle */
#endif /* USE_WIN32_FILEIO */
#ifndef NULL
# define NULL (void *)0
#endif
/*
* Flags to pass to TIFFPrintDirectory to control
* printing of data structures that are potentially
* very large. Bit-or these flags to enable printing
* multiple items.
*/
#define TIFFPRINT_NONE 0x0 /* no extra info */
#define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */
#define TIFFPRINT_CURVES 0x2 /* color/gray response curves */
#define TIFFPRINT_COLORMAP 0x4 /* colormap */
#define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */
#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */
#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */
/*
* Colour conversion stuff
*/
/* reference white */
#define D65_X0 (95.0470F)
#define D65_Y0 (100.0F)
#define D65_Z0 (108.8827F)
#define D50_X0 (96.4250F)
#define D50_Y0 (100.0F)
#define D50_Z0 (82.4680F)
/* Structure for holding information about a display device. */
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
typedef struct {
float d_mat[3][3]; /* XYZ -> luminance matrix */
float d_YCR; /* Light o/p for reference white */
float d_YCG;
float d_YCB;
uint32 d_Vrwr; /* Pixel values for ref. white */
uint32 d_Vrwg;
uint32 d_Vrwb;
float d_Y0R; /* Residual light for black pixel */
float d_Y0G;
float d_Y0B;
float d_gammaR; /* Gamma values for the three guns */
float d_gammaG;
float d_gammaB;
} TIFFDisplay;
typedef struct { /* YCbCr->RGB support */
TIFFRGBValue* clamptab; /* range clamping table */
int* Cr_r_tab;
int* Cb_b_tab;
int32* Cr_g_tab;
int32* Cb_g_tab;
int32* Y_tab;
} TIFFYCbCrToRGB;
typedef struct { /* CIE Lab 1976->RGB support */
int range; /* Size of conversion table */
#define CIELABTORGB_TABLE_RANGE 1500
float rstep, gstep, bstep;
float X0, Y0, Z0; /* Reference white point */
TIFFDisplay display;
float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */
float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */
float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */
} TIFFCIELabToRGB;
/*
* RGBA-style image support.
*/
typedef struct _TIFFRGBAImage TIFFRGBAImage;
/*
* The image reading and conversion routines invoke
* ``put routines'' to copy/image/whatever tiles of
* raw image data. A default set of routines are
* provided to convert/copy raw image data to 8-bit
* packed ABGR format rasters. Applications can supply
* alternate routines that unpack the data into a
* different format or, for example, unpack the data
* and draw the unpacked raster on the display.
*/
typedef void (*tileContigRoutine)
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
unsigned char*);
typedef void (*tileSeparateRoutine)
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
/*
* RGBA-reader state.
*/
struct _TIFFRGBAImage {
TIFF* tif; /* image handle */
int stoponerr; /* stop on read error */
int isContig; /* data is packed/separate */
int alpha; /* type of alpha data present */
uint32 width; /* image width */
uint32 height; /* image height */
uint16 bitspersample; /* image bits/sample */
uint16 samplesperpixel; /* image samples/pixel */
uint16 orientation; /* image orientation */
uint16 req_orientation; /* requested orientation */
uint16 photometric; /* image photometric interp */
uint16* redcmap; /* colormap pallete */
uint16* greencmap;
uint16* bluecmap;
/* get image data routine */
int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
union {
void (*any)(TIFFRGBAImage*);
tileContigRoutine contig;
tileSeparateRoutine separate;
} put; /* put decoded strip/tile */
TIFFRGBValue* Map; /* sample mapping array */
uint32** BWmap; /* black&white map */
uint32** PALmap; /* palette image map */
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
int row_offset;
int col_offset;
};
/*
* Macros for extracting components from the
* packed ABGR form returned by TIFFReadRGBAImage.
*/
#define TIFFGetR(abgr) ((abgr) & 0xff)
#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)
#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)
#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)
/*
* A CODEC is a software package that implements decoding,
* encoding, or decoding+encoding of a compression algorithm.
* The library provides a collection of builtin codecs.
* More codecs may be registered through calls to the library
* and/or the builtin implementations may be overridden.
*/
typedef int (*TIFFInitMethod)(TIFF*, int);
typedef struct {
char* name;
uint16 scheme;
TIFFInitMethod init;
} TIFFCodec;
#include <stdio.h>
#include <stdarg.h>
/* share internal LogLuv conversion routines? */
#ifndef LOGLUV_PUBLIC
#define LOGLUV_PUBLIC 1
#endif
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
typedef tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
typedef int (*TIFFCloseProc)(thandle_t);
typedef toff_t (*TIFFSizeProc)(thandle_t);
typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);
typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);
typedef void (*TIFFExtendProc)(TIFF*);
extern const char* TIFFGetVersion(void);
extern const TIFFCodec* TIFFFindCODEC(uint16);
extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
extern void TIFFUnRegisterCODEC(TIFFCodec*);
extern int TIFFIsCODECConfigured(uint16);
extern TIFFCodec* TIFFGetConfiguredCODECs();
extern tdata_t _TIFFmalloc(tsize_t);
extern tdata_t _TIFFrealloc(tdata_t, tsize_t);
extern void _TIFFmemset(tdata_t, int, tsize_t);
extern void _TIFFmemcpy(tdata_t, const tdata_t, tsize_t);
extern int _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);
extern void _TIFFfree(tdata_t);
extern void TIFFCleanup(TIFF*);
extern void TIFFClose(TIFF*);
extern int TIFFFlush(TIFF*);
extern int TIFFFlushData(TIFF*);
extern int TIFFGetField(TIFF*, ttag_t, ...);
extern int TIFFVGetField(TIFF*, ttag_t, va_list);
extern int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);
extern int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);
extern int TIFFReadDirectory(TIFF*);
extern tsize_t TIFFScanlineSize(TIFF*);
extern tsize_t TIFFRasterScanlineSize(TIFF*);
extern tsize_t TIFFStripSize(TIFF*);
extern tsize_t TIFFRawStripSize(TIFF*, tstrip_t);
extern tsize_t TIFFVStripSize(TIFF*, uint32);
extern tsize_t TIFFTileRowSize(TIFF*);
extern tsize_t TIFFTileSize(TIFF*);
extern tsize_t TIFFVTileSize(TIFF*, uint32);
extern uint32 TIFFDefaultStripSize(TIFF*, uint32);
extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
extern int TIFFFileno(TIFF*);
extern int TIFFSetFileno(TIFF*, int);
extern thandle_t TIFFClientdata(TIFF*);
extern thandle_t TIFFSetClientdata(TIFF*, thandle_t);
extern int TIFFGetMode(TIFF*);
extern int TIFFSetMode(TIFF*, int);
extern int TIFFIsTiled(TIFF*);
extern int TIFFIsByteSwapped(TIFF*);
extern int TIFFIsUpSampled(TIFF*);
extern int TIFFIsMSB2LSB(TIFF*);
extern int TIFFIsBigEndian(TIFF*);
extern TIFFReadWriteProc TIFFGetReadProc(TIFF*);
extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
extern TIFFSeekProc TIFFGetSeekProc(TIFF*);
extern TIFFCloseProc TIFFGetCloseProc(TIFF*);
extern TIFFSizeProc TIFFGetSizeProc(TIFF*);
extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
extern uint32 TIFFCurrentRow(TIFF*);
extern tdir_t TIFFCurrentDirectory(TIFF*);
extern tdir_t TIFFNumberOfDirectories(TIFF*);
extern uint32 TIFFCurrentDirOffset(TIFF*);
extern tstrip_t TIFFCurrentStrip(TIFF*);
extern ttile_t TIFFCurrentTile(TIFF*);
extern int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);
extern int TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);
extern int TIFFSetupStrips(TIFF *);
extern int TIFFWriteCheck(TIFF*, int, const char *);
extern int TIFFCreateDirectory(TIFF*);
extern int TIFFLastDirectory(TIFF*);
extern int TIFFSetDirectory(TIFF*, tdir_t);
extern int TIFFSetSubDirectory(TIFF*, uint32);
extern int TIFFUnlinkDirectory(TIFF*, tdir_t);
extern int TIFFSetField(TIFF*, ttag_t, ...);
extern int TIFFVSetField(TIFF*, ttag_t, va_list);
extern int TIFFWriteDirectory(TIFF *);
extern int TIFFCheckpointDirectory(TIFF *);
extern int TIFFRewriteDirectory(TIFF *);
extern int TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);
#if defined(c_plusplus) || defined(__cplusplus)
extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
int = ORIENTATION_BOTLEFT, int = 0);
#else
extern void TIFFPrintDirectory(TIFF*, FILE*, long);
extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
#endif
extern int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );
extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
extern int TIFFRGBAImageOK(TIFF*, char [1024]);
extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
extern void TIFFRGBAImageEnd(TIFFRGBAImage*);
extern TIFF* TIFFOpen(const char*, const char*);
# ifdef __WIN32__
extern TIFF* TIFFOpenW(const wchar_t*, const char*);
# endif /* __WIN32__ */
extern TIFF* TIFFFdOpen(int, const char*, const char*);
extern TIFF* TIFFClientOpen(const char*, const char*,
thandle_t,
TIFFReadWriteProc, TIFFReadWriteProc,
TIFFSeekProc, TIFFCloseProc,
TIFFSizeProc,
TIFFMapFileProc, TIFFUnmapFileProc);
extern const char* TIFFFileName(TIFF*);
extern const char* TIFFSetFileName(TIFF*, const char *);
extern void TIFFError(const char*, const char*, ...);
extern void TIFFWarning(const char*, const char*, ...);
extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
extern ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);
extern int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);
extern ttile_t TIFFNumberOfTiles(TIFF*);
extern tsize_t TIFFReadTile(TIFF*,
tdata_t, uint32, uint32, uint32, tsample_t);
extern tsize_t TIFFWriteTile(TIFF*,
tdata_t, uint32, uint32, uint32, tsample_t);
extern tstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t);
extern tstrip_t TIFFNumberOfStrips(TIFF*);
extern tsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
extern tsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
extern tsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
extern tsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
extern tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
extern tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
extern tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
extern tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
extern void TIFFSetWriteOffset(TIFF*, toff_t);
extern void TIFFSwabShort(uint16*);
extern void TIFFSwabLong(uint32*);
extern void TIFFSwabDouble(double*);
extern void TIFFSwabArrayOfShort(uint16*, unsigned long);
extern void TIFFSwabArrayOfLong(uint32*, unsigned long);
extern void TIFFSwabArrayOfDouble(double*, unsigned long);
extern void TIFFReverseBits(unsigned char *, unsigned long);
extern const unsigned char* TIFFGetBitRevTable(int);
#ifdef LOGLUV_PUBLIC
#define U_NEU 0.210526316
#define V_NEU 0.473684211
#define UVSCALE 410.
extern double LogL16toY(int);
extern double LogL10toY(int);
extern void XYZtoRGB24(float*, uint8*);
extern int uv_decode(double*, double*, int);
extern void LogLuv24toXYZ(uint32, float*);
extern void LogLuv32toXYZ(uint32, float*);
#if defined(c_plusplus) || defined(__cplusplus)
extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
#else
extern int LogL16fromY(double, int);
extern int LogL10fromY(double, int);
extern int uv_encode(double, double, int);
extern uint32 LogLuv24fromXYZ(float*, int);
extern uint32 LogLuv32fromXYZ(float*, int);
#endif
#endif /* LOGLUV_PUBLIC */
/*
** Stuff, related to tag handling and creating custom tags.
*/
extern int TIFFGetTagListCount( TIFF * );
extern ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );
#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
#define TIFF_VARIABLE -1 /* marker for variable length tags */
#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */
#define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */
#define FIELD_CUSTOM 65
typedef struct {
ttag_t field_tag; /* field's tag */
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
short field_writecount; /* write count/TIFF_VARIABLE */
TIFFDataType field_type; /* type of associated data */
unsigned short field_bit; /* bit in fieldsset bit vector */
unsigned char field_oktochange; /* if true, can change while writing */
unsigned char field_passcount; /* if true, pass dir count on set */
char *field_name; /* ASCII name */
} TIFFFieldInfo;
typedef struct _TIFFTagValue {
const TIFFFieldInfo *info;
int count;
void *value;
} TIFFTagValue;
extern void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
extern const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
extern const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,
TIFFDataType);
extern const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);
extern const TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);
typedef int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
typedef int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
typedef struct {
TIFFVSetMethod vsetfield; /* tag set routine */
TIFFVGetMethod vgetfield; /* tag get routine */
TIFFPrintMethod printdir; /* directory print routine */
} TIFFTagMethods;
extern TIFFTagMethods *TIFFAccessTagMethods( TIFF * );
extern void *TIFFGetClientInfo( TIFF *, const char * );
extern void TIFFSetClientInfo( TIFF *, void *, const char * );
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
float *, float *, float *);
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
uint32 *, uint32 *, uint32 *);
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
uint32 *, uint32 *, uint32 *);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* _TIFFIO_ */
/* vim: set ts=8 sts=8 sw=8 noet: */

View File

@@ -0,0 +1,9 @@
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.7.2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
/*
* This define can be used in code that requires
* compilation-related definitions specific to a
* version or versions of the library. Runtime
* version checking should be done based on the
* string returned by TIFFGetVersion.
*/
#define TIFFLIB_VERSION 20050315

View File

@@ -0,0 +1,279 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id: zconf.h,v 1.2 2002/12/01 15:38:38 neurosurg Exp $ */
#ifndef _ZCONF_H
#define _ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateReset z_inflateReset
# define compress z_compress
# define compress2 z_compress2
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#endif
#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
# ifndef __32BIT__
# define __32BIT__
# endif
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#if defined(MSDOS) && !defined(__32BIT__)
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
# define STDC
#endif
#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
# ifndef STDC
# define STDC
# endif
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Old Borland C incorrectly complains about missing returns: */
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
# define NEED_DUMMY_RETURN
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
#endif
#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
# ifndef __32BIT__
# define SMALL_MEDIUM
# define FAR _far
# endif
#endif
/* Compile with -DZLIB_DLL for Windows DLL support */
#if defined(ZLIB_DLL)
# if defined(_WINDOWS) || defined(WINDOWS)
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR _cdecl _export
# endif
# endif
# if defined (__BORLANDC__)
# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
# include <windows.h>
# define ZEXPORT __declspec(dllexport) WINAPI
# define ZEXPORTRVA __declspec(dllexport) WINAPIV
# else
# if defined (_Windows) && defined (__DLL__)
# define ZEXPORT _export
# define ZEXPORTVA _export
# endif
# endif
# endif
#endif
#if defined (__BEOS__)
# if defined (ZLIB_DLL)
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(MACOS) && !defined(TARGET_OS_MAC)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#ifdef HAVE_UNISTD_H
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
# pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND")
# pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(inflate_blocks,"INBL")
# pragma map(inflate_blocks_new,"INBLNE")
# pragma map(inflate_blocks_free,"INBLFR")
# pragma map(inflate_blocks_reset,"INBLRE")
# pragma map(inflate_codes_free,"INCOFR")
# pragma map(inflate_codes,"INCO")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_flush,"INFLU")
# pragma map(inflate_mask,"INMA")
# pragma map(inflate_set_dictionary,"INSEDI2")
# pragma map(inflate_copyright,"INCOPY")
# pragma map(inflate_trees_bits,"INTRBI")
# pragma map(inflate_trees_dynamic,"INTRDY")
# pragma map(inflate_trees_fixed,"INTRFI")
# pragma map(inflate_trees_free,"INTRFR")
#endif
#endif /* _ZCONF_H */