Changeset 826 for soft/giet_vm/applications/rosenfeld/nrc2/src/nrset2.c
- Timestamp:
- Jul 13, 2017, 11:01:58 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/nrc2/src/nrset2.c
r772 r826 16 16 #include <stddef.h> 17 17 #include <stdlib.h> 18 #include <math.h> // fabs19 18 20 19 #include "mypredef.h" … … 33 32 */ 34 33 35 /* ---------------------------------------------------------------------- */ 36 IMAGE_EXPORT(void) zero_si8matrix(sint8 **m, int i0, int i1, int j0, int j1) 37 /* ---------------------------------------------------------------------- */ 38 { 39 int i; 40 for(i=i0; i<=i1; i++) { 41 zero_si8vector(m[i], j0, j1); 42 } 43 } 44 /* ---------------------------------------------------------------------- */ 45 IMAGE_EXPORT(void) zero_ui8matrix(uint8 **m, int i0, int i1, int j0, int j1) 46 /* ---------------------------------------------------------------------- */ 47 { 48 int i; 49 for(i=i0; i<=i1; i++) { 50 zero_ui8vector(m[i], j0, j1); 51 } 52 } 53 /* ------------------------------------------------------------------------ */ 54 IMAGE_EXPORT(void) zero_si16matrix(sint16 **m, int i0, int i1, int j0, int j1) 55 /* ------------------------------------------------------------------------ */ 56 { 57 int i; 58 for(i=i0; i<=i1; i++) { 59 zero_si16vector(m[i], j0, j1); 60 } 61 } 62 /* ------------------------------------------------------------------------ */ 63 IMAGE_EXPORT(void) zero_ui16matrix(uint16 **m, int i0, int i1, int j0, int j1) 64 /* ------------------------------------------------------------------------ */ 65 { 66 int i; 67 for(i=i0; i<=i1; i++) { 68 zero_ui16vector(m[i], j0, j1); 69 } 70 } 71 /* ------------------------------------------------------------------------ */ 72 IMAGE_EXPORT(void) zero_si32matrix(sint32 **m, int i0, int i1, int j0, int j1) 73 /* ------------------------------------------------------------------------ */ 74 { 75 int i; 76 for(i=i0; i<=i1; i++) { 77 zero_si32vector(m[i], j0, j1); 78 } 79 } 80 /* ------------------------------------------------------------------------ */ 81 IMAGE_EXPORT(void) zero_ui32matrix(uint32 **m, int i0, int i1, int j0, int j1) 82 /* ------------------------------------------------------------------------ */ 83 { 84 int i; 85 for(i=i0; i<=i1; i++) { 86 zero_ui32vector(m[i], j0, j1); 87 } 88 } 89 /* ------------------------------------------------------------------------ */ 90 IMAGE_EXPORT(void) zero_si64matrix(sint64 **m, int i0, int i1, int j0, int j1) 91 /* ------------------------------------------------------------------------ */ 92 { 93 int i; 94 for(i=i0; i<=i1; i++) { 95 zero_si64vector(m[i], j0, j1); 96 } 97 } 98 /* ------------------------------------------------------------------------ */ 99 IMAGE_EXPORT(void) zero_ui64matrix(uint64 **m, int i0, int i1, int j0, int j1) 100 /* ------------------------------------------------------------------------ */ 101 { 102 int i; 103 for(i=i0; i<=i1; i++) { 104 zero_ui64vector(m[i], j0, j1); 105 } 106 } 107 /* ------------------------------------------------------------------------ */ 108 IMAGE_EXPORT(void) zero_f32matrix(float32 **m, int i0, int i1, int j0, int j1) 109 /* ------------------------------------------------------------------------ */ 110 { 111 int i; 112 for(i=i0; i<=i1; i++) { 113 zero_f32vector(m[i], j0, j1); 114 } 115 } 116 /* ------------------------------------------------------------------------ */ 117 IMAGE_EXPORT(void) zero_f64matrix(float64 **m, int i0, int i1, int j0, int j1) 118 /* ------------------------------------------------------------------------ */ 119 { 120 int i; 121 for(i=i0; i<=i1; i++) { 122 zero_f64vector(m[i], j0, j1); 123 } 124 } 125 /* ---------------------------------------------------------------------- */ 126 IMAGE_EXPORT(void) zero_rgb8matrix(rgb8 **m, int i0, int i1, int j0, int j1) 127 /* ---------------------------------------------------------------------- */ 128 { 129 int i; 130 for(i=i0; i<=i1; i++) { 131 zero_rgb8vector(m[i], j0, j1); 132 } 133 } 134 /* ------------------------------------------------------------------------ */ 135 IMAGE_EXPORT(void) zero_rgbx8matrix(rgbx8 **m, int i0, int i1, int j0, int j1) 136 /* ------------------------------------------------------------------------ */ 137 { 138 int i; 139 for(i=i0; i<=i1; i++) { 140 zero_rgbx8vector(m[i], j0, j1); 141 } 142 } 34 35 #undef zero_type_matrix 36 #define zero_type_matrix(t) \ 37 void short_name(t,zero_,matrix)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) \ 38 { \ 39 for (int32_t i = i0; i <= i1; i++) { \ 40 short_name(t,zero_,vector)(m[i], j0, j1); \ 41 } \ 42 } 43 44 zero_type_matrix(int8_t); 45 zero_type_matrix(uint8_t); 46 zero_type_matrix(int16_t); 47 zero_type_matrix(uint16_t); 48 zero_type_matrix(int32_t); 49 zero_type_matrix(uint32_t); 50 zero_type_matrix(int64_t); 51 zero_type_matrix(uint64_t); 52 zero_type_matrix(float); 53 zero_type_matrix(double); 54 zero_type_matrix(rgb8); 55 zero_type_matrix(rgbx8); 56 143 57 /* 144 58 * ------------------ … … 147 61 */ 148 62 149 /* ------------------------------------------------------------------------------ */ 150 IMAGE_EXPORT(void) set_si8matrix(sint8 **m, int i0, int i1, int j0, int j1, sint8 x) 151 /* ------------------------------------------------------------------------------ */ 152 { 153 int i; 154 for(i=i0; i<=i1; i++) 155 set_si8vector(m[i], j0, j1, x); 156 } 157 /* ------------------------------------------------------------------------------ */ 158 IMAGE_EXPORT(void) set_ui8matrix(uint8 **m, int i0, int i1, int j0, int j1, uint8 x) 159 /* ------------------------------------------------------------------------------ */ 160 { 161 int i; 162 for(i=i0; i<=i1; i++) 163 set_ui8vector(m[i], j0, j1, x); 164 } 165 /* --------------------------------------------------------------------------------- */ 166 IMAGE_EXPORT(void) set_si16matrix(sint16 **m, int i0, int i1, int j0, int j1, sint16 x) 167 /* --------------------------------------------------------------------------------- */ 168 { 169 int i; 170 for(i=i0; i<=i1; i++) 171 set_si16vector(m[i], j0, j1, x); 172 } 173 /* --------------------------------------------------------------------------------- */ 174 IMAGE_EXPORT(void) set_ui16matrix(uint16 **m, int i0, int i1, int j0, int j1, uint16 x) 175 /* --------------------------------------------------------------------------------- */ 176 { 177 int i; 178 for(i=i0; i<=i1; i++) 179 set_ui16vector(m[i], j0, j1, x); 180 } 181 /* --------------------------------------------------------------------------------- */ 182 IMAGE_EXPORT(void) set_si32matrix(sint32 **m, int i0, int i1, int j0, int j1, sint32 x) 183 /* --------------------------------------------------------------------------------- */ 184 { 185 int i; 186 for(i=i0; i<=i1; i++) 187 set_si32vector(m[i], j0, j1, x); 188 } 189 /* --------------------------------------------------------------------------------- */ 190 IMAGE_EXPORT(void) set_ui32matrix(uint32 **m, int i0, int i1, int j0, int j1, uint32 x) 191 /* --------------------------------------------------------------------------------- */ 192 { 193 int i; 194 for(i=i0; i<=i1; i++) 195 set_ui32vector(m[i], j0, j1, x); 196 } 197 /* --------------------------------------------------------------------------------- */ 198 IMAGE_EXPORT(void) set_f32matrix(float32 **m, int i0, int i1,int j0, int j1, float32 x) 199 /* --------------------------------------------------------------------------------- */ 200 { 201 int i; 202 for(i=i0; i<=i1; i++) 203 set_f32vector(m[i], j0, j1, x); 204 } 205 /* --------------------------------------------------------------------------------- */ 206 IMAGE_EXPORT(void) set_f64matrix(float64 **m,int i0, int i1, int j0, int j1, float64 x) 207 /* --------------------------------------------------------------------------------- */ 208 { 209 int i; 210 for(i=i0; i<=i1; i++) 211 set_f64vector(m[i], j0, j1, x); 212 } 213 /* ---------------------------------------------------------------------------- */ 214 IMAGE_EXPORT(void) set_rgb8matrix(rgb8 **m,int i0, int i1, int j0, int j1, rgb8 x) 215 /* ---------------------------------------------------------------------------- */ 216 { 217 int i; 218 for(i=i0; i<=i1; i++) 219 set_rgb8vector(m[i], j0, j1, x); 220 } 221 /* ----------------------------------------------------------------------------- */ 222 IMAGE_EXPORT(void) set_rgbx8matrix(rgbx8 **m,int i0,int i1,int j0, int j1, rgbx8 x) 223 /* ----------------------------------------------------------------------------- */ 224 { 225 int i; 226 for(i=i0; i<=i1; i++) 227 set_rgbx8vector(m[i], j0, j1, x); 228 } 63 #undef set_type_matrix 64 #define set_type_matrix(t) \ 65 void short_name(t,set_,matrix)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, t x) \ 66 { \ 67 for (int32_t i = i0; i <= i1; i++) { \ 68 short_name(t,set_,vector)(m[i], j0, j1, x); \ 69 } \ 70 } 71 72 set_type_matrix(int8_t); 73 set_type_matrix(uint8_t); 74 set_type_matrix(int16_t); 75 set_type_matrix(uint16_t); 76 set_type_matrix(int32_t); 77 set_type_matrix(uint32_t); 78 set_type_matrix(int64_t); 79 set_type_matrix(uint64_t); 80 set_type_matrix(float); 81 set_type_matrix(double); 82 set_type_matrix(rgb8); 83 set_type_matrix(rgbx8); 84 85 86 229 87 /* 230 88 * ---------------- … … 232 90 * ---------------- 233 91 */ 234 /* ------------------------------------------------------------------------------------------------ */ 235 void set_ui8matrix_param(uint8 **m, int i0, int i1, int j0, int j1, uint8 x, uint8 xstep, uint8 ystep) 236 /* ------------------------------------------------------------------------------------------------ */ 237 { 238 int i; 239 for(i=i0; i<=i1; i++) { 240 set_ui8vector_param(m[i], j0, j1, x, xstep); 241 x += ystep; 242 } 243 } 244 /* -------------------------------------------------------------------------------------------------- */ 245 void set_si8matrix_param(sint8 **m, int i0, int i1, int j0, int j1, sint8 x, sint8 xstep, sint8 ystep) 246 /* -------------------------------------------------------------------------------------------------- */ 247 { 248 int i; 249 for(i=i0; i<=i1; i++) { 250 set_si8vector_param(m[i], j0, j1, x, xstep); 251 x += ystep; 252 } 253 } 254 /* ----------------------------------------------------------------------------------------------------- */ 255 void set_ui16matrix_param(uint16 **m, int i0, int i1, int j0, int j1, uint16 x, uint16 xstep, uint16 ystep) 256 /* ----------------------------------------------------------------------------------------------------- */ 257 { 258 int i; 259 for(i=i0; i<=i1; i++) { 260 set_ui16vector_param(m[i], j0, j1, x, xstep); 261 x += ystep; 262 } 263 } 264 /* ----------------------------------------------------------------------------------------------------- */ 265 void set_si16matrix_param(sint16 **m, int i0, int i1, int j0, int j1, sint16 x, sint16 xstep, sint16 ystep) 266 /* ----------------------------------------------------------------------------------------------------- */ 267 { 268 int i; 269 for(i=i0; i<=i1; i++) { 270 set_si16vector_param(m[i], j0, j1, x, xstep); 271 x += ystep; 272 } 273 } 274 /* ----------------------------------------------------------------------------------------------------- */ 275 void set_ui32matrix_param(uint32 **m, int i0, int i1, int j0, int j1, uint32 x, uint32 xstep, uint32 ystep) 276 /* ----------------------------------------------------------------------------------------------------- */ 277 { 278 int i; 279 for(i=i0; i<=i1; i++) { 280 set_ui32vector_param(m[i], j0, j1, x, xstep); 281 x += ystep; 282 } 283 } 284 /* ----------------------------------------------------------------------------------------------------- */ 285 void set_si32matrix_param(sint32 **m, int i0, int i1, int j0, int j1, sint32 x, sint32 xstep, sint32 ystep) 286 /* ----------------------------------------------------------------------------------------------------- */ 287 { 288 int i; 289 for(i=i0; i<=i1; i++) { 290 set_si32vector_param(m[i], j0, j1, x, xstep); 291 x += ystep; 292 } 293 } 294 /* ----------------------------------------------------------------------------------------------------- */ 295 void set_ui64matrix_param(uint64 **m, int i0, int i1, int j0, int j1, uint64 x, uint64 xstep, uint64 ystep) 296 /* ----------------------------------------------------------------------------------------------------- */ 297 { 298 int i; 299 for(i=i0; i<=i1; i++) { 300 set_ui64vector_param(m[i], j0, j1, x, xstep); 301 x += ystep; 302 } 303 } 304 /* ----------------------------------------------------------------------------------------------------- */ 305 void set_si64matrix_param(sint64 **m, int i0, int i1, int j0, int j1, sint64 x, sint64 xstep, sint64 ystep) 306 /* ----------------------------------------------------------------------------------------------------- */ 307 { 308 int i; 309 for(i=i0; i<=i1; i++) { 310 set_si64vector_param(m[i], j0, j1, x, xstep); 311 x += ystep; 312 } 313 } 314 /* -------------------------------------------------------------------------------------------------------- */ 315 void set_f32matrix_param(float32 **m, int i0, int i1, int j0, int j1, float32 x, float32 xstep, float32 ystep) 316 /* -------------------------------------------------------------------------------------------------------- */ 317 { 318 int i; 319 for(i=i0; i<=i1; i++) { 320 set_f32vector_param(m[i], j0, j1, x, xstep); 321 x += ystep; 322 } 323 } 324 /* -------------------------------------------------------------------------------------------------------- */ 325 void set_f64matrix_param(float64 **m, int i0, int i1, int j0, int j1, float64 x, float64 xstep, float64 ystep) 326 /* -------------------------------------------------------------------------------------------------------- */ 327 { 328 int i; 329 for(i=i0; i<=i1; i++) { 330 set_f64vector_param(m[i], j0, j1, x, xstep); 331 x += ystep; 332 } 333 } 334 /* --------------------------------------------------------------------------------------------- */ 335 void set_rgb8matrix_param(rgb8 **m, int i0, int i1, int j0, int j1, rgb8 x, rgb8 xstep, rgb8 ystep) 336 /* --------------------------------------------------------------------------------------------- */ 337 { 338 int i; 339 for(i=i0; i<=i1; i++) { 92 93 #undef set_type_matrix_param 94 #define set_type_matrix_param(t) \ 95 void short_name(t,set_,matrix_param)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, t x, t xstep, t ystep) \ 96 { \ 97 for (int32_t i = i0; i <= i1; i++) { \ 98 short_name(t,set_,vector_param)(m[i], j0, j1, x, xstep); \ 99 x += ystep; \ 100 } \ 101 } 102 103 set_type_matrix_param(int8_t); 104 set_type_matrix_param(uint8_t); 105 set_type_matrix_param(int16_t); 106 set_type_matrix_param(uint16_t); 107 set_type_matrix_param(int32_t); 108 set_type_matrix_param(uint32_t); 109 set_type_matrix_param(int64_t); 110 set_type_matrix_param(uint64_t); 111 set_type_matrix_param(float); 112 set_type_matrix_param(double); 113 114 115 void set_rgb8matrix_param(rgb8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, rgb8 x, rgb8 xstep, rgb8 ystep) 116 { 117 for (int32_t i = i0; i <= i1; i++) { 340 118 set_rgb8vector_param(m[i], j0, j1, x, xstep); 341 119 x.r += ystep.r; … … 344 122 } 345 123 } 346 /* -------------------------------------------------------------------------------------------------- */ 347 void set_rgbx8matrix_param(rgbx8 **m, int i0, int i1, int j0, int j1, rgbx8 x, rgbx8 xstep, rgbx8 ystep) 348 /* -------------------------------------------------------------------------------------------------- */ 349 { 350 int i; 351 124 125 void set_rgbx8matrix_param(rgbx8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, rgbx8 x, rgbx8 xstep, rgbx8 ystep) 126 { 352 127 x.x = 0; 353 for (i=i0; i<=i1; i++) {128 for (int32_t i = i0; i <= i1; i++) { 354 129 set_rgbx8vector_param(m[i], j0, j1, x, xstep); 355 130 x.r += ystep.r; 356 131 x.g += ystep.g; 357 132 x.b += ystep.b; 358 133 x.x += ystep.x; 359 134 } 360 135 } 136 137 361 138 /* 362 139 * -------------------- … … 364 141 * -------------------- 365 142 */ 366 /* ----------------------------------------------------------------------- */ 367 IMAGE_EXPORT(void) set_si8matrix_i(sint8 **m, int i0, int i1, int j0, int j1) 368 /* ----------------------------------------------------------------------- */ 369 { 370 set_si8matrix_param(m, i0, i1, j0, j1, i0,0, 1); 371 } 372 /* ----------------------------------------------------------------------- */ 373 IMAGE_EXPORT(void) set_ui8matrix_i(uint8 **m, int i0, int i1, int j0, int j1) 374 /* ----------------------------------------------------------------------- */ 375 { 376 set_ui8matrix_param(m, i0, i1, j0, j1, i0,0, 1); 377 } 378 /* ------------------------------------------------------------------------- */ 379 IMAGE_EXPORT(void) set_si16matrix_i(sint16 **m, int i0, int i1, int j0, int j1) 380 /* ------------------------------------------------------------------------- */ 381 { 382 set_si16matrix_param(m, i0, i1, j0, j1, i0,0, 1); 383 } 384 /* ------------------------------------------------------------------------- */ 385 IMAGE_EXPORT(void) set_ui16matrix_i(uint16 **m, int i0, int i1, int j0, int j1) 386 /* ------------------------------------------------------------------------- */ 387 { 388 set_ui16matrix_param(m, i0, i1, j0, j1, i0,0, 1); 389 } 390 /* ------------------------------------------------------------------------- */ 391 IMAGE_EXPORT(void) set_si32matrix_i(sint32 **m, int i0, int i1, int j0, int j1) 392 /* ------------------------------------------------------------------------- */ 393 { 394 set_si32matrix_param(m, i0, i1, j0, j1, i0,0, 1); 395 } 396 /* ------------------------------------------------------------------------- */ 397 IMAGE_EXPORT(void) set_ui32matrix_i(uint32 **m, int i0, int i1, int j0, int j1) 398 /* ------------------------------------------------------------------------- */ 399 { 400 set_ui32matrix_param(m, i0, i1, j0, j1, i0,0, 1); 401 } 402 /* ------------------------------------------------------------------------- */ 403 IMAGE_EXPORT(void) set_si64matrix_i(sint64 **m, int i0, int i1, int j0, int j1) 404 /* ------------------------------------------------------------------------- */ 405 { 406 set_si64matrix_param(m, i0, i1, j0, j1, i0,0, 1); 407 } 408 /* ------------------------------------------------------------------------- */ 409 IMAGE_EXPORT(void) set_ui64matrix_i(uint64 **m, int i0, int i1, int j0, int j1) 410 /* ------------------------------------------------------------------------- */ 411 { 412 set_ui64matrix_param(m, i0, i1, j0, j1, i0,0, 1); 413 } 414 /* ------------------------------------------------------------------------- */ 415 IMAGE_EXPORT(void) set_f32matrix_i(float32 **m, int i0, int i1, int j0, int j1) 416 /* ------------------------------------------------------------------------- */ 417 { 418 set_f32matrix_param(m, i0, i1, j0, j1, (float32) i0, (float32)0, (float32)1); 419 } 420 /* ------------------------------------------------------------------------- */ 421 IMAGE_EXPORT(void) set_f64matrix_i(float64 **m, int i0, int i1, int j0, int j1) 422 /* ------------------------------------------------------------------------- */ 423 { 424 set_f64matrix_param(m, i0, i1, j0, j1, i0,(float64)0, (float64)1); 425 } 426 /* ----------------------------------------------------------------------- */ 427 IMAGE_EXPORT(void) set_rgb8matrix_i(rgb8 **m, int i0, int i1, int j0, int j1) 428 /* ----------------------------------------------------------------------- */ 429 { 430 rgb8 x0, xstep, ystep; 143 144 #undef set_type_matrix_i 145 #define set_type_matrix_i(t) \ 146 void short_name(t,set_,matrix_i)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) \ 147 { \ 148 short_name(t,set_,matrix_param)(m, i0, i1, j0, j1, i0, 0, 1); \ 149 } 150 151 set_type_matrix_i(int8_t); 152 set_type_matrix_i(uint8_t); 153 set_type_matrix_i(int16_t); 154 set_type_matrix_i(uint16_t); 155 set_type_matrix_i(int32_t); 156 set_type_matrix_i(uint32_t); 157 set_type_matrix_i(int64_t); 158 set_type_matrix_i(uint64_t); 159 set_type_matrix_i(float); 160 set_type_matrix_i(double); 161 162 163 void set_rgb8matrix_i(rgb8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) 164 { 165 rgb8 x0; 166 rgb8 xstep; 167 rgb8 ystep; 431 168 432 169 x0.r = x0.g = x0.b = i0; … … 436 173 set_rgb8matrix_param(m, i0, i1, j0, j1, x0, xstep, ystep); 437 174 } 438 /* ------------------------------------------------------------------------- */ 439 IMAGE_EXPORT(void) set_rgbx8matrix_i(rgbx8 **m, int i0, int i1, int j0, int j1) 440 /* ------------------------------------------------------------------------- */ 441 { 442 rgbx8 x, xstep, ystep; 443 444 x.r = x.g = x.b = i0; x.x = 255; 445 xstep.r = xstep.g = xstep.b = 0; xstep.x = 255; 446 ystep.r = ystep.g = ystep.b = 1; ystep.x = 255; 175 176 177 void set_rgbx8matrix_i(rgbx8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) 178 { 179 rgbx8 x; 180 rgbx8 xstep; 181 rgbx8 ystep; 182 183 x.r = x.g = x.b = i0; 184 x.x = 255; 185 xstep.r = xstep.g = xstep.b = 0; 186 xstep.x = 255; 187 ystep.r = ystep.g = ystep.b = 1; 188 ystep.x = 255; 447 189 448 190 set_rgbx8matrix_param(m, i0, i1, j0, j1, x, xstep, ystep); 449 191 } 192 193 450 194 /* 451 195 * -------------------- … … 453 197 * -------------------- 454 198 */ 455 /* ----------------------------------------------------------------------- */ 456 IMAGE_EXPORT(void) set_si8matrix_j(sint8 **m, int i0, int i1, int j0, int j1) 457 /* ----------------------------------------------------------------------- */ 458 { 459 set_si8matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 460 } 461 /* ----------------------------------------------------------------------- */ 462 IMAGE_EXPORT(void) set_ui8matrix_j(uint8 **m, int i0, int i1, int j0, int j1) 463 /* ----------------------------------------------------------------------- */ 464 { 465 set_ui8matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 466 } 467 /* ------------------------------------------------------------------------- */ 468 IMAGE_EXPORT(void) set_si16matrix_j(sint16 **m, int i0, int i1, int j0, int j1) 469 /* ------------------------------------------------------------------------- */ 470 { 471 set_si16matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 472 } 473 /* ------------------------------------------------------------------------- */ 474 IMAGE_EXPORT(void) set_ui16matrix_j(uint16 **m, int i0, int i1, int j0, int j1) 475 /* ------------------------------------------------------------------------- */ 476 { 477 set_ui16matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 478 } 479 /* ------------------------------------------------------------------------- */ 480 IMAGE_EXPORT(void) set_si32matrix_j(sint32 **m, int i0, int i1, int j0, int j1) 481 /* ------------------------------------------------------------------------- */ 482 { 483 set_si32matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 484 } 485 /* ------------------------------------------------------------------------- */ 486 IMAGE_EXPORT(void) set_ui32matrix_j(uint32 **m, int i0, int i1, int j0, int j1) 487 /* ------------------------------------------------------------------------- */ 488 { 489 set_ui32matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 490 } 491 /* ------------------------------------------------------------------------- */ 492 IMAGE_EXPORT(void) set_si64matrix_j(sint64 **m, int i0, int i1, int j0, int j1) 493 /* ------------------------------------------------------------------------- */ 494 { 495 set_si64matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 496 } 497 /* ------------------------------------------------------------------------- */ 498 IMAGE_EXPORT(void) set_ui64matrix_j(uint64 **m, int i0, int i1, int j0, int j1) 499 /* ------------------------------------------------------------------------- */ 500 { 501 set_ui64matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 502 } 503 /* ------------------------------------------------------------------------- */ 504 IMAGE_EXPORT(void) set_f32matrix_j(float32 **m, int i0, int i1, int j0, int j1) 505 /* ------------------------------------------------------------------------- */ 506 { 507 set_f32matrix_param(m, i0, i1, j0, j1, (float32)j0,(float32)1, (float32)0); 508 } 509 /* ------------------------------------------------------------------------- */ 510 IMAGE_EXPORT(void) set_f64matrix_j(float64 **m, int i0, int i1, int j0, int j1) 511 /* ------------------------------------------------------------------------- */ 512 { 513 set_f64matrix_param(m, i0, i1, j0, j1, j0,(float64)1, (float64)0); 514 } 515 /* ----------------------------------------------------------------------- */ 516 IMAGE_EXPORT(void) set_rgb8matrix_j(rgb8 **m, int i0, int i1, int j0, int j1) 517 /* ----------------------------------------------------------------------- */ 518 { 519 rgb8 x, xstep, ystep; 520 521 x.r = x.g = x.b = j0; 199 200 #undef set_type_matrix_j 201 #define set_type_matrix_j(t) \ 202 void short_name(t,set_,matrix_j)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) \ 203 { \ 204 short_name(t,set_,matrix_param)(m, i0, i1, j0, j1, j0, 1, 0); \ 205 } 206 207 set_type_matrix_j(int8_t); 208 set_type_matrix_j(uint8_t); 209 set_type_matrix_j(int16_t); 210 set_type_matrix_j(uint16_t); 211 set_type_matrix_j(int32_t); 212 set_type_matrix_j(uint32_t); 213 set_type_matrix_j(int64_t); 214 set_type_matrix_j(uint64_t); 215 set_type_matrix_j(float); 216 set_type_matrix_j(double); 217 218 219 220 void set_rgb8matrix_j(rgb8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) 221 { 222 rgb8 x; 223 rgb8 xstep; 224 rgb8 ystep; 225 226 x.r = x.g = x.b = j0; 522 227 xstep.r = xstep.g = xstep.b = 1; 523 228 ystep.r = ystep.g = ystep.b = 0; … … 525 230 set_rgb8matrix_param(m, i0, i1, j0, j1, x, xstep, ystep); 526 231 } 527 /* ------------------------------------------------------------------------- */ 528 IMAGE_EXPORT(void) set_rgbx8matrix_j(rgbx8 **m, int i0, int i1, int j0, int j1) 529 /* ------------------------------------------------------------------------- */ 232 233 void set_rgbx8matrix_j(rgbx8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) 530 234 { 531 235 rgbx8 x, xstep, ystep; 532 236 533 x.r = x.g = x.b = j0; x.x = 255; 534 xstep.r = xstep.g = xstep.b = 1; xstep.x = 255; 535 ystep.r = ystep.g = ystep.b = 0; ystep.x = 255; 237 x.r = x.g = x.b = j0; 238 x.x = 255; 239 xstep.r = xstep.g = xstep.b = 1; 240 xstep.x = 255; 241 ystep.r = ystep.g = ystep.b = 0; 242 ystep.x = 255; 536 243 537 244 set_rgbx8matrix_param(m, i0, i1, j0, j1, x, xstep, ystep); 538 }/* 245 } 246 247 /* 539 248 * -------------- 540 249 * --- autres --- 541 250 * -------------- 542 251 */ 543 /* ------------------------------------------------------------------------------------ */ 544 IMAGE_EXPORT(void) set_ui8matrix_border1(uint8 **m,int i0, int i1, int j0, int j1, uint8 x) 545 /* ------------------------------------------------------------------------------------- */ 546 { 547 int i; 548 549 set_ui8vector(m[i0], j0, j1, x); 550 551 for(i=i0+1; i<=i1-1; i++) { 552 m[i][j0] = x; 553 m[i][j1] = x; 554 } 555 556 set_ui8vector(m[i0], j0, j1, x); 557 } 558 /* --------------------------------------------------------------------------------------- */ 559 IMAGE_EXPORT(void) set_ui8matrix_border(uint8 **m,int i0,int i1,int j0, int j1, int n, uint8 x) 560 /* --------------------------------------------------------------------------------------- */ 561 { 562 int i, j; 563 uint8 *Xi=NULL; 564 565 for(i=i0; i<i0+n; i++) { 566 Xi = m[i]; 567 for(j=j0; j<=j1; j++) { 568 Xi[j] = x; 569 } 570 } 571 572 for(i=i0+n; i<i1; i++) { 573 Xi = m[i]; 574 for(j=0; j<n; j++) { 575 Xi[j0+j] = x; 576 Xi[j1-j] = x; 577 } 578 } 579 580 for(i=i1-n+1; i<=i1; i++) { 581 Xi = m[i]; 582 for(j=j0; j<=j1; j++) { 583 Xi[j] = x; 584 } 585 } 586 } 252 253 #undef set_type_matrix_border1 254 #define set_type_matrix_border1(t) \ 255 void short_name(t,set_,matrix_border1)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, t x) \ 256 { \ 257 short_name(t,set_,vector)(m[i0], j0, j1, x); \ 258 for (int32_t i = i0 + 1; i <= i1 - 1; i++) { \ 259 m[i][j0] = x; \ 260 m[i][j1] = x; \ 261 } \ 262 short_name(t,set_,vector)(m[i0], j0, j1, x); \ 263 } 264 265 266 set_type_matrix_border1(int8_t); 267 set_type_matrix_border1(uint8_t); 268 set_type_matrix_border1(int16_t); 269 set_type_matrix_border1(uint16_t); 270 set_type_matrix_border1(int32_t); 271 set_type_matrix_border1(uint32_t); 272 set_type_matrix_border1(int64_t); 273 set_type_matrix_border1(uint64_t); 274 set_type_matrix_border1(float); 275 set_type_matrix_border1(double); 276 277 278 #undef set_type_matrix_border 279 #define set_type_matrix_border(t) \ 280 void short_name(t,set_,matrix_border)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, int32_t n, t x) \ 281 { \ 282 t * Xi = NULL; \ 283 for (int32_t i = i0; i < i0 + n; i++) { \ 284 Xi = m[i]; \ 285 for (int32_t j = j0; j <= j1; j++) { \ 286 Xi[j] = x; \ 287 } \ 288 } \ 289 for (int32_t i = i0 + n; i < i1; i++) { \ 290 Xi = m[i]; \ 291 for (int32_t j = 0; j < n; j++) { \ 292 Xi[j0 + j] = x; \ 293 Xi[j1 - j] = x; \ 294 } \ 295 } \ 296 for (int32_t i = i1 - n + 1; i <= i1; i++) { \ 297 Xi = m[i]; \ 298 for (int32_t j = j0; j <= j1; j++) { \ 299 Xi[j] = x; \ 300 } \ 301 } \ 302 } 303 304 305 set_type_matrix_border(int8_t); 306 set_type_matrix_border(uint8_t); 307 set_type_matrix_border(int16_t); 308 set_type_matrix_border(uint16_t); 309 set_type_matrix_border(int32_t); 310 set_type_matrix_border(uint32_t); 311 set_type_matrix_border(int64_t); 312 set_type_matrix_border(uint64_t); 313 set_type_matrix_border(float); 314 set_type_matrix_border(double); 315 316 317 // Local Variables: 318 // tab-width: 4 319 // c-basic-offset: 4 320 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 321 // indent-tabs-mode: nil 322 // End: 323 324 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 325
Note: See TracChangeset
for help on using the changeset viewer.