GNU Radio 3.6.5 C++ API

volk_8i_convert_16i_a.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_volk_8i_convert_16i_a_H
00002 #define INCLUDED_volk_8i_convert_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   /*!
00011     \brief Converts the input 8 bit integer data into 16 bit integer data
00012     \param inputVector The 8 bit input data buffer
00013     \param outputVector The 16 bit output data buffer
00014     \param num_points The number of data values to be converted
00015   */
00016 static inline void volk_8i_convert_16i_a_sse4_1(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
00017     unsigned int number = 0;
00018     const unsigned int sixteenthPoints = num_points / 16;
00019 
00020     const __m128i* inputVectorPtr = (const __m128i*)inputVector;
00021     __m128i* outputVectorPtr = (__m128i*)outputVector;
00022     __m128i inputVal;
00023     __m128i ret;
00024 
00025     for(;number < sixteenthPoints; number++){
00026       inputVal = _mm_load_si128(inputVectorPtr);
00027       ret = _mm_cvtepi8_epi16(inputVal);
00028       ret = _mm_slli_epi16(ret, 8); // Multiply by 256
00029       _mm_store_si128(outputVectorPtr, ret);
00030 
00031       outputVectorPtr++;
00032 
00033       inputVal = _mm_srli_si128(inputVal, 8);
00034       ret = _mm_cvtepi8_epi16(inputVal);
00035       ret = _mm_slli_epi16(ret, 8); // Multiply by 256
00036       _mm_store_si128(outputVectorPtr, ret);
00037 
00038       outputVectorPtr++;
00039 
00040       inputVectorPtr++;
00041     }
00042 
00043     number = sixteenthPoints * 16;
00044     for(; number < num_points; number++){
00045       outputVector[number] = (int16_t)(inputVector[number])*256;
00046     }
00047 }
00048 #endif /* LV_HAVE_SSE4_1 */
00049 
00050 #ifdef LV_HAVE_GENERIC
00051   /*!
00052     \brief Converts the input 8 bit integer data into 16 bit integer data
00053     \param inputVector The 8 bit input data buffer
00054     \param outputVector The 16 bit output data buffer
00055     \param num_points The number of data values to be converted
00056   */
00057 static inline void volk_8i_convert_16i_a_generic(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
00058   int16_t* outputVectorPtr = outputVector;
00059   const int8_t* inputVectorPtr = inputVector;
00060   unsigned int number = 0;
00061 
00062   for(number = 0; number < num_points; number++){
00063     *outputVectorPtr++ = ((int16_t)(*inputVectorPtr++)) * 256;
00064   }
00065 }
00066 #endif /* LV_HAVE_GENERIC */
00067 
00068 #ifdef LV_HAVE_ORC
00069   /*!
00070     \brief Converts the input 8 bit integer data into 16 bit integer data
00071     \param inputVector The 8 bit input data buffer
00072     \param outputVector The 16 bit output data buffer
00073     \param num_points The number of data values to be converted
00074   */
00075 extern void volk_8i_convert_16i_a_orc_impl(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points);
00076 static inline void volk_8i_convert_16i_a_orc(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
00077     volk_8i_convert_16i_a_orc_impl(outputVector, inputVector, num_points);
00078 }
00079 #endif /* LV_HAVE_ORC */
00080 
00081 
00082 
00083 #endif /* INCLUDED_VOLK_8s_CONVERT_16s_ALIGNED8_H */