-
Notifications
You must be signed in to change notification settings - Fork 1
/
funcs.h
149 lines (126 loc) · 5.37 KB
/
funcs.h
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
/*
This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop
Copyright (C) 2003-2009 Toby Thain, [email protected]
Copyright (C) 2018-2024 Daniel Marschall, ViaThinkSoft
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef FUNCS_H_
#define FUNCS_H_
#include <math.h>
// Strict compatibility to Filter Factory by using an alternative
// implementation which is a 100% replica of the Filter Factory 3.0.4
// for Windows.
#ifdef WIN_ENV
// i, u, and v are intentionally not equal to Filter Factory (this has been documented).
//#define use_filterfactory_implementation_i
//#define use_filterfactory_implementation_u
//#define use_filterfactory_implementation_v
// umin, umax, vmin, and vmax are intentionally not equal to Filter Factory (this has been documented).
//#define use_filterfactory_implementation_u_minmax
//#define use_filterfactory_implementation_v_minmax
// U and V are intentionally not equal to Filter Factory (this has been documented).
//#define use_filterfactory_implementation_U
//#define use_filterfactory_implementation_V
// dmin and dmax are intentionally not equal to Filter Factory (this has been documented).
//#define use_filterfactory_implementation_d_minmax
// D is intentionally not equal to Filter Factory (this has been documented).
//#define use_filterfactory_implementation_D
// get(i) is intentionally not equal to Filter Factory (this has been documented).
//#define use_filterfactory_implementation_get
// The following functions are implemented as 100% replicas:
#define use_filterfactory_implementation_rad
#define use_filterfactory_implementation_rnd
#define use_filterfactory_implementation_c2d
#define use_filterfactory_implementation_c2m
#define use_filterfactory_implementation_r2x
#define use_filterfactory_implementation_r2y
#define use_filterfactory_implementation_cos
#define use_filterfactory_implementation_sin
#define use_filterfactory_implementation_tan
#define use_filterfactory_implementation_sqr
#define use_filterfactory_implementation_d
#define use_filterfactory_implementation_m
#define use_filterfactory_implementation_M
#define use_filterfactory_implementation_val
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327
#endif
#include "symtab.h"
#define TANTABSIZE 512
#define COSTABSIZE 1024
void init_trigtab(void);
#define DEG2RAD(x) ((x)*M_PI/180.)
#define RAD2DEG(x) ((x)*180./M_PI)
/* [trig functions return] an integer between -512 and 512, inclusive (Windows)
or -1024 and 1024, inclusive (Mac OS) */
#ifdef WIN_ENV
#define TRIGAMP 512
#else
#define TRIGAMP 1024
#endif
#define FFANGLE(v) ((v)*M_PI/512.)
#define TO_FFANGLE(v) ((v)*512./M_PI)
void initialize_rnd_variables(void);
// Functions:
value_type ff_src(value_type x,value_type y,value_type z);
value_type ff_rad(value_type d,value_type m,value_type z);
value_type ff_ctl(value_type i);
value_type ff_val(value_type i,value_type a,value_type b);
value_type ff_map(value_type i,value_type n);
value_type ff_min(value_type a,value_type b);
value_type ff_max(value_type a,value_type b);
value_type ff_abs(value_type a);
value_type ff_add(value_type a,value_type b,value_type c);
value_type ff_sub(value_type a,value_type b,value_type c);
value_type ff_dif(value_type a,value_type b);
value_type ff_rnd(value_type a,value_type b);
value_type ff_mix(value_type a,value_type b,value_type n,value_type d);
value_type ff_scl(value_type a,value_type il,value_type ih,
value_type ol,value_type oh);
value_type ff_sqr(value_type x);
value_type ff_sin(value_type x);
value_type ff_cos(value_type x);
value_type ff_tan(value_type x);
value_type ff_r2x(value_type d,value_type m);
value_type ff_r2y(value_type d,value_type m);
value_type ff_c2d(value_type d,value_type m);
value_type ff_c2m(value_type d,value_type m);
value_type ff_get(value_type i);
value_type ff_put(value_type v,value_type i);
value_type ff_cnv(value_type m11,value_type m12,value_type m13,
value_type m21,value_type m22,value_type m23,
value_type m31,value_type m32,value_type m33,
value_type d );
value_type ff_rst(value_type seed);
// Variables:
value_type ff_i(void);
value_type ff_u(void);
value_type ff_v(void);
value_type ff_d(void);
value_type ff_M(void);
value_type ff_m(void);
extern value_type min_val_i;
extern value_type max_val_i;
extern value_type min_val_u;
extern value_type max_val_u;
extern value_type min_val_v;
extern value_type max_val_v;
extern value_type min_val_d;
extern value_type max_val_d;
extern value_type valueoffset_channel[4];
extern value_type min_channel_val[4];
extern value_type min_val_c;
extern value_type max_channel_val[4];
extern value_type max_val_c;
#endif