GNU Radio 3.6.5 C++ API

volk_32f_s32f_normalize_a.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_volk_32f_s32f_normalize_a_H
00002 #define INCLUDED_volk_32f_s32f_normalize_a_H
00003 
00004 #include <inttypes.h>
00005 #include <stdio.h>
00006 
00007 #ifdef LV_HAVE_SSE
00008 #include <xmmintrin.h>
00009 /*!
00010   \brief Normalizes all points in the buffer by the scalar value ( divides each data point by the scalar value )
00011   \param vecBuffer The buffer of values to be vectorized
00012   \param num_points The number of values in vecBuffer
00013   \param scalar The scale value to be applied to each buffer value
00014 */
00015 static inline void volk_32f_s32f_normalize_a_sse(float* vecBuffer, const float scalar, unsigned int num_points){
00016   unsigned int number = 0;
00017   float* inputPtr = vecBuffer;
00018 
00019   const float invScalar = 1.0 / scalar;
00020   __m128 vecScalar = _mm_set_ps1(invScalar);
00021 
00022   __m128 input1;
00023 
00024   const uint64_t quarterPoints = num_points / 4;
00025   for(;number < quarterPoints; number++){
00026 
00027     input1 = _mm_load_ps(inputPtr);
00028 
00029     input1 = _mm_mul_ps(input1, vecScalar);
00030 
00031     _mm_store_ps(inputPtr, input1);
00032 
00033     inputPtr += 4;
00034   }
00035 
00036   number = quarterPoints*4;
00037   for(; number < num_points; number++){
00038     *inputPtr *= invScalar;
00039     inputPtr++;
00040   }
00041 }
00042 #endif /* LV_HAVE_SSE */
00043 
00044 #ifdef LV_HAVE_GENERIC
00045 /*!
00046   \brief Normalizes the two input vectors and store their results in the third vector
00047   \param cVector The vector where the results will be stored
00048   \param aVector One of the vectors to be normalizeed
00049   \param bVector One of the vectors to be normalizeed
00050   \param num_points The number of values in aVector and bVector to be normalizeed together and stored into cVector
00051 */
00052 static inline void volk_32f_s32f_normalize_a_generic(float* vecBuffer, const float scalar, unsigned int num_points){
00053   unsigned int number = 0;
00054   float* inputPtr = vecBuffer;
00055   const float invScalar = 1.0 / scalar;
00056   for(number = 0; number < num_points; number++){
00057     *inputPtr *= invScalar;
00058     inputPtr++;
00059   }
00060 }
00061 #endif /* LV_HAVE_GENERIC */
00062 
00063 #ifdef LV_HAVE_ORC
00064 /*!
00065   \brief Normalizes the two input vectors and store their results in the third vector
00066   \param cVector The vector where the results will be stored
00067   \param aVector One of the vectors to be normalizeed
00068   \param bVector One of the vectors to be normalizeed
00069   \param num_points The number of values in aVector and bVector to be normalizeed together and stored into cVector
00070 */
00071 extern void volk_32f_s32f_normalize_a_orc_impl(float* dst, float* src, const float scalar, unsigned int num_points);
00072 static inline void volk_32f_s32f_normalize_a_orc(float* vecBuffer, const float scalar, unsigned int num_points){
00073     float invscalar = 1.0 / scalar;
00074     volk_32f_s32f_normalize_a_orc_impl(vecBuffer, vecBuffer, invscalar, num_points);
00075 }
00076 #endif /* LV_HAVE_GENERIC */
00077 
00078 
00079 
00080 
00081 #endif /* INCLUDED_volk_32f_s32f_normalize_a_H */