diff options
author | Frank Barchard <fbarchard@google.com> | 2016-01-06 15:12:17 -0800 |
---|---|---|
committer | Frank Barchard <fbarchard@google.com> | 2016-01-06 15:12:17 -0800 |
commit | fc52d8ded269e9cd40c7a763e36758a08f177da0 (patch) | |
tree | aa3370c07ae5fef458248a8e5a0fac031f57ab22 /source/scale_common.cc | |
parent | 2560df9513e66080524a5b8dcea92b8ec657a8eb (diff) | |
download | libyuv-fc52d8ded269e9cd40c7a763e36758a08f177da0.tar.gz |
Odd width variation of scale down by 2 for subsampling
R=dhrosa@google.com, harryjin@google.com
BUG=libyuv:538
Review URL: https://codereview.chromium.org/1558093003 .
Diffstat (limited to 'source/scale_common.cc')
-rw-r--r-- | source/scale_common.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/scale_common.cc b/source/scale_common.cc index f5c908d0..30ff18c5 100644 --- a/source/scale_common.cc +++ b/source/scale_common.cc @@ -103,6 +103,28 @@ void ScaleRowDown2Box_C(const uint8* src_ptr, ptrdiff_t src_stride, } } +void ScaleRowDown2Box_Odd_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width) { + const uint8* s = src_ptr; + const uint8* t = src_ptr + src_stride; + int x; + dst_width -= 1; + for (x = 0; x < dst_width - 1; x += 2) { + dst[0] = (s[0] + s[1] + t[0] + t[1] + 2) >> 2; + dst[1] = (s[2] + s[3] + t[2] + t[3] + 2) >> 2; + dst += 2; + s += 4; + t += 4; + } + if (dst_width & 1) { + dst[0] = (s[0] + s[1] + t[0] + t[1] + 2) >> 2; + dst += 1; + s += 2; + t += 2; + } + dst[0] = (s[0] + t[0] + 1) >> 1; +} + void ScaleRowDown2Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride, uint16* dst, int dst_width) { const uint16* s = src_ptr; |