1 #ifndef INCLUDED_volk_32f_s32f_32f_fm_detect_32f_a_H
2 #define INCLUDED_volk_32f_s32f_32f_fm_detect_32f_a_H
17 static inline void volk_32f_s32f_32f_fm_detect_32f_a_sse(
float* outputVector,
const float* inputVector,
const float bound,
float* saveValue,
unsigned int num_points){
21 unsigned int number = 1;
25 const unsigned int quarterPoints = (num_points-1) / 4;
27 float* outPtr = outputVector;
28 const float* inPtr = inputVector;
29 __m128 upperBound = _mm_set_ps1(bound);
30 __m128 lowerBound = _mm_set_ps1(-bound);
34 __m128 posBoundAdjust = _mm_set_ps1(-2*bound);
35 __m128 negBoundAdjust = _mm_set_ps1(2*bound);
37 *outPtr = *inPtr - *saveValue;
38 if (*outPtr > bound) *outPtr -= 2*bound;
39 if (*outPtr < -bound) *outPtr += 2*bound;
42 for (j = 1; j < ( (4 < num_points) ? 4 : num_points); j++) {
43 *outPtr = *(inPtr) - *(inPtr-1);
44 if (*outPtr > bound) *outPtr -= 2*bound;
45 if (*outPtr < -bound) *outPtr += 2*bound;
50 for (; number < quarterPoints; number++) {
52 next3old1 = _mm_loadu_ps((
float*) (inPtr-1));
53 next4 = _mm_load_ps(inPtr);
56 next3old1 = _mm_sub_ps(next4, next3old1);
58 boundAdjust = _mm_cmpgt_ps(next3old1, upperBound);
59 boundAdjust = _mm_and_ps(boundAdjust, posBoundAdjust);
60 next4 = _mm_cmplt_ps(next3old1, lowerBound);
61 next4 = _mm_and_ps(next4, negBoundAdjust);
62 boundAdjust = _mm_or_ps(next4, boundAdjust);
64 next3old1 = _mm_add_ps(next3old1, boundAdjust);
65 _mm_store_ps(outPtr,next3old1);
69 for (number = (4 > (quarterPoints*4) ? 4 : (4 * quarterPoints)); number < num_points; number++) {
70 *outPtr = *(inPtr) - *(inPtr-1);
71 if (*outPtr > bound) *outPtr -= 2*bound;
72 if (*outPtr < -bound) *outPtr += 2*bound;
77 *saveValue = inputVector[num_points-1];
81 #ifdef LV_HAVE_GENERIC
90 static inline void volk_32f_s32f_32f_fm_detect_32f_generic(
float* outputVector,
const float* inputVector,
const float bound,
float* saveValue,
unsigned int num_points){
94 unsigned int number = 0;
95 float* outPtr = outputVector;
96 const float* inPtr = inputVector;
99 *outPtr = *inPtr - *saveValue;
100 if (*outPtr > bound) *outPtr -= 2*bound;
101 if (*outPtr < -bound) *outPtr += 2*bound;
105 for (number = 1; number < num_points; number++) {
106 *outPtr = *(inPtr) - *(inPtr-1);
107 if (*outPtr > bound) *outPtr -= 2*bound;
108 if (*outPtr < -bound) *outPtr += 2*bound;
113 *saveValue = inputVector[num_points-1];