From d51c4ba83ddc2459794ed5d0db668135694385f0 Mon Sep 17 00:00:00 2001 From: powturbo Date: Wed, 8 Jul 2015 16:16:31 +0200 Subject: [PATCH] BitUnpack SIMD --- bitunpackv.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/bitunpackv.c b/bitunpackv.c index 83d7cf9..eef86d8 100644 --- a/bitunpackv.c +++ b/bitunpackv.c @@ -48,7 +48,21 @@ unsigned char *bitunpackv32( unsigned char *__restrict in, unsigned n, unsigned *__restrict out, unsigned b) { unsigned char *ip = in+PAD8(n*b); __m128i sv; BITUNPACKV32(in, n, b, out, sv); return ip; } #undef VSTO -#undef BITUNPACK0 +#undef BITUNPACK0 + +//------------------------------------------------------ +#define VSTO(__op, i, __ov, __sv) __ov = UNZIGZAG128_32(__ov); SCAN128_32(__ov,__sv); _mm_storeu_si128(__op++, __sv) + +#include __FILE__ +#define BITUNPACK0(__parm) + +unsigned char *bitzunpackv32( unsigned char *__restrict in, unsigned n, unsigned *__restrict out, unsigned start, unsigned b) { unsigned char *ip = in+PAD8(n*b); + __m128i sv = _mm_set1_epi32(start); + BITUNPACKV32(in, n, b, out, sv); return ip; +} +#undef VSTO +#undef BITUNPACK0 + //------------------------------------------------------ #define VSTO(__op, i, __ov, __sv) SCAN128_32(__ov,__sv); _mm_storeu_si128(__op++, __sv) @@ -62,6 +76,7 @@ unsigned char *bitdunpackv32( unsigned char *__restrict in, unsigned n, unsigned #undef VSTO #undef BITUNBLKV32_0 #undef BITUNPACK0 + //--------------------------------------------------------------------------------------------------------------------------------------------- #define VSTO(__op, i, __ov, __sv) SCANI128_32(__ov,__sv,cv); _mm_storeu_si128(__op++, __sv); @@ -82,6 +97,10 @@ unsigned char *bitd1unpackv32( unsigned char *__restrict in, unsigned n, unsigne __m128i sv = _mm_set1_epi32(start), cv = _mm_set_epi32(4,3,2,1); BITUNPACKV32(in, n, b, out, sv); return ip; } +#undef VSTO +#undef BITUNBLKV32_0 +#undef BITUNPACK0 + #else #include #include