-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource.cpp
More file actions
39 lines (28 loc) · 931 Bytes
/
Copy pathsource.cpp
File metadata and controls
39 lines (28 loc) · 931 Bytes
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
38
39
#include <stdio.h>
#include "OpenCL.h"
#include <windows.h>
int main(int argc, char **argv)
{
ShowAvailableDevicesCL();
InitializeCL();
static unsigned char frame[1000 * 1000 * 3],res[1000 * 1000];
for (size_t i = 0; i < sizeof(frame); i++)
frame[i] = rand() % 256;
for (size_t i = 0; i < sizeof(res); i++)
res[i] = rand() % 256;
GetMemoryCL(sizeof(frame),sizeof(res), 1000, 1000);
LARGE_INTEGER clock, start, end;
QueryPerformanceFrequency(&clock);
while (!GetAsyncKeyState(VK_ESCAPE))
{
WriteSourceCL(frame);
QueryPerformanceCounter(&start);
for (int i = 0; i < 1000; i++)
ProcessCL();
//cvtColor(frame, res, COLOR_BGR2GRAY);
QueryPerformanceCounter(&end);
ReadResultCL(res);
printf("%lf[ms]\n", (double)(end.QuadPart - start.QuadPart) * 1000.0 / clock.QuadPart);
}
ReleaseMemoryCL();
}