VpcUtils.h
1.25 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
#include "dvpp_headers.h"
#include "depend_headers.h"
#include "DvppDataMemory.hpp"
#include <map>
class VpcUtils{
public:
static VpcUtils* getInstance(int devId) {
static std::map<int, VpcUtils*> mapUtils;
VpcUtils* singleton = nullptr;
if (mapUtils.find(devId) == mapUtils.end()) {
singleton = new VpcUtils();
singleton->init(devId);
mapUtils[devId] = singleton;
} else {
singleton = mapUtils[devId];
}
return singleton;
}
VpcUtils();
~VpcUtils();
int init(int);
DvppDataMemory* convert2bgr(acldvppPicDesc *input, int out_width, int out_height, bool key_frame);
DvppDataMemory* convert2bgr(DvppDataMemory* inMem);
DvppDataMemory* resize(acldvppPicDesc *inputDesc_, int out_width, int out_height);
DvppDataMemory* resize(DvppDataMemory* inMem, int out_width, int out_height);
DvppDataMemory* crop(DvppDataMemory* devMem, AreaInfo obj);
vector<DvppDataMemory*> crop_batch(DvppDataMemory* devMem, const vector<AreaInfo> objs);
private:
void check_area(AreaInfo& area, int width, int height);
private:
aclrtContext context_;
aclrtStream stream_;
int m_devId;
acldvppChannelDesc *dvppChannelDesc_ ;
string m_dec_name;
};