Commit 921924de authored by Zhaoliang Ma's avatar Zhaoliang Ma Committed by Commit Bot

Pepper: replace memcpy with libyuv::CopyPlane in copying planes

This CL replaces memcpy with libyuv::CopyPlane since the copy
processing is the same as libyuv::CopyPlane.

Bug: None
Change-Id: Ib9f4e476ea2e18de5cf99c8c97e665f7ed3d1996
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2439679Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Zhaoliang Ma <zhaoliang.ma@intel.com>
Cr-Commit-Position: refs/heads/master@{#815548}
parent 3d4d9244
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "ppapi/thunk/enter.h" #include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_buffer_api.h" #include "ppapi/thunk/ppb_buffer_api.h"
#include "third_party/blink/public/web/modules/mediastream/media_stream_video_source.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_video_source.h"
#include "third_party/libyuv/include/libyuv/planar_functions.h"
#include "third_party/webrtc/common_video/libyuv/include/webrtc_libyuv.h" #include "third_party/webrtc/common_video/libyuv/include/webrtc_libyuv.h"
using ppapi::HostResource; using ppapi::HostResource;
...@@ -198,16 +199,13 @@ void PepperVideoCaptureHost::OnFrameReady(const media::VideoFrame& frame) { ...@@ -198,16 +199,13 @@ void PepperVideoCaptureHost::OnFrameReady(const media::VideoFrame& frame) {
gmb->Unmap(); gmb->Unmap();
} else { } else {
DCHECK_EQ(frame.format(), media::PIXEL_FORMAT_I420); DCHECK_EQ(frame.format(), media::PIXEL_FORMAT_I420);
for (size_t j = 0; j < media::VideoFrame::NumPlanes(frame.format()); size_t num_planes = media::VideoFrame::NumPlanes(frame.format());
++j) { for (size_t plane = 0; plane < num_planes; ++plane) {
const uint8_t* src = frame.visible_data(j); const uint8_t* src = frame.visible_data(plane);
const size_t row_bytes = frame.row_bytes(j); int row_bytes = frame.row_bytes(plane);
const size_t src_stride = frame.stride(j); int src_stride = frame.stride(plane);
for (int k = 0; k < frame.rows(j); ++k) { int rows = frame.rows(plane);
memcpy(dst, src, row_bytes); libyuv::CopyPlane(src, src_stride, dst, row_bytes, row_bytes, rows);
dst += row_bytes;
src += src_stride;
}
} }
} }
......
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