aboutsummaryrefslogtreecommitdiff
path: root/source/scale_common.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2021-02-10 00:22:41 -0800
committerFrank Barchard <fbarchard@chromium.org>2021-02-10 18:51:02 +0000
commit12a4a2372cf8530de0bb1e8f00c176d31d7da0b6 (patch)
tree2a899d0dd65491cc1c59698295a88c6e9eff1de0 /source/scale_common.cc
parent742791f13a8ca9e8a297c323699aff8af30a360b (diff)
downloadlibyuv-12a4a2372cf8530de0bb1e8f00c176d31d7da0b6.tar.gz
Rounding added to scaling upsampler
Bug: libyuv:872, b/178521093 Change-Id: I86749f73f5e55d5fd8b87ea6938084cbacb1cda7 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2686945 Reviewed-by: Wan-Teh Chang <wtc@google.com> Reviewed-by: Frank Barchard <fbarchard@chromium.org> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/scale_common.cc')
-rw-r--r--source/scale_common.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/source/scale_common.cc b/source/scale_common.cc
index 4af84321..f4f23397 100644
--- a/source/scale_common.cc
+++ b/source/scale_common.cc
@@ -1232,21 +1232,29 @@ void ScaleUVRowUp2_Bilinear_C(const uint8_t* src_ptr,
assert((dst_width % 2 == 0) && (dst_width >= 0));
for (x = 0; x < src_width; ++x) {
d[4 * x + 0] = (s[2 * x + 0] * 9 + s[2 * x + 2] * 3 + t[2 * x + 0] * 3 +
- t[2 * x + 2] * 1 + 8) >> 4;
+ t[2 * x + 2] * 1 + 8) >>
+ 4;
d[4 * x + 1] = (s[2 * x + 1] * 9 + s[2 * x + 3] * 3 + t[2 * x + 1] * 3 +
- t[2 * x + 3] * 1 + 8) >> 4;
+ t[2 * x + 3] * 1 + 8) >>
+ 4;
d[4 * x + 2] = (s[2 * x + 0] * 3 + s[2 * x + 2] * 9 + t[2 * x + 0] * 1 +
- t[2 * x + 2] * 3 + 8) >> 4;
+ t[2 * x + 2] * 3 + 8) >>
+ 4;
d[4 * x + 3] = (s[2 * x + 1] * 3 + s[2 * x + 3] * 9 + t[2 * x + 1] * 1 +
- t[2 * x + 3] * 3 + 8) >> 4;
+ t[2 * x + 3] * 3 + 8) >>
+ 4;
e[4 * x + 0] = (s[2 * x + 0] * 3 + s[2 * x + 2] * 1 + t[2 * x + 0] * 9 +
- t[2 * x + 2] * 3 + 8) >> 4;
+ t[2 * x + 2] * 3 + 8) >>
+ 4;
e[4 * x + 1] = (s[2 * x + 1] * 3 + s[2 * x + 3] * 1 + t[2 * x + 1] * 9 +
- t[2 * x + 3] * 3 + 8) >> 4;
+ t[2 * x + 3] * 3 + 8) >>
+ 4;
e[4 * x + 2] = (s[2 * x + 0] * 1 + s[2 * x + 2] * 3 + t[2 * x + 0] * 3 +
- t[2 * x + 2] * 9 + 8) >> 4;
+ t[2 * x + 2] * 9 + 8) >>
+ 4;
e[4 * x + 3] = (s[2 * x + 1] * 1 + s[2 * x + 3] * 3 + t[2 * x + 1] * 3 +
- t[2 * x + 3] * 9 + 8) >> 4;
+ t[2 * x + 3] * 9 + 8) >>
+ 4;
}
}