mirror of https://github.com/PentHertz/srsLTE.git
Added vec_max_fff function
This commit is contained in:
parent
5c8a94ddfc
commit
2dfe82fb9c
|
@ -30,6 +30,7 @@ FIND_LIBRARY(
|
|||
IF(NOT ${VOLK_LIBRARIES} STREQUAL "")
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${VOLK_LIBRARIES} m)
|
||||
CHECK_FUNCTION_EXISTS_MATH(volk_32f_index_max_16u HAVE_VOLK_MAX_FUNCTION)
|
||||
CHECK_FUNCTION_EXISTS_MATH(volk_32f_x2_max_32f HAVE_VOLK_MAX_VEC_FUNCTION)
|
||||
CHECK_FUNCTION_EXISTS_MATH(volk_32f_accumulator_s32f HAVE_VOLK_ACC_FUNCTION)
|
||||
CHECK_FUNCTION_EXISTS_MATH(volk_32fc_s32fc_multiply_32fc HAVE_VOLK_MULT_FUNCTION)
|
||||
CHECK_FUNCTION_EXISTS_MATH(volk_32fc_conjugate_32fc HAVE_VOLK_CONJ_FUNCTION)
|
||||
|
@ -60,6 +61,9 @@ IF(NOT ${VOLK_LIBRARIES} STREQUAL "")
|
|||
IF(${HAVE_VOLK_MAX_ABS_FUNCTION})
|
||||
SET(VOLK_DEFINITIONS "${VOLK_DEFINITIONS}; HAVE_VOLK_MAX_ABS_FUNCTION")
|
||||
ENDIF()
|
||||
IF(${HAVE_VOLK_MAX_VEC_FUNCTION})
|
||||
SET(VOLK_DEFINITIONS "${VOLK_DEFINITIONS}; HAVE_VOLK_MAX_VEC_FUNCTION")
|
||||
ENDIF()
|
||||
IF(${HAVE_VOLK_DOTPROD_CONJ_FC_FUNCTION})
|
||||
SET(VOLK_DEFINITIONS "${VOLK_DEFINITIONS}; HAVE_VOLK_DOTPROD_CONJ_FC_FUNCTION")
|
||||
ENDIF()
|
||||
|
|
|
@ -124,6 +124,9 @@ LIBLTE_API float vec_avg_power_cf(cf_t *x, uint32_t len);
|
|||
LIBLTE_API uint32_t vec_max_fi(float *x, uint32_t len);
|
||||
LIBLTE_API uint32_t vec_max_abs_ci(cf_t *x, uint32_t len);
|
||||
|
||||
/* maximum between two vectors */
|
||||
LIBLTE_API void vec_max_fff(float *x, float *y, float *z, uint32_t len);
|
||||
|
||||
/* quantify vector of floats and convert to uint8_t */
|
||||
LIBLTE_API void vec_quant_fuc(float *in, uint8_t *out, float gain, float offset, float clip, uint32_t len);
|
||||
|
||||
|
|
|
@ -162,29 +162,29 @@ int main(int argc, char **argv) {
|
|||
printf(" EbNo: %.2f\n", ebno_db);
|
||||
}
|
||||
|
||||
data_tx = malloc(frame_length * sizeof(uint8_t));
|
||||
data_tx = vec_malloc(frame_length * sizeof(uint8_t));
|
||||
if (!data_tx) {
|
||||
perror("malloc");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
data_rx = malloc(frame_length * sizeof(uint8_t));
|
||||
data_rx = vec_malloc(frame_length * sizeof(uint8_t));
|
||||
if (!data_rx) {
|
||||
perror("malloc");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
symbols = malloc(coded_length * sizeof(uint8_t));
|
||||
symbols = vec_malloc(coded_length * sizeof(uint8_t));
|
||||
if (!symbols) {
|
||||
perror("malloc");
|
||||
exit(-1);
|
||||
}
|
||||
llr = malloc(coded_length * sizeof(float));
|
||||
llr = vec_malloc(coded_length * sizeof(float));
|
||||
if (!llr) {
|
||||
perror("malloc");
|
||||
exit(-1);
|
||||
}
|
||||
llr_c = malloc(coded_length * sizeof(uint8_t));
|
||||
llr_c = vec_malloc(coded_length * sizeof(uint8_t));
|
||||
if (!llr_c) {
|
||||
perror("malloc");
|
||||
exit(-1);
|
||||
|
|
|
@ -533,6 +533,21 @@ uint32_t vec_max_fi(float *x, uint32_t len) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void vec_max_fff(float *x, float *y, float *z, uint32_t len) {
|
||||
#ifdef HAVE_VOLK_MAX_VEC_FUNCTION
|
||||
volk_32f_x2_max_32f(z,x,y,len);
|
||||
#else
|
||||
uint32_t i;
|
||||
for (i=0;i<len;i++) {
|
||||
if (x[i] > y[i]) {
|
||||
z[i] = x[i];
|
||||
} else {
|
||||
z[i] = y[i];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
uint32_t vec_max_abs_ci(cf_t *x, uint32_t len) {
|
||||
#ifdef HAVE_VOLK_MAX_ABS_FUNCTION
|
||||
|
|
Loading…
Reference in New Issue