source: soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith2.h @ 822

Last change on this file since 822 was 821, checked in by meunier, 9 years ago
  • Added several versions of rosenfeld: { SLOW, FAST } x { FEATURES, NO_FEATURES }
  • Added native linux compilation support
  • Added a script to check results natively
  • Started to refactor nrc code
File size: 6.7 KB
Line 
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) \
20t short_name(t,min_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
21
22min_type_matrix(int8_t);
23min_type_matrix(uint8_t);
24min_type_matrix(int16_t);
25min_type_matrix(uint16_t);
26min_type_matrix(int32_t);
27min_type_matrix(uint32_t);
28min_type_matrix(int64_t);
29min_type_matrix(uint64_t);
30min_type_matrix(float);
31min_type_matrix(double);
32
33
34/* ------------------ */
35/* --- Max_matrix --- */
36/* ------------------ */
37
38#define max_type_matrix(t) \
39t short_name(t,max_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
40
41max_type_matrix(int8_t);
42max_type_matrix(uint8_t);
43max_type_matrix(int16_t);
44max_type_matrix(uint16_t);
45max_type_matrix(int32_t);
46max_type_matrix(uint32_t);
47max_type_matrix(int64_t);
48max_type_matrix(uint64_t);
49max_type_matrix(float);
50max_type_matrix(double);
51
52
53/* ------------------ */
54/* --- Add Matrix --- */
55/* ------------------ */
56
57#define add_type_matrix(t) \
58void short_name(t,add_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z)
59
60add_type_matrix(int8_t);
61add_type_matrix(uint8_t);
62add_type_matrix(int16_t);
63add_type_matrix(uint16_t);
64add_type_matrix(int32_t);
65add_type_matrix(uint32_t);
66add_type_matrix(int64_t);
67add_type_matrix(uint64_t);
68add_type_matrix(float);
69add_type_matrix(double);
70
71void add_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  ** Y, rgb8  ** Z);
72void 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) \
80void short_name(t,addc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z)
81
82addc_type_matrix(int8_t);
83addc_type_matrix(uint8_t);
84addc_type_matrix(int16_t);
85addc_type_matrix(uint16_t);
86addc_type_matrix(int32_t);
87addc_type_matrix(uint32_t);
88addc_type_matrix(int64_t);
89addc_type_matrix(uint64_t);
90addc_type_matrix(float);
91addc_type_matrix(double);
92
93void addc_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  y, rgb8  ** Z);
94void 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) \
102void short_name(t,sub_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z)
103
104sub_type_matrix(int8_t);
105sub_type_matrix(uint8_t);
106sub_type_matrix(int16_t);
107sub_type_matrix(uint16_t);
108sub_type_matrix(int32_t);
109sub_type_matrix(uint32_t);
110sub_type_matrix(int64_t);
111sub_type_matrix(uint64_t);
112sub_type_matrix(float);
113sub_type_matrix(double);
114
115void sub_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  ** Y, rgb8  ** Z);
116void 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) \
124void short_name(t,subc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z)
125
126subc_type_matrix(int8_t);
127subc_type_matrix(uint8_t);
128subc_type_matrix(int16_t);
129subc_type_matrix(uint16_t);
130subc_type_matrix(int32_t);
131subc_type_matrix(uint32_t);
132subc_type_matrix(int64_t);
133subc_type_matrix(uint64_t);
134subc_type_matrix(float);
135subc_type_matrix(double);
136
137void subc_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  y, rgb8  ** Z);
138void 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) \
147void short_name(t,mulc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z)
148
149mulc_type_matrix(int8_t);
150mulc_type_matrix(uint8_t);
151mulc_type_matrix(int16_t);
152mulc_type_matrix(uint16_t);
153mulc_type_matrix(int32_t);
154mulc_type_matrix(uint32_t);
155mulc_type_matrix(int64_t);
156mulc_type_matrix(uint64_t);
157mulc_type_matrix(float);
158mulc_type_matrix(double);
159
160void mulc_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  y, rgb8  ** Z);
161void 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) \
171void 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
174mulfrac_type_matrix(int8_t);
175mulfrac_type_matrix(uint8_t);
176mulfrac_type_matrix(int16_t);
177mulfrac_type_matrix(uint16_t);
178mulfrac_type_matrix(int32_t);
179mulfrac_type_matrix(uint32_t);
180mulfrac_type_matrix(int64_t);
181mulfrac_type_matrix(uint64_t);
182mulfrac_type_matrix(float);
183mulfrac_type_matrix(double);
184
185void mulfrack_rgb8matrix (rgb8  ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 b, rgb8  ** m2);
186void 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) \
195void 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
198mulshift_type_matrix(int8_t);
199mulshift_type_matrix(uint8_t);
200mulshift_type_matrix(int16_t);
201mulshift_type_matrix(uint16_t);
202mulshift_type_matrix(int32_t);
203mulshift_type_matrix(uint32_t);
204mulshift_type_matrix(int64_t);
205mulshift_type_matrix(uint64_t);
206mulshift_type_matrix(float);
207mulshift_type_matrix(double);
208
209void mulshift_rgb8matrix (rgb8  **m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb32  a, rgb32  s, rgb8  ** m2);
210void mulshift_rgbx8matrix(rgbx8 **m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx32 a, rgbx32 s, rgbx8 ** m2);
211
212void mulshiftk_rgb8matrix (rgb8  ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 s, rgb8  ** m2);
213void mulshiftk_rgbx8matrix(rgbx8 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 s, rgbx8 ** m2);
214
215void 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
Note: See TracBrowser for help on using the repository browser.