Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Side by Side Diff: chromecast/public/media/decoder_config.h

Issue 2798023006: [Chromecast] Use VideoColorSpace in Chromecast video config (Closed)
Patch Set: buildfix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromecast/media/cma/base/decoder_config_adapter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_ 5 #ifndef CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_
6 #define CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_ 6 #define CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 inline EncryptionScheme Unencrypted() { 161 inline EncryptionScheme Unencrypted() {
162 return EncryptionScheme(); 162 return EncryptionScheme();
163 } 163 }
164 164
165 inline EncryptionScheme AesCtrEncryptionScheme() { 165 inline EncryptionScheme AesCtrEncryptionScheme() {
166 return EncryptionScheme(EncryptionScheme::CIPHER_MODE_AES_CTR, 166 return EncryptionScheme(EncryptionScheme::CIPHER_MODE_AES_CTR,
167 EncryptionScheme::Pattern()); 167 EncryptionScheme::Pattern());
168 } 168 }
169 169
170 // ---- Begin copy/paste from ui/gfx/color_space.h ---- 170 // ---- Begin copy/paste from //media/base/video_color_space.h ----
171 enum class PrimaryID : uint16_t { 171 // Described in ISO 23001-8:2016
172 // The first 0-255 values should match the H264 specification. 172
173 RESERVED0 = 0, 173 // Table 2
174 enum class PrimaryID : uint8_t {
175 INVALID = 0,
174 BT709 = 1, 176 BT709 = 1,
175 UNSPECIFIED = 2, 177 UNSPECIFIED = 2,
176 RESERVED = 3,
177 BT470M = 4, 178 BT470M = 4,
178 BT470BG = 5, 179 BT470BG = 5,
179 SMPTE170M = 6, 180 SMPTE170M = 6,
180 SMPTE240M = 7, 181 SMPTE240M = 7,
181 FILM = 8, 182 FILM = 8,
182 BT2020 = 9, 183 BT2020 = 9,
183 SMPTEST428_1 = 10, 184 SMPTEST428_1 = 10,
184 SMPTEST431_2 = 11, 185 SMPTEST431_2 = 11,
185 SMPTEST432_1 = 12, 186 SMPTEST432_1 = 12,
186 187 EBU_3213_E = 22
187 // Chrome-specific values start at 1000.
188 XYZ_D50 = 1000,
189 // TODO(hubbe): We need to store the primaries.
190 CUSTOM = 1001,
191 LAST = CUSTOM
192 }; 188 };
193 189
194 enum class TransferID : uint16_t { 190 // Table 3
195 // The first 0-255 values should match the H264 specification. 191 enum class TransferID : uint8_t {
196 RESERVED0 = 0, 192 INVALID = 0,
197 BT709 = 1, 193 BT709 = 1,
198 UNSPECIFIED = 2, 194 UNSPECIFIED = 2,
199 RESERVED = 3,
200 GAMMA22 = 4, 195 GAMMA22 = 4,
201 GAMMA28 = 5, 196 GAMMA28 = 5,
202 SMPTE170M = 6, 197 SMPTE170M = 6,
203 SMPTE240M = 7, 198 SMPTE240M = 7,
204 LINEAR = 8, 199 LINEAR = 8,
205 LOG = 9, 200 LOG = 9,
206 LOG_SQRT = 10, 201 LOG_SQRT = 10,
207 IEC61966_2_4 = 11, 202 IEC61966_2_4 = 11,
208 BT1361_ECG = 12, 203 BT1361_ECG = 12,
209 IEC61966_2_1 = 13, 204 IEC61966_2_1 = 13,
210 BT2020_10 = 14, 205 BT2020_10 = 14,
211 BT2020_12 = 15, 206 BT2020_12 = 15,
212 SMPTEST2084 = 16, 207 SMPTEST2084 = 16,
213 SMPTEST428_1 = 17, 208 SMPTEST428_1 = 17,
214 ARIB_STD_B67 = 18, // AKA hybrid-log gamma, HLG
215 209
216 // Chrome-specific values start at 1000. 210 // Not yet standardized
217 GAMMA24 = 1000, 211 ARIB_STD_B67 = 18, // AKA hybrid-log gamma, HLG.
218
219 // This is an ad-hoc transfer function that decodes SMPTE 2084 content
220 // into a 0-1 range more or less suitable for viewing on a non-hdr
221 // display.
222 SMPTEST2084_NON_HDR,
223
224 // TODO(hubbe): Need to store an approximation of the gamma function(s).
225 CUSTOM,
226 LAST = CUSTOM,
227 }; 212 };
228 213
229 enum class MatrixID : int16_t { 214 // Table 4
230 // The first 0-255 values should match the H264 specification. 215 enum class MatrixID : int8_t {
231 RGB = 0, 216 RGB = 0,
232 BT709 = 1, 217 BT709 = 1,
233 UNSPECIFIED = 2, 218 UNSPECIFIED = 2,
234 RESERVED = 3,
235 FCC = 4, 219 FCC = 4,
236 BT470BG = 5, 220 BT470BG = 5,
237 SMPTE170M = 6, 221 SMPTE170M = 6,
238 SMPTE240M = 7, 222 SMPTE240M = 7,
239 YCOCG = 8, 223 YCOCG = 8,
240 BT2020_NCL = 9, 224 BT2020_NCL = 9,
241 BT2020_CL = 10, 225 BT2020_CL = 10,
242 YDZDX = 11, 226 YDZDX = 11,
243 227 INVALID = 255,
244 // Chrome-specific values start at 1000
245 LAST = YDZDX,
246 }; 228 };
229 // ---- End copy/pasted from media/base/video_color_space.h ----
247 230
248 // This corresponds to the WebM Range enum which is part of WebM color data 231 // This corresponds to the WebM Range enum which is part of WebM color data
249 // (see http://www.webmproject.org/docs/container/#Range). 232 // (see http://www.webmproject.org/docs/container/#Range).
250 // H.264 only uses a bool, which corresponds to the LIMITED/FULL values. 233 // H.264 only uses a bool, which corresponds to the LIMITED/FULL values.
251 // Chrome-specific values start at 1000. 234 // ---- Begin copy/paste from //ui/gfx/color_space.h ----
252 enum class RangeID : int8_t { 235 enum class RangeID : int8_t {
253 // Range is not explicitly specified / unknown. 236 INVALID = 0,
254 UNSPECIFIED = 0,
255
256 // Limited Rec. 709 color range with RGB values ranging from 16 to 235. 237 // Limited Rec. 709 color range with RGB values ranging from 16 to 235.
257 LIMITED = 1, 238 LIMITED = 1,
258
259 // Full RGB color range with RGB valees from 0 to 255. 239 // Full RGB color range with RGB valees from 0 to 255.
260 FULL = 2, 240 FULL = 2,
261
262 // Range is defined by TransferID/MatrixID. 241 // Range is defined by TransferID/MatrixID.
263 DERIVED = 3, 242 DERIVED = 3,
264
265 LAST = DERIVED 243 LAST = DERIVED
266 }; 244 };
267 // ---- End copy/pasted from ui/gfx/color_space.h ---- 245 // ---- Begin copy/paste from //ui/gfx/color_space.h ----
268 246
269 // ---- Begin copy/paste from media/base/hdr_metadata.h ---- 247 // ---- Begin copy/paste from media/base/hdr_metadata.h ----
270 // SMPTE ST 2086 mastering metadata. 248 // SMPTE ST 2086 mastering metadata.
271 struct MasteringMetadata { 249 struct MasteringMetadata {
272 float primary_r_chromaticity_x = 0; 250 float primary_r_chromaticity_x = 0;
273 float primary_r_chromaticity_y = 0; 251 float primary_r_chromaticity_y = 0;
274 float primary_g_chromaticity_x = 0; 252 float primary_g_chromaticity_x = 0;
275 float primary_g_chromaticity_y = 0; 253 float primary_g_chromaticity_y = 0;
276 float primary_b_chromaticity_x = 0; 254 float primary_b_chromaticity_x = 0;
277 float primary_b_chromaticity_y = 0; 255 float primary_b_chromaticity_y = 0;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 VideoConfig* additional_config; 342 VideoConfig* additional_config;
365 // Extra data buffer for certain codec initialization. 343 // Extra data buffer for certain codec initialization.
366 std::vector<uint8_t> extra_data; 344 std::vector<uint8_t> extra_data;
367 // Encryption scheme (if any) used for the content. 345 // Encryption scheme (if any) used for the content.
368 EncryptionScheme encryption_scheme; 346 EncryptionScheme encryption_scheme;
369 347
370 // ColorSpace info 348 // ColorSpace info
371 PrimaryID primaries = PrimaryID::UNSPECIFIED; 349 PrimaryID primaries = PrimaryID::UNSPECIFIED;
372 TransferID transfer = TransferID::UNSPECIFIED; 350 TransferID transfer = TransferID::UNSPECIFIED;
373 MatrixID matrix = MatrixID::UNSPECIFIED; 351 MatrixID matrix = MatrixID::UNSPECIFIED;
374 RangeID range = RangeID::UNSPECIFIED; 352 RangeID range = RangeID::INVALID;
375 353
376 bool have_hdr_metadata = false; 354 bool have_hdr_metadata = false;
377 HDRMetadata hdr_metadata; 355 HDRMetadata hdr_metadata;
378 }; 356 };
379 357
380 inline VideoConfig::VideoConfig() 358 inline VideoConfig::VideoConfig()
381 : id(kPrimary), 359 : id(kPrimary),
382 codec(kVideoCodecUnknown), 360 codec(kVideoCodecUnknown),
383 profile(kVideoProfileUnknown), 361 profile(kVideoProfileUnknown),
384 additional_config(nullptr) { 362 additional_config(nullptr) {
(...skipping 24 matching lines...) Expand all
409 inline bool IsValidConfig(const VideoConfig& config) { 387 inline bool IsValidConfig(const VideoConfig& config) {
410 return config.codec >= kVideoCodecMin && 388 return config.codec >= kVideoCodecMin &&
411 config.codec <= kVideoCodecMax && 389 config.codec <= kVideoCodecMax &&
412 config.codec != kVideoCodecUnknown; 390 config.codec != kVideoCodecUnknown;
413 } 391 }
414 392
415 } // namespace media 393 } // namespace media
416 } // namespace chromecast 394 } // namespace chromecast
417 395
418 #endif // CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_ 396 #endif // CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_
OLDNEW
« no previous file with comments | « chromecast/media/cma/base/decoder_config_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698