1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/* Copyright (C) 2001-2020 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
Refer to licensing information at http://www.artifex.com or contact
Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato,
CA 94945, U.S.A., +1(415)492-9861, for further information.
*/
/* Definitions for sopj filter (OpenJpeg) */
#ifndef SJPX_OPENJPEG_INCLUDED
#define SJPX_OPENJPEG_INCLUDED
/* Requires scommon.h; strimpl.h if any templates are referenced */
#include "scommon.h"
#include "openjpeg.h"
/* define colorspace enumeration for the decompressed image data */
typedef enum {
gs_jpx_cs_unset, /* colorspace hasn't been set */
gs_jpx_cs_gray, /* single component grayscale image */
gs_jpx_cs_rgb, /* three component (s)RGB image */
gs_jpx_cs_cmyk, /* four component CMYK image */
gs_jpx_cs_indexed /* PDF image wants raw index values */
} gs_jpx_cs;
typedef struct stream_block_s
{
unsigned char *data;
unsigned long size;
unsigned long pos;
unsigned long fill;
} stream_block;
/* Stream state for the jpx codec using openjpeg
* We rely on our finalization call to free the
* associated handle and pointers.
*/
typedef struct stream_jpxd_state_s
{
stream_state_common; /* a define from scommon.h */
opj_codec_t *codec;
opj_stream_t *stream;
opj_image_t *image;
int width, height, bpp;
bool samescale;
gs_jpx_cs colorspace; /* requested output colorspace */
bool alpha; /* return opacity channel */
stream_block sb;
unsigned long totalbytes; /* output total */
unsigned long out_offset; /* output bytes already returned previously */
int **pdata; /* pointers to image data */
int out_numcomps; /* real number of channels to use */
int alpha_comp; /* input index of alpha channel */
int *sign_comps; /* compensate for signed data (signed => unsigned) */
unsigned char *row_data;
} stream_jpxd_state;
extern const stream_template s_jpxd_template;
#endif
|