Chromium Code Reviews| 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 #include "media/filters/h264_parser.h" | 5 #include "media/filters/h264_parser.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 coded_size->height() - crop_top <= crop_bottom) { | 115 coded_size->height() - crop_top <= crop_bottom) { |
| 116 DVLOG(1) << "Frame cropping excludes entire frame."; | 116 DVLOG(1) << "Frame cropping excludes entire frame."; |
| 117 return base::nullopt; | 117 return base::nullopt; |
| 118 } | 118 } |
| 119 | 119 |
| 120 return gfx::Rect(crop_left, crop_top, | 120 return gfx::Rect(crop_left, crop_top, |
| 121 coded_size->width() - crop_left - crop_right, | 121 coded_size->width() - crop_left - crop_right, |
| 122 coded_size->height() - crop_top - crop_bottom); | 122 coded_size->height() - crop_top - crop_bottom); |
| 123 } | 123 } |
| 124 | 124 |
| 125 gfx::ColorSpace H264SPS::GetColorSpace() const { | |
|
sandersd (OOO until July 31)
2016/09/16 18:50:26
Nit: Comment where in the spec this comes from (E.
hubbe
2016/09/21 22:04:25
Done.
| |
| 126 if (colour_description_present_flag) { | |
| 127 return gfx::ColorSpace( | |
| 128 static_cast<gfx::ColorSpace::PrimaryID>(colour_primaries), | |
|
sandersd (OOO until July 31)
2016/09/16 18:50:26
This is either unspecified (C++<17) or undefined (
sandersd (OOO until July 31)
2016/09/16 19:31:47
I'll retract that since all of these enums specify
hubbe
2016/09/21 22:04:25
Done.
| |
| 129 static_cast<gfx::ColorSpace::TransferID>(transfer_characteristics), | |
| 130 static_cast<gfx::ColorSpace::MatrixID>(matrix_coefficients), | |
| 131 video_full_range_flag ? gfx::ColorSpace::RangeID::FULL | |
| 132 : gfx::ColorSpace::RangeID::LIMITED); | |
| 133 } else { | |
| 134 return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::UNSPECIFIED, | |
| 135 gfx::ColorSpace::TransferID::UNSPECIFIED, | |
| 136 gfx::ColorSpace::MatrixID::UNSPECIFIED, | |
| 137 video_full_range_flag | |
| 138 ? gfx::ColorSpace::RangeID::FULL | |
| 139 : gfx::ColorSpace::RangeID::LIMITED); | |
| 140 } | |
| 141 } | |
| 142 | |
| 125 H264PPS::H264PPS() { | 143 H264PPS::H264PPS() { |
| 126 memset(this, 0, sizeof(*this)); | 144 memset(this, 0, sizeof(*this)); |
| 127 } | 145 } |
| 128 | 146 |
| 129 H264SliceHeader::H264SliceHeader() { | 147 H264SliceHeader::H264SliceHeader() { |
| 130 memset(this, 0, sizeof(*this)); | 148 memset(this, 0, sizeof(*this)); |
| 131 } | 149 } |
| 132 | 150 |
| 133 H264SEIMessage::H264SEIMessage() { | 151 H264SEIMessage::H264SEIMessage() { |
| 134 memset(this, 0, sizeof(*this)); | 152 memset(this, 0, sizeof(*this)); |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 809 sps->sar_height = kTableSarHeight[aspect_ratio_idc]; | 827 sps->sar_height = kTableSarHeight[aspect_ratio_idc]; |
| 810 } | 828 } |
| 811 } | 829 } |
| 812 | 830 |
| 813 int data; | 831 int data; |
| 814 // Read and ignore overscan and video signal type info. | 832 // Read and ignore overscan and video signal type info. |
| 815 READ_BOOL_OR_RETURN(&data); // overscan_info_present_flag | 833 READ_BOOL_OR_RETURN(&data); // overscan_info_present_flag |
| 816 if (data) | 834 if (data) |
| 817 READ_BOOL_OR_RETURN(&data); // overscan_appropriate_flag | 835 READ_BOOL_OR_RETURN(&data); // overscan_appropriate_flag |
| 818 | 836 |
| 819 READ_BOOL_OR_RETURN(&data); // video_signal_type_present_flag | 837 READ_BOOL_OR_RETURN(&sps->video_signal_type_present_flag); |
| 820 if (data) { | 838 if (sps->video_signal_type_present_flag) { |
| 821 READ_BITS_OR_RETURN(3, &data); // video_format | 839 READ_BITS_OR_RETURN(3, &sps->video_format); |
| 822 READ_BOOL_OR_RETURN(&data); // video_full_range_flag | 840 READ_BOOL_OR_RETURN(&sps->video_full_range_flag); |
| 823 READ_BOOL_OR_RETURN(&data); // colour_description_present_flag | 841 READ_BOOL_OR_RETURN(&sps->colour_description_present_flag); |
| 824 if (data) | 842 if (sps->colour_description_present_flag) { |
| 825 READ_BITS_OR_RETURN(24, &data); // color description syntax elements | 843 // color description syntax elements |
| 844 READ_BITS_OR_RETURN(8, &sps->colour_primaries); | |
| 845 READ_BITS_OR_RETURN(8, &sps->transfer_characteristics); | |
| 846 READ_BITS_OR_RETURN(8, &sps->matrix_coefficients); | |
| 847 } | |
| 826 } | 848 } |
| 827 | 849 |
| 828 READ_BOOL_OR_RETURN(&data); // chroma_loc_info_present_flag | 850 READ_BOOL_OR_RETURN(&data); // chroma_loc_info_present_flag |
| 829 if (data) { | 851 if (data) { |
| 830 READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_top_field | 852 READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_top_field |
| 831 READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_bottom_field | 853 READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_bottom_field |
| 832 } | 854 } |
| 833 | 855 |
| 834 // Read and ignore timing info. | 856 // Read and ignore timing info. |
| 835 READ_BOOL_OR_RETURN(&data); // timing_info_present_flag | 857 READ_BOOL_OR_RETURN(&data); // timing_info_present_flag |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1458 | 1480 |
| 1459 default: | 1481 default: |
| 1460 DVLOG(4) << "Unsupported SEI message"; | 1482 DVLOG(4) << "Unsupported SEI message"; |
| 1461 break; | 1483 break; |
| 1462 } | 1484 } |
| 1463 | 1485 |
| 1464 return kOk; | 1486 return kOk; |
| 1465 } | 1487 } |
| 1466 | 1488 |
| 1467 } // namespace media | 1489 } // namespace media |
| OLD | NEW |