xref: /plan9/sys/src/cmd/gs/src/gsfunc0.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1997, 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: gsfunc0.h,v 1.7 2005/04/19 07:27:32 igor Exp $ */
18 /* Definitions for FunctionType 0 (Sampled) Functions */
19 
20 #ifndef gsfunc0_INCLUDED
21 #  define gsfunc0_INCLUDED
22 
23 #include "gsfunc.h"
24 #include "gsdsrc.h"
25 
26 /* ---------------- Types and structures ---------------- */
27 
28 /* Define the Function type. */
29 #define function_type_Sampled 0
30 
31 /* Define Sampled functions. */
32 typedef struct gs_function_Sd_params_s {
33     gs_function_params_common;
34     int Order;			/* 1 or 3, optional */
35     gs_data_source_t DataSource;
36     int BitsPerSample;		/* 1, 2, 4, 8, 12, 16, 24, 32 */
37     const float *Encode;	/* 2 x m, optional */
38     const float *Decode;	/* 2 x n, optional */
39     const int *Size;		/* m */
40     double *pole;               /* cached poles (internal data) */
41     int *array_step;		/* pole array element step by dimensions */
42     int *stream_step;		/* sample stream element step by dimensions */
43     int array_size;		/* The number of elements in the pole array. */
44 } gs_function_Sd_params_t;
45 
46 #define private_st_function_Sd()	/* in gsfunc.c */\
47   gs_private_st_composite(st_function_Sd, gs_function_Sd_t,\
48     "gs_function_Sd_t", function_Sd_enum_ptrs, function_Sd_reloc_ptrs)
49 
50 /* ---------------- Procedures ---------------- */
51 
52 /* Allocate and initialize a Sampled function. */
53 int gs_function_Sd_init(gs_function_t ** ppfn,
54 			const gs_function_Sd_params_t * params,
55 			gs_memory_t * mem);
56 
57 /* Free the parameters of a Sampled function. */
58 void gs_function_Sd_free_params(gs_function_Sd_params_t * params,
59 				gs_memory_t * mem);
60 
61 #endif /* gsfunc0_INCLUDED */
62