Ignore:
Timestamp:
May 6, 2016, 3:06:29 PM (9 years ago)
Author:
meunier
Message:
  • Added several versions of rosenfeld: { SLOW, FAST } x { FEATURES, NO_FEATURES }
  • Added native linux compilation support
  • Added a script to check results natively
  • Started to refactor nrc code
File:
1 edited

Legend:

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

    r772 r821  
    3131#include <string.h> // memcpy
    3232#include <math.h> // fabs
    33 // #include <memory.h> // memcpy
    3433
     34
     35#include "nrc_os_config.h"
    3536#include "mypredef.h"
    3637#include "nrtype.h"
     
    3940#include "nrkernel.h"
    4041
    41 #include "nralloc1.h"
    4242#include "nralloc3.h"
    4343
     44
     45#undef type_cube
     46#define type_cube(t) \
     47t *** short_name(t,,cube)(int32_t ndl, int32_t ndh, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \
     48{                                                                                                       \
     49    int32_t ndep = ndh - ndl + 1;                                                                       \
     50    int32_t nrow = nrh - nrl + 1;                                                                       \
     51    int32_t nrol = nch - ncl + 1;                                                                       \
     52    t *** c;                                                                                            \
     53    /* allocate pointers to pointers to rows */                                                         \
     54    c = malloc((ndep + NR_END) * sizeof(t **));                                                         \
     55    if (c == NULL) {                                                                                    \
     56        nrerror("*** Error: allocation failure in %s\n", __func__);                                     \
     57    }                                                                                                   \
     58    c += NR_END;                                                                                        \
     59    c -= ndl;                                                                                           \
     60    /* allocate pointers to rows anc set pointers to them */                                            \
     61    c[ndl] = malloc((ndep * nrow + NR_END) * sizeof(t *));                                              \
     62    if (c[ndl] == NULL) {                                                                               \
     63        nrerror("*** Error: allocation failure in %s\n", __func__);                                     \
     64    }                                                                                                   \
     65    c[ndl] += NR_END;                                                                                   \
     66    c[ndl] -= nrl;                                                                                      \
     67    /* allocate rows anc set pointers to them */                                                        \
     68    c[ndl][nrl] = malloc((ndep * nrow * nrol + NR_END) * sizeof(t));                                    \
     69    if (c[ndl][nrl]) {                                                                                  \
     70        nrerror("*** Error: allocation failure in %s\n", __func__);                                     \
     71    }                                                                                                   \
     72    c[ndl][nrl] += NR_END;                                                                              \
     73    c[ndl][nrl] -= ncl;                                                                                 \
     74                                                                                                        \
     75    for(int32_t j = nrl + 1; j <= nrh; j++) {                                                           \
     76        c[ndl][j] = c[ndl][j - 1] + nrol;                                                               \
     77    }                                                                                                   \
     78    for(int32_t i = ndl + 1; i <= ndh; i++) {                                                           \
     79        c[i] = c[i - 1] + nrow;                                                                         \
     80        c[i][nrl] = c[i - 1][nrl] + nrow * nrol;                                                        \
     81        for (int32_t j = nrl + 1; j <= nrh; j++) {                                                      \
     82            c[i][j] = c[i][j - 1] + nrol;                                                               \
     83        }                                                                                               \
     84    }                                                                                                   \
     85    /* return pointer to array of pointers to rows */                                                   \
     86    return t;                                                                                           \
     87}
     88
     89
     90type_cube(int8_t);
     91type_cube(uint8_t);
     92type_cube(int16_t);
     93type_cube(uint16_t);
     94type_cube(int32_t);
     95type_cube(uint32_t);
     96type_cube(int64_t);
     97type_cube(uint64_t);
     98type_cube(float);
     99type_cube(double);
     100type_cube(rgb8);
     101type_cube(rgbx8);
     102
     103#undef free_type_cube
     104#define free_type_cube(t) \
     105void short_name(t,free_,cube)(t *** c, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t ndl, int32_t ndh) \
     106{                                                                                                        \
     107    free((FREE_ARG) (c[nrl][ncl] + ndl - NR_END));                                                       \
     108    free((FREE_ARG) (c[nrl] + ncl - NR_END));                                                            \
     109    free((FREE_ARG) (c + nrl - NR_END));                                                                 \
     110}
     111
     112free_type_cube(int8_t);
     113free_type_cube(uint8_t);
     114free_type_cube(int16_t);
     115free_type_cube(uint16_t);
     116free_type_cube(int32_t);
     117free_type_cube(uint32_t);
     118free_type_cube(int64_t);
     119free_type_cube(uint64_t);
     120free_type_cube(float);
     121free_type_cube(double);
     122free_type_cube(rgb8);
     123free_type_cube(rgbx8);
     124
     125
     126#if 0
    44127/* ----------------------------------------------------------------------- */
    45128double*** d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
     
    78161    return t;
    79162}
     163
     164
    80165/* ------------------------------------------------------------------------------ */
    81166void free_d3tensor(double ***t,long nrl,long nrh,long ncl,long nch,long ndl,long ndh)
     
    87172    free((FREE_ARG) (t+nrl-NR_END));
    88173}
     174#endif
    89175
    90 /* ------------------------------------------------------------------------------------ */
    91 IMAGE_EXPORT(sint8***) si8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch)
    92 /* ------------------------------------------------------------------------------------ */
    93 {
    94     long i,j,ndep=ndh-ndl+1,nrow=nrh-nrl+1,nrol=nch-ncl+1;
    95     sint8 ***t;
    96    
    97     /* allocate pointers to pointers to rows */
    98     t=(sint8***) malloc((size_t)((ndep+NR_END)*sizeof(sint8**)));
    99     if (!t) nrerror("allocation failure 1 in si8cube()");
    100     t += NR_END;
    101     t -= ndl;
    102    
    103     /* allocate pointers to rows anc set pointers to them */
    104     t[ndl]=(sint8**) malloc((size_t)((ndep*nrow+NR_END)*sizeof(sint8*)));
    105     if (!t[ndl]) nrerror("allocation failure 2 in si8cube()");
    106     t[ndl] += NR_END;
    107     t[ndl] -= nrl;
    108    
    109     /* allocate rows anc set pointers to them */
    110     t[ndl][nrl]=(sint8*) malloc((size_t)((ndep*nrow*nrol+NR_END)*sizeof(sint8)));
    111     if (!t[ndl][nrl]) nrerror("allocation failure 3 in si8cube()");
    112     t[ndl][nrl] += NR_END;
    113     t[ndl][nrl] -= ncl;
    114    
    115     for(j=nrl+1;j<=nrh;j++) t[ndl][j]=t[ndl][j-1]+nrol;
    116     for(i=ndl+1;i<=ndh;i++) {
    117         t[i]=t[i-1]+nrow;
    118         t[i][nrl]=t[i-1][nrl]+nrow*nrol;
    119         for(j=nrl+1;j<=nrh;j++) t[i][j]=t[i][j-1]+nrol;
    120     }
    121     /* return pointer to array of pointers to rows */
    122     return t;
    123 }
    124 /* ------------------------------------------------------------------------------------ */
    125 IMAGE_EXPORT(uint8***) ui8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch)
    126 /* ------------------------------------------------------------------------------------ */
    127 {
    128     long i,j,ndep=ndh-ndl+1,nrow=nrh-nrl+1,nrol=nch-ncl+1;
    129     uint8 ***t;
    130    
    131     /* allocate pointers to pointers to rows */
    132     t=(uint8***) malloc((size_t)((ndep+NR_END)*sizeof(uint8**)));
    133     if (!t) nrerror("allocation failure 1 in ui8cube()");
    134     t += NR_END;
    135     t -= ndl;
    136    
    137     /* allocate pointers to rows anc set pointers to them */
    138     t[ndl]=(uint8**) malloc((size_t)((ndep*nrow+NR_END)*sizeof(uint8*)));
    139     if (!t[ndl]) nrerror("allocation failure 2 in ui8cube()");
    140     t[ndl] += NR_END;
    141     t[ndl] -= nrl;
    142    
    143     /* allocate rows anc set pointers to them */
    144     t[ndl][nrl]=(uint8*) malloc((size_t)((ndep*nrow*nrol+NR_END)*sizeof(uint8)));
    145     if (!t[ndl][nrl]) nrerror("allocation failure 3 in ui8cube()");
    146     t[ndl][nrl] += NR_END;
    147     t[ndl][nrl] -= ncl;
    148    
    149     for(j=nrl+1;j<=nrh;j++) t[ndl][j]=t[ndl][j-1]+nrol;
    150     for(i=ndl+1;i<=ndh;i++) {
    151         t[i]=t[i-1]+nrow;
    152         t[i][nrl]=t[i-1][nrl]+nrow*nrol;
    153         for(j=nrl+1;j<=nrh;j++) t[i][j]=t[i][j-1]+nrol;
    154     }
    155     /* return pointer to array of pointers to rows */
    156     return t;
    157 }
    158 /* -------------------------------------------------------------------------------------- */
    159 IMAGE_EXPORT(sint16***) si16cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch)
    160 /* -------------------------------------------------------------------------------------- */
    161 {
    162     long i,j,ndep=ndh-ndl+1,nrow=nrh-nrl+1,nrol=nch-ncl+1;
    163     sint16 ***t;
    164    
    165     /* allocate pointers to pointers to rows */
    166     t=(sint16 ***) malloc((size_t)((ndep+NR_END)*sizeof(sint16**)));
    167     if (!t) nrerror("allocation failure 1 in si16cube()");
    168     t += NR_END;
    169     t -= ndl;
    170    
    171     /* allocate pointers to rows anc set pointers to them */
    172     t[ndl]=(sint16 **) malloc((size_t)((ndep*nrow+NR_END)*sizeof(sint16*)));
    173     if (!t[ndl]) nrerror("allocation failure 2 in si16cube()");
    174     t[ndl] += NR_END;
    175     t[ndl] -= nrl;
    176    
    177     /* allocate rows anc set pointers to them */
    178     t[ndl][nrl]=(sint16 *) malloc((size_t)((ndep*nrow*nrol+NR_END)*sizeof(sint16)));
    179     if (!t[ndl][nrl]) nrerror("allocation failure 3 in si16cube()");
    180     t[ndl][nrl] += NR_END;
    181     t[ndl][nrl] -= ncl;
    182    
    183     for(j=nrl+1;j<=nrh;j++) t[ndl][j]=t[ndl][j-1]+nrol;
    184     for(i=ndl+1;i<=ndh;i++) {
    185         t[i]=t[i-1]+nrow;
    186         t[i][nrl]=t[i-1][nrl]+nrow*nrol;
    187         for(j=nrl+1;j<=nrh;j++) t[i][j]=t[i][j-1]+nrol;
    188     }
    189     /* return pointer to array of pointers to rows */
    190     return t;
    191 }
    192 /* -------------------------------------------------------------------------------------- */
    193 IMAGE_EXPORT(uint16***) ui16cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch)
    194 /* -------------------------------------------------------------------------------------- */
    195 {
    196     long i,j,ndep=ndh-ndl+1,nrow=nrh-nrl+1,nrol=nch-ncl+1;
    197     uint16 ***t;
    198    
    199     /* allocate pointers to pointers to rows */
    200     t=(uint16***) malloc((size_t)((ndep+NR_END)*sizeof(uint16**)));
    201     if (!t) nrerror("allocation failure 1 in ui16cube()");
    202     t += NR_END;
    203     t -= ndl;
    204    
    205     /* allocate pointers to rows anc set pointers to them */
    206     t[ndl]=(uint16**) malloc((size_t)((ndep*nrow+NR_END)*sizeof(uint16*)));
    207     if (!t[ndl]) nrerror("allocation failure 2 in ui16cube()");
    208     t[ndl] += NR_END;
    209     t[ndl] -= nrl;
    210    
    211     /* allocate rows anc set pointers to them */
    212     t[ndl][nrl]=(uint16*) malloc((size_t)((ndep*nrow*nrol+NR_END)*sizeof(uint16)));
    213     if (!t[ndl][nrl]) nrerror("allocation failure 3 in ui16cube()");
    214     t[ndl][nrl] += NR_END;
    215     t[ndl][nrl] -= ncl;
    216    
    217     for(j=nrl+1;j<=nrh;j++) t[ndl][j]=t[ndl][j-1]+nrol;
    218     for(i=ndl+1;i<=ndh;i++) {
    219         t[i]=t[i-1]+nrow;
    220         t[i][nrl]=t[i-1][nrl]+nrow*nrol;
    221         for(j=nrl+1;j<=nrh;j++) t[i][j]=t[i][j-1]+nrol;
    222     }
    223     /* return pointer to array of pointers to rows */
    224     return t;
    225 }
    226 /* ------------------------------------------------------------------------------------ */
    227 IMAGE_EXPORT(sint32***) si32cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch)
    228 /* ------------------------------------------------------------------------------------ */
    229 {
    230     long i,j,ndep=ndh-ndl+1,nrow=nrh-nrl+1,nrol=nch-ncl+1;
    231     sint32 ***t;
    232    
    233     /* allocate pointers to pointers to rows */
    234     t=(sint32***) malloc((size_t)((ndep+NR_END)*sizeof(sint32**)));
    235     if (!t) nrerror("allocation failure 1 in si32cube()");
    236     t += NR_END;
    237     t -= ndl;
    238    
    239     /* allocate pointers to rows anc set pointers to them */
    240     t[ndl]=(sint32**) malloc((size_t)((ndep*nrow+NR_END)*sizeof(sint32*)));
    241     if (!t[ndl]) nrerror("allocation failure 2 in si32cube()");
    242     t[ndl] += NR_END;
    243     t[ndl] -= nrl;
    244    
    245     /* allocate rows anc set pointers to them */
    246     t[ndl][nrl]=(sint32*) malloc((size_t)((ndep*nrow*nrol+NR_END)*sizeof(sint32)));
    247     if (!t[ndl][nrl]) nrerror("allocation failure 3 in si32cube()");
    248     t[ndl][nrl] += NR_END;
    249     t[ndl][nrl] -= ncl;
    250    
    251     for(j=nrl+1;j<=nrh;j++) t[ndl][j]=t[ndl][j-1]+nrol;
    252     for(i=ndl+1;i<=ndh;i++) {
    253         t[i]=t[i-1]+nrow;
    254         t[i][nrl]=t[i-1][nrl]+nrow*nrol;
    255         for(j=nrl+1;j<=nrh;j++) t[i][j]=t[i][j-1]+nrol;
    256     }
    257     /* return pointer to array of pointers to rows */
    258     return t;
    259 }
    260 /* -------------------------------------------------------------------------------------- */
    261 IMAGE_EXPORT(uint32***) ui32cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch)
    262 /* -------------------------------------------------------------------------------------- */
    263 {
    264     long i,j,ndep=ndh-ndl+1,nrow=nrh-nrl+1,nrol=nch-ncl+1;
    265     uint32 ***t;
    266    
    267     /* allocate pointers to pointers to rows */
    268     t=(uint32***) malloc((size_t)((ndep+NR_END)*sizeof(uint32**)));
    269     if (!t) nrerror("allocation failure 1 in ui32cube()");
    270     t += NR_END;
    271     t -= ndl;
    272    
    273     /* allocate pointers to rows anc set pointers to them */
    274     t[ndl]=(uint32**) malloc((size_t)((ndep*nrow+NR_END)*sizeof(uint32*)));
    275     if (!t[ndl]) nrerror("allocation failure 2 in ui32cube()");
    276     t[ndl] += NR_END;
    277     t[ndl] -= nrl;
    278    
    279     /* allocate rows anc set pointers to them */
    280     t[ndl][nrl]=(uint32*) malloc((size_t)((ndep*nrow*nrol+NR_END)*sizeof(uint32)));
    281     if (!t[ndl][nrl]) nrerror("allocation failure 3 in ui32cube()");
    282     t[ndl][nrl] += NR_END;
    283     t[ndl][nrl] -= ncl;
    284    
    285     for(j=nrl+1;j<=nrh;j++) t[ndl][j]=t[ndl][j-1]+nrol;
    286     for(i=ndl+1;i<=ndh;i++) {
    287         t[i]=t[i-1]+nrow;
    288         t[i][nrl]=t[i-1][nrl]+nrow*nrol;
    289         for(j=nrl+1;j<=nrh;j++) t[i][j]=t[i][j-1]+nrol;
    290     }
    291     /* return pointer to array of pointers to rows */
    292     return t;
    293 }
    294 /* -------------------------------------------------------------------------------------- */
    295 IMAGE_EXPORT(float32***) f32cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch)
    296 /* -------------------------------------------------------------------------------------- */
    297 {
    298     long i,j,ndep=ndh-ndl+1,nrow=nrh-nrl+1,nrol=nch-ncl+1;
    299     float32 ***t;
    300    
    301     /* allocate pointers to pointers to rows */
    302     t=(float32***) malloc((size_t)((ndep+NR_END)*sizeof(float32**)));
    303     if (!t) nrerror("allocation failure 1 in f32cube()");
    304     t += NR_END;
    305     t -= ndl;
    306    
    307     /* allocate pointers to rows anc set pointers to them */
    308     t[ndl]=(float32**) malloc((size_t)((ndep*nrow+NR_END)*sizeof(float32*)));
    309     if (!t[ndl]) nrerror("allocation failure 2 in f32cube()");
    310     t[ndl] += NR_END;
    311     t[ndl] -= nrl;
    312    
    313     /* allocate rows anc set pointers to them */
    314     t[ndl][nrl]=(float32*) malloc((size_t)((ndep*nrow*nrol+NR_END)*sizeof(float32)));
    315     if (!t[ndl][nrl]) nrerror("allocation failure 3 in f32cube()");
    316     t[ndl][nrl] += NR_END;
    317     t[ndl][nrl] -= ncl;
    318    
    319     for(j=nrl+1;j<=nrh;j++) t[ndl][j]=t[ndl][j-1]+nrol;
    320     for(i=ndl+1;i<=ndh;i++) {
    321         t[i]=t[i-1]+nrow;
    322         t[i][nrl]=t[i-1][nrl]+nrow*nrol;
    323         for(j=nrl+1;j<=nrh;j++) t[i][j]=t[i][j-1]+nrol;
    324     }
    325     /* return pointer to array of pointers to rows */
    326     return t;
    327 }
    328 /* -------------------------------------------------------------------------------------- */
    329 IMAGE_EXPORT(float64***) f64cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch)
    330 /* -------------------------------------------------------------------------------------- */
    331 {
    332     long i,j,ndep=ndh-ndl+1,nrow=nrh-nrl+1,nrol=nch-ncl+1;
    333     float64 ***t;
    334    
    335     /* allocate pointers to pointers to rows */
    336     t=(float64***) malloc((size_t)((ndep+NR_END)*sizeof(float64**)));
    337     if (!t) nrerror("allocation failure 1 in f32cube()");
    338     t += NR_END;
    339     t -= ndl;
    340    
    341     /* allocate pointers to rows anc set pointers to them */
    342     t[ndl]=(float64**) malloc((size_t)((ndep*nrow+NR_END)*sizeof(float64*)));
    343     if (!t[ndl]) nrerror("allocation failure 2 in f64cube()");
    344     t[ndl] += NR_END;
    345     t[ndl] -= nrl;
    346    
    347     /* allocate rows anc set pointers to them */
    348     t[ndl][nrl]=(float64*) malloc((size_t)((ndep*nrow*nrol+NR_END)*sizeof(float64)));
    349     if (!t[ndl][nrl]) nrerror("allocation failure 3 in f64cube()");
    350     t[ndl][nrl] += NR_END;
    351     t[ndl][nrl] -= ncl;
    352    
    353     for(j=nrl+1;j<=nrh;j++) t[ndl][j]=t[ndl][j-1]+nrol;
    354     for(i=ndl+1;i<=ndh;i++) {
    355         t[i]=t[i-1]+nrow;
    356         t[i][nrl]=t[i-1][nrl]+nrow*nrol;
    357         for(j=nrl+1;j<=nrh;j++) t[i][j]=t[i][j-1]+nrol;
    358     }
    359     /* return pointer to array of pointers to rows */
    360     return t;
    361 }
    362 /* ------------------------------------------------------------------------------------ */
    363 IMAGE_EXPORT(rgb8***) rgb8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch)
    364 /* ------------------------------------------------------------------------------------ */
    365 /* allocate a rgb8 cube with range t[ndl..ndh][nrl..nrh][ncl..nch] */
    366 {
    367     long i,j,ndep=ndh-ndl+1,nrow=nrh-nrl+1,nrol=nch-ncl+1;
    368     rgb8 ***t;
    369    
    370     /* allocate pointers to pointers to rows */
    371     t=(rgb8***) malloc((size_t)((ndep+NR_END)*sizeof(rgb8**)));
    372     if (!t) nrerror("allocation failure 1 in rgb8cube()");
    373     t += NR_END;
    374     t -= ndl;
    375    
    376     /* allocate pointers to rows anc set pointers to them */
    377     t[ndl]=(rgb8**) malloc((size_t)((ndep*nrow+NR_END)*sizeof(rgb8*)));
    378     if (!t[ndl]) nrerror("allocation failure 2 in rgb8cube()");
    379     t[ndl] += NR_END;
    380     t[ndl] -= nrl;
    381    
    382     /* allocate rows anc set pointers to them */
    383     t[ndl][nrl]=(rgb8*) malloc((size_t)((ndep*nrow*nrol+NR_END)*sizeof(rgb8)));
    384     if (!t[ndl][nrl]) nrerror("allocation failure 3 in rgb8cube()");
    385     t[ndl][nrl] += NR_END;
    386     t[ndl][nrl] -= ncl;
    387    
    388     for(j=nrl+1;j<=nrh;j++) t[ndl][j]=t[ndl][j-1]+nrol;
    389     for(i=ndl+1;i<=ndh;i++) {
    390         t[i]=t[i-1]+nrow;
    391         t[i][nrl]=t[i-1][nrl]+nrow*nrol;
    392         for(j=nrl+1;j<=nrh;j++) t[i][j]=t[i][j-1]+nrol;
    393     }
    394     /* return pointer to array of pointers to rows */
    395     return t;
    396 }
    397 /* -------------------------------------------------------------------------------------- */
    398 IMAGE_EXPORT(rgbx8***) rgbx8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch)
    399 /* -------------------------------------------------------------------------------------- */
    400 /* allocate a rgb8 cube with range t[ndl..ndh][nrl..nrh][ncl..nch] */
    401 {
    402     long i,j,ndep=ndh-ndl+1,nrow=nrh-nrl+1,nrol=nch-ncl+1;
    403     rgbx8 ***t;
    404    
    405     /* allocate pointers to pointers to rows */
    406     t=(rgbx8***) malloc((size_t)((ndep+NR_END)*sizeof(rgbx8**)));
    407     if (!t) nrerror("allocation failure 1 in rgbx8cube()");
    408     t += NR_END;
    409     t -= ndl;
    410    
    411     /* allocate pointers to rows anc set pointers to them */
    412     t[ndl]=(rgbx8**) malloc((size_t)((ndep*nrow+NR_END)*sizeof(rgbx8*)));
    413     if (!t[ndl]) nrerror("allocation failure 2 in rgbx8cube()");
    414     t[ndl] += NR_END;
    415     t[ndl] -= nrl;
    416    
    417     /* allocate rows anc set pointers to them */
    418     t[ndl][nrl]=(rgbx8*) malloc((size_t)((ndep*nrow*nrol+NR_END)*sizeof(rgbx8)));
    419     if (!t[ndl][nrl]) nrerror("allocation failure 3 in rgbx8cube()");
    420     t[ndl][nrl] += NR_END;
    421     t[ndl][nrl] -= ncl;
    422    
    423     for(j=nrl+1;j<=nrh;j++) t[ndl][j]=t[ndl][j-1]+nrol;
    424     for(i=ndl+1;i<=ndh;i++) {
    425         t[i]=t[i-1]+nrow;
    426         t[i][nrl]=t[i-1][nrl]+nrow*nrol;
    427         for(j=nrl+1;j<=nrh;j++) t[i][j]=t[i][j-1]+nrol;
    428     }
    429     /* return pointer to array of pointers to rows */
    430     return t;
    431 }
    432 /* ------------------------------------------------------------------------------------------- */
    433 IMAGE_EXPORT(void) free_si8cube(sint8 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh)
    434 /* ------------------------------------------------------------------------------------------- */
    435 {
    436     free((FREE_ARG) (c[nrl][ncl]+ndl-NR_END));
    437     free((FREE_ARG) (c[nrl]+ncl-NR_END));
    438     free((FREE_ARG) (c+nrl-NR_END));
    439 }
    440 /* ------------------------------------------------------------------------------------------- */
    441 IMAGE_EXPORT(void) free_ui8cube(uint8 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh)
    442 /* ------------------------------------------------------------------------------------------- */
    443 {
    444     free((FREE_ARG) (c[nrl][ncl]+ndl-NR_END));
    445     free((FREE_ARG) (c[nrl]+ncl-NR_END));
    446     free((FREE_ARG) (c+nrl-NR_END));
    447 }
    448 /* --------------------------------------------------------------------------------------------- */
    449 IMAGE_EXPORT(void) free_si16cube(sint16 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh)
    450 /* --------------------------------------------------------------------------------------------- */
    451 {
    452     free((FREE_ARG) (c[nrl][ncl]+ndl-NR_END));
    453     free((FREE_ARG) (c[nrl]+ncl-NR_END));
    454     free((FREE_ARG) (c+nrl-NR_END));
    455 }
    456 /* --------------------------------------------------------------------------------------------- */
    457 IMAGE_EXPORT(void) free_ui16cube(uint16 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh)
    458 /* --------------------------------------------------------------------------------------------- */
    459 {
    460     free((FREE_ARG) (c[nrl][ncl]+ndl-NR_END));
    461     free((FREE_ARG) (c[nrl]+ncl-NR_END));
    462     free((FREE_ARG) (c+nrl-NR_END));
    463 }
    464 /* --------------------------------------------------------------------------------------------- */
    465 IMAGE_EXPORT(void) free_si32cube(sint32 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh)
    466 /* --------------------------------------------------------------------------------------------- */
    467 {
    468     free((FREE_ARG) (c[nrl][ncl]+ndl-NR_END));
    469     free((FREE_ARG) (c[nrl]+ncl-NR_END));
    470     free((FREE_ARG) (c+nrl-NR_END));
    471 }
    472 /* --------------------------------------------------------------------------------------------- */
    473 IMAGE_EXPORT(void) free_ui32cube(uint32 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh)
    474 /* --------------------------------------------------------------------------------------------- */
    475 {
    476     free((FREE_ARG) (c[nrl][ncl]+ndl-NR_END));
    477     free((FREE_ARG) (c[nrl]+ncl-NR_END));
    478     free((FREE_ARG) (c+nrl-NR_END));
    479 }
    480 /* --------------------------------------------------------------------------------------------- */
    481 IMAGE_EXPORT(void) free_f32cube(float32 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh)
    482 /* --------------------------------------------------------------------------------------------- */
    483 {
    484     free((FREE_ARG) (c[nrl][ncl]+ndl-NR_END));
    485     free((FREE_ARG) (c[nrl]+ncl-NR_END));
    486     free((FREE_ARG) (c+nrl-NR_END));
    487 }
    488 /* --------------------------------------------------------------------------------------------- */
    489 IMAGE_EXPORT(void) free_f64cube(float64 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh)
    490 /* --------------------------------------------------------------------------------------------- */
    491 {
    492     free((FREE_ARG) (c[nrl][ncl]+ndl-NR_END));
    493     free((FREE_ARG) (c[nrl]+ncl-NR_END));
    494     free((FREE_ARG) (c+nrl-NR_END));
    495 }
    496 /* ------------------------------------------------------------------------------------------- */
    497 IMAGE_EXPORT(void) free_rgb8cube(rgb8 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh)
    498 /* ------------------------------------------------------------------------------------------- */
    499 {
    500     free((FREE_ARG) (c[nrl][ncl]+ndl-NR_END));
    501     free((FREE_ARG) (c[nrl]+ncl-NR_END));
    502     free((FREE_ARG) (c+nrl-NR_END));
    503 }
    504 /* --------------------------------------------------------------------------------------------- */
    505 IMAGE_EXPORT(void) free_rgbx8cube(rgbx8 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh)
    506 /* --------------------------------------------------------------------------------------------- */
    507 {
    508     free((FREE_ARG) (c[nrl][ncl]+ndl-NR_END));
    509     free((FREE_ARG) (c[nrl]+ncl-NR_END));
    510     free((FREE_ARG) (c+nrl-NR_END));
    511 }
     176// Local Variables:
     177// tab-width: 4
     178// c-basic-offset: 4
     179// c-file-offsets:((innamespace . 0)(inline-open . 0))
     180// indent-tabs-mode: nil
     181// End:
     182
     183// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     184
Note: See TracChangeset for help on using the changeset viewer.