Changeset 823 for soft/giet_vm/applications/rosenfeld/nrc2/src/nrmem1.c
- Timestamp:
- Jun 14, 2016, 5:23:56 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/nrc2/src/nrmem1.c
r772 r823 30 30 * ----------- 31 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 } 32 33 34 #undef dup_type_vector 35 #define dup_type_vector(t) \ 36 void short_name(t,dup_,vector)(t * X, int32_t nl, int32_t nh, t * Y) \ 37 { \ 38 for (int32_t i = nl; i <= nh; i++) { \ 39 Y[i] = X[i]; \ 40 } \ 41 } 42 43 dup_type_vector(int8_t); 44 dup_type_vector(uint8_t); 45 dup_type_vector(int16_t); 46 dup_type_vector(uint16_t); 47 dup_type_vector(int32_t); 48 dup_type_vector(uint32_t); 49 dup_type_vector(int64_t); 50 dup_type_vector(uint64_t); 51 dup_type_vector(float); 52 dup_type_vector(double); 53 dup_type_vector(rgb8); 54 dup_type_vector(rgbx8); 55 56 140 57 /* 141 58 * -------------------- … … 143 60 * -------------------- 144 61 */ 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++) { 62 63 64 void split_rgb8vector(rgb8 * X, int32_t nl, int32_t nh, uint8_t * R, uint8_t * G, uint8_t * B) 65 { 66 for (int32_t i = nl; i <= nh; i++) { 67 R[i] = X[i].r; 68 G[i] = X[i].g; 69 B[i] = X[i].b; 70 } 71 } 72 73 void split_rgb32vector(rgb32 * X, int32_t nl, int32_t nh, uint32_t * R, uint32_t * G, uint32_t * B) 74 { 75 for (int32_t i = nl; i <= nh; i++) { 76 R[i] = X[i].r; 77 G[i] = X[i].g; 78 B[i] = X[i].b; 79 } 80 } 81 82 void merge_rgb8vector(uint8_t * R, uint8_t * G, uint8_t * B, int32_t nl, int32_t nh, rgb8 * X) 83 { 84 for (int32_t i = nl; i <= nh; i++) { 85 X[i].r = R[i]; 86 X[i].g = G[i]; 87 X[i].b = B[i]; 88 } 89 } 90 91 92 void merge_rgb32vector(uint32_t * R, uint32_t * G, uint32_t * B, int32_t nl, int32_t nh, rgb32 * X) 93 { 94 for (int32_t i = nl; i <= nh; i++) { 95 X[i].r = R[i]; 96 X[i].g = G[i]; 97 X[i].b = B[i]; 98 } 99 } 100 101 /* ---------------- */ 102 /* -- Conversion -- */ 103 /* ---------------- */ 104 105 #undef convert_type1_vector_type2_vector 106 #define convert_type1_vector_type2_vector(t1, t2) \ 107 void short_name(t1,convert_,short_name(t2,vector_,vector))(t1 * X, int32_t nl, int32_t nh, t2 * Y) \ 108 { \ 109 for (int32_t i = nl; i <= nh; i++) { \ 110 Y[i] = (t2) X[i]; \ 111 } \ 112 } 113 114 convert_type1_vector_type2_vector(int8_t,int16_t); 115 convert_type1_vector_type2_vector(int8_t,int32_t); 116 convert_type1_vector_type2_vector(int8_t,float); 117 convert_type1_vector_type2_vector(int8_t,double); 118 convert_type1_vector_type2_vector(uint8_t,uint16_t); 119 convert_type1_vector_type2_vector(uint8_t,uint32_t); 120 convert_type1_vector_type2_vector(uint8_t,float); 121 convert_type1_vector_type2_vector(uint8_t,double); 122 convert_type1_vector_type2_vector(int16_t,int32_t); 123 convert_type1_vector_type2_vector(int16_t,float); 124 convert_type1_vector_type2_vector(int16_t,double); 125 convert_type1_vector_type2_vector(uint16_t,uint32_t); 126 convert_type1_vector_type2_vector(uint16_t,float); 127 convert_type1_vector_type2_vector(uint16_t,double); 128 convert_type1_vector_type2_vector(int32_t,float); 129 convert_type1_vector_type2_vector(int32_t,double); 130 convert_type1_vector_type2_vector(uint32_t,float); 131 convert_type1_vector_type2_vector(uint32_t,double); 132 convert_type1_vector_type2_vector(int16_t,int8_t); 133 convert_type1_vector_type2_vector(uint16_t,uint8_t); 134 convert_type1_vector_type2_vector(int32_t,int8_t); 135 convert_type1_vector_type2_vector(int32_t,int16_t); 136 convert_type1_vector_type2_vector(uint32_t,uint8_t); 137 convert_type1_vector_type2_vector(uint32_t,uint16_t); 138 convert_type1_vector_type2_vector(float,int8_t); 139 convert_type1_vector_type2_vector(float,uint8_t); 140 convert_type1_vector_type2_vector(float,int16_t); 141 convert_type1_vector_type2_vector(float,uint16_t); 142 convert_type1_vector_type2_vector(float,int32_t); 143 convert_type1_vector_type2_vector(float,uint32_t); 144 convert_type1_vector_type2_vector(double,int8_t); 145 convert_type1_vector_type2_vector(double,uint8_t); 146 convert_type1_vector_type2_vector(double,int16_t); 147 convert_type1_vector_type2_vector(double,uint16_t); 148 convert_type1_vector_type2_vector(double,int32_t); 149 convert_type1_vector_type2_vector(double,uint32_t); 150 convert_type1_vector_type2_vector(double,float); 151 152 153 154 155 156 157 158 void convert_ui8vector_rgb8vector(uint8_t * X, int32_t nl, int32_t nh, rgb8 * Y) 159 { 160 for (int32_t i = nl; i <= nh; i++) { 266 161 Y[i].r = X[i]; 267 162 Y[i].g = X[i]; … … 269 164 } 270 165 } 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++) { 166 167 void convert_ui8vector_rgbx8vector(uint8_t * X, int32_t nl, int32_t nh, rgbx8 * Y) 168 { 169 for (int32_t i = nl; i <= nh; i++) { 277 170 Y[i].r = X[i]; 278 171 Y[i].g = X[i]; … … 281 174 } 282 175 } 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++) { 176 177 178 void convert_rgb8vector_ui8vector(rgb8 * X, int32_t nl, int32_t nh, uint8_t * Y) 179 { 180 for (int32_t i = nl; i <= nh; i++) { 523 181 Y[i] = (X[i].r + X[i].g + X[i].b) / 3; 524 182 } 525 183 } 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++) { 184 185 void convert_rgbx8vector_ui8vector(rgbx8 * X, int32_t nl, int32_t nh, uint8_t * Y) 186 { 187 for (int32_t i = nl; i <= nh; i++) { 532 188 Y[i] = (X[i].r + X[i].g + X[i].b) / 3; 533 189 } 534 190 } 191 535 192 /* 536 193 * --------------- … … 538 195 * --------------- 539 196 */ 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 197 198 void lowpart_ui16vector_ui8vector(uint16_t * X, int32_t nl, int32_t nh, uint8_t * Y) 199 { 200 for(int32_t i = nl; i <= nh; i++) { 201 Y[i] = X[i] & 0xff; 202 } 203 } 204 205 void lowpart_ui32vector_ui8vector(uint32_t * X, int32_t nl, int32_t nh, uint8_t * Y) 206 { 207 for (int32_t i = nl; i <= nh; i++) { 208 Y[i] = X[i] & 0xff; 209 } 210 } 211 212
Note: See TracChangeset
for help on using the changeset viewer.