| OLD | NEW |
| 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/filters/vpx_video_decoder.h" | 5 #include "media/filters/vpx_video_decoder.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 if (vpx_image_alpha) { | 689 if (vpx_image_alpha) { |
| 690 VpxVideoDecoder::MemoryPool::VP9FrameBuffer* frame_buffer = | 690 VpxVideoDecoder::MemoryPool::VP9FrameBuffer* frame_buffer = |
| 691 static_cast<VpxVideoDecoder::MemoryPool::VP9FrameBuffer*>( | 691 static_cast<VpxVideoDecoder::MemoryPool::VP9FrameBuffer*>( |
| 692 vpx_image->fb_priv); | 692 vpx_image->fb_priv); |
| 693 *video_frame = VideoFrame::WrapExternalYuvaData( | 693 *video_frame = VideoFrame::WrapExternalYuvaData( |
| 694 codec_format, coded_size, gfx::Rect(visible_size), | 694 codec_format, coded_size, gfx::Rect(visible_size), |
| 695 config_.natural_size(), vpx_image->stride[VPX_PLANE_Y], | 695 config_.natural_size(), vpx_image->stride[VPX_PLANE_Y], |
| 696 vpx_image->stride[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_V], | 696 vpx_image->stride[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_V], |
| 697 vpx_image_alpha->stride[VPX_PLANE_Y], vpx_image->planes[VPX_PLANE_Y], | 697 vpx_image_alpha->stride[VPX_PLANE_Y], vpx_image->planes[VPX_PLANE_Y], |
| 698 vpx_image->planes[VPX_PLANE_U], vpx_image->planes[VPX_PLANE_V], | 698 vpx_image->planes[VPX_PLANE_U], vpx_image->planes[VPX_PLANE_V], |
| 699 &frame_buffer->alpha_data[0], kNoTimestamp()); | 699 &frame_buffer->alpha_data[0], kNoTimestamp); |
| 700 } else { | 700 } else { |
| 701 *video_frame = VideoFrame::WrapExternalYuvData( | 701 *video_frame = VideoFrame::WrapExternalYuvData( |
| 702 codec_format, coded_size, gfx::Rect(visible_size), | 702 codec_format, coded_size, gfx::Rect(visible_size), |
| 703 config_.natural_size(), vpx_image->stride[VPX_PLANE_Y], | 703 config_.natural_size(), vpx_image->stride[VPX_PLANE_Y], |
| 704 vpx_image->stride[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_V], | 704 vpx_image->stride[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_V], |
| 705 vpx_image->planes[VPX_PLANE_Y], vpx_image->planes[VPX_PLANE_U], | 705 vpx_image->planes[VPX_PLANE_Y], vpx_image->planes[VPX_PLANE_U], |
| 706 vpx_image->planes[VPX_PLANE_V], kNoTimestamp()); | 706 vpx_image->planes[VPX_PLANE_V], kNoTimestamp); |
| 707 } | 707 } |
| 708 if (!(*video_frame)) | 708 if (!(*video_frame)) |
| 709 return false; | 709 return false; |
| 710 | 710 |
| 711 video_frame->get()->AddDestructionObserver( | 711 video_frame->get()->AddDestructionObserver( |
| 712 memory_pool_->CreateFrameCallback(vpx_image->fb_priv)); | 712 memory_pool_->CreateFrameCallback(vpx_image->fb_priv)); |
| 713 return true; | 713 return true; |
| 714 } | 714 } |
| 715 | 715 |
| 716 DCHECK(codec_format == PIXEL_FORMAT_YV12 || | 716 DCHECK(codec_format == PIXEL_FORMAT_YV12 || |
| 717 codec_format == PIXEL_FORMAT_YV12A); | 717 codec_format == PIXEL_FORMAT_YV12A); |
| 718 | 718 |
| 719 *video_frame = frame_pool_.CreateFrame( | 719 *video_frame = frame_pool_.CreateFrame(codec_format, visible_size, |
| 720 codec_format, visible_size, gfx::Rect(visible_size), | 720 gfx::Rect(visible_size), |
| 721 config_.natural_size(), kNoTimestamp()); | 721 config_.natural_size(), kNoTimestamp); |
| 722 if (!(*video_frame)) | 722 if (!(*video_frame)) |
| 723 return false; | 723 return false; |
| 724 | 724 |
| 725 libyuv::I420Copy( | 725 libyuv::I420Copy( |
| 726 vpx_image->planes[VPX_PLANE_Y], vpx_image->stride[VPX_PLANE_Y], | 726 vpx_image->planes[VPX_PLANE_Y], vpx_image->stride[VPX_PLANE_Y], |
| 727 vpx_image->planes[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_U], | 727 vpx_image->planes[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_U], |
| 728 vpx_image->planes[VPX_PLANE_V], vpx_image->stride[VPX_PLANE_V], | 728 vpx_image->planes[VPX_PLANE_V], vpx_image->stride[VPX_PLANE_V], |
| 729 (*video_frame)->visible_data(VideoFrame::kYPlane), | 729 (*video_frame)->visible_data(VideoFrame::kYPlane), |
| 730 (*video_frame)->stride(VideoFrame::kYPlane), | 730 (*video_frame)->stride(VideoFrame::kYPlane), |
| 731 (*video_frame)->visible_data(VideoFrame::kUPlane), | 731 (*video_frame)->visible_data(VideoFrame::kUPlane), |
| 732 (*video_frame)->stride(VideoFrame::kUPlane), | 732 (*video_frame)->stride(VideoFrame::kUPlane), |
| 733 (*video_frame)->visible_data(VideoFrame::kVPlane), | 733 (*video_frame)->visible_data(VideoFrame::kVPlane), |
| 734 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), | 734 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), |
| 735 coded_size.height()); | 735 coded_size.height()); |
| 736 | 736 |
| 737 return true; | 737 return true; |
| 738 } | 738 } |
| 739 | 739 |
| 740 } // namespace media | 740 } // namespace media |
| OLD | NEW |