mpp_frame.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. /* SPDX-License-Identifier: Apache-2.0 OR MIT */
  2. /*
  3. * Copyright (c) 2015 Rockchip Electronics Co., Ltd.
  4. */
  5. #ifndef __MPP_FRAME_H__
  6. #define __MPP_FRAME_H__
  7. #include "mpp_buffer.h"
  8. #include "mpp_meta.h"
  9. /*
  10. * bit definition for mode flag in MppFrame
  11. */
  12. /* progressive frame */
  13. #define MPP_FRAME_FLAG_FRAME (0x00000000)
  14. /* top field only */
  15. #define MPP_FRAME_FLAG_TOP_FIELD (0x00000001)
  16. /* bottom field only */
  17. #define MPP_FRAME_FLAG_BOT_FIELD (0x00000002)
  18. /* paired field */
  19. #define MPP_FRAME_FLAG_PAIRED_FIELD (MPP_FRAME_FLAG_TOP_FIELD|MPP_FRAME_FLAG_BOT_FIELD)
  20. /* paired field with field order of top first */
  21. #define MPP_FRAME_FLAG_TOP_FIRST (0x00000004)
  22. /* paired field with field order of bottom first */
  23. #define MPP_FRAME_FLAG_BOT_FIRST (0x00000008)
  24. /* paired field with unknown field order (MBAFF) */
  25. #define MPP_FRAME_FLAG_DEINTERLACED (MPP_FRAME_FLAG_TOP_FIRST|MPP_FRAME_FLAG_BOT_FIRST)
  26. #define MPP_FRAME_FLAG_FIELD_ORDER_MASK (0x0000000C)
  27. // for multiview stream
  28. #define MPP_FRAME_FLAG_VIEW_ID_MASK (0x000000f0)
  29. #define MPP_FRAME_FLAG_IEP_DEI_MASK (0x00000f00)
  30. #define MPP_FRAME_FLAG_IEP_DEI_I2O1 (0x00000100)
  31. #define MPP_FRAME_FLAG_IEP_DEI_I4O2 (0x00000200)
  32. #define MPP_FRAME_FLAG_IEP_DEI_I4O1 (0x00000300)
  33. /*
  34. * MPEG vs JPEG YUV range.
  35. */
  36. typedef enum {
  37. MPP_FRAME_RANGE_UNSPECIFIED = 0,
  38. MPP_FRAME_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
  39. MPP_FRAME_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
  40. MPP_FRAME_RANGE_NB, ///< Not part of ABI
  41. } MppFrameColorRange;
  42. typedef enum {
  43. MPP_FRAME_CHROMA_DOWN_SAMPLE_MODE_NONE,
  44. MPP_FRAME_CHORMA_DOWN_SAMPLE_MODE_AVERAGE,
  45. MPP_FRAME_CHORMA_DOWN_SAMPLE_MODE_DISCARD,
  46. } MppFrameChromaDownSampleMode;
  47. typedef enum {
  48. MPP_FRAME_VIDEO_FMT_COMPONEMT = 0,
  49. MPP_FRAME_VIDEO_FMT_PAL = 1,
  50. MPP_FRAME_VIDEO_FMT_NTSC = 2,
  51. MPP_FRAME_VIDEO_FMT_SECAM = 3,
  52. MPP_FRAME_VIDEO_FMT_MAC = 4,
  53. MPP_FRAME_VIDEO_FMT_UNSPECIFIED = 5,
  54. MPP_FRAME_VIDEO_FMT_RESERVED0 = 6,
  55. MPP_FRAME_VIDEO_FMT_RESERVED1 = 7,
  56. } MppFrameVideoFormat;
  57. /*
  58. * Chromaticity coordinates of the source primaries.
  59. */
  60. typedef enum {
  61. MPP_FRAME_PRI_RESERVED0 = 0,
  62. MPP_FRAME_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
  63. MPP_FRAME_PRI_UNSPECIFIED = 2,
  64. MPP_FRAME_PRI_RESERVED = 3,
  65. MPP_FRAME_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
  66. MPP_FRAME_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
  67. MPP_FRAME_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC/SMPTE ST 170 (2004)
  68. MPP_FRAME_PRI_SMPTE240M = 7, ///< functionally identical to above/SMPTE ST 240
  69. MPP_FRAME_PRI_FILM = 8, ///< colour filters using Illuminant C
  70. MPP_FRAME_PRI_BT2020 = 9, ///< ITU-R BT2020 / ITU-R BT.2100-2
  71. MPP_FRAME_PRI_SMPTEST428_1 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
  72. MPP_FRAME_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3
  73. MPP_FRAME_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
  74. MPP_FRAME_PRI_JEDEC_P22 = 22, ///< JEDEC P22 phosphors
  75. MPP_FRAME_PRI_NB, ///< Not part of ABI
  76. } MppFrameColorPrimaries;
  77. /*
  78. * Color Transfer Characteristic.
  79. */
  80. typedef enum {
  81. MPP_FRAME_TRC_RESERVED0 = 0,
  82. MPP_FRAME_TRC_BT709 = 1, ///< also ITU-R BT1361
  83. MPP_FRAME_TRC_UNSPECIFIED = 2,
  84. MPP_FRAME_TRC_RESERVED = 3,
  85. MPP_FRAME_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
  86. MPP_FRAME_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
  87. MPP_FRAME_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
  88. MPP_FRAME_TRC_SMPTE240M = 7,
  89. MPP_FRAME_TRC_LINEAR = 8, ///< "Linear transfer characteristics"
  90. MPP_FRAME_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)"
  91. MPP_FRAME_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
  92. MPP_FRAME_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
  93. MPP_FRAME_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut
  94. MPP_FRAME_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
  95. MPP_FRAME_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system
  96. MPP_FRAME_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system
  97. MPP_FRAME_TRC_SMPTEST2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
  98. MPP_FRAME_TRC_SMPTEST428_1 = 17, ///< SMPTE ST 428-1
  99. MPP_FRAME_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
  100. MPP_FRAME_TRC_NB, ///< Not part of ABI
  101. } MppFrameColorTransferCharacteristic;
  102. /*
  103. * YUV colorspace type.
  104. */
  105. typedef enum {
  106. MPP_FRAME_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
  107. MPP_FRAME_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
  108. MPP_FRAME_SPC_UNSPECIFIED = 2,
  109. MPP_FRAME_SPC_RESERVED = 3,
  110. MPP_FRAME_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
  111. MPP_FRAME_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
  112. MPP_FRAME_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
  113. MPP_FRAME_SPC_SMPTE240M = 7,
  114. MPP_FRAME_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
  115. MPP_FRAME_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
  116. MPP_FRAME_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
  117. MPP_FRAME_SPC_SMPTE2085 = 11, ///< SMPTE 2085, Y'D'zD'x
  118. MPP_FRAME_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system
  119. MPP_FRAME_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system
  120. MPP_FRAME_SPC_ICTCP = 14, ///< ITU-R BT.2100-0, ICtCp
  121. MPP_FRAME_SPC_NB, ///< Not part of ABI
  122. } MppFrameColorSpace;
  123. /*
  124. * Location of chroma samples.
  125. *
  126. * Illustration showing the location of the first (top left) chroma sample of the
  127. * image, the left shows only luma, the right
  128. * shows the location of the chroma sample, the 2 could be imagined to overlay
  129. * each other but are drawn separately due to limitations of ASCII
  130. *
  131. * 1st 2nd 1st 2nd horizontal luma sample positions
  132. * v v v v
  133. * ______ ______
  134. *1st luma line > |X X ... |3 4 X ... X are luma samples,
  135. * | |1 2 1-6 are possible chroma positions
  136. *2nd luma line > |X X ... |5 6 X ... 0 is undefined/unknown position
  137. */
  138. typedef enum {
  139. MPP_CHROMA_LOC_UNSPECIFIED = 0,
  140. MPP_CHROMA_LOC_LEFT = 1, ///< mpeg2/4 4:2:0, h264 default for 4:2:0
  141. MPP_CHROMA_LOC_CENTER = 2, ///< mpeg1 4:2:0, jpeg 4:2:0, h263 4:2:0
  142. MPP_CHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
  143. MPP_CHROMA_LOC_TOP = 4,
  144. MPP_CHROMA_LOC_BOTTOMLEFT = 5,
  145. MPP_CHROMA_LOC_BOTTOM = 6,
  146. MPP_CHROMA_LOC_NB, ///< Not part of ABI
  147. } MppFrameChromaLocation;
  148. typedef enum {
  149. MPP_CHROMA_UNSPECIFIED,
  150. MPP_CHROMA_400,
  151. MPP_CHROMA_410,
  152. MPP_CHROMA_411,
  153. MPP_CHROMA_420,
  154. MPP_CHROMA_422,
  155. MPP_CHROMA_440,
  156. MPP_CHROMA_444,
  157. } MppFrameChromaFormat;
  158. /*
  159. * MppFrameFormat bit flag:
  160. *
  161. * +-----------------------------------------------+
  162. * | 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
  163. * +-----------------------------------------------+
  164. * bit 0 ~ 15: YUV / RGB format value
  165. * bit 16 ~ 19: YUV / RGB flag 0 - YUV; 1 - RGB;
  166. * bit 20 ~ 23: Frame Buffer Compression (FBC) flag, 0 - No FBC; 1 - FBCv1; 2 - FBCv2;
  167. * bit 24 : Big / little end flag, 0 - big end; 1 - little end;
  168. * bit 25 : Tile format flag, 0 - No tile; 1 - tile format;
  169. * bit 26 ~ 27: High Dynamic Range (HDR) flag, 0 - Standard Dynamic Range (SDR); 1 - HDR;
  170. *
  171. * NOTE: FBC format and tile format can not exist at the same time.
  172. */
  173. #define MPP_FRAME_FMT_MASK (0x000fffff)
  174. #define MPP_FRAME_FMT_PROP_MASK (0x0ff00000)
  175. #define MPP_FRAME_FMT_COLOR_MASK (0x000f0000)
  176. #define MPP_FRAME_FMT_YUV (0x00000000)
  177. #define MPP_FRAME_FMT_RGB (0x00010000)
  178. #define MPP_FRAME_FBC_MASK (0x00f00000)
  179. #define MPP_FRAME_FBC_NONE (0x00000000)
  180. #define MPP_FRAME_HDR_MASK (0x0c000000)
  181. #define MPP_FRAME_HDR_NONE (0x00000000)
  182. #define MPP_FRAME_HDR (0x04000000)
  183. #define MPP_FRAME_TILE_FLAG (0x02000000)
  184. /*
  185. * AFBC_V1 is for ISP output.
  186. * It has default payload offset to be calculated * from width and height:
  187. * Payload offset = MPP_ALIGN(MPP_ALIGN(width, 16) * MPP_ALIGN(height, 16) / 16, SZ_4K)
  188. */
  189. #define MPP_FRAME_FBC_AFBC_V1 (0x00100000)
  190. /*
  191. * AFBC_V2 is for video decoder output.
  192. * It stores payload offset in first 32-bit in header address
  193. * Payload offset is always set to zero.
  194. */
  195. #define MPP_FRAME_FBC_AFBC_V2 (0x00200000)
  196. /*
  197. * RKFBC is for video decoder output and video encoder Input.
  198. * It has default header stride to be calculated * from width and height:
  199. * Header stride = MPP_ALIGN(width, 64) / 64 * 16
  200. * Payload offset is always set to zero.
  201. */
  202. #define MPP_FRAME_FBC_RKFBC (0x00400000)
  203. #define MPP_FRAME_FMT_LE_MASK (0x01000000)
  204. #define MPP_FRAME_FMT_IS_YUV(fmt) (((fmt & MPP_FRAME_FMT_COLOR_MASK) == MPP_FRAME_FMT_YUV) && \
  205. ((fmt & MPP_FRAME_FMT_MASK) < MPP_FMT_YUV_BUTT))
  206. #define MPP_FRAME_FMT_IS_YUV_10BIT(fmt) ((fmt & MPP_FRAME_FMT_MASK) == MPP_FMT_YUV420SP_10BIT || \
  207. (fmt & MPP_FRAME_FMT_MASK) == MPP_FMT_YUV422SP_10BIT || \
  208. (fmt & MPP_FRAME_FMT_MASK) == MPP_FMT_YUV444SP_10BIT)
  209. #define MPP_FRAME_FMT_IS_RGB(fmt) (((fmt & MPP_FRAME_FMT_COLOR_MASK) == MPP_FRAME_FMT_RGB) && \
  210. ((fmt & MPP_FRAME_FMT_MASK) < MPP_FMT_RGB_BUTT))
  211. /*
  212. * For MPP_FRAME_FBC_AFBC_V1 the 16byte aligned stride is used.
  213. */
  214. #define MPP_FRAME_FMT_IS_FBC(fmt) (fmt & MPP_FRAME_FBC_MASK)
  215. #define MPP_FRAME_FMT_IS_RKFBC(fmt) (fmt & MPP_FRAME_FBC_RKFBC)
  216. #define MPP_FRAME_FMT_IS_HDR(fmt) (fmt & MPP_FRAME_HDR_MASK)
  217. #define MPP_FRAME_FMT_IS_LE(fmt) ((fmt & MPP_FRAME_FMT_LE_MASK) == MPP_FRAME_FMT_LE_MASK)
  218. #define MPP_FRAME_FMT_IS_BE(fmt) ((fmt & MPP_FRAME_FMT_LE_MASK) == 0)
  219. #define MPP_FRAME_FMT_IS_TILE(fmt) (fmt & MPP_FRAME_TILE_FLAG)
  220. /* mpp color format index definition */
  221. typedef enum {
  222. MPP_FMT_YUV420SP = (MPP_FRAME_FMT_YUV + 0), /* YYYY... UV... (NV12) */
  223. /*
  224. * A rockchip specific pixel format, without gap between pixel against
  225. * the P010_10LE/P010_10BE
  226. */
  227. MPP_FMT_YUV420SP_10BIT = (MPP_FRAME_FMT_YUV + 1),
  228. MPP_FMT_YUV422SP = (MPP_FRAME_FMT_YUV + 2), /* YYYY... UVUV... (NV16) */
  229. MPP_FMT_YUV422SP_10BIT = (MPP_FRAME_FMT_YUV + 3), ///< Not part of ABI
  230. MPP_FMT_YUV420P = (MPP_FRAME_FMT_YUV + 4), /* YYYY... U...V... (I420) */
  231. MPP_FMT_YUV420SP_VU = (MPP_FRAME_FMT_YUV + 5), /* YYYY... VUVUVU... (NV21) */
  232. MPP_FMT_YUV422P = (MPP_FRAME_FMT_YUV + 6), /* YYYY... UU...VV...(422P) */
  233. MPP_FMT_YUV422SP_VU = (MPP_FRAME_FMT_YUV + 7), /* YYYY... VUVUVU... (NV61) */
  234. MPP_FMT_YUV422_YUYV = (MPP_FRAME_FMT_YUV + 8), /* YUYVYUYV... (YUY2) */
  235. MPP_FMT_YUV422_YVYU = (MPP_FRAME_FMT_YUV + 9), /* YVYUYVYU... (YVY2) */
  236. MPP_FMT_YUV422_UYVY = (MPP_FRAME_FMT_YUV + 10), /* UYVYUYVY... (UYVY) */
  237. MPP_FMT_YUV422_VYUY = (MPP_FRAME_FMT_YUV + 11), /* VYUYVYUY... (VYUY) */
  238. MPP_FMT_YUV400 = (MPP_FRAME_FMT_YUV + 12), /* YYYY... */
  239. MPP_FMT_YUV440SP = (MPP_FRAME_FMT_YUV + 13), /* YYYY... UVUV... */
  240. MPP_FMT_YUV411SP = (MPP_FRAME_FMT_YUV + 14), /* YYYY... UV... */
  241. MPP_FMT_YUV444SP = (MPP_FRAME_FMT_YUV + 15), /* YYYY... UVUVUVUV... */
  242. MPP_FMT_YUV444P = (MPP_FRAME_FMT_YUV + 16), /* YYYY... UUUU... VVVV... */
  243. MPP_FMT_YUV444SP_10BIT = (MPP_FRAME_FMT_YUV + 17),
  244. MPP_FMT_AYUV2BPP = (MPP_FRAME_FMT_YUV + 18), /* YYYY... UVUVUVUV... */
  245. MPP_FMT_AYUV1BPP = (MPP_FRAME_FMT_YUV + 19),
  246. MPP_FMT_YUV_BUTT,
  247. MPP_FMT_RGB565 = (MPP_FRAME_FMT_RGB + 0), /* 16-bit RGB */
  248. MPP_FMT_BGR565 = (MPP_FRAME_FMT_RGB + 1), /* 16-bit RGB */
  249. MPP_FMT_RGB555 = (MPP_FRAME_FMT_RGB + 2), /* 15-bit RGB */
  250. MPP_FMT_BGR555 = (MPP_FRAME_FMT_RGB + 3), /* 15-bit RGB */
  251. MPP_FMT_RGB444 = (MPP_FRAME_FMT_RGB + 4), /* 12-bit RGB */
  252. MPP_FMT_BGR444 = (MPP_FRAME_FMT_RGB + 5), /* 12-bit RGB */
  253. MPP_FMT_RGB888 = (MPP_FRAME_FMT_RGB + 6), /* 24-bit RGB */
  254. MPP_FMT_BGR888 = (MPP_FRAME_FMT_RGB + 7), /* 24-bit RGB */
  255. MPP_FMT_RGB101010 = (MPP_FRAME_FMT_RGB + 8), /* 30-bit RGB */
  256. MPP_FMT_BGR101010 = (MPP_FRAME_FMT_RGB + 9), /* 30-bit RGB */
  257. MPP_FMT_ARGB8888 = (MPP_FRAME_FMT_RGB + 10), /* 32-bit RGB */
  258. MPP_FMT_ABGR8888 = (MPP_FRAME_FMT_RGB + 11), /* 32-bit RGB */
  259. MPP_FMT_BGRA8888 = (MPP_FRAME_FMT_RGB + 12), /* 32-bit RGB */
  260. MPP_FMT_RGBA8888 = (MPP_FRAME_FMT_RGB + 13), /* 32-bit RGB */
  261. MPP_FMT_ARGB4444 = (MPP_FRAME_FMT_RGB + 14), /* 16-bit RGB */
  262. MPP_FMT_ARGB1555 = (MPP_FRAME_FMT_RGB + 15), /* 2-bit RGB */
  263. MPP_FMT_RGB_BUTT,
  264. MPP_FMT_BUTT,
  265. } MppFrameFormat;
  266. /**
  267. * Rational number (pair of numerator and denominator).
  268. */
  269. typedef struct MppFrameRational {
  270. RK_S32 num; ///< Numerator
  271. RK_S32 den; ///< Denominator
  272. } MppFrameRational;
  273. typedef struct MppFrameMasteringDisplayMetadata {
  274. RK_U16 display_primaries[3][2];
  275. RK_U16 white_point[2];
  276. RK_U32 max_luminance;
  277. RK_U32 min_luminance;
  278. } MppFrameMasteringDisplayMetadata;
  279. typedef struct MppFrameContentLightMetadata {
  280. RK_U16 MaxCLL;
  281. RK_U16 MaxFALL;
  282. } MppFrameContentLightMetadata;
  283. typedef struct MppFrameHdrDynamicMeta {
  284. RK_U32 hdr_fmt;
  285. RK_U32 size;
  286. RK_U8 data[];
  287. } MppFrameHdrDynamicMeta;
  288. typedef enum MppFrameError {
  289. /* General error not specified */
  290. MPP_FRAME_ERR_UNKNOW = 0x0001,
  291. /* Critical error for decoder not support error */
  292. MPP_FRAME_ERR_UNSUPPORT = 0x0002,
  293. /*
  294. * Fatal error for decoder can not parse a valid frame for hardware.
  295. * the pixel data is all invalid.
  296. */
  297. MPP_FRAME_ERR_DEC_INVALID = 0x0010,
  298. /*
  299. * Normal error for decoder found hardware error on decoding.
  300. */
  301. MPP_FRAME_ERR_DEC_HW_ERR = 0x0100,
  302. /*
  303. * Normal error for decoder found missing reference frame on decoding.
  304. */
  305. MPP_FRAME_ERR_DEC_MISS_REF = 0x0200,
  306. } MppFrameError;
  307. typedef enum {
  308. MPP_FRAME_THUMBNAIL_NONE,
  309. MPP_FRAME_THUMBNAIL_MIXED,
  310. MPP_FRAME_THUMBNAIL_ONLY,
  311. } MppFrameThumbnailMode;
  312. #ifdef __cplusplus
  313. extern "C" {
  314. #endif
  315. /*
  316. * MppFrame interface
  317. */
  318. MPP_RET mpp_frame_init(MppFrame *frame);
  319. MPP_RET mpp_frame_deinit(MppFrame *frame);
  320. /*
  321. * normal parameter
  322. *
  323. * offset_x
  324. * <-------->
  325. *
  326. * <---------------+ hor_stride +--------------->
  327. *
  328. * +------------------------------------------------------+ ^ ^
  329. * | | | |
  330. * | | | | offset_y
  331. * | | | |
  332. * | +--------------------------------+ ^ | | v
  333. * | | | | | |
  334. * | | | + | +
  335. * | | | |
  336. * | | valid data area | height | ver_stride
  337. * | | | |
  338. * | | | + | +
  339. * | | | | | |
  340. * | +--------------------------------+ v | |
  341. * | | |
  342. * | <----------+ width +---------> | |
  343. * | | |
  344. * +------------------------------------------------------+ v
  345. *
  346. */
  347. RK_U32 mpp_frame_get_width(const MppFrame frame);
  348. void mpp_frame_set_width(MppFrame frame, RK_U32 width);
  349. RK_U32 mpp_frame_get_height(const MppFrame frame);
  350. void mpp_frame_set_height(MppFrame frame, RK_U32 height);
  351. RK_U32 mpp_frame_get_hor_stride(const MppFrame frame);
  352. void mpp_frame_set_hor_stride(MppFrame frame, RK_U32 hor_stride);
  353. RK_U32 mpp_frame_get_ver_stride(const MppFrame frame);
  354. void mpp_frame_set_ver_stride(MppFrame frame, RK_U32 ver_stride);
  355. void mpp_frame_set_hor_stride_pixel(MppFrame frame, RK_U32 hor_stride_pixel);
  356. RK_U32 mpp_frame_get_hor_stride_pixel(const MppFrame frame);
  357. void mpp_frame_set_fbc_hdr_stride(MppFrame frame, RK_U32 fbc_hdr_stride);
  358. RK_U32 mpp_frame_get_fbc_hdr_stride(const MppFrame frame);
  359. RK_U32 mpp_frame_get_offset_x(const MppFrame frame);
  360. void mpp_frame_set_offset_x(MppFrame frame, RK_U32 offset_x);
  361. RK_U32 mpp_frame_get_offset_y(const MppFrame frame);
  362. void mpp_frame_set_offset_y(MppFrame frame, RK_U32 offset_y);
  363. RK_U32 mpp_frame_get_mode(const MppFrame frame);
  364. void mpp_frame_set_mode(MppFrame frame, RK_U32 mode);
  365. RK_U32 mpp_frame_get_discard(const MppFrame frame);
  366. void mpp_frame_set_discard(MppFrame frame, RK_U32 discard);
  367. RK_U32 mpp_frame_get_viewid(const MppFrame frame);
  368. void mpp_frame_set_viewid(MppFrame frame, RK_U32 viewid);
  369. RK_U32 mpp_frame_get_poc(const MppFrame frame);
  370. void mpp_frame_set_poc(MppFrame frame, RK_U32 poc);
  371. RK_S64 mpp_frame_get_pts(const MppFrame frame);
  372. void mpp_frame_set_pts(MppFrame frame, RK_S64 pts);
  373. RK_S64 mpp_frame_get_dts(const MppFrame frame);
  374. void mpp_frame_set_dts(MppFrame frame, RK_S64 dts);
  375. RK_U32 mpp_frame_get_errinfo(const MppFrame frame);
  376. void mpp_frame_set_errinfo(MppFrame frame, RK_U32 errinfo);
  377. size_t mpp_frame_get_buf_size(const MppFrame frame);
  378. void mpp_frame_set_buf_size(MppFrame frame, size_t buf_size);
  379. void mpp_frame_set_thumbnail_en(MppFrame frame, RK_U32 thumbnail_en);
  380. RK_U32 mpp_frame_get_thumbnail_en(const MppFrame frame);
  381. /*
  382. * flow control parmeter
  383. */
  384. RK_U32 mpp_frame_get_eos(const MppFrame frame);
  385. void mpp_frame_set_eos(MppFrame frame, RK_U32 eos);
  386. RK_U32 mpp_frame_get_info_change(const MppFrame frame);
  387. void mpp_frame_set_info_change(MppFrame frame, RK_U32 info_change);
  388. /*
  389. * buffer parameter
  390. */
  391. MppBuffer mpp_frame_get_buffer(const MppFrame frame);
  392. void mpp_frame_set_buffer(MppFrame frame, MppBuffer buffer);
  393. /*
  394. * meta data parameter
  395. */
  396. RK_S32 mpp_frame_has_meta(const MppFrame frame);
  397. MppMeta mpp_frame_get_meta(const MppFrame frame);
  398. void mpp_frame_set_meta(MppFrame frame, MppMeta meta);
  399. /*
  400. * color related parameter
  401. */
  402. MppFrameColorRange mpp_frame_get_color_range(const MppFrame frame);
  403. void mpp_frame_set_color_range(MppFrame frame, MppFrameColorRange color_range);
  404. MppFrameColorPrimaries mpp_frame_get_color_primaries(const MppFrame frame);
  405. void mpp_frame_set_color_primaries(MppFrame frame, MppFrameColorPrimaries color_primaries);
  406. MppFrameColorTransferCharacteristic mpp_frame_get_color_trc(const MppFrame frame);
  407. void mpp_frame_set_color_trc(MppFrame frame, MppFrameColorTransferCharacteristic color_trc);
  408. MppFrameColorSpace mpp_frame_get_colorspace(const MppFrame frame);
  409. void mpp_frame_set_colorspace(MppFrame frame, MppFrameColorSpace colorspace);
  410. MppFrameChromaLocation mpp_frame_get_chroma_location(const MppFrame frame);
  411. void mpp_frame_set_chroma_location(MppFrame frame, MppFrameChromaLocation chroma_location);
  412. MppFrameFormat mpp_frame_get_fmt(MppFrame frame);
  413. void mpp_frame_set_fmt(MppFrame frame, MppFrameFormat fmt);
  414. MppFrameRational mpp_frame_get_sar(const MppFrame frame);
  415. void mpp_frame_set_sar(MppFrame frame, MppFrameRational sar);
  416. MppFrameMasteringDisplayMetadata mpp_frame_get_mastering_display(const MppFrame frame);
  417. void mpp_frame_set_mastering_display(MppFrame frame, MppFrameMasteringDisplayMetadata mastering_display);
  418. MppFrameContentLightMetadata mpp_frame_get_content_light(const MppFrame frame);
  419. void mpp_frame_set_content_light(MppFrame frame, MppFrameContentLightMetadata content_light);
  420. MppFrameHdrDynamicMeta* mpp_frame_get_hdr_dynamic_meta(const MppFrame frame);
  421. void mpp_frame_set_hdr_dynamic_meta(MppFrame frame, MppFrameHdrDynamicMeta *vivi_data);
  422. /*
  423. * HDR parameter
  424. */
  425. #ifdef __cplusplus
  426. }
  427. #endif
  428. #endif /*__MPP_FRAME_H__*/