Revert of SkNx miplevel building (patchset #3 id:40001 of https://codereview.chromium.org/1606013003/ )

Reason for revert:
Paranoid revert to see if it helps skia:4823

Original issue's description:
> SkNx miplevel building
>
> All sizes approximately twice as fast.
>
> Before:
>     micros   	bench
>    1649.35  	mipmap_build_512x512	nonrendering
>    1824.42  	mipmap_build_511x512	nonrendering
>    2100.66 ?	mipmap_build_512x511	nonrendering
>    2375.94  	mipmap_build_511x511	nonrendering
>
> After:
>     micros   	bench
>     730.32 !	mipmap_build_512x512	nonrendering
>     922.12  	mipmap_build_511x512	nonrendering
>     999.07  	mipmap_build_512x511	nonrendering
>    1342.93 !	mipmap_build_511x511	nonrendering
>
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1606013003
> CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
>
> Committed: https://skia.googlesource.com/skia/+/3bd5aba2a0e165997f683cf3aa306661e71464f6

TBR=reed@google.com,mtklein@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1607323002
This commit is contained in:
mtklein 2016-01-20 08:33:59 -08:00 committed by Commit bot
parent bf361d3ba2
commit 26def8687f
3 changed files with 3 additions and 70 deletions

View File

@ -8,7 +8,6 @@
#include "SkMipMap.h"
#include "SkBitmap.h"
#include "SkColorPriv.h"
#include "SkNx.h"
//
// ColorTypeFilter is the "Type" we pass to some downsample template functions.
@ -19,23 +18,12 @@
struct ColorTypeFilter_8888 {
typedef uint32_t Type;
#if defined(SKNX_IS_FAST)
static Sk4h Expand(uint32_t x) {
return SkNx_cast<uint16_t>(Sk4b::Load((const uint8_t*)&x));
}
static uint32_t Compact(const Sk4h& x) {
uint32_t r;
SkNx_cast<uint8_t>(x).store((uint8_t*)&r);
return r;
}
#else
static uint64_t Expand(uint32_t x) {
return (x & 0xFF00FF) | ((uint64_t)(x & 0xFF00FF00) << 24);
}
static uint32_t Compact(uint64_t x) {
return (uint32_t)((x & 0xFF00FF) | ((x >> 24) & 0xFF00FF00));
}
#endif
};
struct ColorTypeFilter_565 {
@ -68,7 +56,7 @@ struct ColorTypeFilter_8 {
}
};
template <typename T> T add_121(const T& a, const T& b, const T& c) {
template <typename T> T add_121(T a, T b, T c) {
return a + b + b + c;
}
@ -105,7 +93,7 @@ template <typename F> void downsample_3_2(void* dst, const void* src, size_t src
auto p0 = static_cast<const typename F::Type*>(src);
auto p1 = (const typename F::Type*)((const char*)p0 + srcRB);
auto d = static_cast<typename F::Type*>(dst);
auto c02 = F::Expand(p0[0]);
auto c12 = F::Expand(p1[0]);
for (int i = 0; i < count; ++i) {
@ -128,7 +116,7 @@ template <typename F> void downsample_2_3(void* dst, const void* src, size_t src
auto p1 = (const typename F::Type*)((const char*)p0 + srcRB);
auto p2 = (const typename F::Type*)((const char*)p1 + srcRB);
auto d = static_cast<typename F::Type*>(dst);
for (int i = 0; i < count; ++i) {
auto c00 = F::Expand(p0[0]);
auto c01 = F::Expand(p0[1]);

View File

@ -230,45 +230,6 @@ public:
float32x4_t fVec;
};
// It's possible that for our current use cases, representing this as
// half a uint16x8_t might be better than representing it as a uint16x4_t.
// It'd make conversion to Sk4b one step simpler.
template <>
class SkNx<4, uint16_t> {
public:
SkNx(const uint16x4_t& vec) : fVec(vec) {}
SkNx() {}
SkNx(uint16_t val) : fVec(vdup_n_u16(val)) {}
static SkNx Load(const uint16_t vals[4]) { return vld1_u16(vals); }
SkNx(uint16_t a, uint16_t b, uint16_t c, uint16_t d) {
fVec = (uint16x4_t) { a,b,c,d };
}
void store(uint16_t vals[4]) const { vst1_u16(vals, fVec); }
SkNx operator + (const SkNx& o) const { return vadd_u16(fVec, o.fVec); }
SkNx operator - (const SkNx& o) const { return vsub_u16(fVec, o.fVec); }
SkNx operator * (const SkNx& o) const { return vmul_u16(fVec, o.fVec); }
SkNx operator << (int bits) const { SHIFT16(vshl_n_u16, fVec, bits); }
SkNx operator >> (int bits) const { SHIFT16(vshr_n_u16, fVec, bits); }
static SkNx Min(const SkNx& a, const SkNx& b) { return vmin_u16(a.fVec, b.fVec); }
template <int k> uint16_t kth() const {
SkASSERT(0 <= k && k < 4);
return vget_lane_u16(fVec, k&3);
}
SkNx thenElse(const SkNx& t, const SkNx& e) const {
return vbsl_u16(fVec, t.fVec, e.fVec);
}
uint16x4_t fVec;
};
template <>
class SkNx<8, uint16_t> {
public:
@ -390,14 +351,6 @@ static inline void Sk4f_ToBytes(uint8_t bytes[16],
(uint8x16_t)vcvtq_u32_f32(d.fVec)).val[0]).val[0]);
}
template<> inline Sk4h SkNx_cast<uint16_t, uint8_t, 4>(const Sk4b& src) {
return vget_low_u16(vmovl_u8(src.fVec));
}
template<> inline Sk4b SkNx_cast<uint8_t, uint16_t, 4>(const Sk4h& src) {
return vmovn_u16(vcombine_u16(src.fVec, src.fVec));
}
} // namespace
#endif//SkNx_neon_DEFINED

View File

@ -379,14 +379,6 @@ static inline void Sk4f_ToBytes(uint8_t bytes[16],
_mm_cvttps_epi32(d.fVec))));
}
template<> inline Sk4h SkNx_cast<uint16_t, uint8_t, 4>(const Sk4b& src) {
return _mm_unpacklo_epi8(src.fVec, _mm_setzero_si128());
}
template<> inline Sk4b SkNx_cast<uint8_t, uint16_t, 4>(const Sk4h& src) {
return _mm_packus_epi16(src.fVec, src.fVec);
}
} // namespace