summaryrefslogtreecommitdiff
path: root/cesar/ce
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/ce')
-rw-r--r--cesar/ce/rx/bitloading/src/transition.c17
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_fsm.c69
2 files changed, 85 insertions, 1 deletions
diff --git a/cesar/ce/rx/bitloading/src/transition.c b/cesar/ce/rx/bitloading/src/transition.c
index a0cf562dd8..7aac04b6b4 100644
--- a/cesar/ce/rx/bitloading/src/transition.c
+++ b/cesar/ce/rx/bitloading/src/transition.c
@@ -239,12 +239,27 @@ ce_rx_bl_fsm__TRACKING__data (ce_rx_t *ce_rx,
ce_rx_measure_mbox_t *measure = data.measure;
dbg_assert (measure);
+ dbg_assert (sta->rx_tonemaps);
sta->rx_tonemaps->sound_frame_counter = TONEMAP_SOUND_FRAME_COUNTER;
+
+ /* Increase CE statistics. */
+ /* If measure is a negotiated tone map. */
+ if (TONEMAP_INDEX_IS_NEGOTIATED (measure->rx_params.tmi_av))
+ {
+ /* Get tone map. */
+ tonemap_t *tm = sta->rx_tonemaps->tm[measure->rx_params.tmi_av];
+ if (tm)
+ {
+ /* Update statistics. */
+ tm->nb_frame++;
+ tm->nb_pb += measure->total_pb_count;
+ }
+ }
+
/* Measure should only be processed if the TMI used is the one we are
* expected.
* FIXME: this will not work with intervals. */
- dbg_assert (sta->rx_tonemaps);
if (sta->rx_tonemaps->default_tmi == measure->rx_params.tmi_av)
{
/* Update BER sliding means. */
diff --git a/cesar/ce/rx/bitloading/test/src/test_fsm.c b/cesar/ce/rx/bitloading/test/src/test_fsm.c
index c9e90fdacd..03fa9c278c 100644
--- a/cesar/ce/rx/bitloading/test/src/test_fsm.c
+++ b/cesar/ce/rx/bitloading/test/src/test_fsm.c
@@ -74,6 +74,7 @@ test_ce_rx_bl_fsm_base (test_t t)
sta_t sta;
tonemaps_t rx_tms, tx_tms;
uint i;
+ uint stats_pb = 0, stats_frame = 0;
for (i = 0; i < TONEMAP_INDEX_NB; i++)
{
rx_tms.tm[i] = NULL;
@@ -86,6 +87,8 @@ test_ce_rx_bl_fsm_base (test_t t)
rx_tms.default_tmi = tmi_av;
tm.bits_per_symbol = 1;
tm.ber_target_reached = 1;
+ /* Reset statistics. */
+ tm.nb_pb = tm.nb_frame = 0;
ce_rx_bitloading_init (&sta.ce_rx_bt);
for (i = 0; i < COUNT (sta.ce_rx_bt.next_date_min_for_restart_rtc_date); i++)
sta.ce_rx_bt.next_date_min_for_restart_rtc_date[i] = 0;
@@ -107,6 +110,9 @@ test_ce_rx_bl_fsm_base (test_t t)
SCENARIO_END,
};
scenario_run (t, fsm_base, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
} test_end;
test_case_begin (t, "many sounds, one sound complete, bit loading "
@@ -157,6 +163,9 @@ test_ce_rx_bl_fsm_base (test_t t)
SCENARIO_END,
};
scenario_run (t, fsm_base, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
} test_end;
test_case_begin (t, "one sound complete, bit loading initial");
@@ -182,6 +191,9 @@ test_ce_rx_bl_fsm_base (test_t t)
SCENARIO_END,
};
scenario_run (t, fsm_base, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
} test_end;
test_case_begin (t, "many sound complete, one bit loading");
@@ -204,6 +216,9 @@ test_ce_rx_bl_fsm_base (test_t t)
SCENARIO_END,
};
scenario_run (t, fsm_base, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
} test_end;
@@ -232,6 +247,9 @@ test_ce_rx_bl_fsm_base (test_t t)
SCENARIO_END,
};
scenario_run (t, fsm_base, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
} test_end;
@@ -258,6 +276,8 @@ test_ce_rx_bl_fsm_base (test_t t)
{
measure.total_pb_count
= 1 + lib_rnd_uniform (&rnd, ((u8) -1));
+ stats_pb += measure.total_pb_count;
+ stats_frame++;
measure.false_pb_count
= lib_rnd_uniform
(&rnd, measure.total_pb_count / ce_rx_bl_pb_total_factor_);
@@ -272,6 +292,9 @@ test_ce_rx_bl_fsm_base (test_t t)
}
scenario_test[pos++] = scenario_end;
scenario_run (t, scenario_test, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
} test_end;
@@ -290,6 +313,8 @@ test_ce_rx_bl_fsm_base (test_t t)
+ lib_rnd_uniform
(&rnd, ((u8) (-1) - ce_rx_bl_min_pb_per_frame_));
dbg_assert (measure.total_pb_count);
+ stats_pb += measure.total_pb_count;
+ stats_frame++;
if (i % (ce_rx_bl_min_frame_with_high_pb_err_rate_ - 1) == 0)
measure.false_pb_count = 0;
else
@@ -306,6 +331,9 @@ test_ce_rx_bl_fsm_base (test_t t)
}
scenario_test[pos++] = scenario_end;
scenario_run (t, scenario_test, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
} test_end;
@@ -321,6 +349,8 @@ test_ce_rx_bl_fsm_base (test_t t)
{
measure.total_pb_count = 1;
measure.false_pb_count = lib_rnd_uniform (&rnd, (u8) -1);
+ stats_pb += measure.total_pb_count;
+ stats_frame++;
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_ACTION (TRACKING__data,
.sta = &sta,
@@ -333,6 +363,9 @@ test_ce_rx_bl_fsm_base (test_t t)
}
scenario_test[pos++] = scenario_end;
scenario_run (t, scenario_test, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
} test_end;
@@ -361,6 +394,9 @@ test_ce_rx_bl_fsm_base (test_t t)
}
scenario_test[pos++] = scenario_end;
scenario_run (t, scenario_test, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
} test_end;
@@ -405,8 +441,13 @@ test_ce_rx_bl_fsm_base (test_t t)
};
for (i = 0; i < COUNT (sub_sc_ce_restart); i++)
scenario_test[i + pos] = sub_sc_ce_restart[i];
+ stats_pb += measure.total_pb_count * (limit + 1);
+ stats_frame += limit + 1;
scenario_run (t, scenario_test, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
} test_end;
@@ -435,8 +476,13 @@ test_ce_rx_bl_fsm_base (test_t t)
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
}
+ stats_pb += measure.total_pb_count * limit;
+ stats_frame += limit;
scenario_run (t, scenario_test, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
sta.ce_rx_bt.next_date_min_for_restart_rtc_date[0] = 0;
@@ -471,8 +517,13 @@ test_ce_rx_bl_fsm_base (test_t t)
.tms = sta.tx_tonemaps);
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_END;
+ stats_pb += measure.total_pb_count;
+ stats_frame++;
scenario_run (t, scenario_test, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
} test_end;
@@ -500,8 +551,13 @@ test_ce_rx_bl_fsm_base (test_t t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_END;
+ stats_pb += measure.total_pb_count;
+ stats_frame++;
scenario_run (t, scenario_test, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
sta.ce_rx_bt.next_date_min_for_restart_rtc_date[1] = 0;
@@ -539,6 +595,9 @@ test_ce_rx_bl_fsm_base (test_t t)
SCENARIO_END;
scenario_run (t, scenario_test, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
rx_tms.default_tmi = tmi_av;
@@ -566,8 +625,13 @@ test_ce_rx_bl_fsm_base (test_t t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_END;
+ stats_pb += measure.total_pb_count;
+ stats_frame++;
scenario_run (t, scenario_test, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
} test_end;
@@ -596,8 +660,13 @@ test_ce_rx_bl_fsm_base (test_t t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_END;
+ stats_pb += measure.total_pb_count;
+ stats_frame++;
scenario_run (t, scenario_test, &globals);
+ /* Check statistics. */
+ test_fail_if (tm.nb_pb != stats_pb);
+ test_fail_if (tm.nb_frame != stats_frame);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
} test_end;