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

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

Issue 2341723005: Reland of Optimize Android NV12 capture (Closed)
Patch Set: Created 4 years, 3 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/include/webrtc_libyuv.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 44577e9ac8e6beac40001a87af737422d92da624..5d9ab5736733d836623633887bd7a3fd1f2fa8c2 100644
--- a/webrtc/common_video/libyuv/webrtc_libyuv.cc
+++ b/webrtc/common_video/libyuv/webrtc_libyuv.cc
@@ -341,4 +341,34 @@
test_frame->video_frame_buffer()->StrideV(),
test_frame->width(), test_frame->height());
}
+
+void NV12ToI420Scale(uint8_t* tmp_data,
+ const uint8_t* src_y, int src_stride_y,
+ const uint8_t* src_uv, int src_stride_uv,
+ int src_width, int src_height,
+ uint8_t* dst_y, int dst_stride_y,
+ uint8_t* dst_u, int dst_stride_u,
+ uint8_t* dst_v, int dst_stride_v,
+ int dst_width, int dst_height) {
+ // Split source UV plane into separate U and V plane using the temporary data.
+ const int src_uv_width = (src_width + 1) / 2;
+ const int src_uv_height = (src_height + 1) / 2;
+ uint8_t* const src_u = tmp_data;
+ uint8_t* const src_v = tmp_data + src_uv_width * src_uv_height;
+ libyuv::SplitUVPlane(src_uv, src_stride_uv,
+ src_u, src_uv_width,
+ src_v, src_uv_width,
+ src_uv_width, src_uv_height);
+ // Scale the planes into the destination.
+ libyuv::I420Scale(src_y, src_stride_y,
+ src_u, src_uv_width,
+ src_v, src_uv_width,
+ src_width, src_height,
+ dst_y, dst_stride_y,
+ dst_u, dst_stride_u,
+ dst_v, dst_stride_v,
+ dst_width, dst_height,
+ libyuv::kFilterBox);
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/common_video/libyuv/include/webrtc_libyuv.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698