-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
process.cpp
37 lines (27 loc) · 941 Bytes
/
process.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <cstdio>
#include <chrono>
#include "local_laplacian.h"
#include "benchmark.h"
#include "HalideImage.h"
#include "halide_image_io.h"
using namespace Halide;
int main(int argc, char **argv) {
if (argc < 7) {
printf("Usage: ./process input.png levels alpha beta timing_iterations output.png\n"
"e.g.: ./process input.png 8 1 1 10 output.png\n");
return 0;
}
Image<uint16_t> input = load_image(argv[1]);
int levels = atoi(argv[2]);
float alpha = atof(argv[3]), beta = atof(argv[4]);
Image<uint16_t> output(input.width(), input.height(), 3);
int timing = atoi(argv[5]);
// Timing code
double best = benchmark(timing, 1, [&]() {
local_laplacian(levels, alpha/(levels-1), beta, input, output);
});
printf("%gus\n", best * 1e6);
local_laplacian(levels, alpha/(levels-1), beta, input, output);
save_image(output, argv[6]);
return 0;
}