File: hdrl_elemop.h

package info (click to toggle)
cpl-plugin-amber 4.4.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,340 kB
  • sloc: ansic: 89,588; sh: 4,337; makefile: 620; python: 295
file content (238 lines) | stat: -rw-r--r-- 10,368 bytes parent folder | download | duplicates (12)
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
/* $Id: hdrl_elemop.h,v 1.4 2013-10-17 15:44:14 jtaylor Exp $
 *
 * This file is part of the HDRL
 * Copyright (C) 2013 European Southern Observatory
 *
 * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

/*
 * $Author: jtaylor $
 * $Date: 2013-10-17 15:44:14 $
 * $Revision: 1.4 $
 */

#ifndef HDRL_ELEMOP_H
#define HDRL_ELEMOP_H

#ifndef HDRL_USE_PRIVATE
#error This file is not allowed to be included outside of hdrl
#endif

/*-----------------------------------------------------------------------------
                                Includes
 -----------------------------------------------------------------------------*/

#include "hdrl_types.h"
#include <cpl.h>

CPL_BEGIN_DECLS

/*-----------------------------------------------------------------------------
                                Define
 -----------------------------------------------------------------------------*/


/*-----------------------------------------------------------------------------
                            Functions prototypes
 -----------------------------------------------------------------------------*/

/* ---------------------------------------------------------------------------*/
/**
 * @brief add/subtract/multiply/divide two images with error propagation
 *
 * @param a   image, modified in place
 * @param ae  errors of image a, modified in place
 * @param b   image
 * @param be  errors of image b
 *
 * Gaussian error propagation of first order, no accounting correlation
 * besides a == b.
 * Divisions by zero will be marked as bad pixels and set to NAN
 */
/* ---------------------------------------------------------------------------*/
cpl_error_code
hdrl_elemop_image_add_image(cpl_image * a, cpl_image * ae,
                            const cpl_image * b, const cpl_image * be);
cpl_error_code
hdrl_elemop_image_sub_image(cpl_image * a, cpl_image * ae,
                            const cpl_image * b, const cpl_image * be);
cpl_error_code
hdrl_elemop_image_mul_image(cpl_image * a, cpl_image * ae,
                            const cpl_image * b, const cpl_image * be);
cpl_error_code
hdrl_elemop_image_div_image(cpl_image * a, cpl_image * ae,
                            const cpl_image * b, const cpl_image * be);
cpl_error_code
hdrl_elemop_image_pow_image(cpl_image * a, cpl_image * ae,
                            const cpl_image * b, const cpl_image * be);

/* ---------------------------------------------------------------------------*/
/**
 * @brief add/subtract/multiply/divide image and scalar with error propagation
 *
 * @param a   image, modified in place
 * @param ae  errors of image a, modified in place
 * @param b   scalar
 * @param be  error of scalar b
 *
 * Gaussian error propagation of first order, no accounting correlation
 * besides a == b.
 * Divisions by zero will be marked as bad pixels and set to NAN
 */
/* ---------------------------------------------------------------------------*/
cpl_error_code
hdrl_elemop_image_add_scalar(cpl_image * a, cpl_image * ae,
                          const hdrl_data_t b, const hdrl_error_t be);
cpl_error_code
hdrl_elemop_image_sub_scalar(cpl_image * a, cpl_image * ae,
                          const hdrl_data_t b, const hdrl_error_t be);
cpl_error_code
hdrl_elemop_image_mul_scalar(cpl_image * a, cpl_image * ae,
                          const hdrl_data_t b, const hdrl_error_t be);
cpl_error_code
hdrl_elemop_image_div_scalar(cpl_image * a, cpl_image * ae,
                          const hdrl_data_t b, const hdrl_error_t be);
cpl_error_code
hdrl_elemop_image_pow_scalar(cpl_image * a, cpl_image * ae,
                          const hdrl_data_t b, const hdrl_error_t be);
cpl_error_code
hdrl_elemop_image_exp_scalar(cpl_image * a, cpl_image * ae,
                          const hdrl_data_t b, const hdrl_error_t be);
/* ---------------------------------------------------------------------------*/
/**
 * @brief add/subtract/multiply/divide two imagelists and scalar with error
 *        propagation
 *
 * @param a   imagelist, modified in place
 * @param ae  errors of imagelist a, modified in place
 * @param b   imagelist
 * @param be  error of imagelist b
 *
 * Gaussian error propagation of first order, no accounting correlation
 * besides a == b.
 * Divisions by zero will be marked as bad pixels and set to NAN
 */
/* ---------------------------------------------------------------------------*/
cpl_error_code
hdrl_elemop_imagelist_add_imagelist(cpl_imagelist * a, cpl_imagelist * ae,
                   const cpl_imagelist * b, const cpl_imagelist * be);
cpl_error_code
hdrl_elemop_imagelist_sub_imagelist(cpl_imagelist * a, cpl_imagelist * ae,
                   const cpl_imagelist * b, const cpl_imagelist * be);
cpl_error_code
hdrl_elemop_imagelist_mul_imagelist(cpl_imagelist * a, cpl_imagelist * ae,
                   const cpl_imagelist * b, const cpl_imagelist * be);
