Skip to content

Fix and refactor channel average

Matthias Mehlhose requested to merge fix_and_refactor_channel_average into develop

Fixing missing init average variable with zero and refactor the code #86b11ab7 Fixes just the missing avg1=0

Refactor the code to a common SSE/AVX2 inline function using also horizontal add.

We use int64_t result from now on.

We decided to fix length to x12 instead of old x9 openair1/PHY/NR_UE_TRANSPORT/dci_nr.c

//compute average channel_level on each (TX,RX) antenna pair
void nr_pdcch_channel_level(int32_t rx_size,
                            c16_t dl_ch_estimates_ext[][rx_size],
                            NR_DL_FRAME_PARMS *frame_parms,
                            int32_t *avg,
                            int symbol,
                            int nb_rb)
{
  for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
    //clear average level
    simde__m128i avg128P = simde_mm_setzero_si128();
    simde__m128i *dl_ch128 = (simde__m128i *)&dl_ch_estimates_ext[aarx][symbol * nb_rb * 12];

    for (int rb = 0; rb < (nb_rb * 12) >> 2; rb++) {     <-------------- here
      avg128P = simde_mm_add_epi32(avg128P, simde_mm_madd_epi16(dl_ch128[rb], dl_ch128[rb]));
    }

    DevAssert(nb_rb);
    avg[aarx] = 0;
    for (int i = 0; i < 4; i++)
      avg[aarx] += ((int32_t *)&avg128P)[i] / (nb_rb * 12); <-------------- and here
    LOG_DDD("Channel level : %d\n",avg[aarx]);
  }
}
Edited by Matthias Mehlhose

Merge request reports

Loading