Blame view

src/ai_platform/MultiSourceProcess.h 2.11 KB
0b4cd5d5   Hu Chunming   完成轨迹定时抓拍
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  #include "header.h"
  #include "acl/acl.h"
  #include "acl/ops/acl_dvpp.h"
  #include "task_param_manager.h"
  #include "../ai_engine_module/VPTProcess.h"
  #include "../reprocessing_module/snapshot_reprocessing.h"
  #include "../reprocessing_module/save_snapshot_reprocessing.h"
  
  #include <map>
  #include <mutex>
  #include <thread>
  #include <list>
  #include <vector>
  #include <deque>
  
  
  
  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 CloseAllTask();
    int SnapShot(task_param param);
  
  #ifdef POST_USE_RABBITMQ
    int AddMqConn(mq_type_t mq_type, rabbitmq_conn_params_t mq_conn_param);
    int GetTaskStatus(const string taskID);
  #endif
  
  public:
    int algorthim_process_thread();  // 算法处理线程
    void task_finished(const string task_id);
    void decoded_cbk(DeviceMemory* devFrame);
  
  private:
    // 算法相关
    int algorthim_vpt(vector<DeviceMemory*> vec_gpuMem);
  
  private:
    // 工具处理函数
    bool task_has_vpt_algor(const std::string &task_id);
    void clear_finished_task();
    bool finish_task(const string taskID, const bool delete_snapshot);
    int algorithm_vehicle_relult(vector<DeviceMemory*> vec_devMem, vector<onelevel_det_result>& vptResult, vector<vector<int>>& delete_object_id);
    void send_locus_finished_msg(vector<string>& vpt_interest_task_id, vector<vector<int>> deleteObjectID);
  
  private:
    int m_devId; 
  
    snapshot_reprocessing *m_snapshot_reprocessing{nullptr};
    task_param_manager *m_task_param_manager{nullptr};
    save_snapshot_reprocessing *m_save_snapshot_reprocessing{nullptr};
  
    VPTProcess vpt_process;
    int skip_frame_ = 5; // 控制跳帧参数
  
    deque<DeviceMemory*> m_RgbDataList;
    mutex m_DataListMtx; 
  
    mutex m_FinishedTaskMtx;
    map<string,bool> m_FinishedTaskMap;
  
    thread* m_pAlgorthimThread;
    bool m_bfinish{false};
  
    int m_batch_size{1};
  
  #ifdef POST_USE_RABBITMQ
    mq::Manager *mq_manager_{nullptr};
  #endif
  
  };