MppDecoder.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef MPPDECODER_H
  2. #define MPPDECODER_H
  3. #include <rockchip/rk_mpi.h>
  4. #include <rockchip/mpp_buffer.h>
  5. #include <rockchip/mpp_frame.h>
  6. #include <rockchip/mpp_packet.h>
  7. #include <rockchip/rk_type.h>
  8. #include <rockchip/rk_mpi_cmd.h>
  9. #define MPP_ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
  10. class MppDecoder
  11. {
  12. public:
  13. MppDecoder(const MppDecoder &) = delete;
  14. MppDecoder &operator=(const MppDecoder &) = delete;
  15. bool init();
  16. int getDecodeIndex() { return m_index; }
  17. bool decodeJpegToRgb(const char *jpegData, size_t jpegSize, unsigned char **rgbData, int *width, int *height);
  18. bool resetDecoder();
  19. MppDecoder() = default;
  20. ~MppDecoder() = default;
  21. private:
  22. MppCtx m_ctx{nullptr};
  23. MppApi *m_mpi{nullptr};
  24. MppDecCfg m_decCfg{nullptr};
  25. uint32_t m_needSplit{0};
  26. MppBufferGroup m_PacketGroup{nullptr};
  27. MppBufferGroup m_frameGroup{nullptr};
  28. MppFrame m_frame{nullptr};
  29. MppPacket m_packet{nullptr};
  30. RK_U32 m_width{3840};
  31. RK_U32 m_height{2160};
  32. RK_U32 m_format;
  33. MppBuffer m_packetBuffer{nullptr};
  34. MppBuffer m_frameBuffer{nullptr};
  35. void *m_inputBufferPtr{nullptr};
  36. MppTask m_task{nullptr};
  37. unsigned char *m_rgbData{nullptr};
  38. // init flag
  39. bool m_initFlag{false};
  40. // decoder index
  41. int m_index{0};
  42. };
  43. #endif // MPPDECODER_H