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

Unified Diff: webrtc/common_video/video_frame_buffer.cc

Issue 1645543003: H264: Improve FFmpeg decoder performance by using I420BufferPool. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: common_video not unnecessarily depending on webrtc_h264, fixed circular dependency Created 4 years, 10 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 | « webrtc/common_video/include/video_frame_buffer.h ('k') | webrtc/modules/video_coding/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/video_frame_buffer.cc
diff --git a/webrtc/common_video/video_frame_buffer.cc b/webrtc/common_video/video_frame_buffer.cc
index 492bc495876a6a21b080252686991c89a2f5840b..19e44febaf37b9591e3790269909496b2f41225d 100644
--- a/webrtc/common_video/video_frame_buffer.cc
+++ b/webrtc/common_video/video_frame_buffer.cc
@@ -18,6 +18,14 @@ static const int kBufferAlignment = 64;
namespace webrtc {
+namespace {
+
+int I420DataSize(int height, int stride_y, int stride_u, int stride_v) {
+ return stride_y * height + (stride_u + stride_v) * ((height + 1) / 2);
+}
+
+} // namespace
+
uint8_t* VideoFrameBuffer::MutableData(PlaneType type) {
RTC_NOTREACHED();
return nullptr;
@@ -40,7 +48,7 @@ I420Buffer::I420Buffer(int width,
stride_u_(stride_u),
stride_v_(stride_v),
data_(static_cast<uint8_t*>(AlignedMalloc(
- stride_y * height + (stride_u + stride_v) * ((height + 1) / 2),
+ I420DataSize(height, stride_y, stride_u, stride_v),
kBufferAlignment))) {
RTC_DCHECK_GT(width, 0);
RTC_DCHECK_GT(height, 0);
@@ -52,6 +60,11 @@ I420Buffer::I420Buffer(int width,
I420Buffer::~I420Buffer() {
}
+void I420Buffer::InitializeData() {
+ memset(data_.get(), 0,
+ I420DataSize(height_, stride_y_, stride_u_, stride_v_));
+}
+
int I420Buffer::width() const {
return width_;
}
« no previous file with comments | « webrtc/common_video/include/video_frame_buffer.h ('k') | webrtc/modules/video_coding/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698