GNU Radio 3.6.5 C++ API

volk_16ic_deinterleave_real_8i_a.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_volk_16ic_deinterleave_real_8i_a_H
00002 #define INCLUDED_volk_16ic_deinterleave_real_8i_a_H
00003 
00004 #include <inttypes.h>
00005 #include <stdio.h>
00006 
00007 #ifdef LV_HAVE_SSSE3
00008 #include <tmmintrin.h>
00009 /*!
00010   \brief Deinterleaves the complex 16 bit vector into 8 bit I 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_16ic_deinterleave_real_8i_a_ssse3(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
00016   unsigned int number = 0;
00017   const int8_t* complexVectorPtr = (int8_t*)complexVector;
00018   int8_t* iBufferPtr = iBuffer;
00019   __m128i iMoveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 13, 12, 9, 8, 5, 4, 1, 0);
00020   __m128i iMoveMask2 = _mm_set_epi8(13, 12, 9, 8, 5, 4, 1, 0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
00021   __m128i complexVal1, complexVal2, complexVal3, complexVal4, iOutputVal;
00022 
00023   unsigned int sixteenthPoints = num_points / 16;
00024 
00025   for(number = 0; number < sixteenthPoints; number++){
00026     complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr);  complexVectorPtr += 16;
00027     complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr);  complexVectorPtr += 16;
00028 
00029     complexVal3 = _mm_load_si128((__m128i*)complexVectorPtr);  complexVectorPtr += 16;
00030     complexVal4 = _mm_load_si128((__m128i*)complexVectorPtr);  complexVectorPtr += 16;
00031 
00032     complexVal1 = _mm_shuffle_epi8(complexVal1, iMoveMask1);
00033     complexVal2 = _mm_shuffle_epi8(complexVal2, iMoveMask2);
00034 
00035     complexVal1 = _mm_or_si128(complexVal1, complexVal2);
00036 
00037     complexVal3 = _mm_shuffle_epi8(complexVal3, iMoveMask1);
00038     complexVal4 = _mm_shuffle_epi8(complexVal4, iMoveMask2);
00039 
00040     complexVal3 = _mm_or_si128(complexVal3, complexVal4);
00041 
00042 
00043     complexVal1 = _mm_srai_epi16(complexVal1, 8);
00044     complexVal3 = _mm_srai_epi16(complexVal3, 8);
00045 
00046     iOutputVal = _mm_packs_epi16(complexVal1, complexVal3);
00047 
00048     _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
00049 
00050     iBufferPtr += 16;
00051   }
00052 
00053   number = sixteenthPoints * 16;
00054   int16_t* int16ComplexVectorPtr = (int16_t*)complexVectorPtr;
00055   for(; number < num_points; number++){
00056     *iBufferPtr++ = ((int8_t)(*int16ComplexVectorPtr++ >> 8));
00057     int16ComplexVectorPtr++;
00058   }
00059 }
00060 #endif /* LV_HAVE_SSSE3 */
00061 
00062 #ifdef LV_HAVE_GENERIC
00063 /*!
00064   \brief Deinterleaves the complex 16 bit vector into 8 bit I vector data
00065   \param complexVector The complex input vector
00066   \param iBuffer The I buffer output data
00067   \param num_points The number of complex data values to be deinterleaved
00068 */
00069 static inline void volk_16ic_deinterleave_real_8i_a_generic(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
00070   unsigned int number = 0;
00071   int16_t* complexVectorPtr = (int16_t*)complexVector;
00072   int8_t* iBufferPtr = iBuffer;
00073   for(number = 0; number < num_points; number++){
00074     *iBufferPtr++ = ((int8_t)(*complexVectorPtr++ >> 8));
00075     complexVectorPtr++;
00076   }
00077 }
00078 #endif /* LV_HAVE_GENERIC */
00079 
00080 #ifdef LV_HAVE_ORC
00081 /*!
00082   \brief Deinterleaves the complex 16 bit vector into 8 bit I vector data
00083   \param complexVector The complex input vector
00084   \param iBuffer The I buffer output data
00085   \param num_points The number of complex data values to be deinterleaved
00086 */
00087 extern void volk_16ic_deinterleave_real_8i_a_orc_impl(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points);
00088 static inline void volk_16ic_deinterleave_real_8i_a_orc(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
00089     volk_16ic_deinterleave_real_8i_a_orc_impl(iBuffer, complexVector, num_points);
00090 }
00091 #endif /* LV_HAVE_ORC */
00092 
00093 
00094 #endif /* INCLUDED_volk_16ic_deinterleave_real_8i_a_H */