13d0407baSopenharmony_ci/*
23d0407baSopenharmony_ci * Copyright 2015 Rockchip Electronics Co. LTD
33d0407baSopenharmony_ci *
43d0407baSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
53d0407baSopenharmony_ci * you may not use this file except in compliance with the License.
63d0407baSopenharmony_ci * You may obtain a copy of the License at
73d0407baSopenharmony_ci *
83d0407baSopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
93d0407baSopenharmony_ci *
103d0407baSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
113d0407baSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
123d0407baSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133d0407baSopenharmony_ci * See the License for the specific language governing permissions and
143d0407baSopenharmony_ci * limitations under the License.
153d0407baSopenharmony_ci */
163d0407baSopenharmony_ci
173d0407baSopenharmony_ci#ifndef __MPP_FRAME_H__
183d0407baSopenharmony_ci#define __MPP_FRAME_H__
193d0407baSopenharmony_ci
203d0407baSopenharmony_ci#include "mpp_buffer.h"
213d0407baSopenharmony_ci#include "mpp_meta.h"
223d0407baSopenharmony_ci
233d0407baSopenharmony_ci/*
243d0407baSopenharmony_ci * bit definition for mode flag in MppFrame
253d0407baSopenharmony_ci */
263d0407baSopenharmony_ci/* progressive frame */
273d0407baSopenharmony_ci#define MPP_FRAME_FLAG_FRAME            (0x00000000)
283d0407baSopenharmony_ci/* top field only */
293d0407baSopenharmony_ci#define MPP_FRAME_FLAG_TOP_FIELD        (0x00000001)
303d0407baSopenharmony_ci/* bottom field only */
313d0407baSopenharmony_ci#define MPP_FRAME_FLAG_BOT_FIELD        (0x00000002)
323d0407baSopenharmony_ci/* paired field */
333d0407baSopenharmony_ci#define MPP_FRAME_FLAG_PAIRED_FIELD     (MPP_FRAME_FLAG_TOP_FIELD|MPP_FRAME_FLAG_BOT_FIELD)
343d0407baSopenharmony_ci/* paired field with field order of top first */
353d0407baSopenharmony_ci#define MPP_FRAME_FLAG_TOP_FIRST        (0x00000004)
363d0407baSopenharmony_ci/* paired field with field order of bottom first */
373d0407baSopenharmony_ci#define MPP_FRAME_FLAG_BOT_FIRST        (0x00000008)
383d0407baSopenharmony_ci/* paired field with unknown field order (MBAFF) */
393d0407baSopenharmony_ci#define MPP_FRAME_FLAG_DEINTERLACED     (MPP_FRAME_FLAG_TOP_FIRST|MPP_FRAME_FLAG_BOT_FIRST)
403d0407baSopenharmony_ci#define MPP_FRAME_FLAG_FIELD_ORDER_MASK (0x0000000C)
413d0407baSopenharmony_ci// for multiview stream
423d0407baSopenharmony_ci#define MPP_FRAME_FLAG_VIEW_ID_MASK     (0x000000f0)
433d0407baSopenharmony_ci
443d0407baSopenharmony_ci#define MPP_FRAME_FLAG_IEP_DEI_MASK     (0x00000f00)
453d0407baSopenharmony_ci#define MPP_FRAME_FLAG_IEP_DEI_I2O1     (0x00000100)
463d0407baSopenharmony_ci#define MPP_FRAME_FLAG_IEP_DEI_I4O2     (0x00000200)
473d0407baSopenharmony_ci#define MPP_FRAME_FLAG_IEP_DEI_I4O1     (0x00000300)
483d0407baSopenharmony_ci
493d0407baSopenharmony_ci/*
503d0407baSopenharmony_ci * MPEG vs JPEG YUV range.
513d0407baSopenharmony_ci */
523d0407baSopenharmony_citypedef enum {
533d0407baSopenharmony_ci    MPP_FRAME_RANGE_UNSPECIFIED = 0,
543d0407baSopenharmony_ci    MPP_FRAME_RANGE_MPEG        = 1,    ///< the normal 219*2^(n-8) "MPEG" YUV ranges
553d0407baSopenharmony_ci    MPP_FRAME_RANGE_JPEG        = 2,    ///< the normal     2^n-1   "JPEG" YUV ranges
563d0407baSopenharmony_ci    MPP_FRAME_RANGE_NB,                 ///< Not part of ABI
573d0407baSopenharmony_ci} MppFrameColorRange;
583d0407baSopenharmony_ci
593d0407baSopenharmony_citypedef enum {
603d0407baSopenharmony_ci    MPP_FRAME_VIDEO_FMT_COMPONEMT   = 0,
613d0407baSopenharmony_ci    MPP_FRAME_VIDEO_FMT_PAL         = 1,
623d0407baSopenharmony_ci    MPP_FRAME_VIDEO_FMT_NTSC        = 2,
633d0407baSopenharmony_ci    MPP_FRAME_VIDEO_FMT_SECAM       = 3,
643d0407baSopenharmony_ci    MPP_FRAME_VIDEO_FMT_MAC         = 4,
653d0407baSopenharmony_ci    MPP_FRAME_VIDEO_FMT_UNSPECIFIED = 5,
663d0407baSopenharmony_ci    MPP_FRAME_VIDEO_FMT_RESERVED0   = 6,
673d0407baSopenharmony_ci    MPP_FRAME_VIDEO_FMT_RESERVED1   = 7,
683d0407baSopenharmony_ci} MppFrameVideoFormat;
693d0407baSopenharmony_ci
703d0407baSopenharmony_ci/*
713d0407baSopenharmony_ci * Chromaticity coordinates of the source primaries.
723d0407baSopenharmony_ci */
733d0407baSopenharmony_citypedef enum {
743d0407baSopenharmony_ci    MPP_FRAME_PRI_RESERVED0     = 0,
753d0407baSopenharmony_ci    MPP_FRAME_PRI_BT709         = 1,    ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
763d0407baSopenharmony_ci    MPP_FRAME_PRI_UNSPECIFIED   = 2,
773d0407baSopenharmony_ci    MPP_FRAME_PRI_RESERVED      = 3,
783d0407baSopenharmony_ci    MPP_FRAME_PRI_BT470M        = 4,    ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
793d0407baSopenharmony_ci
803d0407baSopenharmony_ci    MPP_FRAME_PRI_BT470BG       = 5,    ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
813d0407baSopenharmony_ci    MPP_FRAME_PRI_SMPTE170M     = 6,    ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
823d0407baSopenharmony_ci    MPP_FRAME_PRI_SMPTE240M     = 7,    ///< functionally identical to above
833d0407baSopenharmony_ci    MPP_FRAME_PRI_FILM          = 8,    ///< colour filters using Illuminant C
843d0407baSopenharmony_ci    MPP_FRAME_PRI_BT2020        = 9,    ///< ITU-R BT2020
853d0407baSopenharmony_ci    MPP_FRAME_PRI_SMPTEST428_1  = 10,   ///< SMPTE ST 428-1 (CIE 1931 XYZ)
863d0407baSopenharmony_ci    MPP_FRAME_PRI_SMPTE431      = 11,   ///< SMPTE ST 431-2 (2011) / DCI P3
873d0407baSopenharmony_ci    MPP_FRAME_PRI_SMPTE432      = 12,   ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
883d0407baSopenharmony_ci    MPP_FRAME_PRI_JEDEC_P22     = 22,   ///< JEDEC P22 phosphors
893d0407baSopenharmony_ci    MPP_FRAME_PRI_NB,                   ///< Not part of ABI
903d0407baSopenharmony_ci} MppFrameColorPrimaries;
913d0407baSopenharmony_ci
923d0407baSopenharmony_ci/*
933d0407baSopenharmony_ci * Color Transfer Characteristic.
943d0407baSopenharmony_ci */
953d0407baSopenharmony_citypedef enum {
963d0407baSopenharmony_ci    MPP_FRAME_TRC_RESERVED0    = 0,
973d0407baSopenharmony_ci    MPP_FRAME_TRC_BT709        = 1,     ///< also ITU-R BT1361
983d0407baSopenharmony_ci    MPP_FRAME_TRC_UNSPECIFIED  = 2,
993d0407baSopenharmony_ci    MPP_FRAME_TRC_RESERVED     = 3,
1003d0407baSopenharmony_ci    MPP_FRAME_TRC_GAMMA22      = 4,     ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
1013d0407baSopenharmony_ci    MPP_FRAME_TRC_GAMMA28      = 5,     ///< also ITU-R BT470BG
1023d0407baSopenharmony_ci    MPP_FRAME_TRC_SMPTE170M    = 6,     ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
1033d0407baSopenharmony_ci    MPP_FRAME_TRC_SMPTE240M    = 7,
1043d0407baSopenharmony_ci    MPP_FRAME_TRC_LINEAR       = 8,     ///< "Linear transfer characteristics"
1053d0407baSopenharmony_ci    MPP_FRAME_TRC_LOG          = 9,     ///< "Logarithmic transfer characteristic (100:1 range)"
1063d0407baSopenharmony_ci    MPP_FRAME_TRC_LOG_SQRT     = 10,    ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
1073d0407baSopenharmony_ci    MPP_FRAME_TRC_IEC61966_2_4 = 11,    ///< IEC 61966-2-4
1083d0407baSopenharmony_ci    MPP_FRAME_TRC_BT1361_ECG   = 12,    ///< ITU-R BT1361 Extended Colour Gamut
1093d0407baSopenharmony_ci    MPP_FRAME_TRC_IEC61966_2_1 = 13,    ///< IEC 61966-2-1 (sRGB or sYCC)
1103d0407baSopenharmony_ci    MPP_FRAME_TRC_BT2020_10    = 14,    ///< ITU-R BT2020 for 10 bit system
1113d0407baSopenharmony_ci    MPP_FRAME_TRC_BT2020_12    = 15,    ///< ITU-R BT2020 for 12 bit system
1123d0407baSopenharmony_ci    MPP_FRAME_TRC_SMPTEST2084  = 16,    ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
1133d0407baSopenharmony_ci    MPP_FRAME_TRC_SMPTEST428_1 = 17,    ///< SMPTE ST 428-1
1143d0407baSopenharmony_ci    MPP_FRAME_TRC_ARIB_STD_B67 = 18,    ///< ARIB STD-B67, known as "Hybrid log-gamma"
1153d0407baSopenharmony_ci    MPP_FRAME_TRC_NB,                   ///< Not part of ABI
1163d0407baSopenharmony_ci} MppFrameColorTransferCharacteristic;
1173d0407baSopenharmony_ci
1183d0407baSopenharmony_ci/*
1193d0407baSopenharmony_ci * YUV colorspace type.
1203d0407baSopenharmony_ci */
1213d0407baSopenharmony_citypedef enum {
1223d0407baSopenharmony_ci    MPP_FRAME_SPC_RGB         = 0,      ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
1233d0407baSopenharmony_ci    MPP_FRAME_SPC_BT709       = 1,      ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
1243d0407baSopenharmony_ci    MPP_FRAME_SPC_UNSPECIFIED = 2,
1253d0407baSopenharmony_ci    MPP_FRAME_SPC_RESERVED    = 3,
1263d0407baSopenharmony_ci    MPP_FRAME_SPC_FCC         = 4,      ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
1273d0407baSopenharmony_ci    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
1283d0407baSopenharmony_ci    MPP_FRAME_SPC_SMPTE170M   = 6,      ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
1293d0407baSopenharmony_ci    MPP_FRAME_SPC_SMPTE240M   = 7,
1303d0407baSopenharmony_ci    MPP_FRAME_SPC_YCOCG       = 8,      ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
1313d0407baSopenharmony_ci    MPP_FRAME_SPC_BT2020_NCL  = 9,      ///< ITU-R BT2020 non-constant luminance system
1323d0407baSopenharmony_ci    MPP_FRAME_SPC_BT2020_CL   = 10,     ///< ITU-R BT2020 constant luminance system
1333d0407baSopenharmony_ci    MPP_FRAME_SPC_SMPTE2085   = 11,     ///< SMPTE 2085, Y'D'zD'x
1343d0407baSopenharmony_ci    MPP_FRAME_SPC_CHROMA_DERIVED_NCL = 12,  ///< Chromaticity-derived non-constant luminance system
1353d0407baSopenharmony_ci    MPP_FRAME_SPC_CHROMA_DERIVED_CL = 13,   ///< Chromaticity-derived constant luminance system
1363d0407baSopenharmony_ci    MPP_FRAME_SPC_ICTCP       = 14,     ///< ITU-R BT.2100-0, ICtCp
1373d0407baSopenharmony_ci    MPP_FRAME_SPC_NB,                   ///< Not part of ABI
1383d0407baSopenharmony_ci} MppFrameColorSpace;
1393d0407baSopenharmony_ci
1403d0407baSopenharmony_ci/*
1413d0407baSopenharmony_ci * Location of chroma samples.
1423d0407baSopenharmony_ci *
1433d0407baSopenharmony_ci * Illustration showing the location of the first (top left) chroma sample of the
1443d0407baSopenharmony_ci * image, the left shows only luma, the right
1453d0407baSopenharmony_ci * shows the location of the chroma sample, the 2 could be imagined to overlay
1463d0407baSopenharmony_ci * each other but are drawn separately due to limitations of ASCII
1473d0407baSopenharmony_ci *
1483d0407baSopenharmony_ci *                1st 2nd       1st 2nd horizontal luma sample positions
1493d0407baSopenharmony_ci *                 v   v         v   v
1503d0407baSopenharmony_ci *                 ______        ______
1513d0407baSopenharmony_ci *1st luma line > |X   X ...    |3 4 X ...     X are luma samples,
1523d0407baSopenharmony_ci *                |             |1 2           1-6 are possible chroma positions
1533d0407baSopenharmony_ci *2nd luma line > |X   X ...    |5 6 X ...     0 is undefined/unknown position
1543d0407baSopenharmony_ci */
1553d0407baSopenharmony_citypedef enum {
1563d0407baSopenharmony_ci    MPP_CHROMA_LOC_UNSPECIFIED = 0,
1573d0407baSopenharmony_ci    MPP_CHROMA_LOC_LEFT        = 1,     ///< mpeg2/4 4:2:0, h264 default for 4:2:0
1583d0407baSopenharmony_ci    MPP_CHROMA_LOC_CENTER      = 2,     ///< mpeg1 4:2:0, jpeg 4:2:0, h263 4:2:0
1593d0407baSopenharmony_ci    MPP_CHROMA_LOC_TOPLEFT     = 3,     ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
1603d0407baSopenharmony_ci    MPP_CHROMA_LOC_TOP         = 4,
1613d0407baSopenharmony_ci    MPP_CHROMA_LOC_BOTTOMLEFT  = 5,
1623d0407baSopenharmony_ci    MPP_CHROMA_LOC_BOTTOM      = 6,
1633d0407baSopenharmony_ci    MPP_CHROMA_LOC_NB,                  ///< Not part of ABI
1643d0407baSopenharmony_ci} MppFrameChromaLocation;
1653d0407baSopenharmony_ci
1663d0407baSopenharmony_ci#define MPP_FRAME_FMT_MASK          (0x000fffff)
1673d0407baSopenharmony_ci
1683d0407baSopenharmony_ci#define MPP_FRAME_FMT_COLOR_MASK    (0x000f0000)
1693d0407baSopenharmony_ci#define MPP_FRAME_FMT_YUV           (0x00000000)
1703d0407baSopenharmony_ci#define MPP_FRAME_FMT_RGB           (0x00010000)
1713d0407baSopenharmony_ci
1723d0407baSopenharmony_ci#define MPP_FRAME_FBC_MASK          (0x00f00000)
1733d0407baSopenharmony_ci#define MPP_FRAME_FBC_NONE          (0x00000000)
1743d0407baSopenharmony_ci/*
1753d0407baSopenharmony_ci * AFBC_V1 is for ISP output.
1763d0407baSopenharmony_ci * It has default payload offset to be calculated * from width and height:
1773d0407baSopenharmony_ci * Payload offset = MPP_ALIGN(MPP_ALIGN(width, 16) * MPP_ALIGN(height, 16) / 16, SZ_4K)
1783d0407baSopenharmony_ci */
1793d0407baSopenharmony_ci#define MPP_FRAME_FBC_AFBC_V1       (0x00100000)
1803d0407baSopenharmony_ci/*
1813d0407baSopenharmony_ci * AFBC_V2 is for video decoder output.
1823d0407baSopenharmony_ci * It stores payload offset in first 32-bit in header address
1833d0407baSopenharmony_ci * Payload offset is always set to zero.
1843d0407baSopenharmony_ci */
1853d0407baSopenharmony_ci#define MPP_FRAME_FBC_AFBC_V2       (0x00200000)
1863d0407baSopenharmony_ci
1873d0407baSopenharmony_ci#define MPP_FRAME_FMT_LE_MASK       (0x01000000)
1883d0407baSopenharmony_ci
1893d0407baSopenharmony_ci#define MPP_FRAME_FMT_IS_YUV(fmt)   (((fmt & MPP_FRAME_FMT_COLOR_MASK) == MPP_FRAME_FMT_YUV) && \
1903d0407baSopenharmony_ci                                     ((fmt & MPP_FRAME_FMT_MASK) < MPP_FMT_YUV_BUTT))
1913d0407baSopenharmony_ci#define MPP_FRAME_FMT_IS_RGB(fmt)   (((fmt & MPP_FRAME_FMT_COLOR_MASK) == MPP_FRAME_FMT_RGB) && \
1923d0407baSopenharmony_ci                                     ((fmt & MPP_FRAME_FMT_MASK) < MPP_FMT_RGB_BUTT))
1933d0407baSopenharmony_ci
1943d0407baSopenharmony_ci/*
1953d0407baSopenharmony_ci * For MPP_FRAME_FBC_AFBC_V1 the 16byte aligned stride is used.
1963d0407baSopenharmony_ci */
1973d0407baSopenharmony_ci#define MPP_FRAME_FMT_IS_FBC(fmt)   (fmt & MPP_FRAME_FBC_MASK)
1983d0407baSopenharmony_ci
1993d0407baSopenharmony_ci#define MPP_FRAME_FMT_IS_LE(fmt)    ((fmt & MPP_FRAME_FMT_LE_MASK) == MPP_FRAME_FMT_LE_MASK)
2003d0407baSopenharmony_ci#define MPP_FRAME_FMT_IS_BE(fmt)    ((fmt & MPP_FRAME_FMT_LE_MASK) == 0)
2013d0407baSopenharmony_ci
2023d0407baSopenharmony_ci/* mpp color format index definition */
2033d0407baSopenharmony_citypedef enum {
2043d0407baSopenharmony_ci    MPP_FMT_YUV420SP        = (MPP_FRAME_FMT_YUV + 0),  /* YYYY... UV... (NV12)     */
2053d0407baSopenharmony_ci    /*
2063d0407baSopenharmony_ci     * A rockchip specific pixel format, without gap between pixel aganist
2073d0407baSopenharmony_ci     * the P010_10LE/P010_10BE
2083d0407baSopenharmony_ci     */
2093d0407baSopenharmony_ci    MPP_FMT_YUV420SP_10BIT  = (MPP_FRAME_FMT_YUV + 1),
2103d0407baSopenharmony_ci    MPP_FMT_YUV422SP        = (MPP_FRAME_FMT_YUV + 2),  /* YYYY... UVUV... (NV16)   */
2113d0407baSopenharmony_ci    MPP_FMT_YUV422SP_10BIT  = (MPP_FRAME_FMT_YUV + 3),  ///< Not part of ABI
2123d0407baSopenharmony_ci    MPP_FMT_YUV420P         = (MPP_FRAME_FMT_YUV + 4),  /* YYYY... U...V...  (I420) */
2133d0407baSopenharmony_ci    MPP_FMT_YUV420SP_VU     = (MPP_FRAME_FMT_YUV + 5),  /* YYYY... VUVUVU... (NV21) */
2143d0407baSopenharmony_ci    MPP_FMT_YUV422P         = (MPP_FRAME_FMT_YUV + 6),  /* YYYY... UU...VV...(422P) */
2153d0407baSopenharmony_ci    MPP_FMT_YUV422SP_VU     = (MPP_FRAME_FMT_YUV + 7),  /* YYYY... VUVUVU... (NV61) */
2163d0407baSopenharmony_ci    MPP_FMT_YUV422_YUYV     = (MPP_FRAME_FMT_YUV + 8),  /* YUYVYUYV... (YUY2)       */
2173d0407baSopenharmony_ci    MPP_FMT_YUV422_YVYU     = (MPP_FRAME_FMT_YUV + 9),  /* YVYUYVYU... (YVY2)       */
2183d0407baSopenharmony_ci    MPP_FMT_YUV422_UYVY     = (MPP_FRAME_FMT_YUV + 10), /* UYVYUYVY... (UYVY)       */
2193d0407baSopenharmony_ci    MPP_FMT_YUV422_VYUY     = (MPP_FRAME_FMT_YUV + 11), /* VYUYVYUY... (VYUY)       */
2203d0407baSopenharmony_ci    MPP_FMT_YUV400          = (MPP_FRAME_FMT_YUV + 12), /* YYYY...                  */
2213d0407baSopenharmony_ci    MPP_FMT_YUV440SP        = (MPP_FRAME_FMT_YUV + 13), /* YYYY... UVUV...          */
2223d0407baSopenharmony_ci    MPP_FMT_YUV411SP        = (MPP_FRAME_FMT_YUV + 14), /* YYYY... UV...            */
2233d0407baSopenharmony_ci    MPP_FMT_YUV444SP        = (MPP_FRAME_FMT_YUV + 15), /* YYYY... UVUVUVUV...      */
2243d0407baSopenharmony_ci    MPP_FMT_YUV444P         = (MPP_FRAME_FMT_YUV + 16), /* YYYY... UUUU... VVVV...  */
2253d0407baSopenharmony_ci    MPP_FMT_YUV_BUTT,
2263d0407baSopenharmony_ci
2273d0407baSopenharmony_ci    MPP_FMT_RGB565          = (MPP_FRAME_FMT_RGB + 0),  /* 16-bit RGB               */
2283d0407baSopenharmony_ci    MPP_FMT_BGR565          = (MPP_FRAME_FMT_RGB + 1),  /* 16-bit RGB               */
2293d0407baSopenharmony_ci    MPP_FMT_RGB555          = (MPP_FRAME_FMT_RGB + 2),  /* 15-bit RGB               */
2303d0407baSopenharmony_ci    MPP_FMT_BGR555          = (MPP_FRAME_FMT_RGB + 3),  /* 15-bit RGB               */
2313d0407baSopenharmony_ci    MPP_FMT_RGB444          = (MPP_FRAME_FMT_RGB + 4),  /* 12-bit RGB               */
2323d0407baSopenharmony_ci    MPP_FMT_BGR444          = (MPP_FRAME_FMT_RGB + 5),  /* 12-bit RGB               */
2333d0407baSopenharmony_ci    MPP_FMT_RGB888          = (MPP_FRAME_FMT_RGB + 6),  /* 24-bit RGB               */
2343d0407baSopenharmony_ci    MPP_FMT_BGR888          = (MPP_FRAME_FMT_RGB + 7),  /* 24-bit RGB               */
2353d0407baSopenharmony_ci    MPP_FMT_RGB101010       = (MPP_FRAME_FMT_RGB + 8),  /* 30-bit RGB               */
2363d0407baSopenharmony_ci    MPP_FMT_BGR101010       = (MPP_FRAME_FMT_RGB + 9),  /* 30-bit RGB               */
2373d0407baSopenharmony_ci    MPP_FMT_ARGB8888        = (MPP_FRAME_FMT_RGB + 10), /* 32-bit RGB               */
2383d0407baSopenharmony_ci    MPP_FMT_ABGR8888        = (MPP_FRAME_FMT_RGB + 11), /* 32-bit RGB               */
2393d0407baSopenharmony_ci    MPP_FMT_BGRA8888        = (MPP_FRAME_FMT_RGB + 12), /* 32-bit RGB               */
2403d0407baSopenharmony_ci    MPP_FMT_RGBA8888        = (MPP_FRAME_FMT_RGB + 13), /* 32-bit RGB               */
2413d0407baSopenharmony_ci    MPP_FMT_RGB_BUTT,
2423d0407baSopenharmony_ci
2433d0407baSopenharmony_ci    MPP_FMT_BUTT,
2443d0407baSopenharmony_ci} MppFrameFormat;
2453d0407baSopenharmony_ci
2463d0407baSopenharmony_ci/**
2473d0407baSopenharmony_ci * Rational number (pair of numerator and denominator).
2483d0407baSopenharmony_ci */
2493d0407baSopenharmony_citypedef struct MppFrameRational {
2503d0407baSopenharmony_ci    RK_S32 num; ///< Numerator
2513d0407baSopenharmony_ci    RK_S32 den; ///< Denominator
2523d0407baSopenharmony_ci} MppFrameRational;
2533d0407baSopenharmony_ci
2543d0407baSopenharmony_citypedef struct MppFrameMasteringDisplayMetadata {
2553d0407baSopenharmony_ci    RK_U16 display_primaries[3][2];
2563d0407baSopenharmony_ci    RK_U16 white_point[2];
2573d0407baSopenharmony_ci    RK_U32 max_luminance;
2583d0407baSopenharmony_ci    RK_U32 min_luminance;
2593d0407baSopenharmony_ci} MppFrameMasteringDisplayMetadata;
2603d0407baSopenharmony_ci
2613d0407baSopenharmony_citypedef struct MppFrameContentLightMetadata {
2623d0407baSopenharmony_ci    RK_U16 MaxCLL;
2633d0407baSopenharmony_ci    RK_U16 MaxFALL;
2643d0407baSopenharmony_ci} MppFrameContentLightMetadata;
2653d0407baSopenharmony_ci
2663d0407baSopenharmony_citypedef enum {
2673d0407baSopenharmony_ci    MPP_FRAME_ERR_UNKNOW           = 0x0001,
2683d0407baSopenharmony_ci    MPP_FRAME_ERR_UNSUPPORT        = 0x0002,
2693d0407baSopenharmony_ci} MPP_FRAME_ERR;
2703d0407baSopenharmony_ci
2713d0407baSopenharmony_ci#ifdef __cplusplus
2723d0407baSopenharmony_ciextern "C" {
2733d0407baSopenharmony_ci#endif
2743d0407baSopenharmony_ci
2753d0407baSopenharmony_ci/*
2763d0407baSopenharmony_ci * MppFrame interface
2773d0407baSopenharmony_ci */
2783d0407baSopenharmony_ciMPP_RET mpp_frame_init(MppFrame *frame);
2793d0407baSopenharmony_ciMPP_RET mpp_frame_deinit(MppFrame *frame);
2803d0407baSopenharmony_ci
2813d0407baSopenharmony_ci/*
2823d0407baSopenharmony_ci * normal parameter
2833d0407baSopenharmony_ci *
2843d0407baSopenharmony_ci *    offset_x
2853d0407baSopenharmony_ci *   <-------->
2863d0407baSopenharmony_ci *
2873d0407baSopenharmony_ci *   <---------------+      hor_stride      +--------------->
2883d0407baSopenharmony_ci *
2893d0407baSopenharmony_ci *   +------------------------------------------------------+   ^   ^
2903d0407baSopenharmony_ci *   |                                                      |   |   |
2913d0407baSopenharmony_ci *   |                                                      |   |   | offset_y
2923d0407baSopenharmony_ci *   |                                                      |   |   |
2933d0407baSopenharmony_ci *   |        +--------------------------------+  ^         |   |   v
2943d0407baSopenharmony_ci *   |        |                                |  |         |   |
2953d0407baSopenharmony_ci *   |        |                                |  +         |   +
2963d0407baSopenharmony_ci *   |        |                                |            |
2973d0407baSopenharmony_ci *   |        |        valid data area         | height     | ver_stride
2983d0407baSopenharmony_ci *   |        |                                |            |
2993d0407baSopenharmony_ci *   |        |                                |  +         |   +
3003d0407baSopenharmony_ci *   |        |                                |  |         |   |
3013d0407baSopenharmony_ci *   |        +--------------------------------+  v         |   |
3023d0407baSopenharmony_ci *   |                                                      |   |
3033d0407baSopenharmony_ci *   |        <----------+   width   +--------->            |   |
3043d0407baSopenharmony_ci *   |                                                      |   |
3053d0407baSopenharmony_ci *   +------------------------------------------------------+   v
3063d0407baSopenharmony_ci *
3073d0407baSopenharmony_ci */
3083d0407baSopenharmony_ciRK_U32  mpp_frame_get_width(const MppFrame frame);
3093d0407baSopenharmony_civoid    mpp_frame_set_width(MppFrame frame, RK_U32 width);
3103d0407baSopenharmony_ciRK_U32  mpp_frame_get_height(const MppFrame frame);
3113d0407baSopenharmony_civoid    mpp_frame_set_height(MppFrame frame, RK_U32 height);
3123d0407baSopenharmony_ciRK_U32  mpp_frame_get_hor_stride(const MppFrame frame);
3133d0407baSopenharmony_civoid    mpp_frame_set_hor_stride(MppFrame frame, RK_U32 hor_stride);
3143d0407baSopenharmony_ciRK_U32  mpp_frame_get_ver_stride(const MppFrame frame);
3153d0407baSopenharmony_civoid    mpp_frame_set_ver_stride(MppFrame frame, RK_U32 ver_stride);
3163d0407baSopenharmony_civoid    mpp_frame_set_hor_stride_pixel(MppFrame frame, RK_U32 hor_stride_pixel);
3173d0407baSopenharmony_ciRK_U32  mpp_frame_get_hor_stride_pixel(const MppFrame frame);
3183d0407baSopenharmony_civoid    mpp_frame_set_fbc_hdr_stride(MppFrame frame, RK_U32 fbc_hdr_stride);
3193d0407baSopenharmony_ciRK_U32  mpp_frame_get_fbc_hdr_stride(const MppFrame frame);
3203d0407baSopenharmony_ci
3213d0407baSopenharmony_ciRK_U32  mpp_frame_get_offset_x(const MppFrame frame);
3223d0407baSopenharmony_civoid    mpp_frame_set_offset_x(MppFrame frame, RK_U32 offset_x);
3233d0407baSopenharmony_ciRK_U32  mpp_frame_get_offset_y(const MppFrame frame);
3243d0407baSopenharmony_civoid    mpp_frame_set_offset_y(MppFrame frame, RK_U32 offset_y);
3253d0407baSopenharmony_ciRK_U32  mpp_frame_get_mode(const MppFrame frame);
3263d0407baSopenharmony_civoid    mpp_frame_set_mode(MppFrame frame, RK_U32 mode);
3273d0407baSopenharmony_ciRK_U32  mpp_frame_get_discard(const MppFrame frame);
3283d0407baSopenharmony_civoid    mpp_frame_set_discard(MppFrame frame, RK_U32 discard);
3293d0407baSopenharmony_ciRK_U32  mpp_frame_get_viewid(const MppFrame frame);
3303d0407baSopenharmony_civoid    mpp_frame_set_viewid(MppFrame frame, RK_U32 viewid);
3313d0407baSopenharmony_ciRK_U32  mpp_frame_get_poc(const MppFrame frame);
3323d0407baSopenharmony_civoid    mpp_frame_set_poc(MppFrame frame, RK_U32 poc);
3333d0407baSopenharmony_ciRK_S64  mpp_frame_get_pts(const MppFrame frame);
3343d0407baSopenharmony_civoid    mpp_frame_set_pts(MppFrame frame, RK_S64 pts);
3353d0407baSopenharmony_ciRK_S64  mpp_frame_get_dts(const MppFrame frame);
3363d0407baSopenharmony_civoid    mpp_frame_set_dts(MppFrame frame, RK_S64 dts);
3373d0407baSopenharmony_ciRK_U32  mpp_frame_get_errinfo(const MppFrame frame);
3383d0407baSopenharmony_civoid    mpp_frame_set_errinfo(MppFrame frame, RK_U32 errinfo);
3393d0407baSopenharmony_cisize_t  mpp_frame_get_buf_size(const MppFrame frame);
3403d0407baSopenharmony_civoid    mpp_frame_set_buf_size(MppFrame frame, size_t buf_size);
3413d0407baSopenharmony_ci/*
3423d0407baSopenharmony_ci * flow control parmeter
3433d0407baSopenharmony_ci */
3443d0407baSopenharmony_ciRK_U32  mpp_frame_get_eos(const MppFrame frame);
3453d0407baSopenharmony_civoid    mpp_frame_set_eos(MppFrame frame, RK_U32 eos);
3463d0407baSopenharmony_ciRK_U32  mpp_frame_get_info_change(const MppFrame frame);
3473d0407baSopenharmony_civoid    mpp_frame_set_info_change(MppFrame frame, RK_U32 info_change);
3483d0407baSopenharmony_ci
3493d0407baSopenharmony_ci/*
3503d0407baSopenharmony_ci * buffer parameter
3513d0407baSopenharmony_ci */
3523d0407baSopenharmony_ciMppBuffer mpp_frame_get_buffer(const MppFrame frame);
3533d0407baSopenharmony_civoid    mpp_frame_set_buffer(MppFrame frame, MppBuffer buffer);
3543d0407baSopenharmony_ci
3553d0407baSopenharmony_ci/*
3563d0407baSopenharmony_ci * meta data parameter
3573d0407baSopenharmony_ci */
3583d0407baSopenharmony_ciRK_S32  mpp_frame_has_meta(const MppFrame frame);
3593d0407baSopenharmony_ciMppMeta mpp_frame_get_meta(const MppFrame frame);
3603d0407baSopenharmony_civoid    mpp_frame_set_meta(MppFrame frame, MppMeta meta);
3613d0407baSopenharmony_ci
3623d0407baSopenharmony_ci/*
3633d0407baSopenharmony_ci * color related parameter
3643d0407baSopenharmony_ci */
3653d0407baSopenharmony_ciMppFrameColorRange mpp_frame_get_color_range(const MppFrame frame);
3663d0407baSopenharmony_civoid    mpp_frame_set_color_range(MppFrame frame, MppFrameColorRange color_range);
3673d0407baSopenharmony_ciMppFrameColorPrimaries mpp_frame_get_color_primaries(const MppFrame frame);
3683d0407baSopenharmony_civoid    mpp_frame_set_color_primaries(MppFrame frame, MppFrameColorPrimaries color_primaries);
3693d0407baSopenharmony_ciMppFrameColorTransferCharacteristic mpp_frame_get_color_trc(const MppFrame frame);
3703d0407baSopenharmony_civoid    mpp_frame_set_color_trc(MppFrame frame, MppFrameColorTransferCharacteristic color_trc);
3713d0407baSopenharmony_ciMppFrameColorSpace mpp_frame_get_colorspace(const MppFrame frame);
3723d0407baSopenharmony_civoid    mpp_frame_set_colorspace(MppFrame frame, MppFrameColorSpace colorspace);
3733d0407baSopenharmony_ciMppFrameChromaLocation mpp_frame_get_chroma_location(const MppFrame frame);
3743d0407baSopenharmony_civoid    mpp_frame_set_chroma_location(MppFrame frame, MppFrameChromaLocation chroma_location);
3753d0407baSopenharmony_ciMppFrameFormat mpp_frame_get_fmt(MppFrame frame);
3763d0407baSopenharmony_civoid    mpp_frame_set_fmt(MppFrame frame, MppFrameFormat fmt);
3773d0407baSopenharmony_ciMppFrameRational mpp_frame_get_sar(const MppFrame frame);
3783d0407baSopenharmony_civoid    mpp_frame_set_sar(MppFrame frame, MppFrameRational sar);
3793d0407baSopenharmony_ciMppFrameMasteringDisplayMetadata mpp_frame_get_mastering_display(const MppFrame frame);
3803d0407baSopenharmony_civoid    mpp_frame_set_mastering_display(MppFrame frame, MppFrameMasteringDisplayMetadata mastering_display);
3813d0407baSopenharmony_ciMppFrameContentLightMetadata mpp_frame_get_content_light(const MppFrame frame);
3823d0407baSopenharmony_civoid    mpp_frame_set_content_light(MppFrame frame, MppFrameContentLightMetadata content_light);
3833d0407baSopenharmony_ci
3843d0407baSopenharmony_ci/*
3853d0407baSopenharmony_ci * HDR parameter
3863d0407baSopenharmony_ci */
3873d0407baSopenharmony_ci
3883d0407baSopenharmony_ci#ifdef __cplusplus
3893d0407baSopenharmony_ci}
3903d0407baSopenharmony_ci#endif
3913d0407baSopenharmony_ci
3923d0407baSopenharmony_ci#endif /*__MPP_FRAME_H__*/
393