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

Side by Side Diff: media/renderers/skcanvas_video_renderer.cc

Issue 2370453003: 12-bit vp9 video support (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/mojo/interfaces/media_types.mojom ('k') | media/test/data/bear-320x180-hi12p-vp9.webm » ('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/renderers/skcanvas_video_renderer.h" 5 #include "media/renderers/skcanvas_video_renderer.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "gpu/GLES2/gl2extchromium.h" 10 #include "gpu/GLES2/gl2extchromium.h"
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 444
445 namespace { 445 namespace {
446 446
447 // libyuv doesn't support 9- and 10-bit video frames yet. This function 447 // libyuv doesn't support 9- and 10-bit video frames yet. This function
448 // creates a regular 8-bit video frame which we can give to libyuv. 448 // creates a regular 8-bit video frame which we can give to libyuv.
449 scoped_refptr<VideoFrame> DownShiftHighbitVideoFrame( 449 scoped_refptr<VideoFrame> DownShiftHighbitVideoFrame(
450 const VideoFrame* video_frame) { 450 const VideoFrame* video_frame) {
451 VideoPixelFormat format; 451 VideoPixelFormat format;
452 int shift = 1; 452 int shift = 1;
453 switch (video_frame->format()) { 453 switch (video_frame->format()) {
454 case PIXEL_FORMAT_YUV420P12:
455 shift += 2;
454 case PIXEL_FORMAT_YUV420P10: 456 case PIXEL_FORMAT_YUV420P10:
455 shift = 2; 457 shift++;
DaleCurtis 2016/09/23 23:42:24 Why the change?
hubbe 2016/09/23 23:43:06 Because of fall-through?
DaleCurtis 2016/09/23 23:45:42 Oooh, yuck. This seems like it would be way more l
hubbe 2016/09/23 23:49:49 It's longer and seems a bit more error-prone to me
456 case PIXEL_FORMAT_YUV420P9: 458 case PIXEL_FORMAT_YUV420P9:
457 format = PIXEL_FORMAT_I420; 459 format = PIXEL_FORMAT_I420;
458 break; 460 break;
461
462 case PIXEL_FORMAT_YUV422P12:
463 shift += 2;
459 case PIXEL_FORMAT_YUV422P10: 464 case PIXEL_FORMAT_YUV422P10:
460 shift = 2; 465 shift++;
461 case PIXEL_FORMAT_YUV422P9: 466 case PIXEL_FORMAT_YUV422P9:
462 format = PIXEL_FORMAT_YV16; 467 format = PIXEL_FORMAT_YV16;
463 break; 468 break;
469
470 case PIXEL_FORMAT_YUV444P12:
471 shift += 2;
464 case PIXEL_FORMAT_YUV444P10: 472 case PIXEL_FORMAT_YUV444P10:
465 shift = 2; 473 shift++;
466 case PIXEL_FORMAT_YUV444P9: 474 case PIXEL_FORMAT_YUV444P9:
467 format = PIXEL_FORMAT_YV24; 475 format = PIXEL_FORMAT_YV24;
468 break; 476 break;
469 477
470 default: 478 default:
471 NOTREACHED(); 479 NOTREACHED();
472 return nullptr; 480 return nullptr;
473 } 481 }
474 scoped_refptr<VideoFrame> ret = VideoFrame::CreateFrame( 482 scoped_refptr<VideoFrame> ret = VideoFrame::CreateFrame(
475 format, video_frame->coded_size(), video_frame->visible_rect(), 483 format, video_frame->coded_size(), video_frame->visible_rect(),
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 static_cast<uint8_t*>(rgb_pixels), row_bytes, 593 static_cast<uint8_t*>(rgb_pixels), row_bytes,
586 video_frame->visible_rect().width(), 594 video_frame->visible_rect().width(),
587 video_frame->visible_rect().height()); 595 video_frame->visible_rect().height());
588 break; 596 break;
589 597
590 case PIXEL_FORMAT_YUV420P9: 598 case PIXEL_FORMAT_YUV420P9:
591 case PIXEL_FORMAT_YUV422P9: 599 case PIXEL_FORMAT_YUV422P9:
592 case PIXEL_FORMAT_YUV444P9: 600 case PIXEL_FORMAT_YUV444P9:
593 case PIXEL_FORMAT_YUV420P10: 601 case PIXEL_FORMAT_YUV420P10:
594 case PIXEL_FORMAT_YUV422P10: 602 case PIXEL_FORMAT_YUV422P10:
595 case PIXEL_FORMAT_YUV444P10: { 603 case PIXEL_FORMAT_YUV444P10:
604 case PIXEL_FORMAT_YUV420P12:
605 case PIXEL_FORMAT_YUV422P12:
606 case PIXEL_FORMAT_YUV444P12: {
596 scoped_refptr<VideoFrame> temporary_frame = 607 scoped_refptr<VideoFrame> temporary_frame =
597 DownShiftHighbitVideoFrame(video_frame); 608 DownShiftHighbitVideoFrame(video_frame);
598 ConvertVideoFrameToRGBPixels(temporary_frame.get(), rgb_pixels, 609 ConvertVideoFrameToRGBPixels(temporary_frame.get(), rgb_pixels,
599 row_bytes); 610 row_bytes);
600 break; 611 break;
601 } 612 }
602 613
603 case PIXEL_FORMAT_NV12: 614 case PIXEL_FORMAT_NV12:
604 case PIXEL_FORMAT_NV21: 615 case PIXEL_FORMAT_NV21:
605 case PIXEL_FORMAT_UYVY: 616 case PIXEL_FORMAT_UYVY:
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 if (!last_image_) // Couldn't create the SkImage. 765 if (!last_image_) // Couldn't create the SkImage.
755 return false; 766 return false;
756 last_timestamp_ = video_frame->timestamp(); 767 last_timestamp_ = video_frame->timestamp();
757 } 768 }
758 last_image_deleting_timer_.Reset(); 769 last_image_deleting_timer_.Reset();
759 DCHECK(!!last_image_); 770 DCHECK(!!last_image_);
760 return true; 771 return true;
761 } 772 }
762 773
763 } // namespace media 774 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/interfaces/media_types.mojom ('k') | media/test/data/bear-320x180-hi12p-vp9.webm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698