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

Unified Diff: webrtc/common_video/libyuv/scaler.cc

Issue 1935443002: Revert of Delete webrtc::VideoFrame methods buffer and stride. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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/libyuv/libyuv_unittest.cc ('k') | webrtc/common_video/libyuv/webrtc_libyuv.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/libyuv/scaler.cc
diff --git a/webrtc/common_video/libyuv/scaler.cc b/webrtc/common_video/libyuv/scaler.cc
index 6e683c003b4d17e39985fca0475fe9bcbbd55cea..c6adbf95078c437b5bb7152384ec6d4bd71bcc4c 100644
--- a/webrtc/common_video/libyuv/scaler.cc
+++ b/webrtc/common_video/libyuv/scaler.cc
@@ -47,7 +47,6 @@
return 0;
}
-// TODO(nisse): Should work with VideoFrameBuffer instead.
int Scaler::Scale(const VideoFrame& src_frame, VideoFrame* dst_frame) {
assert(dst_frame);
if (src_frame.IsZeroSize())
@@ -70,35 +69,31 @@
const int src_offset_x = ((src_width_ - cropped_src_width) / 2) & ~1;
const int src_offset_y = ((src_height_ - cropped_src_height) / 2) & ~1;
- const uint8_t* y_ptr =
- src_frame.video_frame_buffer()->DataY() +
- src_offset_y * src_frame.video_frame_buffer()->StrideY() +
- src_offset_x;
- const uint8_t* u_ptr =
- src_frame.video_frame_buffer()->DataU() +
- src_offset_y / 2 * src_frame.video_frame_buffer()->StrideU() +
- src_offset_x / 2;
- const uint8_t* v_ptr =
- src_frame.video_frame_buffer()->DataV() +
- src_offset_y / 2 * src_frame.video_frame_buffer()->StrideV() +
- src_offset_x / 2;
+ const uint8_t* y_ptr = src_frame.buffer(kYPlane) +
+ src_offset_y * src_frame.stride(kYPlane) +
+ src_offset_x;
+ const uint8_t* u_ptr = src_frame.buffer(kUPlane) +
+ src_offset_y / 2 * src_frame.stride(kUPlane) +
+ src_offset_x / 2;
+ const uint8_t* v_ptr = src_frame.buffer(kVPlane) +
+ src_offset_y / 2 * src_frame.stride(kVPlane) +
+ src_offset_x / 2;
- return libyuv::I420Scale(
- y_ptr,
- src_frame.video_frame_buffer()->StrideY(),
- u_ptr,
- src_frame.video_frame_buffer()->StrideU(),
- v_ptr,
- src_frame.video_frame_buffer()->StrideV(),
- cropped_src_width, cropped_src_height,
- dst_frame->video_frame_buffer()->MutableDataY(),
- dst_frame->video_frame_buffer()->StrideY(),
- dst_frame->video_frame_buffer()->MutableDataU(),
- dst_frame->video_frame_buffer()->StrideU(),
- dst_frame->video_frame_buffer()->MutableDataV(),
- dst_frame->video_frame_buffer()->StrideV(),
- dst_width_, dst_height_,
- libyuv::FilterMode(method_));
+ return libyuv::I420Scale(y_ptr,
+ src_frame.stride(kYPlane),
+ u_ptr,
+ src_frame.stride(kUPlane),
+ v_ptr,
+ src_frame.stride(kVPlane),
+ cropped_src_width, cropped_src_height,
+ dst_frame->buffer(kYPlane),
+ dst_frame->stride(kYPlane),
+ dst_frame->buffer(kUPlane),
+ dst_frame->stride(kUPlane),
+ dst_frame->buffer(kVPlane),
+ dst_frame->stride(kVPlane),
+ dst_width_, dst_height_,
+ libyuv::FilterMode(method_));
}
bool Scaler::SupportedVideoType(VideoType src_video_type,
« no previous file with comments | « webrtc/common_video/libyuv/libyuv_unittest.cc ('k') | webrtc/common_video/libyuv/webrtc_libyuv.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698