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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 const struct vpx_image* vpx_image_alpha, | 453 const struct vpx_image* vpx_image_alpha, |
454 scoped_refptr<VideoFrame>* video_frame) { | 454 scoped_refptr<VideoFrame>* video_frame) { |
455 CHECK(vpx_image); | 455 CHECK(vpx_image); |
456 CHECK(vpx_image->fmt == VPX_IMG_FMT_I420 || | 456 CHECK(vpx_image->fmt == VPX_IMG_FMT_I420 || |
457 vpx_image->fmt == VPX_IMG_FMT_YV12 || | 457 vpx_image->fmt == VPX_IMG_FMT_YV12 || |
458 vpx_image->fmt == VPX_IMG_FMT_I444); | 458 vpx_image->fmt == VPX_IMG_FMT_I444); |
459 | 459 |
460 VideoFrame::Format codec_format = VideoFrame::YV12; | 460 VideoFrame::Format codec_format = VideoFrame::YV12; |
461 int uv_rows = (vpx_image->d_h + 1) / 2; | 461 int uv_rows = (vpx_image->d_h + 1) / 2; |
462 | 462 |
463 if (vpx_image->fmt == VPX_IMG_FMT_I444) { | 463 if ((vpx_image->fmt == VPX_IMG_FMT_YV12 || |
464 vpx_image->fmt == VPX_IMG_FMT_I420) && | |
465 vpx_image->cs == VPX_CS_BT_709) { | |
xhwang
2015/03/03 19:53:30
Can vpx_codec_alpha_ be true here?
watk
2015/03/03 22:01:28
Yeah, it can. Unfortunately we have to choose betw
| |
466 codec_format = VideoFrame::YV12HD; | |
467 } else if (vpx_image->fmt == VPX_IMG_FMT_I444) { | |
xhwang
2015/03/03 19:53:30
Can vpx_image->cs == VPX_CS_BT_709 here?
watk
2015/03/03 22:01:28
It can, but we can't support it at the moment :( I
| |
464 CHECK(!vpx_codec_alpha_); | 468 CHECK(!vpx_codec_alpha_); |
465 codec_format = VideoFrame::YV24; | 469 codec_format = VideoFrame::YV24; |
466 uv_rows = vpx_image->d_h; | 470 uv_rows = vpx_image->d_h; |
467 } else if (vpx_codec_alpha_) { | 471 } else if (vpx_codec_alpha_) { |
468 codec_format = VideoFrame::YV12A; | 472 codec_format = VideoFrame::YV12A; |
469 } | 473 } |
470 | 474 |
471 gfx::Size size(vpx_image->d_w, vpx_image->d_h); | 475 gfx::Size size(vpx_image->d_w, vpx_image->d_h); |
472 | 476 |
473 if (!vpx_codec_alpha_ && memory_pool_.get()) { | 477 if (!vpx_codec_alpha_ && memory_pool_.get()) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); | 515 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); |
512 return; | 516 return; |
513 } | 517 } |
514 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 518 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
515 vpx_image_alpha->stride[VPX_PLANE_Y], | 519 vpx_image_alpha->stride[VPX_PLANE_Y], |
516 vpx_image_alpha->d_h, | 520 vpx_image_alpha->d_h, |
517 video_frame->get()); | 521 video_frame->get()); |
518 } | 522 } |
519 | 523 |
520 } // namespace media | 524 } // namespace media |
OLD | NEW |