[772] | 1 | /* ---------------- */ |
---|
| 2 | /* --- nrmem2.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 | #include <stdio.h> |
---|
| 15 | #include <stddef.h> |
---|
| 16 | #include <stdlib.h> |
---|
| 17 | #include <math.h> // fabs |
---|
| 18 | |
---|
| 19 | #include "mypredef.h" |
---|
| 20 | #include "nrtype.h" |
---|
| 21 | #include "nrdef.h" |
---|
| 22 | #include "nrmacro.h" |
---|
| 23 | #include "nrkernel.h" |
---|
| 24 | |
---|
| 25 | #include "nrmem1.h" |
---|
| 26 | #include "nrmem2.h" |
---|
| 27 | |
---|
| 28 | /* |
---|
| 29 | * ------------------ |
---|
| 30 | * --- dub_matrix --- |
---|
| 31 | * ------------------ |
---|
| 32 | */ |
---|
| 33 | /* -------------------------------------------------------------------------------------- */ |
---|
| 34 | IMAGE_EXPORT(void) dup_si8matrix(sint8 **X, long nrl,long nrh,long ncl, long nch, sint8 **Y) |
---|
| 35 | /* -------------------------------------------------------------------------------------- */ |
---|
| 36 | { |
---|
| 37 | int i; |
---|
| 38 | for(i=nrl; i<=nrh; i++) { |
---|
| 39 | dup_si8vector(X[i], ncl, nch, Y[i]); |
---|
| 40 | } |
---|
| 41 | } |
---|
| 42 | /* -------------------------------------------------------------------------------------- */ |
---|
| 43 | IMAGE_EXPORT(void) dup_ui8matrix(uint8 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y) |
---|
| 44 | /* -------------------------------------------------------------------------------------- */ |
---|
| 45 | { |
---|
| 46 | int i; |
---|
| 47 | for(i=nrl; i<=nrh; i++) { |
---|
| 48 | dup_ui8vector(X[i], ncl, nch, Y[i]); |
---|
| 49 | } |
---|
| 50 | } |
---|
| 51 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 52 | IMAGE_EXPORT(void) dup_si16matrix(sint16 **X, long nrl,long nrh,long ncl, long nch, sint16 **Y) |
---|
| 53 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 54 | { |
---|
| 55 | int i; |
---|
| 56 | for(i=nrl; i<=nrh; i++) { |
---|
| 57 | dup_si16vector(X[i], ncl, nch, Y[i]); |
---|
| 58 | } |
---|
| 59 | } |
---|
| 60 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 61 | IMAGE_EXPORT(void) dup_ui16matrix(uint16 **X, long nrl,long nrh,long ncl, long nch, uint16 **Y) |
---|
| 62 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 63 | { |
---|
| 64 | int i; |
---|
| 65 | for(i=nrl; i<=nrh; i++) { |
---|
| 66 | dup_ui16vector(X[i], ncl, nch, Y[i]); |
---|
| 67 | } |
---|
| 68 | } |
---|
| 69 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 70 | IMAGE_EXPORT(void) dup_si32matrix(sint32 **X, long nrl,long nrh,long ncl, long nch, sint32 **Y) |
---|
| 71 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 72 | { |
---|
| 73 | int i; |
---|
| 74 | for(i=nrl; i<=nrh; i++) { |
---|
| 75 | dup_si32vector(X[i], ncl, nch, Y[i]); |
---|
| 76 | } |
---|
| 77 | } |
---|
| 78 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 79 | IMAGE_EXPORT(void) dup_ui32matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint32 **Y) |
---|
| 80 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 81 | { |
---|
| 82 | int i; |
---|
| 83 | for(i=nrl; i<=nrh; i++) { |
---|
| 84 | dup_ui32vector(X[i], ncl, nch, Y[i]); |
---|
| 85 | } |
---|
| 86 | } |
---|
| 87 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 88 | IMAGE_EXPORT(void) dup_si64matrix(sint64 **X, long nrl,long nrh,long ncl, long nch, sint64 **Y) |
---|
| 89 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 90 | { |
---|
| 91 | int i; |
---|
| 92 | for(i=nrl; i<=nrh; i++) { |
---|
| 93 | dup_si64vector(X[i], ncl, nch, Y[i]); |
---|
| 94 | } |
---|
| 95 | } |
---|
| 96 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 97 | IMAGE_EXPORT(void) dup_ui64matrix(uint64 **X, long nrl,long nrh,long ncl, long nch, uint64 **Y) |
---|
| 98 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 99 | { |
---|
| 100 | int i; |
---|
| 101 | for(i=nrl; i<=nrh; i++) { |
---|
| 102 | dup_ui64vector(X[i], ncl, nch, Y[i]); |
---|
| 103 | } |
---|
| 104 | } |
---|
| 105 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 106 | IMAGE_EXPORT(void) dup_f32matrix(float32 **X, long nrl,long nrh,long ncl, long nch, float32 **Y) |
---|
| 107 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 108 | { |
---|
| 109 | int i; |
---|
| 110 | for(i=nrl; i<=nrh; i++) { |
---|
| 111 | dup_f32vector(X[i], ncl, nch, Y[i]); |
---|
| 112 | } |
---|
| 113 | } |
---|
| 114 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 115 | IMAGE_EXPORT(void) dup_f64matrix(float64 **X, long nrl,long nrh,long ncl, long nch, float64 **Y) |
---|
| 116 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 117 | { |
---|
| 118 | int i; |
---|
| 119 | for(i=nrl; i<=nrh; i++) { |
---|
| 120 | dup_f64vector(X[i], ncl, nch, Y[i]); |
---|
| 121 | } |
---|
| 122 | } |
---|
| 123 | /* ------------------------------------------------------------------------------------- */ |
---|
| 124 | IMAGE_EXPORT(void) dup_rgb8matrix(rgb8 **X, long nrl,long nrh,long ncl, long nch, rgb8 **Y) |
---|
| 125 | /* ------------------------------------------------------------------------------------- */ |
---|
| 126 | { |
---|
| 127 | int i; |
---|
| 128 | for(i=nrl; i<=nrh; i++) { |
---|
| 129 | dup_rgb8vector(X[i], ncl, nch, Y[i]); |
---|
| 130 | } |
---|
| 131 | } |
---|
| 132 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 133 | IMAGE_EXPORT(void) dup_rgbx8matrix(rgbx8 **X, long nrl,long nrh,long ncl, long nch, rgbx8 **Y) |
---|
| 134 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 135 | { |
---|
| 136 | int i; |
---|
| 137 | for(i=nrl; i<=nrh; i++) { |
---|
| 138 | dup_rgbx8vector(X[i], ncl, nch, Y[i]); |
---|
| 139 | } |
---|
| 140 | } |
---|
| 141 | /* |
---|
| 142 | * -------------- |
---|
| 143 | * --- resize --- |
---|
| 144 | * -------------- |
---|
| 145 | */ |
---|
| 146 | /* -------------------------------------------------------------------------------- */ |
---|
| 147 | IMAGE_EXPORT(void) resize_si8matrix(sint8 **m, long nrl, long nrh, long ncl, long nch) |
---|
| 148 | /* -------------------------------------------------------------------------------- */ |
---|
| 149 | { |
---|
| 150 | long i, ncol=nch-ncl+1; |
---|
| 151 | |
---|
| 152 | for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; |
---|
| 153 | } |
---|
| 154 | /* -------------------------------------------------------------------------------- */ |
---|
| 155 | IMAGE_EXPORT(void) resize_ui8matrix(uint8 **m, long nrl, long nrh, long ncl, long nch) |
---|
| 156 | /* -------------------------------------------------------------------------------- */ |
---|
| 157 | { |
---|
| 158 | long i, ncol=nch-ncl+1; |
---|
| 159 | |
---|
| 160 | for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; |
---|
| 161 | } |
---|
| 162 | /* ---------------------------------------------------------------------------------- */ |
---|
| 163 | IMAGE_EXPORT(void) resize_si16matrix(sint16 **m, long nrl, long nrh, long ncl, long nch) |
---|
| 164 | /* ---------------------------------------------------------------------------------- */ |
---|
| 165 | { |
---|
| 166 | long i, ncol=nch-ncl+1; |
---|
| 167 | |
---|
| 168 | for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; |
---|
| 169 | } |
---|
| 170 | /* ---------------------------------------------------------------------------------- */ |
---|
| 171 | IMAGE_EXPORT(void) resize_ui16matrix(uint16 **m, long nrl, long nrh, long ncl, long nch) |
---|
| 172 | /* ---------------------------------------------------------------------------------- */ |
---|
| 173 | { |
---|
| 174 | long i, ncol=nch-ncl+1; |
---|
| 175 | |
---|
| 176 | for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; |
---|
| 177 | } |
---|
| 178 | /* ---------------------------------------------------------------------------------- */ |
---|
| 179 | IMAGE_EXPORT(void) resize_si32matrix(sint32 **m, long nrl, long nrh, long ncl, long nch) |
---|
| 180 | /* ---------------------------------------------------------------------------------- */ |
---|
| 181 | { |
---|
| 182 | long i, ncol=nch-ncl+1; |
---|
| 183 | |
---|
| 184 | for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; |
---|
| 185 | } |
---|
| 186 | /* ---------------------------------------------------------------------------------- */ |
---|
| 187 | IMAGE_EXPORT(void) resize_ui32matrix(uint32 **m, long nrl, long nrh, long ncl, long nch) |
---|
| 188 | /* ---------------------------------------------------------------------------------- */ |
---|
| 189 | { |
---|
| 190 | long i, ncol=nch-ncl+1; |
---|
| 191 | |
---|
| 192 | for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; |
---|
| 193 | } |
---|
| 194 | /* ---------------------------------------------------------------------------------- */ |
---|
| 195 | IMAGE_EXPORT(void) resize_f32matrix(float32 **m, long nrl, long nrh, long ncl, long nch) |
---|
| 196 | /* ---------------------------------------------------------------------------------- */ |
---|
| 197 | { |
---|
| 198 | long i, ncol=nch-ncl+1; |
---|
| 199 | |
---|
| 200 | for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; |
---|
| 201 | } |
---|
| 202 | /* ---------------------------------------------------------------------------------- */ |
---|
| 203 | IMAGE_EXPORT(void) resize_f64matrix(float64 **m, long nrl, long nrh, long ncl, long nch) |
---|
| 204 | /* ---------------------------------------------------------------------------------- */ |
---|
| 205 | { |
---|
| 206 | long i, ncol=nch-ncl+1; |
---|
| 207 | |
---|
| 208 | for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; |
---|
| 209 | } |
---|
| 210 | /* -------------------------------------------------------------------------------- */ |
---|
| 211 | IMAGE_EXPORT(void) resize_rgb8matrix(rgb8 **m, long nrl, long nrh, long ncl, long nch) |
---|
| 212 | /* -------------------------------------------------------------------------------- */ |
---|
| 213 | { |
---|
| 214 | long i, ncol=nch-ncl+1; |
---|
| 215 | |
---|
| 216 | for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; |
---|
| 217 | } |
---|
| 218 | /* ---------------------------------------------------------------------------------- */ |
---|
| 219 | IMAGE_EXPORT(void) resize_rgbx8matrix(rgbx8 **m, long nrl, long nrh, long ncl, long nch) |
---|
| 220 | /* ---------------------------------------------------------------------------------- */ |
---|
| 221 | { |
---|
| 222 | long i, ncol=nch-ncl+1; |
---|
| 223 | |
---|
| 224 | for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; |
---|
| 225 | } |
---|
| 226 | /* ---------------- */ |
---|
| 227 | /* -- Convertion -- */ |
---|
| 228 | /* ---------------- */ |
---|
| 229 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 230 | IMAGE_EXPORT(void) convert_si8matrix_si16matrix(sint8 **X, int nrl, int nrh, int ncl, int nch, sint16 **Y) |
---|
| 231 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 232 | { |
---|
| 233 | long i; |
---|
| 234 | for(i=nrl; i<=nrh; i++) { |
---|
| 235 | convert_si8vector_si16vector(X[i], ncl, nch, Y[i]); |
---|
| 236 | } |
---|
| 237 | } |
---|
| 238 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 239 | IMAGE_EXPORT(void) convert_si8matrix_si32matrix(sint8 **X, int nrl, int nrh, int ncl, int nch, sint32 **Y) |
---|
| 240 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 241 | { |
---|
| 242 | long i; |
---|
| 243 | for(i=nrl; i<=nrh; i++) { |
---|
| 244 | convert_si8vector_si32vector(X[i], ncl, nch, Y[i]); |
---|
| 245 | } |
---|
| 246 | } |
---|
| 247 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 248 | IMAGE_EXPORT(void) convert_si8matrix_f32matrix(sint8 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) |
---|
| 249 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 250 | { |
---|
| 251 | long i; |
---|
| 252 | for(i=nrl; i<=nrh; i++) { |
---|
| 253 | convert_si8vector_f32vector(X[i], ncl, nch, Y[i]); |
---|
| 254 | } |
---|
| 255 | } |
---|
| 256 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 257 | IMAGE_EXPORT(void) convert_si8matrix_f64matrix(sint8 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) |
---|
| 258 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 259 | { |
---|
| 260 | long i; |
---|
| 261 | for(i=nrl; i<=nrh; i++) { |
---|
| 262 | convert_si8vector_f64vector(X[i], ncl, nch, Y[i]); |
---|
| 263 | } |
---|
| 264 | } |
---|
| 265 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 266 | IMAGE_EXPORT(void) convert_ui8matrix_ui16matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, uint16 **Y) |
---|
| 267 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 268 | { |
---|
| 269 | long i; |
---|
| 270 | for(i=nrl; i<=nrh; i++) { |
---|
| 271 | convert_ui8vector_ui16vector(X[i], ncl, nch, Y[i]); |
---|
| 272 | } |
---|
| 273 | } |
---|
| 274 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 275 | IMAGE_EXPORT(void) convert_ui8matrix_ui32matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, uint32 **Y) |
---|
| 276 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 277 | { |
---|
| 278 | long i; |
---|
| 279 | for(i=nrl; i<=nrh; i++) { |
---|
| 280 | convert_ui8vector_ui32vector(X[i], ncl, nch, Y[i]); |
---|
| 281 | } |
---|
| 282 | } |
---|
| 283 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 284 | IMAGE_EXPORT(void) convert_ui8matrix_f32matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) |
---|
| 285 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 286 | { |
---|
| 287 | long i; |
---|
| 288 | for(i=nrl; i<=nrh; i++) { |
---|
| 289 | convert_ui8vector_f32vector(X[i], ncl, nch, Y[i]); |
---|
| 290 | } |
---|
| 291 | } |
---|
| 292 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 293 | IMAGE_EXPORT(void) convert_ui8matrix_f64matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) |
---|
| 294 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 295 | { |
---|
| 296 | long i; |
---|
| 297 | for(i=nrl; i<=nrh; i++) { |
---|
| 298 | convert_ui8vector_f64vector(X[i], ncl, nch, Y[i]); |
---|
| 299 | } |
---|
| 300 | } |
---|
| 301 | /* -------------------------------------------------------------------------------------------------- */ |
---|
| 302 | IMAGE_EXPORT(void) convert_ui8matrix_rgb8matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, rgb8 **Y) |
---|
| 303 | /* -------------------------------------------------------------------------------------------------- */ |
---|
| 304 | { |
---|
| 305 | long i; |
---|
| 306 | for(i=nrl; i<=nrh; i++) { |
---|
| 307 | convert_ui8vector_rgb8vector(X[i], ncl, nch, Y[i]); |
---|
| 308 | } |
---|
| 309 | } |
---|
| 310 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 311 | IMAGE_EXPORT(void) convert_ui8matrix_rgbx8matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, rgbx8 **Y) |
---|
| 312 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 313 | { |
---|
| 314 | long i; |
---|
| 315 | for(i=nrl; i<=nrh; i++) { |
---|
| 316 | convert_ui8vector_rgbx8vector(X[i], ncl, nch, Y[i]); |
---|
| 317 | } |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 321 | IMAGE_EXPORT(void) convert_si16matrix_si32matrix(sint16 **X, int nrl, int nrh, int ncl, int nch, sint32 **Y) |
---|
| 322 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 323 | { |
---|
| 324 | long i; |
---|
| 325 | for(i=nrl; i<=nrh; i++) { |
---|
| 326 | convert_si16vector_si32vector(X[i], ncl, nch, Y[i]); |
---|
| 327 | } |
---|
| 328 | } |
---|
| 329 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 330 | IMAGE_EXPORT(void) convert_si16matrix_f32matrix(sint16 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) |
---|
| 331 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 332 | { |
---|
| 333 | long i; |
---|
| 334 | for(i=nrl; i<=nrh; i++) { |
---|
| 335 | convert_si16vector_f32vector(X[i], ncl, nch, Y[i]); |
---|
| 336 | } |
---|
| 337 | } |
---|
| 338 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 339 | IMAGE_EXPORT(void) convert_si16matrix_f64matrix(sint16 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) |
---|
| 340 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 341 | { |
---|
| 342 | long i; |
---|
| 343 | for(i=nrl; i<=nrh; i++) { |
---|
| 344 | convert_si16vector_f64vector(X[i], ncl, nch, Y[i]); |
---|
| 345 | } |
---|
| 346 | } |
---|
| 347 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 348 | IMAGE_EXPORT(void) convert_ui16matrix_ui32matrix(uint16 **X, int nrl, int nrh, int ncl, int nch, uint32 **Y) |
---|
| 349 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 350 | { |
---|
| 351 | long i; |
---|
| 352 | for(i=nrl; i<=nrh; i++) { |
---|
| 353 | convert_ui16vector_ui32vector(X[i], ncl, nch, Y[i]); |
---|
| 354 | } |
---|
| 355 | } |
---|
| 356 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 357 | IMAGE_EXPORT(void) convert_ui16matrix_f32matrix(uint16 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) |
---|
| 358 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 359 | { |
---|
| 360 | long i; |
---|
| 361 | for(i=nrl; i<=nrh; i++) { |
---|
| 362 | convert_ui16vector_f32vector(X[i], ncl, nch, Y[i]); |
---|
| 363 | } |
---|
| 364 | } |
---|
| 365 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 366 | IMAGE_EXPORT(void) convert_ui16matrix_f64matrix(uint16 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) |
---|
| 367 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 368 | { |
---|
| 369 | long i; |
---|
| 370 | for(i=nrl; i<=nrh; i++) { |
---|
| 371 | convert_ui16vector_f64vector(X[i], ncl, nch, Y[i]); |
---|
| 372 | } |
---|
| 373 | } |
---|
| 374 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 375 | IMAGE_EXPORT(void) convert_si32matrix_f32matrix(sint32 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) |
---|
| 376 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 377 | { |
---|
| 378 | long i; |
---|
| 379 | for(i=nrl; i<=nrh; i++) { |
---|
| 380 | convert_si32vector_f32vector(X[i], ncl, nch, Y[i]); |
---|
| 381 | } |
---|
| 382 | } |
---|
| 383 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 384 | IMAGE_EXPORT(void) convert_si32matrix_f64matrix(sint32 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) |
---|
| 385 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 386 | { |
---|
| 387 | long i; |
---|
| 388 | for(i=nrl; i<=nrh; i++) { |
---|
| 389 | convert_si32vector_f64vector(X[i], ncl, nch, Y[i]); |
---|
| 390 | } |
---|
| 391 | } |
---|
| 392 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 393 | IMAGE_EXPORT(void) convert_ui32matrix_f32matrix(uint32 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) |
---|
| 394 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 395 | { |
---|
| 396 | long i; |
---|
| 397 | for(i=nrl; i<=nrh; i++) { |
---|
| 398 | convert_ui32vector_f32vector(X[i], ncl, nch, Y[i]); |
---|
| 399 | } |
---|
| 400 | } |
---|
| 401 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 402 | IMAGE_EXPORT(void) convert_ui32matrix_f64matrix(uint32 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) |
---|
| 403 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 404 | { |
---|
| 405 | long i; |
---|
| 406 | for(i=nrl; i<=nrh; i++) { |
---|
| 407 | convert_ui32vector_f64vector(X[i], ncl, nch, Y[i]); |
---|
| 408 | } |
---|
| 409 | } |
---|
| 410 | /* |
---|
| 411 | * ------------------------- |
---|
| 412 | * --- convert downgrade --- |
---|
| 413 | * ------------------------- |
---|
| 414 | */ |
---|
| 415 | /* --------------------------------------------------------------------------------------------------- */ |
---|
| 416 | IMAGE_EXPORT(void) convert_si16matrix_si8matrix(sint16 **X, int nrl, int nrh, int ncl, int nch, sint8 **Y) |
---|
| 417 | /* --------------------------------------------------------------------------------------------------- */ |
---|
| 418 | { |
---|
| 419 | long i; |
---|
| 420 | for(i=nrl; i<=nrh; i++) { |
---|
| 421 | convert_si16vector_si8vector(X[i], ncl, nch, Y[i]); |
---|
| 422 | } |
---|
| 423 | } |
---|
| 424 | /* --------------------------------------------------------------------------------------------------- */ |
---|
| 425 | IMAGE_EXPORT(void) convert_ui16matrix_ui8matrix(uint16 **X, int nrl, int nrh, int ncl, int nch, uint8 **Y) |
---|
| 426 | /* --------------------------------------------------------------------------------------------------- */ |
---|
| 427 | { |
---|
| 428 | long i; |
---|
| 429 | for(i=nrl; i<=nrh; i++) { |
---|
| 430 | convert_ui16vector_ui8vector(X[i], ncl, nch, Y[i]); |
---|
| 431 | } |
---|
| 432 | } |
---|
| 433 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 434 | IMAGE_EXPORT(void) convert_si32matrix_si8matrix(sint32 **X, int nrl, int nrh, int ncl, int nch, sint8 **Y) |
---|
| 435 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 436 | { |
---|
| 437 | long i; |
---|
| 438 | for(i=nrl; i<=nrh; i++) { |
---|
| 439 | convert_si32vector_si8vector(X[i], ncl, nch, Y[i]); |
---|
| 440 | } |
---|
| 441 | } |
---|
| 442 | /* --------------------------------------------------------------------------------------------------- */ |
---|
| 443 | IMAGE_EXPORT(void) convert_si32matrix_si16matrix(sint32 **X, int nrl, int nrh, int ncl, int nch, sint16 **Y) |
---|
| 444 | /* --------------------------------------------------------------------------------------------------- */ |
---|
| 445 | { |
---|
| 446 | long i; |
---|
| 447 | for(i=nrl; i<=nrh; i++) { |
---|
| 448 | convert_si32vector_si16vector(X[i], ncl, nch, Y[i]); |
---|
| 449 | } |
---|
| 450 | } |
---|
| 451 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 452 | IMAGE_EXPORT(void) convert_ui32matrix_ui8matrix(uint32 **X, int nrl, int nrh, int ncl, int nch, uint8 **Y) |
---|
| 453 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 454 | { |
---|
| 455 | long i; |
---|
| 456 | for(i=nrl; i<=nrh; i++) { |
---|
| 457 | convert_ui32vector_ui8vector(X[i], ncl, nch, Y[i]); |
---|
| 458 | } |
---|
| 459 | } |
---|
| 460 | /* --------------------------------------------------------------------------------------------------- */ |
---|
| 461 | IMAGE_EXPORT(void) convert_ui32matrix_ui16matrix(uint32 **X, int nrl, int nrh, int ncl, int nch, uint16 **Y) |
---|
| 462 | /* --------------------------------------------------------------------------------------------------- */ |
---|
| 463 | { |
---|
| 464 | long i; |
---|
| 465 | for(i=nrl; i<=nrh; i++) { |
---|
| 466 | convert_ui32vector_ui16vector(X[i], ncl, nch, Y[i]); |
---|
| 467 | } |
---|
| 468 | } |
---|
| 469 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 470 | IMAGE_EXPORT(void) convert_f32matrix_si8matrix(float32 **X, int nrl, int nrh, int ncl, int nch, sint8 **Y) |
---|
| 471 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 472 | { |
---|
| 473 | long i; |
---|
| 474 | for(i=nrl; i<=nrh; i++) { |
---|
| 475 | convert_f32vector_si8vector(X[i], ncl, nch, Y[i]); |
---|
| 476 | } |
---|
| 477 | } |
---|
| 478 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 479 | IMAGE_EXPORT(void) convert_f32matrix_ui8matrix(float32 **X, int nrl, int nrh, int ncl, int nch, uint8 **Y) |
---|
| 480 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 481 | { |
---|
| 482 | long i; |
---|
| 483 | for(i=nrl; i<=nrh; i++) { |
---|
| 484 | convert_f32vector_ui8vector(X[i], ncl, nch, Y[i]); |
---|
| 485 | } |
---|
| 486 | } |
---|
| 487 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 488 | IMAGE_EXPORT(void) convert_f32matrix_si16matrix(float32 **X, int nrl, int nrh, int ncl, int nch, sint16 **Y) |
---|
| 489 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 490 | { |
---|
| 491 | long i; |
---|
| 492 | for(i=nrl; i<=nrh; i++) { |
---|
| 493 | convert_f32vector_si16vector(X[i], ncl, nch, Y[i]); |
---|
| 494 | } |
---|
| 495 | } |
---|
| 496 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 497 | IMAGE_EXPORT(void) convert_f32matrix_ui16matrix(float32 **X, int nrl, int nrh, int ncl, int nch, uint16 **Y) |
---|
| 498 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 499 | { |
---|
| 500 | long i; |
---|
| 501 | for(i=nrl; i<=nrh; i++) { |
---|
| 502 | convert_f32vector_ui16vector(X[i], ncl, nch, Y[i]); |
---|
| 503 | } |
---|
| 504 | } |
---|
| 505 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 506 | IMAGE_EXPORT(void) convert_f32matrix_si32matrix(float32 **X, int nrl, int nrh, int ncl, int nch, sint32 **Y) |
---|
| 507 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 508 | { |
---|
| 509 | long i; |
---|
| 510 | for(i=nrl; i<=nrh; i++) { |
---|
| 511 | convert_f32vector_si32vector(X[i], ncl, nch, Y[i]); |
---|
| 512 | } |
---|
| 513 | } |
---|
| 514 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 515 | IMAGE_EXPORT(void) convert_f32matrix_ui32matrix(float32 **X, int nrl, int nrh, int ncl, int nch, uint32 **Y) |
---|
| 516 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 517 | { |
---|
| 518 | long i; |
---|
| 519 | for(i=nrl; i<=nrh; i++) { |
---|
| 520 | convert_f32vector_ui32vector(X[i], ncl, nch, Y[i]); |
---|
| 521 | } |
---|
| 522 | } |
---|
| 523 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 524 | IMAGE_EXPORT(void) convert_f64matrix_si8matrix(float64 **X, int nrl, int nrh, int ncl, int nch, sint8 **Y) |
---|
| 525 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 526 | { |
---|
| 527 | long i; |
---|
| 528 | for(i=nrl; i<=nrh; i++) { |
---|
| 529 | convert_f64vector_si8vector(X[i], ncl, nch, Y[i]); |
---|
| 530 | } |
---|
| 531 | } |
---|
| 532 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 533 | IMAGE_EXPORT(void) convert_f64matrix_ui8matrix(float64 **X, int nrl, int nrh, int ncl, int nch, uint8 **Y) |
---|
| 534 | /* ---------------------------------------------------------------------------------------------------- */ |
---|
| 535 | { |
---|
| 536 | long i; |
---|
| 537 | for(i=nrl; i<=nrh; i++) { |
---|
| 538 | convert_f64vector_ui8vector(X[i], ncl, nch, Y[i]); |
---|
| 539 | } |
---|
| 540 | } |
---|
| 541 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 542 | IMAGE_EXPORT(void) convert_f64matrix_si16matrix(float64 **X, int nrl, int nrh, int ncl, int nch, sint16 **Y) |
---|
| 543 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 544 | { |
---|
| 545 | long i; |
---|
| 546 | for(i=nrl; i<=nrh; i++) { |
---|
| 547 | convert_f64vector_si16vector(X[i], ncl, nch, Y[i]); |
---|
| 548 | } |
---|
| 549 | } |
---|
| 550 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 551 | IMAGE_EXPORT(void) convert_f64matrix_ui16matrix(float64 **X, int nrl, int nrh, int ncl, int nch, uint16 **Y) |
---|
| 552 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 553 | { |
---|
| 554 | long i; |
---|
| 555 | for(i=nrl; i<=nrh; i++) { |
---|
| 556 | convert_f64vector_ui16vector(X[i], ncl, nch, Y[i]); |
---|
| 557 | } |
---|
| 558 | } |
---|
| 559 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 560 | IMAGE_EXPORT(void) convert_f64matrix_si32matrix(float64 **X, int nrl, int nrh, int ncl, int nch, sint32 **Y) |
---|
| 561 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 562 | { |
---|
| 563 | long i; |
---|
| 564 | for(i=nrl; i<=nrh; i++) { |
---|
| 565 | convert_f64vector_si32vector(X[i], ncl, nch, Y[i]); |
---|
| 566 | } |
---|
| 567 | } |
---|
| 568 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 569 | IMAGE_EXPORT(void) convert_f64matrix_ui32matrix(float64 **X, int nrl, int nrh, int ncl, int nch, uint32 **Y) |
---|
| 570 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 571 | { |
---|
| 572 | long i; |
---|
| 573 | for(i=nrl; i<=nrh; i++) { |
---|
| 574 | convert_f64vector_ui32vector(X[i], ncl, nch, Y[i]); |
---|
| 575 | } |
---|
| 576 | } |
---|
| 577 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 578 | IMAGE_EXPORT(void) convert_f64matrix_f32matrix(float64 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) |
---|
| 579 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 580 | { |
---|
| 581 | long i; |
---|
| 582 | for(i=nrl; i<=nrh; i++) { |
---|
| 583 | convert_f64vector_f32vector(X[i], ncl, nch, Y[i]); |
---|
| 584 | } |
---|
| 585 | } |
---|
| 586 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 587 | IMAGE_EXPORT(void) convert_rgb8matrix_ui8matrix(rgb8 **X, long nrl, long nrh, long ncl, long nch, uint8 **Y) |
---|
| 588 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 589 | { |
---|
| 590 | long i; |
---|
| 591 | for(i=nrl; i<=nrh; i++) { |
---|
| 592 | convert_rgb8vector_ui8vector(X[i], ncl, nch, Y[i]); |
---|
| 593 | } |
---|
| 594 | } |
---|
| 595 | /* |
---|
| 596 | * ---------------------- |
---|
| 597 | * --- lowpart_matrix --- |
---|
| 598 | * ---------------------- |
---|
| 599 | */ |
---|
| 600 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 601 | IMAGE_EXPORT(void) lowpart_ui16matrix_ui8matrix(uint16 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y) |
---|
| 602 | /* ------------------------------------------------------------------------------------------------------ */ |
---|
| 603 | { |
---|
| 604 | long i; |
---|
| 605 | |
---|
| 606 | for(i=nrl; i<=nrh; i++) { |
---|
| 607 | lowpart_ui16vector_ui8vector(X[i], ncl,nch, Y[i]); |
---|
| 608 | } |
---|
| 609 | } |
---|
| 610 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 611 | void lowpart_ui32matrix_ui8matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y) |
---|
| 612 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 613 | { |
---|
| 614 | long i; |
---|
| 615 | for(i=nrl; i<=nrh; i++) { |
---|
| 616 | lowpart_ui32vector_ui8vector(X[i], ncl,nch, Y[i]); |
---|
| 617 | } |
---|
| 618 | } |
---|
| 619 | /* |
---|
| 620 | * ------------------- |
---|
| 621 | * --- split-merge --- |
---|
| 622 | * ------------------- |
---|
| 623 | */ |
---|
| 624 | /* ---------------------------------------------------------------------------------------------------------------- */ |
---|
| 625 | IMAGE_EXPORT(void) split_rgb8matrix(rgb8 **X, long nrl, long nrh, long ncl, long nch, uint8 **R, uint8 **G, uint8 **B) |
---|
| 626 | /* ---------------------------------------------------------------------------------------------------------------- */ |
---|
| 627 | { |
---|
| 628 | long i, j; |
---|
| 629 | |
---|
| 630 | for(i=nrl; i<=nrh; i++) { |
---|
| 631 | for(j=ncl; j<=nch; j++) { |
---|
| 632 | split_rgb8vector(X[i], ncl, nch, R[i], G[i], B[i]); |
---|
| 633 | } |
---|
| 634 | } |
---|
| 635 | } |
---|
| 636 | /* ---------------------------------------------------------------------------------------------------------------- */ |
---|
| 637 | IMAGE_EXPORT(void) merge_rgb8matrix(uint8 **R, uint8 **G, uint8 **B, long nrl, long nrh, long ncl, long nch, rgb8 **X) |
---|
| 638 | /* ---------------------------------------------------------------------------------------------------------------- */ |
---|
| 639 | { |
---|
| 640 | long i, j; |
---|
| 641 | |
---|
| 642 | for(i=nrl; i<=nrh; i++) { |
---|
| 643 | for(j=ncl; j<=nch; j++) { |
---|
| 644 | merge_rgb8vector(R[i], G[i], B[i], ncl, nch, X[i]); |
---|
| 645 | } |
---|
| 646 | } |
---|
| 647 | } |
---|