-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.cpp
81 lines (66 loc) · 2.26 KB
/
main.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
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
81
#include <omp.h>
#include <string>
#include <vector>
#include <ostream>
#include <random>
#include <chrono>
#include <stdio.h>
#include <unistd.h>
#include <fstream>
#include <opencv2/opencv.hpp>
#include <hifivoice.h>
#define PBWIDTH 60
//#define PBSTR "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
void printProgress(double percentage) {
char PBSTR[] = "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||";
std::array<char, PBWIDTH> PBSTR_2;
PBSTR_2.fill(254u);
//PBSTR_2.fill(0xDB);
int bar_size = PBWIDTH;
int val = (int) (percentage );
int lpad = (int) (percentage * bar_size/100);
int rpad = bar_size - lpad;
printf("\r%3d%% [%.*s%*s]", val, lpad, PBSTR_2, rpad, "");
fflush(stdout);
}
int main(int argc, char** argv)
{
int opt = 0;
char *mel = NULL;
char *out_fname = NULL;
while ((opt = getopt(argc, argv, "i:0:1:o:")) != -1) {
switch(opt){
case 'i':
mel = optarg;
printf("\nInput option value=%s", mel);
break;
case 'o':
out_fname = optarg;
printf("\nOutput option value=%s", out_fname);
break;
case '?':
if (optopt == 'i'){
printf("\nMissing input file name");
} else if (optopt == 'o') {
printf("\nMissing output file name");
} else {
printf("\nInvalid option received");
printf("\nUsage: hifivoice -i input file name -o output file name");
}
break;
}
}
//printProgress(50);
//char *argv_my[] = {"face", "./img/test.jpg", NULL };
//char *argv_my[] = {"face", "./img/3.jpg", NULL };
char *argv_my[] = {"mel", mel, NULL };
printf("\npath = %s", mel);
hifivoice_main(2, argv_my);
printf("\nFinal");
#pragma omp parallel
{
//printf("thread num %d: first hello world!\n",omp_get_thread_num());
//printf("thread num %d; second hello world!\n",omp_get_thread_num());
}
return 0;
}