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

Unified Diff: src/opts/Sk4px_NEON.h

Issue 1452903004: div255(x) as ((x+128)*257)>>16 with SSE (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: notes Created 5 years, 1 month 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 | « src/core/Sk4px.h ('k') | src/opts/Sk4px_SSE2.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/Sk4px_NEON.h
diff --git a/src/opts/Sk4px_NEON.h b/src/opts/Sk4px_NEON.h
index 89841d927ee5efd927012ce25f8c110be071f713..c27bb13764f8acc53b1ad8524cbd454e12db9342 100644
--- a/src/opts/Sk4px_NEON.h
+++ b/src/opts/Sk4px_NEON.h
@@ -57,6 +57,12 @@ inline Sk4px Sk4px::Wide::addNarrowHi(const Sk16h& other) const {
vaddhn_u16(this->fHi.fVec, o.fHi.fVec)));
}
+inline Sk4px Sk4px::Wide::div255() const {
+ // Calculated as ((x+128) + ((x+128)>>8)) >> 8.
+ auto v = *this + Sk16h(128);
+ return v.addNarrowHi(v>>8);
+}
+
inline Sk4px Sk4px::alphas() const {
auto as = vshrq_n_u32((uint32x4_t)fVec, SK_A32_SHIFT); // ___3 ___2 ___1 ___0
return Sk16b((uint8x16_t)vmulq_n_u32(as, 0x01010101)); // 3333 2222 1111 0000
« no previous file with comments | « src/core/Sk4px.h ('k') | src/opts/Sk4px_SSE2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698