32 #ifndef __UNIT_TEST_COMMON__ 33 #define __UNIT_TEST_COMMON__ 51 #include "NE10_random.h" 54 #if defined REGRESSION_TEST 55 # define TEST_ITERATION 2048 58 # define TEST_ITERATION 11 63 #if defined PERFORMANCE_TEST 64 # define PERF_TEST_ITERATION 1024 76 #define ARRAY_GUARD_LEN 4 77 #define MAX_FUNC_COUNT 8 //C and NEON version with 4 different data type 80 #define SIGNBIT_MASK 0x7FFFFFFF 83 #define ERROR_MARGIN_SMALL 1 84 #define ERROR_MARGIN_LARGE 1 85 #define SNR_THRESHOLD 50.0f 86 #define PSNR_THRESHOLD 30.0f 89 #define ACCEPTABLE_WARNS 12 90 #define ACCEPTABLE_WARNS_MATRICES 48 92 #define NE10_SRC_ALLOC(src, guarded_src, length) { \ 93 (guarded_src) = (ne10_float32_t*) calloc (2*ARRAY_GUARD_LEN + (length), sizeof(ne10_float32_t)); \ 94 if ((guarded_src) == NULL) \ 95 printf ("error: calloc src failed\n"); \ 96 (src) = (guarded_src) + ARRAY_GUARD_LEN; \ 97 FILL_FLOAT_ARRAY((src), (length)); \ 100 #define NE10_SRC_ALLOC_LIMIT(src, guarded_src, length) { \ 101 (guarded_src) = (ne10_float32_t*) calloc (2*ARRAY_GUARD_LEN + (length), sizeof(ne10_float32_t)); \ 102 if ((guarded_src) == NULL) \ 103 printf ("error: calloc src failed\n"); \ 104 (src) = (guarded_src) + ARRAY_GUARD_LEN; \ 105 FILL_FLOAT_ARRAY_LIMIT((src), (length)); \ 108 #define NE10_DST_ALLOC(dst, guarded_dst, length) { \ 109 (guarded_dst) = (ne10_float32_t*) calloc (2*ARRAY_GUARD_LEN + (length), sizeof(ne10_float32_t)); \ 110 if ((guarded_dst) == NULL) \ 111 printf ("error: calloc dst failed\n"); \ 112 (dst) = (guarded_dst) + ARRAY_GUARD_LEN; \ 115 #define GET_TIME(time, code) { \ 116 (time) = GetTickCount(); \ 118 (time) = GetTickCount() - (time);\ 121 typedef ne10_result_t (*ne10_func_5args_t) (
void * dst,
void * acc,
void * src1,
void * src2, ne10_uint32_t count);
122 typedef ne10_result_t (*ne10_func_4args_t) (
void * dst,
void * src1,
void * src2, ne10_uint32_t count);
123 typedef ne10_result_t (*ne10_func_3args_t) (
void * dst,
void * src, ne10_uint32_t count);
124 typedef ne10_result_t (*ne10_func_2args_t) (
void * dst, ne10_uint32_t count);
125 typedef ne10_result_t (*ne10_func_5args_cst_t) (
void * dst,
void * acc,
void * src, ne10_float32_t cst, ne10_uint32_t count);
126 typedef ne10_result_t (*ne10_func_4args_cst_t) (
void * dst,
void * src,
const ne10_float32_t cst, ne10_uint32_t count);
127 typedef ne10_result_t (*ne10_func_3args_cst_t) (
void * dst,
const ne10_float32_t cst, ne10_uint32_t count);
129 extern void FILL_FLOAT_ARRAY( ne10_float32_t *arr, ne10_uint32_t count );
130 extern void FILL_FLOAT_ARRAY_LIMIT( ne10_float32_t *arr, ne10_uint32_t count );
131 extern void FILL_FLOAT_ARRAY_LIMIT_GT1( ne10_float32_t *arr, ne10_uint32_t count );
134 extern int EQUALS_FLOAT( ne10_float32_t fa, ne10_float32_t fb , ne10_uint32_t err );
135 extern int GUARD_ARRAY( ne10_float32_t* array, ne10_uint32_t array_length );
136 extern int CHECK_ARRAY_GUARD( ne10_float32_t* array, ne10_uint32_t array_length );
137 extern ne10_int32_t GUARD_ARRAY_UINT8 (ne10_uint8_t* array, ne10_uint32_t array_length);
138 extern ne10_int32_t CHECK_ARRAY_GUARD_UINT8 (ne10_uint8_t* array, ne10_uint32_t array_length);
139 extern ne10_float32_t CAL_SNR_FLOAT32(ne10_float32_t *pRef, ne10_float32_t *pTest, ne10_uint32_t buffSize);
140 extern ne10_float32_t CAL_PSNR_UINT8 (ne10_uint8_t *pRef, ne10_uint8_t *pTest, ne10_uint32_t buffSize);
142 extern char ne10_log_buffer[];
143 extern char *ne10_log_buffer_ptr;
144 extern void ne10_log(
const char *func_name,
145 const char *format_str,
148 ne10_int32_t time_neon,
149 ne10_float32_t time_savings,
150 ne10_float32_t time_speedup);
151 extern void ne10_performance_print(ne10_print_target_t target,
155 extern void diff(
const ne10_uint8_t *mat1,
156 const ne10_uint8_t *mat2,
158 ne10_uint32_t dst_stride,
160 ne10_uint32_t height,
161 ne10_uint32_t src_stride,
162 ne10_uint32_t channel);
163 extern int diff_count(
const ne10_int32_t *mat,
167 ne10_int32_t channel);
169 #endif // __UNIT_TEST_COMMON