OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file contains an implementation of an H264 Annex-B video stream parser. | 5 // This file contains an implementation of an H264 Annex-B video stream parser. |
6 | 6 |
7 #ifndef MEDIA_FILTERS_H264_PARSER_H_ | 7 #ifndef MEDIA_FILTERS_H264_PARSER_H_ |
8 #define MEDIA_FILTERS_H264_PARSER_H_ | 8 #define MEDIA_FILTERS_H264_PARSER_H_ |
9 | 9 |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 enum { | 47 enum { |
48 kH264ScalingList4x4Length = 16, | 48 kH264ScalingList4x4Length = 16, |
49 kH264ScalingList8x8Length = 64, | 49 kH264ScalingList8x8Length = 64, |
50 }; | 50 }; |
51 | 51 |
52 struct MEDIA_EXPORT H264SPS { | 52 struct MEDIA_EXPORT H264SPS { |
53 H264SPS(); | 53 H264SPS(); |
54 | 54 |
55 int profile_idc; | 55 int profile_idc; |
56 int constraint_setx_flag; | 56 bool constraint_set0_flag; |
| 57 bool constraint_set1_flag; |
| 58 bool constraint_set2_flag; |
| 59 bool constraint_set3_flag; |
| 60 bool constraint_set4_flag; |
| 61 bool constraint_set5_flag; |
57 int level_idc; | 62 int level_idc; |
58 int seq_parameter_set_id; | 63 int seq_parameter_set_id; |
59 | 64 |
60 int chroma_format_idc; | 65 int chroma_format_idc; |
61 bool separate_colour_plane_flag; | 66 bool separate_colour_plane_flag; |
62 int bit_depth_luma_minus8; | 67 int bit_depth_luma_minus8; |
63 int bit_depth_chroma_minus8; | 68 int bit_depth_chroma_minus8; |
64 bool qpprime_y_zero_transform_bypass_flag; | 69 bool qpprime_y_zero_transform_bypass_flag; |
65 | 70 |
66 bool seq_scaling_matrix_present_flag; | 71 bool seq_scaling_matrix_present_flag; |
(...skipping 14 matching lines...) Expand all Loading... |
81 int pic_width_in_mbs_minus1; | 86 int pic_width_in_mbs_minus1; |
82 int pic_height_in_map_units_minus1; | 87 int pic_height_in_map_units_minus1; |
83 bool frame_mbs_only_flag; | 88 bool frame_mbs_only_flag; |
84 bool mb_adaptive_frame_field_flag; | 89 bool mb_adaptive_frame_field_flag; |
85 bool direct_8x8_inference_flag; | 90 bool direct_8x8_inference_flag; |
86 bool frame_cropping_flag; | 91 bool frame_cropping_flag; |
87 int frame_crop_left_offset; | 92 int frame_crop_left_offset; |
88 int frame_crop_right_offset; | 93 int frame_crop_right_offset; |
89 int frame_crop_top_offset; | 94 int frame_crop_top_offset; |
90 int frame_crop_bottom_offset; | 95 int frame_crop_bottom_offset; |
| 96 |
91 bool vui_parameters_present_flag; | 97 bool vui_parameters_present_flag; |
92 int chroma_array_type; | |
93 int sar_width; // Set to 0 when not specified. | 98 int sar_width; // Set to 0 when not specified. |
94 int sar_height; // Set to 0 when not specified. | 99 int sar_height; // Set to 0 when not specified. |
| 100 bool bitstream_restriction_flag; |
| 101 int max_num_reorder_frames; |
| 102 int max_dec_frame_buffering; |
| 103 |
| 104 int chroma_array_type; |
95 }; | 105 }; |
96 | 106 |
97 struct MEDIA_EXPORT H264PPS { | 107 struct MEDIA_EXPORT H264PPS { |
98 H264PPS(); | 108 H264PPS(); |
99 | 109 |
100 int pic_parameter_set_id; | 110 int pic_parameter_set_id; |
101 int seq_parameter_set_id; | 111 int seq_parameter_set_id; |
102 bool entropy_coding_mode_flag; | 112 bool entropy_coding_mode_flag; |
103 bool bottom_field_pic_order_in_frame_present_flag; | 113 bool bottom_field_pic_order_in_frame_present_flag; |
104 int num_slice_groups_minus1; | 114 int num_slice_groups_minus1; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 Result ReadUE(int* val); | 347 Result ReadUE(int* val); |
338 | 348 |
339 // Read one signed exp-Golomb code from the stream and return in |*val|. | 349 // Read one signed exp-Golomb code from the stream and return in |*val|. |
340 Result ReadSE(int* val); | 350 Result ReadSE(int* val); |
341 | 351 |
342 // Parse scaling lists (see spec). | 352 // Parse scaling lists (see spec). |
343 Result ParseScalingList(int size, int* scaling_list, bool* use_default); | 353 Result ParseScalingList(int size, int* scaling_list, bool* use_default); |
344 Result ParseSPSScalingLists(H264SPS* sps); | 354 Result ParseSPSScalingLists(H264SPS* sps); |
345 Result ParsePPSScalingLists(const H264SPS& sps, H264PPS* pps); | 355 Result ParsePPSScalingLists(const H264SPS& sps, H264PPS* pps); |
346 | 356 |
| 357 // Parse optional VUI parameters in SPS (see spec). |
| 358 Result ParseVUIParameters(H264SPS* sps); |
| 359 // Set |hrd_parameters_present| to true only if they are present. |
| 360 Result ParseAndIgnoreHRDParameters(bool* hrd_parameters_present); |
| 361 |
347 // Parse reference picture lists' modifications (see spec). | 362 // Parse reference picture lists' modifications (see spec). |
348 Result ParseRefPicListModifications(H264SliceHeader* shdr); | 363 Result ParseRefPicListModifications(H264SliceHeader* shdr); |
349 Result ParseRefPicListModification(int num_ref_idx_active_minus1, | 364 Result ParseRefPicListModification(int num_ref_idx_active_minus1, |
350 H264ModificationOfPicNum* ref_list_mods); | 365 H264ModificationOfPicNum* ref_list_mods); |
351 | 366 |
352 // Parse prediction weight table (see spec). | 367 // Parse prediction weight table (see spec). |
353 Result ParsePredWeightTable(const H264SPS& sps, H264SliceHeader* shdr); | 368 Result ParsePredWeightTable(const H264SPS& sps, H264SliceHeader* shdr); |
354 | 369 |
355 // Parse weighting factors (see spec). | 370 // Parse weighting factors (see spec). |
356 Result ParseWeightingFactors(int num_ref_idx_active_minus1, | 371 Result ParseWeightingFactors(int num_ref_idx_active_minus1, |
(...skipping 18 matching lines...) Expand all Loading... |
375 typedef std::map<int, H264PPS*> PPSById; | 390 typedef std::map<int, H264PPS*> PPSById; |
376 SPSById active_SPSes_; | 391 SPSById active_SPSes_; |
377 PPSById active_PPSes_; | 392 PPSById active_PPSes_; |
378 | 393 |
379 DISALLOW_COPY_AND_ASSIGN(H264Parser); | 394 DISALLOW_COPY_AND_ASSIGN(H264Parser); |
380 }; | 395 }; |
381 | 396 |
382 } // namespace media | 397 } // namespace media |
383 | 398 |
384 #endif // MEDIA_FILTERS_H264_PARSER_H_ | 399 #endif // MEDIA_FILTERS_H264_PARSER_H_ |
OLD | NEW |