GNU Radio 3.6.5 C++ API
|
00001 #ifndef INCLUDED_volk_32f_x2_min_32f_a_H 00002 #define INCLUDED_volk_32f_x2_min_32f_a_H 00003 00004 #include <inttypes.h> 00005 #include <stdio.h> 00006 00007 #ifdef LV_HAVE_SSE 00008 #include <xmmintrin.h> 00009 /*! 00010 \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector 00011 \param cVector The vector where the results will be stored 00012 \param aVector The vector to be checked 00013 \param bVector The vector to be checked 00014 \param num_points The number of values in aVector and bVector to be checked and stored into cVector 00015 */ 00016 static inline void volk_32f_x2_min_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){ 00017 unsigned int number = 0; 00018 const unsigned int quarterPoints = num_points / 4; 00019 00020 float* cPtr = cVector; 00021 const float* aPtr = aVector; 00022 const float* bPtr= bVector; 00023 00024 __m128 aVal, bVal, cVal; 00025 for(;number < quarterPoints; number++){ 00026 00027 aVal = _mm_load_ps(aPtr); 00028 bVal = _mm_load_ps(bPtr); 00029 00030 cVal = _mm_min_ps(aVal, bVal); 00031 00032 _mm_store_ps(cPtr,cVal); // Store the results back into the C container 00033 00034 aPtr += 4; 00035 bPtr += 4; 00036 cPtr += 4; 00037 } 00038 00039 number = quarterPoints * 4; 00040 for(;number < num_points; number++){ 00041 const float a = *aPtr++; 00042 const float b = *bPtr++; 00043 *cPtr++ = ( a < b ? a : b); 00044 } 00045 } 00046 #endif /* LV_HAVE_SSE */ 00047 00048 #ifdef LV_HAVE_GENERIC 00049 /*! 00050 \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector 00051 \param cVector The vector where the results will be stored 00052 \param aVector The vector to be checked 00053 \param bVector The vector to be checked 00054 \param num_points The number of values in aVector and bVector to be checked and stored into cVector 00055 */ 00056 static inline void volk_32f_x2_min_32f_a_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){ 00057 float* cPtr = cVector; 00058 const float* aPtr = aVector; 00059 const float* bPtr= bVector; 00060 unsigned int number = 0; 00061 00062 for(number = 0; number < num_points; number++){ 00063 const float a = *aPtr++; 00064 const float b = *bPtr++; 00065 *cPtr++ = ( a < b ? a : b); 00066 } 00067 } 00068 #endif /* LV_HAVE_GENERIC */ 00069 00070 #ifdef LV_HAVE_ORC 00071 /*! 00072 \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector 00073 \param cVector The vector where the results will be stored 00074 \param aVector The vector to be checked 00075 \param bVector The vector to be checked 00076 \param num_points The number of values in aVector and bVector to be checked and stored into cVector 00077 */ 00078 extern void volk_32f_x2_min_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points); 00079 static inline void volk_32f_x2_min_32f_a_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){ 00080 volk_32f_x2_min_32f_a_orc_impl(cVector, aVector, bVector, num_points); 00081 } 00082 #endif /* LV_HAVE_ORC */ 00083 00084 00085 #endif /* INCLUDED_volk_32f_x2_min_32f_a_H */