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

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

Issue 12310041: experiment with -Wimplicit-fallthrough Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase Created 6 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « gpu/config/gpu_info_collector_mac.mm ('k') | media/filters/gpu_video_decoder.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 (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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 case VideoFrame::I420: { 294 case VideoFrame::I420: {
295 switch (plane) { 295 switch (plane) {
296 case VideoFrame::kYPlane: 296 case VideoFrame::kYPlane:
297 return area; 297 return area;
298 case VideoFrame::kUPlane: 298 case VideoFrame::kUPlane:
299 case VideoFrame::kVPlane: 299 case VideoFrame::kVPlane:
300 return area / 4; 300 return area / 4;
301 default: 301 default:
302 break; 302 break;
303 } 303 }
304 break;
304 } 305 }
305 case VideoFrame::YV12A: { 306 case VideoFrame::YV12A: {
306 switch (plane) { 307 switch (plane) {
307 case VideoFrame::kYPlane: 308 case VideoFrame::kYPlane:
308 case VideoFrame::kAPlane: 309 case VideoFrame::kAPlane:
309 return area; 310 return area;
310 case VideoFrame::kUPlane: 311 case VideoFrame::kUPlane:
311 case VideoFrame::kVPlane: 312 case VideoFrame::kVPlane:
312 return area / 4; 313 return area / 4;
313 default: 314 default:
314 break; 315 break;
315 } 316 }
317 break;
316 } 318 }
317 case VideoFrame::YV16: { 319 case VideoFrame::YV16: {
318 switch (plane) { 320 switch (plane) {
319 case VideoFrame::kYPlane: 321 case VideoFrame::kYPlane:
320 return area; 322 return area;
321 case VideoFrame::kUPlane: 323 case VideoFrame::kUPlane:
322 case VideoFrame::kVPlane: 324 case VideoFrame::kVPlane:
323 return area / 2; 325 return area / 2;
324 default: 326 default:
325 break; 327 break;
326 } 328 }
329 break;
327 } 330 }
328 case VideoFrame::UNKNOWN: 331 case VideoFrame::UNKNOWN:
329 case VideoFrame::NATIVE_TEXTURE: 332 case VideoFrame::NATIVE_TEXTURE:
330 case VideoFrame::HISTOGRAM_MAX: 333 case VideoFrame::HISTOGRAM_MAX:
331 #if defined(VIDEO_HOLE) 334 #if defined(VIDEO_HOLE)
332 case VideoFrame::HOLE: 335 case VideoFrame::HOLE:
333 #endif // defined(VIDEO_HOLE) 336 #endif // defined(VIDEO_HOLE)
334 break; 337 break;
335 } 338 }
336 NOTREACHED() << "Unsupported video frame format/plane: " 339 NOTREACHED() << "Unsupported video frame format/plane: "
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 } 434 }
432 435
433 int VideoFrame::row_bytes(size_t plane) const { 436 int VideoFrame::row_bytes(size_t plane) const {
434 DCHECK(IsValidPlane(plane)); 437 DCHECK(IsValidPlane(plane));
435 int width = coded_size_.width(); 438 int width = coded_size_.width();
436 switch (format_) { 439 switch (format_) {
437 // Planar, 8bpp. 440 // Planar, 8bpp.
438 case YV12A: 441 case YV12A:
439 if (plane == kAPlane) 442 if (plane == kAPlane)
440 return width; 443 return width;
441 // Fallthrough. 444 FALLTHROUGH_INTENDED;
442 case YV12: 445 case YV12:
443 case YV16: 446 case YV16:
444 case I420: 447 case I420:
445 case YV12J: 448 case YV12J:
446 if (plane == kYPlane) 449 if (plane == kYPlane)
447 return width; 450 return width;
448 return RoundUp(width, 2) / 2; 451 return RoundUp(width, 2) / 2;
449 452
450 default: 453 default:
451 break; 454 break;
452 } 455 }
453 456
454 // Intentionally leave out non-production formats. 457 // Intentionally leave out non-production formats.
455 NOTREACHED() << "Unsupported video frame format: " << format_; 458 NOTREACHED() << "Unsupported video frame format: " << format_;
456 return 0; 459 return 0;
457 } 460 }
458 461
459 int VideoFrame::rows(size_t plane) const { 462 int VideoFrame::rows(size_t plane) const {
460 DCHECK(IsValidPlane(plane)); 463 DCHECK(IsValidPlane(plane));
461 int height = coded_size_.height(); 464 int height = coded_size_.height();
462 switch (format_) { 465 switch (format_) {
463 case YV16: 466 case YV16:
464 return height; 467 return height;
465 468
466 case YV12A: 469 case YV12A:
467 if (plane == kAPlane) 470 if (plane == kAPlane)
468 return height; 471 return height;
469 // Fallthrough. 472 FALLTHROUGH_INTENDED;
470 case YV12: 473 case YV12:
471 case I420: 474 case I420:
472 if (plane == kYPlane) 475 if (plane == kYPlane)
473 return height; 476 return height;
474 return RoundUp(height, 2) / 2; 477 return RoundUp(height, 2) / 2;
475 478
476 default: 479 default:
477 break; 480 break;
478 } 481 }
479 482
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 : mailbox_(mailbox), 523 : mailbox_(mailbox),
521 sync_point_(sync_point), 524 sync_point_(sync_point),
522 release_callback_(release_callback) {} 525 release_callback_(release_callback) {}
523 526
524 VideoFrame::MailboxHolder::~MailboxHolder() { 527 VideoFrame::MailboxHolder::~MailboxHolder() {
525 if (!release_callback_.is_null()) 528 if (!release_callback_.is_null())
526 release_callback_.Run(sync_point_); 529 release_callback_.Run(sync_point_);
527 } 530 }
528 531
529 } // namespace media 532 } // namespace media
OLDNEW
« no previous file with comments | « gpu/config/gpu_info_collector_mac.mm ('k') | media/filters/gpu_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698