csi_venc_h264.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (C) 2021 Alibaba Group Holding Limited
  3. * Author: LuChongzhi <chongzhi.lcz@alibaba-inc.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #ifndef __CSI_VENC_H264_H__
  10. #define __CSI_VENC_H264_H__
  11. typedef enum {
  12. CSI_VENC_H264_PROFILE_BASELINE = 0,
  13. CSI_VENC_H264_PROFILE_EXTENDED = 1,
  14. CSI_VENC_H264_PROFILE_MAIN = 2,
  15. CSI_VENC_H264_PROFILE_HIGH = 3,
  16. CSI_VENC_H264_PROFILE_HIGH10 = 4,
  17. CSI_VENC_H264_PROFILE_HIGH422 = 5,
  18. CSI_VENC_H264_PROFILE_HIGH444 = 6,
  19. CSI_VENC_H264_PROFILE_SVC = 10,
  20. } csi_venc_h264_profile_e;
  21. typedef enum {
  22. CSI_VENC_H264_LEVEL_1 = 10, /* QCIF (176x144) 64k bps */
  23. CSI_VENC_H264_LEVEL_1_b = 99,
  24. CSI_VENC_H264_LEVEL_1_1 = 11,
  25. CSI_VENC_H264_LEVEL_1_2 = 12,
  26. CSI_VENC_H264_LEVEL_1_3 = 13,
  27. CSI_VENC_H264_LEVEL_2 = 20, /* CIF (352x288) 576k bps" */
  28. CSI_VENC_H264_LEVEL_2_1 = 21,
  29. CSI_VENC_H264_LEVEL_2_2 = 22,
  30. CSI_VENC_H264_LEVEL_3 = 30, /* SD (720x576) 2M bps */
  31. CSI_VENC_H264_LEVEL_3_1 = 31,
  32. CSI_VENC_H264_LEVEL_3_2 = 32,
  33. CSI_VENC_H264_LEVEL_4 = 40, /* 1080p (1920x1080) 25M bps */
  34. CSI_VENC_H264_LEVEL_4_1 = 41,
  35. CSI_VENC_H264_LEVEL_4_2 = 42,
  36. CSI_VENC_H264_LEVEL_5 = 50, /* 2k (2560x1920) 168M bps */
  37. CSI_VENC_H264_LEVEL_5_1 = 51,
  38. CSI_VENC_H264_LEVEL_5_2 = 52,
  39. } csi_venc_h264_level_e;
  40. typedef struct csi_venc_h264_attr {
  41. csi_venc_h264_profile_e profile;
  42. csi_venc_h264_level_e level;
  43. uint32_t frame_type; // bitmask of csi_vcodec_frame_type_e
  44. bool frame_mode; // encode by frame or slice mode
  45. bool share_buf; //Whether to enable the Share Buf of Rcn and Ref
  46. } csi_venc_h264_attr_s;
  47. typedef struct csi_venc_h264_cbr {
  48. uint32_t stat_time; /* Range:[1, 60]; the rate statistic time, the unit is senconds(s) */
  49. uint32_t framerate_numer;
  50. uint32_t framerate_denom;
  51. uint32_t bit_rate; /* Range:[2, 409600]; average bitrate, units:kbps */
  52. } csi_venc_h264_cbr_s;
  53. typedef struct csi_venc_h264_vbr {
  54. uint32_t stat_time; /* Range:[1, 60]; the rate statistic time, the unit is senconds(s) */
  55. uint32_t framerate_numer;
  56. uint32_t framerate_denom;
  57. uint32_t max_bit_rate; /* Range:[2, 409600]; average bitrate, units:kbps */
  58. } csi_venc_h264_vbr_s;
  59. typedef struct csi_venc_h264_avbr {
  60. uint32_t stat_time; /* Range:[1, 60]; the rate statistic time, the unit is senconds(s) */
  61. uint32_t framerate_numer;
  62. uint32_t framerate_denom;
  63. uint32_t max_bit_rate; /* Range:[2, 409600]; average bitrate, units:kbps */
  64. } csi_venc_h264_avbr_s;
  65. typedef struct csi_venc_h264_fixqp {
  66. uint32_t framerate_numer;
  67. uint32_t framerate_denom;
  68. uint32_t i_qp; /* Range:[0, 51]; qp of the I frame */
  69. uint32_t p_qp; /* Range:[0, 51]; qp of the P frame */
  70. uint32_t b_qp; /* Range:[0, 51]; qp of the B frame */
  71. } csi_venc_h264_fixqp_s;
  72. typedef struct csi_venc_h264_qpmap {
  73. uint32_t stat_time; /* Range:[1, 60]; the rate statistic time, the unit is senconds(s) */
  74. uint32_t framerate_numer;
  75. uint32_t framerate_denom;
  76. } csi_venc_h264_qpmap_s;
  77. typedef enum csi_venc_h264_nalu {
  78. CSI_VENC_H264_NALU_BSLICE, /*B SLICE types*/
  79. CSI_VENC_H264_NALU_PSLICE, /*P SLICE types*/
  80. CSI_VENC_H264_NALU_ISLICE, /*I SLICE types*/
  81. CSI_VENC_H264_NALU_IDRSLICE, /*IDR SLICE types*/
  82. CSI_VENC_H264_NALU_SEI, /*SEI types*/
  83. CSI_VENC_H264_NALU_SPS, /*SPS types*/
  84. CSI_VENC_H264_NALU_PPS, /*PPS types*/
  85. } csi_venc_h264_nalu_e;
  86. #endif /* __CSI_VENC_H264_H__ */