mvpt.h 2.32 KB
#include <map>
#include <mutex>
#include <thread>
#include <list>
#include <vector>
#include <deque>
#include <set>

#include "det_obj_header.h"
#include "acl/acl.h"
#include "acl/ops/acl_dvpp.h"
#include "../reprocessing_module/snapshot_reprocessing.h"
#include "../ai_engine_module/ai_engine_module.h"
#include "../util/JpegUtil.h"

#include "atlas_licence.h"//授权文件

#include "FeatureAnalysis.h"

#include "task_manager.h"


using namespace std;

class DeviceMemory;

class CMultiSourceProcess {
public:
  CMultiSourceProcess();
  ~CMultiSourceProcess();

  int InitAlgorthim(tsl_aiplatform_param vptParam);
  bool AddTask(task_param _cur_task_param);
  bool PauseTask(const string taskID);
  bool RestartTask(const string taskID);
  bool FinishTask(const string taskID);
  void Release();
  void CloseAllTask();
  int SnapShot(task_param param, string result_folder);
  int CountRunningTask();

  int GetTaskStatus(const string taskID);

public:
  int algorthim_process_thread();  // 算法处理线程
  void task_finished(const string task_id);
  void decoded_cbk(DeviceMemory* devFrame);

  bool CheckTime();
  bool CheckLabel(int devId);
  bool UpdateLabel();

private:
  // 算法相关
  int algorthim_vpt(vector<DeviceMemory*> vec_gpuMem);
  
private:
  // 工具处理函数
  void clear_finished_task();
  bool finish_task(const string taskID, const bool delete_snapshot);

  void vehicle_snapshot(vector<string>& vpt_interest_task_id, vector<vector<int>> deleteObjectID);
  void vehicle_locus_finished(const OBJ_KEY obj_key);

  bool save_obj_pic(ObjectInfo&);

  int snapshot_task(std::string& uri_or_name, const std::string& file_name, bool bInTask);

private:
  int m_devId; 

  snapshot_reprocessing *m_snapshot_reprocessing{nullptr};

  VPTProcess vpt_process;
  int skip_frame_ {5}; // 控制跳帧参数

  deque<DeviceMemory*> m_RgbDataList;
  mutex m_DataListMtx; 

  task_manager m_task_manager;

  mutex m_FinishedTaskMtx;
  map<string,bool> m_FinishedTaskMap;

  thread* m_pAlgorthimThread{nullptr};
  bool m_bfinish{false};

  int m_batch_size{1};

  FeatureAnalysis m_feature_analysis;

  JpegUtil jpegUtil;

  ResultData_CALLBACK m_result_cbk;

  void *skt_handle = nullptr;//授权
	atlas_licence_check_param check_param;//授权
	int check_label{-1};//授权 -1=未授权  0=授权  1=授权check日已经check成功(每月一次check)
};