cpl_error_code
hdrl_elemop_imagelist_div_imagelist(cpl_imagelist * a, cpl_imagelist * ae,
                   const cpl_imagelist * b, const cpl_imagelist * be);
cpl_error_code
hdrl_elemop_imagelist_pow_imagelist(cpl_imagelist * a, cpl_imagelist * ae,
                   const cpl_imagelist * b, const cpl_imagelist * be);

/* ---------------------------------------------------------------------------*/
/**
 * @brief add/subtract/multiply/divide each image of an imagelist and a
 *        scalar from a vector with error propagation
 *
 * @param a   imagelist, modified in place
 * @param ae  errors of imagelist a, modified in place
 * @param b   vector
 * @param be  error of vector b
 *
 * Gaussian error propagation of first order, no accounting correlation
 * besides a == b.
 * Divisions by zero will be marked as bad pixels and set to NAN
 */
/* ---------------------------------------------------------------------------*/
cpl_error_code
hdrl_elemop_imagelist_add_vector(cpl_imagelist * a, cpl_imagelist * ae,
                              const cpl_vector * b, const cpl_vector * be);
cpl_error_code
hdrl_elemop_imagelist_sub_vector(cpl_imagelist * a, cpl_imagelist * ae,
                              const cpl_vector * b, const cpl_vector * be);
cpl_error_code
hdrl_elemop_imagelist_mul_vector(cpl_imagelist * a, cpl_imagelist * ae,
                              const cpl_vector * b, const cpl_vector * be);
cpl_error_code
hdrl_elemop_imagelist_div_vector(cpl_imagelist * a, cpl_imagelist * ae,
                              const cpl_vector * b, const cpl_vector * be);
cpl_error_code
hdrl_elemop_imagelist_pow_vector(cpl_imagelist * a, cpl_imagelist * ae,
                              const cpl_vector * b, const cpl_vector * be);

/* ---------------------------------------------------------------------------*/
/**
 * @brief add/subtract/multiply/divide each image of an imagelist and an image
 *        with error propagation
 *
 * @param a   imagelist, modified in place
 * @param ae  errors of imagelist a, modified in place
 * @param b   image
 * @param be  error of image b
 *
 * Gaussian error propagation of first order, no accounting correlation
 * besides a == b.
 * Divisions by zero will be marked as bad pixels and set to NAN
 */
/* ---------------------------------------------------------------------------*/
cpl_error_code
hdrl_elemop_imagelist_add_image(cpl_imagelist * a, cpl_imagelist * ae,
                             const cpl_image * b, const cpl_image * be);
cpl_error_code
hdrl_elemop_imagelist_sub_image(cpl_imagelist * a, cpl_imagelist * ae,
                             const cpl_image * b, const cpl_image * be);
cpl_error_code
hdrl_elemop_imagelist_mul_image(cpl_imagelist * a, cpl_imagelist * ae,
                             const cpl_image * b, const cpl_image * be);
cpl_error_code
hdrl_elemop_imagelist_div_image(cpl_imagelist * a, cpl_imagelist * ae,
                             const cpl_image * b, const cpl_image * be);
cpl_error_code
hdrl_elemop_imagelist_pow_image(cpl_imagelist * a, cpl_imagelist * ae,
                             const cpl_image * b, const cpl_image * be);

/* see hdrl_elemop.c for doc strings */
cpl_error_code hdrl_elemop_add(hdrl_data_t * a, hdrl_error_t * ea, size_t na,
                            const hdrl_data_t * b, const hdrl_error_t * eb, size_t nb,
                            const cpl_binary * mask);
cpl_error_code hdrl_elemop_sub(hdrl_data_t * a, hdrl_error_t * ea, size_t na,
                            const hdrl_data_t * b, const hdrl_error_t * eb, size_t nb,
                            const cpl_binary * mask);
cpl_error_code hdrl_elemop_mul(hdrl_data_t * a, hdrl_error_t * ea, size_t na,
                            const hdrl_data_t * b, const hdrl_error_t * eb, size_t nb,
                            const cpl_binary * mask);
cpl_error_code hdrl_elemop_div(hdrl_data_t * a, hdrl_error_t * ea, size_t na,
                            const hdrl_data_t * b, const hdrl_error_t * eb, size_t nb,
                            const cpl_binary * mask);
cpl_error_code hdrl_elemop_pow(hdrl_data_t * a, hdrl_error_t * ea, size_t na,
                            const hdrl_data_t * b, const hdrl_error_t * eb, size_t nb,
                            const cpl_binary * mask);
cpl_error_code hdrl_elemop_pow_inverted(
                                hdrl_data_t * a, hdrl_error_t * ea, size_t na,
                            const hdrl_data_t * b, const hdrl_error_t * eb, size_t nb,
                            const cpl_binary * mask);

/*-----------------------------------------------------------------------------
             Private declarations - must not be used outside of hdrl
 -----------------------------------------------------------------------------*/

#ifdef HDRL_USE_PRIVATE

#endif

CPL_END_DECLS

#endif