Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: source/scale_common.cc

Issue 2093913004: rounding for arm filter (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: arm or aarch64 Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/libyuv/version.h ('k') | source/scale_neon.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/scale_common.cc
diff --git a/source/scale_common.cc b/source/scale_common.cc
index baed70b9da1f9c6d705feff6f04bdb4e1c93cc92..3507aa4d9ff0cf006eba6f7ded4c124989318816 100644
--- a/source/scale_common.cc
+++ b/source/scale_common.cc
@@ -417,11 +417,9 @@ void ScaleColsUp2_16_C(uint16* dst_ptr, const uint16* src_ptr,
}
// (1-f)a + fb can be replaced with a + f(b-a)
-#if defined(__arm__)
-// arm uses 16 bit math with truncation.
-// TODO(fbarchard): add rounding.
+#if defined(__arm__) || defined(__aarch64__)
#define BLENDER(a, b, f) (uint8)((int)(a) + \
- (((int)((f)) * ((int)(b) - (int)(a))) >> 16))
+ ((((int)((f)) * ((int)(b) - (int)(a))) + 0x8000) >> 16))
#else
// inteluses 7 bit math with rounding.
#define BLENDER(a, b, f) (uint8)((int)(a) + \
@@ -480,7 +478,7 @@ void ScaleFilterCols64_C(uint8* dst_ptr, const uint8* src_ptr,
// Same as 8 bit arm blender but return is cast to uint16
#define BLENDER(a, b, f) (uint16)((int)(a) + \
- (((int)((f)) * ((int)(b) - (int)(a))) >> 16))
+ ((((int)((f)) * ((int)(b) - (int)(a))) + 0x8000) >> 16))
void ScaleFilterCols_16_C(uint16* dst_ptr, const uint16* src_ptr,
int dst_width, int x, int dx) {
@@ -818,7 +816,7 @@ void ScaleARGBColsUp2_C(uint8* dst_argb, const uint8* src_argb,
}
}
-// TODO(fbarchard): Replace 0x7f ^ f with 128-f. bug=605.
+// TODO(fbarchard): Replace 0x7f ^ f with 128-f. bug=607.
// Mimics SSSE3 blender
#define BLENDER1(a, b, f) ((a) * (0x7f ^ f) + (b) * f) >> 7
#define BLENDERC(a, b, f, s) (uint32)( \
« no previous file with comments | « include/libyuv/version.h ('k') | source/scale_neon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698