zmq: fix scaling of samples when decimation is applied

This commit is contained in:
Robert Falkenberg 2021-11-16 16:48:33 +01:00
parent fbf178e958
commit b4bbbc902a
1 changed files with 5 additions and 1 deletions

View File

@ -785,7 +785,7 @@ int rf_zmq_recv_with_time_multi(void* h, void** data, uint32_t nsamples, bool bl
for (int j = 0; j < decim_factor; j++, n++) { for (int j = 0; j < decim_factor; j++, n++) {
avg += ptr[n]; avg += ptr[n];
} }
dst[i] = avg; dst[i] = avg; // divide by decim_factor later via scale
} }
rf_zmq_info(handler->id, rf_zmq_info(handler->id,
@ -801,6 +801,10 @@ int rf_zmq_recv_with_time_multi(void* h, void** data, uint32_t nsamples, bool bl
pthread_mutex_lock(&handler->rx_gain_mutex); pthread_mutex_lock(&handler->rx_gain_mutex);
float scale = srsran_convert_dB_to_amplitude(handler->rx_gain); float scale = srsran_convert_dB_to_amplitude(handler->rx_gain);
pthread_mutex_unlock(&handler->rx_gain_mutex); pthread_mutex_unlock(&handler->rx_gain_mutex);
// scale shall also incorporate decim_factor
if (decim_factor > 0) {
scale = scale / decim_factor;
}
for (uint32_t c = 0; c < handler->nof_channels; c++) { for (uint32_t c = 0; c < handler->nof_channels; c++) {
if (buffers[c]) { if (buffers[c]) {
srsran_vec_sc_prod_cfc(buffers[c], scale, buffers[c], nsamples); srsran_vec_sc_prod_cfc(buffers[c], scale, buffers[c], nsamples);