MppDecoder.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. MppDecoder() = default;
  19. ~MppDecoder() = default;
  20. private:
  21. MppCtx m_ctx{nullptr};
  22. MppApi *m_mpi{nullptr};
  23. MppDecCfg m_decCfg{nullptr};
  24. uint32_t m_needSplit{0};
  25. MppBufferGroup m_PacketGroup{nullptr};
  26. MppBufferGroup m_frameGroup{nullptr};
  27. MppFrame m_frame{nullptr};
  28. MppPacket m_packet{nullptr};
  29. RK_U32 m_width{3840};
  30. RK_U32 m_height{2160};
  31. RK_U32 m_format;
  32. MppBuffer m_packetBuffer{nullptr};
  33. MppBuffer m_frameBuffer{nullptr};
  34. void *m_inputBufferPtr{nullptr};
  35. MppTask m_task{nullptr};
  36. unsigned char *m_rgbData{nullptr};
  37. // init flag
  38. bool m_initFlag{false};
  39. // decoder index
  40. int m_index{0};
  41. };
  42. #endif // MPPDECODER_H