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