Commit 7960f912 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Chromium LUCI CQ

media/gpu/test/Video: Fix the plane size computation for decoded frames

Video::Decode() decodes compressed videos and fills decoded frames
to the buffer. Originally, the plane size of filled frames is
computed by VideoFrame::PlaneSize().GetArea(). However, this
aligns resolutions by two and thus the computed plane size is not
the succinct area. For instance, when a resolution is 641x361,
PlaneSize().GetArea() returns 232404=642x362 for the first plane,
but the test demands a plane size is 231401=641x361. This CL
fixes the mismatch.
This enables video_encode_accelerator_tests to run odd resolution
videos.

Bug: b:174318867
Test: video_encode_accelerator_tests crowd-641x361.vp9.webm --codec=vp9 on atlas
Change-Id: I5d2d9fa31ae838abd501e60e19509d667f70821c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2563186
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarDavid Staessens <dstaessens@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834128}
parent 05df6aa4
...@@ -598,8 +598,10 @@ void Video::OnFrameDecoded(const gfx::Size& resolution, ...@@ -598,8 +598,10 @@ void Video::OnFrameDecoded(const gfx::Size& resolution,
VideoFrame::Rows(plane, frame->format(), resolution.height()); VideoFrame::Rows(plane, frame->format(), resolution.height());
const int row_bytes = const int row_bytes =
VideoFrame::RowBytes(plane, frame->format(), resolution.width()); VideoFrame::RowBytes(plane, frame->format(), resolution.width());
const size_t plane_size = // VideoFrame::PlaneSize() cannot be used because it computes the plane size
VideoFrame::PlaneSize(frame->format(), plane, resolution).GetArea(); // with resolutions aligned by two while our test code works with a succinct
// buffer size.
const int plane_size = row_bytes * rows;
const size_t current_pos = data->size(); const size_t current_pos = data->size();
// TODO(dstaessens): Avoid resizing. // TODO(dstaessens): Avoid resizing.
data->resize(data->size() + plane_size); data->resize(data->size() + plane_size);
......
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