1 /*****************************************************************************
2 * color_config.h: ISO/IEC 23001-8:2016 color mappings
3 *****************************************************************************
4 * Copyright (C) 2018 VideoLabs, VLC authors and VideoLAN
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
20 #ifndef VLC_MP4_COLOR_CONFIG_H_
21 #define VLC_MP4_COLOR_CONFIG_H_
25 /* no free spec, grabbed from av1 bitstream spec */
29 ISO_23001_8_CP_BT_709
= 1,
30 ISO_23001_8_CP_UNSPECIFIED
,
31 ISO_23001_8_CP_RESERVED0
,
32 ISO_23001_8_CP_BT_470_M
,
33 ISO_23001_8_CP_BT_470_B_G
,
34 ISO_23001_8_CP_BT_601
,
35 ISO_23001_8_CP_SMPTE_240
,
36 ISO_23001_8_CP_GENERIC_FILM
,
37 ISO_23001_8_CP_BT_2020
, /* BT.2100 */
38 ISO_23001_8_CP_XYZ
, /* SMPTE 428 */
39 ISO_23001_8_CP_SMPTE_431
,
40 ISO_23001_8_CP_SMPTE_432
,
42 ISO_23001_8_CP_EBU_3213
= 22,
45 static const uint8_t iso_23001_8_cp_to_vlc_primaries_table
[] =
47 [0] = COLOR_PRIMARIES_UNDEF
,
48 [ISO_23001_8_CP_BT_709
] = COLOR_PRIMARIES_BT709
,
49 [ISO_23001_8_CP_UNSPECIFIED
] = COLOR_PRIMARIES_UNDEF
,
50 [ISO_23001_8_CP_RESERVED0
] = COLOR_PRIMARIES_UNDEF
,
51 [ISO_23001_8_CP_BT_470_M
] = COLOR_PRIMARIES_BT470_M
,
52 [ISO_23001_8_CP_BT_470_B_G
] = COLOR_PRIMARIES_BT470_BG
,
53 [ISO_23001_8_CP_BT_601
] = COLOR_PRIMARIES_SMTPE_170
,
54 [ISO_23001_8_CP_SMPTE_240
] = COLOR_PRIMARIES_SMTPE_240
,
55 [ISO_23001_8_CP_GENERIC_FILM
] = COLOR_PRIMARIES_UNDEF
,
56 [ISO_23001_8_CP_BT_2020
] = COLOR_PRIMARIES_BT2020
,
57 [ISO_23001_8_CP_XYZ
] = COLOR_PRIMARIES_UNDEF
,
58 [ISO_23001_8_CP_SMPTE_431
] = COLOR_PRIMARIES_UNDEF
,
59 [ISO_23001_8_CP_SMPTE_432
] = COLOR_PRIMARIES_UNDEF
,
60 /* [ISO_23001_8_CP_EBU_3213] = COLOR_PRIMARIES_EBU_3213, see below */
63 static inline uint8_t iso_23001_8_cp_to_vlc_primaries( uint8_t v
)
65 if( v
== ISO_23001_8_CP_EBU_3213
)
66 return COLOR_PRIMARIES_EBU_3213
;
67 return v
< ARRAY_SIZE(iso_23001_8_cp_to_vlc_primaries_table
)
68 ? iso_23001_8_cp_to_vlc_primaries_table
[v
]
69 : COLOR_PRIMARIES_UNDEF
;
74 ISO_23001_8_TC_RESERVED_0
= 0,
75 ISO_23001_8_TC_BT_709
,
76 ISO_23001_8_TC_UNSPECIFIED
,
77 ISO_23001_8_TC_RESERVED_3
,
78 ISO_23001_8_TC_BT_470_M
,
79 ISO_23001_8_TC_BT_470_B_G
,
80 ISO_23001_8_TC_BT_601
,
81 ISO_23001_8_TC_SMPTE_240
,
82 ISO_23001_8_TC_LINEAR
,
83 ISO_23001_8_TC_LOG_100
,
84 ISO_23001_8_TC_LOG_100_SQRT10
,
85 ISO_23001_8_TC_IEC_61966
,
86 ISO_23001_8_TC_BT_1361
,
88 ISO_23001_8_TC_BT_2020_10_BIT
,
89 ISO_23001_8_TC_BT_2020_12_BIT
,
90 ISO_23001_8_TC_SMPTE_2084
,
91 ISO_23001_8_TC_SMPTE_428
,
92 ISO_23001_8_TC_HLG
/* BT.2100 HLG, ARIB STD-B67 */
95 static const uint8_t iso_23001_8_tc_to_vlc_xfer_table
[] =
97 [ISO_23001_8_TC_RESERVED_0
] = TRANSFER_FUNC_UNDEF
,
98 [ISO_23001_8_TC_BT_709
] = TRANSFER_FUNC_BT709
,
99 [ISO_23001_8_TC_UNSPECIFIED
] = TRANSFER_FUNC_UNDEF
,
100 [ISO_23001_8_TC_RESERVED_3
] = TRANSFER_FUNC_UNDEF
,
101 [ISO_23001_8_TC_BT_470_M
] = TRANSFER_FUNC_BT470_M
,
102 [ISO_23001_8_TC_BT_470_B_G
] = TRANSFER_FUNC_BT470_BG
,
103 [ISO_23001_8_TC_BT_601
] = TRANSFER_FUNC_BT709
,
104 [ISO_23001_8_TC_SMPTE_240
] = TRANSFER_FUNC_SMPTE_240
,
105 [ISO_23001_8_TC_LINEAR
] = TRANSFER_FUNC_LINEAR
,
106 [ISO_23001_8_TC_LOG_100
] = TRANSFER_FUNC_UNDEF
,
107 [ISO_23001_8_TC_LOG_100_SQRT10
] = TRANSFER_FUNC_UNDEF
,
108 [ISO_23001_8_TC_IEC_61966
] = TRANSFER_FUNC_UNDEF
,
109 [ISO_23001_8_TC_BT_1361
] = TRANSFER_FUNC_UNDEF
,
110 [ISO_23001_8_TC_SRGB
] = TRANSFER_FUNC_SRGB
,
111 [ISO_23001_8_TC_BT_2020_10_BIT
] = TRANSFER_FUNC_BT2020
,
112 [ISO_23001_8_TC_BT_2020_12_BIT
] = TRANSFER_FUNC_BT2020
,
113 [ISO_23001_8_TC_SMPTE_2084
] = TRANSFER_FUNC_SMPTE_ST2084
,
114 [ISO_23001_8_TC_SMPTE_428
] = TRANSFER_FUNC_UNDEF
,
115 [ISO_23001_8_TC_HLG
] = TRANSFER_FUNC_HLG
,
118 static inline uint8_t iso_23001_8_tc_to_vlc_xfer( uint8_t v
)
120 return v
< ARRAY_SIZE(iso_23001_8_tc_to_vlc_xfer_table
)
121 ? iso_23001_8_tc_to_vlc_xfer_table
[v
]
122 : TRANSFER_FUNC_UNDEF
;
127 ISO_23001_8_MC_IDENTITY
= 0,
128 ISO_23001_8_MC_BT_709
,
129 ISO_23001_8_MC_UNSPECIFIED
,
130 ISO_23001_8_MC_RESERVED_3
,
132 ISO_23001_8_MC_BT_470_B_G
,
133 ISO_23001_8_MC_BT_601
,
134 ISO_23001_8_MC_SMPTE_240
,
135 ISO_23001_8_MC_SMPTE_YCGCO
,
136 ISO_23001_8_MC_BT_2020_NCL
,
137 ISO_23001_8_MC_BT_2020_CL
,
138 ISO_23001_8_MC_SMPTE_2085
,
139 ISO_23001_8_MC_CHROMAT_NCL
,
140 ISO_23001_8_MC_CHROMAT_CL
,
141 ISO_23001_8_MC_ICTCP
,
144 static const uint8_t iso_23001_8_mc_to_vlc_coeffs_table
[] =
146 [ISO_23001_8_MC_IDENTITY
] = COLOR_SPACE_UNDEF
,
147 [ISO_23001_8_MC_BT_709
] = COLOR_SPACE_BT709
,
148 [ISO_23001_8_MC_UNSPECIFIED
] = COLOR_SPACE_UNDEF
,
149 [ISO_23001_8_MC_RESERVED_3
] = COLOR_SPACE_UNDEF
,
150 [ISO_23001_8_MC_FCC
] = COLOR_SPACE_UNDEF
,
151 [ISO_23001_8_MC_BT_470_B_G
] = COLOR_SPACE_BT601
,
152 [ISO_23001_8_MC_BT_601
] = COLOR_SPACE_BT601
,
153 [ISO_23001_8_MC_SMPTE_240
] = COLOR_SPACE_UNDEF
,
154 [ISO_23001_8_MC_SMPTE_YCGCO
] = COLOR_SPACE_UNDEF
,
155 [ISO_23001_8_MC_BT_2020_NCL
] = COLOR_SPACE_BT2020
,
156 [ISO_23001_8_MC_BT_2020_CL
] = COLOR_SPACE_BT2020
,
157 [ISO_23001_8_MC_SMPTE_2085
] = COLOR_SPACE_UNDEF
,
158 [ISO_23001_8_MC_CHROMAT_NCL
] = COLOR_SPACE_UNDEF
,
159 [ISO_23001_8_MC_CHROMAT_CL
] = COLOR_SPACE_UNDEF
,
160 [ISO_23001_8_MC_ICTCP
] = COLOR_SPACE_UNDEF
,
163 static inline uint8_t iso_23001_8_mc_to_vlc_coeffs( uint8_t v
)
165 return v
< ARRAY_SIZE(iso_23001_8_mc_to_vlc_coeffs_table
)
166 ? iso_23001_8_mc_to_vlc_coeffs_table
[v
]
170 #endif /* VLC_MP4_COLOR_CONFIG_H_ */