GNU Radio 3.6.5 C++ API

volk_32fc_conjugate_32fc_a.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_volk_32fc_conjugate_32fc_a_H
00002 #define INCLUDED_volk_32fc_conjugate_32fc_a_H
00003 
00004 #include <inttypes.h>
00005 #include <stdio.h>
00006 #include <volk/volk_complex.h>
00007 #include <float.h>
00008 
00009 #ifdef LV_HAVE_SSE3
00010 #include <pmmintrin.h>
00011   /*!
00012     \brief Takes the conjugate of a complex vector.
00013     \param cVector The vector where the results will be stored
00014     \param aVector Vector to be conjugated
00015     \param num_points The number of complex values in aVector to be conjugated and stored into cVector
00016   */
00017 static inline void volk_32fc_conjugate_32fc_a_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){
00018     unsigned int number = 0;
00019     const unsigned int halfPoints = num_points / 2;
00020 
00021     __m128 x;
00022     lv_32fc_t* c = cVector;
00023     const lv_32fc_t* a = aVector;
00024 
00025     __m128 conjugator = _mm_setr_ps(0, -0.f, 0, -0.f);
00026 
00027     for(;number < halfPoints; number++){
00028 
00029       x = _mm_load_ps((float*)a); // Load the complex data as ar,ai,br,bi
00030 
00031       x = _mm_xor_ps(x, conjugator); // conjugate register
00032 
00033       _mm_store_ps((float*)c,x); // Store the results back into the C container
00034 
00035       a += 2;
00036       c += 2;
00037     }
00038 
00039     if((num_points % 2) != 0) {
00040       *c = lv_conj(*a);
00041     }
00042 }
00043 #endif /* LV_HAVE_SSE3 */
00044 
00045 #ifdef LV_HAVE_GENERIC
00046   /*!
00047     \brief Takes the conjugate of a complex vector.
00048     \param cVector The vector where the results will be stored
00049     \param aVector Vector to be conjugated
00050     \param num_points The number of complex values in aVector to be conjugated and stored into cVector
00051   */
00052 static inline void volk_32fc_conjugate_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){
00053     lv_32fc_t* cPtr = cVector;
00054     const lv_32fc_t* aPtr = aVector;
00055     unsigned int number = 0;
00056 
00057     for(number = 0; number < num_points; number++){
00058       *cPtr++ = lv_conj(*aPtr++);
00059     }
00060 }
00061 #endif /* LV_HAVE_GENERIC */
00062 
00063 
00064 #endif /* INCLUDED_volk_32fc_conjugate_32fc_a_H */