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

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

Issue 45053003: Add UMA metrics for ffmpeg color ranges. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add period to comment. Created 7 years, 1 month 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_frame.h" 5 #include "media/base/video_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 case VideoFrame::I420: 59 case VideoFrame::I420:
60 return "I420"; 60 return "I420";
61 case VideoFrame::NATIVE_TEXTURE: 61 case VideoFrame::NATIVE_TEXTURE:
62 return "NATIVE_TEXTURE"; 62 return "NATIVE_TEXTURE";
63 #if defined(GOOGLE_TV) 63 #if defined(GOOGLE_TV)
64 case VideoFrame::HOLE: 64 case VideoFrame::HOLE:
65 return "HOLE"; 65 return "HOLE";
66 #endif 66 #endif
67 case VideoFrame::YV12A: 67 case VideoFrame::YV12A:
68 return "YV12A"; 68 return "YV12A";
69 case VideoFrame::FORMAT_HISTOGRAM_MAX:
70 return "FORMAT_HISTOGRAM_MAX";
69 } 71 }
70 NOTREACHED() << "Invalid videoframe format provided: " << format; 72 NOTREACHED() << "Invalid videoframe format provided: " << format;
71 return ""; 73 return "";
72 } 74 }
73 75
74 // static 76 // static
75 bool VideoFrame::IsValidConfig(VideoFrame::Format format, 77 bool VideoFrame::IsValidConfig(VideoFrame::Format format,
76 const gfx::Size& coded_size, 78 const gfx::Size& coded_size,
77 const gfx::Rect& visible_rect, 79 const gfx::Rect& visible_rect,
78 const gfx::Size& natural_size) { 80 const gfx::Size& natural_size) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 case VideoFrame::RGB32: 236 case VideoFrame::RGB32:
235 return 1; 237 return 1;
236 case VideoFrame::YV12: 238 case VideoFrame::YV12:
237 case VideoFrame::YV16: 239 case VideoFrame::YV16:
238 case VideoFrame::I420: 240 case VideoFrame::I420:
239 return 3; 241 return 3;
240 case VideoFrame::YV12A: 242 case VideoFrame::YV12A:
241 return 4; 243 return 4;
242 case VideoFrame::EMPTY: 244 case VideoFrame::EMPTY:
243 case VideoFrame::INVALID: 245 case VideoFrame::INVALID:
246 case VideoFrame::FORMAT_HISTOGRAM_MAX:
244 break; 247 break;
245 } 248 }
246 NOTREACHED() << "Unsupported video frame format: " << format; 249 NOTREACHED() << "Unsupported video frame format: " << format;
247 return 0; 250 return 0;
248 } 251 }
249 252
250 static inline size_t RoundUp(size_t value, size_t alignment) { 253 static inline size_t RoundUp(size_t value, size_t alignment) {
251 // Check that |alignment| is a power of 2. 254 // Check that |alignment| is a power of 2.
252 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1))); 255 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1)));
253 return ((value + (alignment - 1)) & ~(alignment-1)); 256 return ((value + (alignment - 1)) & ~(alignment-1));
(...skipping 19 matching lines...) Expand all
273 const size_t rounded_size = 276 const size_t rounded_size =
274 RoundUp(coded_size.width(), 2) * RoundUp(coded_size.height(), 2); 277 RoundUp(coded_size.width(), 2) * RoundUp(coded_size.height(), 2);
275 return rounded_size * 2; 278 return rounded_size * 2;
276 } 279 }
277 case VideoFrame::INVALID: 280 case VideoFrame::INVALID:
278 case VideoFrame::EMPTY: 281 case VideoFrame::EMPTY:
279 case VideoFrame::NATIVE_TEXTURE: 282 case VideoFrame::NATIVE_TEXTURE:
280 #if defined(GOOGLE_TV) 283 #if defined(GOOGLE_TV)
281 case VideoFrame::HOLE: 284 case VideoFrame::HOLE:
282 #endif 285 #endif
286 case VideoFrame::FORMAT_HISTOGRAM_MAX:
283 break; 287 break;
284 } 288 }
285 NOTREACHED() << "Unsupported video frame format: " << format; 289 NOTREACHED() << "Unsupported video frame format: " << format;
286 return 0; 290 return 0;
287 } 291 }
288 292
289 // Release data allocated by AllocateRGB() or AllocateYUV(). 293 // Release data allocated by AllocateRGB() or AllocateYUV().
290 static void ReleaseData(uint8* data) { 294 static void ReleaseData(uint8* data) {
291 DCHECK(data); 295 DCHECK(data);
292 base::AlignedFree(data); 296 base::AlignedFree(data);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 : mailbox_(mailbox), 493 : mailbox_(mailbox),
490 sync_point_(sync_point), 494 sync_point_(sync_point),
491 release_callback_(release_callback) {} 495 release_callback_(release_callback) {}
492 496
493 VideoFrame::MailboxHolder::~MailboxHolder() { 497 VideoFrame::MailboxHolder::~MailboxHolder() {
494 if (!release_callback_.is_null()) 498 if (!release_callback_.is_null())
495 release_callback_.Run(sync_point_); 499 release_callback_.Run(sync_point_);
496 } 500 }
497 501
498 } // namespace media 502 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698