Blame view

src/nvdecoder/GpuRgbMemory.hpp 794 Bytes
63e6f7bc   Hu Chunming   完成dvpp。但是nv和gb281...
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
  #include<string>
  
  #include "../DeviceRgbMemory.hpp"
  #include "cuda_kernels.h"
  #include "define.hpp"
  #include "utiltools.hpp"
  
  using namespace std;
  
  class GpuRgbMemory : public DeviceRgbMemory{
  
  public:
       GpuRgbMemory(int _channel, int _width, int _height, string _id, string _gpuid, bool _isused)
       :DeviceRgbMemory(_channel, _width, _height, _id, _gpuid, _isused){
          gpuid = _gpuid;
          cudaSetDevice(atoi(gpuid.c_str()));
          CHECK_CUDA(cudaMalloc((void **)&pHwRgb, data_size * sizeof(unsigned char)));
      }
  
      ~GpuRgbMemory(){
          if (pHwRgb) {
              cudaSetDevice(atoi(gpuid.c_str()));
              CHECK_CUDA(cudaFree(pHwRgb));
              pHwRgb = nullptr;
          }
      }
  
      string getGpuId() {
          return gpuid;
      }
  
  private:
      string gpuid;
  };