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

Unified Diff: webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc

Issue 2709923005: Android HW decoder: Support odd heights for non-texture output (Closed)
Patch Set: Created 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc
diff --git a/webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc b/webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc
index d999b01b0ac7684a957486e69949c934b0122559..7936b09f56866d868ba4d9564f99fa7e4dc39799 100644
--- a/webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc
+++ b/webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc
@@ -809,12 +809,14 @@ bool MediaCodecVideoDecoder::DeliverPendingOutputs(
i420_buffer = decoded_frame_pool_.CreateBuffer(width, height);
if (color_format == COLOR_FormatYUV420Planar) {
RTC_CHECK_EQ(0, stride % 2);
- RTC_CHECK_EQ(0, slice_height % 2);
const int uv_stride = stride / 2;
- const int u_slice_height = slice_height / 2;
const uint8_t* y_ptr = payload;
const uint8_t* u_ptr = y_ptr + stride * slice_height;
- const uint8_t* v_ptr = u_ptr + uv_stride * u_slice_height;
+ // This offset is weird when |slice_height| is not dividable by two, since
+ // the last u row might not be full, but this is what's used in practice.
+ // See http://bugs.webrtc.org/6651 for more info.
+ const int u_offset = (uv_stride * slice_height + 1) / 2;
+ const uint8_t* v_ptr = u_ptr + u_offset;
libyuv::I420Copy(y_ptr, stride, u_ptr, uv_stride, v_ptr, uv_stride,
sakal 2017/02/23 12:59:07 Hmm, it seems I420Copy is reading uv_stride * ((he
magjed_webrtc 2017/02/23 14:19:30 No. I made a new patch set that is more complicate
i420_buffer->MutableDataY(), i420_buffer->StrideY(),
i420_buffer->MutableDataU(), i420_buffer->StrideU(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698