diff options
author | Frank Barchard <fbarchard@google.com> | 2021-04-09 13:04:57 -0700 |
---|---|---|
committer | Frank Barchard <fbarchard@chromium.org> | 2021-04-09 20:17:55 +0000 |
commit | 287158925b0e03ea4499a18b4e08478c5781541b (patch) | |
tree | 2be2a0f3cdc0fc01bacded73ca7eb6cd1da2d6b0 /source/row_common.cc | |
parent | 2cd098f83b446067a999bb7ab4d856892c956cdc (diff) | |
download | libyuv-287158925b0e03ea4499a18b4e08478c5781541b.tar.gz |
use width + 1 for odd width tests
Bug: libyuv:894, libyuv:898, libyuv:899
Change-Id: Ieba8eaeb8b06f0323824967776673e339b263220
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2809701
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
Diffstat (limited to 'source/row_common.cc')
-rw-r--r-- | source/row_common.cc | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/source/row_common.cc b/source/row_common.cc index 68446953..5e02a73b 100644 --- a/source/row_common.cc +++ b/source/row_common.cc @@ -4380,13 +4380,14 @@ void NV21ToYUV24Row_C(const uint8_t* src_y, } // Filter 2 rows of AYUV UV's (444) into UV (420). +// AYUV is VUYA in memory. UV for NV12 is UV order in memory. void AYUVToUVRow_C(const uint8_t* src_ayuv, int src_stride_ayuv, uint8_t* dst_uv, int width) { // Output a row of UV values, filtering 2x2 rows of AYUV. int x; - for (x = 0; x < width; x += 2) { + for (x = 0; x < width - 1; x += 2) { dst_uv[0] = (src_ayuv[1] + src_ayuv[5] + src_ayuv[src_stride_ayuv + 1] + src_ayuv[src_stride_ayuv + 5] + 2) >> 2; @@ -4397,12 +4398,8 @@ void AYUVToUVRow_C(const uint8_t* src_ayuv, dst_uv += 2; } if (width & 1) { - dst_uv[0] = (src_ayuv[0] + src_ayuv[0] + src_ayuv[src_stride_ayuv + 0] + - src_ayuv[src_stride_ayuv + 0] + 2) >> - 2; - dst_uv[1] = (src_ayuv[1] + src_ayuv[1] + src_ayuv[src_stride_ayuv + 1] + - src_ayuv[src_stride_ayuv + 1] + 2) >> - 2; + dst_uv[0] = (src_ayuv[1] + src_ayuv[src_stride_ayuv + 1] + 1) >> 1; + dst_uv[1] = (src_ayuv[0] + src_ayuv[src_stride_ayuv + 0] + 1) >> 1; } } @@ -4413,7 +4410,7 @@ void AYUVToVURow_C(const uint8_t* src_ayuv, int width) { // Output a row of VU values, filtering 2x2 rows of AYUV. int x; - for (x = 0; x < width; x += 2) { + for (x = 0; x < width - 1; x += 2) { dst_vu[0] = (src_ayuv[0] + src_ayuv[4] + src_ayuv[src_stride_ayuv + 0] + src_ayuv[src_stride_ayuv + 4] + 2) >> 2; @@ -4424,12 +4421,8 @@ void AYUVToVURow_C(const uint8_t* src_ayuv, dst_vu += 2; } if (width & 1) { - dst_vu[0] = (src_ayuv[0] + src_ayuv[0] + src_ayuv[src_stride_ayuv + 0] + - src_ayuv[src_stride_ayuv + 0] + 2) >> - 2; - dst_vu[1] = (src_ayuv[1] + src_ayuv[1] + src_ayuv[src_stride_ayuv + 1] + - src_ayuv[src_stride_ayuv + 1] + 2) >> - 2; + dst_vu[0] = (src_ayuv[0] + src_ayuv[src_stride_ayuv + 0] + 1) >> 1; + dst_vu[1] = (src_ayuv[1] + src_ayuv[src_stride_ayuv + 1] + 1) >> 1; } } |