diff options
author | Miao Wang <miaowang@google.com> | 2014-11-18 19:40:47 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-18 19:40:47 +0000 |
commit | fdceadb811ec22c69f879ea0d0108be3d287708b (patch) | |
tree | d639725facaf2488cdf2923acac48167d6998577 /cpu_ref/rsCpuIntrinsicConvolve5x5.cpp | |
parent | d240e6165f7fac1f3b7e72549ab41d92ee5db8e6 (diff) | |
parent | 4283f579c424f07bc07c7f075398053eed3f8281 (diff) | |
download | rs-fdceadb811ec22c69f879ea0d0108be3d287708b.tar.gz |
am 4283f579: Fix rounding bug of IntrinsicConvolve in cpu_ref
* commit '4283f579c424f07bc07c7f075398053eed3f8281':
Fix rounding bug of IntrinsicConvolve in cpu_ref
Diffstat (limited to 'cpu_ref/rsCpuIntrinsicConvolve5x5.cpp')
-rw-r--r-- | cpu_ref/rsCpuIntrinsicConvolve5x5.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cpu_ref/rsCpuIntrinsicConvolve5x5.cpp b/cpu_ref/rsCpuIntrinsicConvolve5x5.cpp index 815badfb..e591e44c 100644 --- a/cpu_ref/rsCpuIntrinsicConvolve5x5.cpp +++ b/cpu_ref/rsCpuIntrinsicConvolve5x5.cpp @@ -125,7 +125,7 @@ static void OneU4(const RsExpandKernelParams *p, uint32_t x, uchar4 *out, convert_float4(py4[x2]) * coeff[22] + convert_float4(py4[x3]) * coeff[23] + convert_float4(py4[x4]) * coeff[24]; - px = clamp(px, 0.f, 255.f); + px = clamp(px + 0.5f, 0.f, 255.f); *out = convert_uchar4(px); } @@ -168,7 +168,7 @@ static void OneU2(const RsExpandKernelParams *p, uint32_t x, uchar2 *out, convert_float2(py4[x2]) * coeff[22] + convert_float2(py4[x3]) * coeff[23] + convert_float2(py4[x4]) * coeff[24]; - px = clamp(px, 0.f, 255.f); + px = clamp(px + 0.5f, 0.f, 255.f); *out = convert_uchar2(px); } @@ -211,7 +211,7 @@ static void OneU1(const RsExpandKernelParams *p, uint32_t x, uchar *out, (float)(py4[x2]) * coeff[22] + (float)(py4[x3]) * coeff[23] + (float)(py4[x4]) * coeff[24]; - px = clamp(px, 0.f, 255.f); + px = clamp(px + 0.5f, 0.f, 255.f); *out = px; } |