Commit db2bf675 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

GenericDmaBufVideoFrameValidator: Map YV12 VideoFrame as-is

GenericDmaBufVideoFrameValidator swaps U plane and V plane addresses so that
VideoFrameValidator is able to libyuv::I420Copy in the order Y, U and V. This
is a wrong design, meaning VideoFrameMapper does not only map but also
does something. VideoFrameMapper caller should expect the address acquired by
VideoFrame::data(UPlane) is V plane's and one by VideoFrame::data(VPlane) is U
plane's in the case of YV12 VideoFrame.

BUG=chromium:895230, chromium:856562
TEST=VDA unittest on hana with --frame_validator=check
TEST=VEA unittest on hana with --native_input

Change-Id: Ibf5e5685d95634fe6720f07dc154fd01907516d8
Reviewed-on: https://chromium-review.googlesource.com/c/1341783Reviewed-by: default avatarPawel Osciak <posciak@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609518}
parent c1b5b2a2
......@@ -53,11 +53,6 @@ scoped_refptr<VideoFrame> CreateMappedVideoFrame(
for (size_t i = 0; i < layout.num_planes(); i++) {
strides[i] = layout.planes()[i].stride;
}
if (layout.format() == PIXEL_FORMAT_YV12) {
// Swap the address of U and V planes, because the order U and V planes is
// reversed in YV12.
std::swap(plane_addrs[1], plane_addrs[2]);
}
auto video_frame = VideoFrame::WrapExternalYuvData(
layout.format(), layout.coded_size(), visible_rect, visible_rect.size(),
strides[0], strides[1], strides[2], plane_addrs[0], plane_addrs[1],
......
......@@ -163,10 +163,10 @@ scoped_refptr<VideoFrame> VideoFrameValidator::CreateI420Frame(
case PIXEL_FORMAT_YV12:
libyuv::I420Copy(src_frame->data(VideoFrame::kYPlane),
src_frame->stride(VideoFrame::kYPlane),
src_frame->data(VideoFrame::kUPlane),
src_frame->stride(VideoFrame::kUPlane),
src_frame->data(VideoFrame::kVPlane),
src_frame->stride(VideoFrame::kVPlane), dst_y,
src_frame->stride(VideoFrame::kVPlane),
src_frame->data(VideoFrame::kUPlane),
src_frame->stride(VideoFrame::kUPlane), dst_y,
dst_stride_y, dst_u, dst_stride_u, dst_v, dst_stride_v,
width, height);
break;
......
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