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:

committed by
Commit Bot

parent
bb23c838f5
commit
acdaaaf29a
@ -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();
|
||||||
|
@ -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.
|
||||||
|
Reference in New Issue
Block a user