File: cimg_dispatch.c

package info (click to toggle)
vips 8.14.1-3%2Bdeb12u2
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 35,912 kB
  • sloc: ansic: 165,449; cpp: 10,987; python: 4,462; xml: 4,212; sh: 471; perl: 40; makefile: 23
file content (162 lines) | stat: -rw-r--r-- 4,617 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
/* Function dispatch tables for cimg wrappers.
 */

/*

    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 <glib/gi18n-lib.h>

#include <stdio.h>

#include <vips/vips.h>
#include <vips/vips7compat.h>

static int
greyc_vec( im_object *argv )
{
        IMAGE *src = (IMAGE *) argv[0];
        IMAGE *dst = (IMAGE *) argv[1];

        int iterations = *((int *) argv[2]); 
	double amplitude = *((double *) argv[3]);   
	double sharpness = *((double *) argv[4]); 
	double anisotropy = *((double *) argv[5]); 
	double alpha = *((double *) argv[6]); 
	double sigma = *((double *) argv[7]);
	double dl = *((double *) argv[8]); 
	double da = *((double *) argv[9]); 
	double gauss_prec = *((double *) argv[10]); 
	int interpolation = *((int *) argv[11]); 
	int fast_approx = *((int *) argv[12]); 

        if( im_greyc_mask( src, dst, NULL,
		iterations,
		amplitude, sharpness, anisotropy,
		alpha, sigma, 
		dl, da, gauss_prec, 
		interpolation, fast_approx ) )
		return( -1 );

        return( 0 );
}

static im_arg_desc greyc_arg_types[] = {
        IM_INPUT_IMAGE( "src" ),
        IM_OUTPUT_IMAGE( "dst" ),
        IM_INPUT_INT( "iterations" ),
	IM_INPUT_DOUBLE( "amplitude" ),
	IM_INPUT_DOUBLE( "sharpness" ),
	IM_INPUT_DOUBLE( "anisotropy" ),
	IM_INPUT_DOUBLE( "alpha" ),
	IM_INPUT_DOUBLE( "sigma" ),
	IM_INPUT_DOUBLE( "dl" ),
	IM_INPUT_DOUBLE( "da" ),
	IM_INPUT_DOUBLE( "gauss_prec" ),
	IM_INPUT_INT( "interpolation" ),
	IM_INPUT_INT( "fast_approx" )
};

static im_function greyc_desc = {
        "im_greyc", 			/* Name */
        "noise-removing filter",      	/* Description */
        (im_fn_flags) (IM_FN_TRANSFORM | IM_FN_PIO),/* Flags */
        greyc_vec,           		/* Dispatch function */
        IM_NUMBER( greyc_arg_types ),	/* Size of arg list */
        greyc_arg_types       		/* Arg list */
};

static int
greyc_mask_vec( im_object *argv )
{
        IMAGE *src = (IMAGE *) argv[0];
        IMAGE *dst = (IMAGE *) argv[1];
        IMAGE *mask = (IMAGE *) argv[2];

        int iterations = *((int *) argv[3]); 
	double amplitude = *((double *) argv[4]);   
	double sharpness = *((double *) argv[5]); 
	double anisotropy = *((double *) argv[6]); 
	double alpha = *((double *) argv[7]); 
	double sigma = *((double *) argv[8]);
	double dl = *((double *) argv[9]); 
	double da = *((double *) argv[10]); 
	double gauss_prec = *((double *) argv[11]); 
	int interpolation = *((int *) argv[12]); 
	int fast_approx = *((int *) argv[13]); 

        if( im_greyc_mask( src, dst, mask,
		iterations,
		amplitude, sharpness, anisotropy,
		alpha, sigma, 
		dl, da, gauss_prec, 
		interpolation, fast_approx ) )
		return( -1 );

        return( 0 );
}

static im_arg_desc greyc_mask_arg_types[] = {
        IM_INPUT_IMAGE( "src" ),
        IM_OUTPUT_IMAGE( "dst" ),
        IM_INPUT_IMAGE( "mask" ),
        IM_INPUT_INT( "iterations" ),
	IM_INPUT_DOUBLE( "amplitude" ),
	IM_INPUT_DOUBLE( "sharpness" ),
	IM_INPUT_DOUBLE( "anisotropy" ),
	IM_INPUT_DOUBLE( "alpha" ),
	IM_INPUT_DOUBLE( "sigma" ),
	IM_INPUT_DOUBLE( "dl" ),
	IM_INPUT_DOUBLE( "da" ),
	IM_INPUT_DOUBLE( "gauss_prec" ),
	IM_INPUT_INT( "interpolation" ),
	IM_INPUT_INT( "fast_approx" )
};

static im_function greyc_mask_desc = {
        "im_greyc_mask",     		/* Name */
        "noise-removing filter, with a mask", /* Description */
        (im_fn_flags) (IM_FN_TRANSFORM | IM_FN_PIO),/* Flags */
        greyc_mask_vec,           	/* Dispatch function */
        IM_NUMBER( greyc_mask_arg_types ),/* Size of arg list */
        greyc_mask_arg_types       	/* Arg list */
};

static im_function *function_list[] = {
	&greyc_desc,
	&greyc_mask_desc
};

/* Package of functions.
 */
im_package im__cimg = {
	"cimg",
	IM_NUMBER( function_list ),
	function_list
};