commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 01/22: volk: add neon kernel for 16i_conver


From: git
Subject: [Commit-gnuradio] [gnuradio] 01/22: volk: add neon kernel for 16i_convert_8i
Date: Fri, 31 Oct 2014 19:22:30 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit d97396d462188e9bac1b5aad0220eea0c16cc7a4
Author: Nathan West <address@hidden>
Date:   Fri Oct 17 21:03:34 2014 -0500

    volk: add neon kernel for 16i_convert_8i
---
 volk/kernels/volk/volk_16i_convert_8i.h | 43 ++++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 3 deletions(-)

diff --git a/volk/kernels/volk/volk_16i_convert_8i.h 
b/volk/kernels/volk/volk_16i_convert_8i.h
index eb29949..6f16fa4 100644
--- a/volk/kernels/volk/volk_16i_convert_8i.h
+++ b/volk/kernels/volk/volk_16i_convert_8i.h
@@ -138,6 +138,46 @@ static inline void volk_16i_convert_8i_a_sse2(int8_t* 
outputVector, const int16_
 }
 #endif /* LV_HAVE_SSE2 */
 
+#ifdef LV_HAVE_NEON
+#include <arm_neon.h>
+/*!
+  \brief Converts the input 16 bit integer data into 8 bit integer data
+  \param inputVector The 16 bit input data buffer
+  \param outputVector The 8 bit output data buffer
+  \param num_points The number of data values to be converted
+*/
+static inline void volk_16i_convert_8i_neon(int8_t* outputVector, const 
int16_t* inputVector, unsigned int num_points){
+  int8_t* outputVectorPtr = outputVector;
+  const int16_t* inputVectorPtr = inputVector;
+  unsigned int number = 0;
+  unsigned int sixteenth_points = num_points / 16;
+
+  int16x8_t inputVal0;
+  int16x8_t inputVal1;
+  int8x8_t outputVal0;
+  int8x8_t outputVal1;
+  int8x16_t outputVal;
+  
+  for(number = 0; number < sixteenth_points; number++){
+    // load two input vectors
+    inputVal0 = vld1q_s16(inputVectorPtr);
+    inputVal1 = vld1q_s16(inputVectorPtr+8);
+    // shift right
+    outputVal0 = vshrn_n_s16(inputVal0, 8);
+    outputVal1 = vshrn_n_s16(inputVal1, 8);
+    // squash two vectors and write output
+    outputVal = vcombine_s8(outputVal0, outputVal1);
+    vst1q_s8(outputVectorPtr, outputVal);
+    inputVectorPtr += 16;
+    outputVectorPtr += 16;
+  }
+
+  for(number = sixteenth_points * 16; number < num_points; number++){
+    *outputVectorPtr++ = ((int8_t)(*inputVectorPtr++ >> 8));
+  }
+}
+#endif /* LV_HAVE_NEON */
+
 #ifdef LV_HAVE_GENERIC
 /*!
   \brief Converts the input 16 bit integer data into 8 bit integer data
@@ -156,7 +196,4 @@ static inline void volk_16i_convert_8i_a_generic(int8_t* 
outputVector, const int
 }
 #endif /* LV_HAVE_GENERIC */
 
-
-
-
 #endif /* INCLUDED_volk_16i_convert_8i_a_H */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]