summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading/src/bitloading.c
diff options
context:
space:
mode:
authorJerome Jutteau2010-10-26 10:32:23 +0200
committerjutteau2010-12-27 11:30:59 +0100
commit1dba59698130fdf6001e21104d33604cae627d61 (patch)
treee39119067259f60625fdca557ad40cc66331a7e3 /cesar/ce/rx/bitloading/src/bitloading.c
parent880fa3e15b2afa73527dd60ea6906959605eea99 (diff)
cesar/ce/rx/bl: store optimization tables, closes #1934
Store optimization table to use it during tone map updates.
Diffstat (limited to 'cesar/ce/rx/bitloading/src/bitloading.c')
-rw-r--r--cesar/ce/rx/bitloading/src/bitloading.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/cesar/ce/rx/bitloading/src/bitloading.c b/cesar/ce/rx/bitloading/src/bitloading.c
index 14708ebd5e..5b2cb3457f 100644
--- a/cesar/ce/rx/bitloading/src/bitloading.c
+++ b/cesar/ce/rx/bitloading/src/bitloading.c
@@ -136,7 +136,7 @@ ce_rx_bl_update_tone_map_under_ber_consign (u64 ber_pt,
return ber_weighted_sum;
}
-void
+u16
ce_rx_bl_update_tone_map_at_ber_consign (u64 ber_pt,
tonemask_info_t *tonemask,
ce_rx_bitloading_t *bl,
@@ -169,7 +169,7 @@ ce_rx_bl_update_tone_map_at_ber_consign (u64 ber_pt,
* all the remaining tone that can be increase are already at the
* maximum too. So basically, we should stop the algorithm here. */
if (mod == CE_MOD_COUNT - 1)
- return;
+ return pos;
/* Remove from number of bits of the tone map the current value. */
tm->bits_per_symbol -= CE_BIT_PER_MOD[mod];
/* Remove from the summed BER of the tone map the current value. */
@@ -210,6 +210,7 @@ ce_rx_bl_update_tone_map_at_ber_consign (u64 ber_pt,
if (mod == 0)
(*tone_en)--;
}
+ return pos;
}
tonemap_t *
@@ -228,7 +229,9 @@ ce_rx_bl_compute_tone_map_iterative (const u64 bpt_initial[PHY_FEC_RATE_NB],
/* Dynamic table size is not possible (because of compiler bug on stack).
* For the moment being we use a define (even if table is too big). */
dbg_assert (tonemask && tonemask->carrier_nb <= PHY_CARRIER_NB);
- ce_rx_bl_ber_impact_t opti[PHY_CARRIER_NB];
+ ce_rx_bl_ber_impact_t opti[PHY_FEC_RATE_NB][PHY_CARRIER_NB];
+ u16 opti_cursor[PHY_FEC_RATE_NB];
+ u16 i;
u32 sort[PHY_FEC_RATE_NB];
tonemap_t *tm[PHY_FEC_RATE_NB];
uint tone_en;
@@ -256,15 +259,21 @@ ce_rx_bl_compute_tone_map_iterative (const u64 bpt_initial[PHY_FEC_RATE_NB],
ce_rx_bl_update_tone_map_under_ber_consign (ber_cur, tonemask,
fec_rate, bl,
tm[fec_rate],
- opti, &tone_en);
+ opti[fec_rate],
+ &tone_en);
/* Sort optimization table. */
- ce_rx_bl_sort_optimization (opti, tonemask->carrier_nb);
+ ce_rx_bl_sort_optimization (opti[fec_rate], tonemask->carrier_nb);
/* Optimize tone map to reach BER consign. */
- ce_rx_bl_update_tone_map_at_ber_consign
- (ber_cur, tonemask, bl, tm[fec_rate], opti, &ber_weighted_sum,
- &tone_en);
+ opti_cursor[fec_rate] =
+ ce_rx_bl_update_tone_map_at_ber_consign (ber_cur,
+ tonemask,
+ bl,
+ tm[fec_rate],
+ opti[fec_rate],
+ &ber_weighted_sum,
+ &tone_en);
/* Store previous BER consign. */
ber_prev[fec_rate] = ber_cur;
/* We may have zero bit per symbol (when NSR is high for example).
@@ -332,6 +341,11 @@ ce_rx_bl_compute_tone_map_iterative (const u64 bpt_initial[PHY_FEC_RATE_NB],
tm[good]->ber_target_reached = ber_reached[good];
/* Configure tone map for usage. */
tm[good]->cpf = true;
+ /* Copy the optimization table corresponding to the best tone map. */
+ for (i = 0; i < PHY_CARRIER_NB; i++)
+ bl->opti_table[i] = opti[good][i].carrier_index;
+ /* Store the cursor of the optimization table for this tone map. */
+ tm[good]->opti_table_cursor = opti_cursor[good];
/* Return best tone map. */
return tm[good];
}