median_main.c 1.3 KB

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