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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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_I444) { |
464 CHECK(!vpx_codec_alpha_); | 464 CHECK(!vpx_codec_alpha_); |
465 codec_format = VideoFrame::YV24; | 465 codec_format = VideoFrame::YV24; |
466 uv_rows = vpx_image->d_h; | 466 uv_rows = vpx_image->d_h; |
467 } else if (vpx_codec_alpha_) { | 467 } else if (vpx_codec_alpha_) { |
468 codec_format = VideoFrame::YV12A; | 468 codec_format = VideoFrame::YV12A; |
469 } else if (vpx_image->cs == VPX_CS_BT_709) { | |
470 // TODO(watk): A limitation of conflating color space with pixel format is | |
471 // that it's not possible to have BT709 with alpha. | |
472 // Until color space is separated from format, prefer YV12A over YV12HD. | |
xhwang
2015/03/04 18:07:14
This seems more like a comment/todo for l.468. Mov
watk
2015/03/04 18:23:02
Done.
| |
473 codec_format = VideoFrame::YV12HD; | |
469 } | 474 } |
470 | 475 |
471 gfx::Size size(vpx_image->d_w, vpx_image->d_h); | 476 gfx::Size size(vpx_image->d_w, vpx_image->d_h); |
472 | 477 |
473 if (!vpx_codec_alpha_ && memory_pool_.get()) { | 478 if (!vpx_codec_alpha_ && memory_pool_.get()) { |
474 *video_frame = VideoFrame::WrapExternalYuvData( | 479 *video_frame = VideoFrame::WrapExternalYuvData( |
475 codec_format, | 480 codec_format, |
476 size, gfx::Rect(size), config_.natural_size(), | 481 size, gfx::Rect(size), config_.natural_size(), |
477 vpx_image->stride[VPX_PLANE_Y], | 482 vpx_image->stride[VPX_PLANE_Y], |
478 vpx_image->stride[VPX_PLANE_U], | 483 vpx_image->stride[VPX_PLANE_U], |
(...skipping 32 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()); | 516 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); |
512 return; | 517 return; |
513 } | 518 } |
514 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 519 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
515 vpx_image_alpha->stride[VPX_PLANE_Y], | 520 vpx_image_alpha->stride[VPX_PLANE_Y], |
516 vpx_image_alpha->d_h, | 521 vpx_image_alpha->d_h, |
517 video_frame->get()); | 522 video_frame->get()); |
518 } | 523 } |
519 | 524 |
520 } // namespace media | 525 } // namespace media |
OLD | NEW |