xref: /plan9/sys/src/cmd/gs/src/sisparam.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1995, 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: sisparam.h,v 1.4 2002/02/21 22:24:54 giles Exp $ */
18 /* Generic image scaling stream definitions */
19 /* Requires strimpl.h */
20 
21 #ifndef sisparam_INCLUDED
22 #  define sisparam_INCLUDED
23 
24 /*
25  * Image scaling streams all use a common set of parameters to define the
26  * input and output data.  That is what we define here.
27  */
28 
29 /* Input values */
30 /*typedef byte PixelIn; */  /* per BitsPerComponentIn */
31 /*#define MaxValueIn 255 */  /* per MaxValueIn */
32 
33 /* Output values */
34 /*typedef byte PixelOut; */  /* per BitsPerComponentOut */
35 /*#define MaxValueOut 255 */  /* per MaxValueOut */
36 
37 /*
38  * The 'support' S of a digital filter is the value such that the filter is
39  * guaranteed to be zero for all arguments outside the range [-S..S].  We
40  * limit the support so that we can put an upper bound on the time required
41  * to compute an output value and on the amount of storage required for
42  * X-filtered input data; this also allows us to use pre-scaled fixed-point
43  * values for the weights if we wish.
44  *
45  * 8x8 pixels should be enough for any reasonable application....
46  */
47 #define LOG2_MAX_ISCALE_SUPPORT 3
48 #define MAX_ISCALE_SUPPORT (1 << LOG2_MAX_ISCALE_SUPPORT)
49 
50 /* Define image scaling stream parameters. */
51 typedef struct stream_image_scale_params_s {
52     int Colors;			/* >= 1 */
53     int BitsPerComponentIn;	/* bits per input value, 8 or 16 */
54     uint MaxValueIn;		/* max value of input component, */
55 				/* 0 < MaxValueIn < 1 << BitsPerComponentIn */
56     int WidthIn, HeightIn;	/* > 0 */
57     int BitsPerComponentOut;	/* bits per output value, 8 or 16 */
58     uint MaxValueOut;		/* max value of output component, */
59 				/* 0 < MaxValueOut < 1 << BitsPerComponentOut*/
60     int WidthOut, HeightOut;	/* > 0 */
61 } stream_image_scale_params_t;
62 
63 /* Define a generic image scaling stream state. */
64 
65 #define stream_image_scale_state_common\
66     stream_state_common;\
67     stream_image_scale_params_t params
68 
69 typedef struct stream_image_scale_state_s {
70     stream_image_scale_state_common;
71 } stream_image_scale_state;
72 
73 #endif /* sisparam_INCLUDED */
74