Blame view

src/decoder/dvpp/DvppDataMemory.hpp 1.27 KB
09c2d08c   Hu Chunming   arm交付版
1
2
3
4
5
6
7
8
9
  #include<string>
  
  #include "dvpp_headers.h"
  
  using namespace std;
  
  class DvppDataMemory : public DeviceMemory
  {
  public:
746db74c   Hu Chunming   实现recode
10
11
      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交付版
12
13
14
15
16
17
18
          data_size = _size;
          int ret = acldvppMalloc((void **)&pHwRgb, data_size);
          if(ret != ACL_ERROR_NONE){
              cout << "acldvppMalloc failed" << endl;
          }
      }
  
746db74c   Hu Chunming   实现recode
19
      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   优化代码;避免可能的泄漏
20
       :DeviceMemory(-1, _width, _width_stride, _height, _height_stride, _id, _dev_id, _key_frame, frame_nb, false){
09c2d08c   Hu Chunming   arm交付版
21
22
23
24
25
26
27
          data_size = _size;
          data_type = 1;
          pHwRgb = pHwData;
      }
  
      ~DvppDataMemory(){
          if (pHwRgb) {
b17e0e69   Zhao Shuaihua   闯红灯增加场景自适应、轨迹约束;逆...
28
              int ret = acldvppFree(pHwRgb);
09c2d08c   Hu Chunming   arm交付版
29
30
31
32
33
34
35
36
37
38
              if(ret != ACL_ERROR_NONE){
                  cout << "acldvppFree failed" << endl;
              }
              pHwRgb = nullptr;
          }
      }
  
  public:
      int data_type;  // 0: rgb , 1: NV12
  };