1 | /* ----------------- */ |
---|
2 | /* --- nrwrap2.c --- */ |
---|
3 | /* ----------------- */ |
---|
4 | |
---|
5 | /* |
---|
6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
7 | * Univ Paris Sud XI, CNRS |
---|
8 | * |
---|
9 | * Distributed under the Boost Software License, Version 1.0 |
---|
10 | * see accompanying file LICENSE.txt or copy it at |
---|
11 | * http://www.boost.org/LICENSE_1_0.txt |
---|
12 | */ |
---|
13 | |
---|
14 | /* |
---|
15 | * 2002/06/11 ajout des fonctions endline |
---|
16 | */ |
---|
17 | #include <stdio.h> |
---|
18 | #include <stddef.h> |
---|
19 | #include <stdlib.h> |
---|
20 | #include <malloc.h> |
---|
21 | #include <math.h> // fabs |
---|
22 | |
---|
23 | #include "mypredef.h" |
---|
24 | #include "nrtype.h" |
---|
25 | #include "nrdef.h" |
---|
26 | #include "nrmacro.h" |
---|
27 | #include "nrkernel.h" |
---|
28 | |
---|
29 | #include "nralloc1.h" |
---|
30 | #include "nralloc2.h" |
---|
31 | #include "nrwrap2.h" |
---|
32 | |
---|
33 | /* --------------------------------------------------------------------- */ |
---|
34 | IMAGE_EXPORT(sint8**) si8matrix_map(long nrl, long nrh, long ncl, long nch) |
---|
35 | /* --------------------------------------------------------------------- */ |
---|
36 | { |
---|
37 | long nrow=nrh-nrl+1; |
---|
38 | sint8 **m; |
---|
39 | |
---|
40 | // allocate pointers to rows |
---|
41 | m=(sint8 **) malloc((size_t)(nrow*sizeof(sint8*))); |
---|
42 | if (!m) nrerror("allocation failure 1 in si8matrix_map()"); |
---|
43 | m -= nrl; |
---|
44 | |
---|
45 | // return pointer to array of pointers to rows |
---|
46 | return m; |
---|
47 | } |
---|
48 | /* --------------------------------------------------------------------- */ |
---|
49 | IMAGE_EXPORT(uint8**) ui8matrix_map(long nrl, long nrh, long ncl, long nch) |
---|
50 | /* --------------------------------------------------------------------- */ |
---|
51 | { |
---|
52 | long nrow=nrh-nrl+1; |
---|
53 | uint8 **m; |
---|
54 | |
---|
55 | // allocate pointers to rows |
---|
56 | m=(uint8 **) malloc((size_t)(nrow*sizeof(uint8*))); |
---|
57 | if (!m) nrerror("allocation failure 1 in ui8matrix_map()"); |
---|
58 | m -= nrl; |
---|
59 | |
---|
60 | // return pointer to array of pointers to rows |
---|
61 | return m; |
---|
62 | } |
---|
63 | /* ----------------------------------------------------------------------- */ |
---|
64 | IMAGE_EXPORT(sint16**) si16matrix_map(long nrl, long nrh, long ncl, long nch) |
---|
65 | /* ----------------------------------------------------------------------- */ |
---|
66 | { |
---|
67 | long nrow=nrh-nrl+1; |
---|
68 | sint16 **m; |
---|
69 | |
---|
70 | // allocate pointers to rows |
---|
71 | m=(sint16 **) malloc((size_t)(nrow*sizeof(sint16*))); |
---|
72 | if (!m) nrerror("allocation failure 1 in si16matrix_map()"); |
---|
73 | m -= nrl; |
---|
74 | |
---|
75 | // return pointer to array of pointers to rows |
---|
76 | return m; |
---|
77 | } |
---|
78 | /* ----------------------------------------------------------------------- */ |
---|
79 | IMAGE_EXPORT(uint16**) ui16matrix_map(long nrl, long nrh, long ncl, long nch) |
---|
80 | /* ----------------------------------------------------------------------- */ |
---|
81 | { |
---|
82 | long nrow=nrh-nrl+1; |
---|
83 | uint16 **m; |
---|
84 | |
---|
85 | // allocate pointers to rows |
---|
86 | m=(uint16 **) malloc((size_t)(nrow*sizeof(uint16*))); |
---|
87 | if (!m) nrerror("allocation failure 1 in ui16matrix_map()"); |
---|
88 | m -= nrl; |
---|
89 | |
---|
90 | // return pointer to array of pointers to rows |
---|
91 | return m; |
---|
92 | } |
---|
93 | /* ----------------------------------------------------------------------- */ |
---|
94 | IMAGE_EXPORT(sint32**) si32matrix_map(long nrl, long nrh, long ncl, long nch) |
---|
95 | /* ----------------------------------------------------------------------- */ |
---|
96 | { |
---|
97 | long nrow=nrh-nrl+1; |
---|
98 | sint32 **m; |
---|
99 | |
---|
100 | // allocate pointers to rows |
---|
101 | m=(sint32 **) malloc((size_t)(nrow*sizeof(sint32*))); |
---|
102 | if (!m) nrerror("allocation failure 1 in si32matrix_map()"); |
---|
103 | m -= nrl; |
---|
104 | |
---|
105 | // return pointer to array of pointers to rows |
---|
106 | return m; |
---|
107 | } |
---|
108 | /* ----------------------------------------------------------------------- */ |
---|
109 | IMAGE_EXPORT(uint32**) ui32matrix_map(long nrl, long nrh, long ncl, long nch) |
---|
110 | /* ----------------------------------------------------------------------- */ |
---|
111 | { |
---|
112 | long nrow=nrh-nrl+1; |
---|
113 | uint32 **m; |
---|
114 | |
---|
115 | // allocate pointers to rows |
---|
116 | m=(uint32 **) malloc((size_t)(nrow*sizeof(uint32*))); |
---|
117 | if (!m) nrerror("allocation failure 1 in ui32matrix_map()"); |
---|
118 | m -= nrl; |
---|
119 | |
---|
120 | // return pointer to array of pointers to rows |
---|
121 | return m; |
---|
122 | } |
---|
123 | /* ----------------------------------------------------------------------- */ |
---|
124 | IMAGE_EXPORT(sint64**) si64matrix_map(long nrl, long nrh, long ncl, long nch) |
---|
125 | /* ----------------------------------------------------------------------- */ |
---|
126 | { |
---|
127 | long nrow=nrh-nrl+1; |
---|
128 | sint64 **m; |
---|
129 | |
---|
130 | // allocate pointers to rows |
---|
131 | m=(sint64 **) malloc((size_t)(nrow*sizeof(sint64*))); |
---|
132 | if (!m) nrerror("allocation failure 1 in si32matrix_map()"); |
---|
133 | m -= nrl; |
---|
134 | |
---|
135 | // return pointer to array of pointers to rows |
---|
136 | return m; |
---|
137 | } |
---|
138 | /* ----------------------------------------------------------------------- */ |
---|
139 | IMAGE_EXPORT(uint64**) ui64matrix_map(long nrl, long nrh, long ncl, long nch) |
---|
140 | /* ----------------------------------------------------------------------- */ |
---|
141 | { |
---|
142 | long nrow=nrh-nrl+1; |
---|
143 | uint64 **m; |
---|
144 | |
---|
145 | // allocate pointers to rows |
---|
146 | m=(uint64 **) malloc((size_t)(nrow*sizeof(uint64*))); |
---|
147 | if (!m) nrerror("allocation failure 1 in ui32matrix_map()"); |
---|
148 | m -= nrl; |
---|
149 | |
---|
150 | // return pointer to array of pointers to rows |
---|
151 | return m; |
---|
152 | } |
---|
153 | /* ----------------------------------------------------------------------- */ |
---|
154 | IMAGE_EXPORT(float32**) f32matrix_map(long nrl, long nrh, long ncl, long nch) |
---|
155 | /* ----------------------------------------------------------------------- */ |
---|
156 | { |
---|
157 | long nrow=nrh-nrl+1; |
---|
158 | float32 **m; |
---|
159 | |
---|
160 | // allocate pointers to rows |
---|
161 | m=(float32 **) malloc((size_t)(nrow*sizeof(float32*))); |
---|
162 | if (!m) nrerror("allocation failure 1 in f32matrix_map()"); |
---|
163 | m -= nrl; |
---|
164 | |
---|
165 | // return pointer to array of pointers to rows |
---|
166 | return m; |
---|
167 | } |
---|
168 | /* ----------------------------------------------------------------------- */ |
---|
169 | IMAGE_EXPORT(float64**) matrix_f64map(long nrl, long nrh, long ncl, long nch) |
---|
170 | /* ----------------------------------------------------------------------- */ |
---|
171 | { |
---|
172 | long nrow=nrh-nrl+1; |
---|
173 | float64 **m; |
---|
174 | |
---|
175 | // allocate pointers to rows |
---|
176 | m=(float64 **) malloc((size_t)(nrow*sizeof(float64*))); |
---|
177 | if (!m) nrerror("allocation failure 1 in matrix_f64map()"); |
---|
178 | m -= nrl; |
---|
179 | |
---|
180 | // return pointer to array of pointers to rows |
---|
181 | return m; |
---|
182 | } |
---|
183 | /* --------------------------------------------------------------------- */ |
---|
184 | IMAGE_EXPORT(rgb8**) rgb8matrix_map(long nrl, long nrh, long ncl, long nch) |
---|
185 | /* --------------------------------------------------------------------- */ |
---|
186 | { |
---|
187 | long nrow=nrh-nrl+1; |
---|
188 | rgb8 **m; |
---|
189 | |
---|
190 | // allocate pointers to rows |
---|
191 | m=(rgb8**) malloc((size_t)(nrow*sizeof(rgb8*))); |
---|
192 | if (!m) nrerror("allocation failure 1 in rgb8matrix_map()"); |
---|
193 | m -= nrl; |
---|
194 | |
---|
195 | // return pointer to array of pointers to rows |
---|
196 | return m; |
---|
197 | } |
---|
198 | /* ----------------------------------------------------------------------- */ |
---|
199 | IMAGE_EXPORT(rgbx8**) rgbx8matrix_map(long nrl, long nrh, long ncl, long nch) |
---|
200 | /* ----------------------------------------------------------------------- */ |
---|
201 | { |
---|
202 | long nrow=nrh-nrl+1; |
---|
203 | rgbx8 **m; |
---|
204 | |
---|
205 | // allocate pointers to rows |
---|
206 | m=(rgbx8**) malloc((size_t)(nrow*sizeof(rgbx8*))); |
---|
207 | if (!m) nrerror("allocation failure 1 in rgbx8matrix_map()"); |
---|
208 | m -= nrl; |
---|
209 | |
---|
210 | // return pointer to array of pointers to rows |
---|
211 | return m; |
---|
212 | } |
---|
213 | /* --------------------------------------------------------------------------------------------------------------------- */ |
---|
214 | IMAGE_EXPORT(sint8 **) si8matrix_map_1D_pitch(sint8 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
215 | /* --------------------------------------------------------------------------------------------------------------------- */ |
---|
216 | { |
---|
217 | long i; |
---|
218 | |
---|
219 | // map rows and set pointers to them |
---|
220 | m[nrl]= (sint8*) data_1D; |
---|
221 | m[nrl] -= ncl; |
---|
222 | |
---|
223 | for(i=nrl+1;i<=nrh;i++) m[i] = m[i-1] + pitch; |
---|
224 | |
---|
225 | // return pointer to array of pointers to rows |
---|
226 | return m; |
---|
227 | } |
---|
228 | /* --------------------------------------------------------------------------------------------------------------------- */ |
---|
229 | IMAGE_EXPORT(uint8 **) ui8matrix_map_1D_pitch(uint8 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
230 | /* --------------------------------------------------------------------------------------------------------------------- */ |
---|
231 | { |
---|
232 | long i; |
---|
233 | |
---|
234 | // map rows and set pointers to them |
---|
235 | m[nrl]= (uint8*) data_1D; |
---|
236 | m[nrl] -= ncl; |
---|
237 | |
---|
238 | for(i=nrl+1;i<=nrh;i++) m[i] = m[i-1] + pitch; |
---|
239 | |
---|
240 | // return pointer to array of pointers to rows |
---|
241 | return m; |
---|
242 | } |
---|
243 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
244 | IMAGE_EXPORT(sint16**) si16matrix_map_1D_pitch(sint16 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
245 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
246 | { |
---|
247 | long i; |
---|
248 | uint8 *p; // must be 8-bit pointer |
---|
249 | |
---|
250 | // map rows and set pointers to them |
---|
251 | m[nrl]= (sint16*) data_1D; |
---|
252 | m[nrl] -= ncl; |
---|
253 | |
---|
254 | //for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1] + pitch; |
---|
255 | p = (uint8*) m[nrl]; |
---|
256 | for(i=nrl+1;i<=nrh;i++) { |
---|
257 | p += pitch; |
---|
258 | m[i] = (sint16*) p; |
---|
259 | } |
---|
260 | |
---|
261 | // return pointer to array of pointers to rows |
---|
262 | return m; |
---|
263 | } |
---|
264 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
265 | IMAGE_EXPORT(uint16**) ui16matrix_map_1D_pitch(uint16 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
266 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
267 | { |
---|
268 | long i; |
---|
269 | uint8 *p; // must be 8-bit pointer |
---|
270 | |
---|
271 | // map rows and set pointers to them |
---|
272 | m[nrl]= (uint16*) data_1D; |
---|
273 | m[nrl] -= ncl; |
---|
274 | |
---|
275 | //for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1] + pitch; |
---|
276 | p = (uint8*) m[nrl]; |
---|
277 | for(i=nrl+1;i<=nrh;i++) { |
---|
278 | p += pitch; |
---|
279 | m[i] = (uint16*) p; |
---|
280 | } |
---|
281 | |
---|
282 | // return pointer to array of pointers to rows |
---|
283 | return m; |
---|
284 | } |
---|
285 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
286 | IMAGE_EXPORT(sint32**) si32matrix_map_1D_pitch(sint32 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
287 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
288 | { |
---|
289 | long i; |
---|
290 | uint8 *p; // must be 8-bit pointer |
---|
291 | |
---|
292 | // map rows and set pointers to them |
---|
293 | m[nrl]= (sint32*) data_1D; |
---|
294 | m[nrl] -= ncl; |
---|
295 | |
---|
296 | //for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1] + pitch; |
---|
297 | p = (uint8*) m[nrl]; |
---|
298 | for(i=nrl+1;i<=nrh;i++) { |
---|
299 | p += pitch; |
---|
300 | m[i] = (sint32*) p; |
---|
301 | } |
---|
302 | |
---|
303 | // return pointer to array of pointers to rows |
---|
304 | return m; |
---|
305 | } |
---|
306 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
307 | IMAGE_EXPORT(uint32**) ui32matrix_map_1D_pitch(uint32 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
308 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
309 | { |
---|
310 | long i; |
---|
311 | uint8 *p; // must be 8-bit pointer |
---|
312 | |
---|
313 | // map rows and set pointers to them |
---|
314 | m[nrl]= (uint32*) data_1D; |
---|
315 | m[nrl] -= ncl; |
---|
316 | |
---|
317 | //for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1] + pitch; |
---|
318 | p = (uint8*) m[nrl]; |
---|
319 | for(i=nrl+1;i<=nrh;i++) { |
---|
320 | p += pitch; |
---|
321 | m[i] = (uint32*) p; |
---|
322 | } |
---|
323 | |
---|
324 | // return pointer to array of pointers to rows |
---|
325 | return m; |
---|
326 | } |
---|
327 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
328 | IMAGE_EXPORT(sint64**) si64matrix_map_1D_pitch(sint64 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
329 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
330 | { |
---|
331 | long i; |
---|
332 | uint8 *p; // must be 8-bit pointer |
---|
333 | |
---|
334 | // map rows and set pointers to them |
---|
335 | m[nrl]= (sint64*) data_1D; |
---|
336 | m[nrl] -= ncl; |
---|
337 | |
---|
338 | //for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1] + pitch; |
---|
339 | p = (uint8*) m[nrl]; |
---|
340 | for(i=nrl+1;i<=nrh;i++) { |
---|
341 | p += pitch; |
---|
342 | m[i] = (sint64*) p; |
---|
343 | } |
---|
344 | |
---|
345 | // return pointer to array of pointers to rows |
---|
346 | return m; |
---|
347 | } |
---|
348 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
349 | IMAGE_EXPORT(uint64**) ui64matrix_map_1D_pitch(uint64 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
350 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
351 | { |
---|
352 | long i; |
---|
353 | uint8 *p; // must be 8-bit pointer |
---|
354 | |
---|
355 | // map rows and set pointers to them |
---|
356 | m[nrl]= (uint64*) data_1D; |
---|
357 | m[nrl] -= ncl; |
---|
358 | |
---|
359 | //for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1] + pitch; |
---|
360 | p = (uint8*) m[nrl]; |
---|
361 | for(i=nrl+1;i<=nrh;i++) { |
---|
362 | p += pitch; |
---|
363 | m[i] = (uint64*) p; |
---|
364 | } |
---|
365 | |
---|
366 | // return pointer to array of pointers to rows |
---|
367 | return m; |
---|
368 | } |
---|
369 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
370 | IMAGE_EXPORT(float32**) f32matrix_map_1D_pitch(float32 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
371 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
372 | { |
---|
373 | long i; |
---|
374 | uint8 *p; // must be 8-bit pointer |
---|
375 | |
---|
376 | // map rows and set pointers to them |
---|
377 | m[nrl]= (float32*) data_1D; |
---|
378 | m[nrl] -= ncl; |
---|
379 | |
---|
380 | //for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1] + pitch; |
---|
381 | p = (uint8*) m[nrl]; |
---|
382 | for(i=nrl+1;i<=nrh;i++) { |
---|
383 | p += pitch; |
---|
384 | m[i] = (float32*) p; |
---|
385 | } |
---|
386 | |
---|
387 | // return pointer to array of pointers to rows |
---|
388 | return m; |
---|
389 | } |
---|
390 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
391 | IMAGE_EXPORT(float64**) f64matrix_map_1D_pitch(float64 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
392 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
393 | { |
---|
394 | long i; |
---|
395 | uint8 *p; // must be 8-bit pointer |
---|
396 | |
---|
397 | // map rows and set pointers to them |
---|
398 | m[nrl]= (float64*) data_1D; |
---|
399 | m[nrl] -= ncl; |
---|
400 | |
---|
401 | //for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1] + pitch; |
---|
402 | p = (uint8*) m[nrl]; |
---|
403 | for(i=nrl+1;i<=nrh;i++) { |
---|
404 | p += pitch; |
---|
405 | m[i] = (float64*) p; |
---|
406 | } |
---|
407 | |
---|
408 | // return pointer to array of pointers to rows |
---|
409 | return m; |
---|
410 | } |
---|
411 | /* -------------------------------------------------------------------------------------------------------------------- */ |
---|
412 | IMAGE_EXPORT(rgb8**) rgb8matrix_map_1D_pitch(rgb8 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
413 | /* -------------------------------------------------------------------------------------------------------------------- */ |
---|
414 | { |
---|
415 | long i; |
---|
416 | uint8 *p; // must be 8-bit pointer |
---|
417 | |
---|
418 | // map rows and set pointers to them |
---|
419 | m[nrl]= (rgb8*) data_1D; |
---|
420 | m[nrl] -= ncl; |
---|
421 | |
---|
422 | //for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1] + pitch; |
---|
423 | p = (uint8*) m[nrl]; |
---|
424 | for(i=nrl+1;i<=nrh;i++) { |
---|
425 | p += pitch; |
---|
426 | m[i] = (rgb8*) p; |
---|
427 | } |
---|
428 | |
---|
429 | // return pointer to array of pointers to rows |
---|
430 | return m; |
---|
431 | } |
---|
432 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
433 | IMAGE_EXPORT(rgbx8**) rgbx8matrix_map_1D_pitch(rgbx8 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
434 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
435 | { |
---|
436 | long i; |
---|
437 | uint8 *p; // must be 8-bit pointer |
---|
438 | |
---|
439 | // map rows and set pointers to them |
---|
440 | m[nrl]= (rgbx8*) data_1D; |
---|
441 | m[nrl] -= ncl; |
---|
442 | |
---|
443 | //for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1] + pitch; |
---|
444 | p = (uint8*) m[nrl]; |
---|
445 | for(i=nrl+1;i<=nrh;i++) { |
---|
446 | p += pitch; |
---|
447 | m[i] = (rgbx8*) p; |
---|
448 | } |
---|
449 | |
---|
450 | // return pointer to array of pointers to rows |
---|
451 | return m; |
---|
452 | } |
---|
453 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
454 | IMAGE_EXPORT(sint8**) si8matrix_remap_1D_pitch(sint8 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
455 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
456 | { |
---|
457 | m[nrl] += ncl; |
---|
458 | return si8matrix_map_1D_pitch(m, nrl, nrh, ncl, nch, data_1D, pitch); |
---|
459 | } |
---|
460 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
461 | IMAGE_EXPORT(uint8**) ui8matrix_remap_1D_pitch(uint8 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
462 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
463 | { |
---|
464 | m[nrl] += ncl; |
---|
465 | return ui8matrix_map_1D_pitch(m, nrl, nrh, ncl, nch, data_1D, pitch); |
---|
466 | } |
---|
467 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
468 | IMAGE_EXPORT(sint16**) si16matrix_remap_1D_pitch(sint16 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
469 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
470 | { |
---|
471 | m[nrl] += ncl; |
---|
472 | return si16matrix_map_1D_pitch(m, nrl, nrh, ncl, nch, data_1D, pitch); |
---|
473 | } |
---|
474 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
475 | IMAGE_EXPORT(uint16**) ui16matrix_remap_1D_pitch(uint16 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
476 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
477 | { |
---|
478 | m[nrl] += ncl; |
---|
479 | return ui16matrix_map_1D_pitch(m, nrl, nrh, ncl, nch, data_1D, pitch); |
---|
480 | } |
---|
481 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
482 | IMAGE_EXPORT(sint32**) si32matrix_remap_1D_pitch(sint32 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
483 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
484 | { |
---|
485 | m[nrl] += ncl; |
---|
486 | return si32matrix_map_1D_pitch(m, nrl, nrh, ncl, nch, data_1D, pitch); |
---|
487 | } |
---|
488 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
489 | IMAGE_EXPORT(uint32**) ui32matrix_remap_1D_pitch(uint32 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
490 | /* ---------------------------------------------------------------------------------------------------------------------- */ |
---|
491 | { |
---|
492 | m[nrl] += ncl; |
---|
493 | return ui32matrix_map_1D_pitch(m, nrl, nrh, ncl, nch, data_1D, pitch); |
---|
494 | } |
---|
495 | /* --------------------------------------------------------------------------------------------------------------------------- */ |
---|
496 | IMAGE_EXPORT(float32**) f32matrix_remap_1D_pitch(float32 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
497 | /* --------------------------------------------------------------------------------------------------------------------------- */ |
---|
498 | { |
---|
499 | m[nrl] += ncl; |
---|
500 | return f32matrix_map_1D_pitch(m, nrl, nrh, ncl, nch, data_1D, pitch); |
---|
501 | } |
---|
502 | /* --------------------------------------------------------------------------------------------------------------------------- */ |
---|
503 | IMAGE_EXPORT(float64**) f64matrix_remap_1D_pitch(float64 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
504 | /* --------------------------------------------------------------------------------------------------------------------------- */ |
---|
505 | { |
---|
506 | m[nrl] += ncl; |
---|
507 | return f64matrix_map_1D_pitch(m, nrl, nrh, ncl, nch, data_1D, pitch); |
---|
508 | } |
---|
509 | /* --------------------------------------------------------------------------------------------------------------------- */ |
---|
510 | IMAGE_EXPORT(rgb8**) rgb8matrix_remap_1D_pitch(rgb8 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
511 | /* --------------------------------------------------------------------------------------------------------------------- */ |
---|
512 | { |
---|
513 | m[nrl] += ncl; |
---|
514 | return rgb8matrix_map_1D_pitch(m, nrl, nrh, ncl, nch, data_1D, pitch); |
---|
515 | } |
---|
516 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
517 | IMAGE_EXPORT(rgbx8**) rgbx8matrix_remap_1D_pitch(rgbx8 **m, long nrl, long nrh, long ncl, long nch, void *data_1D, long pitch) |
---|
518 | /* ----------------------------------------------------------------------------------------------------------------------- */ |
---|
519 | { |
---|
520 | m[nrl] += ncl; |
---|
521 | return rgbx8matrix_map_1D_pitch(m, nrl, nrh, ncl, nch, data_1D, pitch); |
---|
522 | } |
---|
523 | /* |
---|
524 | * --------------- |
---|
525 | * free_matrix_map |
---|
526 | * --------------- |
---|
527 | */ |
---|
528 | /* ---------------------------------------------------------------------------------- */ |
---|
529 | IMAGE_EXPORT(void) free_si8matrix_map(sint8 **m, long nrl, long nrh, long ncl, long nch) |
---|
530 | /* ---------------------------------------------------------------------------------- */ |
---|
531 | { |
---|
532 | free((FREE_ARG)(m+nrl)); |
---|
533 | } |
---|
534 | /* ---------------------------------------------------------------------------------- */ |
---|
535 | IMAGE_EXPORT(void) free_ui8matrix_map(uint8 **m, long nrl, long nrh, long ncl, long nch) |
---|
536 | /* ---------------------------------------------------------------------------------- */ |
---|
537 | { |
---|
538 | free((FREE_ARG)(m+nrl)); |
---|
539 | } |
---|
540 | /* ------------------------------------------------------------------------------------ */ |
---|
541 | IMAGE_EXPORT(void) free_si16matrix_map(sint16 **m, long nrl, long nrh, long ncl, long nch) |
---|
542 | /* ------------------------------------------------------------------------------------ */ |
---|
543 | { |
---|
544 | free((FREE_ARG)(m+nrl)); |
---|
545 | } |
---|
546 | /* ------------------------------------------------------------------------------------ */ |
---|
547 | IMAGE_EXPORT(void) free_ui16matrix_map(uint16 **m, long nrl, long nrh, long ncl, long nch) |
---|
548 | /* ------------------------------------------------------------------------------------ */ |
---|
549 | { |
---|
550 | free((FREE_ARG)(m+nrl)); |
---|
551 | } |
---|
552 | /* ------------------------------------------------------------------------------------ */ |
---|
553 | IMAGE_EXPORT(void) free_si32matrix_map(sint32 **m, long nrl, long nrh, long ncl, long nch) |
---|
554 | /* ------------------------------------------------------------------------------------ */ |
---|
555 | { |
---|
556 | free((FREE_ARG)(m+nrl)); |
---|
557 | } |
---|
558 | /* ------------------------------------------------------------------------------------ */ |
---|
559 | IMAGE_EXPORT(void) free_ui32matrix_map(uint32 **m, long nrl, long nrh, long ncl, long nch) |
---|
560 | /* ------------------------------------------------------------------------------------ */ |
---|
561 | { |
---|
562 | free((FREE_ARG)(m+nrl)); |
---|
563 | } |
---|
564 | /* ------------------------------------------------------------------------------------ */ |
---|
565 | IMAGE_EXPORT(void) free_si64matrix_map(sint64 **m, long nrl, long nrh, long ncl, long nch) |
---|
566 | /* ------------------------------------------------------------------------------------ */ |
---|
567 | { |
---|
568 | free((FREE_ARG)(m+nrl)); |
---|
569 | } |
---|
570 | /* ------------------------------------------------------------------------------------ */ |
---|
571 | IMAGE_EXPORT(void) free_ui64matrix_map(uint64 **m, long nrl, long nrh, long ncl, long nch) |
---|
572 | /* ------------------------------------------------------------------------------------ */ |
---|
573 | { |
---|
574 | free((FREE_ARG)(m+nrl)); |
---|
575 | } |
---|
576 | /* ---------------------------------------------------------------------------------- */ |
---|
577 | IMAGE_EXPORT(void) free_rgb8matrix_map(rgb8 **m, long nrl, long nrh, long ncl, long nch) |
---|
578 | /* ---------------------------------------------------------------------------------- */ |
---|
579 | { |
---|
580 | free((FREE_ARG)(m+nrl)); |
---|
581 | } |
---|
582 | /* ------------------------------------------------------------------------------------ */ |
---|
583 | IMAGE_EXPORT(void) free_rgbx8matrix_map(rgbx8 **m, long nrl, long nrh, long ncl, long nch) |
---|
584 | /* ------------------------------------------------------------------------------------ */ |
---|
585 | { |
---|
586 | free((FREE_ARG)(m+nrl)); |
---|
587 | } |
---|
588 | |
---|