[772] | 1 | /* ------------------ */ |
---|
| 2 | /* --- nrmem2XX.c --- */ |
---|
| 3 | /* ------------------ */ |
---|
| 4 | |
---|
| 5 | /* |
---|
| 6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
| 7 | * Univ Paris Sud XI, CNRS |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #include "def.h" |
---|
| 11 | #include "nrmem1.h" |
---|
| 12 | #include "nrmem2.h" |
---|
| 13 | #include "nrmem2X.h" |
---|
| 14 | #include "nrmem2XX.h" |
---|
| 15 | /* ---------------------------- */ |
---|
| 16 | /* --- Left & right Rotate --- */ |
---|
| 17 | /* ---------------------------- */ |
---|
| 18 | // (i,j) -> (n-j,i) -> (n-i,n-j) -> (j,n-i) -> |
---|
| 19 | /* -------------------------------------------------------------------------------------- */ |
---|
| 20 | IMAGE_EXPORT(void) lrotate_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch, byte **D) |
---|
| 21 | /* -------------------------------------------------------------------------------------- */ |
---|
| 22 | { |
---|
| 23 | int i, j, n = nrl + nrh; |
---|
| 24 | for(i=nrl; i<=nrh; i++) { |
---|
| 25 | for(j=ncl; j<=nch; j++) { |
---|
| 26 | D[n-j][i] = S[i][j]; |
---|
| 27 | } |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 31 | IMAGE_EXPORT(void) lrotate_smatrix(short **S, long nrl,long nrh,long ncl, long nch, short **D) |
---|
| 32 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 33 | { |
---|
| 34 | int i, j, n = nrl + nrh; |
---|
| 35 | for(i=nrl; i<=nrh; i++) { |
---|
| 36 | for(j=ncl; j<=nch; j++) { |
---|
| 37 | D[n-j][i] = S[i][j]; |
---|
| 38 | } |
---|
| 39 | } |
---|
| 40 | } |
---|
| 41 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 42 | IMAGE_EXPORT(void) lrotate_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D) |
---|
| 43 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 44 | { |
---|
| 45 | int i, j, n = nrl + nrh; |
---|
| 46 | for(i=nrl; i<=nrh; i++) { |
---|
| 47 | for(j=ncl; j<=nch; j++) { |
---|
| 48 | D[n-j][i] = S[i][j]; |
---|
| 49 | } |
---|
| 50 | } |
---|
| 51 | } |
---|
| 52 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 53 | IMAGE_EXPORT(void) lrotate_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch, int16 **D) |
---|
| 54 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 55 | { |
---|
| 56 | int i, j, n = nrl + nrh; |
---|
| 57 | for(i=nrl; i<=nrh; i++) { |
---|
| 58 | for(j=ncl; j<=nch; j++) { |
---|
| 59 | D[n-j][i] = S[i][j]; |
---|
| 60 | } |
---|
| 61 | } |
---|
| 62 | } |
---|
| 63 | /* --------------------------------------------------------------------------------------------- */ |
---|
| 64 | IMAGE_EXPORT(void) lrotate_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D) |
---|
| 65 | /* --------------------------------------------------------------------------------------------- */ |
---|
| 66 | { |
---|
| 67 | int i, j, n = nrl + nrh; |
---|
| 68 | for(i=nrl; i<=nrh; i++) { |
---|
| 69 | for(j=ncl; j<=nch; j++) { |
---|
| 70 | D[n-j][i] = S[i][j]; |
---|
| 71 | } |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | /* ------------------------------------------------------------------------------------ */ |
---|
| 75 | IMAGE_EXPORT(void) lrotate_imatrix(int **S, long nrl,long nrh,long ncl, long nch, int **D) |
---|
| 76 | /* ------------------------------------------------------------------------------------ */ |
---|
| 77 | { |
---|
| 78 | int i, j, n = nrl + nrh; |
---|
| 79 | for(i=nrl; i<=nrh; i++) { |
---|
| 80 | for(j=ncl; j<=nch; j++) { |
---|
| 81 | D[n-j][i] = S[i][j]; |
---|
| 82 | } |
---|
| 83 | } |
---|
| 84 | } |
---|
| 85 | /* --------------------------------------------------------------------------------------- */ |
---|
| 86 | IMAGE_EXPORT(void) lrotate_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch, uint **D) |
---|
| 87 | /* --------------------------------------------------------------------------------------- */ |
---|
| 88 | { |
---|
| 89 | int i, j, n = nrl + nrh; |
---|
| 90 | for(i=nrl; i<=nrh; i++) { |
---|
| 91 | for(j=ncl; j<=nch; j++) { |
---|
| 92 | D[n-j][i] = S[i][j]; |
---|
| 93 | } |
---|
| 94 | } |
---|
| 95 | } |
---|
| 96 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 97 | IMAGE_EXPORT(void) lrotate_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D) |
---|
| 98 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 99 | { |
---|
| 100 | int i, j, n = nrl + nrh; |
---|
| 101 | for(i=nrl; i<=nrh; i++) { |
---|
| 102 | for(j=ncl; j<=nch; j++) { |
---|
| 103 | D[n-j][i] = S[i][j]; |
---|
| 104 | } |
---|
| 105 | } |
---|
| 106 | } |
---|
| 107 | /* --------------------------------------------------------------------------------------------- */ |
---|
| 108 | IMAGE_EXPORT(void) lrotate_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D) |
---|
| 109 | /* --------------------------------------------------------------------------------------------- */ |
---|
| 110 | { |
---|
| 111 | int i, j, n = nrl + nrh; |
---|
| 112 | for(i=nrl; i<=nrh; i++) { |
---|
| 113 | for(j=ncl; j<=nch; j++) { |
---|
| 114 | D[n-j][i] = S[i][j]; |
---|
| 115 | } |
---|
| 116 | } |
---|
| 117 | } |
---|
| 118 | /* --------------------------------------------------------------------------------------- */ |
---|
| 119 | IMAGE_EXPORT(void) lrotate_matrix(float **S, long nrl,long nrh,long ncl, long nch, float **D) |
---|
| 120 | /* --------------------------------------------------------------------------------------- */ |
---|
| 121 | { |
---|
| 122 | int i, j, n = nrl + nrh; |
---|
| 123 | for(i=nrl; i<=nrh; i++) { |
---|
| 124 | for(j=ncl; j<=nch; j++) { |
---|
| 125 | D[n-j][i] = S[i][j]; |
---|
| 126 | } |
---|
| 127 | } |
---|
| 128 | } |
---|
| 129 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 130 | IMAGE_EXPORT(void) lrotate_dmatrix(double **S, long nrl,long nrh,long ncl, long nch, double **D) |
---|
| 131 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 132 | { |
---|
| 133 | int i, j, n = nrl + nrh; |
---|
| 134 | for(i=nrl; i<=nrh; i++) { |
---|
| 135 | for(j=ncl; j<=nch; j++) { |
---|
| 136 | D[n-j][i] = S[i][j]; |
---|
| 137 | } |
---|
| 138 | } |
---|
| 139 | } |
---|
| 140 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 141 | IMAGE_EXPORT(void) lrotate_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D) |
---|
| 142 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 143 | { |
---|
| 144 | int i, j, n = nrl + nrh; |
---|
| 145 | for(i=nrl; i<=nrh; i++) { |
---|
| 146 | for(j=ncl; j<=nch; j++) { |
---|
| 147 | D[n-j][i] = S[i][j]; |
---|
| 148 | } |
---|
| 149 | } |
---|
| 150 | } |
---|
| 151 | /* -------------------------------------------------------------------------------------- */ |
---|
| 152 | IMAGE_EXPORT(void) rrotate_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch, byte **D) |
---|
| 153 | /* -------------------------------------------------------------------------------------- */ |
---|
| 154 | { |
---|
| 155 | int i, j, n = nrl + nrh; |
---|
| 156 | for(i=nrl; i<=nrh; i++) { |
---|
| 157 | for(j=ncl; j<=nch; j++) { |
---|
| 158 | D[i][j] = S[n-j][i]; |
---|
| 159 | } |
---|
| 160 | } |
---|
| 161 | } |
---|
| 162 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 163 | IMAGE_EXPORT(void) rrotate_smatrix(short **S, long nrl,long nrh,long ncl, long nch, short **D) |
---|
| 164 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 165 | { |
---|
| 166 | int i, j, n = nrl + nrh; |
---|
| 167 | for(i=nrl; i<=nrh; i++) { |
---|
| 168 | for(j=ncl; j<=nch; j++) { |
---|
| 169 | D[i][j] = S[n-j][i]; |
---|
| 170 | } |
---|
| 171 | } |
---|
| 172 | } |
---|
| 173 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 174 | IMAGE_EXPORT(void) rrotate_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D) |
---|
| 175 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 176 | { |
---|
| 177 | int i, j, n = nrl + nrh; |
---|
| 178 | for(i=nrl; i<=nrh; i++) { |
---|
| 179 | for(j=ncl; j<=nch; j++) { |
---|
| 180 | D[i][j] = S[n-j][i]; |
---|
| 181 | } |
---|
| 182 | } |
---|
| 183 | } |
---|
| 184 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 185 | IMAGE_EXPORT(void) rrotate_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch, int16 **D) |
---|
| 186 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 187 | { |
---|
| 188 | int i, j, n = nrl + nrh; |
---|
| 189 | for(i=nrl; i<=nrh; i++) { |
---|
| 190 | for(j=ncl; j<=nch; j++) { |
---|
| 191 | D[i][j] = S[n-j][i]; |
---|
| 192 | } |
---|
| 193 | } |
---|
| 194 | } |
---|
| 195 | /* --------------------------------------------------------------------------------------------- */ |
---|
| 196 | IMAGE_EXPORT(void) rrotate_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D) |
---|
| 197 | /* --------------------------------------------------------------------------------------------- */ |
---|
| 198 | { |
---|
| 199 | int i, j, n = nrl + nrh; |
---|
| 200 | for(i=nrl; i<=nrh; i++) { |
---|
| 201 | for(j=ncl; j<=nch; j++) { |
---|
| 202 | D[i][j] = S[n-j][i]; |
---|
| 203 | } |
---|
| 204 | } |
---|
| 205 | } |
---|
| 206 | /* ------------------------------------------------------------------------------------ */ |
---|
| 207 | IMAGE_EXPORT(void) rrotate_imatrix(int **S, long nrl,long nrh,long ncl, long nch, int **D) |
---|
| 208 | /* ------------------------------------------------------------------------------------ */ |
---|
| 209 | { |
---|
| 210 | int i, j, n = nrl + nrh; |
---|
| 211 | for(i=nrl; i<=nrh; i++) { |
---|
| 212 | for(j=ncl; j<=nch; j++) { |
---|
| 213 | D[i][j] = S[n-j][i]; |
---|
| 214 | } |
---|
| 215 | } |
---|
| 216 | } |
---|
| 217 | /* --------------------------------------------------------------------------------------- */ |
---|
| 218 | IMAGE_EXPORT(void) rrotate_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch, uint **D) |
---|
| 219 | /* --------------------------------------------------------------------------------------- */ |
---|
| 220 | { |
---|
| 221 | int i, j, n = nrl + nrh; |
---|
| 222 | for(i=nrl; i<=nrh; i++) { |
---|
| 223 | for(j=ncl; j<=nch; j++) { |
---|
| 224 | D[i][j] = S[n-j][i]; |
---|
| 225 | } |
---|
| 226 | } |
---|
| 227 | } |
---|
| 228 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 229 | IMAGE_EXPORT(void) rrotate_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D) |
---|
| 230 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 231 | { |
---|
| 232 | int i, j, n = nrl + nrh; |
---|
| 233 | for(i=nrl; i<=nrh; i++) { |
---|
| 234 | for(j=ncl; j<=nch; j++) { |
---|
| 235 | D[i][j] = S[n-j][i]; |
---|
| 236 | } |
---|
| 237 | } |
---|
| 238 | } |
---|
| 239 | /* --------------------------------------------------------------------------------------------- */ |
---|
| 240 | IMAGE_EXPORT(void) rrotate_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D) |
---|
| 241 | /* --------------------------------------------------------------------------------------------- */ |
---|
| 242 | { |
---|
| 243 | int i, j, n = nrl + nrh; |
---|
| 244 | for(i=nrl; i<=nrh; i++) { |
---|
| 245 | for(j=ncl; j<=nch; j++) { |
---|
| 246 | D[i][j] = S[n-j][i]; |
---|
| 247 | } |
---|
| 248 | } |
---|
| 249 | } |
---|
| 250 | /* --------------------------------------------------------------------------------------- */ |
---|
| 251 | IMAGE_EXPORT(void) rrotate_matrix(float **S, long nrl,long nrh,long ncl, long nch, float **D) |
---|
| 252 | /* --------------------------------------------------------------------------------------- */ |
---|
| 253 | { |
---|
| 254 | int i, j, n = nrl + nrh; |
---|
| 255 | for(i=nrl; i<=nrh; i++) { |
---|
| 256 | for(j=ncl; j<=nch; j++) { |
---|
| 257 | D[i][j] = S[n-j][i]; |
---|
| 258 | } |
---|
| 259 | } |
---|
| 260 | } |
---|
| 261 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 262 | IMAGE_EXPORT(void) rrotate_dmatrix(double **S, long nrl,long nrh,long ncl, long nch, double **D) |
---|
| 263 | /* ------------------------------------------------------------------------------------------ */ |
---|
| 264 | { |
---|
| 265 | int i, j, n = nrl + nrh; |
---|
| 266 | for(i=nrl; i<=nrh; i++) { |
---|
| 267 | for(j=ncl; j<=nch; j++) { |
---|
| 268 | D[i][j] = S[n-j][i]; |
---|
| 269 | } |
---|
| 270 | } |
---|
| 271 | } |
---|
| 272 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 273 | IMAGE_EXPORT(void) rrotate_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D) |
---|
| 274 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 275 | { |
---|
| 276 | int i, j, n = nrl + nrh; |
---|
| 277 | for(i=nrl; i<=nrh; i++) { |
---|
| 278 | for(j=ncl; j<=nch; j++) { |
---|
| 279 | D[i][j] = S[n-j][i]; |
---|
| 280 | } |
---|
| 281 | } |
---|
| 282 | } |
---|
| 283 | /* ----------------------------------------------------------------------------- */ |
---|
| 284 | IMAGE_EXPORT(void) lrotate1_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch) |
---|
| 285 | /* ----------------------------------------------------------------------------- */ |
---|
| 286 | { |
---|
| 287 | int i, j, n = nrl + nrh; |
---|
| 288 | byte t; |
---|
| 289 | |
---|
| 290 | for(i=nrl; i<=nrh; i++) { |
---|
| 291 | for(j=ncl; j<=nch; j++) { |
---|
| 292 | t = S[n-j][i]; |
---|
| 293 | S[n-j][i] = S[i][j]; |
---|
| 294 | S[i][j] = t; |
---|
| 295 | } |
---|
| 296 | } |
---|
| 297 | } |
---|
| 298 | /* ------------------------------------------------------------------------------ */ |
---|
| 299 | IMAGE_EXPORT(void) lrotate1_smatrix(short **S, long nrl,long nrh,long ncl, long nch) |
---|
| 300 | /* ------------------------------------------------------------------------------ */ |
---|
| 301 | { |
---|
| 302 | int i, j, n = nrl + nrh; |
---|
| 303 | short t; |
---|
| 304 | |
---|
| 305 | for(i=nrl; i<=nrh; i++) { |
---|
| 306 | for(j=ncl; j<=nch; j++) { |
---|
| 307 | t = S[n-j][i]; |
---|
| 308 | S[n-j][i] = S[i][j]; |
---|
| 309 | S[i][j] = t; |
---|
| 310 | } |
---|
| 311 | } |
---|
| 312 | } |
---|
| 313 | /* -------------------------------------------------------------------------------- */ |
---|
| 314 | IMAGE_EXPORT(void) lrotate1_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch) |
---|
| 315 | /* -------------------------------------------------------------------------------- */ |
---|
| 316 | { |
---|
| 317 | int i, j, n = nrl + nrh; |
---|
| 318 | ushort t; |
---|
| 319 | |
---|
| 320 | for(i=nrl; i<=nrh; i++) { |
---|
| 321 | for(j=ncl; j<=nch; j++) { |
---|
| 322 | t = S[n-j][i]; |
---|
| 323 | S[n-j][i] = S[i][j]; |
---|
| 324 | S[i][j] = t; |
---|
| 325 | } |
---|
| 326 | } |
---|
| 327 | } |
---|
| 328 | /* -------------------------------------------------------------------------------- */ |
---|
| 329 | IMAGE_EXPORT(void) lrotate1_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 330 | /* -------------------------------------------------------------------------------- */ |
---|
| 331 | { |
---|
| 332 | int i, j, n = nrl + nrh; |
---|
| 333 | int16 t; |
---|
| 334 | |
---|
| 335 | for(i=nrl; i<=nrh; i++) { |
---|
| 336 | for(j=ncl; j<=nch; j++) { |
---|
| 337 | t = S[n-j][i]; |
---|
| 338 | S[n-j][i] = S[i][j]; |
---|
| 339 | S[i][j] = t; |
---|
| 340 | } |
---|
| 341 | } |
---|
| 342 | } |
---|
| 343 | /* ---------------------------------------------------------------------------------- */ |
---|
| 344 | IMAGE_EXPORT(void) lrotate1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 345 | /* ---------------------------------------------------------------------------------- */ |
---|
| 346 | { |
---|
| 347 | int i, j, n = nrl + nrh; |
---|
| 348 | uint16 t; |
---|
| 349 | |
---|
| 350 | for(i=nrl; i<=nrh; i++) { |
---|
| 351 | for(j=ncl; j<=nch; j++) { |
---|
| 352 | t = S[n-j][i]; |
---|
| 353 | S[n-j][i] = S[i][j]; |
---|
| 354 | S[i][j] = t; |
---|
| 355 | } |
---|
| 356 | } |
---|
| 357 | } |
---|
| 358 | /* ---------------------------------------------------------------------------- */ |
---|
| 359 | IMAGE_EXPORT(void) lrotate1_imatrix(int **S, long nrl,long nrh,long ncl, long nch) |
---|
| 360 | /* ---------------------------------------------------------------------------- */ |
---|
| 361 | { |
---|
| 362 | int i, j, n = nrl + nrh; |
---|
| 363 | int t; |
---|
| 364 | |
---|
| 365 | for(i=nrl; i<=nrh; i++) { |
---|
| 366 | for(j=ncl; j<=nch; j++) { |
---|
| 367 | t = S[n-j][i]; |
---|
| 368 | S[n-j][i] = S[i][j]; |
---|
| 369 | S[i][j] = t; |
---|
| 370 | } |
---|
| 371 | } |
---|
| 372 | } |
---|
| 373 | /* ------------------------------------------------------------------------------ */ |
---|
| 374 | IMAGE_EXPORT(void) lrotate1_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch) |
---|
| 375 | /* ------------------------------------------------------------------------------ */ |
---|
| 376 | { |
---|
| 377 | int i, j, n = nrl + nrh; |
---|
| 378 | uint t; |
---|
| 379 | |
---|
| 380 | for(i=nrl; i<=nrh; i++) { |
---|
| 381 | for(j=ncl; j<=nch; j++) { |
---|
| 382 | t = S[n-j][i]; |
---|
| 383 | S[n-j][i] = S[i][j]; |
---|
| 384 | S[i][j] = t; |
---|
| 385 | } |
---|
| 386 | } |
---|
| 387 | } |
---|
| 388 | /* -------------------------------------------------------------------------------- */ |
---|
| 389 | IMAGE_EXPORT(void) lrotate1_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 390 | /* -------------------------------------------------------------------------------- */ |
---|
| 391 | { |
---|
| 392 | int i, j, n = nrl + nrh; |
---|
| 393 | int32 t; |
---|
| 394 | |
---|
| 395 | for(i=nrl; i<=nrh; i++) { |
---|
| 396 | for(j=ncl; j<=nch; j++) { |
---|
| 397 | t = S[n-j][i]; |
---|
| 398 | S[n-j][i] = S[i][j]; |
---|
| 399 | S[i][j] = t; |
---|
| 400 | } |
---|
| 401 | } |
---|
| 402 | } |
---|
| 403 | /* ---------------------------------------------------------------------------------- */ |
---|
| 404 | IMAGE_EXPORT(void) lrotate1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 405 | /* ---------------------------------------------------------------------------------- */ |
---|
| 406 | { |
---|
| 407 | int i, j, n = nrl + nrh; |
---|
| 408 | uint32 t; |
---|
| 409 | |
---|
| 410 | for(i=nrl; i<=nrh; i++) { |
---|
| 411 | for(j=ncl; j<=nch; j++) { |
---|
| 412 | t = S[n-j][i]; |
---|
| 413 | S[n-j][i] = S[i][j]; |
---|
| 414 | S[i][j] = t; |
---|
| 415 | } |
---|
| 416 | } |
---|
| 417 | } |
---|
| 418 | /* ----------------------------------------------------------------------------- */ |
---|
| 419 | IMAGE_EXPORT(void) lrotate1_matrix(float **S, long nrl,long nrh,long ncl, long nch) |
---|
| 420 | /* ----------------------------------------------------------------------------- */ |
---|
| 421 | { |
---|
| 422 | int i, j, n = nrl + nrh; |
---|
| 423 | float t; |
---|
| 424 | |
---|
| 425 | for(i=nrl; i<=nrh; i++) { |
---|
| 426 | for(j=ncl; j<=nch; j++) { |
---|
| 427 | t = S[n-j][i]; |
---|
| 428 | S[n-j][i] = S[i][j]; |
---|
| 429 | S[i][j] = t; |
---|
| 430 | } |
---|
| 431 | } |
---|
| 432 | } |
---|
| 433 | /* ------------------------------------------------------------------------------- */ |
---|
| 434 | IMAGE_EXPORT(void) lrotate1_dmatrix(double **S, long nrl,long nrh,long ncl, long nch) |
---|
| 435 | /* ------------------------------------------------------------------------------- */ |
---|
| 436 | { |
---|
| 437 | int i, j, n = nrl + nrh; |
---|
| 438 | double t; |
---|
| 439 | |
---|
| 440 | for(i=nrl; i<=nrh; i++) { |
---|
| 441 | for(j=ncl; j<=nch; j++) { |
---|
| 442 | t = S[n-j][i]; |
---|
| 443 | S[n-j][i] = S[i][j]; |
---|
| 444 | S[i][j] = t; |
---|
| 445 | } |
---|
| 446 | } |
---|
| 447 | } |
---|
| 448 | /* -------------------------------------------------------------------------------- */ |
---|
| 449 | IMAGE_EXPORT(void) lrotate1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 450 | /* -------------------------------------------------------------------------------- */ |
---|
| 451 | { |
---|
| 452 | int i, j, n = nrl + nrh; |
---|
| 453 | rgb8 t; |
---|
| 454 | |
---|
| 455 | for(i=nrl; i<=nrh; i++) { |
---|
| 456 | for(j=ncl; j<=nch; j++) { |
---|
| 457 | t = S[n-j][i]; |
---|
| 458 | S[n-j][i] = S[i][j]; |
---|
| 459 | S[i][j] = t; |
---|
| 460 | } |
---|
| 461 | } |
---|
| 462 | } |
---|
| 463 | /* ----------------------------------------------------------------------------- */ |
---|
| 464 | IMAGE_EXPORT(void) rrotate1_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch) |
---|
| 465 | /* ----------------------------------------------------------------------------- */ |
---|
| 466 | { |
---|
| 467 | int i, j, n = nrl + nrh; |
---|
| 468 | byte t; |
---|
| 469 | |
---|
| 470 | for(i=nrl; i<=nrh; i++) { |
---|
| 471 | for(j=ncl; j<=nch; j++) { |
---|
| 472 | t = S[i][j]; |
---|
| 473 | S[i][j] = S[n-j][i]; |
---|
| 474 | S[n-j][i] = t; |
---|
| 475 | } |
---|
| 476 | } |
---|
| 477 | } |
---|
| 478 | /* ------------------------------------------------------------------------------ */ |
---|
| 479 | IMAGE_EXPORT(void) rrotate1_smatrix(short **S, long nrl,long nrh,long ncl, long nch) |
---|
| 480 | /* ------------------------------------------------------------------------------ */ |
---|
| 481 | { |
---|
| 482 | int i, j, n = nrl + nrh; |
---|
| 483 | short t; |
---|
| 484 | |
---|
| 485 | for(i=nrl; i<=nrh; i++) { |
---|
| 486 | for(j=ncl; j<=nch; j++) { |
---|
| 487 | t = S[i][j]; |
---|
| 488 | S[i][j] = S[n-j][i]; |
---|
| 489 | S[n-j][i] = t; |
---|
| 490 | } |
---|
| 491 | } |
---|
| 492 | } |
---|
| 493 | /* -------------------------------------------------------------------------------- */ |
---|
| 494 | IMAGE_EXPORT(void) rrotate1_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch) |
---|
| 495 | /* -------------------------------------------------------------------------------- */ |
---|
| 496 | { |
---|
| 497 | int i, j, n = nrl + nrh; |
---|
| 498 | ushort t; |
---|
| 499 | |
---|
| 500 | for(i=nrl; i<=nrh; i++) { |
---|
| 501 | for(j=ncl; j<=nch; j++) { |
---|
| 502 | t = S[i][j]; |
---|
| 503 | S[i][j] = S[n-j][i]; |
---|
| 504 | S[n-j][i] = t; |
---|
| 505 | } |
---|
| 506 | } |
---|
| 507 | } |
---|
| 508 | /* -------------------------------------------------------------------------------- */ |
---|
| 509 | IMAGE_EXPORT(void) rrotate1_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 510 | /* -------------------------------------------------------------------------------- */ |
---|
| 511 | { |
---|
| 512 | int i, j, n = nrl + nrh; |
---|
| 513 | int16 t; |
---|
| 514 | |
---|
| 515 | for(i=nrl; i<=nrh; i++) { |
---|
| 516 | for(j=ncl; j<=nch; j++) { |
---|
| 517 | t = S[i][j]; |
---|
| 518 | S[i][j] = S[n-j][i]; |
---|
| 519 | S[n-j][i] = t; |
---|
| 520 | } |
---|
| 521 | } |
---|
| 522 | } |
---|
| 523 | /* ---------------------------------------------------------------------------------- */ |
---|
| 524 | IMAGE_EXPORT(void) rrotate1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 525 | /* ---------------------------------------------------------------------------------- */ |
---|
| 526 | { |
---|
| 527 | int i, j, n = nrl + nrh; |
---|
| 528 | uint16 t; |
---|
| 529 | |
---|
| 530 | for(i=nrl; i<=nrh; i++) { |
---|
| 531 | for(j=ncl; j<=nch; j++) { |
---|
| 532 | t = S[i][j]; |
---|
| 533 | S[i][j] = S[n-j][i]; |
---|
| 534 | S[n-j][i] = t; |
---|
| 535 | } |
---|
| 536 | } |
---|
| 537 | } |
---|
| 538 | /* ---------------------------------------------------------------------------- */ |
---|
| 539 | IMAGE_EXPORT(void) rrotate1_imatrix(int **S, long nrl,long nrh,long ncl, long nch) |
---|
| 540 | /* ---------------------------------------------------------------------------- */ |
---|
| 541 | { |
---|
| 542 | int i, j, n = nrl + nrh; |
---|
| 543 | int t; |
---|
| 544 | |
---|
| 545 | for(i=nrl; i<=nrh; i++) { |
---|
| 546 | for(j=ncl; j<=nch; j++) { |
---|
| 547 | t = S[i][j]; |
---|
| 548 | S[i][j] = S[n-j][i]; |
---|
| 549 | S[n-j][i] = t; |
---|
| 550 | } |
---|
| 551 | } |
---|
| 552 | } |
---|
| 553 | /* ------------------------------------------------------------------------------ */ |
---|
| 554 | IMAGE_EXPORT(void) rrotate1_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch) |
---|
| 555 | /* ------------------------------------------------------------------------------ */ |
---|
| 556 | { |
---|
| 557 | int i, j, n = nrl + nrh; |
---|
| 558 | uint t; |
---|
| 559 | |
---|
| 560 | for(i=nrl; i<=nrh; i++) { |
---|
| 561 | for(j=ncl; j<=nch; j++) { |
---|
| 562 | t = S[i][j]; |
---|
| 563 | S[i][j] = S[n-j][i]; |
---|
| 564 | S[n-j][i] = t; |
---|
| 565 | } |
---|
| 566 | } |
---|
| 567 | } |
---|
| 568 | /* -------------------------------------------------------------------------------- */ |
---|
| 569 | IMAGE_EXPORT(void) rrotate1_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 570 | /* -------------------------------------------------------------------------------- */ |
---|
| 571 | { |
---|
| 572 | int i, j, n = nrl + nrh; |
---|
| 573 | int32 t; |
---|
| 574 | |
---|
| 575 | for(i=nrl; i<=nrh; i++) { |
---|
| 576 | for(j=ncl; j<=nch; j++) { |
---|
| 577 | t = S[i][j]; |
---|
| 578 | S[i][j] = S[n-j][i]; |
---|
| 579 | S[n-j][i] = t; |
---|
| 580 | } |
---|
| 581 | } |
---|
| 582 | } |
---|
| 583 | /* ---------------------------------------------------------------------------------- */ |
---|
| 584 | IMAGE_EXPORT(void) rrotate1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 585 | /* ---------------------------------------------------------------------------------- */ |
---|
| 586 | { |
---|
| 587 | int i, j, n = nrl + nrh; |
---|
| 588 | uint32 t; |
---|
| 589 | |
---|
| 590 | for(i=nrl; i<=nrh; i++) { |
---|
| 591 | for(j=ncl; j<=nch; j++) { |
---|
| 592 | t = S[i][j]; |
---|
| 593 | S[i][j] = S[n-j][i]; |
---|
| 594 | S[n-j][i] = t; |
---|
| 595 | } |
---|
| 596 | } |
---|
| 597 | } |
---|
| 598 | /* ----------------------------------------------------------------------------- */ |
---|
| 599 | IMAGE_EXPORT(void) rrotate1_matrix(float **S, long nrl,long nrh,long ncl, long nch) |
---|
| 600 | /* ----------------------------------------------------------------------------- */ |
---|
| 601 | { |
---|
| 602 | int i, j, n = nrl + nrh; |
---|
| 603 | float t; |
---|
| 604 | |
---|
| 605 | for(i=nrl; i<=nrh; i++) { |
---|
| 606 | for(j=ncl; j<=nch; j++) { |
---|
| 607 | t = S[i][j]; |
---|
| 608 | S[i][j] = S[n-j][i]; |
---|
| 609 | S[n-j][i] = t; |
---|
| 610 | } |
---|
| 611 | } |
---|
| 612 | } |
---|
| 613 | /* ------------------------------------------------------------------------------- */ |
---|
| 614 | IMAGE_EXPORT(void) rrotate1_dmatrix(double **S, long nrl,long nrh,long ncl, long nch) |
---|
| 615 | /* ------------------------------------------------------------------------------- */ |
---|
| 616 | { |
---|
| 617 | int i, j, n = nrl + nrh; |
---|
| 618 | double t; |
---|
| 619 | |
---|
| 620 | for(i=nrl; i<=nrh; i++) { |
---|
| 621 | for(j=ncl; j<=nch; j++) { |
---|
| 622 | t = S[i][j]; |
---|
| 623 | S[i][j] = S[n-j][i]; |
---|
| 624 | S[n-j][i] = t; |
---|
| 625 | } |
---|
| 626 | } |
---|
| 627 | } |
---|
| 628 | /* -------------------------------------------------------------------------------- */ |
---|
| 629 | IMAGE_EXPORT(void) rrotate1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 630 | /* -------------------------------------------------------------------------------- */ |
---|
| 631 | { |
---|
| 632 | int i, j, n = nrl + nrh; |
---|
| 633 | rgb8 t; |
---|
| 634 | |
---|
| 635 | for(i=nrl; i<=nrh; i++) { |
---|
| 636 | for(j=ncl; j<=nch; j++) { |
---|
| 637 | t = S[i][j]; |
---|
| 638 | S[i][j] = S[n-j][i]; |
---|
| 639 | S[n-j][i] = t; |
---|
| 640 | } |
---|
| 641 | } |
---|
| 642 | } |
---|
| 643 | /* ---------------------------------- */ |
---|
| 644 | /* --- Horizontal & Vertical Flip --- */ |
---|
| 645 | /* ---------------------------------- */ |
---|
| 646 | |
---|
| 647 | /* ------------------------------------------------------------------------------------ */ |
---|
| 648 | IMAGE_EXPORT(void) hflip_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch, byte **D) |
---|
| 649 | /* ------------------------------------------------------------------------------------ */ |
---|
| 650 | { |
---|
| 651 | int i, j, n = ncl + nch; |
---|
| 652 | for(i=nrl; i<=nrh; i++) { |
---|
| 653 | for(j=ncl; j<=nch; j++) { |
---|
| 654 | D[i][n-j] = S[i][j]; |
---|
| 655 | } |
---|
| 656 | } |
---|
| 657 | } |
---|
| 658 | /* -------------------------------------------------------------------------------------- */ |
---|
| 659 | IMAGE_EXPORT(void) hflip_smatrix(short **S, long nrl,long nrh,long ncl, long nch, short **D) |
---|
| 660 | /* -------------------------------------------------------------------------------------- */ |
---|
| 661 | { |
---|
| 662 | int i, j, n = ncl + nch; |
---|
| 663 | for(i=nrl; i<=nrh; i++) { |
---|
| 664 | for(j=ncl; j<=nch; j++) { |
---|
| 665 | D[i][n-j] = S[i][j]; |
---|
| 666 | } |
---|
| 667 | } |
---|
| 668 | } |
---|
| 669 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 670 | IMAGE_EXPORT(void) hflip_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D) |
---|
| 671 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 672 | { |
---|
| 673 | int i, j, n = ncl + nch; |
---|
| 674 | for(i=nrl; i<=nrh; i++) { |
---|
| 675 | for(j=ncl; j<=nch; j++) { |
---|
| 676 | D[i][n-j] = S[i][j]; |
---|
| 677 | } |
---|
| 678 | } |
---|
| 679 | } |
---|
| 680 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 681 | IMAGE_EXPORT(void) hflip_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch, int16 **D) |
---|
| 682 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 683 | { |
---|
| 684 | int i, j, n = ncl + nch; |
---|
| 685 | for(i=nrl; i<=nrh; i++) { |
---|
| 686 | for(j=ncl; j<=nch; j++) { |
---|
| 687 | D[i][n-j] = S[i][j]; |
---|
| 688 | } |
---|
| 689 | } |
---|
| 690 | } |
---|
| 691 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 692 | IMAGE_EXPORT(void) hflip_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D) |
---|
| 693 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 694 | { |
---|
| 695 | int i, j, n = ncl + nch; |
---|
| 696 | for(i=nrl; i<=nrh; i++) { |
---|
| 697 | for(j=ncl; j<=nch; j++) { |
---|
| 698 | D[i][n-j] = S[i][j]; |
---|
| 699 | } |
---|
| 700 | } |
---|
| 701 | } |
---|
| 702 | /* ---------------------------------------------------------------------------------- */ |
---|
| 703 | IMAGE_EXPORT(void) hflip_imatrix(int **S, long nrl,long nrh,long ncl, long nch, int **D) |
---|
| 704 | /* ---------------------------------------------------------------------------------- */ |
---|
| 705 | { |
---|
| 706 | int i, j, n = ncl + nch; |
---|
| 707 | for(i=nrl; i<=nrh; i++) { |
---|
| 708 | for(j=ncl; j<=nch; j++) { |
---|
| 709 | D[i][n-j] = S[i][j]; |
---|
| 710 | } |
---|
| 711 | } |
---|
| 712 | } |
---|
| 713 | /* ------------------------------------------------------------------------------------- */ |
---|
| 714 | IMAGE_EXPORT(void) hflip_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch, uint **D) |
---|
| 715 | /* ------------------------------------------------------------------------------------- */ |
---|
| 716 | { |
---|
| 717 | int i, j, n = ncl + nch; |
---|
| 718 | for(i=nrl; i<=nrh; i++) { |
---|
| 719 | for(j=ncl; j<=nch; j++) { |
---|
| 720 | D[i][n-j] = S[i][j]; |
---|
| 721 | } |
---|
| 722 | } |
---|
| 723 | } |
---|
| 724 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 725 | IMAGE_EXPORT(void) hflip_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D) |
---|
| 726 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 727 | { |
---|
| 728 | int i, j, n = ncl + nch; |
---|
| 729 | for(i=nrl; i<=nrh; i++) { |
---|
| 730 | for(j=ncl; j<=nch; j++) { |
---|
| 731 | D[i][n-j] = S[i][j]; |
---|
| 732 | } |
---|
| 733 | } |
---|
| 734 | } |
---|
| 735 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 736 | IMAGE_EXPORT(void) hflip_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D) |
---|
| 737 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 738 | { |
---|
| 739 | int i, j, n = ncl + nch; |
---|
| 740 | for(i=nrl; i<=nrh; i++) { |
---|
| 741 | for(j=ncl; j<=nch; j++) { |
---|
| 742 | D[i][n-j] = S[i][j]; |
---|
| 743 | } |
---|
| 744 | } |
---|
| 745 | } |
---|
| 746 | /* ------------------------------------------------------------------------------------- */ |
---|
| 747 | IMAGE_EXPORT(void) hflip_matrix(float **S, long nrl,long nrh,long ncl, long nch, float **D) |
---|
| 748 | /* ------------------------------------------------------------------------------------- */ |
---|
| 749 | { |
---|
| 750 | int i, j, n = ncl + nch; |
---|
| 751 | for(i=nrl; i<=nrh; i++) { |
---|
| 752 | for(j=ncl; j<=nch; j++) { |
---|
| 753 | D[i][n-j] = S[i][j]; |
---|
| 754 | } |
---|
| 755 | } |
---|
| 756 | } |
---|
| 757 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 758 | IMAGE_EXPORT(void) hflip_dmatrix(double **S, long nrl,long nrh,long ncl, long nch, double **D) |
---|
| 759 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 760 | { |
---|
| 761 | int i, j, n = ncl + nch; |
---|
| 762 | for(i=nrl; i<=nrh; i++) { |
---|
| 763 | for(j=ncl; j<=nch; j++) { |
---|
| 764 | D[i][n-j] = S[i][j]; |
---|
| 765 | } |
---|
| 766 | } |
---|
| 767 | } |
---|
| 768 | /* --------------------------------------------------------------------------------------- */ |
---|
| 769 | IMAGE_EXPORT(void) hflip_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D) |
---|
| 770 | /* --------------------------------------------------------------------------------------- */ |
---|
| 771 | { |
---|
| 772 | int i, j, n = ncl + nch; |
---|
| 773 | for(i=nrl; i<=nrh; i++) { |
---|
| 774 | for(j=ncl; j<=nch; j++) { |
---|
| 775 | D[i][n-j] = S[i][j]; |
---|
| 776 | } |
---|
| 777 | } |
---|
| 778 | } |
---|
| 779 | /* ------------------------------------------------------------------------------------- */ |
---|
| 780 | IMAGE_EXPORT(void) vflip_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch, byte **D) |
---|
| 781 | /* -------------------------------------------------------------------------------------- */ |
---|
| 782 | { |
---|
| 783 | int i, j, n = nrl + nrh; |
---|
| 784 | for(i=nrl; i<=nrh; i++) { |
---|
| 785 | for(j=ncl; j<=nch; j++) { |
---|
| 786 | D[n-i][j] = S[i][j]; |
---|
| 787 | } |
---|
| 788 | } |
---|
| 789 | } |
---|
| 790 | /* -------------------------------------------------------------------------------------- */ |
---|
| 791 | IMAGE_EXPORT(void) vflip_smatrix(short **S, long nrl,long nrh,long ncl, long nch, short **D) |
---|
| 792 | /* -------------------------------------------------------------------------------------- */ |
---|
| 793 | { |
---|
| 794 | int i, j, n = nrl + nrh; |
---|
| 795 | for(i=nrl; i<=nrh; i++) { |
---|
| 796 | for(j=ncl; j<=nch; j++) { |
---|
| 797 | D[n-i][j] = S[i][j]; |
---|
| 798 | } |
---|
| 799 | } |
---|
| 800 | } |
---|
| 801 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 802 | IMAGE_EXPORT(void) vflip_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D) |
---|
| 803 | /* ----------------------------------------------------------------------------------------- */ |
---|
| 804 | { |
---|
| 805 | int i, j, n = nrl + nrh; |
---|
| 806 | for(i=nrl; i<=nrh; i++) { |
---|
| 807 | for(j=ncl; j<=nch; j++) { |
---|
| 808 | D[n-i][j] = S[i][j]; |
---|
| 809 | } |
---|
| 810 | } |
---|
| 811 | } |
---|
| 812 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 813 | IMAGE_EXPORT(void) vflip_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch, int16 **D) |
---|
| 814 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 815 | { |
---|
| 816 | int i, j, n = nrl + nrh; |
---|
| 817 | for(i=nrl; i<=nrh; i++) { |
---|
| 818 | for(j=ncl; j<=nch; j++) { |
---|
| 819 | D[n-i][j] = S[i][j]; |
---|
| 820 | } |
---|
| 821 | } |
---|
| 822 | } |
---|
| 823 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 824 | IMAGE_EXPORT(void) vflip_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D) |
---|
| 825 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 826 | { |
---|
| 827 | int i, j, n = nrl + nrh; |
---|
| 828 | for(i=nrl; i<=nrh; i++) { |
---|
| 829 | for(j=ncl; j<=nch; j++) { |
---|
| 830 | D[n-i][j] = S[i][j]; |
---|
| 831 | } |
---|
| 832 | } |
---|
| 833 | } |
---|
| 834 | /* ---------------------------------------------------------------------------------- */ |
---|
| 835 | IMAGE_EXPORT(void) vflip_imatrix(int **S, long nrl,long nrh,long ncl, long nch, int **D) |
---|
| 836 | /* ---------------------------------------------------------------------------------- */ |
---|
| 837 | { |
---|
| 838 | int i, j, n = nrl + nrh; |
---|
| 839 | for(i=nrl; i<=nrh; i++) { |
---|
| 840 | for(j=ncl; j<=nch; j++) { |
---|
| 841 | D[n-i][j] = S[i][j]; |
---|
| 842 | } |
---|
| 843 | } |
---|
| 844 | } |
---|
| 845 | /* ------------------------------------------------------------------------------------- */ |
---|
| 846 | IMAGE_EXPORT(void) vflip_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch, uint **D) |
---|
| 847 | /* ------------------------------------------------------------------------------------- */ |
---|
| 848 | { |
---|
| 849 | int i, j, n = nrl + nrh; |
---|
| 850 | for(i=nrl; i<=nrh; i++) { |
---|
| 851 | for(j=ncl; j<=nch; j++) { |
---|
| 852 | D[n-i][j] = S[i][j]; |
---|
| 853 | } |
---|
| 854 | } |
---|
| 855 | } |
---|
| 856 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 857 | IMAGE_EXPORT(void) vflip_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D) |
---|
| 858 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 859 | { |
---|
| 860 | int i, j, n = nrl + nrh; |
---|
| 861 | for(i=nrl; i<=nrh; i++) { |
---|
| 862 | for(j=ncl; j<=nch; j++) { |
---|
| 863 | D[n-i][j] = S[i][j]; |
---|
| 864 | } |
---|
| 865 | } |
---|
| 866 | } |
---|
| 867 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 868 | IMAGE_EXPORT(void) vflip_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D) |
---|
| 869 | /* ------------------------------------------------------------------------------------------- */ |
---|
| 870 | { |
---|
| 871 | int i, j, n = nrl + nrh; |
---|
| 872 | for(i=nrl; i<=nrh; i++) { |
---|
| 873 | for(j=ncl; j<=nch; j++) { |
---|
| 874 | D[n-i][j] = S[i][j]; |
---|
| 875 | } |
---|
| 876 | } |
---|
| 877 | } |
---|
| 878 | /* ------------------------------------------------------------------------------------- */ |
---|
| 879 | IMAGE_EXPORT(void) vflip_matrix(float **S, long nrl,long nrh,long ncl, long nch, float **D) |
---|
| 880 | /* ------------------------------------------------------------------------------------- */ |
---|
| 881 | { |
---|
| 882 | int i, j, n = nrl + nrh; |
---|
| 883 | for(i=nrl; i<=nrh; i++) { |
---|
| 884 | for(j=ncl; j<=nch; j++) { |
---|
| 885 | D[n-i][j] = S[i][j]; |
---|
| 886 | } |
---|
| 887 | } |
---|
| 888 | } |
---|
| 889 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 890 | IMAGE_EXPORT(void) vflip_dmatrix(double **S, long nrl,long nrh,long ncl, long nch, double **D) |
---|
| 891 | /* ---------------------------------------------------------------------------------------- */ |
---|
| 892 | { |
---|
| 893 | int i, j, n = nrl + nrh; |
---|
| 894 | for(i=nrl; i<=nrh; i++) { |
---|
| 895 | for(j=ncl; j<=nch; j++) { |
---|
| 896 | D[n-i][j] = S[i][j]; |
---|
| 897 | } |
---|
| 898 | } |
---|
| 899 | } |
---|
| 900 | /* --------------------------------------------------------------------------------------- */ |
---|
| 901 | IMAGE_EXPORT(void) vflip_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D) |
---|
| 902 | /* --------------------------------------------------------------------------------------- */ |
---|
| 903 | { |
---|
| 904 | int i, j, n = nrl + nrh; |
---|
| 905 | for(i=nrl; i<=nrh; i++) { |
---|
| 906 | for(j=ncl; j<=nch; j++) { |
---|
| 907 | D[n-i][j] = S[i][j]; |
---|
| 908 | } |
---|
| 909 | } |
---|
| 910 | } |
---|
| 911 | /* --------------------------------------------------------------------------- */ |
---|
| 912 | IMAGE_EXPORT(void) hflip1_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch) |
---|
| 913 | /* --------------------------------------------------------------------------- */ |
---|
| 914 | { |
---|
| 915 | int i, j, n = ncl + nch; |
---|
| 916 | byte t; |
---|
| 917 | |
---|
| 918 | for(i=nrl; i<=nrh; i++) { |
---|
| 919 | for(j=ncl; j<=nch; j++) { |
---|
| 920 | t = S[i][n-j]; |
---|
| 921 | S[i][n-j] = S[i][j]; |
---|
| 922 | S[i][j] = t; |
---|
| 923 | } |
---|
| 924 | } |
---|
| 925 | } |
---|
| 926 | /* ---------------------------------------------------------------------------- */ |
---|
| 927 | IMAGE_EXPORT(void) hflip1_smatrix(short **S, long nrl,long nrh,long ncl, long nch) |
---|
| 928 | /* ---------------------------------------------------------------------------- */ |
---|
| 929 | { |
---|
| 930 | int i, j, n = ncl + nch; |
---|
| 931 | short t; |
---|
| 932 | |
---|
| 933 | for(i=nrl; i<=nrh; i++) { |
---|
| 934 | for(j=ncl; j<=nch; j++) { |
---|
| 935 | t = S[i][n-j]; |
---|
| 936 | S[i][n-j] = S[i][j]; |
---|
| 937 | S[i][j] = t; |
---|
| 938 | } |
---|
| 939 | } |
---|
| 940 | } |
---|
| 941 | /* ------------------------------------------------------------------------------ */ |
---|
| 942 | IMAGE_EXPORT(void) hflip1_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch) |
---|
| 943 | /* ------------------------------------------------------------------------------ */ |
---|
| 944 | { |
---|
| 945 | int i, j, n = ncl + nch; |
---|
| 946 | ushort t; |
---|
| 947 | |
---|
| 948 | for(i=nrl; i<=nrh; i++) { |
---|
| 949 | for(j=ncl; j<=nch; j++) { |
---|
| 950 | t = S[i][n-j]; |
---|
| 951 | S[i][n-j] = S[i][j]; |
---|
| 952 | S[i][j] = t; |
---|
| 953 | } |
---|
| 954 | } |
---|
| 955 | } |
---|
| 956 | /* ------------------------------------------------------------------------------ */ |
---|
| 957 | IMAGE_EXPORT(void) hflip1_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 958 | /* ------------------------------------------------------------------------------ */ |
---|
| 959 | { |
---|
| 960 | int i, j, n = ncl + nch; |
---|
| 961 | int16 t; |
---|
| 962 | |
---|
| 963 | for(i=nrl; i<=nrh; i++) { |
---|
| 964 | for(j=ncl; j<=nch; j++) { |
---|
| 965 | t = S[i][n-j]; |
---|
| 966 | S[i][n-j] = S[i][j]; |
---|
| 967 | S[i][j] = t; |
---|
| 968 | } |
---|
| 969 | } |
---|
| 970 | } |
---|
| 971 | /* -------------------------------------------------------------------------------- */ |
---|
| 972 | IMAGE_EXPORT(void) hflip1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 973 | /* -------------------------------------------------------------------------------- */ |
---|
| 974 | { |
---|
| 975 | int i, j, n = ncl + nch; |
---|
| 976 | uint16 t; |
---|
| 977 | |
---|
| 978 | for(i=nrl; i<=nrh; i++) { |
---|
| 979 | for(j=ncl; j<=nch; j++) { |
---|
| 980 | t = S[i][n-j]; |
---|
| 981 | S[i][n-j] = S[i][j]; |
---|
| 982 | S[i][j] = t; |
---|
| 983 | } |
---|
| 984 | } |
---|
| 985 | } |
---|
| 986 | /* -------------------------------------------------------------------------- */ |
---|
| 987 | IMAGE_EXPORT(void) hflip1_imatrix(int **S, long nrl,long nrh,long ncl, long nch) |
---|
| 988 | /* -------------------------------------------------------------------------- */ |
---|
| 989 | { |
---|
| 990 | int i, j, n = ncl + nch; |
---|
| 991 | int t; |
---|
| 992 | |
---|
| 993 | for(i=nrl; i<=nrh; i++) { |
---|
| 994 | for(j=ncl; j<=nch; j++) { |
---|
| 995 | t = S[i][n-j]; |
---|
| 996 | S[i][n-j] = S[i][j]; |
---|
| 997 | S[i][j] = t; |
---|
| 998 | } |
---|
| 999 | } |
---|
| 1000 | } |
---|
| 1001 | /* ---------------------------------------------------------------------------- */ |
---|
| 1002 | IMAGE_EXPORT(void) hflip1_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1003 | /* ---------------------------------------------------------------------------- */ |
---|
| 1004 | { |
---|
| 1005 | int i, j, n = ncl + nch; |
---|
| 1006 | uint t; |
---|
| 1007 | |
---|
| 1008 | for(i=nrl; i<=nrh; i++) { |
---|
| 1009 | for(j=ncl; j<=nch; j++) { |
---|
| 1010 | t = S[i][n-j]; |
---|
| 1011 | S[i][n-j] = S[i][j]; |
---|
| 1012 | S[i][j] = t; |
---|
| 1013 | } |
---|
| 1014 | } |
---|
| 1015 | } |
---|
| 1016 | /* ------------------------------------------------------------------------------- */ |
---|
| 1017 | IMAGE_EXPORT(void) hflip1_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1018 | /* ------------------------------------------------------------------------------- */ |
---|
| 1019 | { |
---|
| 1020 | int i, j, n = ncl + nch; |
---|
| 1021 | int32 t; |
---|
| 1022 | |
---|
| 1023 | for(i=nrl; i<=nrh; i++) { |
---|
| 1024 | for(j=ncl; j<=nch; j++) { |
---|
| 1025 | t = S[i][n-j]; |
---|
| 1026 | S[i][n-j] = S[i][j]; |
---|
| 1027 | S[i][j] = t; |
---|
| 1028 | } |
---|
| 1029 | } |
---|
| 1030 | } |
---|
| 1031 | /* ------------------------------------------------------------------------------- */ |
---|
| 1032 | IMAGE_EXPORT(void) hflip1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1033 | /* -------------------------------------------------------------------------------- */ |
---|
| 1034 | { |
---|
| 1035 | int i, j, n = ncl + nch; |
---|
| 1036 | uint32 t; |
---|
| 1037 | |
---|
| 1038 | for(i=nrl; i<=nrh; i++) { |
---|
| 1039 | for(j=ncl; j<=nch; j++) { |
---|
| 1040 | t = S[i][n-j]; |
---|
| 1041 | S[i][n-j] = S[i][j]; |
---|
| 1042 | S[i][j] = t; |
---|
| 1043 | } |
---|
| 1044 | } |
---|
| 1045 | } |
---|
| 1046 | /* --------------------------------------------------------------------------- */ |
---|
| 1047 | IMAGE_EXPORT(void) hflip1_matrix(float **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1048 | /* --------------------------------------------------------------------------- */ |
---|
| 1049 | { |
---|
| 1050 | int i, j, n = ncl + nch; |
---|
| 1051 | float t; |
---|
| 1052 | |
---|
| 1053 | for(i=nrl; i<=nrh; i++) { |
---|
| 1054 | for(j=ncl; j<=nch; j++) { |
---|
| 1055 | t = S[i][n-j]; |
---|
| 1056 | S[i][n-j] = S[i][j]; |
---|
| 1057 | S[i][j] = t; |
---|
| 1058 | } |
---|
| 1059 | } |
---|
| 1060 | } |
---|
| 1061 | /* ----------------------------------------------------------------------------- */ |
---|
| 1062 | IMAGE_EXPORT(void) hflip1_dmatrix(double **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1063 | /* ----------------------------------------------------------------------------- */ |
---|
| 1064 | { |
---|
| 1065 | int i, j, n = ncl + nch; |
---|
| 1066 | double t; |
---|
| 1067 | |
---|
| 1068 | for(i=nrl; i<=nrh; i++) { |
---|
| 1069 | for(j=ncl; j<=nch; j++) { |
---|
| 1070 | t = S[i][n-j]; |
---|
| 1071 | S[i][n-j] = S[i][j]; |
---|
| 1072 | S[i][j] = t; |
---|
| 1073 | } |
---|
| 1074 | } |
---|
| 1075 | } |
---|
| 1076 | /* ------------------------------------------------------------------------------ */ |
---|
| 1077 | IMAGE_EXPORT(void) hflip1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1078 | /* ------------------------------------------------------------------------------ */ |
---|
| 1079 | { |
---|
| 1080 | int i, j, n = ncl + nch; |
---|
| 1081 | rgb8 t; |
---|
| 1082 | |
---|
| 1083 | for(i=nrl; i<=nrh; i++) { |
---|
| 1084 | for(j=ncl; j<=nch; j++) { |
---|
| 1085 | t = S[i][n-j]; |
---|
| 1086 | S[i][n-j] = S[i][j]; |
---|
| 1087 | S[i][j] = t; |
---|
| 1088 | } |
---|
| 1089 | } |
---|
| 1090 | } |
---|
| 1091 | /* ---------------------------------------------------------------------------- */ |
---|
| 1092 | IMAGE_EXPORT(void) vflip1_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1093 | /* ---------------------------------------------------------------------------- */ |
---|
| 1094 | { |
---|
| 1095 | int i, j, n = nrl + nrh; |
---|
| 1096 | byte t; |
---|
| 1097 | |
---|
| 1098 | for(i=nrl; i<=nrh; i++) { |
---|
| 1099 | for(j=ncl; j<=nch; j++) { |
---|
| 1100 | t = S[n-i][j]; |
---|
| 1101 | S[n-i][j] = S[i][j]; |
---|
| 1102 | S[i][j] = t; |
---|
| 1103 | } |
---|
| 1104 | } |
---|
| 1105 | } |
---|
| 1106 | /* ---------------------------------------------------------------------------- */ |
---|
| 1107 | IMAGE_EXPORT(void) vflip1_smatrix(short **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1108 | /* ---------------------------------------------------------------------------- */ |
---|
| 1109 | { |
---|
| 1110 | int i, j, n = nrl + nrh; |
---|
| 1111 | short t; |
---|
| 1112 | |
---|
| 1113 | for(i=nrl; i<=nrh; i++) { |
---|
| 1114 | for(j=ncl; j<=nch; j++) { |
---|
| 1115 | t = S[n-i][j]; |
---|
| 1116 | S[n-i][j] = S[i][j]; |
---|
| 1117 | S[i][j] = t; |
---|
| 1118 | } |
---|
| 1119 | } |
---|
| 1120 | } |
---|
| 1121 | /* ------------------------------------------------------------------------------ */ |
---|
| 1122 | IMAGE_EXPORT(void) vflip1_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1123 | /* ------------------------------------------------------------------------------ */ |
---|
| 1124 | { |
---|
| 1125 | int i, j, n = nrl + nrh; |
---|
| 1126 | ushort t; |
---|
| 1127 | |
---|
| 1128 | for(i=nrl; i<=nrh; i++) { |
---|
| 1129 | for(j=ncl; j<=nch; j++) { |
---|
| 1130 | t = S[n-i][j]; |
---|
| 1131 | S[n-i][j] = S[i][j]; |
---|
| 1132 | S[i][j] = t; |
---|
| 1133 | } |
---|
| 1134 | } |
---|
| 1135 | } |
---|
| 1136 | /* ------------------------------------------------------------------------------ */ |
---|
| 1137 | IMAGE_EXPORT(void) vflip1_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1138 | /* ------------------------------------------------------------------------------ */ |
---|
| 1139 | { |
---|
| 1140 | int i, j, n = nrl + nrh; |
---|
| 1141 | int16 t; |
---|
| 1142 | |
---|
| 1143 | for(i=nrl; i<=nrh; i++) { |
---|
| 1144 | for(j=ncl; j<=nch; j++) { |
---|
| 1145 | t = S[n-i][j]; |
---|
| 1146 | S[n-i][j] = S[i][j]; |
---|
| 1147 | S[i][j] = t; |
---|
| 1148 | } |
---|
| 1149 | } |
---|
| 1150 | } |
---|
| 1151 | /* -------------------------------------------------------------------------------- */ |
---|
| 1152 | IMAGE_EXPORT(void) vflip1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1153 | /* -------------------------------------------------------------------------------- */ |
---|
| 1154 | { |
---|
| 1155 | int i, j, n = nrl + nrh; |
---|
| 1156 | uint16 t; |
---|
| 1157 | |
---|
| 1158 | for(i=nrl; i<=nrh; i++) { |
---|
| 1159 | for(j=ncl; j<=nch; j++) { |
---|
| 1160 | t = S[n-i][j]; |
---|
| 1161 | S[n-i][j] = S[i][j]; |
---|
| 1162 | S[i][j] = t; |
---|
| 1163 | } |
---|
| 1164 | } |
---|
| 1165 | } |
---|
| 1166 | /* -------------------------------------------------------------------------- */ |
---|
| 1167 | IMAGE_EXPORT(void) vflip1_imatrix(int **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1168 | /* -------------------------------------------------------------------------- */ |
---|
| 1169 | { |
---|
| 1170 | int i, j, n = nrl + nrh; |
---|
| 1171 | int t; |
---|
| 1172 | |
---|
| 1173 | for(i=nrl; i<=nrh; i++) { |
---|
| 1174 | for(j=ncl; j<=nch; j++) { |
---|
| 1175 | t = S[n-i][j]; |
---|
| 1176 | S[n-i][j] = S[i][j]; |
---|
| 1177 | S[i][j] = t; |
---|
| 1178 | } |
---|
| 1179 | } |
---|
| 1180 | } |
---|
| 1181 | /* ---------------------------------------------------------------------------- */ |
---|
| 1182 | IMAGE_EXPORT(void) vflip1_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1183 | /* ---------------------------------------------------------------------------- */ |
---|
| 1184 | { |
---|
| 1185 | int i, j, n = nrl + nrh; |
---|
| 1186 | uint t; |
---|
| 1187 | |
---|
| 1188 | for(i=nrl; i<=nrh; i++) { |
---|
| 1189 | for(j=ncl; j<=nch; j++) { |
---|
| 1190 | t = S[n-i][j]; |
---|
| 1191 | S[n-i][j] = S[i][j]; |
---|
| 1192 | S[i][j] = t; |
---|
| 1193 | } |
---|
| 1194 | } |
---|
| 1195 | } |
---|
| 1196 | /* ------------------------------------------------------------------------------ */ |
---|
| 1197 | IMAGE_EXPORT(void) vflip1_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1198 | /* ------------------------------------------------------------------------------ */ |
---|
| 1199 | { |
---|
| 1200 | int i, j, n = nrl + nrh; |
---|
| 1201 | int32 t; |
---|
| 1202 | |
---|
| 1203 | for(i=nrl; i<=nrh; i++) { |
---|
| 1204 | for(j=ncl; j<=nch; j++) { |
---|
| 1205 | t = S[n-i][j]; |
---|
| 1206 | S[n-i][j] = S[i][j]; |
---|
| 1207 | S[i][j] = t; |
---|
| 1208 | } |
---|
| 1209 | } |
---|
| 1210 | } |
---|
| 1211 | /* -------------------------------------------------------------------------------- */ |
---|
| 1212 | IMAGE_EXPORT(void) vflip1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1213 | /* -------------------------------------------------------------------------------- */ |
---|
| 1214 | { |
---|
| 1215 | int i, j, n = nrl + nrh; |
---|
| 1216 | uint32 t; |
---|
| 1217 | |
---|
| 1218 | for(i=nrl; i<=nrh; i++) { |
---|
| 1219 | for(j=ncl; j<=nch; j++) { |
---|
| 1220 | t = S[n-i][j]; |
---|
| 1221 | S[n-i][j] = S[i][j]; |
---|
| 1222 | S[i][j] = t; |
---|
| 1223 | } |
---|
| 1224 | } |
---|
| 1225 | } |
---|
| 1226 | /* --------------------------------------------------------------------------- */ |
---|
| 1227 | IMAGE_EXPORT(void) vflip1_matrix(float **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1228 | /* --------------------------------------------------------------------------- */ |
---|
| 1229 | { |
---|
| 1230 | int i, j, n = nrl + nrh; |
---|
| 1231 | float t; |
---|
| 1232 | |
---|
| 1233 | for(i=nrl; i<=nrh; i++) { |
---|
| 1234 | for(j=ncl; j<=nch; j++) { |
---|
| 1235 | t = S[n-i][j]; |
---|
| 1236 | S[n-i][j] = S[i][j]; |
---|
| 1237 | S[i][j] = t; |
---|
| 1238 | } |
---|
| 1239 | } |
---|
| 1240 | } |
---|
| 1241 | /* ----------------------------------------------------------------------------- */ |
---|
| 1242 | IMAGE_EXPORT(void) vflip1_dmatrix(double **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1243 | /* ----------------------------------------------------------------------------- */ |
---|
| 1244 | { |
---|
| 1245 | int i, j, n = nrl + nrh; |
---|
| 1246 | double t; |
---|
| 1247 | |
---|
| 1248 | for(i=nrl; i<=nrh; i++) { |
---|
| 1249 | for(j=ncl; j<=nch; j++) { |
---|
| 1250 | t = S[n-i][j]; |
---|
| 1251 | S[n-i][j] = S[i][j]; |
---|
| 1252 | S[i][j] = t; |
---|
| 1253 | } |
---|
| 1254 | } |
---|
| 1255 | } |
---|
| 1256 | /* ------------------------------------------------------------------------------ */ |
---|
| 1257 | IMAGE_EXPORT(void) vflip1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch) |
---|
| 1258 | /* ------------------------------------------------------------------------------ */ |
---|
| 1259 | { |
---|
| 1260 | int i, j, n = nrl + nrh; |
---|
| 1261 | rgb8 t; |
---|
| 1262 | |
---|
| 1263 | for(i=nrl; i<=nrh; i++) { |
---|
| 1264 | for(j=ncl; j<=nch; j++) { |
---|
| 1265 | t = S[n-i][j]; |
---|
| 1266 | S[n-i][j] = S[i][j]; |
---|
| 1267 | S[i][j] = t; |
---|
| 1268 | } |
---|
| 1269 | } |
---|
| 1270 | } |
---|
| 1271 | |
---|