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

Side by Side Diff: media/filters/h264_parser.cc

Issue 2399133002: Revert of Attach color space information to hardware decoded NV12 video frames. (Closed)
Patch Set: Created 4 years, 2 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 | « media/filters/h264_parser.h ('k') | media/gpu/android_video_decode_accelerator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 coded_size->height() - crop_top <= crop_bottom) { 114 coded_size->height() - crop_top <= crop_bottom) {
115 DVLOG(1) << "Frame cropping excludes entire frame."; 115 DVLOG(1) << "Frame cropping excludes entire frame.";
116 return base::nullopt; 116 return base::nullopt;
117 } 117 }
118 118
119 return gfx::Rect(crop_left, crop_top, 119 return gfx::Rect(crop_left, crop_top,
120 coded_size->width() - crop_left - crop_right, 120 coded_size->width() - crop_left - crop_right,
121 coded_size->height() - crop_top - crop_bottom); 121 coded_size->height() - crop_top - crop_bottom);
122 } 122 }
123 123
124 // Based on T-REC-H.264 E.2.1, "VUI parameters semantics",
125 // available from http://www.itu.int/rec/T-REC-H.264.
126 gfx::ColorSpace H264SPS::GetColorSpace() const {
127 if (colour_description_present_flag) {
128 return gfx::ColorSpace(
129 colour_primaries, transfer_characteristics, matrix_coefficients,
130 video_full_range_flag ? gfx::ColorSpace::RangeID::FULL
131 : gfx::ColorSpace::RangeID::LIMITED);
132 } else {
133 return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::UNSPECIFIED,
134 gfx::ColorSpace::TransferID::UNSPECIFIED,
135 gfx::ColorSpace::MatrixID::UNSPECIFIED,
136 video_full_range_flag
137 ? gfx::ColorSpace::RangeID::FULL
138 : gfx::ColorSpace::RangeID::LIMITED);
139 }
140 }
141
142 H264PPS::H264PPS() { 124 H264PPS::H264PPS() {
143 memset(this, 0, sizeof(*this)); 125 memset(this, 0, sizeof(*this));
144 } 126 }
145 127
146 H264SliceHeader::H264SliceHeader() { 128 H264SliceHeader::H264SliceHeader() {
147 memset(this, 0, sizeof(*this)); 129 memset(this, 0, sizeof(*this));
148 } 130 }
149 131
150 H264SEIMessage::H264SEIMessage() { 132 H264SEIMessage::H264SEIMessage() {
151 memset(this, 0, sizeof(*this)); 133 memset(this, 0, sizeof(*this));
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 sps->sar_height = kTableSarHeight[aspect_ratio_idc]; 806 sps->sar_height = kTableSarHeight[aspect_ratio_idc];
825 } 807 }
826 } 808 }
827 809
828 int data; 810 int data;
829 // Read and ignore overscan and video signal type info. 811 // Read and ignore overscan and video signal type info.
830 READ_BOOL_OR_RETURN(&data); // overscan_info_present_flag 812 READ_BOOL_OR_RETURN(&data); // overscan_info_present_flag
831 if (data) 813 if (data)
832 READ_BOOL_OR_RETURN(&data); // overscan_appropriate_flag 814 READ_BOOL_OR_RETURN(&data); // overscan_appropriate_flag
833 815
834 READ_BOOL_OR_RETURN(&sps->video_signal_type_present_flag); 816 READ_BOOL_OR_RETURN(&data); // video_signal_type_present_flag
835 if (sps->video_signal_type_present_flag) { 817 if (data) {
836 READ_BITS_OR_RETURN(3, &sps->video_format); 818 READ_BITS_OR_RETURN(3, &data); // video_format
837 READ_BOOL_OR_RETURN(&sps->video_full_range_flag); 819 READ_BOOL_OR_RETURN(&data); // video_full_range_flag
838 READ_BOOL_OR_RETURN(&sps->colour_description_present_flag); 820 READ_BOOL_OR_RETURN(&data); // colour_description_present_flag
839 if (sps->colour_description_present_flag) { 821 if (data)
840 // color description syntax elements 822 READ_BITS_OR_RETURN(24, &data); // color description syntax elements
841 READ_BITS_OR_RETURN(8, &sps->colour_primaries);
842 READ_BITS_OR_RETURN(8, &sps->transfer_characteristics);
843 READ_BITS_OR_RETURN(8, &sps->matrix_coefficients);
844 }
845 } 823 }
846 824
847 READ_BOOL_OR_RETURN(&data); // chroma_loc_info_present_flag 825 READ_BOOL_OR_RETURN(&data); // chroma_loc_info_present_flag
848 if (data) { 826 if (data) {
849 READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_top_field 827 READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_top_field
850 READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_bottom_field 828 READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_bottom_field
851 } 829 }
852 830
853 // Read and ignore timing info. 831 // Read and ignore timing info.
854 READ_BOOL_OR_RETURN(&data); // timing_info_present_flag 832 READ_BOOL_OR_RETURN(&data); // timing_info_present_flag
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 1453
1476 default: 1454 default:
1477 DVLOG(4) << "Unsupported SEI message"; 1455 DVLOG(4) << "Unsupported SEI message";
1478 break; 1456 break;
1479 } 1457 }
1480 1458
1481 return kOk; 1459 return kOk;
1482 } 1460 }
1483 1461
1484 } // namespace media 1462 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/h264_parser.h ('k') | media/gpu/android_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698