File: other_dispatch.c

package info (click to toggle)
vips 8.4.5-1%2Bdeb9u1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 25,724 kB
  • sloc: ansic: 102,605; cpp: 57,527; sh: 4,957; xml: 3,317; python: 3,105; makefile: 1,089; perl: 40
file content (364 lines) | stat: -rw-r--r-- 8,156 bytes parent folder | download
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
/* Function dispatch tables for other.
 *
 * J. Cupitt, 8/2/95
 */

/*

    This file is part of VIPS.
    
    VIPS is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301  USA

 */

/*

    These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk

 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>

#include <stdio.h>

#include <vips/vips.h>

/* Args for im_sines.
 */
static im_arg_desc sines_args[] = {
	IM_OUTPUT_IMAGE( "out" ),
	IM_INPUT_INT( "xsize" ),
	IM_INPUT_INT( "ysize" ),
	IM_INPUT_DOUBLE( "horfreq" ),
	IM_INPUT_DOUBLE( "verfreq" )
};

/* Call im_sines via arg vector.
 */
static int
sines_vec( im_object *argv )
{
	int xsize = *((int *) argv[1]);
	int ysize = *((int *) argv[2]);
	double horfreq = *((double *) argv[3]);
	double verfreq = *((double *) argv[4]);

	return( im_sines( argv[0], xsize, ysize, horfreq, verfreq ) );
}

/* Description of im_sines.
 */ 
static im_function sines_desc = {
	"im_sines", 			/* Name */
	"generate 2D sine image",
	0,				/* Flags */
	sines_vec, 			/* Dispatch function */
	IM_NUMBER( sines_args ), 	/* Size of arg list */
	sines_args 			/* Arg list */
};

/* Args for im_eye.
 */
static im_arg_desc eye_args[] = {
	IM_OUTPUT_IMAGE( "out" ),
	IM_INPUT_INT( "xsize" ),
	IM_INPUT_INT( "ysize" ),
	IM_INPUT_DOUBLE( "factor" )
};

/* Call im_eye via arg vector.
 */
static int
eye_vec( im_object *argv )
{
	int xsize = *((int *) argv[1]);
	int ysize = *((int *) argv[2]);
	double factor = *((double *) argv[3]);

	return( im_eye( argv[0], xsize, ysize, factor ) );
}

/* Description of im_eye.
 */ 
static im_function eye_desc = {
	"im_eye", 			/* Name */
	"generate IM_BANDFMT_UCHAR [0,255] frequency/amplitude image",
	0,				/* Flags */
	eye_vec, 			/* Dispatch function */
	IM_NUMBER( eye_args ), 		/* Size of arg list */
	eye_args 			/* Arg list */
};

/* Call im_feye via arg vector.
 */
static int
feye_vec( im_object *argv )
{
	int xsize = *((int *) argv[1]);
	int ysize = *((int *) argv[2]);
	double factor = *((double *) argv[3]);

	return( im_feye( argv[0], xsize, ysize, factor ) );
}

/* Description of im_feye.
 */ 
static im_function feye_desc = {
	"im_feye", 			/* Name */
	"generate IM_BANDFMT_FLOAT [-1,1] frequency/amplitude image",
	0,				/* Flags */
	feye_vec, 			/* Dispatch function */
	IM_NUMBER( eye_args ), 		/* Size of arg list */
	eye_args 			/* Arg list */
};

/* Args for im_zone.
 */
static im_arg_desc zone_args[] = {
	IM_OUTPUT_IMAGE( "out" ),
	IM_INPUT_INT( "size" )
};

/* Call im_zone via arg vector.
 */
static int
zone_vec( im_object *argv )
{
	int size = *((int *) argv[1]);

	return( im_zone( argv[0], size ) );
}

/* Description of im_zone.
 */ 
static im_function zone_desc = {
	"im_zone", 			/* Name */
	"generate IM_BANDFMT_UCHAR [0,255] zone plate image", /* Description */
	0,				/* Flags */
	zone_vec, 			/* Dispatch function */
	IM_NUMBER( zone_args ), 		/* Size of arg list */
	zone_args 			/* Arg list */
};

/* Call im_fzone via arg vector.
 */
static int
fzone_vec( im_object *argv )
{
	int size = *((int *) argv[1]);

	return( im_fzone( argv[0], size ) );
}

/* Description of im_fzone.
 */ 
static im_function fzone_desc = {
	"im_fzone", 			/* Name */
	"generate IM_BANDFMT_FLOAT [-1,1] zone plate image", /* Description */
	0,				/* Flags */
	fzone_vec, 			/* Dispatch function */
	IM_NUMBER( zone_args ), 		/* Size of arg list */
	zone_args 			/* Arg list */
};

/* Args for im_benchmark.
 */
static im_arg_desc benchmark_args[] = {
	IM_INPUT_IMAGE( "in" ),
	IM_OUTPUT_IMAGE( "out" )
};

/* Call im_benchmark via arg vector.
 */
