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

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

Issue 148553003: Clean up histogram'd media enum max values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 6 years, 10 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_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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 case VideoFrame::NATIVE_TEXTURE: 55 case VideoFrame::NATIVE_TEXTURE:
56 return "NATIVE_TEXTURE"; 56 return "NATIVE_TEXTURE";
57 #if defined(VIDEO_HOLE) 57 #if defined(VIDEO_HOLE)
58 case VideoFrame::HOLE: 58 case VideoFrame::HOLE:
59 return "HOLE"; 59 return "HOLE";
60 #endif // defined(VIDEO_HOLE) 60 #endif // defined(VIDEO_HOLE)
61 case VideoFrame::YV12A: 61 case VideoFrame::YV12A:
62 return "YV12A"; 62 return "YV12A";
63 case VideoFrame::YV12J: 63 case VideoFrame::YV12J:
64 return "YV12J"; 64 return "YV12J";
65 case VideoFrame::HISTOGRAM_MAX:
66 return "HISTOGRAM_MAX";
67 } 65 }
68 NOTREACHED() << "Invalid videoframe format provided: " << format; 66 NOTREACHED() << "Invalid videoframe format provided: " << format;
69 return ""; 67 return "";
70 } 68 }
71 69
72 // static 70 // static
73 bool VideoFrame::IsValidConfig(VideoFrame::Format format, 71 bool VideoFrame::IsValidConfig(VideoFrame::Format format,
74 const gfx::Size& coded_size, 72 const gfx::Size& coded_size,
75 const gfx::Rect& visible_rect, 73 const gfx::Rect& visible_rect,
76 const gfx::Size& natural_size) { 74 const gfx::Size& natural_size) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 #endif // defined(VIDEO_HOLE) 252 #endif // defined(VIDEO_HOLE)
255 return 0; 253 return 0;
256 case VideoFrame::YV12: 254 case VideoFrame::YV12:
257 case VideoFrame::YV16: 255 case VideoFrame::YV16:
258 case VideoFrame::I420: 256 case VideoFrame::I420:
259 case VideoFrame::YV12J: 257 case VideoFrame::YV12J:
260 return 3; 258 return 3;
261 case VideoFrame::YV12A: 259 case VideoFrame::YV12A:
262 return 4; 260 return 4;
263 case VideoFrame::UNKNOWN: 261 case VideoFrame::UNKNOWN:
264 case VideoFrame::HISTOGRAM_MAX:
265 break; 262 break;
266 } 263 }
267 NOTREACHED() << "Unsupported video frame format: " << format; 264 NOTREACHED() << "Unsupported video frame format: " << format;
268 return 0; 265 return 0;
269 } 266 }
270 267
271 static inline size_t RoundUp(size_t value, size_t alignment) { 268 static inline size_t RoundUp(size_t value, size_t alignment) {
272 // Check that |alignment| is a power of 2. 269 // Check that |alignment| is a power of 2.
273 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1))); 270 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1)));
274 return ((value + (alignment - 1)) & ~(alignment-1)); 271 return ((value + (alignment - 1)) & ~(alignment-1));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 return area; 317 return area;
321 case VideoFrame::kUPlane: 318 case VideoFrame::kUPlane:
322 case VideoFrame::kVPlane: 319 case VideoFrame::kVPlane:
323 return area / 2; 320 return area / 2;
324 default: 321 default:
325 break; 322 break;
326 } 323 }
327 } 324 }
328 case VideoFrame::UNKNOWN: 325 case VideoFrame::UNKNOWN:
329 case VideoFrame::NATIVE_TEXTURE: 326 case VideoFrame::NATIVE_TEXTURE:
330 case VideoFrame::HISTOGRAM_MAX:
331 #if defined(VIDEO_HOLE) 327 #if defined(VIDEO_HOLE)
332 case VideoFrame::HOLE: 328 case VideoFrame::HOLE:
333 #endif // defined(VIDEO_HOLE) 329 #endif // defined(VIDEO_HOLE)
334 break; 330 break;
335 } 331 }
336 NOTREACHED() << "Unsupported video frame format/plane: " 332 NOTREACHED() << "Unsupported video frame format/plane: "
337 << format << "/" << plane; 333 << format << "/" << plane;
338 return 0; 334 return 0;
339 } 335 }
340 336
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 : mailbox_(mailbox), 516 : mailbox_(mailbox),
521 sync_point_(sync_point), 517 sync_point_(sync_point),
522 release_callback_(release_callback) {} 518 release_callback_(release_callback) {}
523 519
524 VideoFrame::MailboxHolder::~MailboxHolder() { 520 VideoFrame::MailboxHolder::~MailboxHolder() {
525 if (!release_callback_.is_null()) 521 if (!release_callback_.is_null())
526 release_callback_.Run(sync_point_); 522 release_callback_.Run(sync_point_);
527 } 523 }
528 524
529 } // namespace media 525 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698