Skip to content

Commit 88425e8

Browse files
xavierarteagacodebot
authored andcommitted
phy: review channel equalizer
1 parent 8e2001a commit 88425e8

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

include/srsran/phy/support/re_buffer.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ class static_re_buffer : public re_buffer_reader<T>, public re_buffer_writer<T>
278278
/// \ref set_slice method.
279279
///
280280
/// \tparam T Resource element type.
281-
template <unsigned MaxNofSlices, typename T = cf_t>
281+
template <typename T, unsigned MaxNofSlices>
282282
class modular_re_buffer_reader : public re_buffer_reader<T>
283283
{
284284
public:
@@ -350,8 +350,9 @@ class modular_re_buffer_reader : public re_buffer_reader<T>
350350
/// In this implementation, each slice is a view to an external block of contiguous REs that must be loaded with the
351351
/// \ref set_slice method.
352352
///
353-
/// \tparam T Resource element type.
354-
template <unsigned MaxNofSlices, typename T = cf_t>
353+
/// \tparam T Resource element type.
354+
/// \tparam MaxNofSlices Maximum number of slices.
355+
template <typename T, unsigned MaxNofSlices>
355356
class modular_re_buffer_writer : public re_buffer_writer<T>
356357
{
357358
public:

lib/phy/support/resource_grid_mapper_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ void resource_grid_mapper_impl::map(symbol_buffer& buffer,
272272
{
273273
// Temporary intermediate buffer for storing precoded symbols.
274274
static_re_buffer<precoding_constants::MAX_NOF_PORTS, NRE * MAX_RB, cbf16_t> precoding_buffer_copy;
275-
modular_re_buffer_writer<MAX_PORTS, cbf16_t> precoding_buffer_view;
275+
modular_re_buffer_writer<cbf16_t, MAX_PORTS> precoding_buffer_view;
276276

277277
// The number of layers is equal to the number of ports.
278278
unsigned nof_layers = precoding.get_nof_layers();

lib/phy/upper/channel_processors/pusch/pusch_demodulator_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class pusch_demodulator_impl : public pusch_demodulator
214214
/// Copy buffer used to transfer channel modulation symbols from the resource grid to the equalizer.
215215
dynamic_re_buffer<cbf16_t> ch_re_copy;
216216
/// View buffer used to transfer channel modulation symbols from the resource grid to the equalizer.
217-
modular_re_buffer_reader<MAX_PORTS, cbf16_t> ch_re_view;
217+
modular_re_buffer_reader<cbf16_t, MAX_PORTS> ch_re_view;
218218
/// Buffer used to store channel modulation resource elements at the equalizer output.
219219
std::vector<cf_t> temp_eq_re;
220220
/// Buffer used to transfer symbol noise variances at the equalizer output.

lib/phy/upper/equalization/channel_equalizer_generic_impl.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,15 @@ void equalize_zf_single_tx_layer<1>(unsigned /**/,
119119
}
120120

121121
template <unsigned NOF_PORTS>
122-
void equalize_zf_single_tx_layer_reduction(unsigned nof_ports,
123-
span<cf_t> eq_symbols,
122+
void equalize_zf_single_tx_layer_reduction(span<cf_t> eq_symbols,
124123
span<float> eq_noise_vars,
125124
const re_buffer_reader<cbf16_t>& ch_symbols,
126125
const channel_equalizer::ch_est_list& ch_estimates,
127126
span<const float> noise_var,
128127
float tx_scaling)
129128
{
129+
unsigned nof_ports = noise_var.size();
130+
130131
// Function for checking if a noise variance is valid.
131132
const auto func_valid_noise_var = [](float nvar) {
132133
return (nvar > 0) && (nvar < std::numeric_limits<float>::infinity());
@@ -146,7 +147,7 @@ void equalize_zf_single_tx_layer_reduction(unsigned
146147
if (nof_valid_noise_var != nof_ports) {
147148
// Reduce ports.
148149
static_vector<float, NOF_PORTS> reduced_noise_var(nof_valid_noise_var);
149-
modular_re_buffer_reader<NOF_PORTS, cbf16_t> reduced_ch_symbols(nof_ports, ch_symbols.get_nof_re());
150+
modular_re_buffer_reader<cbf16_t, NOF_PORTS> reduced_ch_symbols(nof_ports, ch_symbols.get_nof_re());
150151
modular_ch_est_list<NOF_PORTS> reduced_ch_estimates(nof_ports, ch_symbols.get_nof_re());
151152
for (unsigned i_port = 0, i_reduced_port = 0; i_port != nof_ports; ++i_port) {
152153
if (func_valid_noise_var(noise_var[i_port])) {
@@ -231,7 +232,7 @@ void channel_equalizer_generic_impl::equalize(span<cf_t> e
231232
// Single transmit layer and any number of receive ports.
232233
if (nof_tx_layers == 1) {
233234
equalize_zf_single_tx_layer_reduction<MAX_PORTS>(
234-
nof_rx_ports, eq_symbols, eq_noise_vars, ch_symbols, ch_estimates, noise_var_estimates, tx_scaling);
235+
eq_symbols, eq_noise_vars, ch_symbols, ch_estimates, noise_var_estimates, tx_scaling);
235236
return;
236237
}
237238

0 commit comments

Comments
 (0)