1 | /* ----------------- */ |
---|
2 | /* -- nrarith2.h --- */ |
---|
3 | /* ----------------- */ |
---|
4 | |
---|
5 | /* |
---|
6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
7 | * Univ Paris Sud XI, CNRS |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef _NRARITH2_H_ |
---|
11 | #define _NRARITH2_H_ |
---|
12 | |
---|
13 | #include "nrc_os_config.h" |
---|
14 | |
---|
15 | /* ------------------ */ |
---|
16 | /* --- Min_matrix --- */ |
---|
17 | /* ------------------ */ |
---|
18 | |
---|
19 | #define min_type_matrix(t) \ |
---|
20 | t short_name(t,min_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) |
---|
21 | |
---|
22 | min_type_matrix(int8_t); |
---|
23 | min_type_matrix(uint8_t); |
---|
24 | min_type_matrix(int16_t); |
---|
25 | min_type_matrix(uint16_t); |
---|
26 | min_type_matrix(int32_t); |
---|
27 | min_type_matrix(uint32_t); |
---|
28 | min_type_matrix(int64_t); |
---|
29 | min_type_matrix(uint64_t); |
---|
30 | min_type_matrix(float); |
---|
31 | min_type_matrix(double); |
---|
32 | |
---|
33 | |
---|
34 | /* ------------------ */ |
---|
35 | /* --- Max_matrix --- */ |
---|
36 | /* ------------------ */ |
---|
37 | |
---|
38 | #define max_type_matrix(t) \ |
---|
39 | t short_name(t,max_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) |
---|
40 | |
---|
41 | max_type_matrix(int8_t); |
---|
42 | max_type_matrix(uint8_t); |
---|
43 | max_type_matrix(int16_t); |
---|
44 | max_type_matrix(uint16_t); |
---|
45 | max_type_matrix(int32_t); |
---|
46 | max_type_matrix(uint32_t); |
---|
47 | max_type_matrix(int64_t); |
---|
48 | max_type_matrix(uint64_t); |
---|
49 | max_type_matrix(float); |
---|
50 | max_type_matrix(double); |
---|
51 | |
---|
52 | |
---|
53 | /* ------------------ */ |
---|
54 | /* --- Add Matrix --- */ |
---|
55 | /* ------------------ */ |
---|
56 | |
---|
57 | #define add_type_matrix(t) \ |
---|
58 | void short_name(t,add_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z) |
---|
59 | |
---|
60 | add_type_matrix(int8_t); |
---|
61 | add_type_matrix(uint8_t); |
---|
62 | add_type_matrix(int16_t); |
---|
63 | add_type_matrix(uint16_t); |
---|
64 | add_type_matrix(int32_t); |
---|
65 | add_type_matrix(uint32_t); |
---|
66 | add_type_matrix(int64_t); |
---|
67 | add_type_matrix(uint64_t); |
---|
68 | add_type_matrix(float); |
---|
69 | add_type_matrix(double); |
---|
70 | |
---|
71 | void add_rgb8matrix (rgb8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8 ** Y, rgb8 ** Z); |
---|
72 | void add_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 ** Y, rgbx8 ** Z); |
---|
73 | |
---|
74 | |
---|
75 | /* -------------------- */ |
---|
76 | /* --- Add constant --- */ |
---|
77 | /* -------------------- */ |
---|
78 | |
---|
79 | #define addc_type_matrix(t) \ |
---|
80 | void short_name(t,addc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z) |
---|
81 | |
---|
82 | addc_type_matrix(int8_t); |
---|
83 | addc_type_matrix(uint8_t); |
---|
84 | addc_type_matrix(int16_t); |
---|
85 | addc_type_matrix(uint16_t); |
---|
86 | addc_type_matrix(int32_t); |
---|
87 | addc_type_matrix(uint32_t); |
---|
88 | addc_type_matrix(int64_t); |
---|
89 | addc_type_matrix(uint64_t); |
---|
90 | addc_type_matrix(float); |
---|
91 | addc_type_matrix(double); |
---|
92 | |
---|
93 | void addc_rgb8matrix (rgb8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8 y, rgb8 ** Z); |
---|
94 | void addc_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 ** Z); |
---|
95 | |
---|
96 | |
---|
97 | /* ----------- */ |
---|
98 | /* --- Sub --- */ |
---|
99 | /* ----------- */ |
---|
100 | |
---|
101 | #define sub_type_matrix(t) \ |
---|
102 | void short_name(t,sub_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z) |
---|
103 | |
---|
104 | sub_type_matrix(int8_t); |
---|
105 | sub_type_matrix(uint8_t); |
---|
106 | sub_type_matrix(int16_t); |
---|
107 | sub_type_matrix(uint16_t); |
---|
108 | sub_type_matrix(int32_t); |
---|
109 | sub_type_matrix(uint32_t); |
---|
110 | sub_type_matrix(int64_t); |
---|
111 | sub_type_matrix(uint64_t); |
---|
112 | sub_type_matrix(float); |
---|
113 | sub_type_matrix(double); |
---|
114 | |
---|
115 | void sub_rgb8matrix (rgb8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8 ** Y, rgb8 ** Z); |
---|
116 | void sub_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 ** Y, rgbx8 ** Z); |
---|
117 | |
---|
118 | |
---|
119 | /* --------------------- */ |
---|
120 | /* --- Sub constante --- */ |
---|
121 | /* --------------------- */ |
---|
122 | |
---|
123 | #define subc_type_matrix(t) \ |
---|
124 | void short_name(t,subc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z) |
---|
125 | |
---|
126 | subc_type_matrix(int8_t); |
---|
127 | subc_type_matrix(uint8_t); |
---|
128 | subc_type_matrix(int16_t); |
---|
129 | subc_type_matrix(uint16_t); |
---|
130 | subc_type_matrix(int32_t); |
---|
131 | subc_type_matrix(uint32_t); |
---|
132 | subc_type_matrix(int64_t); |
---|
133 | subc_type_matrix(uint64_t); |
---|
134 | subc_type_matrix(float); |
---|
135 | subc_type_matrix(double); |
---|
136 | |
---|
137 | void subc_rgb8matrix (rgb8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8 y, rgb8 ** Z); |
---|
138 | void subc_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 ** Z); |
---|
139 | |
---|
140 | /* --------------------- */ |
---|
141 | /* --- Mul constante --- */ |
---|
142 | /* --------------------- */ |
---|
143 | |
---|
144 | // Z = X * y |
---|
145 | |
---|
146 | #define mulc_type_matrix(t) \ |
---|
147 | void short_name(t,mulc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z) |
---|
148 | |
---|
149 | mulc_type_matrix(int8_t); |
---|
150 | mulc_type_matrix(uint8_t); |
---|
151 | mulc_type_matrix(int16_t); |
---|
152 | mulc_type_matrix(uint16_t); |
---|
153 | mulc_type_matrix(int32_t); |
---|
154 | mulc_type_matrix(uint32_t); |
---|
155 | mulc_type_matrix(int64_t); |
---|
156 | mulc_type_matrix(uint64_t); |
---|
157 | mulc_type_matrix(float); |
---|
158 | mulc_type_matrix(double); |
---|
159 | |
---|
160 | void mulc_rgb8matrix (rgb8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8 y, rgb8 ** Z); |
---|
161 | void mulc_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 ** Z); |
---|
162 | |
---|
163 | |
---|
164 | /* --------------- */ |
---|
165 | /* --- MulFrac --- */ |
---|
166 | /* --------------- */ |
---|
167 | |
---|
168 | // m2 = (a * m1) / b |
---|
169 | |
---|
170 | #define mulfrac_type_matrix(t) \ |
---|
171 | void short_name(t,mulfrac_,matrix)(t ** X, int32_t nrl, int32_t nrh, \ |
---|
172 | int32_t ncl, int32_t nch, int32_t a, int32_t b, t ** Y) |
---|
173 | |
---|
174 | mulfrac_type_matrix(int8_t); |
---|
175 | mulfrac_type_matrix(uint8_t); |
---|
176 | mulfrac_type_matrix(int16_t); |
---|
177 | mulfrac_type_matrix(uint16_t); |
---|
178 | mulfrac_type_matrix(int32_t); |
---|
179 | mulfrac_type_matrix(uint32_t); |
---|
180 | mulfrac_type_matrix(int64_t); |
---|
181 | mulfrac_type_matrix(uint64_t); |
---|
182 | mulfrac_type_matrix(float); |
---|
183 | mulfrac_type_matrix(double); |
---|
184 | |
---|
185 | void mulfrack_rgb8matrix (rgb8 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 b, rgb8 ** m2); |
---|
186 | void mulfrack_rgbx8matrix(rgbx8 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 b, rgbx8 ** m2); |
---|
187 | |
---|
188 | |
---|
189 | /* ---------------- */ |
---|
190 | /* --- MulShift --- */ |
---|
191 | /* ---------------- */ |
---|
192 | // m3 = (a * m1) >> s |
---|
193 | |
---|
194 | #define mulshift_type_matrix(t) \ |
---|
195 | void short_name(t,mulshift_,matrix)(t ** X, int32_t nrl, int32_t nrh, \ |
---|
196 | int32_t ncl, int32_t nch, int32_t a, int32_t s, t ** Y) |
---|
197 | |
---|
198 | mulshift_type_matrix(int8_t); |
---|
199 | mulshift_type_matrix(uint8_t); |
---|
200 | mulshift_type_matrix(int16_t); |
---|
201 | mulshift_type_matrix(uint16_t); |
---|
202 | mulshift_type_matrix(int32_t); |
---|
203 | mulshift_type_matrix(uint32_t); |
---|
204 | mulshift_type_matrix(int64_t); |
---|
205 | mulshift_type_matrix(uint64_t); |
---|
206 | mulshift_type_matrix(float); |
---|
207 | mulshift_type_matrix(double); |
---|
208 | |
---|
209 | void mulshift_rgb8matrix (rgb8 **m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb32 a, rgb32 s, rgb8 ** m2); |
---|
210 | void mulshift_rgbx8matrix(rgbx8 **m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx32 a, rgbx32 s, rgbx8 ** m2); |
---|
211 | |
---|
212 | void mulshiftk_rgb8matrix (rgb8 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 s, rgb8 ** m2); |
---|
213 | void mulshiftk_rgbx8matrix(rgbx8 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 s, rgbx8 ** m2); |
---|
214 | |
---|
215 | void quadratic_error_si16matrix(sint16 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, sint16 ** m2, sint16 ** m3); |
---|
216 | |
---|
217 | |
---|
218 | #endif /* _NRARITH2_H_ */ |
---|
219 | |
---|
220 | // Local Variables: |
---|
221 | // tab-width: 4 |
---|
222 | // c-basic-offset: 4 |
---|
223 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
224 | // indent-tabs-mode: nil |
---|
225 | // End: |
---|
226 | |
---|
227 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
228 | |
---|