Simplifying bit shift in the nr_scale_channel() function
This commit is contained in:
@@ -427,34 +427,18 @@ void nr_channel_level(const int symbol,
|
||||
|
||||
void nr_scale_channel(int size, int ch_estimates_ext[][size], int symb, uint32_t len, int nrOfLayers, int nb_rx, int shift_ch_ext)
|
||||
{
|
||||
// Determine scaling amplitude based the symbol
|
||||
int b = 3;
|
||||
short ch_amp = 1024 * 8;
|
||||
if (shift_ch_ext > 3) {
|
||||
b = 0;
|
||||
ch_amp >>= (shift_ch_ext - 3);
|
||||
if (ch_amp == 0) {
|
||||
ch_amp = 1;
|
||||
}
|
||||
} else {
|
||||
b -= shift_ch_ext;
|
||||
}
|
||||
simde__m128i ch_amp128 = simde_mm_set1_epi16(ch_amp); // Q3.13
|
||||
LOG_D(PHY, "Scaling channel est in OFDM symbol %d by %d\n", symb, ch_amp);
|
||||
|
||||
for (int l = 0; l < nrOfLayers; l++) {
|
||||
for (int aarx = 0; aarx < nb_rx; aarx++) {
|
||||
simde__m128i *ul_ch128 = (simde__m128i *)&ch_estimates_ext[l * nb_rx + aarx][symb * len];
|
||||
int loop_end = len >> 2;
|
||||
for (int i = 0; i < loop_end; i++) {
|
||||
ul_ch128[i] = simde_mm_mulhi_epi16(ul_ch128[i], ch_amp128);
|
||||
ul_ch128[i] = simde_mm_slli_epi16(ul_ch128[i], b);
|
||||
ul_ch128[i] = simde_mm_srai_epi16(ul_ch128[i], shift_ch_ext);
|
||||
}
|
||||
// loop for the remaining elements
|
||||
int start_index = loop_end * 4;
|
||||
for (int j = start_index; j < len; j++) {
|
||||
c16_t *temp = ((c16_t *)ul_ch128) + j;
|
||||
*temp = c16Shift(*temp, b);
|
||||
*temp = c16Shift(*temp, shift_ch_ext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user