Blame view

src/dvpp/DvppDec.h 1.89 KB
63e6f7bc   Hu Chunming   完成dvpp。但是nv和gb281...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  #include<string>
  #include <pthread.h>
  
  #include "dvpp_headers.h"
  #include "depend_headers.h"
  #include "user_mem.h"
  #include "CircularQueue.hpp"
  #include "VpcPicConverter.h"
  #include "FFReceiver.h"
  
  #include <queue>
  
  using namespace std;
  
  #define TEST_DECODER
  
63e6f7bc   Hu Chunming   完成dvpp。但是nv和gb281...
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
  struct DvppDecConfig{
      string dec_name;                         
      POST_DECODE_CALLBACK post_decoded_cbk;  // 解码数据回调接口
      string dev_id;                           // gpu id
      bool force_tcp{true};                   // 是否指定使用tcp连接
      int skip_frame{1};                      // 跳帧数
      int codec_id;                           // 0 : h264   1:h265
      int profile;
      CircularQueue<AVPacket*> *pktQueueptr;
  
      int width;
      int height;
  };
  
  
  class DvppDec {
  public:
      DvppDec();
      ~DvppDec();
      bool init_vdpp(DvppDecConfig cfg);
      void setPostDecArg(const void* postDecArg);
      bool start();
      void close();
      void pause();
      void resume();
  
  public:
      void doProcessReport();
      void doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *output);
  
  private:
      void decode_thread();
      void releaseResource();
      bool sendVdecEos(aclvdecChannelDesc *vdecChannelDesc);
      int sentFrame(aclvdecChannelDesc *vdecChannelDesc, uint64_t frame_count);
  
  private:
  
      bool m_bRunning{false};
      bool m_bPause{false};
      bool m_bExitReportThd{false};
  
      int m_dvpp_deviceId {-1};
      int m_dvpp_channel {-1};
      aclrtContext m_context;
      acldvppStreamFormat enType;
  
      pthread_t m_decode_thread;
      
      DvppDecConfig m_cfg;
      string m_dec_name;
  
      vector<void*> m_vec_vdec;
      CircularQueue<void *> m_vdecQueue;
      CircularQueue<AVPacket *> *m_pktQueueptr;
  
      const void * m_postDecArg;
      POST_DECODE_CALLBACK post_decoded_cbk;
  
      VpcPicConverter picConverter;
  
      int m_vdec_out_size {-1};
d248da62   Hu Chunming   优化代码,修正dvpp的一些bug
79
80
81
82
83
84
  
  #ifdef TEST_DECODER
      void *vdecHostAddr = nullptr;
      int count_frame = 0;
  #endif
  
63e6f7bc   Hu Chunming   完成dvpp。但是nv和gb281...
85
  };