forked from sliver-chen/mpp_linux_cpp
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathmain.cpp
executable file
·82 lines (66 loc) · 1.52 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
82
/*
* linux mpp c++ performance avaluation.
* base in mpp & rga & sdl.
* cfg info writed in params[6].
*/
#include <iostream>
#include "rkrga/RGA.h"
#include "mpp/Codec.h"
#include "thread/Thread.h"
extern "C" {
#include <stdlib.h>
#include <signal.h>
#include "rk_mpi.h"
}
#define dbg(fmt,...)\
do {\
printf(fmt,##__VA_ARGS__);\
} while(0)
using namespace std;
struct param {
int display;
int width;
int height;
string input;
string output;
MppCodingType type;
};
/*
* specified res file info here
*/
param params[1] = {
{1, 1920, 1080, "../res/Tennis1080p.h264", "../res/Tennis1080p.yuv", MPP_VIDEO_CodingAVC},
};
void *thread_exec(void *args) {
int ret = 0;
param *arg = (param *)args;
double *retRate = new double;
Codec *ctx = new Codec();
ret = ctx->init(arg->input.c_str(), arg->output.c_str(), arg->type,
arg->width, arg->height, arg->display);
if (ret < 0) {
cout << "failed to init codec" << endl;
return NULL;
}
ret = ctx->decode();
if (ret <0)
cout << "codec decode exec failed" << endl;
else
cout << "codec decode exec success id:" << endl;
ctx->deinit();
delete ctx;
return NULL;
}
void stop(int signo) {
cout << "mpp_linux_demo exit";
_exit(0);
}
int main() {
int ret = 0;
signal(SIGINT, stop);
Thread *tFirst = new Thread(thread_exec, ¶ms[0], NULL);
tFirst->init();
tFirst->run();
delete(tFirst);
return 0;
}