summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading/src/bitloading.c
diff options
context:
space:
mode:
authorJérémy Dufour2011-12-06 16:28:05 +0100
committerJérémy Dufour2012-09-12 16:20:42 +0200
commit5e9395298847310fbe0a806140645a1c8f9f6dcc (patch)
treef9c2bdb159c64b5836514db3c29eca335cdad1c4 /cesar/ce/rx/bitloading/src/bitloading.c
parent5a6518e311d3d61a220845c70f684f5eb4cdd03b (diff)
cesar/ce/rx/bl: add a stat when BL can not optimize tone map, refs #2376
Diffstat (limited to 'cesar/ce/rx/bitloading/src/bitloading.c')
-rw-r--r--cesar/ce/rx/bitloading/src/bitloading.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/cesar/ce/rx/bitloading/src/bitloading.c b/cesar/ce/rx/bitloading/src/bitloading.c
index 5000df9d13..0bed98e35a 100644
--- a/cesar/ce/rx/bitloading/src/bitloading.c
+++ b/cesar/ce/rx/bitloading/src/bitloading.c
@@ -173,7 +173,8 @@ ce_rx_bl_update_tone_map_at_ber_consign (u64 ber_pt,
tonemap_t *tm,
ce_rx_bl_ber_impact_t *opti,
u64 *ber_weighted_sum_q49,
- uint *tone_en)
+ uint *tone_en,
+ bool *opti_failed)
{
/* Check parameters. */
dbg_assert (ber_pt < CE_RX_BL_BER_DEFAULT_OVER);
@@ -182,12 +183,14 @@ ce_rx_bl_update_tone_map_at_ber_consign (u64 ber_pt,
dbg_assert (bl);
dbg_assert (opti);
dbg_assert (tone_en);
+ dbg_assert (opti_failed);
dbg_assert (ber_weighted_sum_q49);
uint pos = 0;
u32 *tone_word;
s8 mod = -1;
u64 ber_pt_q49 = fixed_round_64 (ber_pt, CE_RX_BL_BER_WEIGHTED_SUM_SHIFT);
+ *opti_failed = false;
/* Optimize tone map until we reach the BER consign or we are out of
* table. */
@@ -200,7 +203,10 @@ 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)
+ {
+ *opti_failed = true;
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. */
@@ -279,6 +285,7 @@ ce_rx_bl_compute_tone_map_iterative (const u64 bpt_initial[PHY_FEC_RATE_NB],
tonemap_t *tm[PHY_FEC_RATE_NB];
uint tone_en;
s64 tmp_ber;
+ bool opti_failed[PHY_FEC_RATE_NB] = { false, false };
phy_fecrate_t fec_rate;
/* For each FEC rate. */
@@ -313,13 +320,9 @@ ce_rx_bl_compute_tone_map_iterative (const u64 bpt_initial[PHY_FEC_RATE_NB],
/* Optimize tone map to reach BER consign. */
opti_cursor[fec_rate] =
- ce_rx_bl_update_tone_map_at_ber_consign (ber_cur,
- reducedtm,
- bl,
- tm[fec_rate],
- opti[fec_rate],
- &ber_weighted_sum_q49,
- &tone_en);
+ ce_rx_bl_update_tone_map_at_ber_consign
+ (ber_cur, reducedtm, bl, tm[fec_rate], opti[fec_rate],
+ &ber_weighted_sum_q49, &tone_en, &opti_failed[fec_rate]);
/* Store previous BER consign. */
ber_prev[fec_rate] = ber_cur;
/* We may have zero bit per symbol (when NSR is high for example).
@@ -401,6 +404,10 @@ ce_rx_bl_compute_tone_map_iterative (const u64 bpt_initial[PHY_FEC_RATE_NB],
}
/* Store the cursor of the optimization table for this tone map. */
bl->opti_table_cursor = opti_cursor[good];
+ /* Store optimization result and update corresponding stats. */
+ bl->optimization_failed = opti_failed[good];
+ if (bl->optimization_failed)
+ bl->stats.optimization_failure++;
/* Return best tone map. */
return tm[good];
}