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