1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#ifndef INCLUDED_volk_8i_convert_16i_a16_H
#define INCLUDED_volk_8i_convert_16i_a16_H
#include <inttypes.h>
#include <stdio.h>
#if LV_HAVE_SSE4_1
#include <smmintrin.h>
/*!
\brief Converts the input 8 bit integer data into 16 bit integer data
\param inputVector The 8 bit input data buffer
\param outputVector The 16 bit output data buffer
\param num_points The number of data values to be converted
*/
static inline void volk_8i_convert_16i_a16_sse4_1(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
unsigned int number = 0;
const unsigned int sixteenthPoints = num_points / 16;
const __m128i* inputVectorPtr = (const __m128i*)inputVector;
__m128i* outputVectorPtr = (__m128i*)outputVector;
__m128i inputVal;
__m128i ret;
for(;number < sixteenthPoints; number++){
inputVal = _mm_load_si128(inputVectorPtr);
ret = _mm_cvtepi8_epi16(inputVal);
ret = _mm_slli_epi16(ret, 8); // Multiply by 256
_mm_store_si128(outputVectorPtr, ret);
outputVectorPtr++;
inputVal = _mm_srli_si128(inputVal, 8);
ret = _mm_cvtepi8_epi16(inputVal);
ret = _mm_slli_epi16(ret, 8); // Multiply by 256
_mm_store_si128(outputVectorPtr, ret);
outputVectorPtr++;
inputVectorPtr++;
}
number = sixteenthPoints * 16;
for(; number < num_points; number++){
outputVector[number] = (int16_t)(inputVector[number])*256;
}
}
#endif /* LV_HAVE_SSE4_1 */
#if LV_HAVE_GENERIC
/*!
\brief Converts the input 8 bit integer data into 16 bit integer data
\param inputVector The 8 bit input data buffer
\param outputVector The 16 bit output data buffer
\param num_points The number of data values to be converted
*/
static inline void volk_8i_convert_16i_a16_generic(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
int16_t* outputVectorPtr = outputVector;
const int8_t* inputVectorPtr = inputVector;
unsigned int number = 0;
for(number = 0; number < num_points; number++){
*outputVectorPtr++ = ((int16_t)(*inputVectorPtr++)) * 256;
}
}
#endif /* LV_HAVE_GENERIC */
#if LV_HAVE_ORC
/*!
\brief Converts the input 8 bit integer data into 16 bit integer data
\param inputVector The 8 bit input data buffer
\param outputVector The 16 bit output data buffer
\param num_points The number of data values to be converted
*/
extern void volk_8i_convert_16i_a16_orc_impl(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points);
static inline void volk_8i_convert_16i_a16_orc(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
volk_8i_convert_16i_a16_orc_impl(outputVector, inputVector, num_points);
}
#endif /* LV_HAVE_ORC */
#endif /* INCLUDED_VOLK_8s_CONVERT_16s_ALIGNED8_H */
|