Add LICENSE
[riscv-tests.git] / benchmarks / median / median_main.c
1 // See LICENSE for license details.
2
3 //**************************************************************************
4 // Median filter bencmark
5 //--------------------------------------------------------------------------
6 //
7 // This benchmark performs a 1D three element median filter. The
8 // input data (and reference data) should be generated using the
9 // median_gendata.pl perl script and dumped to a file named
10 // dataset1.h You should not change anything except the
11 // HOST_DEBUG and PREALLOCATE macros for your timing run.
12
13 #include "util.h"
14
15 #include "median.h"
16
17 //--------------------------------------------------------------------------
18 // Input/Reference Data
19
20 #include "dataset1.h"
21
22 //--------------------------------------------------------------------------
23 // Main
24
25 int main( int argc, char* argv[] )
26 {
27 int results_data[DATA_SIZE];
28
29 // Output the input array
30 printArray( "input", DATA_SIZE, input_data );
31 printArray( "verify", DATA_SIZE, verify_data );
32
33 #if PREALLOCATE
34 // If needed we preallocate everything in the caches
35 median( DATA_SIZE, input_data, results_data );
36 #endif
37
38 // Do the filter
39 setStats(1);
40 median( DATA_SIZE, input_data, results_data );
41 setStats(0);
42
43 // Print out the results
44 printArray( "results", DATA_SIZE, results_data );
45
46 // Check the results
47 return verify( DATA_SIZE, results_data, verify_data );
48 }