-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
80 lines (74 loc) · 2.14 KB
/
main.cpp
File metadata and controls
80 lines (74 loc) · 2.14 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "config.h"
#include "imagereader.h"
#include "imagereaderver2.h"
#include "avximgver2.h"
#include "imgapi.h"
#include "avximgapi.h"
#include <QDebug>
#include <chrono>
#include <avximgver2.h>
void withoutAvx()
{
typedef std::chrono::high_resolution_clock Time;
typedef std::chrono::milliseconds ms;
typedef std::chrono::duration<float> fsec;
auto t0 = Time::now();
ImageReader * img = new ImageReader();
img->checkTranspose();
imgapi * imgApi = new imgapi(img);
imgApi->countBvAndBh();
auto result = imgApi->countQs();
auto t1 = Time::now();
fsec fs = t1 - t0;
ms d = std::chrono::duration_cast<ms>(fs);
qInfo() << "result: " << result;
qInfo() << fs.count() << "s\n";
qInfo() << d.count() << "ms\n";
}
void withAvx()
{
typedef std::chrono::high_resolution_clock Time;
typedef std::chrono::milliseconds ms;
typedef std::chrono::duration<float> fsec;
qInfo() << "AVX";
ImageReader * img = new ImageReader();
auto t0 = Time::now();
avximgapi * imgApi = new avximgapi(img);
imgApi->countBvAndBh();
imgApi->countDandBAVx();
auto result = imgApi->countQs();
auto t1 = Time::now();
qInfo() << "result: " << result;
fsec fs = t1 - t0;
ms d = std::chrono::duration_cast<ms>(fs);
qInfo() << "result: " << result;
qInfo() << fs.count() << "s\n";
qInfo() << d.count() << "ms\n";
}
void withoutQVectorAvx()
{
typedef std::chrono::high_resolution_clock Time;
typedef std::chrono::milliseconds ms;
typedef std::chrono::duration<float> fsec;
qInfo() << "AVX - QVector";
ImageReader * img = new ImageReader();
auto t0 = Time::now();
avximgapi * imgApi = new avximgapi(img);
imgApi->countBvAndBhCalloc();
imgApi->countDandBAVxCalloc();
auto result = imgApi->countQs();
auto t1 = Time::now();
qInfo() << "result: " << result;
fsec fs = t1 - t0;
ms d = std::chrono::duration_cast<ms>(fs);
qInfo() << "result: " << result;
qInfo() << fs.count() << "s\n";
qInfo() << d.count() << "ms\n";
}
int main(int argc, char *argv[])
{
withoutAvx();
withAvx();
withoutQVectorAvx();
return 0;
}