Ignore:
Timestamp:
Jun 1, 2016, 10:25:43 AM (8 years ago)
Author:
meunier
Message:

In rosenfeld:

  • Updated nrio0, nrio1, nrio2, nrio1f, nrio2f, nrio1x, nrbool1, nrbool2 and nralloc1 in the nrc2 lib in order to use macro-typed functions
  • Updated the simulation script to include performance evaluation with random images, and a script to generate graphs
  • Updated the clock.h to use 64-bit integers, which potentially breaks the printing on the giet
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/rosenfeld/nrc2/src/nrbool2.c

    r772 r822  
    1616#include <stddef.h>
    1717#include <stdlib.h>
    18 #include <math.h> // fabs
     18#include <math.h>
     19#include <stdbool.h>
    1920
     21#include "nrc_os_config.h"
    2022#include "mypredef.h"
    2123#include "nrtype.h"
     
    2729#include "nrbool2.h"
    2830
    29 /* ----------------------------------------------------------------------------------- */
    30 IMAGE_EXPORT(int) cmpeq_bmatrix(byte **X, long nrl,long nrh,long ncl, long nch, byte **Y)
    31 /* ----------------------------------------------------------------------------------- */
    32 {
    33         int i, j;
    34        
    35         for(i=nrl; i<=nrh; i++) {
    36                 for(j=ncl; j<=nch; j++) {
    37                         if(X[i][j] != Y[i][j]) return 1;
    38                 }
    39         }
    40         return 0;
     31
     32#undef cmpeq_type_matrix
     33#define cmpeq_type_matrix(t) \
     34int32_t short_name(t,cmpeq_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y) \
     35{                                              \
     36    for (int32_t i = nrl; i <= nrh; i++) {     \
     37        for (int32_t j = ncl; j <= nch; j++) { \
     38            if (X[i][j] != Y[i][j]) {          \
     39                return 1;                      \
     40            }                                  \
     41        }                                      \
     42    }                                          \
     43    return 0;                                  \
    4144}
    42 /* --------------------------------------------------------------------------------------- */
    43 IMAGE_EXPORT(int) cmpeq_si8matrix(sint8 **X, long nrl,long nrh,long ncl, long nch, sint8 **Y)
    44 /* --------------------------------------------------------------------------------------- */
    45 {
    46         int i, j;
    47        
    48         for(i=nrl; i<=nrh; i++) {
    49                 for(j=ncl; j<=nch; j++) {
    50                         if(X[i][j] != Y[i][j]) return 1;
    51                 }
    52         }
    53         return 0;
    54 }
    55 /* ----------------------------------------------------------------------------------------- */
    56 IMAGE_EXPORT(int) cmpeq_ui8matrix(uint8 **X, long nrl, long nrh, long ncl, long nch, uint8 **Y)
    57 /* ----------------------------------------------------------------------------------------- */
    58 {
    59         int i, j;
    60        
    61         for(i=nrl; i<=nrh; i++) {
    62                 for(j=ncl; j<=nch; j++) {
    63                         if(X[i][j] != Y[i][j]) return 1;
    64                 }
    65         }
    66         return 0;
    67 }
    68 /* -------------------------------------------------------------------------------------------- */
    69 IMAGE_EXPORT(int) cmpeq_si16matrix(sint16 **X, long nrl ,long nrh, long ncl, long nch, sint16 **Y)
    70 /* -------------------------------------------------------------------------------------------- */
    71 {
    72         int i, j;
    73        
    74         for(i=nrl; i<=nrh; i++) {
    75                 for(j=ncl; j<=nch; j++) {
    76                         if(X[i][j] != Y[i][j]) return 1;
    77                 }
    78         }
    79         return 0;
    80 }
    81 /* -------------------------------------------------------------------------------------------- */
    82 IMAGE_EXPORT(int) cmpeq_ui16matrix(uint16 **X, long nrl, long nrh, long ncl, long nch, uint16 **Y)
    83 /* -------------------------------------------------------------------------------------------- */
    84 {
    85         int i, j;
    86        
    87         for(i=nrl; i<=nrh; i++) {
    88                 for(j=ncl; j<=nch; j++) {
    89                         if(X[i][j] != Y[i][j]) return 1;
    90                 }
    91         }
    92         return 0;
    93 }
    94 /* -------------------------------------------------------------------------------------------- */
    95 IMAGE_EXPORT(int) cmpeq_si32matrix(sint32 **X, long nrl, long nrh, long ncl, long nch, sint32 **Y)
    96 /* -------------------------------------------------------------------------------------------- */
    97 {
    98         int i, j;
    99        
    100         for(i=nrl; i<=nrh; i++) {
    101                 for(j=ncl; j<=nch; j++) {
    102                         if(X[i][j] != Y[i][j]) return 1;
    103                 }
    104         }
    105         return 0;
    106 }
    107 /* -------------------------------------------------------------------------------------------- */
    108 IMAGE_EXPORT(int) cmpeq_ui32matrix(uint32 **X, long nrl, long nrh, long ncl, long nch, uint32 **Y)
    109 /* -------------------------------------------------------------------------------------------- */
    110 {
    111         int i, j;
    112        
    113         for(i=nrl; i<=nrh; i++) {
    114                 for(j=ncl; j<=nch; j++) {
    115                         if(X[i][j] != Y[i][j]) return 1;
    116                 }
    117         }
    118         return 0;
    119 }
     45
     46cmpeq_type_matrix(int8_t);
     47cmpeq_type_matrix(uint8_t);
     48cmpeq_type_matrix(int16_t);
     49cmpeq_type_matrix(uint16_t);
     50cmpeq_type_matrix(int32_t);
     51cmpeq_type_matrix(uint32_t);
     52cmpeq_type_matrix(int64_t);
     53cmpeq_type_matrix(uint64_t);
     54
     55
    12056
    12157/*
     
    12561 */
    12662
    127 /* ---------------------------------------------------------------------------------- */
    128 IMAGE_EXPORT(void) not_bmatrix(byte **X, long nrl,long nrh,long ncl, long nch, byte **Y)
    129 /* ---------------------------------------------------------------------------------- */
    130 {
    131         long i;
    132        
    133         for(i=nrl; i<=nrh; i++) {
    134                 not_bvector(X[i], ncl, nch, Y[i]);
    135         }
     63#undef not_type_matrix
     64#define not_type_matrix(t) \
     65void short_name(t,not_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y) \
     66{                                                        \
     67    for (int32_t i = nrl; i <= nrh; i++) {               \
     68        short_name(t,not_,vector)(X[i], ncl, nch, Y[i]); \
     69    }                                                    \
    13670}
    137 /* -------------------------------------------------------------------------------------- */
    138 IMAGE_EXPORT(void) not_si8matrix(sint8 **X, long nrl,long nrh,long ncl, long nch, sint8 **Y)
    139 /* -------------------------------------------------------------------------------------- */
    140 {
    141         long i;
    142    
    143     for(i=nrl; i<=nrh; i++) {
    144         not_si8vector(X[i], ncl, nch, Y[i]);
    145     }
    146 }
    147 /* -------------------------------------------------------------------------------------- */
    148 IMAGE_EXPORT(void) not_ui8matrix(uint8 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y)
    149 /* -------------------------------------------------------------------------------------- */
    150 {
    151     long i;
    152    
    153     for(i=nrl; i<=nrh; i++) {
    154         not_ui8vector(X[i], ncl, nch, Y[i]);
    155     }
    156 }
    157 /* ----------------------------------------------------------------------------------------- */
    158 IMAGE_EXPORT(void) not_si16matrix(sint16 **X, long nrl,long nrh,long ncl, long nch, sint16 **Y)
    159 /* ----------------------------------------------------------------------------------------- */
    160 {
    161     long i;
    162    
    163     for(i=nrl; i<=nrh; i++) {
    164         not_si16vector(X[i], ncl, nch, Y[i]);
    165     }
    166 }
    167 /* ----------------------------------------------------------------------------------------- */
    168 IMAGE_EXPORT(void) not_ui16matrix(uint16 **X, long nrl,long nrh,long ncl, long nch, uint16 **Y)
    169 /* ----------------------------------------------------------------------------------------- */
    170 {
    171     long i;
    172    
    173     for(i=nrl; i<=nrh; i++) {
    174         not_ui16vector(X[i], ncl, nch, Y[i]);
    175     }
    176 }
    177 /* ---------------------------------------------------------------------------------------- */
    178 IMAGE_EXPORT(void) not_si32matrix(int32 **X, long nrl,long nrh,long ncl, long nch, sint32 **Y)
    179 /* ---------------------------------------------------------------------------------------- */
    180 {
    181     long i;
    182    
    183     for(i=nrl; i<=nrh; i++) {
    184         not_si32vector(X[i], ncl, nch, Y[i]);
    185     }
    186 }
    187 /* ----------------------------------------------------------------------------------------- */
    188 IMAGE_EXPORT(void) not_ui32matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint32 **Y)
    189 /* ----------------------------------------------------------------------------------------- */
    190 {
    191     long i;
    192    
    193     for(i=nrl; i<=nrh; i++) {
    194         not_ui32vector(X[i], ncl, nch, Y[i]);
    195     }
    196 }
    197 /* --------------------------------------------------------------------------------------- */
    198 IMAGE_EXPORT(void) not_rgb8matrix(rgb8 **X, long nrl,long nrh,long ncl, long nch, rgb8 **Y)
    199 /* --------------------------------------------------------------------------------------- */
    200 {
    201     long i;
    202    
    203     for(i=nrl; i<=nrh; i++) {
    204         not_rgb8vector(X[i], ncl, nch, Y[i]);
    205     }
    206 }
    207 /* ------------------------------------------------------------------------------------------ */
    208 IMAGE_EXPORT(void) not_rgbx8matrix(rgbx8 **X, long nrl,long nrh,long ncl, long nch, rgbx8 **Y)
    209 /* ------------------------------------------------------------------------------------------ */
    210 {
    211     long i;
    212    
    213     for(i=nrl; i<=nrh; i++) {
    214         not_rgbx8vector(X[i], ncl, nch, Y[i]);
    215     }
    216 }
     71
     72not_type_matrix(int8_t);
     73not_type_matrix(uint8_t);
     74not_type_matrix(int16_t);
     75not_type_matrix(uint16_t);
     76not_type_matrix(int32_t);
     77not_type_matrix(uint32_t);
     78not_type_matrix(int64_t);
     79not_type_matrix(uint64_t);
     80not_type_matrix(rgb8);
     81not_type_matrix(rgbx8);
     82
     83
    21784
    21885/*
     
    22289 */
    22390
    224 /* ------------------------------------------------------------------------------------------- */
    225 IMAGE_EXPORT(void) or_bmatrix(byte **X, long nrl,long nrh,long ncl, long nch, byte **Y, byte **Z)
    226 /* ------------------------------------------------------------------------------------------- */
    227 {
    228     long i;
    229    
    230     for(i=nrl; i<=nrh; i++) {
    231         or_bvector(X[i], ncl, nch, Y[i], Z[i]);
    232     }
     91#undef or_type_matrix
     92#define or_type_matrix(t) \
     93void short_name(t,or_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z) \
     94{                                                             \
     95    for (int32_t i = nrl; i <= nrh; i++) {                    \
     96        short_name(t,or_,vector)(X[i], ncl, nch, Y[i], Z[i]); \
     97    }                                                         \
     98}                                                             \
     99void short_name(t,orc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z) \
     100{                                                             \
     101    for (int32_t i = nrl; i <= nrh; i++) {                    \
     102        short_name(t,orc_,vector)(X[i], ncl, nch, y, Z[i]);   \
     103    }                                                         \
    233104}
    234 /* ------------------------------------------------------------------------------------------------ */
    235 IMAGE_EXPORT(void) or_si8matrix(sint8 **X, long nrl,long nrh,long ncl, long nch, sint8 **Y, sint8 **Z)
    236 /* ------------------------------------------------------------------------------------------------ */
    237 {
    238     long i;
    239    
    240     for(i=nrl; i<=nrh; i++) {
    241         or_si8vector(X[i], ncl, nch, Y[i], Z[i]);
    242     }
    243 }
    244 /* ------------------------------------------------------------------------------------------------ */
    245 IMAGE_EXPORT(void) or_ui8matrix(uint8 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y, uint8 **Z)
    246 /* ------------------------------------------------------------------------------------------------ */
    247 {
    248     long i;
    249    
    250     for(i=nrl; i<=nrh; i++) {
    251         or_ui8vector(X[i], ncl, nch, Y[i], Z[i]);
    252     }
    253 }
    254 /* ---------------------------------------------------------------------------------------------------- */
    255 IMAGE_EXPORT(void) or_si16matrix(sint16 **X, long nrl,long nrh,long ncl, long nch, sint16 **Y, sint16 **Z)
    256 /* ---------------------------------------------------------------------------------------------------- */
    257 {
    258     long i;
    259    
    260     for(i=nrl; i<=nrh; i++) {
    261         or_si16vector(X[i], ncl, nch, Y[i], Z[i]);
    262     }
    263 }
    264 /* ---------------------------------------------------------------------------------------------------- */
    265 IMAGE_EXPORT(void) or_ui16matrix(uint16 **X, long nrl,long nrh,long ncl, long nch, uint16 **Y, uint16 **Z)
    266 /* ---------------------------------------------------------------------------------------------------- */
    267 {
    268     long i;
    269    
    270     for(i=nrl; i<=nrh; i++) {
    271         or_ui16vector(X[i], ncl, nch, Y[i], Z[i]);
    272     }
    273 }
    274 /* ---------------------------------------------------------------------------------------------------- */
    275 IMAGE_EXPORT(void) or_si32matrix(sint32 **X, long nrl,long nrh,long ncl, long nch, sint32 **Y, sint32 **Z)
    276 /* ---------------------------------------------------------------------------------------------------- */
    277 {
    278     long i;
    279    
    280     for(i=nrl; i<=nrh; i++) {
    281         or_si32vector(X[i], ncl, nch, Y[i], Z[i]);
    282     }
    283 }
    284 /* ---------------------------------------------------------------------------------------------------- */
    285 IMAGE_EXPORT(void) or_ui32matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint32 **Y, uint32 **Z)
    286 /* ---------------------------------------------------------------------------------------------------- */
    287 {
    288     long i;
    289    
    290     for(i=nrl; i<=nrh; i++) {
    291         or_ui32vector(X[i], ncl, nch, Y[i], Z[i]);
    292     }
    293 }
    294 /* ---------------------------------------------------------------------------------------------------- */
    295 IMAGE_EXPORT(void) or_si64matrix(sint64 **X, long nrl,long nrh,long ncl, long nch, sint64 **Y, sint64 **Z)
    296 /* ---------------------------------------------------------------------------------------------------- */
    297 {
    298     long i;
    299    
    300     for(i=nrl; i<=nrh; i++) {
    301         or_si64vector(X[i], ncl, nch, Y[i], Z[i]);
    302     }
    303 }
    304 /* ---------------------------------------------------------------------------------------------------- */
    305 IMAGE_EXPORT(void) or_ui64matrix(uint64 **X, long nrl,long nrh,long ncl, long nch, uint64 **Y, uint64 **Z)
    306 /* ---------------------------------------------------------------------------------------------------- */
    307 {
    308     long i;
    309    
    310     for(i=nrl; i<=nrh; i++) {
    311         or_ui64vector(X[i], ncl, nch, Y[i], Z[i]);
    312     }
    313 }
    314 /* ---------------------------------------------------------------------------------------------- */
    315 IMAGE_EXPORT(void) or_rgb8matrix(rgb8 **X, long nrl,long nrh,long ncl, long nch, rgb8 **Y, rgb8 **Z)
    316 /* ---------------------------------------------------------------------------------------------- */
    317 {
    318     long i;
    319    
    320     for(i=nrl; i<=nrh; i++) {
    321         or_rgb8vector(X[i], ncl, nch, Y[i], Z[i]);
    322     }
    323 }
    324 /* -------------------------------------------------------------------------------------------------- */
    325 IMAGE_EXPORT(void) or_rgb8xmatrix(rgbx8 **X, long nrl,long nrh,long ncl, long nch, rgbx8 **Y, rgbx8 **Z)
    326 /* -------------------------------------------------------------------------------------------------- */
    327 {
    328     long i;
    329    
    330     for(i=nrl; i<=nrh; i++) {
    331         or_rgbx8vector(X[i], ncl, nch, Y[i], Z[i]);
    332     }
    333 }
    334 /* ------------------------------------------------------------------------------------------ */
    335 IMAGE_EXPORT(void) orc_bmatrix(byte **X, long nrl,long nrh,long ncl, long nch, byte y, byte **Z)
    336 /* ------------------------------------------------------------------------------------------ */
    337 {
    338     long i;
    339    
    340     for(i=nrl; i<=nrh; i++) {
    341         orc_bvector(X[i], ncl, nch, y, Z[i]);
    342     }
    343 }
    344 /* ----------------------------------------------------------------------------------------------- */
    345 IMAGE_EXPORT(void) orc_si8matrix(sint8 **X, long nrl,long nrh,long ncl, long nch, sint8 y, sint8 **Z)
    346 /* ----------------------------------------------------------------------------------------------- */
    347 {
    348     long i;
    349    
    350     for(i=nrl; i<=nrh; i++) {
    351         orc_si8vector(X[i], ncl, nch, y, Z[i]);
    352     }
    353 }
    354 /* ----------------------------------------------------------------------------------------------- */
    355 IMAGE_EXPORT(void) orc_ui8matrix(uint8 **X, long nrl,long nrh,long ncl, long nch, uint8 y, uint8 **Z)
    356 /* ----------------------------------------------------------------------------------------------- */
    357 {
    358     long i;
    359    
    360     for(i=nrl; i<=nrh; i++) {
    361         orc_ui8vector(X[i], ncl, nch, y, Z[i]);
    362     }
    363 }
    364 /* -------------------------------------------------------------------------------------------------- */
    365 IMAGE_EXPORT(void) orc_i16matrix(sint16 **X, long nrl,long nrh,long ncl, long nch, sint16 y, sint16 **Z)
    366 /* -------------------------------------------------------------------------------------------------- */
    367 {
    368     long i;
    369    
    370     for(i=nrl; i<=nrh; i++) {
    371         orc_si16vector(X[i], ncl, nch, y, Z[i]);
    372     }
    373 }
    374 /* --------------------------------------------------------------------------------------------------- */
    375 IMAGE_EXPORT(void) orc_ui16matrix(uint16 **X, long nrl,long nrh,long ncl, long nch, uint16 y, uint16 **Z)
    376 /* --------------------------------------------------------------------------------------------------- */
    377 {
    378     long i;
    379    
    380     for(i=nrl; i<=nrh; i++) {
    381         orc_ui16vector(X[i], ncl, nch, y, Z[i]);
    382     }
    383 }
    384 /* --------------------------------------------------------------------------------------------------- */
    385 IMAGE_EXPORT(void) orc_si32matrix(sint32 **X, long nrl,long nrh,long ncl, long nch, sint32 y, sint32 **Z)
    386 /* --------------------------------------------------------------------------------------------------- */
    387 {
    388     long i;
    389    
    390     for(i=nrl; i<=nrh; i++) {
    391         orc_si32vector(X[i], ncl, nch, y, Z[i]);
    392     }
    393 }
    394 /* --------------------------------------------------------------------------------------------------- */
    395 IMAGE_EXPORT(void) orc_ui32matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint32 y, uint32 **Z)
    396 /* --------------------------------------------------------------------------------------------------- */
    397 {
    398     long i;
    399    
    400     for(i=nrl; i<=nrh; i++) {
    401         orc_ui32vector(X[i], ncl, nch, y, Z[i]);
    402     }
    403 }
    404 /* --------------------------------------------------------------------------------------------------- */
    405 IMAGE_EXPORT(void) orc_si64matrix(sint64 **X, long nrl,long nrh,long ncl, long nch, sint64 y, sint64 **Z)
    406 /* --------------------------------------------------------------------------------------------------- */
    407 {
    408     long i;
    409    
    410     for(i=nrl; i<=nrh; i++) {
    411         orc_si64vector(X[i], ncl, nch, y, Z[i]);
    412     }
    413 }
    414 /* --------------------------------------------------------------------------------------------------- */
    415 IMAGE_EXPORT(void) orc_ui64matrix(uint64 **X, long nrl,long nrh,long ncl, long nch, uint64 y, uint64 **Z)
    416105
    417 /* --------------------------------------------------------------------------------------------------- */
    418 {
    419     long i;
    420    
    421     for(i=nrl; i<=nrh; i++) {
    422         orc_ui64vector(X[i], ncl, nch, y, Z[i]);
    423     }
    424 }
    425 /* --------------------------------------------------------------------------------------------- */
    426 IMAGE_EXPORT(void) orc_rgb8matrix(rgb8 **X, long nrl,long nrh,long ncl, long nch, rgb8 y, rgb8 **Z)
    427 /* --------------------------------------------------------------------------------------------- */
    428 {
    429     long i;
    430    
    431     for(i=nrl; i<=nrh; i++) {
    432         orc_rgb8vector(X[i], ncl, nch, y, Z[i]);
    433     }
    434 }
    435 /* ------------------------------------------------------------------------------------------------- */
    436 IMAGE_EXPORT(void) orc_rgb8xmatrix(rgbx8 **X, long nrl,long nrh,long ncl, long nch, rgbx8 y, rgbx8 **Z)
    437 /* ------------------------------------------------------------------------------------------------- */
    438 {
    439     long i;
    440    
    441     for(i=nrl; i<=nrh; i++) {
    442         orc_rgbx8vector(X[i], ncl, nch, y, Z[i]);
    443     }
    444 }
     106or_type_matrix(int8_t);
     107or_type_matrix(uint8_t);
     108or_type_matrix(int16_t);
     109or_type_matrix(uint16_t);
     110or_type_matrix(int32_t);
     111or_type_matrix(uint32_t);
     112or_type_matrix(int64_t);
     113or_type_matrix(uint64_t);
     114or_type_matrix(rgb8);
     115or_type_matrix(rgbx8);
     116
    445117
    446118/*
     
    450122 */
    451123
    452 /* -------------------------------------------------------------------------------------------- */
    453 IMAGE_EXPORT(void) xor_bmatrix(byte **X, long nrl,long nrh,long ncl, long nch, byte **Y, byte **Z)
    454 /* -------------------------------------------------------------------------------------------- */
    455 {
    456     long i;
    457    
    458     for(i=nrl; i<=nrh; i++) {
    459         xor_bvector(X[i], ncl, nch, Y[i], Z[i]);
    460     }
     124#undef xor_type_matrix
     125#define xor_type_matrix(t) \
     126void short_name(t,xor_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z) \
     127{                                                              \
     128    for (int32_t i = nrl; i <= nrh; i++) {                     \
     129        short_name(t,xor_,vector)(X[i], ncl, nch, Y[i], Z[i]); \
     130    }                                                          \
     131}                                                              \
     132void short_name(t,xorc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z) \
     133{                                                              \
     134    for (int32_t i = nrl; i <= nrh; i++) {                     \
     135        short_name(t,xorc_,vector)(X[i], ncl, nch, y, Z[i]);   \
     136    }                                                          \
    461137}
    462 /* ------------------------------------------------------------------------------------------------- */
    463 IMAGE_EXPORT(void) xor_si8matrix(sint8 **X, long nrl,long nrh,long ncl, long nch, sint8 **Y, sint8 **Z)
    464 /* ------------------------------------------------------------------------------------------------- */
    465 {
    466     long i;
    467    
    468     for(i=nrl; i<=nrh; i++) {
    469         xor_si8vector(X[i], ncl, nch, Y[i], Z[i]);
    470     }
    471 }
    472 /* ------------------------------------------------------------------------------------------------- */
    473 IMAGE_EXPORT(void) xor_ui8matrix(uint8 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y, uint8 **Z)
    474 /* ------------------------------------------------------------------------------------------------- */
    475 {
    476     long i;
    477    
    478     for(i=nrl; i<=nrh; i++) {
    479         xor_ui8vector(X[i], ncl, nch, Y[i], Z[i]);
    480     }
    481 }
    482 /* ----------------------------------------------------------------------------------------------------- */
    483 IMAGE_EXPORT(void) xor_si16matrix(sint16 **X, long nrl,long nrh,long ncl, long nch, sint16 **Y, sint16 **Z)
    484 /* ----------------------------------------------------------------------------------------------------- */
    485 {
    486     long i;
    487    
    488     for(i=nrl; i<=nrh; i++) {
    489         xor_si16vector(X[i], ncl, nch, Y[i], Z[i]);
    490     }
    491 }
    492 /* ----------------------------------------------------------------------------------------------------- */
    493 IMAGE_EXPORT(void) xor_ui16matrix(uint16 **X, long nrl,long nrh,long ncl, long nch, uint16 **Y, uint16 **Z)
    494 /* ----------------------------------------------------------------------------------------------------- */
    495 {
    496     long i;
    497    
    498     for(i=nrl; i<=nrh; i++) {
    499         xor_ui16vector(X[i], ncl, nch, Y[i], Z[i]);
    500     }
    501 }
    502 /* ----------------------------------------------------------------------------------------------------- */
    503 IMAGE_EXPORT(void) xor_si32matrix(sint32 **X, long nrl,long nrh,long ncl, long nch, sint32 **Y, sint32 **Z)
    504 /* ----------------------------------------------------------------------------------------------------- */
    505 {
    506     long i;
    507    
    508     for(i=nrl; i<=nrh; i++) {
    509         xor_si32vector(X[i], ncl, nch, Y[i], Z[i]);
    510     }
    511 }
    512 /* ----------------------------------------------------------------------------------------------------- */
    513 IMAGE_EXPORT(void) xor_ui32matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint32 **Y, uint32 **Z)
    514 /* ----------------------------------------------------------------------------------------------------- */
    515 {
    516     long i;
    517    
    518     for(i=nrl; i<=nrh; i++) {
    519         xor_ui32vector(X[i], ncl, nch, Y[i], Z[i]);
    520     }
    521 }
    522 /* ----------------------------------------------------------------------------------------------------- */
    523 IMAGE_EXPORT(void) xor_si64matrix(sint64 **X, long nrl,long nrh,long ncl, long nch, sint64 **Y, sint64 **Z)
    524 /* ----------------------------------------------------------------------------------------------------- */
    525 {
    526     long i;
    527    
    528     for(i=nrl; i<=nrh; i++) {
    529         xor_si64vector(X[i], ncl, nch, Y[i], Z[i]);
    530     }
    531 }
    532 /* ----------------------------------------------------------------------------------------------------- */
    533 IMAGE_EXPORT(void) xor_ui64matrix(uint64 **X, long nrl,long nrh,long ncl, long nch, uint64 **Y, uint64 **Z)
    534 /* ----------------------------------------------------------------------------------------------------- */
    535 {
    536     long i;
    537    
    538     for(i=nrl; i<=nrh; i++) {
    539         xor_ui64vector(X[i], ncl, nch, Y[i], Z[i]);
    540     }
    541 }
    542 /* ----------------------------------------------------------------------------------------------- */
    543 IMAGE_EXPORT(void) xor_rgb8matrix(rgb8 **X, long nrl,long nrh,long ncl, long nch, rgb8 **Y, rgb8 **Z)
    544 /* ----------------------------------------------------------------------------------------------- */
    545 {
    546     long i;
    547    
    548     for(i=nrl; i<=nrh; i++) {
    549         xor_rgb8vector(X[i], ncl, nch, Y[i], Z[i]);
    550     }
    551 }
    552 /* --------------------------------------------------------------------------------------------------- */
    553 IMAGE_EXPORT(void) xor_rgb8xmatrix(rgbx8 **X, long nrl,long nrh,long ncl, long nch, rgbx8 **Y, rgbx8 **Z)
    554 /* --------------------------------------------------------------------------------------------------- */
    555 {
    556     long i;
    557    
    558     for(i=nrl; i<=nrh; i++) {
    559         xor_rgbx8vector(X[i], ncl, nch, Y[i], Z[i]);
    560     }
    561 }
    562 /* ------------------------------------------------------------------------------------------- */
    563 IMAGE_EXPORT(void) xorc_bmatrix(byte **X, long nrl,long nrh,long ncl, long nch, byte y, byte **Z)
    564 /* ------------------------------------------------------------------------------------------- */
    565 {
    566     long i;
    567    
    568     for(i=nrl; i<=nrh; i++) {
    569         xorc_bvector(X[i], ncl, nch, y, Z[i]);
    570     }
    571 }
    572 /* ------------------------------------------------------------------------------------------------ */
    573 IMAGE_EXPORT(void) xorc_si8matrix(sint8 **X, long nrl,long nrh,long ncl, long nch, sint8 y, sint8 **Z)
    574 /* ------------------------------------------------------------------------------------------------ */
    575 {
    576     long i;
    577    
    578     for(i=nrl; i<=nrh; i++) {
    579         xorc_si8vector(X[i], ncl, nch, y, Z[i]);
    580     }
    581 }
    582 /* ------------------------------------------------------------------------------------------------ */
    583 IMAGE_EXPORT(void) xorc_ui8matrix(uint8 **X, long nrl,long nrh,long ncl, long nch, uint8 y, uint8 **Z)
    584 /* ------------------------------------------------------------------------------------------------ */
    585 {
    586     long i;
    587    
    588     for(i=nrl; i<=nrh; i++) {
    589         xorc_ui8vector(X[i], ncl, nch, y, Z[i]);
    590     }
    591 }
    592 /* --------------------------------------------------------------------------------------------------- */
    593 IMAGE_EXPORT(void) xorc_i16matrix(sint16 **X, long nrl,long nrh,long ncl, long nch, sint16 y, sint16 **Z)
    594 /* --------------------------------------------------------------------------------------------------- */
    595 {
    596     long i;
    597    
    598     for(i=nrl; i<=nrh; i++) {
    599         xorc_si16vector(X[i], ncl, nch, y, Z[i]);
    600     }
    601 }
    602 /* ---------------------------------------------------------------------------------------------------- */
    603 IMAGE_EXPORT(void) xorc_ui16matrix(uint16 **X, long nrl,long nrh,long ncl, long nch, uint16 y, uint16 **Z)
    604 /* ---------------------------------------------------------------------------------------------------- */
    605 {
    606     long i;
    607    
    608     for(i=nrl; i<=nrh; i++) {
    609         xorc_ui16vector(X[i], ncl, nch, y, Z[i]);
    610     }
    611 }
    612 /* ---------------------------------------------------------------------------------------------------- */
    613 IMAGE_EXPORT(void) xorc_si32matrix(sint32 **X, long nrl,long nrh,long ncl, long nch, sint32 y, sint32 **Z)
    614 /* ---------------------------------------------------------------------------------------------------- */
    615 {
    616     long i;
    617    
    618     for(i=nrl; i<=nrh; i++) {
    619         xorc_si32vector(X[i], ncl, nch, y, Z[i]);
    620     }
    621 }
    622 /* ---------------------------------------------------------------------------------------------------- */
    623 IMAGE_EXPORT(void) xorc_ui32matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint32 y, uint32 **Z)
    624 /* ---------------------------------------------------------------------------------------------------- */
    625 {
    626     long i;
    627    
    628     for(i=nrl; i<=nrh; i++) {
    629         xorc_ui32vector(X[i], ncl, nch, y, Z[i]);
    630     }
    631 }
    632 /* ---------------------------------------------------------------------------------------------------- */
    633 IMAGE_EXPORT(void) xorc_si64matrix(sint64 **X, long nrl,long nrh,long ncl, long nch, sint64 y, sint64 **Z)
    634 /* ---------------------------------------------------------------------------------------------------- */
    635 {
    636     long i;
    637    
    638     for(i=nrl; i<=nrh; i++) {
    639         xorc_si64vector(X[i], ncl, nch, y, Z[i]);
    640     }
    641 }
    642 /* ---------------------------------------------------------------------------------------------------- */
    643 IMAGE_EXPORT(void) xorc_ui64matrix(uint64 **X, long nrl,long nrh,long ncl, long nch, uint64 y, uint64 **Z)
    644 /* ---------------------------------------------------------------------------------------------------- */
    645 {
    646     long i;
    647    
    648     for(i=nrl; i<=nrh; i++) {
    649         xorc_ui64vector(X[i], ncl, nch, y, Z[i]);
    650     }
    651 }
    652 /* ---------------------------------------------------------------------------------------------- */
    653 IMAGE_EXPORT(void) xorc_rgb8matrix(rgb8 **X, long nrl,long nrh,long ncl, long nch, rgb8 y, rgb8 **Z)
    654 /* ---------------------------------------------------------------------------------------------- */
    655 {
    656     long i;
    657    
    658     for(i=nrl; i<=nrh; i++) {
    659         xorc_rgb8vector(X[i], ncl, nch, y, Z[i]);
    660     }
    661 }
    662 /* -------------------------------------------------------------------------------------------------- */
    663 IMAGE_EXPORT(void) xorc_rgb8xmatrix(rgbx8 **X, long nrl,long nrh,long ncl, long nch, rgbx8 y, rgbx8 **Z)
    664 /* -------------------------------------------------------------------------------------------------- */
    665 {
    666     long i;
    667    
    668     for(i=nrl; i<=nrh; i++) {
    669         xorc_rgbx8vector(X[i], ncl, nch, y, Z[i]);
    670     }
    671 }
     138
     139xor_type_matrix(int8_t);
     140xor_type_matrix(uint8_t);
     141xor_type_matrix(int16_t);
     142xor_type_matrix(uint16_t);
     143xor_type_matrix(int32_t);
     144xor_type_matrix(uint32_t);
     145xor_type_matrix(int64_t);
     146xor_type_matrix(uint64_t);
     147xor_type_matrix(rgb8);
     148xor_type_matrix(rgbx8);
    672149
    673150
     
    678155 */
    679156
    680 /* -------------------------------------------------------------------------------------------- */
    681 IMAGE_EXPORT(void) and_bmatrix(byte **X, long nrl,long nrh,long ncl, long nch, byte **Y, byte **Z)
    682 /* -------------------------------------------------------------------------------------------- */
    683 {
    684     long i;
    685    
    686     for(i=nrl; i<=nrh; i++) {
    687         and_bvector(X[i], ncl, nch, Y[i], Z[i]);
    688     }
     157#undef and_type_matrix
     158#define and_type_matrix(t) \
     159void short_name(t,and_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z) \
     160{                                                              \
     161    for (int32_t i = nrl; i <= nrh; i++) {                     \
     162        short_name(t,and_,vector)(X[i], ncl, nch, Y[i], Z[i]); \
     163    }                                                          \
     164}                                                              \
     165void short_name(t,andc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z) \
     166{                                                              \
     167    for (int32_t i = nrl; i <= nrh; i++) {                     \
     168        short_name(t,andc_,vector)(X[i], ncl, nch, y, Z[i]);   \
     169    }                                                          \
    689170}
    690 /* ------------------------------------------------------------------------------------------------- */
    691 IMAGE_EXPORT(void) and_si8matrix(sint8 **X, long nrl,long nrh,long ncl, long nch, sint8 **Y, sint8 **Z)
    692 /* ------------------------------------------------------------------------------------------------- */
    693 {
    694     long i;
    695    
    696     for(i=nrl; i<=nrh; i++) {
    697         and_si8vector(X[i], ncl, nch, Y[i], Z[i]);
    698     }
    699 }
    700 /* ------------------------------------------------------------------------------------------------- */
    701 IMAGE_EXPORT(void) and_ui8matrix(uint8 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y, uint8 **Z)
    702 /* ------------------------------------------------------------------------------------------------- */
    703 {
    704     long i;
    705    
    706     for(i=nrl; i<=nrh; i++) {
    707         and_ui8vector(X[i], ncl, nch, Y[i], Z[i]);
    708     }
    709 }
    710 /* ----------------------------------------------------------------------------------------------------- */
    711 IMAGE_EXPORT(void) and_si16matrix(sint16 **X, long nrl,long nrh,long ncl, long nch, sint16 **Y, sint16 **Z)
    712 /* ----------------------------------------------------------------------------------------------------- */
    713 {
    714     long i;
    715    
    716     for(i=nrl; i<=nrh; i++) {
    717         and_si16vector(X[i], ncl, nch, Y[i], Z[i]);
    718     }
    719 }
    720 /* ----------------------------------------------------------------------------------------------------- */
    721 IMAGE_EXPORT(void) and_ui16matrix(uint16 **X, long nrl,long nrh,long ncl, long nch, uint16 **Y, uint16 **Z)
    722 /* ----------------------------------------------------------------------------------------------------- */
    723 {
    724     long i;
    725    
    726     for(i=nrl; i<=nrh; i++) {
    727         and_ui16vector(X[i], ncl, nch, Y[i], Z[i]);
    728     }
    729 }
    730 /* ----------------------------------------------------------------------------------------------------- */
    731 IMAGE_EXPORT(void) and_si32matrix(sint32 **X, long nrl,long nrh,long ncl, long nch, sint32 **Y, sint32 **Z)
    732 /* ----------------------------------------------------------------------------------------------------- */
    733 {
    734     long i;
    735    
    736     for(i=nrl; i<=nrh; i++) {
    737         and_si32vector(X[i], ncl, nch, Y[i], Z[i]);
    738     }
    739 }
    740 /* ----------------------------------------------------------------------------------------------------- */
    741 IMAGE_EXPORT(void) and_ui32matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint32 **Y, uint32 **Z)
    742 /* ----------------------------------------------------------------------------------------------------- */
    743 {
    744     long i;
    745    
    746     for(i=nrl; i<=nrh; i++) {
    747         and_ui32vector(X[i], ncl, nch, Y[i], Z[i]);
    748     }
    749 }
    750 /* ----------------------------------------------------------------------------------------------------- */
    751 IMAGE_EXPORT(void) and_si64matrix(sint64 **X, long nrl,long nrh,long ncl, long nch, sint64 **Y, sint64 **Z)
    752 /* ----------------------------------------------------------------------------------------------------- */
    753 {
    754     long i;
    755    
    756     for(i=nrl; i<=nrh; i++) {
    757         and_si64vector(X[i], ncl, nch, Y[i], Z[i]);
    758     }
    759 }
    760 /* ----------------------------------------------------------------------------------------------------- */
    761 IMAGE_EXPORT(void) and_ui64matrix(uint64 **X, long nrl,long nrh,long ncl, long nch, uint64 **Y, uint64 **Z)
    762 /* ----------------------------------------------------------------------------------------------------- */
    763 {
    764     long i;
    765    
    766     for(i=nrl; i<=nrh; i++) {
    767         and_ui64vector(X[i], ncl, nch, Y[i], Z[i]);
    768     }
    769 }
    770 /* ----------------------------------------------------------------------------------------------- */
    771 IMAGE_EXPORT(void) and_rgb8matrix(rgb8 **X, long nrl,long nrh,long ncl, long nch, rgb8 **Y, rgb8 **Z)
    772 /* ----------------------------------------------------------------------------------------------- */
    773 {
    774     long i;
    775    
    776     for(i=nrl; i<=nrh; i++) {
    777         and_rgb8vector(X[i], ncl, nch, Y[i], Z[i]);
    778     }
    779 }
    780 /* --------------------------------------------------------------------------------------------------- */
    781 IMAGE_EXPORT(void) and_rgb8xmatrix(rgbx8 **X, long nrl,long nrh,long ncl, long nch, rgbx8 **Y, rgbx8 **Z)
    782 /* --------------------------------------------------------------------------------------------------- */
    783 {
    784     long i;
    785    
    786     for(i=nrl; i<=nrh; i++) {
    787         and_rgbx8vector(X[i], ncl, nch, Y[i], Z[i]);
    788     }
    789 }
    790 /* ------------------------------------------------------------------------------------------- */
    791 IMAGE_EXPORT(void) andc_bmatrix(byte **X, long nrl,long nrh,long ncl, long nch, byte y, byte **Z)
    792 /* ------------------------------------------------------------------------------------------- */
    793 {
    794     long i;
    795    
    796     for(i=nrl; i<=nrh; i++) {
    797         andc_bvector(X[i], ncl, nch, y, Z[i]);
    798     }
    799 }
    800 /* ------------------------------------------------------------------------------------------------ */
    801 IMAGE_EXPORT(void) andc_si8matrix(sint8 **X, long nrl,long nrh,long ncl, long nch, sint8 y, sint8 **Z)
    802 /* ------------------------------------------------------------------------------------------------ */
    803 {
    804     long i;
    805    
    806     for(i=nrl; i<=nrh; i++) {
    807         andc_si8vector(X[i], ncl, nch, y, Z[i]);
    808     }
    809 }
    810 /* ------------------------------------------------------------------------------------------------ */
    811 IMAGE_EXPORT(void) andc_ui8matrix(uint8 **X, long nrl,long nrh,long ncl, long nch, uint8 y, uint8 **Z)
    812 /* ------------------------------------------------------------------------------------------------ */
    813 {
    814     long i;
    815    
    816     for(i=nrl; i<=nrh; i++) {
    817         andc_ui8vector(X[i], ncl, nch, y, Z[i]);
    818     }
    819 }
    820 /* --------------------------------------------------------------------------------------------------- */
    821 IMAGE_EXPORT(void) andc_i16matrix(sint16 **X, long nrl,long nrh,long ncl, long nch, sint16 y, sint16 **Z)
    822 /* --------------------------------------------------------------------------------------------------- */
    823 {
    824     long i;
    825    
    826     for(i=nrl; i<=nrh; i++) {
    827         andc_si16vector(X[i], ncl, nch, y, Z[i]);
    828     }
    829 }
    830 /* ---------------------------------------------------------------------------------------------------- */
    831 IMAGE_EXPORT(void) andc_ui16matrix(uint16 **X, long nrl,long nrh,long ncl, long nch, uint16 y, uint16 **Z)
    832 /* ---------------------------------------------------------------------------------------------------- */
    833 {
    834     long i;
    835    
    836     for(i=nrl; i<=nrh; i++) {
    837         andc_ui16vector(X[i], ncl, nch, y, Z[i]);
    838     }
    839 }
    840 /* ---------------------------------------------------------------------------------------------------- */
    841 IMAGE_EXPORT(void) andc_si32matrix(sint32 **X, long nrl,long nrh,long ncl, long nch, sint32 y, sint32 **Z)
    842 /* ---------------------------------------------------------------------------------------------------- */
    843 {
    844     long i;
    845    
    846     for(i=nrl; i<=nrh; i++) {
    847         andc_si32vector(X[i], ncl, nch, y, Z[i]);
    848     }
    849 }
    850 /* ---------------------------------------------------------------------------------------------------- */
    851 IMAGE_EXPORT(void) andc_ui32matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint32 y, uint32 **Z)
    852 /* ---------------------------------------------------------------------------------------------------- */
    853 {
    854     long i;
    855    
    856     for(i=nrl; i<=nrh; i++) {
    857         andc_ui32vector(X[i], ncl, nch, y, Z[i]);
    858     }
    859 }
    860 /* ---------------------------------------------------------------------------------------------------- */
    861 IMAGE_EXPORT(void) andc_si64matrix(sint64 **X, long nrl,long nrh,long ncl, long nch, sint64 y, sint64 **Z)
    862 /* ---------------------------------------------------------------------------------------------------- */
    863 {
    864     long i;
    865    
    866     for(i=nrl; i<=nrh; i++) {
    867         andc_si64vector(X[i], ncl, nch, y, Z[i]);
    868     }
    869 }
    870 /* ---------------------------------------------------------------------------------------------------- */
    871 IMAGE_EXPORT(void) andc_ui64matrix(uint64 **X, long nrl,long nrh,long ncl, long nch, uint64 y, uint64 **Z)
    872 /* ---------------------------------------------------------------------------------------------------- */
    873 {
    874     long i;
    875    
    876     for(i=nrl; i<=nrh; i++) {
    877         andc_ui64vector(X[i], ncl, nch, y, Z[i]);
    878     }
    879 }
    880 /* ---------------------------------------------------------------------------------------------- */
    881 IMAGE_EXPORT(void) andc_rgb8matrix(rgb8 **X, long nrl,long nrh,long ncl, long nch, rgb8 y, rgb8 **Z)
    882 /* ---------------------------------------------------------------------------------------------- */
    883 {
    884     long i;
    885    
    886     for(i=nrl; i<=nrh; i++) {
    887         andc_rgb8vector(X[i], ncl, nch, y, Z[i]);
    888     }
    889 }
    890 /* -------------------------------------------------------------------------------------------------- */
    891 IMAGE_EXPORT(void) andc_rgb8xmatrix(rgbx8 **X, long nrl,long nrh,long ncl, long nch, rgbx8 y, rgbx8 **Z)
    892 /* -------------------------------------------------------------------------------------------------- */
    893 {
    894     long i;
    895    
    896     for(i=nrl; i<=nrh; i++) {
    897         andc_rgbx8vector(X[i], ncl, nch, y, Z[i]);
    898     }
    899 }
     171
     172and_type_matrix(int8_t);
     173and_type_matrix(uint8_t);
     174and_type_matrix(int16_t);
     175and_type_matrix(uint16_t);
     176and_type_matrix(int32_t);
     177and_type_matrix(uint32_t);
     178and_type_matrix(int64_t);
     179and_type_matrix(uint64_t);
     180and_type_matrix(rgb8);
     181and_type_matrix(rgbx8);
     182
     183
     184// Local Variables:
     185// tab-width: 4
     186// c-basic-offset: 4
     187// c-file-offsets:((innamespace . 0)(inline-open . 0))
     188// indent-tabs-mode: nil
     189// End:
     190
     191// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     192
Note: See TracChangeset for help on using the changeset viewer.