DvppDataMemory.hpp 1.28 KB
#include<string>

#include "dvpp_headers.h"

using namespace std;

class DvppDataMemory : public DeviceMemory
{
public:
    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){
        data_size = _size;
        int ret = acldvppMalloc((void **)&pHwRgb, data_size);
        if(ret != ACL_ERROR_NONE){
            cout << "acldvppMalloc failed" << endl;
        }
    }

    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)
     :DeviceMemory(3, _width, _width_stride, _height, _height_stride, _id, _dev_id, _key_frame, frame_nb, false){
        data_size = _size;
        data_type = 1;
        pHwRgb = pHwData;
    }

    ~DvppDataMemory(){
        if (pHwRgb) {
            int ret = acldvppFree((uint8_t*)pHwRgb);
            if(ret != ACL_ERROR_NONE){
                cout << "acldvppFree failed" << endl;
            }
            pHwRgb = nullptr;
        }
    }

public:
    int data_type;  // 0: rgb , 1: NV12
};