summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-06-25 15:57:08 -0700
committerJosh Blum <josh@joshknows.com>2010-06-28 11:12:19 -0700
commita9a47d0a69419e862657567a4228e8de0f4b8342 (patch)
tree93b7a605bea8bf2c349fd2291831989354649e09
parentb46f9f53c9252f69c0ab60a948373431da4fc54f (diff)
downloaduhd-a9a47d0a69419e862657567a4228e8de0f4b8342.tar.gz
uhd-a9a47d0a69419e862657567a4228e8de0f4b8342.tar.bz2
uhd-a9a47d0a69419e862657567a4228e8de0f4b8342.zip
uhd: convert types simd, unpack with zero constant for lower half
-rw-r--r--host/lib/transport/convert_types_impl.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/host/lib/transport/convert_types_impl.hpp b/host/lib/transport/convert_types_impl.hpp
index 58cc69eb0..ca1be175c 100644
--- a/host/lib/transport/convert_types_impl.hpp
+++ b/host/lib/transport/convert_types_impl.hpp
@@ -160,6 +160,7 @@ static UHD_INLINE void item32_to_fc32_bswap(
const item32_t *input, fc32_t *output, size_t nsamps
){
__m128 scalar = _mm_set_ps1(floats_per_short/(1 << 16));
+ __m128i zeroi = _mm_setzero_si128();
//convert blocks of samples with intrinsics
size_t i = 0; for (; i < nsamps/4; i+=4){
@@ -168,8 +169,8 @@ static UHD_INLINE void item32_to_fc32_bswap(
//byteswap + unpack -> byteswap 32 bit words
tmpi = _mm_or_si128(_mm_srli_epi16(tmpi, 8), _mm_slli_epi16(tmpi, 8));
- __m128i tmpilo = _mm_unpacklo_epi16(tmpi, tmpi);
- __m128i tmpihi = _mm_unpackhi_epi16(tmpi, tmpi);
+ __m128i tmpilo = _mm_unpacklo_epi16(zeroi, tmpi); //value in upper 16 bits
+ __m128i tmpihi = _mm_unpackhi_epi16(zeroi, tmpi);
//convert and scale
__m128 tmplo = _mm_mul_ps(_mm_cvtepi32_ps(tmpilo), scalar);