[772] | 1 | /* ---------------- */ |
---|
| 2 | /* --- nrmem1.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 | |
---|
| 27 | /* |
---|
| 28 | * ----------- |
---|
| 29 | * --- dup --- |
---|
| 30 | * ----------- |
---|
| 31 | */ |
---|
| 32 | /* ---------------------------------------------------------------- */ |
---|
| 33 | IMAGE_EXPORT(void) dup_si8vector(sint8 *X, long nl, long nh, sint8 *Y) |
---|
| 34 | /* ---------------------------------------------------------------- */ |
---|
| 35 | { |
---|
| 36 | int i; |
---|
| 37 | for(i=nl; i<=nh; i++) { |
---|
| 38 | Y[i] = X[i]; |
---|
| 39 | } |
---|
| 40 | } |
---|
| 41 | /* ---------------------------------------------------------------- */ |
---|
| 42 | IMAGE_EXPORT(void) dup_ui8vector(uint8 *X, long nl, long nh, uint8 *Y) |
---|
| 43 | /* ---------------------------------------------------------------- */ |
---|
| 44 | { |
---|
| 45 | int i; |
---|
| 46 | for(i=nl; i<=nh; i++) { |
---|
| 47 | Y[i] = X[i]; |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | /* ------------------------------------------------------------------- */ |
---|
| 51 | IMAGE_EXPORT(void) dup_si16vector(sint16 *X, long nl, long nh, sint16 *Y) |
---|
| 52 | /* ------------------------------------------------------------------- */ |
---|
| 53 | { |
---|
| 54 | int i; |
---|
| 55 | for(i=nl; i<=nh; i++) { |
---|
| 56 | Y[i] = X[i]; |
---|
| 57 | } |
---|
| 58 | } |
---|
| 59 | /* ------------------------------------------------------------------- */ |
---|
| 60 | IMAGE_EXPORT(void) dup_ui16vector(uint16 *X, long nl, long nh, uint16 *Y) |
---|
| 61 | /* ------------------------------------------------------------------- */ |
---|
| 62 | { |
---|
| 63 | int i; |
---|
| 64 | for(i=nl; i<=nh; i++) { |
---|
| 65 | Y[i] = X[i]; |
---|
| 66 | } |
---|
| 67 | } |
---|
| 68 | /* -------------------------------------------------------------------- */ |
---|
| 69 | IMAGE_EXPORT(void) dup_si32vector(sint32 *X, long nl, long nh, sint32 *Y) |
---|
| 70 | /* -------------------------------------------------------------------- */ |
---|
| 71 | { |
---|
| 72 | int i; |
---|
| 73 | for(i=nl; i<=nh; i++) { |
---|
| 74 | Y[i] = X[i]; |
---|
| 75 | } |
---|
| 76 | } |
---|
| 77 | /* ------------------------------------------------------------------- */ |
---|
| 78 | IMAGE_EXPORT(void) dup_ui32vector(uint32 *X, long nl, long nh, uint32 *Y) |
---|
| 79 | /* ------------------------------------------------------------------- */ |
---|
| 80 | { |
---|
| 81 | int i; |
---|
| 82 | for(i=nl; i<=nh; i++) { |
---|
| 83 | Y[i] = X[i]; |
---|
| 84 | } |
---|
| 85 | } |
---|
| 86 | /* -------------------------------------------------------------------- */ |
---|
| 87 | IMAGE_EXPORT(void) dup_si64vector(sint64 *X, long nl, long nh, sint64 *Y) |
---|
| 88 | /* -------------------------------------------------------------------- */ |
---|
| 89 | { |
---|
| 90 | int i; |
---|
| 91 | for(i=nl; i<=nh; i++) { |
---|
| 92 | Y[i] = X[i]; |
---|
| 93 | } |
---|
| 94 | } |
---|
| 95 | /* ------------------------------------------------------------------- */ |
---|
| 96 | IMAGE_EXPORT(void) dup_ui64vector(uint64 *X, long nl, long nh, uint64 *Y) |
---|
| 97 | /* ------------------------------------------------------------------- */ |
---|
| 98 | { |
---|
| 99 | int i; |
---|
| 100 | for(i=nl; i<=nh; i++) { |
---|
| 101 | Y[i] = X[i]; |
---|
| 102 | } |
---|
| 103 | } |
---|
| 104 | /* -------------------------------------------------------------------- */ |
---|
| 105 | IMAGE_EXPORT(void) dup_f32vector(float32 *X, long nl, long nh, float32 *Y) |
---|
| 106 | /* -------------------------------------------------------------------- */ |
---|
| 107 | { |
---|
| 108 | int i; |
---|
| 109 | for(i=nl; i<=nh; i++) { |
---|
| 110 | Y[i] = X[i]; |
---|
| 111 | } |
---|
| 112 | } |
---|
| 113 | /* -------------------------------------------------------------------- */ |
---|
| 114 | IMAGE_EXPORT(void) dup_f64vector(float64 *X, long nl, long nh, float64 *Y) |
---|
| 115 | /* -------------------------------------------------------------------- */ |
---|
| 116 | { |
---|
| 117 | int i; |
---|
| 118 | for(i=nl; i<=nh; i++) { |
---|
| 119 | Y[i] = X[i]; |
---|
| 120 | } |
---|
| 121 | } |
---|
| 122 | /* --------------------------------------------------------------- */ |
---|
| 123 | IMAGE_EXPORT(void) dup_rgb8vector(rgb8 *X, long nl, long nh, rgb8 *Y) |
---|
| 124 | /* --------------------------------------------------------------- */ |
---|
| 125 | { |
---|
| 126 | int i; |
---|
| 127 | for(i=nl; i<=nh; i++) { |
---|
| 128 | Y[i] = X[i]; |
---|
| 129 | } |
---|
| 130 | } |
---|
| 131 | /* ------------------------------------------------------------------ */ |
---|
| 132 | IMAGE_EXPORT(void) dup_rgbx8vector(rgbx8 *X, long nl, long nh, rgbx8 *Y) |
---|
| 133 | /* ------------------------------------------------------------------ */ |
---|
| 134 | { |
---|
| 135 | int i; |
---|
| 136 | for(i=nl; i<=nh; i++) { |
---|
| 137 | Y[i] = X[i]; |
---|
| 138 | } |
---|
| 139 | } |
---|
| 140 | /* |
---|
| 141 | * -------------------- |
---|
| 142 | * --- split_vector --- |
---|
| 143 | * -------------------- |
---|
| 144 | */ |
---|
| 145 | /* -------------------------------------------------------------------------------------- */ |
---|
| 146 | IMAGE_EXPORT(void) split_rgb8vector(rgb8 *X, long nl, long nh, uint8 *R, uint8 *G, uint8 *B) |
---|
| 147 | /* -------------------------------------------------------------------------------------- */ |
---|
| 148 | { |
---|
| 149 | long i; |
---|
| 150 | rgb8 x; |
---|
| 151 | for(i=nl; i<=nh; i++) { |
---|
| 152 | x = X[i]; |
---|
| 153 | R[i] = x.r; |
---|
| 154 | G[i] = x.g; |
---|
| 155 | B[i] = x.b; |
---|
| 156 | } |
---|
| 157 | } |
---|
| 158 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 159 | IMAGE_EXPORT(void) split_rgb32vector(rgb32 *X, long nl, long nh, uint32 *R, uint32 *G, uint32 *B) |
---|
| 160 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 161 | { |
---|
| 162 | long i; |
---|
| 163 | for(i=nl; i<=nh; i++) { |
---|
| 164 | R[i] = X[i].r; |
---|
| 165 | G[i] = X[i].g; |
---|
| 166 | B[i] = X[i].b; |
---|
| 167 | } |
---|
| 168 | } |
---|
| 169 | /* -------------------------------------------------------------------------------------- */ |
---|
| 170 | IMAGE_EXPORT(void) merge_rgb8vector(uint8 *R, uint8 *G, uint8 *B, long nl, long nh, rgb8 *X) |
---|
| 171 | /* -------------------------------------------------------------------------------------- */ |
---|
| 172 | { |
---|
| 173 | long i; |
---|
| 174 | for(i=nl; i<=nh; i++) { |
---|
| 175 | X[i].r = R[i]; |
---|
| 176 | X[i].g = G[i]; |
---|
| 177 | X[i].b = B[i]; |
---|
| 178 | } |
---|
| 179 | } |
---|
| 180 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 181 | IMAGE_EXPORT(void) merge_rgb32vector(uint32 *R, uint32 *G, uint32 *B, long nl, long nh, rgb32 *X) |
---|
| 182 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 183 | { |
---|
| 184 | long i; |
---|
| 185 | for(i=nl; i<=nh; i++) { |
---|
| 186 | X[i].r = R[i]; |
---|
| 187 | X[i].g = G[i]; |
---|
| 188 | X[i].b = B[i]; |
---|
| 189 | } |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | /* ---------------- */ |
---|
| 193 | /* -- Convertion -- */ |
---|
| 194 | /* ---------------- */ |
---|
| 195 | |
---|
| 196 | /* -------------------------------------------------------------------------------- */ |
---|
| 197 | IMAGE_EXPORT(void) convert_si8vector_si16vector(sint8 *X, long nl, long nh, sint16 *Y) |
---|
| 198 | /* -------------------------------------------------------------------------------- */ |
---|
| 199 | { |
---|
| 200 | long i; |
---|
| 201 | for(i=nl; i<=nh; i++) |
---|
| 202 | Y[i] = (sint16) X[i]; |
---|
| 203 | } |
---|
| 204 | /* -------------------------------------------------------------------------------- */ |
---|
| 205 | IMAGE_EXPORT(void) convert_si8vector_si32vector(sint8 *X, long nl, long nh, sint32 *Y) |
---|
| 206 | /* -------------------------------------------------------------------------------- */ |
---|
| 207 | { |
---|
| 208 | long i; |
---|
| 209 | for(i=nl; i<=nh; i++) |
---|
| 210 | Y[i] = (sint32) X[i]; |
---|
| 211 | } |
---|
| 212 | /* -------------------------------------------------------------------------------- */ |
---|
| 213 | IMAGE_EXPORT(void) convert_si8vector_f32vector(sint8 *X, long nl, long nh, float32 *Y) |
---|
| 214 | /* -------------------------------------------------------------------------------- */ |
---|
| 215 | { |
---|
| 216 | long i; |
---|
| 217 | for(i=nl; i<=nh; i++) |
---|
| 218 | Y[i] = (float32) X[i]; |
---|
| 219 | } |
---|
| 220 | /* -------------------------------------------------------------------------------- */ |
---|
| 221 | IMAGE_EXPORT(void) convert_si8vector_f64vector(sint8 *X, long nl, long nh, float64 *Y) |
---|
| 222 | /* -------------------------------------------------------------------------------- */ |
---|
| 223 | { |
---|
| 224 | long i; |
---|
| 225 | for(i=nl; i<=nh; i++) |
---|
| 226 | Y[i] = (float64) X[i]; |
---|
| 227 | } |
---|
| 228 | /* -------------------------------------------------------------------------------- */ |
---|
| 229 | IMAGE_EXPORT(void) convert_ui8vector_ui16vector(uint8 *X, long nl, long nh, uint16 *Y) |
---|
| 230 | /* -------------------------------------------------------------------------------- */ |
---|
| 231 | { |
---|
| 232 | long i; |
---|
| 233 | for(i=nl; i<=nh; i++) |
---|
| 234 | Y[i] = (uint16) X[i]; |
---|
| 235 | } |
---|
| 236 | /* -------------------------------------------------------------------------------- */ |
---|
| 237 | IMAGE_EXPORT(void) convert_ui8vector_ui32vector(uint8 *X, long nl, long nh, uint32 *Y) |
---|
| 238 | /* -------------------------------------------------------------------------------- */ |
---|
| 239 | { |
---|
| 240 | long i; |
---|
| 241 | for(i=nl; i<=nh; i++) |
---|
| 242 | Y[i] = (uint32) X[i]; |
---|
| 243 | } |
---|
| 244 | /* -------------------------------------------------------------------------------- */ |
---|
| 245 | IMAGE_EXPORT(void) convert_ui8vector_f32vector(uint8 *X, long nl, long nh, float32 *Y) |
---|
| 246 | /* -------------------------------------------------------------------------------- */ |
---|
| 247 | { |
---|
| 248 | long i; |
---|
| 249 | for(i=nl; i<=nh; i++) |
---|
| 250 | Y[i] = (float32) X[i]; |
---|
| 251 | } |
---|
| 252 | /* -------------------------------------------------------------------------------- */ |
---|
| 253 | IMAGE_EXPORT(void) convert_ui8vector_f64vector(uint8 *X, long nl, long nh, float64 *Y) |
---|
| 254 | /* -------------------------------------------------------------------------------- */ |
---|
| 255 | { |
---|
| 256 | long i; |
---|
| 257 | for(i=nl; i<=nh; i++) |
---|
| 258 | Y[i] = (float64) X[i]; |
---|
| 259 | } |
---|
| 260 | /* ------------------------------------------------------------------------------ */ |
---|
| 261 | IMAGE_EXPORT(void) convert_ui8vector_rgb8vector(uint8 *X, long nl, long nh, rgb8 *Y) |
---|
| 262 | /* ------------------------------------------------------------------------------ */ |
---|
| 263 | { |
---|
| 264 | long i; |
---|
| 265 | for(i=nl; i<=nh; i++) { |
---|
| 266 | Y[i].r = X[i]; |
---|
| 267 | Y[i].g = X[i]; |
---|
| 268 | Y[i].b = X[i]; |
---|
| 269 | } |
---|
| 270 | } |
---|
| 271 | /* -------------------------------------------------------------------------------- */ |
---|
| 272 | IMAGE_EXPORT(void) convert_ui8vector_rgbx8vector(uint8 *X, long nl, long nh, rgbx8 *Y) |
---|
| 273 | /* -------------------------------------------------------------------------------- */ |
---|
| 274 | { |
---|
| 275 | long i; |
---|
| 276 | for(i=nl; i<=nh; i++) { |
---|
| 277 | Y[i].r = X[i]; |
---|
| 278 | Y[i].g = X[i]; |
---|
| 279 | Y[i].b = X[i]; |
---|
| 280 | Y[i].x = 255; |
---|
| 281 | } |
---|
| 282 | } |
---|
| 283 | /* ---------------------------------------------------------------------------------- */ |
---|
| 284 | IMAGE_EXPORT(void) convert_si16vector_si32vector(sint16 *X, long nl, long nh, sint32 *Y) |
---|
| 285 | /* ---------------------------------------------------------------------------------- */ |
---|
| 286 | { |
---|
| 287 | long i; |
---|
| 288 | for(i=nl; i<=nh; i++) |
---|
| 289 | Y[i] = (sint32) X[i]; |
---|
| 290 | } |
---|
| 291 | /* ---------------------------------------------------------------------------------- */ |
---|
| 292 | IMAGE_EXPORT(void) convert_si16vector_f32vector(sint16 *X, long nl, long nh, float32 *Y) |
---|
| 293 | /* ---------------------------------------------------------------------------------- */ |
---|
| 294 | { |
---|
| 295 | long i; |
---|
| 296 | for(i=nl; i<=nh; i++) |
---|
| 297 | Y[i] = (float32) X[i]; |
---|
| 298 | } |
---|
| 299 | /* ---------------------------------------------------------------------------------- */ |
---|
| 300 | IMAGE_EXPORT(void) convert_si16vector_f64vector(sint16 *X, long nl, long nh, float64 *Y) |
---|
| 301 | /* ---------------------------------------------------------------------------------- */ |
---|
| 302 | { |
---|
| 303 | long i; |
---|
| 304 | for(i=nl; i<=nh; i++) |
---|
| 305 | Y[i] = (float64) X[i]; |
---|
| 306 | } |
---|
| 307 | |
---|
| 308 | /* ---------------------------------------------------------------------------------- */ |
---|
| 309 | IMAGE_EXPORT(void) convert_ui16vector_ui32vector(uint16 *X, long nl, long nh, uint32 *Y) |
---|
| 310 | /* ---------------------------------------------------------------------------------- */ |
---|
| 311 | { |
---|
| 312 | long i; |
---|
| 313 | for(i=nl; i<=nh; i++) |
---|
| 314 | Y[i] = (uint32) X[i]; |
---|
| 315 | } |
---|
| 316 | /* ---------------------------------------------------------------------------------- */ |
---|
| 317 | IMAGE_EXPORT(void) convert_ui16vector_f32vector(uint16 *X, long nl, long nh, float32 *Y) |
---|
| 318 | /* ---------------------------------------------------------------------------------- */ |
---|
| 319 | { |
---|
| 320 | long i; |
---|
| 321 | for(i=nl; i<=nh; i++) |
---|
| 322 | Y[i] = (float32) X[i]; |
---|
| 323 | } |
---|
| 324 | /* ---------------------------------------------------------------------------------- */ |
---|
| 325 | IMAGE_EXPORT(void) convert_ui16vector_f64vector(uint16 *X, long nl, long nh, float64 *Y) |
---|
| 326 | /* ---------------------------------------------------------------------------------- */ |
---|
| 327 | { |
---|
| 328 | long i; |
---|
| 329 | for(i=nl; i<=nh; i++) |
---|
| 330 | Y[i] = (float64) X[i]; |
---|
| 331 | } |
---|
| 332 | /* ---------------------------------------------------------------------------------- */ |
---|
| 333 | IMAGE_EXPORT(void) convert_si32vector_f32vector(sint32 *X, long nl, long nh, float32 *Y) |
---|
| 334 | /* ---------------------------------------------------------------------------------- */ |
---|
| 335 | { |
---|
| 336 | long i; |
---|
| 337 | for(i=nl; i<=nh; i++) |
---|
| 338 | Y[i] = (float32) X[i]; |
---|
| 339 | } |
---|
| 340 | /* ---------------------------------------------------------------------------------- */ |
---|
| 341 | IMAGE_EXPORT(void) convert_si32vector_f64vector(sint32 *X, long nl, long nh, float64 *Y) |
---|
| 342 | /* ---------------------------------------------------------------------------------- */ |
---|
| 343 | { |
---|
| 344 | long i; |
---|
| 345 | for(i=nl; i<=nh; i++) |
---|
| 346 | Y[i] = (float64) X[i]; |
---|
| 347 | } |
---|
| 348 | /* ----------------------------------------------------------------------------------- */ |
---|
| 349 | IMAGE_EXPORT(void) convert_ui32vector_f32vector(uint32 *X, long nl, long nh, float32 *Y) |
---|
| 350 | /* ----------------------------------------------------------------------------------- */ |
---|
| 351 | { |
---|
| 352 | long i; |
---|
| 353 | for(i=nl; i<=nh; i++) |
---|
| 354 | Y[i] = (float32) X[i]; |
---|
| 355 | } |
---|
| 356 | /* ----------------------------------------------------------------------------------- */ |
---|
| 357 | IMAGE_EXPORT(void) convert_ui32vector_f64vector(uint32 *X, long nl, long nh, float64 *Y) |
---|
| 358 | /* ----------------------------------------------------------------------------------- */ |
---|
| 359 | { |
---|
| 360 | long i; |
---|
| 361 | for(i=nl; i<=nh; i++) |
---|
| 362 | Y[i] = (float64) X[i]; |
---|
| 363 | } |
---|
| 364 | // === Down === // |
---|
| 365 | /* ------------------------------------------------------------------------------- */ |
---|
| 366 | IMAGE_EXPORT(void) convert_si16vector_si8vector(sint16 *X, long nl, long nh, sint8 *Y) |
---|
| 367 | /* ------------------------------------------------------------------------------- */ |
---|
| 368 | { |
---|
| 369 | long i; |
---|
| 370 | for(i=nl; i<=nh; i++) |
---|
| 371 | Y[i] = (sint8) X[i]; |
---|
| 372 | } |
---|
| 373 | /* ------------------------------------------------------------------------------- */ |
---|
| 374 | IMAGE_EXPORT(void) convert_ui16vector_ui8vector(uint16 *X, long nl, long nh, uint8 *Y) |
---|
| 375 | /* ------------------------------------------------------------------------------- */ |
---|
| 376 | { |
---|
| 377 | long i; |
---|
| 378 | for(i=nl; i<=nh; i++) |
---|
| 379 | Y[i] = (uint8) X[i]; |
---|
| 380 | } |
---|
| 381 | /* -------------------------------------------------------------------------------- */ |
---|
| 382 | IMAGE_EXPORT(void) convert_si32vector_si8vector(sint32 *X, long nl, long nh, sint8 *Y) |
---|
| 383 | /* -------------------------------------------------------------------------------- */ |
---|
| 384 | { |
---|
| 385 | long i; |
---|
| 386 | for(i=nl; i<=nh; i++) |
---|
| 387 | Y[i] = (sint8) X[i]; |
---|
| 388 | } |
---|
| 389 | /* ---------------------------------------------------------------------------------- */ |
---|
| 390 | IMAGE_EXPORT(void) convert_si32vector_si16vector(sint32 *X, long nl, long nh, sint16 *Y) |
---|
| 391 | /* ---------------------------------------------------------------------------------- */ |
---|
| 392 | { |
---|
| 393 | long i; |
---|
| 394 | for(i=nl; i<=nh; i++) |
---|
| 395 | Y[i] = (sint16) X[i]; |
---|
| 396 | } |
---|
| 397 | /* -------------------------------------------------------------------------------- */ |
---|
| 398 | IMAGE_EXPORT(void) convert_ui32vector_ui8vector(uint32 *X, long nl, long nh, uint8 *Y) |
---|
| 399 | /* -------------------------------------------------------------------------------- */ |
---|
| 400 | { |
---|
| 401 | long i; |
---|
| 402 | for(i=nl; i<=nh; i++) |
---|
| 403 | Y[i] = (uint8) X[i]; |
---|
| 404 | } |
---|
| 405 | /* ---------------------------------------------------------------------------------- */ |
---|
| 406 | IMAGE_EXPORT(void) convert_ui32vector_ui16vector(uint32 *X, long nl, long nh, uint16 *Y) |
---|
| 407 | /* ---------------------------------------------------------------------------------- */ |
---|
| 408 | { |
---|
| 409 | long i; |
---|
| 410 | for(i=nl; i<=nh; i++) |
---|
| 411 | Y[i] = (uint16) X[i]; |
---|
| 412 | } |
---|
| 413 | /* -------------------------------------------------------------------------------- */ |
---|
| 414 | IMAGE_EXPORT(void) convert_f32vector_si8vector(float32 *X, long nl, long nh, sint8 *Y) |
---|
| 415 | /* -------------------------------------------------------------------------------- */ |
---|
| 416 | { |
---|
| 417 | long i; |
---|
| 418 | for(i=nl; i<=nh; i++) |
---|
| 419 | Y[i] = (sint8) X[i]; |
---|
| 420 | } |
---|
| 421 | /* -------------------------------------------------------------------------------- */ |
---|
| 422 | IMAGE_EXPORT(void) convert_f32vector_ui8vector(float32 *X, long nl, long nh, uint8 *Y) |
---|
| 423 | /* -------------------------------------------------------------------------------- */ |
---|
| 424 | { |
---|
| 425 | long i; |
---|
| 426 | for(i=nl; i<=nh; i++) |
---|
| 427 | Y[i] = (uint8) X[i]; |
---|
| 428 | } |
---|
| 429 | /* ---------------------------------------------------------------------------------- */ |
---|
| 430 | IMAGE_EXPORT(void) convert_f32vector_si16vector(float32 *X, long nl, long nh, sint16 *Y) |
---|
| 431 | /* ---------------------------------------------------------------------------------- */ |
---|
| 432 | { |
---|
| 433 | long i; |
---|
| 434 | for(i=nl; i<=nh; i++) |
---|
| 435 | Y[i] = (sint16) X[i]; |
---|
| 436 | } |
---|
| 437 | /* ---------------------------------------------------------------------------------- */ |
---|
| 438 | IMAGE_EXPORT(void) convert_f32vector_ui16vector(float32 *X, long nl, long nh, uint16 *Y) |
---|
| 439 | /* ---------------------------------------------------------------------------------- */ |
---|
| 440 | { |
---|
| 441 | long i; |
---|
| 442 | for(i=nl; i<=nh; i++) |
---|
| 443 | Y[i] = (uint16) X[i]; |
---|
| 444 | } |
---|
| 445 | /* ---------------------------------------------------------------------------------- */ |
---|
| 446 | IMAGE_EXPORT(void) convert_f32vector_si32vector(float32 *X, long nl, long nh, sint32 *Y) |
---|
| 447 | /* ---------------------------------------------------------------------------------- */ |
---|
| 448 | { |
---|
| 449 | long i; |
---|
| 450 | for(i=nl; i<=nh; i++) |
---|
| 451 | Y[i] = (sint32) X[i]; |
---|
| 452 | } |
---|
| 453 | /* ---------------------------------------------------------------------------------- */ |
---|
| 454 | IMAGE_EXPORT(void) convert_f32vector_ui32vector(float32 *X, long nl, long nh, uint32 *Y) |
---|
| 455 | /* ---------------------------------------------------------------------------------- */ |
---|
| 456 | { |
---|
| 457 | long i; |
---|
| 458 | for(i=nl; i<=nh; i++) |
---|
| 459 | Y[i] = (uint32) X[i]; |
---|
| 460 | } |
---|
| 461 | /* -------------------------------------------------------------------------------- */ |
---|
| 462 | IMAGE_EXPORT(void) convert_f64vector_si8vector(float64 *X, long nl, long nh, sint8 *Y) |
---|
| 463 | /* -------------------------------------------------------------------------------- */ |
---|
| 464 | { |
---|
| 465 | long i; |
---|
| 466 | for(i=nl; i<=nh; i++) |
---|
| 467 | Y[i] = (sint8) X[i]; |
---|
| 468 | } |
---|
| 469 | /* -------------------------------------------------------------------------------- */ |
---|
| 470 | IMAGE_EXPORT(void) convert_f64vector_ui8vector(float64 *X, long nl, long nh, uint8 *Y) |
---|
| 471 | /* -------------------------------------------------------------------------------- */ |
---|
| 472 | { |
---|
| 473 | long i; |
---|
| 474 | for(i=nl; i<=nh; i++) |
---|
| 475 | Y[i] = (uint8) X[i]; |
---|
| 476 | } |
---|
| 477 | /* ---------------------------------------------------------------------------------- */ |
---|
| 478 | IMAGE_EXPORT(void) convert_f64vector_si16vector(float64 *X, long nl, long nh, sint16 *Y) |
---|
| 479 | /* ---------------------------------------------------------------------------------- */ |
---|
| 480 | { |
---|
| 481 | long i; |
---|
| 482 | for(i=nl; i<=nh; i++) |
---|
| 483 | Y[i] = (sint16) X[i]; |
---|
| 484 | } |
---|
| 485 | /* ---------------------------------------------------------------------------------- */ |
---|
| 486 | IMAGE_EXPORT(void) convert_f64vector_ui16vector(float64 *X, long nl, long nh, uint16 *Y) |
---|
| 487 | /* ---------------------------------------------------------------------------------- */ |
---|
| 488 | { |
---|
| 489 | long i; |
---|
| 490 | for(i=nl; i<=nh; i++) |
---|
| 491 | Y[i] = (uint16) X[i]; |
---|
| 492 | } |
---|
| 493 | /* ---------------------------------------------------------------------------------- */ |
---|
| 494 | IMAGE_EXPORT(void) convert_f64vector_si32vector(float64 *X, long nl, long nh, sint32 *Y) |
---|
| 495 | /* ---------------------------------------------------------------------------------- */ |
---|
| 496 | { |
---|
| 497 | long i; |
---|
| 498 | for(i=nl; i<=nh; i++) |
---|
| 499 | Y[i] = (sint32) X[i]; |
---|
| 500 | } |
---|
| 501 | /* ---------------------------------------------------------------------------------- */ |
---|
| 502 | IMAGE_EXPORT(void) convert_f64vector_ui32vector(float64 *X, long nl, long nh, uint32 *Y) |
---|
| 503 | /* ---------------------------------------------------------------------------------- */ |
---|
| 504 | { |
---|
| 505 | long i; |
---|
| 506 | for(i=nl; i<=nh; i++) |
---|
| 507 | Y[i] = (uint32) X[i]; |
---|
| 508 | } |
---|
| 509 | /* ---------------------------------------------------------------------------------- */ |
---|
| 510 | IMAGE_EXPORT(void) convert_f64vector_f32vector(float64 *X, long nl, long nh, float32 *Y) |
---|
| 511 | /* ---------------------------------------------------------------------------------- */ |
---|
| 512 | { |
---|
| 513 | long i; |
---|
| 514 | for(i=nl; i<=nh; i++) |
---|
| 515 | Y[i] = (float32) X[i]; |
---|
| 516 | } |
---|
| 517 | /* ------------------------------------------------------------------------------ */ |
---|
| 518 | IMAGE_EXPORT(void) convert_rgb8vector_ui8vector(rgb8 *X, long nl, long nh, uint8 *Y) |
---|
| 519 | /* ------------------------------------------------------------------------------ */ |
---|
| 520 | { |
---|
| 521 | long i; |
---|
| 522 | for(i=nl; i<=nh; i++) { |
---|
| 523 | Y[i] = (X[i].r + X[i].g + X[i].b) / 3; |
---|
| 524 | } |
---|
| 525 | } |
---|
| 526 | /* -------------------------------------------------------------------------------- */ |
---|
| 527 | IMAGE_EXPORT(void) convert_rgbx8vector_ui8vector(rgbx8 *X, long nl, long nh, uint8 *Y) |
---|
| 528 | /* -------------------------------------------------------------------------------- */ |
---|
| 529 | { |
---|
| 530 | long i; |
---|
| 531 | for(i=nl; i<=nh; i++) { |
---|
| 532 | Y[i] = (X[i].r + X[i].g + X[i].b) / 3; |
---|
| 533 | } |
---|
| 534 | } |
---|
| 535 | /* |
---|
| 536 | * --------------- |
---|
| 537 | * --- LowPart --- |
---|
| 538 | * --------------- |
---|
| 539 | */ |
---|
| 540 | /* ------------------------------------------------------------------------------- */ |
---|
| 541 | IMAGE_EXPORT(void) lowpart_ui16vector_ui8vector(uint16 *X, long nl,long nh, uint8 *Y) |
---|
| 542 | /* ------------------------------------------------------------------------------- */ |
---|
| 543 | { |
---|
| 544 | int i; |
---|
| 545 | for(i=nl; i<=nh; i++) { |
---|
| 546 | Y[i] = X[i] & 0xff; |
---|
| 547 | } |
---|
| 548 | } |
---|
| 549 | /* ------------------------------------------------------------------------------- */ |
---|
| 550 | IMAGE_EXPORT(void) lowpart_ui32vector_ui8vector(uint32 *X, long nl,long nh, uint8 *Y) |
---|
| 551 | /* ------------------------------------------------------------------------------- */ |
---|
| 552 | { |
---|
| 553 | int i; |
---|
| 554 | for(i=nl; i<=nh; i++) { |
---|
| 555 | Y[i] = X[i] & 0xff; |
---|
| 556 | } |
---|
| 557 | } |
---|
| 558 | |
---|
| 559 | |
---|