@@ -156,6 +156,7 @@ static unsigned extract_layer_hop_rx_pilots(dmrs_symbol_list&
156156// / \param[in] dmrs_mask Boolean mask identifying the OFDM symbols carrying DM-RS within the slot.
157157// / \param[in] scs Subcarrier spacing.
158158// / \param[in] cp_cum_duration Cumulative duration of all CPs in the slot.
159+ // / \param[in] compensate_cfo Boolean flag to activate the CFO compensation.
159160// / \param[in] first_hop_symbol Index of the first OFDM symbol of the current hop, within the slot.
160161// / \param[in] last_hop_symbol Index of the last OFDM symbol of the current hop (not included), within the slot.
161162// / \param[in] hop_offset Number of OFDM symbols carrying DM-RS in the previous hop.
@@ -169,6 +170,7 @@ static std::pair<float, optional<float>> preprocess_pilots_and_cfo(span<cf_t>
169170 const bounded_bitset<MAX_NSYMB_PER_SLOT>& dmrs_mask,
170171 const subcarrier_spacing& scs,
171172 span<const float > cp_cum_duration,
173+ bool compensate_cfo,
172174 unsigned first_hop_symbol,
173175 unsigned last_hop_symbol,
174176 unsigned hop_offset,
@@ -183,6 +185,7 @@ static std::pair<float, optional<float>> preprocess_pilots_and_cfo(span<cf_t>
183185// / \param[in] scs Subcarrier spacing.
184186// / \param[in] cfo Carrier frequency offset.
185187// / \param[in] cp_cum_duration Cumulative duration of all CPs in the slot.
188+ // / \param[in] compensate_cfo Boolean flag to activate the CFO compensation.
186189// / \param[in] first_hop_symbol Index of the first OFDM symbol of the current hop, within the slot.
187190// / \param[in] last_hop_symbol Index of the last OFDM symbol of the current hop (not included), within the slot.
188191// / \param[in] hop_symbols Number of OFDM symbols containing DM-RS pilots in the current hop.
@@ -198,6 +201,7 @@ static float estimate_noise(const dmrs_symbol_list& pilots,
198201 const subcarrier_spacing& scs,
199202 optional<float > cfo,
200203 span<const float > cp_cum_duration,
204+ bool compensate_cfo,
201205 unsigned first_hop_symbol,
202206 unsigned last_hop_symbol,
203207 unsigned hop_symbols,
@@ -261,7 +265,7 @@ void port_channel_estimator_average_impl::compute(channel_estimate& es
261265 time_alignment_s /= 2 .0F ;
262266 }
263267
264- if (cfo_normalized.has_value ()) {
268+ if (compensate_cfo && cfo_normalized.has_value ()) {
265269 // Apply CFO to the estimated channel.
266270 float cfo = cfo_normalized.value ();
267271 for (unsigned i_symbol = cfg.first_symbol , last_symbol = cfg.first_symbol + cfg.nof_symbols ;
@@ -344,6 +348,7 @@ void port_channel_estimator_average_impl::compute_layer_hop(srsran::channel_esti
344348 pattern.symbols ,
345349 cfg.scs ,
346350 cp_cum_duration,
351+ compensate_cfo,
347352 first_symbol,
348353 last_symbol,
349354 hop_offset,
@@ -393,6 +398,7 @@ void port_channel_estimator_average_impl::compute_layer_hop(srsran::channel_esti
393398 cfg.scs ,
394399 cfo_hop,
395400 cp_cum_duration,
401+ compensate_cfo,
396402 first_symbol,
397403 last_symbol,
398404 nof_dmrs_symbols,
@@ -480,6 +486,7 @@ static std::pair<float, optional<float>> preprocess_pilots_and_cfo(span<cf_t>
480486 const bounded_bitset<MAX_NSYMB_PER_SLOT>& dmrs_mask,
481487 const subcarrier_spacing& scs,
482488 span<const float > cp_cum_duration,
489+ bool compensate_cfo,
483490 unsigned first_hop_symbol,
484491 unsigned last_hop_symbol,
485492 unsigned hop_offset,
@@ -510,9 +517,11 @@ static std::pair<float, optional<float>> preprocess_pilots_and_cfo(span<cf_t>
510517 std::arg (noisy_phase) / TWOPI / (i_dmrs_1 - i_dmrs_0 + cp_cum_duration[i_dmrs_1] - cp_cum_duration[i_dmrs_0]);
511518
512519 // Compensate the CFO in the first two DM-RS symbols and combine them.
513- srsvec::sc_prod (pilots_lse, std::polar (1 .0f , -TWOPI * (i_dmrs_0 + cp_cum_duration[i_dmrs_0]) * cfo), pilots_lse);
514- srsvec::sc_prod (
515- pilot_products, std::polar (1 .0f , -TWOPI * (i_dmrs_1 + cp_cum_duration[i_dmrs_1]) * cfo), pilot_products);
520+ if (compensate_cfo) {
521+ srsvec::sc_prod (pilots_lse, std::polar (1 .0f , -TWOPI * (i_dmrs_0 + cp_cum_duration[i_dmrs_0]) * cfo), pilots_lse);
522+ srsvec::sc_prod (
523+ pilot_products, std::polar (1 .0f , -TWOPI * (i_dmrs_1 + cp_cum_duration[i_dmrs_1]) * cfo), pilot_products);
524+ }
516525 srsvec::add (pilots_lse, pilot_products, pilots_lse);
517526
518527 // If there are other DM-RS symbols in the hop, match them with the corresponding transmitted symbols, compensate the
@@ -521,8 +530,10 @@ static std::pair<float, optional<float>> preprocess_pilots_and_cfo(span<cf_t>
521530 auto combine_pilots = [&, i_dmrs = 2 ](size_t i_symbol) mutable {
522531 srsvec::prod_conj (
523532 rx_pilots.get_symbol (i_dmrs, i_layer), pilots.get_symbol (hop_offset + i_dmrs, i_layer), pilot_products);
524- srsvec::sc_prod (
525- pilot_products, std::polar (1 .0f , -TWOPI * (i_symbol + cp_cum_duration[i_symbol]) * cfo), pilot_products);
533+ if (compensate_cfo) {
534+ srsvec::sc_prod (
535+ pilot_products, std::polar (1 .0f , -TWOPI * (i_symbol + cp_cum_duration[i_symbol]) * cfo), pilot_products);
536+ }
526537 srsvec::add (pilots_lse, pilot_products, pilots_lse);
527538 epre += std::real (srsvec::dot_prod (rx_pilots.get_symbol (i_dmrs, i_layer), rx_pilots.get_symbol (i_dmrs, i_layer)));
528539 ++i_dmrs;
@@ -542,6 +553,7 @@ static float estimate_noise(const dmrs_symbol_list& pilots,
542553 const subcarrier_spacing& scs,
543554 optional<float > cfo,
544555 span<const float > cp_cum_duration,
556+ bool compensate_cfo,
545557 unsigned first_hop_symbol,
546558 unsigned last_hop_symbol,
547559 unsigned hop_symbols,
@@ -558,7 +570,7 @@ static float estimate_noise(const dmrs_symbol_list& pilots,
558570 span<cf_t > predicted_obs = span<cf_t >(predicted_obs_buffer).first (estimates.size ());
559571 float noise_energy = 0 .0F ;
560572
561- if (cfo.has_value ()) {
573+ if (compensate_cfo && cfo.has_value ()) {
562574 auto noise_cfo = [&, i_dmrs = 0 ](size_t i_symbol) mutable {
563575 span<const cf_t > symbol_pilots = pilots.get_symbol (hop_offset + i_dmrs, i_layer);
564576 span<const cf_t > symbol_rx_pilots = rx_pilots.get_symbol (i_dmrs, i_layer);
0 commit comments