static int
benchmark_vec( im_object *argv )
{
	return( im_benchmarkn( argv[0], argv[1], 1 ) );
}

/* Description of im_benchmark.
 */ 
static im_function benchmark_desc = {
	"im_benchmark", 		/* Name */
	"do something complicated for testing", /* Description */
	IM_FN_PIO,			/* Flags */
	benchmark_vec, 			/* Dispatch function */
	IM_NUMBER( benchmark_args ), 	/* Size of arg list */
	benchmark_args 			/* Arg list */
};

/* Args for im_benchmark2.
 */
static im_arg_desc benchmark2_args[] = {
        IM_INPUT_IMAGE( "in" ),
        IM_OUTPUT_DOUBLE( "value" )
};

/* Call im_benchmark2 via arg vector.
 */
static int
benchmark2_vec( im_object *argv )
{
        double f;

        if( im_benchmark2( argv[0], &f ) )
                return( -1 );

        *((double *) argv[1]) = f;

        return( 0 );
}

/* Description of im_benchmark2.
 */
static im_function benchmark2_desc = {
        "im_benchmark2",                /* Name */
        "do something complicated for testing", /* Description */
        IM_FN_PIO,                      /* Flags */
        benchmark2_vec,                 /* Dispatch function */
        IM_NUMBER( benchmark2_args ),   /* Size of arg list */
        benchmark2_args                 /* Arg list */
};

/* Args for im_benchmarkn.
 */
static im_arg_desc benchmarkn_args[] = {
	IM_INPUT_IMAGE( "in" ),
	IM_OUTPUT_IMAGE( "out" ),
	IM_INPUT_INT( "n" )
};

/* Call im_benchmarkn via arg vector.
 */
static int
benchmarkn_vec( im_object *argv )
{
	int n = *((int *) argv[2]);

	return( im_benchmarkn( argv[0], argv[1], n ) );
}

/* Description of im_benchmarkn.
 */ 
static im_function benchmarkn_desc = {
	"im_benchmarkn", 		/* Name */
	"do something complicated for testing", /* Description */
	IM_FN_PIO,			/* Flags */
	benchmarkn_vec, 		/* Dispatch function */
	IM_NUMBER( benchmarkn_args ), 	/* Size of arg list */
	benchmarkn_args 		/* Arg list */
};

/* Args for im_grey.
 */
static im_arg_desc grey_args[] = {
	IM_OUTPUT_IMAGE( "out" ),
	IM_INPUT_INT( "xsize" ),
	IM_INPUT_INT( "ysize" )
};

/* Call im_grey via arg vector.
 */
static int
grey_vec( im_object *argv )
{
	int xsize = *((int *) argv[1]);
	int ysize = *((int *) argv[2]);

	return( im_grey( argv[0], xsize, ysize ) );
}

/* Description of im_grey.
 */ 
static im_function grey_desc = {
	"im_grey", 			/* Name */
	"generate IM_BANDFMT_UCHAR [0,255] grey scale image", /* Description */
	0,				/* Flags */
	grey_vec, 			/* Dispatch function */
	IM_NUMBER( grey_args ), 		/* Size of arg list */
	grey_args 			/* Arg list */
};

/* Call im_fgrey via arg vector.
 */
static int
fgrey_vec( im_object *argv )
{
	int xsize = *((int *) argv[1]);
	int ysize = *((int *) argv[2]);

	return( im_fgrey( argv[0], xsize, ysize ) );
}

/* Description of im_fgrey.
 */ 
static im_function fgrey_desc = {
	"im_fgrey", 			/* Name */
	"generate IM_BANDFMT_FLOAT [0,1] grey scale image", /* Description */
	0,				/* Flags */
	fgrey_vec, 			/* Dispatch function */
	IM_NUMBER( grey_args ), 		/* Size of arg list */
	grey_args 			/* Arg list */
};

/* Call im_make_xy via arg vector.
 */
static int
make_xy_vec( im_object *argv )
{
	int xsize = *((int *) argv[1]);
	int ysize = *((int *) argv[2]);

	return( im_make_xy( argv[0], xsize, ysize ) );
}

/* Description of im_make_xy.
 */ 
static im_function make_xy_desc = {
	"im_make_xy", 			/* Name */
	"generate image with pixel value equal to coordinate", /* Description */
	0,				/* Flags */
	make_xy_vec, 			/* Dispatch function */
	IM_NUMBER( grey_args ), 	/* Size of arg list */
	grey_args 			/* Arg list */
};

/* Package up all these functions.
 */
static im_function *other_list[] = {
	&benchmark_desc,
	&benchmark2_desc,
	&benchmarkn_desc,
	&eye_desc,
	&grey_desc,
	&feye_desc,
	&fgrey_desc,
	&fzone_desc,
	&make_xy_desc,
	&sines_desc,
	&zone_desc
};

/* Package of functions.
 */
im_package im__other = {
	"other",
	IM_NUMBER( other_list ),
	other_list
};