d121e4ee
Zhao Shuaihua
道路分割区分农村路;优化逆行、占用...
|
1
2
3
|
#ifndef __DVPP_DATA_MEMORY_HPP__
#define __DVPP_DATA_MEMORY_HPP__
|
09c2d08c
Hu Chunming
arm交付版
|
4
5
|
#include<string>
|
d51ea997
Zhao Shuaihua
升级玩手机、雨棚模型;模型批处理;...
|
6
|
#include "depend_headers.h"
|
09c2d08c
Hu Chunming
arm交付版
|
7
8
9
10
|
#include "dvpp_headers.h"
using namespace std;
|
d51ea997
Zhao Shuaihua
升级玩手机、雨棚模型;模型批处理;...
|
11
12
|
// static int snap_free = 0;
|
09c2d08c
Hu Chunming
arm交付版
|
13
14
15
|
class DvppDataMemory : public DeviceMemory
{
public:
|
746db74c
Hu Chunming
实现recode
|
16
17
|
DvppDataMemory(int _channel, int _width, int _width_stride, int _height, int _height_stride, int _size, string _id, string _dev_id, bool _key_frame, unsigned long long frame_nb)
:DeviceMemory(_channel, _width, _width_stride, _height, _height_stride, _id, _dev_id, _key_frame, frame_nb, false){
|
09c2d08c
Hu Chunming
arm交付版
|
18
|
data_size = _size;
|
d51ea997
Zhao Shuaihua
升级玩手机、雨棚模型;模型批处理;...
|
19
|
data_type = 1;
|
09c2d08c
Hu Chunming
arm交付版
|
20
21
|
int ret = acldvppMalloc((void **)&pHwRgb, data_size);
if(ret != ACL_ERROR_NONE){
|
d51ea997
Zhao Shuaihua
升级玩手机、雨棚模型;模型批处理;...
|
22
|
LOG_ERROR("[{}]- acldvppMalloc failed", id);
|
09c2d08c
Hu Chunming
arm交付版
|
23
24
25
|
}
}
|
746db74c
Hu Chunming
实现recode
|
26
|
DvppDataMemory( int _width, int _width_stride, int _height, int _height_stride, int _size, string _id, string _dev_id, bool _key_frame, unsigned long long frame_nb, unsigned char * pHwData)
|
d15d6736
Hu Chunming
优化代码;避免可能的泄漏
|
27
|
:DeviceMemory(-1, _width, _width_stride, _height, _height_stride, _id, _dev_id, _key_frame, frame_nb, false){
|
09c2d08c
Hu Chunming
arm交付版
|
28
29
30
31
32
|
data_size = _size;
data_type = 1;
pHwRgb = pHwData;
}
|
d51ea997
Zhao Shuaihua
升级玩手机、雨棚模型;模型批处理;...
|
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
|
DvppDataMemory(DvppDataMemory* pSrc):DeviceMemory(-1, pSrc->getWidth(), pSrc->getWidthStride(), pSrc->getHeight(), pSrc->getHeightStride(), pSrc->getId(), pSrc->getDeviceId(), pSrc->isKeyFrame(), pSrc->getFrameNb(), false){
if(pSrc == nullptr) {
LOG_ERROR("[{}]- pSrc is nullptr", pSrc->getId());
return;
}
data_size = pSrc->getSize();
int ret = acldvppMalloc((void **)&pHwRgb, data_size);
if(ret != ACL_ERROR_NONE){
LOG_ERROR("[{}]- acldvppMalloc failed", pSrc->getId());
return;
}
ret = aclrtMemcpy(pHwRgb, data_size, pSrc->getMem(), pSrc->getSize(), ACL_MEMCPY_DEVICE_TO_DEVICE);
if(ret != ACL_ERROR_NONE){
acldvppFree(pHwRgb);
LOG_ERROR("[{}]- aclrtMemcpy failed", pSrc->getId());
return;
}
data_type = 2;
timestamp = UtilTools::get_cur_time_ms();
}
|
09c2d08c
Hu Chunming
arm交付版
|
59
|
~DvppDataMemory(){
|
d51ea997
Zhao Shuaihua
升级玩手机、雨棚模型;模型批处理;...
|
60
61
62
63
64
|
// if (data_type == 2)
// {
// snap_free++;
// LOG_INFO("[{}]- snap_free: {}", getId(), snap_free);
// }
|
09c2d08c
Hu Chunming
arm交付版
|
65
|
if (pHwRgb) {
|
b17e0e69
Zhao Shuaihua
闯红灯增加场景自适应、轨迹约束;逆...
|
66
|
int ret = acldvppFree(pHwRgb);
|
09c2d08c
Hu Chunming
arm交付版
|
67
|
if(ret != ACL_ERROR_NONE){
|
d51ea997
Zhao Shuaihua
升级玩手机、雨棚模型;模型批处理;...
|
68
|
LOG_ERROR("[{}]- acldvppFree failed", id);
|
09c2d08c
Hu Chunming
arm交付版
|
69
70
71
|
}
pHwRgb = nullptr;
}
|
09c2d08c
Hu Chunming
arm交付版
|
72
73
74
75
|
}
public:
int data_type; // 0: rgb , 1: NV12
|
d121e4ee
Zhao Shuaihua
道路分割区分农村路;优化逆行、占用...
|
76
77
78
79
|
};
#endif // __DVPP_DATA_MEMORY_HPP__
|