Commit a865a068 authored by sandersd@chromium.org's avatar sandersd@chromium.org

Support for YUV 4:4:4 subsampling in vpx decoder.

Depends on https://codereview.chromium.org/289373011/.

BUG=104711

Review URL: https://codereview.chromium.org/308543002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274747 0039d316-1c4b-4281-b951-d872f2087c98
parent c3a6b4a7
...@@ -1454,6 +1454,15 @@ TEST_F(PipelineIntegrationTest, ...@@ -1454,6 +1454,15 @@ TEST_F(PipelineIntegrationTest,
ASSERT_TRUE(WaitUntilOnEnded()); ASSERT_TRUE(WaitUntilOnEnded());
} }
// Verify that VP9 video with 4:4:4 subsampling can be played back.
TEST_F(PipelineIntegrationTest, P444_VP9_WebM) {
ASSERT_TRUE(Start(GetTestDataFilePath("bear-320x240-P444.webm"),
PIPELINE_OK));
Play();
ASSERT_TRUE(WaitUntilOnEnded());
EXPECT_EQ(last_video_frame_format_, VideoFrame::YV24);
}
// For MediaSource tests, generate two sets of tests: one using FrameProcessor, // For MediaSource tests, generate two sets of tests: one using FrameProcessor,
// and one using LegacyFrameProcessor. // and one using LegacyFrameProcessor.
INSTANTIATE_TEST_CASE_P(NewFrameProcessor, PipelineIntegrationTest, INSTANTIATE_TEST_CASE_P(NewFrameProcessor, PipelineIntegrationTest,
......
...@@ -450,27 +450,39 @@ void VpxVideoDecoder::CopyVpxImageTo(const vpx_image* vpx_image, ...@@ -450,27 +450,39 @@ void VpxVideoDecoder::CopyVpxImageTo(const vpx_image* vpx_image,
scoped_refptr<VideoFrame>* video_frame) { scoped_refptr<VideoFrame>* video_frame) {
CHECK(vpx_image); CHECK(vpx_image);
CHECK(vpx_image->fmt == VPX_IMG_FMT_I420 || CHECK(vpx_image->fmt == VPX_IMG_FMT_I420 ||
vpx_image->fmt == VPX_IMG_FMT_YV12); vpx_image->fmt == VPX_IMG_FMT_YV12 ||
vpx_image->fmt == VPX_IMG_FMT_I444);
VideoFrame::Format codec_format = VideoFrame::YV12;
int uv_rows = (vpx_image->d_h + 1) / 2;
if (vpx_image->fmt == VPX_IMG_FMT_I444) {
CHECK(!vpx_codec_alpha_);
codec_format = VideoFrame::YV24;
uv_rows = vpx_image->d_h;
} else if (vpx_codec_alpha_) {
codec_format = VideoFrame::YV12A;
}
gfx::Size size(vpx_image->d_w, vpx_image->d_h); gfx::Size size(vpx_image->d_w, vpx_image->d_h);
if (!vpx_codec_alpha_ && memory_pool_) { if (!vpx_codec_alpha_ && memory_pool_) {
*video_frame = VideoFrame::WrapExternalYuvData( *video_frame = VideoFrame::WrapExternalYuvData(
VideoFrame::YV12, codec_format,
size, gfx::Rect(size), config_.natural_size(), size, gfx::Rect(size), config_.natural_size(),
vpx_image->stride[VPX_PLANE_Y], vpx_image->stride[VPX_PLANE_Y],
vpx_image->stride[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_U],
vpx_image->stride[VPX_PLANE_V], vpx_image->stride[VPX_PLANE_V],
vpx_image->planes[VPX_PLANE_Y], vpx_image->planes[VPX_PLANE_Y],
vpx_image->planes[VPX_PLANE_U], vpx_image->planes[VPX_PLANE_U],
vpx_image->planes[VPX_PLANE_V], vpx_image->planes[VPX_PLANE_V],
kNoTimestamp(), kNoTimestamp(),
memory_pool_->CreateFrameCallback(vpx_image->fb_priv)); memory_pool_->CreateFrameCallback(vpx_image->fb_priv));
return; return;
} }
*video_frame = frame_pool_.CreateFrame( *video_frame = frame_pool_.CreateFrame(
vpx_codec_alpha_ ? VideoFrame::YV12A : VideoFrame::YV12, codec_format,
size, size,
gfx::Rect(size), gfx::Rect(size),
config_.natural_size(), config_.natural_size(),
...@@ -482,11 +494,11 @@ void VpxVideoDecoder::CopyVpxImageTo(const vpx_image* vpx_image, ...@@ -482,11 +494,11 @@ void VpxVideoDecoder::CopyVpxImageTo(const vpx_image* vpx_image,
video_frame->get()); video_frame->get());
CopyUPlane(vpx_image->planes[VPX_PLANE_U], CopyUPlane(vpx_image->planes[VPX_PLANE_U],
vpx_image->stride[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_U],
(vpx_image->d_h + 1) / 2, uv_rows,
video_frame->get()); video_frame->get());
CopyVPlane(vpx_image->planes[VPX_PLANE_V], CopyVPlane(vpx_image->planes[VPX_PLANE_V],
vpx_image->stride[VPX_PLANE_V], vpx_image->stride[VPX_PLANE_V],
(vpx_image->d_h + 1) / 2, uv_rows,
video_frame->get()); video_frame->get());
if (!vpx_codec_alpha_) if (!vpx_codec_alpha_)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment