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

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: Addressed comments Created 4 years, 11 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
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..e3c114c99b7175e6184b33fb480fd0f61d481497 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);
@@ -81,6 +89,10 @@ uint8_t* I420Buffer::MutableData(PlaneType type) {
static_cast<const VideoFrameBuffer*>(this)->data(type));
}
+int I420Buffer::DataSize() const {
+ return I420DataSize(height_, stride_y_, stride_u_, stride_v_);
+}
+
int I420Buffer::stride(PlaneType type) const {
switch (type) {
case kYPlane:

Powered by Google App Engine
This is Rietveld 408576698