xref: /OK3568_Linux_fs/external/rockit/tgi/sdk/include/RTMediaPixel.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2019 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * author: martin.cheng@rock-chips.com
17  *   date: 20190115
18  *    ref: tmedia/libavutil/pixfmt.h
19  */
20 
21 #ifndef SRC_RT_MEDIA_INCLUDE_RTMEDIAPIXEL_H_
22 #define SRC_RT_MEDIA_INCLUDE_RTMEDIAPIXEL_H_
23 
24 /**
25   * Chromaticity coordinates of the source primaries.
26   * These values match the ones defined by ISO/IEC 23001-8_2013 7.1.
27   */
28 enum RTColorPrimaries {
29     RTCOL_PRI_RESERVED0   = 0,
30     RTCOL_PRI_BT709       = 1,   ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
31     RTCOL_PRI_UNSPECIFIED = 2,
32     RTCOL_PRI_RESERVED    = 3,
33     RTCOL_PRI_BT470M      = 4,   ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
34 
35     RTCOL_PRI_BT470BG     = 5,   ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
36     RTCOL_PRI_SMPTE170M   = 6,   ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
37     RTCOL_PRI_SMPTE240M   = 7,   ///< functionally identical to above
38     RTCOL_PRI_FILM        = 8,   ///< colour filters using Illuminant C
39     RTCOL_PRI_BT2020      = 9,   ///< ITU-R BT2020
40     RTCOL_PRI_SMPTE428    = 10,  ///< SMPTE ST 428-1 (CIE 1931 XYZ)
41     RTCOL_PRI_SMPTEST428_1 = RTCOL_PRI_SMPTE428,
42     RTCOL_PRI_SMPTE431    = 11,  ///< SMPTE ST 431-2 (2011) / DCI P3
43     RTCOL_PRI_SMPTE432    = 12,  ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
44     RTCOL_PRI_JEDEC_P22   = 22,  ///< JEDEC P22 phosphors
45     RTCOL_PRI_MAX                ///< Not part of ABI
46 };
47 
48 /**
49  * Color Transfer Characteristic.
50  * These values match the ones defined by ISO/IEC 23001-8_2013-7.2.
51  */
52 enum RTColorTransfer {
53     RTCOL_TRC_RESERVED0    = 0,
54     RTCOL_TRC_BT709        = 1,   ///< also ITU-R BT1361
55     RTCOL_TRC_UNSPECIFIED  = 2,
56     RTCOL_TRC_RESERVED     = 3,
57     RTCOL_TRC_GAMMA22      = 4,   ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
58     RTCOL_TRC_GAMMA28      = 5,   ///< also ITU-R BT470BG
59     RTCOL_TRC_SMPTE170M    = 6,   ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
60     RTCOL_TRC_SMPTE240M    = 7,
61     RTCOL_TRC_LINEAR       = 8,   ///< "Linear transfer characteristics"
62     RTCOL_TRC_LOG          = 9,   ///< "Logarithmic transfer characteristic (100:1 range)"
63     RTCOL_TRC_LOG_SQRT     = 10,  ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
64     RTCOL_TRC_IEC61966_2_4 = 11,  ///< IEC 61966-2-4
65     RTCOL_TRC_BT1361_ECG   = 12,  ///< ITU-R BT1361 Extended Colour Gamut
66     RTCOL_TRC_IEC61966_2_1 = 13,  ///< IEC 61966-2-1 (sRGB or sYCC)
67     RTCOL_TRC_BT2020_10    = 14,  ///< ITU-R BT2020 for 10-bit system
68     RTCOL_TRC_BT2020_12    = 15,  ///< ITU-R BT2020 for 12-bit system
69     RTCOL_TRC_SMPTE2084    = 16,  ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
70     RTCOL_TRC_SMPTEST2084  = RTCOL_TRC_SMPTE2084,
71     RTCOL_TRC_SMPTE428     = 17,  ///< SMPTE ST 428-1
72     RTCOL_TRC_SMPTEST428_1 = RTCOL_TRC_SMPTE428,
73     RTCOL_TRC_ARIB_STD_B67 = 18,  ///< ARIB STD-B67, known as "Hybrid log-gamma"
74     RTCOL_TRC_MAX                 ///< Not part of ABI
75 };
76 
77 /**
78  * YUV colorspace type.
79  * These values match the ones defined by ISO/IEC 23001-8_2013-7.3.
80  */
81 enum RTColorSpace {
82     RTCOL_SPC_RGB         = 0,  ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
83     RTCOL_SPC_BT709       = 1,  ///< ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
84     RTCOL_SPC_UNSPECIFIED = 2,
85     RTCOL_SPC_RESERVED    = 3,
86     RTCOL_SPC_FCC         = 4,  ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
87     RTCOL_SPC_BT470BG     = 5,  ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601  // NOLINT
88     RTCOL_SPC_SMPTE170M   = 6,  ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
89     RTCOL_SPC_SMPTE240M   = 7,  ///< functionally identical to above
90     RTCOL_SPC_YCGCO       = 8,  ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
91     RTCOL_SPC_YCOCG       = RTCOL_SPC_YCGCO,
92     RTCOL_SPC_BT2020_NCL  = 9,  ///< ITU-R BT2020 non-constant luminance system
93     RTCOL_SPC_BT2020_CL   = 10,  ///< ITU-R BT2020 constant luminance system
94     RTCOL_SPC_SMPTE2085   = 11,  ///< SMPTE 2085, Y'D'zD'x
95     RTCOL_SPC_CHROMA_DERIVED_NCL = 12,  ///< Chromaticity-derived non-constant luminance system
96     RTCOL_SPC_CHROMA_DERIVED_CL  = 13,  ///< Chromaticity-derived constant luminance system
97     RTCOL_SPC_ICTCP       = 14,         ///< ITU-R BT.2100-0, ICtCp
98     RTCOL_SPC_MAX                ///< Not part of ABI
99 };
100 
101 /**
102  * MPEG vs JPEG YUV range.
103  */
104 enum RTColorRange {
105     RTCOL_RANGE_UNSPECIFIED = 0,
106     RTCOL_RANGE_MPEG        = 1,  ///< the normal 219*2^(n-8) "MPEG" YUV ranges
107     RTCOL_RANGE_JPEG        = 2,  ///< the normal     2^n-1   "JPEG" YUV ranges
108     RTCOL_RANGE_MAX               ///< Not part of ABI
109 };
110 
111 /**
112  * Location of chroma samples.
113  *
114  * Illustration showing the location of the first (top left) chroma sample of the
115  * image, the left shows only luma, the right
116  * shows the location of the chroma sample, the 2 could be imagined to overlay
117  * each other but are drawn separately due to limitations of ASCII
118  *
119  *                1st 2nd       1st 2nd horizontal luma sample positions
120  *                 v   v         v   v
121  *                 ______        ______
122  *1st luma line > |X   X ...    |3 4 X ...     X are luma samples,
123  *                |             |1 2           1-6 are possible chroma positions
124  *2nd luma line > |X   X ...    |5 6 X ...     0 is undefined/unknown position
125  */
126 enum RTChromaLocation {
127     RTCHROMA_LOC_UNSPECIFIED = 0,
128     RTCHROMA_LOC_LEFT        = 1,  ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0
129     RTCHROMA_LOC_CENTER      = 2,  ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0
130     RTCHROMA_LOC_TOPLEFT     = 3,  ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
131     RTCHROMA_LOC_TOP         = 4,
132     RTCHROMA_LOC_BOTTOMLEFT  = 5,
133     RTCHROMA_LOC_BOTTOM      = 6,
134     RTCHROMA_LOC_MAX              ///< Not part of ABI
135 };
136 
137 #endif  // SRC_RT_MEDIA_INCLUDE_RTMEDIAPIXEL_H_
138