Android: Fix cropping logic for NV12/NV21 buffers

Bug: webrtc:9186
Change-Id: I06ad4c4b08a564e177c47fc109261f2f6d303c7b
Reviewed-on: https://webrtc-review.googlesource.com/71741
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22980}
This commit is contained in:
Magnus Jedvert
2018-04-23 14:49:49 +02:00
committed by Commit Bot
parent bb23c838f5
commit acdaaaf29a
2 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ static void JNI_NV12Buffer_CropAndScale(JNIEnv* jni,
// Crop using pointer arithmetic. // Crop using pointer arithmetic.
src_y += crop_x + crop_y * src_stride_y; src_y += crop_x + crop_y * src_stride_y;
src_uv += crop_chroma_x + crop_chroma_y * src_stride_uv; src_uv += 2 * crop_chroma_x + crop_chroma_y * src_stride_uv;
std::vector<uint8_t> tmp_buffer(tmp_size); std::vector<uint8_t> tmp_buffer(tmp_size);
uint8_t* tmp_u = tmp_buffer.data(); uint8_t* tmp_u = tmp_buffer.data();

View File

@ -63,7 +63,7 @@ static void JNI_NV21Buffer_CropAndScale(JNIEnv* jni,
// Crop using pointer arithmetic. // Crop using pointer arithmetic.
src_y += crop_x + crop_y * src_stride_y; src_y += crop_x + crop_y * src_stride_y;
src_uv += crop_chroma_x + crop_chroma_y * src_stride_uv; src_uv += 2 * crop_chroma_x + crop_chroma_y * src_stride_uv;
NV12ToI420Scaler scaler; NV12ToI420Scaler scaler;
// U- and V-planes are swapped because this is NV21 not NV12. // U- and V-planes are swapped because this is NV21 not NV12.