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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.