aboutsummaryrefslogtreecommitdiff
path: root/source/convert_from.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2021-09-22 11:18:12 -0700
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-09-22 19:44:06 +0000
commitb92a60320f6d3021bafe95d7906ad156cb32d611 (patch)
tree777c850ef90cc1a33f48151a05d07cc970b4df99 /source/convert_from.cc
parent33a68ec7794d6ca897e129d74e425a75a009e156 (diff)
downloadlibyuv-b92a60320f6d3021bafe95d7906ad156cb32d611.tar.gz
ConvertFromI420 respect destination stride for NV12 and NV21
Bug: libyuv:904 Change-Id: Ie1fd39c693e64661eb52f75492a261384db70776 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3176483 Reviewed-by: Frank Barchard <fbarchard@chromium.org> Reviewed-by: richard winterton <rrwinterton@gmail.com> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/convert_from.cc')
-rw-r--r--source/convert_from.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/convert_from.cc b/source/convert_from.cc
index 687f0a72..62a13d04 100644
--- a/source/convert_from.cc
+++ b/source/convert_from.cc
@@ -772,7 +772,8 @@ int ConvertFromI420(const uint8_t* y,
height);
break;
case FOURCC_NV12: {
- uint8_t* dst_uv = dst_sample + width * height;
+ int dst_y_stride = dst_sample_stride ? dst_sample_stride : width;
+ uint8_t* dst_uv = dst_sample + dst_y_stride * height;
r = I420ToNV12(y, y_stride, u, u_stride, v, v_stride, dst_sample,
dst_sample_stride ? dst_sample_stride : width, dst_uv,
dst_sample_stride ? dst_sample_stride : width, width,
@@ -780,7 +781,8 @@ int ConvertFromI420(const uint8_t* y,
break;
}
case FOURCC_NV21: {
- uint8_t* dst_vu = dst_sample + width * height;
+ int dst_y_stride = dst_sample_stride ? dst_sample_stride : width;
+ uint8_t* dst_vu = dst_sample + dst_y_stride * height;
r = I420ToNV21(y, y_stride, u, u_stride, v, v_stride, dst_sample,
dst_sample_stride ? dst_sample_stride : width, dst_vu,
dst_sample_stride ? dst_sample_stride : width, width,