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

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

Issue 2020593002: Refactor scaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Delete ShallowCenterCrop. 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
Index: webrtc/common_video/libyuv/webrtc_libyuv.cc
diff --git a/webrtc/common_video/libyuv/webrtc_libyuv.cc b/webrtc/common_video/libyuv/webrtc_libyuv.cc
index 7f5e3300c13be481b6e8a9e7793c08264f974bcf..a3febddc9a816101ea7f44af4aaf8bf8eb468b95 100644
--- a/webrtc/common_video/libyuv/webrtc_libyuv.cc
+++ b/webrtc/common_video/libyuv/webrtc_libyuv.cc
@@ -142,27 +142,28 @@ int PrintVideoFrame(const VideoFrame& frame, FILE* file) {
return 0;
}
-int ExtractBuffer(const VideoFrame& input_frame, size_t size, uint8_t* buffer) {
+int ExtractBuffer(const rtc::scoped_refptr<VideoFrameBuffer>& input_frame,
+ size_t size,
+ uint8_t* buffer) {
assert(buffer);
- if (input_frame.IsZeroSize())
+ if (!input_frame)
pbos-webrtc 2016/05/31 14:14:01 Seems to me like all of these could be DCHECKs, I
nisse-webrtc 2016/06/01 09:15:18 Agree. Not fixed yet.
nisse-webrtc 2016/06/02 09:00:06 Actually, return value is kind-of needed, since it
return -1;
- size_t length =
- CalcBufferSize(kI420, input_frame.width(), input_frame.height());
+ int width = input_frame->width();
+ int height = input_frame->height();
+ size_t length = CalcBufferSize(kI420, width, height);
if (size < length) {
return -1;
}
- int width = input_frame.video_frame_buffer()->width();
- int height = input_frame.video_frame_buffer()->height();
int chroma_width = (width + 1) / 2;
int chroma_height = (height + 1) / 2;
- libyuv::I420Copy(input_frame.video_frame_buffer()->DataY(),
- input_frame.video_frame_buffer()->StrideY(),
- input_frame.video_frame_buffer()->DataU(),
- input_frame.video_frame_buffer()->StrideU(),
- input_frame.video_frame_buffer()->DataV(),
- input_frame.video_frame_buffer()->StrideV(),
+ libyuv::I420Copy(input_frame->DataY(),
+ input_frame->StrideY(),
+ input_frame->DataU(),
+ input_frame->StrideU(),
+ input_frame->DataV(),
+ input_frame->StrideV(),
buffer, width,
buffer + width*height, chroma_width,
buffer + width*height + chroma_width*chroma_height,
@@ -172,6 +173,9 @@ int ExtractBuffer(const VideoFrame& input_frame, size_t size, uint8_t* buffer) {
return static_cast<int>(length);
}
+int ExtractBuffer(const VideoFrame& input_frame, size_t size, uint8_t* buffer) {
+ return ExtractBuffer(input_frame.video_frame_buffer(), size, buffer);
+}
int ConvertNV12ToRGB565(const uint8_t* src_frame,
uint8_t* dst_frame,

Powered by Google App Engine
This is Rietveld 408576698