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