csi_frame_ex.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /**
  2. * Copyright (C) 2021 Alibaba Group Holding Limited
  3. **/
  4. #ifndef _CSI_FRAME_EX_H
  5. #define _CSI_FRAME_EX_H
  6. #include "csi_common.h"
  7. #include "csi_meta.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #define MAX_PLANE_COUNT 3
  12. #if 0
  13. typedef enum {
  14. CSI_PICTURE_TYPE_NONE = 0, /* undefined */
  15. CSI_PICTURE_TYPE_I, /* intra */
  16. CSI_PICTURE_TYPE_P, /* predicted */
  17. CSI_PICTURE_TYPE_B, /* BI-dir predictd */
  18. CSI_PICTURE_TYPE_S, /* S(GMC)-VOP MPEG-4 */
  19. CSI_PICTURE_TYPE_SI, /* Switching intra */
  20. CSI_PICTURE_TYPE_SP, /* Switching Predicted */
  21. CSI_PICTURE_TYPE_BI, /* BI Type */
  22. } csi_picture_type_e;
  23. #endif
  24. typedef enum {
  25. CSI_CHROMA_LOCATION_LEFT,
  26. CSI_CHROMA_LOCATION_CENTER,
  27. CSI_CHROMA_LOCATION_TOPLEFT,
  28. CSI_CHROMA_LOCATION_TOP,
  29. CSI_CHROMA_LOCATION_BOTTOMLEFT,
  30. CSI_CHROMA_LOCATION_BOTTOM,
  31. CSI_CHROMA_LOCATION_DV420
  32. } csi_chroma_location_e;
  33. #if 0
  34. typedef enum {
  35. CSI_FRAME_COMPRESS_MODE_NONE = 0, /* no compress */
  36. CSI_FRAME_COMPRESS_MODE_SEQ, /* compress unit is 256x1 bytes as a segment. */
  37. CSI_FRAME_COMPRESS_MODE_TILE, /* compress unit is a tile. */
  38. CSI_FRAME_COMPRESS_MODE_LINE, /* compress unit is the whole line. raw for VI */
  39. CSI_FRAME_COMPRESS_MODE_FRAME, /* compress unit is the whole frame. YUV for VI(3DNR), RGB for TDE(write)/VO(read) */
  40. CSI_FRAME_COMPRESS_MAX
  41. } csi_frame_compress_mode;
  42. #endif
  43. typedef enum {
  44. CSI_COLORSPACE_ACES, /* RGB color space ACES standardized as SMPTE ST 2065-1:2012. */
  45. CSI_COLORSPACE_ACESCG, /* RGB color space ACEScg standardized as Academy S-2014-004. */
  46. CSI_COLORSPACE_RGB, /* RGB color space Adobe RGB (1998). */
  47. CSI_COLORSPACE_BT2020, /* RGB color space BT.2020 standardized as Rec. */
  48. CSI_COLORSPACE_BT709, /* RGB color space BT.709 standardized as Rec. */
  49. CSI_COLORSPACE_CIE_LAB, /* Lab color space CIE L*a*b*. */
  50. CSI_COLORSPACE_CIE_XYZ, /* XYZ color space CIE XYZ. */
  51. CSI_COLORSPACE_DCI_P3, /* RGB color space DCI-P3 standardized as SMPTE RP 431-2-2007. */
  52. CSI_COLORSPACE_DISPLAY_p3, /* RGB color space Display P3 based on SMPTE RP 431-2-2007 and IEC 61966-2.1:1999. */
  53. CSI_COLORSPACE_EXTENDED_SRGB, /* RGB color space scRGB-nl standardized as IEC 61966-2-2:2003. */
  54. CSI_COLORSPACE_LINEAR_EXTENDED_SRGB, /* RGB color space scRGB standardized as IEC 61966-2-2:2003. */
  55. CSI_COLORSPACE_LINEAR_SRGB, /* RGB color space sRGB standardized as IEC 61966-2.1:1999. */
  56. CSI_COLORSPACE_NTSC_1953, /* RGB color space NTSC, 1953 standard. */
  57. CSI_COLORSPACE_PRO_PHOTO_RGB, /* RGB color space NTSC, 1953 standard. */
  58. CSI_COLORSPACE_SMPTE_C, /* RGB color space SMPTE C. */
  59. CSI_COLORSPACE_SRGB /* RGB color space sRGB standardized as IEC 61966-2.1:1999. */
  60. } csi_color_space_e;
  61. typedef enum {
  62. CSI_VIDEO_FORMAT_UNDEFINED,
  63. CSI_VIDEO_FORMAT_COMPONENT,
  64. CSI_VIDEO_FORMAT_PAL,
  65. CSI_VIDEO_FORMAT_NTSC,
  66. CSI_VIDEO_FORMAT_SECAM,
  67. CSI_VIDEO_FORMAT_MAC
  68. } csi_video_format_e;
  69. typedef struct csi_frame_info {
  70. int32_t width;
  71. int32_t height;
  72. /* the region of interest of the frame */
  73. //csi_rect_s roi;
  74. int32_t pixel_format; //define in csi_pixel_fmt_e
  75. //csi_frame_compress_mode compress_mode;
  76. csi_color_space_e color_space;
  77. csi_chroma_location_e chroma_location;
  78. } csi_frame_info_s;
  79. typedef struct csi_frame_data {
  80. int64_t pts;
  81. int64_t dts;
  82. int64_t frame_num;
  83. int8_t is_key_frame;
  84. int8_t is_eos; /* last frame */
  85. int32_t offset[MAX_PLANE_COUNT];
  86. int32_t stride[MAX_PLANE_COUNT];
  87. int32_t num_plane;
  88. void *vir_addr[MAX_PLANE_COUNT];
  89. union {
  90. int fd[MAX_PLANE_COUNT]; /* -1 means invalid */
  91. int64_t phy_addr[MAX_PLANE_COUNT]; /* 0 means invalid */
  92. };
  93. } csi_frame_data_s;
  94. typedef struct csi_frame_ex {
  95. csi_frame_info_s frame_info;
  96. csi_frame_data_s frame_data;
  97. csi_meta_s frame_meta;
  98. void *opaque; /* for user private data, csi NOT use or modify it */
  99. void *csi_priv;/**for csi private data,user NOT use or modify it***************/
  100. } csi_frame_ex_s;
  101. typedef struct csi_frame_alloctor{
  102. int (*alloc)(csi_frame_ex_s * frame); /* base on the frame info,alloc fill the fd */
  103. int (*free)(csi_frame_ex_s * frame);
  104. }csi_frame_alloctor_s;
  105. #if 0
  106. typedef struct csi_bitstream {
  107. void *buf;
  108. uint32_t len;
  109. uint8_t is_eos; //is the end of stream
  110. uint8_t is_frame; //is whole compress frame data
  111. } csi_bitstream_s;
  112. #endif
  113. #ifdef __cplusplus
  114. }
  115. #endif
  116. #endif