GNU Radio 3.6.5 C++ API
|
00001 #ifndef INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H 00002 #define INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H 00003 00004 #include <volk/volk_common.h> 00005 #include <inttypes.h> 00006 #include <stdio.h> 00007 00008 #ifdef LV_HAVE_SSE 00009 #include <xmmintrin.h> 00010 /*! 00011 \brief Deinterleaves the complex vector, multiply the value by the scalar, convert to 16t, and in I vector data 00012 \param complexVector The complex input vector 00013 \param scalar The value to be multiply against each of the input values 00014 \param iBuffer The I buffer output data 00015 \param num_points The number of complex data values to be deinterleaved 00016 */ 00017 static inline void volk_32fc_s32f_deinterleave_real_16i_a_sse(int16_t* iBuffer, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){ 00018 unsigned int number = 0; 00019 const unsigned int quarterPoints = num_points / 4; 00020 00021 const float* complexVectorPtr = (float*)complexVector; 00022 int16_t* iBufferPtr = iBuffer; 00023 00024 __m128 vScalar = _mm_set_ps1(scalar); 00025 00026 __m128 cplxValue1, cplxValue2, iValue; 00027 00028 __VOLK_ATTR_ALIGNED(16) float floatBuffer[4]; 00029 00030 for(;number < quarterPoints; number++){ 00031 cplxValue1 = _mm_load_ps(complexVectorPtr); 00032 complexVectorPtr += 4; 00033 00034 cplxValue2 = _mm_load_ps(complexVectorPtr); 00035 complexVectorPtr += 4; 00036 00037 // Arrange in i1i2i3i4 format 00038 iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0)); 00039 00040 iValue = _mm_mul_ps(iValue, vScalar); 00041 00042 _mm_store_ps(floatBuffer, iValue); 00043 *iBufferPtr++ = (int16_t)(floatBuffer[0]); 00044 *iBufferPtr++ = (int16_t)(floatBuffer[1]); 00045 *iBufferPtr++ = (int16_t)(floatBuffer[2]); 00046 *iBufferPtr++ = (int16_t)(floatBuffer[3]); 00047 } 00048 00049 number = quarterPoints * 4; 00050 iBufferPtr = &iBuffer[number]; 00051 for(; number < num_points; number++){ 00052 *iBufferPtr++ = (int16_t)(*complexVectorPtr++ * scalar); 00053 complexVectorPtr++; 00054 } 00055 } 00056 #endif /* LV_HAVE_SSE */ 00057 00058 #ifdef LV_HAVE_GENERIC 00059 /*! 00060 \brief Deinterleaves the complex vector, multiply the value by the scalar, convert to 16t, and in I vector data 00061 \param complexVector The complex input vector 00062 \param scalar The value to be multiply against each of the input values 00063 \param iBuffer The I buffer output data 00064 \param num_points The number of complex data values to be deinterleaved 00065 */ 00066 static inline void volk_32fc_s32f_deinterleave_real_16i_a_generic(int16_t* iBuffer, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){ 00067 const float* complexVectorPtr = (float*)complexVector; 00068 int16_t* iBufferPtr = iBuffer; 00069 unsigned int number = 0; 00070 for(number = 0; number < num_points; number++){ 00071 *iBufferPtr++ = (int16_t)(*complexVectorPtr++ * scalar); 00072 complexVectorPtr++; 00073 } 00074 00075 } 00076 #endif /* LV_HAVE_GENERIC */ 00077 00078 00079 00080 00081 #endif /* INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H */