Ignore:
Timestamp:
May 6, 2016, 3:06:29 PM (8 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
Location:
soft/giet_vm/applications/rosenfeld/nrc2/include
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc.h

    r772 r821  
    1111#define __NRALLOC_H__
    1212
    13 #ifdef __cplusplus
    14 #pragma message ("C++")
    15 extern "C" {
    16 #endif
    17    
    18 #ifdef VERBOSE_PRAGMA
    19 //#pragma message ("- *** include nralloc.h ***")
    20 #endif
    2113
    2214#include "nralloc1.h"
     
    2416#include "nralloc3.h"
    2517
    26 #ifdef __cplusplus
    27 }
    28 #endif
     18#endif /* __NRALLOC_H__ */
    2919
    30 #endif /* __NRALLOC_H__ */
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc1.h

    r772 r821  
    1111#define __NRALLOC1_H__
    1212
    13 #ifdef __cplusplus
    14 #pragma message ("C++")
    15 extern "C" {
    16 #endif
    17    
    18 #ifdef VERBOSE_PRAGMA
    19 //#pragma message ("- *** include nralloc1.h ***")
    20 #endif
     13#include <stdint.h>
    2114
    22 
    23 //NR_END est maintenant defini dans nrutil.h
    24 
    25 #define NR_END 0
    26 #define FREE_ARG char*
    27 
    28 //long nr_end = NR_END;
    29 
    30 //void nrerror(char error_text[]);
    31 //void nrerror(char *format, ...);
    32 //void Error  (char *format, ...);
    33 //void Warning(char *format, ...);
     15#include "nrc_os_config.h"
     16#include "nrtype.h"
    3417
    3518/*
     
    3922 */
    4023
    41 // do: allocate a float vector with subscript range v[nl..nh]
     24#define type_vector(t) \
     25t * short_name(t,,vector)(int32_t nl, int32_t nh)
    4226
    43 //IMAGE_EXPORT(byte*)      bvector(long nl, long nh);
    44 IMAGE_EXPORT(sint8*)   si8vector(long nl, long nh);
    45 IMAGE_EXPORT(uint8*)   ui8vector(long nl, long nh);
    46 IMAGE_EXPORT(sint16*) si16vector(long nl, long nh);
    47 IMAGE_EXPORT(uint16*) ui16vector(long nl, long nh);
    48 IMAGE_EXPORT(sint32*) si32vector(long nl, long nh);
    49 IMAGE_EXPORT(uint32*) ui32vector(long nl, long nh);
    50 IMAGE_EXPORT(sint64*) si64vector(long nl, long nh);
    51 IMAGE_EXPORT(uint64*) ui64vector(long nl, long nh);
     27type_vector(int8_t);
     28type_vector(uint8_t);
     29type_vector(int16_t);
     30type_vector(uint16_t);
     31type_vector(int32_t);
     32type_vector(uint32_t);
     33type_vector(int64_t);
     34type_vector(uint64_t);
     35type_vector(float);
     36type_vector(double);
     37type_vector(rgb8);
     38type_vector(rgbx8);
     39type_vector(rgb32);
     40type_vector(void_p);
    5241
    53 IMAGE_EXPORT(float32*) f32vector(long nl, long nh);
    54 IMAGE_EXPORT(float64*) f64vector(long nl, long nh);
    5542
    56 IMAGE_EXPORT(rgb8*)   rgb8vector(long nl, long nh);
    57 IMAGE_EXPORT(rgbx8*) rgbx8vector(long nl, long nh);
    58 IMAGE_EXPORT(rgb32*) rgb32vector(long nl, long nh);
    5943
    60 IMAGE_EXPORT(void**)     vvector(long nl, long nh);
     44#if TARGET_OS == GIETVM
     45#define remote_type_vector(t) \
     46t * short_name(t,remote_,vector)(int32_t nl, int32_t nh, int32_t x, int32_t y)
     47
     48remote_type_vector(int8_t);
     49remote_type_vector(uint8_t);
     50remote_type_vector(int16_t);
     51remote_type_vector(uint16_t);
     52remote_type_vector(int32_t);
     53remote_type_vector(uint32_t);
     54remote_type_vector(int64_t);
     55remote_type_vector(uint64_t);
     56remote_type_vector(float);
     57remote_type_vector(double);
     58remote_type_vector(rgb8);
     59remote_type_vector(rgbx8);
     60remote_type_vector(rgb32);
     61remote_type_vector(void_p);
     62
     63//void ** remote_vvector(long nl, long nh, int x, int y);
     64#endif
     65
     66#define type_vector0(t) \
     67t * short_name(t,,vector0)(int32_t nl, int32_t nh)
     68
     69type_vector0(int8_t);
     70type_vector0(uint8_t);
     71type_vector0(int16_t);
     72type_vector0(uint16_t);
     73type_vector0(int32_t);
     74type_vector0(uint32_t);
     75type_vector0(int64_t);
     76type_vector0(uint64_t);
     77type_vector0(float);
     78type_vector0(double);
     79type_vector0(rgb8);
     80type_vector0(rgbx8);
     81type_vector0(rgb32);
     82type_vector0(void_p);
     83
     84#define realloc_type_vector(t) \
     85t * short_name(t,realloc_,vector)(t * v, int32_t nl, int32_t nh)
     86
     87realloc_type_vector(int8_t);
     88realloc_type_vector(uint8_t);
     89realloc_type_vector(int16_t);
     90realloc_type_vector(uint16_t);
     91realloc_type_vector(int32_t);
     92realloc_type_vector(uint32_t);
     93realloc_type_vector(int64_t);
     94realloc_type_vector(uint64_t);
     95realloc_type_vector(float);
     96realloc_type_vector(double);
     97realloc_type_vector(rgb8);
     98realloc_type_vector(rgbx8);
     99realloc_type_vector(rgb32);
     100realloc_type_vector(void_p);
     101
     102
     103#define free_type_vector(t) \
     104void short_name(t,free_,vector)(t * v, long nl, long nh)
     105
     106free_type_vector(int8_t);
     107free_type_vector(uint8_t);
     108free_type_vector(int16_t);
     109free_type_vector(uint16_t);
     110free_type_vector(int32_t);
     111free_type_vector(uint32_t);
     112free_type_vector(int64_t);
     113free_type_vector(uint64_t);
     114free_type_vector(float);
     115free_type_vector(double);
     116free_type_vector(rgb8);
     117free_type_vector(rgbx8);
     118free_type_vector(rgb32);
     119free_type_vector(void_p);
     120
     121
    61122
    62123/*
    63  * ---------------
    64  * --- vector0 ---
    65  * ---------------
    66  */
    67 
    68 // do: allocate a vector and set it to 0
    69 
    70 //IMAGE_EXPORT(byte*)       bvector0(long nl, long nh);
    71 IMAGE_EXPORT(sint8*)    si8vector0(long nl, long nh);
    72 IMAGE_EXPORT(uint8*)    ui8vector0(long nl, long nh);
    73 IMAGE_EXPORT(sint16*)  si16vector0(long nl, long nh);
    74 IMAGE_EXPORT(uint16*)  ui16vector0(long nl, long nh);
    75 IMAGE_EXPORT(sint32*)  si32vector0(long nl, long nh);
    76 IMAGE_EXPORT(uint32*)  ui32vector0(long nl, long nh);
    77 
    78 IMAGE_EXPORT(float32*) f32vector0(long nl, long nh);
    79 IMAGE_EXPORT(float64*) f64vector0(long nl, long nh);
    80 
    81 IMAGE_EXPORT(rgb8*)   rgb8vector0(long nl, long nh);
    82 IMAGE_EXPORT(rgbx8*) rgbx8vector0(long nl, long nh);
    83 IMAGE_EXPORT(rgb32*) rgb32vector0(long nl, long nh);
    84 
    85 IMAGE_EXPORT(void**)     vvector0(long nl, long nh);
    86 /*
    87  * ----------------------
    88  * --- realloc_vector ---
    89  * ----------------------
    90  */
    91 
    92 // realloc a vector to [nl..nh]
    93 IMAGE_EXPORT(void**)  realloc_vvector(void   **v, long nl, long nh);
    94 
    95 /*
    96  * -------------------
    97  * --- free_vector ---
    98  * -------------------
    99  */
    100 
    101 //IMAGE_EXPORT(void) free_bvector    (byte    *v, long nl, long nh);
    102 IMAGE_EXPORT(void) free_si8vector  (sint8   *v, long nl, long nh);
    103 IMAGE_EXPORT(void) free_ui8vector  (uint8   *v, long nl, long nh);
    104 IMAGE_EXPORT(void) free_si16vector (sint16  *v, long nl, long nh);
    105 IMAGE_EXPORT(void) free_ui16vector (uint16  *v, long nl, long nh);
    106 IMAGE_EXPORT(void) free_si32vector (sint32  *v, long nl, long nh);
    107 IMAGE_EXPORT(void) free_ui32vector (uint32  *v, long nl, long nh);
    108 IMAGE_EXPORT(void) free_si64vector (sint64  *v, long nl, long nh);
    109 IMAGE_EXPORT(void) free_ui64vector (uint64  *v, long nl, long nh);
    110 
    111 IMAGE_EXPORT(void) free_f32vector  (float32 *v, long nl, long nh);
    112 IMAGE_EXPORT(void) free_f64vector  (float64 *v, long nl, long nh);
    113 
    114 IMAGE_EXPORT(void) free_rgb8vector (rgb8    *v, long nl, long nh);
    115 IMAGE_EXPORT(void) free_rgbx8vector(rgbx8   *v, long nl, long nh);
    116 IMAGE_EXPORT(void) free_rgb32vector(rgb32   *v, long nl, long nh);
    117 
    118 IMAGE_EXPORT(void) free_vvector    (void   **v, long nl, long nh);
    119 
    120 #ifdef __cplusplus
    121 }
    122 #endif
     124void ** vvector(long nl, long nh);
     125void ** vvector0(long nl, long nh);
     126void ** realloc_vvector(void ** v, long nl, long nh);
     127void free_vvector(void ** v, long nl, long nh);
     128*/
    123129
    124130#endif /* __NRALLOC1_H__ */
     131
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc2.h

    r772 r821  
    1616#define __NRALLOC2_H__
    1717
    18 #ifdef __cplusplus
    19 #pragma message ("C++")
    20 extern "C" {
    21 #endif
    22    
    23 #ifdef VERBOSE_PRAGMA
    24 //#pragma message ("- *** include nralloc2.h ***")
    25 #endif
     18#include "nrc_os_config.h"
    2619
    2720/*
     
    3124 */
    3225
    33 IMAGE_EXPORT(sint8**)     si8matrix(long nrl, long nrh, long ncl, long nch);
    34 IMAGE_EXPORT(uint8**)     ui8matrix(long nrl, long nrh, long ncl, long nch);
    35 IMAGE_EXPORT(sint16**)   si16matrix(long nrl, long nrh, long ncl, long nch);
    36 IMAGE_EXPORT(uint16**)   ui16matrix(long nrl, long nrh, long ncl, long nch);
    37 IMAGE_EXPORT(sint32**)   si32matrix(long nrl, long nrh, long ncl, long nch);
    38 IMAGE_EXPORT(uint32**)   ui32matrix(long nrl, long nrh, long ncl, long nch);
    39 IMAGE_EXPORT(sint64**)   si64matrix(long nrl, long nrh, long ncl, long nch);
    40 IMAGE_EXPORT(uint64**)   ui64matrix(long nrl, long nrh, long ncl, long nch);
    4126
    42 IMAGE_EXPORT(float32**)   f32matrix(long nrl, long nrh, long ncl, long nch);
    43 IMAGE_EXPORT(float64**)   f64matrix(long nrl, long nrh, long ncl, long nch);
     27#undef type_matrix
     28#define type_matrix(t) \
     29t ** short_name(t,,matrix)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
    4430
    45 IMAGE_EXPORT(complex32**) c32matrix(long nrl, long nrh, long ncl, long nch);
    46 IMAGE_EXPORT(complex64**) c64matrix(long nrl, long nrh, long ncl, long nch);
    4731
    48 IMAGE_EXPORT(rgb8**)     rgb8matrix(long nrl, long nrh, long ncl, long nch);
    49 IMAGE_EXPORT(rgbx8**)   rgbx8matrix(long nrl, long nrh, long ncl, long nch);
    50 //IMAGE_EXPORT(rgb32**)   rgb32matrix(long nrl, long nrh, long ncl, long nch);
    51 //IMAGE_EXPORT(rgbx32**) rgbx32matrix(long nrl, long nrh, long ncl, long nch);
     32type_matrix(int8_t);
     33type_matrix(uint8_t);
     34type_matrix(int16_t);
     35type_matrix(uint16_t);
     36type_matrix(int32_t);
     37type_matrix(uint32_t);
     38type_matrix(int64_t);
     39type_matrix(uint64_t);
     40type_matrix(float);
     41type_matrix(double);
     42type_matrix(void_p);
     43type_matrix(rgb8);
     44type_matrix(rgbx8);
     45type_matrix(rgb32);
     46type_matrix(rgbx32);
     47type_matrix(complex32);
     48type_matrix(complex64);
    5249
    53 /*
    54  * ---------------
    55  * --- matrix0 ---
    56  * ---------------
    57  */
    5850
    59 IMAGE_EXPORT(sint8**)     si8matrix0(long nrl, long nrh, long ncl, long nch);
    60 IMAGE_EXPORT(uint8**)     ui8matrix0(long nrl, long nrh, long ncl, long nch);
    61 IMAGE_EXPORT(sint16**)   si16matrix0(long nrl, long nrh, long ncl, long nch);
    62 IMAGE_EXPORT(uint16**)   ui16matrix0(long nrl, long nrh, long ncl, long nch);
    63 IMAGE_EXPORT(sint32**)    i32matrix0(long nrl, long nrh, long ncl, long nch);
    64 IMAGE_EXPORT(uint32**)   ui32matrix0(long nrl, long nrh, long ncl, long nch);
    65 IMAGE_EXPORT(sint64**)   si64matrix0(long nrl, long nrh, long ncl, long nch);
    66 IMAGE_EXPORT(uint64**)   ui64matrix0(long nrl, long nrh, long ncl, long nch);
    67 IMAGE_EXPORT(rgb8**)     rgb8matrix0(long nrl, long nrh, long ncl, long nch);
    68 IMAGE_EXPORT(rgbx8**)   rgbx8matrix0(long nrl, long nrh, long ncl, long nch);
    69 IMAGE_EXPORT(rgb32**)   rgb32matrix0(long nrl, long nrh, long ncl, long nch);
    70 IMAGE_EXPORT(rgbx32**) rgbx32matrix0(long nrl, long nrh, long ncl, long nch);
     51#undef type_matrix0
     52#define type_matrix0(t) \
     53t ** short_name(t,,matrix0)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
    7154
    72 IMAGE_EXPORT(float32**)   f32matrix0(long nrl, long nrh, long ncl, long nch);
    73 IMAGE_EXPORT(float64**)   f64matrix0(long nrl, long nrh, long ncl, long nch);
    7455
    75 /*
    76  * -------------------
    77  * --- free_matrix ---
    78  * -------------------
    79  */
     56type_matrix0(int8_t);
     57type_matrix0(uint8_t);
     58type_matrix0(int16_t);
     59type_matrix0(uint16_t);
     60type_matrix0(int32_t);
     61type_matrix0(uint32_t);
     62type_matrix0(int64_t);
     63type_matrix0(uint64_t);
     64type_matrix0(float);
     65type_matrix0(double);
     66type_matrix0(void_p);
     67type_matrix0(rgb8);
     68type_matrix0(rgbx8);
     69type_matrix0(rgb32);
     70type_matrix0(rgbx32);
     71type_matrix0(complex32);
     72type_matrix0(complex64);
    8073
    81 IMAGE_EXPORT(void) free_si8matrix  (sint8  **m, long nrl, long nrh, long ncl, long nch);
    82 IMAGE_EXPORT(void) free_ui8matrix  (uint8  **m, long nrl, long nrh, long ncl, long nch);
    83 IMAGE_EXPORT(void) free_si16matrix (sint16 **m, long nrl, long nrh, long ncl, long nch);
    84 IMAGE_EXPORT(void) free_ui16matrix (uint16 **m, long nrl, long nrh, long ncl, long nch);
    85 IMAGE_EXPORT(void) free_si32matrix (sint32 **m, long nrl, long nrh, long ncl, long nch);
    86 IMAGE_EXPORT(void) free_ui32matrix (uint32 **m, long nrl, long nrh, long ncl, long nch);
    87 IMAGE_EXPORT(void) free_si64matrix (sint64 **m, long nrl, long nrh, long ncl, long nch);
    88 IMAGE_EXPORT(void) free_ui64matrix (uint64 **m, long nrl, long nrh, long ncl, long nch);
    8974
    90 IMAGE_EXPORT(void) free_f32matrix (float32   **m, long nrl, long nrh, long ncl, long nch);
    91 IMAGE_EXPORT(void) free_f64matrix (float64   **m, long nrl, long nrh, long ncl, long nch);
    92 IMAGE_EXPORT(void) free_c32matrix (complex32 **m, long nrl, long nrh, long ncl, long nch);
    93 IMAGE_EXPORT(void) free_c64matrix (complex64 **m, long nrl, long nrh, long ncl, long nch);
     75#if TARGET_OS == GIETVM
    9476
    95 IMAGE_EXPORT(void) free_rgb8matrix  (rgb8   **m, long nrl, long nrh, long ncl, long nch);
    96 IMAGE_EXPORT(void) free_rgbx8matrix (rgbx8  **m, long nrl, long nrh, long ncl, long nch);
    97 IMAGE_EXPORT(void) free_rgb32matrix (rgb32  **m, long nrl, long nrh, long ncl, long nch);
    98 IMAGE_EXPORT(void) free_rgbx32matrix(rgbx32 **m, long nrl, long nrh, long ncl, long nch);
     77#undef remote_type_matrix
     78#define remote_type_matrix(t) \
     79t ** short_name(t,remote_,matrix)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
    9980
    100 #ifdef __cplusplus
    101 }
     81remote_type_matrix(int8_t);
     82remote_type_matrix(uint8_t);
     83remote_type_matrix(int16_t);
     84remote_type_matrix(uint16_t);
     85remote_type_matrix(int32_t);
     86remote_type_matrix(uint32_t);
     87remote_type_matrix(int64_t);
     88remote_type_matrix(uint64_t);
     89remote_type_matrix(float);
     90remote_type_matrix(double);
     91remote_type_matrix(void_p);
     92remote_type_matrix(rgb8);
     93remote_type_matrix(rgbx8);
     94remote_type_matrix(rgb32);
     95remote_type_matrix(rgbx32);
     96remote_type_matrix(complex32);
     97remote_type_matrix(complex64);
     98
    10299#endif
    103100
     101
     102#undef free_type_matrix
     103#define free_type_matrix(t) \
     104void short_name(t,free_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
     105
     106free_type_matrix(int8_t);
     107free_type_matrix(uint8_t);
     108free_type_matrix(int16_t);
     109free_type_matrix(uint16_t);
     110free_type_matrix(int32_t);
     111free_type_matrix(uint32_t);
     112free_type_matrix(int64_t);
     113free_type_matrix(uint64_t);
     114free_type_matrix(float);
     115free_type_matrix(double);
     116free_type_matrix(void_p);
     117free_type_matrix(rgb8);
     118free_type_matrix(rgbx8);
     119free_type_matrix(rgb32);
     120free_type_matrix(rgbx32);
     121free_type_matrix(complex32);
     122free_type_matrix(complex64);
     123
     124
    104125#endif /* __NRALLOC2_H__ */
     126
     127// Local Variables:
     128// tab-width: 4
     129// c-basic-offset: 4
     130// c-file-offsets:((innamespace . 0)(inline-open . 0))
     131// indent-tabs-mode: nil
     132// End:
     133// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     134
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc2x.h

    r772 r821  
    1616#define __NRALLOC2X_H__
    1717
    18 #ifdef __cplusplus
    19 #pragma message ("C++")
    20 extern "C" {
    21 #endif
    22    
    23 #ifdef VERBOSE_PRAGMA
    24 //#pragma message ("- *** include nralloc2x.h ***")
    25 #endif
    2618
     19#include "nrc_os_config.h"
    2720#include "nrtype.h"
    2821#include "nrtypex.h"
    2922
    30 /* ---------------------------------- */
    31 /* --- composite user type matrix --- */
    32 /* ---------------------------------- */
    33 
    34 IMAGE_EXPORT(si16Point**)   si16Pmatrix(long nrl, long nrh, long ncl, long nch);
    35 IMAGE_EXPORT(ui16Point**)   ui16Pmatrix(long nrl, long nrh, long ncl, long nch);
    36 IMAGE_EXPORT(si32Point**)   si32Pmatrix(long nrl, long nrh, long ncl, long nch);
    37 IMAGE_EXPORT(ui32Point**)   ui32Pmatrix(long nrl, long nrh, long ncl, long nch);
    38 IMAGE_EXPORT(f32Point**)     f32Pmatrix(long nrl, long nrh, long ncl, long nch);
    39 
    40 IMAGE_EXPORT(si16Triplet**) si16Tmatrix(long nrl, long nrh, long ncl, long nch);
    41 IMAGE_EXPORT(ui16Triplet**) ui16Tmatrix(long nrl, long nrh, long ncl, long nch);
    42 IMAGE_EXPORT(si32Triplet**) si32Tmatrix(long nrl, long nrh, long ncl, long nch);
    43 IMAGE_EXPORT(ui32Triplet**) ui32Tmatrix(long nrl, long nrh, long ncl, long nch);
    44 IMAGE_EXPORT(f32Triplet**)   f32Tmatrix(long nrl, long nrh, long ncl, long nch);
    45 
    46 IMAGE_EXPORT(void) free_si16Pmatrix(si16Point **m, long nrl, long nrh, long ncl, long nch);
    47 IMAGE_EXPORT(void) free_ui16Pmatrix(ui16Point **m, long nrl, long nrh, long ncl, long nch);
    48 IMAGE_EXPORT(void) free_si32Pmatrix(si32Point **m, long nrl, long nrh, long ncl, long nch);
    49 IMAGE_EXPORT(void) free_ui32Pmatrix(ui32Point **m, long nrl, long nrh, long ncl, long nch);
    50 IMAGE_EXPORT(void) free_f32Pmatrix(f32Point   **m, long nrl, long nrh, long ncl, long nch);
    51 
    52 IMAGE_EXPORT(void) free_si16Tmatrix(si16Triplet **m, long nrl, long nrh, long ncl, long nch);
    53 IMAGE_EXPORT(void) free_ui16Tmatrix(ui16Triplet **m, long nrl, long nrh, long ncl, long nch);
    54 IMAGE_EXPORT(void) free_si32Tmatrix(si32Triplet **m, long nrl, long nrh, long ncl, long nch);
    55 IMAGE_EXPORT(void) free_ui32Tmatrix(ui32Triplet **m, long nrl, long nrh, long ncl, long nch);
    56 IMAGE_EXPORT(void) free_f32Tmatrix ( f32Triplet **m, long nrl, long nrh, long ncl, long nch);
    5723
    5824/* ----------------- */
     
    6026/* ----------------- */
    6127
    62 IMAGE_EXPORT(byte**)      btrimatrix(long nrl, long nrh, long ncl, long nch, long step);
    63 IMAGE_EXPORT(sint16**) si16trimatrix(long nrl, long nrh, long ncl, long nch, long step);
    64 IMAGE_EXPORT(uint16**) ui16trimatrix(long nrl, long nrh, long ncl, long nch, long step);
    65 IMAGE_EXPORT(sint32**) si32trimatrix(long nrl, long nrh, long ncl, long nch, long step);
    66 IMAGE_EXPORT(uint32**) ui32trimatrix(long nrl, long nrh, long ncl, long nch, long step);
    67 IMAGE_EXPORT(float32**) f32trimatrix(long nrl, long nrh, long ncl, long nch, long step);
    68 IMAGE_EXPORT(float64**) f64trimatrix(long nrl, long nrh, long ncl, long nch, long step);
     28#define type_trimatrix(t) \
     29t ** short_name(t,,trimatrix)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t step)
    6930
    70 #ifdef __cplusplus
    71 }
    72 #endif
     31type_trimatrix(int8_t);
     32type_trimatrix(uint8_t);
     33type_trimatrix(int16_t);
     34type_trimatrix(uint16_t);
     35type_trimatrix(int32_t);
     36type_trimatrix(uint32_t);
     37type_trimatrix(float);
     38type_trimatrix(double);
     39
    7340
    7441#endif /* __NRALLOC2X_H__ */
     42
     43// Local Variables:
     44// tab-width: 4
     45// c-basic-offset: 4
     46// c-file-offsets:((innamespace . 0)(inline-open . 0))
     47// indent-tabs-mode: nil
     48// End:
     49// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     50
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc3.h

    r772 r821  
    1313#define __NRALLOC3_H__
    1414
    15 #ifdef __cplusplus
    16 #pragma message ("C++")
    17 extern "C" {
    18 #endif
    19    
    20 #ifdef VERBOSE_PRAGMA
    21 //#pragma message ("- *** include nralloc3.h ***")
    22 #endif
     15#include "nrc_os_config.h"
    2316
    24 double*** d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
    25 void free_d3tensor(double  ***t,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
     17//double*** d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
     18//void free_d3tensor(double  ***t,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
     19
     20#define type_cube(t) \
     21t *** short_name(t,,cube)(int32_t ndl, int32_t ndh, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \
    2622
    2723
     24type_cube(int8_t);
     25type_cube(uint8_t);
     26type_cube(int16_t);
     27type_cube(uint16_t);
     28type_cube(int32_t);
     29type_cube(uint32_t);
     30type_cube(int64_t);
     31type_cube(uint64_t);
     32type_cube(float);
     33type_cube(double);
     34type_cube(rgb8);
     35type_cube(rgbx8);
    2836
    29 IMAGE_EXPORT(sint8***)   si8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
    30 IMAGE_EXPORT(uint8***)   ui8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
    31 IMAGE_EXPORT(sint16***) si16cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
    32 IMAGE_EXPORT(uint16***) ui16cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
    33 IMAGE_EXPORT(sint32***) si32cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
    34 IMAGE_EXPORT(uint32***) ui32cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
    35 IMAGE_EXPORT(float32***) f32cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
    36 IMAGE_EXPORT(float64***) f64cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
    37 IMAGE_EXPORT(rgb8***)   rgb8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
    38 IMAGE_EXPORT(rgbx8***) rgbx8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
     37#define free_type_cube(t) \
     38void 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) \
    3939
    40 IMAGE_EXPORT(void) free_si8cube  (sint8   ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
    41 IMAGE_EXPORT(void) free_ui8cube  (uint8   ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
    42 IMAGE_EXPORT(void) free_si16cube (sint16  ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
    43 IMAGE_EXPORT(void) free_ui16cube (uint16  ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
    44 IMAGE_EXPORT(void) free_si32cube (sint32  ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
    45 IMAGE_EXPORT(void) free_ui32cube (uint32  ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
    46 IMAGE_EXPORT(void) free_f32cube  (float32 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
    47 IMAGE_EXPORT(void) free_f64cube  (float64 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
    48 IMAGE_EXPORT(void) free_rgb8cube (rgb8    ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
    49 IMAGE_EXPORT(void) free_rgbx8cube(rgbx8   ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
     40free_type_cube(int8_t);
     41free_type_cube(uint8_t);
     42free_type_cube(int16_t);
     43free_type_cube(uint16_t);
     44free_type_cube(int32_t);
     45free_type_cube(uint32_t);
     46free_type_cube(int64_t);
     47free_type_cube(uint64_t);
     48free_type_cube(float);
     49free_type_cube(double);
     50free_type_cube(rgb8);
     51free_type_cube(rgbx8);
    5052
    51 #ifdef __cplusplus
    52 }
    53 #endif
    5453
    5554#endif /* __NRALLOC3_H__ */
     55
     56// Local Variables:
     57// tab-width: 4
     58// c-basic-offset: 4
     59// c-file-offsets:((innamespace . 0)(inline-open . 0))
     60// indent-tabs-mode: nil
     61// End:
     62
     63// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     64
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith0.h

    r772 r821  
    1111#define __NRARITH0_H__
    1212
    13 #ifdef __cplusplus
    14 #pragma message ("C++")
    15 extern "C" {
    16 #endif
    17 
    18 #ifdef VERBOSE_PRAGMA
    19 //#pragma message(" -include nrarith0.h")
    20 #endif
    21 
    2213/* ---------- */
    2314/* -- Swap -- */
    2415/* ---------- */
    2516
    26 ROUTINE(void)   i8swap(int8    *a, int8    *b);
    27 ROUTINE(void)  i16swap(int16   *a, int16   *b);
    28 ROUTINE(void)  i32swap(int32   *a, int32   *b);
    29 ROUTINE(void)  i64swap(int64   *a, int64   *b);
    30 ROUTINE(void)  f32swap(float32 *a, float32 *b);
    31 ROUTINE(void)  f64swap(float64 *a, float64 *b);
    32 ROUTINE(void)  rgb8swap(rgb8   *a, rgb8    *b);
    33 ROUTINE(void) rgbx8swap(rgbx8  *a, rgbx8   *b);
     17#define type_swap(t)                   \
     18void short_name(t,,swap)(t * a, t * b)
     19
     20type_swap(int8_t);
     21type_swap(int16_t);
     22type_swap(int32_t);
     23type_swap(int64_t);
     24type_swap(float);
     25type_swap(double);
     26type_swap(rgb8);
     27type_swap(rgbx8);
     28
    3429
    3530/* --------- */
     
    3732/* --------- */
    3833
    39 ROUTINE(float32) f32min (float32 x1, float32 x2);
    40 ROUTINE(float32) f32min2(float32 x1, float32 x2);
    41 ROUTINE(float32) f32min3(float32 x1, float32 x2, float32 x3);
    42 ROUTINE(float32) f32min4(float32 x1, float32 x2, float32 x3, float32 x4);
    43 ROUTINE(float32) f32min5(float32 x1, float32 x2, float32 x3, float32 x4, float32 x5);
     34#define type_min(t)                                 \
     35t short_name(t,,min)(t x1, t x2);                   \
     36t short_name(t,,min2)(t x1, t x2);                  \
     37t short_name(t,,min3)(t x1, t x2, t x3);            \
     38t short_name(t,,min4)(t x1, t x2, t x3, t x4);      \
     39t short_name(t,,min5)(t x1, t x2, t x3, t x4, t x5) \
    4440
    45 ROUTINE(float64) f64min (float64 x1, float64 x2);
    46 ROUTINE(float64) f64min2(float64 x1, float64 x2);
    47 ROUTINE(float64) f64min3(float64 x1, float64 x2, float64 x3);
    48 ROUTINE(float64) f64min4(float64 x1, float64 x2, float64 x3, float64 x4);
    49 ROUTINE(float64) f64min5(float64 x1, float64 x2, float64 x3, float64 x4, float64 x5);
     41type_min(float);
     42type_min(double);
     43type_min(int8_t);
     44type_min(uint8_t);
     45type_min(int16_t);
     46type_min(uint16_t);
     47type_min(int32_t);
     48type_min(uint32_t);
     49type_min(rgb8);
    5050
    51 ROUTINE(byte)  bmin (byte x1, byte x2);
    52 ROUTINE(byte)  bmin2(byte x1, byte x2);
    53 ROUTINE(byte)  bmin3(byte x1, byte x2, byte x3);
    54 ROUTINE(byte)  bmin4(byte x1, byte x2, byte x3, byte x4);
    55 ROUTINE(byte)  bmin5(byte x1, byte x2, byte x3, byte x4, byte x5);
    56 
    57 ROUTINE(uint16) ui16min (uint16 x1, uint16 x2);
    58 ROUTINE(uint16) ui16min2(uint16 x1, uint16 x2);
    59 ROUTINE(uint16) ui16min3(uint16 x1, uint16 x2, uint16 x3);
    60 ROUTINE(uint16) ui16min4(uint16 x1, uint16 x2, uint16 x3, uint16 x4);
    61 ROUTINE(uint16) ui16min5(uint16 x1, uint16 x2, uint16 x3, uint16 x4, uint16 x5);
    62 
    63 ROUTINE(int32) i32min (int32 x1, int32 x2);
    64 ROUTINE(int32) i32min2(int32 x1, int32 x2);
    65 ROUTINE(int32) i32min3(int32 x1, int32 x2, int32 x3);
    66 ROUTINE(int32) i32min4(int32 x1, int32 x2, int32 x3, int32 x4);
    67 ROUTINE(int32) i32min5(int32 x1, int32 x2, int32 x3, int32 x4, int32 x5);
    68 
    69 ROUTINE(rgb8) rgb8min (rgb8 x1, rgb8 x2);
    70 ROUTINE(rgb8) rgb8min2(rgb8 x1, rgb8 x2);
    71 ROUTINE(rgb8) rgb8min3(rgb8 x1, rgb8 x2, rgb8 x3);
    72 ROUTINE(rgb8) rgb8min4(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4);
    73 ROUTINE(rgb8) rgb8min5(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4, rgb8 x5);
    7451
    7552/* --------- */
    7653/* -- Max -- */
    7754/* --------- */
    78 ROUTINE(float32) f32max (float32 x1, float32 x2);
    79 ROUTINE(float32) f32max2(float32 x1, float32 x2);
    80 ROUTINE(float32) f32max3(float32 x1, float32 x2, float32 x3);
    81 ROUTINE(float32) f32max4(float32 x1, float32 x2, float32 x3, float32 x4);
    82 ROUTINE(float32) f32max5(float32 x1, float32 x2, float32 x3, float32 x4, float32 x5);
    8355
    84 ROUTINE(float64) f64max (float64 x1, float64 x2);
    85 ROUTINE(float64) f64max2(float64 x1, float64 x2);
    86 ROUTINE(float64) f64max3(float64 x1, float64 x2, float64 x3);
    87 ROUTINE(float64) f64max4(float64 x1, float64 x2, float64 x3, float64 x4);
    88 ROUTINE(float64) f64max5(float64 x1, float64 x2, float64 x3, float64 x4, float64 x5);
     56#define type_max(t)                                 \
     57t short_name(t,,max)(t x1, t x2);                   \
     58t short_name(t,,max2)(t x1, t x2);                  \
     59t short_name(t,,max3)(t x1, t x2, t x3);            \
     60t short_name(t,,max4)(t x1, t x2, t x3, t x4);      \
     61t short_name(t,,max5)(t x1, t x2, t x3, t x4, t x5) \
    8962
    90 ROUTINE(byte)  bmax (byte x1,  byte x2);
    91 ROUTINE(byte)  bmax2(byte x1,  byte x2);
    92 ROUTINE(byte)  bmax3(byte x1,  byte x2, byte x3);
    93 ROUTINE(byte)  bmax4(byte x1,  byte x2, byte x3, byte x4);
    94 ROUTINE(byte)  bmax5(byte x1,  byte x2, byte x3, byte x4, byte x5);
     63type_max(float);
     64type_max(double);
     65type_max(int8_t);
     66type_max(uint8_t);
     67type_max(int16_t);
     68type_max(uint16_t);
     69type_max(int32_t);
     70type_max(uint32_t);
     71type_max(rgb8);
    9572
    96 ROUTINE(uint16) ui16max (uint16 x1, uint16 x2);
    97 ROUTINE(uint16) ui16max2(uint16 x1, uint16 x2);
    98 ROUTINE(uint16) ui16max3(uint16 x1, uint16 x2, uint16 x3);
    99 ROUTINE(uint16) ui16max4(uint16 x1, uint16 x2, uint16 x3, uint16 x4);
    100 ROUTINE(uint16) ui16max5(uint16 x1, uint16 x2, uint16 x3, uint16 x4, uint16 x5);
    101 
    102 ROUTINE(int32) i32max (int32 x1, int32 x2);
    103 ROUTINE(int32) i32max2(int32 x1, int32 x2);
    104 ROUTINE(int32) i32max3(int32 x1, int32 x2, int32 x3);
    105 ROUTINE(int32) i32max4(int32 x1, int32 x2, int32 x3, int32 x4);
    106 ROUTINE(int32) i32max5(int32 x1, int32 x2, int32 x3, int32 x4, int32 x5);
    107 
    108 ROUTINE(rgb8) rgb8max (rgb8 x1, rgb8 x2);
    109 ROUTINE(rgb8) rgb8max2(rgb8 x1, rgb8 x2);
    110 ROUTINE(rgb8) rgb8max3(rgb8 x1, rgb8 x2, rgb8 x3);
    111 ROUTINE(rgb8) rgb8max4(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4);
    112 ROUTINE(rgb8) rgb8max5(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4, rgb8 x5);
    11373
    11474/* ----------- */
     
    11676/* ----------- */
    11777
    118 ROUTINE(byte) ibit(int32 x, int n);
    119 ROUTINE(int32) sym_int32(int32 x);
    120 ROUTINE(int) myLog2(int x);
    121 ROUTINE(int) next_power2(int x);
    122 ROUTINE(int) myGCD(int u, int v);
    123 ROUTINE(int) myLCM(int u, int v);
     78int32_t i32bit(int32_t x, int32_t n);
     79int32_t sym_int32(int32_t x);
     80int32_t myLog2(int32_t x);
     81int32_t next_power2(int32_t x);
     82int32_t myGCD(int32_t u, int32_t v);
     83int32_t myLCM(int32_t u, int32_t v);
    12484
    125 #ifdef __cplusplus
    126 }
    12785#endif
    12886
    129 #else
    130 //#pragma message(" Warning : attempt to re-include nrarith0.h")
    131 #endif
     87// Local Variables:
     88// tab-width: 4
     89// c-basic-offset: 4
     90// c-file-offsets:((innamespace . 0)(inline-open . 0))
     91// indent-tabs-mode: nil
     92// End:
    13293
     94// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     95
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith1.h

    r772 r821  
    1111#define _NRARITH1_H_
    1212
    13 #ifdef __cplusplus
    14 #ifdef PRAGMA_VERBOSE
    15 #pragma message ("C++")
    16 #endif
    17 extern "C" {
    18 #endif
    19 
    20 #ifdef PRAGMA_VERBOSE
    21 //#pragma message("- include nrarith1.h")
    22 #endif
    23 
    24 /* ======================================================================== */
    25 /* === Beta reduction ===================================================== */
    26 /* ======================================================================== */
    27 
    28 IMAGE_EXPORT(int32) sum_bvector (byte  *v, long nl, long nh);
    29 IMAGE_EXPORT(int32) sum_si16vector (sint16  *v, long nl, long nh);
    30 IMAGE_EXPORT(int32) sum_si32vector (sint32   *v, long nl, long nh);
    31 IMAGE_EXPORT(float) sum_f32vector  (float32 *v, long nl, long nh);
    32 
    33 // ==================
    34 // === min_vector ===
    35 // ==================
    36 
    37 IMAGE_EXPORT(sint8)   min_si8vector  (sint8   *v, long nl, long nh);
    38 IMAGE_EXPORT(uint8)   min_ui8vector  (uint8   *v, long nl, long nh);
    39 IMAGE_EXPORT(sint16)  min_si16vector (sint16  *v, long nl, long nh);
    40 IMAGE_EXPORT(uint16)  min_ui16vector (uint16  *v, long nl, long nh);
    41 IMAGE_EXPORT(sint32)  min_si32vector (sint32  *v, long nl, long nh);
    42 IMAGE_EXPORT(uint32)  min_ui32vector (uint32  *v, long nl, long nh);
    43 IMAGE_EXPORT(float32) min_f32vector  (float32 *v, long nl, long nh);
    44 IMAGE_EXPORT(float64) min_f64vector  (float64 *v, long nl, long nh);
    45 
    46 // ==================
    47 // === max_vector ===
    48 // ==================
    49 
    50 IMAGE_EXPORT(sint8)  max_si8vector  (sint8   *v, long nl, long nh);
    51 IMAGE_EXPORT(uint8)  max_ui8vector  (uint8   *v, long nl, long nh);
    52 IMAGE_EXPORT(sint16) max_si16vector (sint16  *v, long nl, long nh);
    53 IMAGE_EXPORT(uint16) max_ui16vector (uint16  *v, long nl, long nh);
    54 IMAGE_EXPORT(sint32) max_si32vector (sint32  *v, long nl, long nh);
    55 IMAGE_EXPORT(uint32) max_ui32vector (uint32  *v, long nl, long nh);
    56 
    57 IMAGE_EXPORT(float32) max_f32vector (float32 *v, long nl, long nh);
    58 IMAGE_EXPORT(float64) max_f64vector (float64 *v, long nl, long nh);
    59 
    60 // ======================
    61 // === min_vector_pos ===
    62 // ======================
    63 
    64 IMAGE_EXPORT(sint8)  min_si8vector_pos  (sint8  *v, long nl, long nh, int *pos);
    65 IMAGE_EXPORT(uint8)  min_ui8vector_pos  (uint8  *v, long nl, long nh, int *pos);
    66 IMAGE_EXPORT(sint16) min_si16vector_pos (sint16 *v, long nl, long nh, int *pos);
    67 IMAGE_EXPORT(uint16) min_ui16vector_pos (uint16 *v, long nl, long nh, int *pos);
    68 IMAGE_EXPORT(sint32) min_si32vector_pos (sint32 *v, long nl, long nh, int *pos);
    69 IMAGE_EXPORT(uint32) min_ui32vector_pos (uint32 *v, long nl, long nh, int *pos);
    70 
    71 IMAGE_EXPORT(float32)min_f32vector_pos (float32 *v, long nl, long nh, int *pos);
    72 IMAGE_EXPORT(float64)min_f64vector_pos (float64 *v, long nl, long nh, int *pos);
    73 
    74 // ======================
    75 // === max_vector_pos ===
    76 // ======================
    77 
    78 IMAGE_EXPORT(sint8)  max_si8vector_pos  (sint8  *v, long nl, long nh, int *pos);
    79 IMAGE_EXPORT(uint8)  max_ui8vector_pos  (uint8  *v, long nl, long nh, int *pos);
    80 IMAGE_EXPORT(sint16) max_si16vector_pos (sint16 *v, long nl, long nh, int *pos);
    81 IMAGE_EXPORT(uint16) max_ui16vector_pos (uint16 *v, long nl, long nh, int *pos);
    82 IMAGE_EXPORT(sint32) max_si32vector_pos (sint32 *v, long nl, long nh, int *pos);
    83 IMAGE_EXPORT(uint32) max_ui32vector_pos (uint32 *v, long nl, long nh, int *pos);
    84 
    85 IMAGE_EXPORT(float32)max_f32vector_pos (float32 *v, long nl, long nh, int *pos);
    86 IMAGE_EXPORT(float64)max_f64vector_pos (float64 *v, long nl, long nh, int *pos);
     13/*
     14 * ------------------
     15 * --- sum_vector ---
     16 * ------------------
     17 */
     18
     19#define sum_type_vector(t,r) \
     20r short_name(t,sum_,vector)(t * v, int32_t nl, int32_t nh)
     21
     22sum_type_vector(int8_t, int32_t);
     23sum_type_vector(uint8_t, uint32_t);
     24sum_type_vector(int16_t, int32_t);
     25sum_type_vector(uint16_t, uint32_t);
     26sum_type_vector(int32_t, int32_t);
     27sum_type_vector(uint32_t, uint32_t);
     28sum_type_vector(float, float);
     29sum_type_vector(double, double);
     30
     31/*
     32 * ------------------
     33 * --- min_vector ---
     34 * ------------------
     35 */
     36
     37#define min_type_vector(t) \
     38t short_name(t,min_,vector)(t * v, int32_t nl, int32_t nh)
     39
     40min_type_vector(int8_t);
     41min_type_vector(uint8_t);
     42min_type_vector(int16_t);
     43min_type_vector(uint16_t);
     44min_type_vector(int32_t);
     45min_type_vector(uint32_t);
     46min_type_vector(float);
     47min_type_vector(double);
     48
     49
     50/*
     51 * ------------------
     52 * --- max_vector ---
     53 * ------------------
     54 */
     55
     56#define max_type_vector(t) \
     57t short_name(t,max_,vector)(t * v, int32_t nl, int32_t nh)
     58
     59max_type_vector(int8_t);
     60max_type_vector(uint8_t);
     61max_type_vector(int16_t);
     62max_type_vector(uint16_t);
     63max_type_vector(int32_t);
     64max_type_vector(uint32_t);
     65max_type_vector(float);
     66max_type_vector(double);
     67
     68
     69/*
     70 * ----------------------
     71 * --- min_vector_pos ---
     72 * ----------------------
     73 */
     74
     75
     76#define min_type_vector_pos(t) \
     77t short_name(t,min_,vector_pos)(t * v, int32_t nl, int32_t nh, int32_t * pos)
     78
     79min_type_vector_pos(int8_t);
     80min_type_vector_pos(uint8_t);
     81min_type_vector_pos(int16_t);
     82min_type_vector_pos(uint16_t);
     83min_type_vector_pos(int32_t);
     84min_type_vector_pos(uint32_t);
     85min_type_vector_pos(float);
     86min_type_vector_pos(double);
     87
     88
     89/*
     90 * ----------------------
     91 * --- max_vector_pos ---
     92 * ----------------------
     93 */
     94
     95#define max_type_vector_pos(t) \
     96t short_name(t,max_,vector_pos)(t * v, int32_t nl, int32_t nh, int32_t * pos)
     97
     98max_type_vector_pos(int8_t);
     99max_type_vector_pos(uint8_t);
     100max_type_vector_pos(int16_t);
     101max_type_vector_pos(uint16_t);
     102max_type_vector_pos(int32_t);
     103max_type_vector_pos(uint32_t);
     104max_type_vector_pos(float);
     105max_type_vector_pos(double);
     106
    87107
    88108// =============
     
    90110// =============
    91111
    92 IMAGE_EXPORT(void) beta_sum_rgb32vector    (rgb32 *S,long nl,long nh, rgb32 *D);
    93 IMAGE_EXPORT(void) beta_average_rgb32vector(rgb32 *S,long nl,long nh, rgb32 *D);
    94 
    95 IMAGE_EXPORT(void) add_i32vector(int32 *S1, long nl,long nh, int32 *S2, int32 *D);
    96 IMAGE_EXPORT(void) sub_i32vector(int32 *S1, long nl,long nh, int32 *S2, int32 *D);
    97 
    98 IMAGE_EXPORT(void) cumulleft_i32vector  (int32 *S, long nl, long nh, int32 *D);
    99 IMAGE_EXPORT(void) cumulleft_rgb32vector(rgb32 *S, long nl, long nh, rgb32 *D);
    100 
    101 IMAGE_EXPORT(void) cumulright_i32vector  (int32 *S, long nl, long nh, int32 *D);
    102 IMAGE_EXPORT(void) cumulright_rgb32vector(rgb32 *S, long nl, long nh, rgb32 *D);
    103 
    104 IMAGE_EXPORT(void) mulc_i32vector     (int32 *S, long nl, long nh, int32 c, int32 *D);
    105 IMAGE_EXPORT(void) mulc_rgb32vector   (rgb32 *S, long nl, long nh, int32 c, rgb32 *D);
    106 IMAGE_EXPORT(void) divc_i32vector     (int32 *S, long nl, long nh, int32 c, int32 *D);
    107 IMAGE_EXPORT(void) divc_rgb32vector   (rgb32 *S, long nl, long nh, int32 c, rgb32 *D);
    108 
    109 IMAGE_EXPORT(void) mulfrac_i32vector  (int32 *S, long nl, long nh, int32 a, int32 b, int32 *D);
    110 IMAGE_EXPORT(void) mulfrac_rgb32vector(rgb32 *S, long nl, long nh, int32 a, int32 b, rgb32 *D);
    111 
    112 #ifdef __cplusplus
    113 }
    114 #endif
     112#define add_type_vector(t) \
     113void short_name(t,add_,vector)(t * S1, int32_t nl, int32_t nh, t * S2, t * D)
     114
     115add_type_vector(int8_t);
     116add_type_vector(uint8_t);
     117add_type_vector(int16_t);
     118add_type_vector(uint16_t);
     119add_type_vector(int32_t);
     120add_type_vector(uint32_t);
     121add_type_vector(float);
     122add_type_vector(double);
     123
     124#define sub_type_vector(t) \
     125void short_name(t,sub_,vector)(t * S1, int32_t nl, int32_t nh, t * S2, t * D)
     126
     127sub_type_vector(int8_t);
     128sub_type_vector(uint8_t);
     129sub_type_vector(int16_t);
     130sub_type_vector(uint16_t);
     131sub_type_vector(int32_t);
     132sub_type_vector(uint32_t);
     133sub_type_vector(float);
     134sub_type_vector(double);
     135
     136#define mulc_type_vector(t) \
     137void short_name(t,mulc_,vector)(t * S, int32_t nl, int32_t nh, int32_t c, t * D)
     138
     139mulc_type_vector(int8_t);
     140mulc_type_vector(uint8_t);
     141mulc_type_vector(int16_t);
     142mulc_type_vector(uint16_t);
     143mulc_type_vector(int32_t);
     144mulc_type_vector(uint32_t);
     145mulc_type_vector(float);
     146mulc_type_vector(double);
     147
     148#define divc_type_vector(t) \
     149void short_name(t,divc_,vector)(t * S, int32_t nl, int32_t nh, int32_t c, t * D)
     150
     151divc_type_vector(int8_t);
     152divc_type_vector(uint8_t);
     153divc_type_vector(int16_t);
     154divc_type_vector(uint16_t);
     155divc_type_vector(int32_t);
     156divc_type_vector(uint32_t);
     157divc_type_vector(float);
     158divc_type_vector(double);
     159
     160
     161#define cumulleft_type_vector(t) \
     162void short_name(t,cumulleft_,vector)(t * S, int32_t nl, int32_t nh, int32_t * D)
     163
     164cumulleft_type_vector(int8_t);
     165cumulleft_type_vector(uint8_t);
     166cumulleft_type_vector(int16_t);
     167cumulleft_type_vector(uint16_t);
     168cumulleft_type_vector(int32_t);
     169cumulleft_type_vector(uint32_t);
     170cumulleft_type_vector(float);
     171cumulleft_type_vector(double);
     172
     173#define cumulright_type_vector(t) \
     174void short_name(t,cumulright_,vector)(t * S, int32_t nl, int32_t nh, int32_t * D)
     175
     176cumulright_type_vector(int8_t);
     177cumulright_type_vector(uint8_t);
     178cumulright_type_vector(int16_t);
     179cumulright_type_vector(uint16_t);
     180cumulright_type_vector(int32_t);
     181cumulright_type_vector(uint32_t);
     182cumulright_type_vector(float);
     183cumulright_type_vector(double);
     184
     185
     186#define mulfrac_type_vector(t) \
     187void short_name(t,mulfrac_,vector)(t * S, int32_t nl, int32_t nh, int32_t a, int32_t b, t * D)
     188
     189mulfrac_type_vector(int8_t);
     190mulfrac_type_vector(uint8_t);
     191mulfrac_type_vector(int16_t);
     192mulfrac_type_vector(uint16_t);
     193mulfrac_type_vector(int32_t);
     194mulfrac_type_vector(uint32_t);
     195mulfrac_type_vector(float);
     196mulfrac_type_vector(double);
     197
     198
     199
     200void beta_sum_rgb32vector    (rgb32 * S, int32_t nl, int32_t nh, rgb32 * D);
     201void beta_average_rgb32vector(rgb32 * S, int32_t nl, int32_t nh, rgb32 * D);
     202void cumulleft_rgb32vector   (rgb32 * S, int32_t nl, int32_t nh, rgb32 * D);
     203void cumulright_rgb32vector  (rgb32 * S, int32_t nl, int32_t nh, rgb32 * D);
     204void mulc_rgb32vector        (rgb32 * S, int32_t nl, int32_t nh, int32 c, rgb32 * D);
     205void divc_rgb32vector        (rgb32 * S, int32_t nl, int32_t nh, int32 c, rgb32 * D);
     206void mulfrac_rgb32vector     (rgb32 * S, int32_t nl, int32_t nh, int32 a, int32 b, rgb32 * D);
     207
    115208
    116209#endif /* _NRARITH1_H_ */
     210
     211// Local Variables:
     212// tab-width: 4
     213// c-basic-offset: 4
     214// c-file-offsets:((innamespace . 0)(inline-open . 0))
     215// indent-tabs-mode: nil
     216// End:
     217
     218// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     219
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith2.h

    r772 r821  
    1111#define _NRARITH2_H_
    1212
    13 #ifdef __cplusplus
    14 #ifdef PRAGMA_VERBOSE
    15 #pragma message ("C++")
    16 #endif
    17 extern "C" {
    18 #endif
    19 
    20 #ifdef PRAGMA_VERBOSE
    21 //#pragma message("- include nrarith.h")
    22 #endif
     13#include "nrc_os_config.h"
    2314
    2415/* ------------------ */
     
    2617/* ------------------ */
    2718
    28 IMAGE_EXPORT(sint8)   min_si8matrix  (sint8    **m, long nrl,long nrh,long ncl, long nch);
    29 IMAGE_EXPORT(uint8)   min_ui8matrix  (uint8    **m, long nrl,long nrh,long ncl, long nch);
    30 IMAGE_EXPORT(sint16)  min_si16matrix (sint16   **m, long nrl,long nrh,long ncl, long nch);
    31 IMAGE_EXPORT(uint16)  min_ui16matrix (uint16   **m, long nrl,long nrh,long ncl, long nch);
    32 IMAGE_EXPORT(sint32)  min_si32matrix (sint32   **m, long nrl,long nrh,long ncl, long nch);
    33 IMAGE_EXPORT(uint32)  min_ui32matrix (uint32   **m, long nrl,long nrh,long ncl, long nch);
    34 IMAGE_EXPORT(sint64)  min_si64matrix (sint64   **m, long nrl,long nrh,long ncl, long nch);
    35 IMAGE_EXPORT(uint64)  min_ui64matrix (uint64   **m, long nrl,long nrh,long ncl, long nch);
    36 IMAGE_EXPORT(float32) min_f32matrix  (float32  **m, long nrl,long nrh,long ncl, long nch);
    37 IMAGE_EXPORT(float64) min_f64matrix  (float64  **m, long nrl,long nrh,long ncl, long nch);
     19#define min_type_matrix(t) \
     20t short_name(t,min_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
     21
     22min_type_matrix(int8_t);
     23min_type_matrix(uint8_t);
     24min_type_matrix(int16_t);
     25min_type_matrix(uint16_t);
     26min_type_matrix(int32_t);
     27min_type_matrix(uint32_t);
     28min_type_matrix(int64_t);
     29min_type_matrix(uint64_t);
     30min_type_matrix(float);
     31min_type_matrix(double);
     32
    3833
    3934/* ------------------ */
     
    4136/* ------------------ */
    4237
    43 IMAGE_EXPORT(sint8)   max_si8matrix  (sint8    **m, long nrl,long nrh,long ncl, long nch);
    44 IMAGE_EXPORT(uint8)   max_ui8matrix  (uint8    **m, long nrl,long nrh,long ncl, long nch);
    45 IMAGE_EXPORT(sint16)  max_si16matrix (sint16   **m, long nrl,long nrh,long ncl, long nch);
    46 IMAGE_EXPORT(uint16)  max_ui16matrix (uint16   **m, long nrl,long nrh,long ncl, long nch);
    47 IMAGE_EXPORT(sint32)  max_si32matrix (sint32   **m, long nrl,long nrh,long ncl, long nch);
    48 IMAGE_EXPORT(uint32)  max_ui32matrix (uint32   **m, long nrl,long nrh,long ncl, long nch);
    49 IMAGE_EXPORT(sint64)  max_si64matrix (sint64   **m, long nrl,long nrh,long ncl, long nch);
    50 IMAGE_EXPORT(uint64)  max_ui64matrix (uint64   **m, long nrl,long nrh,long ncl, long nch);
    51 IMAGE_EXPORT(float32) max_f32matrix  (float32  **m, long nrl,long nrh,long ncl, long nch);
    52 IMAGE_EXPORT(float64) max_f64matrix  (float64  **m, long nrl,long nrh,long ncl, long nch);
     38#define max_type_matrix(t) \
     39t short_name(t,max_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
     40
     41max_type_matrix(int8_t);
     42max_type_matrix(uint8_t);
     43max_type_matrix(int16_t);
     44max_type_matrix(uint16_t);
     45max_type_matrix(int32_t);
     46max_type_matrix(uint32_t);
     47max_type_matrix(int64_t);
     48max_type_matrix(uint64_t);
     49max_type_matrix(float);
     50max_type_matrix(double);
     51
    5352
    5453/* ------------------ */
     
    5655/* ------------------ */
    5756
    58 IMAGE_EXPORT(void) add_si8matrix  (sint8   **X, long nrl,long nrh,long ncl, long nch, sint8   **Y, sint8   **Z);
    59 IMAGE_EXPORT(void) add_ui8matrix  (uint8   **X, long nrl,long nrh,long ncl, long nch, uint8   **Y, uint8   **Z);
    60 IMAGE_EXPORT(void) add_si16matrix (sint16  **X, long nrl,long nrh,long ncl, long nch, sint16  **Y, sint16  **Z);
    61 IMAGE_EXPORT(void) add_ui16matrix (uint16  **X, long nrl,long nrh,long ncl, long nch, uint16  **Y, uint16  **Z);
    62 IMAGE_EXPORT(void) add_si32matrix (sint32  **X, long nrl,long nrh,long ncl, long nch, sint32  **Y, sint32  **Z);
    63 IMAGE_EXPORT(void) add_ui32matrix (uint32  **X, long nrl,long nrh,long ncl, long nch, uint32  **Y, uint32  **Z);
    64 IMAGE_EXPORT(void) add_si64matrix (sint64  **X, long nrl,long nrh,long ncl, long nch, sint64  **Y, sint64  **Z);
    65 IMAGE_EXPORT(void) add_ui64matrix (uint64  **X, long nrl,long nrh,long ncl, long nch, uint64  **Y, uint64  **Z);
    66 
    67 IMAGE_EXPORT(void) add_f32matrix  (float32 **X, long nrl,long nrh,long ncl, long nch, float32 **Y, float32 **Z);
    68 IMAGE_EXPORT(void) add_f64matrix  (float64 **X, long nrl,long nrh,long ncl, long nch, float64 **Y, float64 **Z);
    69 
    70 IMAGE_EXPORT(void) add_rgb8matrix (rgb8    **X, long nrl,long nrh,long ncl, long nch, rgb8    **Y, rgb8    **Z);
    71 IMAGE_EXPORT(void) add_rgbx8matrix(rgbx8   **X, long nrl,long nrh,long ncl, long nch, rgbx8   **Y, rgbx8   **Z);
     57#define add_type_matrix(t) \
     58void short_name(t,add_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z)
     59
     60add_type_matrix(int8_t);
     61add_type_matrix(uint8_t);
     62add_type_matrix(int16_t);
     63add_type_matrix(uint16_t);
     64add_type_matrix(int32_t);
     65add_type_matrix(uint32_t);
     66add_type_matrix(int64_t);
     67add_type_matrix(uint64_t);
     68add_type_matrix(float);
     69add_type_matrix(double);
     70
     71void add_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  ** Y, rgb8  ** Z);
     72void add_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 ** Y, rgbx8 ** Z);
     73
    7274
    7375/* -------------------- */
     
    7577/* -------------------- */
    7678
    77 IMAGE_EXPORT(void) addc_si8matrix  (sint8   **X, long nrl,long nrh,long ncl, long nch, sint8   y, sint8   **Z);
    78 IMAGE_EXPORT(void) addc_ui8matrix  (uint8   **X, long nrl,long nrh,long ncl, long nch, uint8   y, uint8   **Z);
    79 IMAGE_EXPORT(void) addc_si16matrix (sint16  **X, long nrl,long nrh,long ncl, long nch, sint16  y, sint16  **Z);
    80 IMAGE_EXPORT(void) addc_ui16matrix (uint16  **X, long nrl,long nrh,long ncl, long nch, uint16  y, uint16  **Z);
    81 IMAGE_EXPORT(void) addc_si32matrix (sint32  **X, long nrl,long nrh,long ncl, long nch, sint32  y, sint32  **Z);
    82 IMAGE_EXPORT(void) addc_ui32matrix (uint32  **X, long nrl,long nrh,long ncl, long nch, uint32  y, uint32  **Z);
    83 IMAGE_EXPORT(void) addc_si64matrix (sint64  **X, long nrl,long nrh,long ncl, long nch, sint64  y, sint64  **Z);
    84 IMAGE_EXPORT(void) addc_ui64matrix (uint64  **X, long nrl,long nrh,long ncl, long nch, uint64  y, uint64  **Z);
    85 
    86 IMAGE_EXPORT(void) addc_f32matrix  (float32 **X, long nrl,long nrh,long ncl, long nch, float32 y, float32 **Z);
    87 IMAGE_EXPORT(void) addc_f64matrix  (float64 **X, long nrl,long nrh,long ncl, long nch, float64 y, float64 **Z);
    88 
    89 IMAGE_EXPORT(void) addc_rgb8matrix (rgb8    **X, long nrl,long nrh,long ncl, long nch, rgb8    y, rgb8    **Z);
    90 IMAGE_EXPORT(void) addc_rgbx8matrix(rgbx8   **X, long nrl,long nrh,long ncl, long nch, rgbx8   y, rgbx8   **Z);
     79#define addc_type_matrix(t) \
     80void short_name(t,addc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z)
     81
     82addc_type_matrix(int8_t);
     83addc_type_matrix(uint8_t);
     84addc_type_matrix(int16_t);
     85addc_type_matrix(uint16_t);
     86addc_type_matrix(int32_t);
     87addc_type_matrix(uint32_t);
     88addc_type_matrix(int64_t);
     89addc_type_matrix(uint64_t);
     90addc_type_matrix(float);
     91addc_type_matrix(double);
     92
     93void addc_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  y, rgb8  ** Z);
     94void addc_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 ** Z);
     95
    9196
    9297/* ----------- */
     
    9499/* ----------- */
    95100
    96 IMAGE_EXPORT(void) sub_si8matrix  (sint8   **X, long nrl,long nrh,long ncl, long nch, sint8   **Y, sint8   **Z);
    97 IMAGE_EXPORT(void) sub_ui8matrix  (uint8   **X, long nrl,long nrh,long ncl, long nch, uint8   **Y, uint8   **Z);
    98 IMAGE_EXPORT(void) sub_si16matrix (sint16  **X, long nrl,long nrh,long ncl, long nch, sint16  **Y, sint16  **Z);
    99 IMAGE_EXPORT(void) sub_ui16matrix (uint16  **X, long nrl,long nrh,long ncl, long nch, uint16  **Y, uint16  **Z);
    100 IMAGE_EXPORT(void) sub_si32matrix (sint32  **X, long nrl,long nrh,long ncl, long nch, sint32  **Y, sint32  **Z);
    101 IMAGE_EXPORT(void) sub_ui32matrix (uint32  **X, long nrl,long nrh,long ncl, long nch, uint32  **Y, uint32  **Z);
    102 IMAGE_EXPORT(void) sub_si64matrix (sint64  **X, long nrl,long nrh,long ncl, long nch, sint64  **Y, sint64  **Z);
    103 IMAGE_EXPORT(void) sub_ui64matrix (uint64  **X, long nrl,long nrh,long ncl, long nch, uint64  **Y, uint64  **Z);
    104 
    105 IMAGE_EXPORT(void) sub_f32matrix  (float32 **X, long nrl,long nrh,long ncl, long nch, float32 **Y, float32 **Z);
    106 IMAGE_EXPORT(void) sub_f64matrix  (float64 **X, long nrl,long nrh,long ncl, long nch, float64 **Y, float64 **Z);
    107 
    108 IMAGE_EXPORT(void) sub_rgb8matrix (rgb8    **X, long nrl,long nrh,long ncl, long nch, rgb8    **Y, rgb8    **Z);
    109 IMAGE_EXPORT(void) sub_rgbx8matrix(rgbx8   **X, long nrl,long nrh,long ncl, long nch, rgbx8   **Y, rgbx8   **Z);
     101#define sub_type_matrix(t) \
     102void short_name(t,sub_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z)
     103
     104sub_type_matrix(int8_t);
     105sub_type_matrix(uint8_t);
     106sub_type_matrix(int16_t);
     107sub_type_matrix(uint16_t);
     108sub_type_matrix(int32_t);
     109sub_type_matrix(uint32_t);
     110sub_type_matrix(int64_t);
     111sub_type_matrix(uint64_t);
     112sub_type_matrix(float);
     113sub_type_matrix(double);
     114
     115void sub_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  ** Y, rgb8  ** Z);
     116void sub_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 ** Y, rgbx8 ** Z);
     117
    110118
    111119/* --------------------- */
     
    113121/* --------------------- */
    114122
    115 IMAGE_EXPORT(void) subc_si8matrix  (sint8   **X, long nrl,long nrh,long ncl, long nch, sint8   y, sint8   **Z);
    116 IMAGE_EXPORT(void) subc_ui8matrix  (uint8   **X, long nrl,long nrh,long ncl, long nch, uint8   y, uint8   **Z);
    117 IMAGE_EXPORT(void) subc_si16matrix (sint16  **X, long nrl,long nrh,long ncl, long nch, sint16  y, sint16  **Z);
    118 IMAGE_EXPORT(void) subc_ui16matrix (uint16  **X, long nrl,long nrh,long ncl, long nch, uint16  y, uint16  **Z);
    119 IMAGE_EXPORT(void) subc_si32matrix (sint32  **X, long nrl,long nrh,long ncl, long nch, sint32  y, sint32  **Z);
    120 IMAGE_EXPORT(void) subc_ui32matrix (uint32  **X, long nrl,long nrh,long ncl, long nch, uint32  y, uint32  **Z);
    121 IMAGE_EXPORT(void) subc_si64matrix (sint64  **X, long nrl,long nrh,long ncl, long nch, sint64  y, sint64  **Z);
    122 IMAGE_EXPORT(void) subc_ui64matrix (uint64  **X, long nrl,long nrh,long ncl, long nch, uint64  y, uint64  **Z);
    123 
    124 IMAGE_EXPORT(void) subc_f32matrix  (float32 **X, long nrl,long nrh,long ncl, long nch, float32 y, float32 **Z);
    125 IMAGE_EXPORT(void) subc_f64matrix  (float64 **X, long nrl,long nrh,long ncl, long nch, float64 y, float64 **Z);
    126 
    127 IMAGE_EXPORT(void) subc_rgb8matrix (rgb8    **X, long nrl,long nrh,long ncl, long nch, rgb8    y, rgb8    **Z);
    128 IMAGE_EXPORT(void) subc_rgbx8matrix(rgbx8   **X, long nrl,long nrh,long ncl, long nch, rgbx8   y, rgbx8   **Z);
    129 
    130 /* --------------------- */
    131 /* --- Sub constante --- */
     123#define subc_type_matrix(t) \
     124void short_name(t,subc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z)
     125
     126subc_type_matrix(int8_t);
     127subc_type_matrix(uint8_t);
     128subc_type_matrix(int16_t);
     129subc_type_matrix(uint16_t);
     130subc_type_matrix(int32_t);
     131subc_type_matrix(uint32_t);
     132subc_type_matrix(int64_t);
     133subc_type_matrix(uint64_t);
     134subc_type_matrix(float);
     135subc_type_matrix(double);
     136
     137void subc_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  y, rgb8  ** Z);
     138void subc_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 ** Z);
     139
     140/* --------------------- */
     141/* --- Mul constante --- */
    132142/* --------------------- */
    133143
    134144// Z = X * y
    135 IMAGE_EXPORT(void) mulc_si8matrix  (sint8   **X, long nrl,long nrh,long ncl, long nch, sint8   y, sint8   **Z);
    136 IMAGE_EXPORT(void) mulc_ui8matrix  (uint8   **X, long nrl,long nrh,long ncl, long nch, uint8   y, uint8   **Z);
    137 IMAGE_EXPORT(void) mulc_si16matrix (sint16  **X, long nrl,long nrh,long ncl, long nch, sint16  y, sint16  **Z);
    138 IMAGE_EXPORT(void) mulc_ui16matrix (uint16  **X, long nrl,long nrh,long ncl, long nch, uint16  y, uint16  **Z);
    139 IMAGE_EXPORT(void) mulc_si32matrix (sint32  **X, long nrl,long nrh,long ncl, long nch, sint32  y, sint32  **Z);
    140 IMAGE_EXPORT(void) mulc_ui32matrix (uint32  **X, long nrl,long nrh,long ncl, long nch, uint32  y, uint32  **Z);
    141 IMAGE_EXPORT(void) mulc_si64matrix (sint64  **X, long nrl,long nrh,long ncl, long nch, sint64  y, sint64  **Z);
    142 IMAGE_EXPORT(void) mulc_ui64matrix (uint64  **X, long nrl,long nrh,long ncl, long nch, uint64  y, uint64  **Z);
    143 
    144 IMAGE_EXPORT(void) mulc_f32matrix  (float32 **X, long nrl,long nrh,long ncl, long nch, float32 y, float32 **Z);
    145 IMAGE_EXPORT(void) mulc_f64matrix  (float64 **X, long nrl,long nrh,long ncl, long nch, float64 y, float64 **Z);
    146 
    147 IMAGE_EXPORT(void) mulc_rgb8matrix (rgb8    **X, long nrl,long nrh,long ncl, long nch, rgb8    y, rgb8    **Z);
    148 IMAGE_EXPORT(void) mulc_rgbx8matrix(rgbx8   **X, long nrl,long nrh,long ncl, long nch, rgbx8   y, rgbx8   **Z);
     145
     146#define mulc_type_matrix(t) \
     147void short_name(t,mulc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z)
     148
     149mulc_type_matrix(int8_t);
     150mulc_type_matrix(uint8_t);
     151mulc_type_matrix(int16_t);
     152mulc_type_matrix(uint16_t);
     153mulc_type_matrix(int32_t);
     154mulc_type_matrix(uint32_t);
     155mulc_type_matrix(int64_t);
     156mulc_type_matrix(uint64_t);
     157mulc_type_matrix(float);
     158mulc_type_matrix(double);
     159
     160void mulc_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  y, rgb8  ** Z);
     161void mulc_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 ** Z);
     162
    149163
    150164/* --------------- */
    151165/* --- MulFrac --- */
    152166/* --------------- */
    153 // m2 = (a*m1)/b
    154 IMAGE_EXPORT(void) mulfrac_bmatrix    (byte   **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  b, byte    **m2);
    155 IMAGE_EXPORT(void) mulfrac_si16matrix (sint16 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  b, sint16  **m2);
    156 IMAGE_EXPORT(void) mulfrac_ui16matrix (uint16 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  b, uint16  **m2);
    157 IMAGE_EXPORT(void) mulfrac_si32matrix (sint32 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  b, sint32  **m2);
    158 IMAGE_EXPORT(void) mulfrac_ui32matrix (uint32 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  b, uint32  **m2);
    159 IMAGE_EXPORT(void) mulfrac_rgb8matrix (rgb8   **m1, long nrl,long nrh,long ncl, long nch, rgb32  a, rgb32  b, rgb8    **m2);
    160 IMAGE_EXPORT(void) mulfrac_rgbx8matrix(rgbx8  **m1, long nrl,long nrh,long ncl, long nch, rgbx32 a, rgbx32 b, rgbx8   **m2);
    161 
    162 IMAGE_EXPORT(void) mulfrack_rgb8matrix (rgb8   **m1, long nrl,long nrh,long ncl, long nch, int32 a, int32 b, rgb8    **m2);
    163 IMAGE_EXPORT(void) mulfrack_rgbx8matrix(rgbx8  **m1, long nrl,long nrh,long ncl, long nch, int32 a, int32 b, rgbx8   **m2);
     167
     168// m2 = (a * m1) / b
     169
     170#define mulfrac_type_matrix(t) \
     171void short_name(t,mulfrac_,matrix)(t ** X, int32_t nrl, int32_t nrh, \
     172        int32_t ncl, int32_t nch, int32_t a, int32_t b, t ** Y)
     173
     174mulfrac_type_matrix(int8_t);
     175mulfrac_type_matrix(uint8_t);
     176mulfrac_type_matrix(int16_t);
     177mulfrac_type_matrix(uint16_t);
     178mulfrac_type_matrix(int32_t);
     179mulfrac_type_matrix(uint32_t);
     180mulfrac_type_matrix(int64_t);
     181mulfrac_type_matrix(uint64_t);
     182mulfrac_type_matrix(float);
     183mulfrac_type_matrix(double);
     184
     185void mulfrack_rgb8matrix (rgb8  ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 b, rgb8  ** m2);
     186void mulfrack_rgbx8matrix(rgbx8 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 b, rgbx8 ** m2);
     187
    164188
    165189/* ---------------- */
    166190/* --- MulShift --- */
    167191/* ---------------- */
    168 // m3 = (a*m1)>>s
    169 IMAGE_EXPORT(void) mulshift_bmatrix    (byte   **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  s, byte    **m2);
    170 IMAGE_EXPORT(void) mulshift_i16matrix  (int16  **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  s, int16   **m2);
    171 IMAGE_EXPORT(void) mulshift_ui16matrix (uint16 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  s, uint16  **m2);
    172 IMAGE_EXPORT(void) mulshift_i32matrix  (int32  **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  s, int32   **m2);
    173 IMAGE_EXPORT(void) mulshift_ui32matrix (uint32 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  s, uint32  **m2);
    174 IMAGE_EXPORT(void) mulshift_rgb8matrix (rgb8   **m1, long nrl,long nrh,long ncl, long nch, rgb32  a, rgb32  s, rgb8    **m2);
    175 IMAGE_EXPORT(void) mulshift_rgbx8matrix(rgbx8  **m1, long nrl,long nrh,long ncl, long nch, rgbx32 a, rgbx32 s, rgbx8   **m2);
    176 
    177 IMAGE_EXPORT(void) mulshiftk_rgb8matrix (rgb8   **m1, long nrl,long nrh,long ncl, long nch, int32 a, int32 s, rgb8    **m2);
    178 IMAGE_EXPORT(void) mulshiftk_rgbx8matrix(rgbx8  **m1, long nrl,long nrh,long ncl, long nch, int32 a, int32 s, rgbx8   **m2);
    179 
    180 IMAGE_EXPORT(void) quadratic_error_si16matrix(sint16 **m1,long nrl,long nrh,long ncl, long nch, sint16 **m2, sint16 **m3);
    181 
    182 
    183 #ifdef __cplusplus
    184 }
    185 #endif
     192// m3 = (a * m1) >> s
     193
     194#define mulshift_type_matrix(t) \
     195void short_name(t,mulshift_,matrix)(t ** X, int32_t nrl, int32_t nrh, \
     196        int32_t ncl, int32_t nch, int32_t a, int32_t s, t ** Y)
     197
     198mulshift_type_matrix(int8_t);
     199mulshift_type_matrix(uint8_t);
     200mulshift_type_matrix(int16_t);
     201mulshift_type_matrix(uint16_t);
     202mulshift_type_matrix(int32_t);
     203mulshift_type_matrix(uint32_t);
     204mulshift_type_matrix(int64_t);
     205mulshift_type_matrix(uint64_t);
     206mulshift_type_matrix(float);
     207mulshift_type_matrix(double);
     208
     209void mulshift_rgb8matrix (rgb8  **m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb32  a, rgb32  s, rgb8  ** m2);
     210void mulshift_rgbx8matrix(rgbx8 **m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx32 a, rgbx32 s, rgbx8 ** m2);
     211
     212void mulshiftk_rgb8matrix (rgb8  ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 s, rgb8  ** m2);
     213void mulshiftk_rgbx8matrix(rgbx8 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 s, rgbx8 ** m2);
     214
     215void quadratic_error_si16matrix(sint16 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, sint16 ** m2, sint16 ** m3);
     216
    186217
    187218#endif /* _NRARITH2_H_ */
     219
     220// Local Variables:
     221// tab-width: 4
     222// c-basic-offset: 4
     223// c-file-offsets:((innamespace . 0)(inline-open . 0))
     224// indent-tabs-mode: nil
     225// End:
     226
     227// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     228
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith2x.h

    r772 r821  
    1111#define _NRARITH2X_H_
    1212
    13 #ifdef __cplusplus
    14 #ifdef PRAGMA_VERBOSE
    15 #pragma message ("C++")
    16 #endif
    17 extern "C" {
    18 #endif
     13// Add conditionnel
    1914
    20 #ifdef PRAGMA_VERBOSE
    21 #pragma message("- include nrarith2x.h")
    22 #endif
     15#define addcnz_type_matrix(t) \
     16void short_name(t,addcnz_,matrix)(t ** src, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t cte, t ** dst)
     17
     18addcnz_type_matrix(int8_t);
     19addcnz_type_matrix(uint8_t);
     20addcnz_type_matrix(int16_t);
     21addcnz_type_matrix(uint16_t);
     22addcnz_type_matrix(int32_t);
     23addcnz_type_matrix(uint32_t);
     24addcnz_type_matrix(int64_t);
     25addcnz_type_matrix(uint64_t);
     26addcnz_type_matrix(float);
     27addcnz_type_matrix(double);
    2328
    2429
    25     // Add conditionnel
    26 IMAGE_EXPORT(void) addc_bmatrix (byte   **src,long nrl,long nrh,long ncl, long nch, byte  cte, byte   **dst);
    27 IMAGE_EXPORT(void) addc_smatrix (sint16  **src,long nrl,long nrh,long ncl, long nch, short cte, sint16  **dst);
    28 IMAGE_EXPORT(void) addc_usmatrix(uint16 **src,long nrl,long nrh,long ncl, long nch, short cte, uint16 **dst);
     30#define addandc_type_matrix(t) \
     31void short_name(t,addandc_,matrix)(t ** src, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t cte, t ** dst)
    2932
    30 IMAGE_EXPORT(void) addandc_bmatrix    (byte   **src,long nrl,long nrh,long ncl, long nch, byte  cte, byte   **dst);
    31 IMAGE_EXPORT(void) addandc_si16matrix (sint16 **src,long nrl,long nrh,long ncl, long nch, short cte, sint16  **dst);
    32 IMAGE_EXPORT(void) addandc_ui16matrix (uint16 **src,long nrl,long nrh,long ncl, long nch, short cte, uint16 **dst);
     33addandc_type_matrix(int8_t);
     34addandc_type_matrix(uint8_t);
     35addandc_type_matrix(int16_t);
     36addandc_type_matrix(uint16_t);
     37addandc_type_matrix(int32_t);
     38addandc_type_matrix(uint32_t);
     39addandc_type_matrix(int64_t);
     40addandc_type_matrix(uint64_t);
     41addandc_type_matrix(float);
     42addandc_type_matrix(double);
    3343
    34 IMAGE_EXPORT(void) addcnz_bmatrix(byte  **src,long nrl,long nrh,long ncl, long nch, byte  cte, byte  **dst);
    3544
    36 IMAGE_EXPORT(int) count_bmatrix(byte **m, long nrl,long nrh,long ncl, long nch);
    37 /*
    38  * renvoie la somme des points de la matrice
    39  */
     45/* renvoie la somme des points de la matrice */
    4046
    41 #ifdef __cplusplus
    42 }
    43 #endif
     47#define sum_type_matrix(t,rt) \
     48rt short_name(t,sum_,matrix)(t ** m, int32_t nrl, int32_t nrh,int32_t ncl, int32_t nch)
     49
     50sum_type_matrix(int8_t, int32_t);
     51sum_type_matrix(uint8_t, uint32_t);
     52sum_type_matrix(int16_t, int32_t);
     53sum_type_matrix(uint16_t, uint32_t);
     54sum_type_matrix(int32_t, int64_t);
     55sum_type_matrix(uint32_t, uint64_t);
     56sum_type_matrix(int64_t, int64_t);
     57sum_type_matrix(uint64_t, uint64_t);
     58sum_type_matrix(float, float);
     59sum_type_matrix(double, double);
     60
     61
    4462
    4563#endif /* _NRUTIL_H_ */
     64
     65// Local Variables:
     66// tab-width: 4
     67// c-basic-offset: 4
     68// c-file-offsets:((innamespace . 0)(inline-open . 0))
     69// indent-tabs-mode: nil
     70// End:
     71
     72// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     73
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nrc_os_config.h

    r798 r821  
    77    #define printf(...)  giet_tty_printf(__VA_ARGS__)
    88
    9     #define open(x, y)      giet_fat_open(x, y)
    10     #define close(x)        giet_fat_close(x)
    11     #define read(x, y, z)   giet_fat_read(x, y, z)
    12     #define write(x, y, z)  giet_fat_write(x, y, z)
    13     #define fprintf(x, ...) giet_fat_fprintf(x, __VA_ARGS__)
    14     #define fscanf(x, ...)  ;
    15     #define exit(x)         giet_pthread_exit(NULL)
    16 #else
     9    #define open(x, y)         giet_fat_open(x, y)
     10    #define close(x)           giet_fat_close(x)
     11    #define read(x, y, z)      giet_fat_read(x, y, z)
     12    #define write(x, y, z)     giet_fat_write(x, y, z)
     13    #define fprintf(x, ...)    giet_fat_fprintf(x, __VA_ARGS__)
     14    //#define fscanf(x, ...)  ;
     15    #define exit(x)            giet_pthread_exit(NULL)
     16
     17    #define pthread_barrier_t           giet_barrier_t
     18    #define pthread_spinlock_t          user_lock_t
     19    #define pthread_spin_lock(x)        lock_acquire(x)
     20    #define pthread_spin_unlock(x)      lock_release(x)
     21    #define pthread_spin_init(x, y)     lock_init(x)
     22    #define pthread_mutexlock_t         user_lock_t
     23    #define pthread_mutex_lock(x)       lock_acquire(x)
     24    #define pthread_mutex_unlock(x)     lock_release(x)
     25    #define pthread_mutex_init(x, y)    lock_init(x)
     26    #define pthread_barrier_init(x,y,z) barrier_init(x, z)
     27    #define pthread_barrier_wait(x)     barrier_wait(x)
     28    #define pthread_barrier_destroy(x)
     29    #define pthread_create(x,y,z,t)     giet_pthread_create(x,y,z,t)
     30    #define pthread_join(x,y)           giet_pthread_join(x,y)
    1731#endif
    1832
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nrkernel.h

    r772 r821  
    1111#define __NRKERNEL_H__
    1212
    13 #ifdef __cplusplus
    14 #pragma message ("C++")
    15 extern "C" {
    16 #endif
    17    
    18 #ifdef VERBOSE_PRAGMA
    19 //#pragma message ("- *** include nrkernel.h ***")
     13
     14#if TARGET_OS == GIETVM
     15    #define nrerror(...) ({                        \
     16            printf("*** NRC Runtime Error:\n   "); \
     17            printf(__VA_ARGS__);                   \
     18            exit(1);                               \
     19    })
     20#else
     21    #define nrerror(...) ({                                 \
     22            fprintf(stderr, "*** NRC Runtime Error:\n   "); \
     23            fprintf(stderr, __VA_ARGS__);                   \
     24            exit(1);                                        \
     25    })
    2026#endif
    2127
    22 void nrerror(char error_text[]);
    23 void nrerror0(char error_text[]);   
    24 void nrerror1(char *format, ...);
    25    
    26 void Error  (char *format, ...);
    27 void Warning(char *format, ...);
    2828
    2929
    30 #ifdef __cplusplus
    31 }
    32 #endif
    3330
    3431#endif // __NRKERNEL_H__
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nrtype.h

    r772 r821  
    1616#define _NRTYPE_H_
    1717
    18 #ifdef __cplusplus
    19 #pragma message ("C++")
    20 extern "C" {
    21 #endif
    22    
    23 #define VERBOSE_PRAGMA
    24 
    25 #ifdef VERBOSE_PRAGMA
    26 //#pragma message ("- include nrtype.h")
    27 #endif
     18#include <stdint.h>
    2819
    2920// ---------------------------------- //
     
    3122// ---------------------------------- //
    3223
     24
    3325#include "mypredef.h"
    3426   
    35 typedef unsigned char BOOLEAN;
    36 typedef unsigned char boolean;
    37 typedef          int  BOOL;
    38 #ifdef VERBOSE_PRAGMA
    39 //#pragma message("boolean")
    40 #endif
    4127
    42 #ifndef TRUE
    43 #define TRUE 1
    44 #else
    45 #pragma message("  ATTENTION : TRUE  already defined")
    46 #endif
     28// Short names
    4729
    48 #ifndef FALSE
    49 #define FALSE 0
    50 #else
    51 #pragma message("  ATTENTION : FALSE  already defined")
    52 #endif
     30#define sn_int8_t(p,s)      p##i8##s
     31#define sn_int16_t(p,s)     p##i16##s
     32#define sn_int32_t(p,s)     p##i32##s
     33#define sn_int64_t(p,s)     p##i64##s
     34#define sn_uint8_t(p,s)     p##ui8##s
     35#define sn_uint16_t(p,s)    p##ui16##s
     36#define sn_uint32_t(p,s)    p##ui32##s
     37#define sn_uint64_t(p,s)    p##ui64##s
     38#define sn_float(p,s)       p##f32##s
     39#define sn_double(p,s)      p##f64##s
     40#define sn_void_p(p,s)      p##v##s
     41#define sn_rgb8(p,s)        p##rgb8##s
     42#define sn_rgbx8(p,s)       p##rgbx8##s
     43#define sn_rgb32(p,s)       p##rgb32##s
     44#define sn_rgbx32(p,s)      p##rgbx32##s
     45#define sn_complex32(p,s)   p##c32##s
     46#define sn_complex64(p,s)   p##c64##s
     47#define sn_si16Point(p,s)   p##si16P##s
     48#define sn_ui16Point(p,s)   p##ui16P##s
     49#define sn_si32Point(p,s)   p##si32P##s
     50#define sn_ui32Point(p,s)   p##ui32P##s
     51#define sn_f32Point(p,s)    p##f32P##s
     52#define sn_si16Triplet(p,s) p##si16T##s
     53#define sn_ui16Triplet(p,s) p##ui16T##s
     54#define sn_si32Triplet(p,s) p##si32T##s
     55#define sn_ui32Triplet(p,s) p##ui32T##s
     56#define sn_f32Triplet(p,s)  p##f32T##s
     57
     58#define short_name(t,p,s) sn_##t(p,s)
     59
     60#define NR_END 0
     61#define FREE_ARG char*
     62
     63
     64
    5365
    5466/* ------------------------------- */
    5567/* --- 8, 16, 32, 64 bit types --- */
    5668/* ------------------------------- */
    57 // old types to be removed
    58 //typedef sint16  usint16 ;
    59 //typedef int uint;
    6069
    61 // half-typed types
     70typedef void * void_p;
     71typedef char    byte;
    6272
    63 typedef char  byte;
    64 //typedef char  usint16 ;
    65 //typedef char  uint;
    66 
    67 typedef char  int8;
    68 typedef short int16;
    69 typedef int   int32;
    70 typedef long long  int64;
     73typedef int8_t  int8;
     74typedef int16_t int16;
     75typedef int32_t int32;
     76typedef int64_t int64;
    7177   
    72 #ifdef LIBCOMP
    73 #if defined(myCompiler_ICC) || defined (myCompiler_MSC)
    74 typedef __int64  int64;
    75 #else
    76 typedef long long  int64;
    77 #endif
    78 #endif
    7978
    8079// full-typed types
    81 typedef   signed char sint8;
    82 typedef unsigned char uint8;
     80typedef int8_t  sint8;
     81typedef uint8_t uint8;
    8382
    84 typedef   signed short  sint16;
    85 typedef unsigned short uint16;
     83typedef int16_t  sint16;
     84typedef uint16_t uint16;
    8685
    87 typedef   signed int sint32;
    88 typedef unsigned int uint32;
     86typedef int32_t sint32;
     87typedef uint32_t uint32;
    8988
    90 #if defined(myCompiler_ICC) || defined (myCompiler_MSC)
    91 typedef          __int64  int64;
    92 typedef   signed __int64 sint64;
    93 typedef unsigned __int64 uint64;
    94 #else
    95 typedef   signed long long sint64;
    96 typedef unsigned long long uint64;
    97 #endif
     89typedef int64_t  sint64;
     90typedef uint64_t uint64;
    9891
    99 typedef float   float32;
    100 typedef double  float64;
     92typedef float    float32;
     93typedef double   float64;
     94
    10195
    10296/* -------------------- */
    10397/* --- complex type --- */
    10498/* -------------------- */
     99
    105100typedef struct { float32 x; float32 y;} complex32;
    106101typedef struct { float64 x; float64 y;} complex64;
     
    199194} bitfield8;
    200195
    201 #ifdef __cplusplus
    202 }
    203 #endif
    204196
    205197#endif // _NR_TYPE_H_
     198
Note: See TracChangeset for help on using the changeset viewer.