Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1554)

Unified Diff: media/base/video_util.cc

Issue 1955233002: Revert of Memory copy the VideoFrame to match the requirement for HW encoders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/video_util.h ('k') | media/base/video_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_util.cc
diff --git a/media/base/video_util.cc b/media/base/video_util.cc
index 7c44e2c1751ebf3225a820755ceb847ca0e6b893..d9954f8f8e7b4b902d33bd6c63aebd42d619801c 100644
--- a/media/base/video_util.cc
+++ b/media/base/video_util.cc
@@ -11,7 +11,6 @@
#include "base/numerics/safe_math.h"
#include "media/base/video_frame.h"
#include "media/base/yuv_convert.h"
-#include "third_party/libyuv/include/libyuv.h"
namespace media {
@@ -19,35 +18,6 @@
// Empty method used for keeping a reference to the original media::VideoFrame.
void ReleaseOriginalFrame(const scoped_refptr<media::VideoFrame>& frame) {}
-
-// Helper to apply padding to the region outside visible rect up to the coded
-// size with the repeated last column / row of the visible rect.
-void FillRegionOutsideVisibleRect(uint8_t* data,
- size_t stride,
- const gfx::Size& coded_size,
- const gfx::Size& visible_size) {
- if (visible_size.IsEmpty()) {
- if (!coded_size.IsEmpty())
- memset(data, 0, coded_size.height() * stride);
- return;
- }
-
- const int coded_width = coded_size.width();
- if (visible_size.width() < coded_width) {
- const int pad_length = coded_width - visible_size.width();
- uint8_t* dst = data + visible_size.width();
- for (int i = 0; i < visible_size.height(); ++i, dst += stride)
- std::memset(dst, *(dst - 1), pad_length);
- }
-
- if (visible_size.height() < coded_size.height()) {
- uint8_t* dst = data + visible_size.height() * stride;
- uint8_t* src = dst - stride;
- for (int i = visible_size.height(); i < coded_size.height();
- ++i, dst += stride)
- std::memcpy(dst, src, coded_width);
- }
-}
} // namespace
@@ -369,53 +339,4 @@
return wrapped_frame;
}
-bool I420CopyWithPadding(const VideoFrame& src_frame, VideoFrame* dst_frame) {
- if (!dst_frame || !dst_frame->IsMappable())
- return false;
-
- DCHECK_GE(dst_frame->coded_size().width(), src_frame.visible_rect().width());
- DCHECK_GE(dst_frame->coded_size().height(),
- src_frame.visible_rect().height());
- DCHECK(dst_frame->visible_rect().origin().IsOrigin());
-
- if (libyuv::I420Copy(src_frame.visible_data(VideoFrame::kYPlane),
- src_frame.stride(VideoFrame::kYPlane),
- src_frame.visible_data(VideoFrame::kUPlane),
- src_frame.stride(VideoFrame::kUPlane),
- src_frame.visible_data(VideoFrame::kVPlane),
- src_frame.stride(VideoFrame::kVPlane),
- dst_frame->data(VideoFrame::kYPlane),
- dst_frame->stride(VideoFrame::kYPlane),
- dst_frame->data(VideoFrame::kUPlane),
- dst_frame->stride(VideoFrame::kUPlane),
- dst_frame->data(VideoFrame::kVPlane),
- dst_frame->stride(VideoFrame::kVPlane),
- src_frame.visible_rect().width(),
- src_frame.visible_rect().height()))
- return false;
-
- // Padding the region outside the visible rect with the repeated last
- // column / row of the visible rect. This can improve the coding efficiency.
- FillRegionOutsideVisibleRect(dst_frame->data(VideoFrame::kYPlane),
- dst_frame->stride(VideoFrame::kYPlane),
- dst_frame->coded_size(),
- src_frame.visible_rect().size());
- FillRegionOutsideVisibleRect(
- dst_frame->data(VideoFrame::kUPlane),
- dst_frame->stride(VideoFrame::kUPlane),
- VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kUPlane,
- dst_frame->coded_size()),
- VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kUPlane,
- src_frame.visible_rect().size()));
- FillRegionOutsideVisibleRect(
- dst_frame->data(VideoFrame::kVPlane),
- dst_frame->stride(VideoFrame::kVPlane),
- VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kVPlane,
- dst_frame->coded_size()),
- VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kVPlane,
- src_frame.visible_rect().size()));
-
- return true;
-}
-
} // namespace media
« no previous file with comments | « media/base/video_util.h ('k') | media/base/video_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698