crop_process.h 1.59 KB
#ifndef ___CROP_PROCESS_H__
#define ___CROP_PROCESS_H__

#include <vector>
#include "acl/ops/acl_dvpp.h"
#include "../ai_platform/header.h"

using namespace std;

class DeviceMemory;

typedef enum Result {
    SUCCESS = 0,
    FAILED = 1
} Result;

class DvppCropProcess {
public:
    /**
    * @brief Constructor
    * @param [in] stream: stream
    */
    DvppCropProcess();

    /**
    * @brief Destructor
    */
    ~DvppCropProcess();

public:
    /**
    * @brief  Process Batch Crop
    * @return result
    */
    Result ProcessBatchCrop(DeviceMemory *devMem, vector<video_object_info> objs);

    /**
    * @brief init reousce
    * @return result
    */
    Result init(int deviceId);


private:
    /**
    * @brief  InitBatchCropInputDesc
    * @return Result
    */
    Result InitBatchCropInputDesc(DeviceMemory *devMem);

    /**
    * @brief  InitBatchCropOutputDesc
    * @return Result
    */
    Result InitBatchCropOutputDesc(vector<video_object_info> objs);

    /**
    * @brief  DestroyBatchCropResource
    */
    void DestroyBatchCropResource();


    void DestroyResource();

    /**
    * @brief init reousce
    * @return result
    */
    Result InitProcess();

private:
    int32_t deviceId_;
    aclrtContext context_;
    aclrtStream stream_;

    acldvppChannelDesc *dvppChannelDesc_;
    acldvppResizeConfig *resizeConfig_;

    std::vector<void *> vecOutPtr_;

    acldvppBatchPicDesc *inputBatchPicDesc_;   // vpc input desc
    acldvppBatchPicDesc *outputBatchPicDesc_;  // vpc output desc

    uint32_t inputBatchSize_;
    uint32_t outputBatchSize_;
};

#endif  // ___CROP_PROCESS_H__