1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
4
This software is provided AS-IS with no warranty, either express or
7
This software is distributed under license and may not be copied, modified
8
or distributed except as expressly authorized under the terms of that
9
license. Refer to licensing information at http://www.artifex.com/
10
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
14
/* $Id: sjpx_luratech.h 8816 2008-07-03 18:25:52Z giles $ */
15
/* Definitions for JPXDecode filter (JPEG 2000) */
16
/* we link to the Luratech CSDK for the actual decoding */
18
#ifndef sjpx_luratech_INCLUDED
19
# define sjpx_luratech_INCLUDED
21
/* Requires scommon.h; strimpl.h if any templates are referenced */
26
/* define colorspace enumeration for the decompressed image data */
28
gs_jpx_cs_unset, /* colorspace hasn't been set */
29
gs_jpx_cs_gray, /* single component grayscale image */
30
gs_jpx_cs_rgb, /* three component (s)RGB image */
31
gs_jpx_cs_cmyk, /* four component CMYK image */
32
gs_jpx_cs_indexed /* PDF image wants raw index values */
35
/* Stream state for the Luratech jp2 codec
36
* We rely on our finalization call to free the
37
* associated handle and pointers.
39
typedef struct stream_jpxd_state_s
41
stream_state_common; /* a define from scommon.h */
42
const gs_memory_t *jpx_memory;
43
JP2_Decomp_Handle handle; /* library decoder handle */
44
unsigned char *inbuf; /* input data buffer */
45
unsigned long inbuf_size;
46
unsigned long inbuf_fill;
47
gs_jpx_cs colorspace; /* requested output colorspace */
48
int ncomp; /* number of image components */
49
int bpc; /* sample bits per component */
50
unsigned long width, height;
52
unsigned char *image; /* decoded image buffer */
53
long offset; /* offset into the image buffer of the next
54
byte to be returned */
58
#define private_st_jpxd_state() \
59
gs_private_st_simple(st_jpxd_state, stream_jpxd_state,\
60
"JPXDecode filter state")
61
extern const stream_template s_jpxd_template;
63
/* JPX encoder internal state */
64
typedef struct stream_jpxe_state_s {
65
stream_state_common; /* inherit base object from scommon.h */
66
JP2_Comp_Handle handle; /* compression library context */
68
/* the following members must be set by the caller: */
69
unsigned long width, height;/* image dimensions */
70
gs_jpx_cs colorspace; /* colorspace of the input image data */
71
unsigned int bpc; /* sample depth of each channel in bits */
73
/* the following members can be optionally set by the caller: */
74
unsigned int quality; /* compressed image quality target; 1-100
75
leave unset for the default */
76
int lossless; /* set to 1 to specify lossless image
77
compression; overrides quality */
79
/* the remainder are handled internally: */
80
unsigned int components; /* number of image channels */
81
unsigned long stride; /* line length in bytes */
82
unsigned char *inbuf; /* input image data buffer */
83
unsigned long insize; /* allocated size of buffer */
84
unsigned long infill; /* bytes written to the buffer */
86
unsigned char *outbuf; /* output data buffer */
87
unsigned long outsize; /* size of the data buffer in bytes */
88
unsigned long outfill; /* bytes written to the buffer */
89
unsigned long offset; /* bytes written from the buffer */
92
#define private_st_jpxe_state() \
93
gs_private_st_simple(st_jpxe_state, stream_jpxe_state, \
94
"jpx encode filter state")
96
extern const stream_template s_jpxe_template;
98
#endif /* sjpx_luratech_INCLUDED */