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

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

Issue 2370453003: 12-bit vp9 video support (Closed)
Patch Set: typO 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 = 4;
456 format = PIXEL_FORMAT_I420;
457 break;
458
454 case PIXEL_FORMAT_YUV420P10: 459 case PIXEL_FORMAT_YUV420P10:
455 shift = 2; 460 shift = 2;
456 case PIXEL_FORMAT_YUV420P9:
457 format = PIXEL_FORMAT_I420; 461 format = PIXEL_FORMAT_I420;
458 break; 462 break;
463
464 case PIXEL_FORMAT_YUV420P9:
465 shift = 1;
466 format = PIXEL_FORMAT_I420;
467 break;
468
469 case PIXEL_FORMAT_YUV422P12:
470 shift = 4;
471 format = PIXEL_FORMAT_YV16;
472 break;
473
459 case PIXEL_FORMAT_YUV422P10: 474 case PIXEL_FORMAT_YUV422P10:
460 shift = 2; 475 shift = 2;
461 case PIXEL_FORMAT_YUV422P9:
462 format = PIXEL_FORMAT_YV16; 476 format = PIXEL_FORMAT_YV16;
463 break; 477 break;
464 case PIXEL_FORMAT_YUV444P10: 478
465 shift = 2; 479 case PIXEL_FORMAT_YUV422P9:
466 case PIXEL_FORMAT_YUV444P9: 480 shift = 1;
481 format = PIXEL_FORMAT_YV16;
482 break;
483
484 case PIXEL_FORMAT_YUV444P12:
485 shift = 4;
467 format = PIXEL_FORMAT_YV24; 486 format = PIXEL_FORMAT_YV24;
468 break; 487 break;
469 488
489 case PIXEL_FORMAT_YUV444P10:
490 shift = 2;
491 format = PIXEL_FORMAT_YV24;
492 break;
493
494 case PIXEL_FORMAT_YUV444P9:
495 shift = 1;
496 format = PIXEL_FORMAT_YV24;
497 break;
498
470 default: 499 default:
471 NOTREACHED(); 500 NOTREACHED();
472 return nullptr; 501 return nullptr;
473 } 502 }
474 scoped_refptr<VideoFrame> ret = VideoFrame::CreateFrame( 503 scoped_refptr<VideoFrame> ret = VideoFrame::CreateFrame(
475 format, video_frame->coded_size(), video_frame->visible_rect(), 504 format, video_frame->coded_size(), video_frame->visible_rect(),
476 video_frame->natural_size(), video_frame->timestamp()); 505 video_frame->natural_size(), video_frame->timestamp());
477 506
478 // Copy all metadata. 507 // Copy all metadata.
479 // (May be enough to copy color space) 508 // (May be enough to copy color space)
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 static_cast<uint8_t*>(rgb_pixels), row_bytes, 614 static_cast<uint8_t*>(rgb_pixels), row_bytes,
586 video_frame->visible_rect().width(), 615 video_frame->visible_rect().width(),
587 video_frame->visible_rect().height()); 616 video_frame->visible_rect().height());
588 break; 617 break;
589 618
590 case PIXEL_FORMAT_YUV420P9: 619 case PIXEL_FORMAT_YUV420P9:
591 case PIXEL_FORMAT_YUV422P9: 620 case PIXEL_FORMAT_YUV422P9:
592 case PIXEL_FORMAT_YUV444P9: 621 case PIXEL_FORMAT_YUV444P9:
593 case PIXEL_FORMAT_YUV420P10: 622 case PIXEL_FORMAT_YUV420P10:
594 case PIXEL_FORMAT_YUV422P10: 623 case PIXEL_FORMAT_YUV422P10:
595 case PIXEL_FORMAT_YUV444P10: { 624 case PIXEL_FORMAT_YUV444P10:
625 case PIXEL_FORMAT_YUV420P12:
626 case PIXEL_FORMAT_YUV422P12:
627 case PIXEL_FORMAT_YUV444P12: {
596 scoped_refptr<VideoFrame> temporary_frame = 628 scoped_refptr<VideoFrame> temporary_frame =
597 DownShiftHighbitVideoFrame(video_frame); 629 DownShiftHighbitVideoFrame(video_frame);
598 ConvertVideoFrameToRGBPixels(temporary_frame.get(), rgb_pixels, 630 ConvertVideoFrameToRGBPixels(temporary_frame.get(), rgb_pixels,
599 row_bytes); 631 row_bytes);
600 break; 632 break;
601 } 633 }
602 634
603 case PIXEL_FORMAT_NV12: 635 case PIXEL_FORMAT_NV12:
604 case PIXEL_FORMAT_NV21: 636 case PIXEL_FORMAT_NV21:
605 case PIXEL_FORMAT_UYVY: 637 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. 786 if (!last_image_) // Couldn't create the SkImage.
755 return false; 787 return false;
756 last_timestamp_ = video_frame->timestamp(); 788 last_timestamp_ = video_frame->timestamp();
757 } 789 }
758 last_image_deleting_timer_.Reset(); 790 last_image_deleting_timer_.Reset();
759 DCHECK(!!last_image_); 791 DCHECK(!!last_image_);
760 return true; 792 return true;
761 } 793 }
762 794
763 } // namespace media 795 } // 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