1 /* Copyright (C) 1994, 1995, 1999 artofcode LLC.  All rights reserved.
2 
3   This program is free software; you can redistribute it and/or modify it
4   under the terms of the GNU General Public License as published by the
5   Free Software Foundation; either version 2 of the License, or (at your
6   option) any later version.
7 
8   This program is distributed in the hope that it will be useful, but
9   WITHOUT ANY WARRANTY; without even the implied warranty of
10   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   General Public License for more details.
12 
13   You should have received a copy of the GNU General Public License along
14   with this program; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA, 02111-1307.
16 
17 */
18 
19 /*$Id: spdiffx.h,v 1.2.6.1.2.1 2003/01/17 00:49:05 giles Exp $ */
20 /* Definitions for PixelDifference filters */
21 /* Requires strimpl.h */
22 
23 #ifndef spdiffx_INCLUDED
24 #  define spdiffx_INCLUDED
25 
26 /*
27  * Define the maximum value for Colors.  This must be at least 4, but can
28  * be arbitrarily large: the only cost is a larger stream state structure.
29  */
30 #define s_PDiff_max_Colors 16
31 
32 /* PixelDifferenceDecode / PixelDifferenceEncode */
33 typedef struct stream_PDiff_state_s {
34     stream_state_common;
35     /* The client sets the following before initialization. */
36     int Colors;			/* # of colors, 1..s_PDiff_max_Colors */
37     int BitsPerComponent;	/* 1, 2, 4, 8 */
38     int Columns;
39     /* The init procedure computes the following. */
40     uint row_count;		/* # of bytes per row */
41     byte end_mask;		/* mask for left-over bits in last byte */
42     int case_index;		/* switch index for case dispatch */
43     /* The following are updated dynamically. */
44     uint row_left;		/* # of bytes left in row */
45     byte prev[s_PDiff_max_Colors];	/* previous sample */
46 } stream_PDiff_state;
47 
48 #define private_st_PDiff_state()	/* in spdiff.c */\
49   gs_private_st_simple(st_PDiff_state, stream_PDiff_state,\
50     "PixelDifferenceEncode/Decode state")
51 #define s_PDiff_set_defaults_inline(ss)\
52   ((ss)->Colors = 1, (ss)->BitsPerComponent = 8, (ss)->Columns = 1)
53 extern const stream_template s_PDiffD_template;
54 extern const stream_template s_PDiffE_template;
55 
56 #endif /* spdiffx_INCLUDED */
57