/** * * \section COPYRIGHT * * Copyright 2013-2015 Software Radio Systems Limited * * \section LICENSE * * This file is part of the srsLTE library. * * srsLTE is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * srsLTE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * A copy of the GNU Affero General Public License can be found in * the LICENSE file in the top-level directory of this distribution * and at http://www.gnu.org/licenses/. * */ #include #include #include #include #include #include "srslte/utils/vector.h" #include "srslte/utils/vector_simd.h" #include "srslte/utils/bit.h" #ifdef HAVE_VOLK #include "volk/volk.h" #endif int srslte_vec_acc_ii(int *x, uint32_t len) { int i; int z=0; for (i=0;im) { m=x[i]; p=i; } } return p; #endif } int16_t srslte_vec_max_star_si(int16_t *x, uint32_t len) { #ifdef HAVE_VOLK_MAX_STAR_S_FUNCTION int16_t target=0; volk_16i_max_star_16i(&target,x,len); return target; #else uint32_t i; int16_t m=-INT16_MIN; for (i=0;im) { m=x[i]; } } return m; #endif } int16_t srslte_vec_max_abs_star_si(int16_t *x, uint32_t len) { uint32_t i; int16_t m=-INT16_MIN; for (i=0;im) { m=abs(x[i]); } } return m; } void srslte_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 y[i]) { z[i] = x[i]; } else { z[i] = y[i]; } } #endif } uint32_t srslte_vec_max_abs_ci(cf_t *x, uint32_t len) { #ifdef HAVE_VOLK_MAX_ABS_FUNCTION uint32_t target=0; volk_32fc_index_max_16u(&target,x,len); return target; #else uint32_t i; float m=-FLT_MAX; uint32_t p=0; float tmp; for (i=0;im) { m=tmp; p=i; } } return p; #endif } void srslte_vec_quant_fuc(float *in, uint8_t *out, float gain, float offset, float clip, uint32_t len) { int i; int tmp; for (i=0;i clip) tmp = clip; out[i] = (uint8_t) tmp; } } void srslte_vec_quant_suc(int16_t *in, uint8_t *out, float gain, int16_t offset, int16_t clip, uint32_t len) { int i; int16_t tmp; for (i=0;i clip) tmp = clip; out[i] = (uint8_t) tmp; } }