GNU Radio 3.6.4.2 C++ API
|
00001 #ifndef INCLUDED_volk_32fc_conjugate_32fc_u_H 00002 #define INCLUDED_volk_32fc_conjugate_32fc_u_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_u_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_loadu_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_storeu_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_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_u_H */ 00065 #ifndef INCLUDED_volk_32fc_conjugate_32fc_a_H 00066 #define INCLUDED_volk_32fc_conjugate_32fc_a_H 00067 00068 #include <inttypes.h> 00069 #include <stdio.h> 00070 #include <volk/volk_complex.h> 00071 #include <float.h> 00072 00073 #ifdef LV_HAVE_SSE3 00074 #include <pmmintrin.h> 00075 /*! 00076 \brief Takes the conjugate of a complex vector. 00077 \param cVector The vector where the results will be stored 00078 \param aVector Vector to be conjugated 00079 \param num_points The number of complex values in aVector to be conjugated and stored into cVector 00080 */ 00081 static inline void volk_32fc_conjugate_32fc_a_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){ 00082 unsigned int number = 0; 00083 const unsigned int halfPoints = num_points / 2; 00084 00085 __m128 x; 00086 lv_32fc_t* c = cVector; 00087 const lv_32fc_t* a = aVector; 00088 00089 __m128 conjugator = _mm_setr_ps(0, -0.f, 0, -0.f); 00090 00091 for(;number < halfPoints; number++){ 00092 00093 x = _mm_load_ps((float*)a); // Load the complex data as ar,ai,br,bi 00094 00095 x = _mm_xor_ps(x, conjugator); // conjugate register 00096 00097 _mm_store_ps((float*)c,x); // Store the results back into the C container 00098 00099 a += 2; 00100 c += 2; 00101 } 00102 00103 if((num_points % 2) != 0) { 00104 *c = lv_conj(*a); 00105 } 00106 } 00107 #endif /* LV_HAVE_SSE3 */ 00108 00109 #ifdef LV_HAVE_GENERIC 00110 /*! 00111 \brief Takes the conjugate of a complex vector. 00112 \param cVector The vector where the results will be stored 00113 \param aVector Vector to be conjugated 00114 \param num_points The number of complex values in aVector to be conjugated and stored into cVector 00115 */ 00116 static inline void volk_32fc_conjugate_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){ 00117 lv_32fc_t* cPtr = cVector; 00118 const lv_32fc_t* aPtr = aVector; 00119 unsigned int number = 0; 00120 00121 for(number = 0; number < num_points; number++){ 00122 *cPtr++ = lv_conj(*aPtr++); 00123 } 00124 } 00125 #endif /* LV_HAVE_GENERIC */ 00126 00127 00128 #endif /* INCLUDED_volk_32fc_conjugate_32fc_a_H */