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

Side by Side Diff: media/base/video_decoder_config.cc

Issue 1221903003: Change the video color space default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable the JPEG blackwhite test Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/base/video_decoder_config.h" 5 #include "media/base/video_decoder_config.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 9
10 namespace media { 10 namespace media {
11 11
12 VideoFrame::ColorSpace VideoDecoderConfig::DefaultMseColorSpace() {
13 return VideoFrame::COLOR_SPACE_HD_REC709;
14 }
15
16 VideoFrame::ColorSpace VideoDecoderConfig::DefaultSrcColorSpace(
17 const gfx::Size& natural_size) {
18 if (natural_size.height() < 720)
19 return VideoFrame::COLOR_SPACE_SD_REC601;
20 else
21 return VideoFrame::COLOR_SPACE_HD_REC709;
22 }
23
12 VideoDecoderConfig::VideoDecoderConfig() 24 VideoDecoderConfig::VideoDecoderConfig()
13 : codec_(kUnknownVideoCodec), 25 : codec_(kUnknownVideoCodec),
14 profile_(VIDEO_CODEC_PROFILE_UNKNOWN), 26 profile_(VIDEO_CODEC_PROFILE_UNKNOWN),
15 format_(VideoFrame::UNKNOWN), 27 format_(VideoFrame::UNKNOWN),
16 is_encrypted_(false) { 28 is_encrypted_(false) {
17 } 29 }
18 30
19 VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec, 31 VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec,
20 VideoCodecProfile profile, 32 VideoCodecProfile profile,
21 VideoFrame::Format format, 33 VideoFrame::Format format,
34 VideoFrame::ColorSpace color_space,
22 const gfx::Size& coded_size, 35 const gfx::Size& coded_size,
23 const gfx::Rect& visible_rect, 36 const gfx::Rect& visible_rect,
24 const gfx::Size& natural_size, 37 const gfx::Size& natural_size,
25 const uint8* extra_data, 38 const uint8* extra_data,
26 size_t extra_data_size, 39 size_t extra_data_size,
27 bool is_encrypted) { 40 bool is_encrypted) {
28 Initialize(codec, profile, format, VideoFrame::COLOR_SPACE_UNSPECIFIED, 41 Initialize(codec, profile, format, color_space,
29 coded_size, visible_rect, natural_size, extra_data, 42 coded_size, visible_rect, natural_size, extra_data,
30 extra_data_size, is_encrypted, true); 43 extra_data_size, is_encrypted, true);
31 } 44 }
32 45
33 VideoDecoderConfig::~VideoDecoderConfig() {} 46 VideoDecoderConfig::~VideoDecoderConfig() {}
34 47
35 // Some videos just want to watch the world burn, with a height of 0; cap the 48 // Some videos just want to watch the world burn, with a height of 0; cap the
36 // "infinite" aspect ratio resulting. 49 // "infinite" aspect ratio resulting.
37 static const int kInfiniteRatio = 99999; 50 static const int kInfiniteRatio = 99999;
38 51
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 UmaHistogramAspectRatio("Media.VideoVisibleAspectRatio", visible_rect); 93 UmaHistogramAspectRatio("Media.VideoVisibleAspectRatio", visible_rect);
81 UMA_HISTOGRAM_ENUMERATION("Media.VideoFramePixelFormat", format, 94 UMA_HISTOGRAM_ENUMERATION("Media.VideoFramePixelFormat", format,
82 VideoFrame::FORMAT_MAX + 1); 95 VideoFrame::FORMAT_MAX + 1);
83 UMA_HISTOGRAM_ENUMERATION("Media.VideoFrameColorSpace", color_space, 96 UMA_HISTOGRAM_ENUMERATION("Media.VideoFrameColorSpace", color_space,
84 VideoFrame::COLOR_SPACE_MAX + 1); 97 VideoFrame::COLOR_SPACE_MAX + 1);
85 } 98 }
86 99
87 codec_ = codec; 100 codec_ = codec;
88 profile_ = profile; 101 profile_ = profile;
89 format_ = format; 102 format_ = format;
103 color_space_ = color_space;
90 coded_size_ = coded_size; 104 coded_size_ = coded_size;
91 visible_rect_ = visible_rect; 105 visible_rect_ = visible_rect;
92 natural_size_ = natural_size; 106 natural_size_ = natural_size;
93 extra_data_.assign(extra_data, extra_data + extra_data_size); 107 extra_data_.assign(extra_data, extra_data + extra_data_size);
94 is_encrypted_ = is_encrypted; 108 is_encrypted_ = is_encrypted;
95 } 109 }
96 110
97 bool VideoDecoderConfig::IsValidConfig() const { 111 bool VideoDecoderConfig::IsValidConfig() const {
98 return codec_ != kUnknownVideoCodec && 112 return codec_ != kUnknownVideoCodec &&
99 natural_size_.width() > 0 && 113 natural_size_.width() > 0 &&
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return "vp9"; 168 return "vp9";
155 } 169 }
156 NOTREACHED(); 170 NOTREACHED();
157 return ""; 171 return "";
158 } 172 }
159 173
160 VideoCodec VideoDecoderConfig::codec() const { 174 VideoCodec VideoDecoderConfig::codec() const {
161 return codec_; 175 return codec_;
162 } 176 }
163 177
164 VideoCodecProfile VideoDecoderConfig::profile() const { 178 VideoCodecProfile VideoDecoderConfig::profile() const {
DaleCurtis 2015/07/06 22:36:14 Can you move all of these one-line getters into th
watk 2015/07/06 23:15:58 Done.
165 return profile_; 179 return profile_;
166 } 180 }
167 181
168 VideoFrame::Format VideoDecoderConfig::format() const { 182 VideoFrame::Format VideoDecoderConfig::format() const {
169 return format_; 183 return format_;
170 } 184 }
171 185
186 VideoFrame::ColorSpace VideoDecoderConfig::color_space() const {
187 return color_space_;
188 }
189
172 gfx::Size VideoDecoderConfig::coded_size() const { 190 gfx::Size VideoDecoderConfig::coded_size() const {
173 return coded_size_; 191 return coded_size_;
174 } 192 }
175 193
176 gfx::Rect VideoDecoderConfig::visible_rect() const { 194 gfx::Rect VideoDecoderConfig::visible_rect() const {
177 return visible_rect_; 195 return visible_rect_;
178 } 196 }
179 197
180 gfx::Size VideoDecoderConfig::natural_size() const { 198 gfx::Size VideoDecoderConfig::natural_size() const {
181 return natural_size_; 199 return natural_size_;
182 } 200 }
183 201
184 const uint8* VideoDecoderConfig::extra_data() const { 202 const uint8* VideoDecoderConfig::extra_data() const {
185 if (extra_data_.empty()) 203 if (extra_data_.empty())
186 return NULL; 204 return NULL;
187 return &extra_data_[0]; 205 return &extra_data_[0];
188 } 206 }
189 207
190 size_t VideoDecoderConfig::extra_data_size() const { 208 size_t VideoDecoderConfig::extra_data_size() const {
191 return extra_data_.size(); 209 return extra_data_.size();
192 } 210 }
193 211
194 bool VideoDecoderConfig::is_encrypted() const { 212 bool VideoDecoderConfig::is_encrypted() const {
195 return is_encrypted_; 213 return is_encrypted_;
196 } 214 }
197 215
198 } // namespace media 216 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698