2 |
- |
1 |
/* Copyright (C) 1996, 1999 Aladdin Enterprises. All rights reserved.
|
|
|
2 |
|
|
|
3 |
This software is provided AS-IS with no warranty, either express or
|
|
|
4 |
implied.
|
|
|
5 |
|
|
|
6 |
This software is distributed under license and may not be copied,
|
|
|
7 |
modified or distributed except as expressly authorized under the terms
|
|
|
8 |
of the license contained in the file LICENSE in this distribution.
|
|
|
9 |
|
|
|
10 |
For more information about licensing, please refer to
|
|
|
11 |
http://www.ghostscript.com/licensing/. For information on
|
|
|
12 |
commercial licensing, go to http://www.artifex.com/licensing/ or
|
|
|
13 |
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
|
|
|
14 |
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
/* $Id: spngpx.h,v 1.4 2002/02/21 22:24:54 giles Exp $ */
|
|
|
18 |
/* Definitions for PNGPredictor filters */
|
|
|
19 |
/* Requires strimpl.h */
|
|
|
20 |
|
|
|
21 |
#ifndef spngpx_INCLUDED
|
|
|
22 |
# define spngpx_INCLUDED
|
|
|
23 |
|
|
|
24 |
/* PNGPredictorDecode / PNGPredictorEncode */
|
|
|
25 |
typedef struct stream_PNGP_state_s {
|
|
|
26 |
stream_state_common;
|
|
|
27 |
/* The client sets the following before initialization. */
|
|
|
28 |
int Colors; /* # of colors, 1..16 */
|
|
|
29 |
int BitsPerComponent; /* 1, 2, 4, 8, 16 */
|
|
|
30 |
uint Columns; /* >0 */
|
|
|
31 |
int Predictor; /* 10-15, only relevant for Encode */
|
|
|
32 |
/* The init procedure computes the following. */
|
|
|
33 |
uint row_count; /* # of bytes per row */
|
|
|
34 |
byte end_mask; /* mask for left-over bits in last byte */
|
|
|
35 |
int bpp; /* bytes per pixel */
|
|
|
36 |
byte *prev_row; /* previous row */
|
|
|
37 |
int case_index; /* switch index for case dispatch, */
|
|
|
38 |
/* set dynamically when decoding */
|
|
|
39 |
/* The following are updated dynamically. */
|
|
|
40 |
long row_left; /* # of bytes left in row */
|
|
|
41 |
byte prev[32]; /* previous samples */
|
|
|
42 |
} stream_PNGP_state;
|
|
|
43 |
|
|
|
44 |
#define private_st_PNGP_state() /* in sPNGP.c */\
|
|
|
45 |
gs_private_st_ptrs1(st_PNGP_state, stream_PNGP_state,\
|
|
|
46 |
"PNGPredictorEncode/Decode state", pngp_enum_ptrs, pngp_reloc_ptrs,\
|
|
|
47 |
prev_row)
|
|
|
48 |
#define s_PNGP_set_defaults_inline(ss)\
|
|
|
49 |
((ss)->Colors = 1, (ss)->BitsPerComponent = 8, (ss)->Columns = 1,\
|
|
|
50 |
(ss)->Predictor = 15,\
|
|
|
51 |
/* Clear pointers */\
|
|
|
52 |
(ss)->prev_row = 0)
|
|
|
53 |
extern const stream_template s_PNGPD_template;
|
|
|
54 |
extern const stream_template s_PNGPE_template;
|
|
|
55 |
|
|
|
56 |
#endif /* spngpx_INCLUDED */
|