diff --git a/lib/include/srslte/phy/dft/dft_precoding.h b/lib/include/srslte/phy/dft/dft_precoding.h index e87189e3f..2cbee27c8 100644 --- a/lib/include/srslte/phy/dft/dft_precoding.h +++ b/lib/include/srslte/phy/dft/dft_precoding.h @@ -53,6 +53,8 @@ SRSLTE_API void srslte_dft_precoding_free(srslte_dft_precoding_t* q); SRSLTE_API bool srslte_dft_precoding_valid_prb(uint32_t nof_prb); +SRSLTE_API uint32_t srslte_dft_precoding_get_valid_prb(uint32_t nof_prb); + SRSLTE_API int srslte_dft_precoding(srslte_dft_precoding_t* q, cf_t* input, cf_t* output, uint32_t nof_prb, uint32_t nof_symbols); diff --git a/lib/src/phy/dft/dft_precoding.c b/lib/src/phy/dft/dft_precoding.c index 3fdde3a7a..a68a4565f 100644 --- a/lib/src/phy/dft/dft_precoding.c +++ b/lib/src/phy/dft/dft_precoding.c @@ -102,6 +102,15 @@ bool srslte_dft_precoding_valid_prb(uint32_t nof_prb) return false; } +/* Return largest integer that fulfills the DFT precoding PRB criterion (TS 36.213 Section 14.1.1.4C) */ +uint32_t srslte_dft_precoding_get_valid_prb(uint32_t nof_prb) +{ + while (srslte_dft_precoding_valid_prb(nof_prb) == false) { + nof_prb--; + } + return nof_prb; +} + int srslte_dft_precoding(srslte_dft_precoding_t* q, cf_t* input, cf_t* output, uint32_t nof_prb, uint32_t nof_symbols) {