GNU Radio 3.6.5 C++ API
|
00001 #ifndef INCLUDED_volk_8i_convert_16i_u_H 00002 #define INCLUDED_volk_8i_convert_16i_u_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 \note Input and output buffers do NOT need to be properly aligned 00016 */ 00017 static inline void volk_8i_convert_16i_u_sse4_1(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){ 00018 unsigned int number = 0; 00019 const unsigned int sixteenthPoints = num_points / 16; 00020 00021 const __m128i* inputVectorPtr = (const __m128i*)inputVector; 00022 __m128i* outputVectorPtr = (__m128i*)outputVector; 00023 __m128i inputVal; 00024 __m128i ret; 00025 00026 for(;number < sixteenthPoints; number++){ 00027 inputVal = _mm_loadu_si128(inputVectorPtr); 00028 ret = _mm_cvtepi8_epi16(inputVal); 00029 ret = _mm_slli_epi16(ret, 8); // Multiply by 256 00030 _mm_storeu_si128(outputVectorPtr, ret); 00031 00032 outputVectorPtr++; 00033 00034 inputVal = _mm_srli_si128(inputVal, 8); 00035 ret = _mm_cvtepi8_epi16(inputVal); 00036 ret = _mm_slli_epi16(ret, 8); // Multiply by 256 00037 _mm_storeu_si128(outputVectorPtr, ret); 00038 00039 outputVectorPtr++; 00040 00041 inputVectorPtr++; 00042 } 00043 00044 number = sixteenthPoints * 16; 00045 for(; number < num_points; number++){ 00046 outputVector[number] = (int16_t)(inputVector[number])*256; 00047 } 00048 } 00049 #endif /* LV_HAVE_SSE4_1 */ 00050 00051 #ifdef LV_HAVE_GENERIC 00052 /*! 00053 \brief Converts the input 8 bit integer data into 16 bit integer data 00054 \param inputVector The 8 bit input data buffer 00055 \param outputVector The 16 bit output data buffer 00056 \param num_points The number of data values to be converted 00057 \note Input and output buffers do NOT need to be properly aligned 00058 */ 00059 static inline void volk_8i_convert_16i_u_generic(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){ 00060 int16_t* outputVectorPtr = outputVector; 00061 const int8_t* inputVectorPtr = inputVector; 00062 unsigned int number = 0; 00063 00064 for(number = 0; number < num_points; number++){ 00065 *outputVectorPtr++ = ((int16_t)(*inputVectorPtr++)) * 256; 00066 } 00067 } 00068 #endif /* LV_HAVE_GENERIC */ 00069 00070 00071 00072 00073 #endif /* INCLUDED_VOLK_8s_CONVERT_16s_UNALIGNED8_H */