GNU Radio 3.6.5 C++ API

volk_8ic_deinterleave_real_16i_a.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_volk_8ic_deinterleave_real_16i_a_H
00002 #define INCLUDED_volk_8ic_deinterleave_real_16i_a_H
00003 
00004 #include <inttypes.h>
00005 #include <stdio.h>
00006 
00007 #ifdef LV_HAVE_SSE4_1
00008 #include <smmintrin.h>
00009 /*!
00010   \brief Deinterleaves the complex 8 bit vector into I 16 bit vector data
00011   \param complexVector The complex input vector
00012   \param iBuffer The I buffer output data
00013   \param num_points The number of complex data values to be deinterleaved
00014 */
00015 static inline void volk_8ic_deinterleave_real_16i_a_sse4_1(int16_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
00016   unsigned int number = 0;
00017   const int8_t* complexVectorPtr = (int8_t*)complexVector;
00018   int16_t* iBufferPtr = iBuffer;
00019   __m128i moveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
00020   __m128i complexVal, outputVal;
00021 
00022   unsigned int eighthPoints = num_points / 8;
00023 
00024   for(number = 0; number < eighthPoints; number++){
00025     complexVal = _mm_load_si128((__m128i*)complexVectorPtr);  complexVectorPtr += 16;
00026 
00027     complexVal = _mm_shuffle_epi8(complexVal, moveMask);
00028 
00029     outputVal = _mm_cvtepi8_epi16(complexVal);
00030     outputVal = _mm_slli_epi16(outputVal, 7);
00031 
00032     _mm_store_si128((__m128i*)iBufferPtr, outputVal);
00033     iBufferPtr += 8;
00034   }
00035 
00036   number = eighthPoints * 8;
00037   for(; number < num_points; number++){
00038     *iBufferPtr++ = ((int16_t)*complexVectorPtr++) * 128;
00039     complexVectorPtr++;
00040   }
00041 }
00042 #endif /* LV_HAVE_SSE4_1 */
00043 
00044 
00045 #ifdef LV_HAVE_GENERIC
00046 /*!
00047   \brief Deinterleaves the complex 8 bit vector into I 16 bit vector data
00048   \param complexVector The complex input vector
00049   \param iBuffer The I buffer output data
00050   \param num_points The number of complex data values to be deinterleaved
00051 */
00052 static inline void volk_8ic_deinterleave_real_16i_a_generic(int16_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
00053   unsigned int number = 0;
00054   const int8_t* complexVectorPtr = (const int8_t*)complexVector;
00055   int16_t* iBufferPtr = iBuffer;
00056   for(number = 0; number < num_points; number++){
00057     *iBufferPtr++ = ((int16_t)(*complexVectorPtr++)) * 128;
00058     complexVectorPtr++;
00059   }
00060 }
00061 #endif /* LV_HAVE_GENERIC */
00062 
00063 
00064 
00065 
00066 #endif /* INCLUDED_volk_8ic_deinterleave_real_16i_a_H */