From 13e0d70d0f2870c395f845ebdfadb0452c860bf9 Mon Sep 17 00:00:00 2001 From: Cyril Jourdan Date: Thu, 4 Apr 2013 15:33:02 +0200 Subject: cesar/ce/rx/bl: add a function to check tonemaps usage, refs #2588 The functions returns a bit field where each bit stands for a TMI and indicates if corresponding tonemap is currently used as default one or on at least one interval. --- cesar/ce/rx/bitloading/test/src/test_intervals.c | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'cesar/ce/rx/bitloading/test/src/test_intervals.c') diff --git a/cesar/ce/rx/bitloading/test/src/test_intervals.c b/cesar/ce/rx/bitloading/test/src/test_intervals.c index 4fb5f23f4e..d831d5b4b9 100644 --- a/cesar/ce/rx/bitloading/test/src/test_intervals.c +++ b/cesar/ce/rx/bitloading/test/src/test_intervals.c @@ -65,6 +65,58 @@ test_suite_ce_rx_bl_intervals_init (test_t t) } test_end; } +void +test_suite_ce_rx_bl_intervals_get_tmi_used_list (test_t t) +{ + uint old_fsm_nb = mac_interval_fsm_count_; + uint old_repetition_nb = mac_interval_repetition_count_; + + /* This tests only works if the number of intervals is known, so I prefer + * to manage this locally. */ + mac_interval_fsm_count_ = 6; + mac_interval_repetition_count_ = 4; + + sta_t sta; + + sta.rx_tonemaps = tonemaps_alloc (); + sta.intervals = ce_rx_bl_intervals_alloc (TONEMAP_INDEX_NEGOTIATED_FIRST); + + test_case_begin (t, "Get tonemaps used list"); + test_begin (t, "Including default one.") + { + sta.rx_tonemaps->default_tmi = TONEMAP_INDEX_INITIAL_START; + test_fail_if (ce_rx_bl_intervals_get_tmi_used_list (&sta, true) + != 0x00000010); + sta.rx_tonemaps->default_tmi = 0; + test_fail_if (ce_rx_bl_intervals_get_tmi_used_list (&sta, true) + != 0x00000011); + sta.rx_tonemaps->default_tmi = 18; + test_fail_if (ce_rx_bl_intervals_get_tmi_used_list (&sta, true) + != 0x00040010); + sta.intervals->tmi[0] = 5; + sta.intervals->tmi[2] = 31; + test_fail_if (ce_rx_bl_intervals_get_tmi_used_list (&sta, true) + != 0x80040030); + sta.intervals->tmi[2] = 29; + test_fail_if (ce_rx_bl_intervals_get_tmi_used_list (&sta, true) + != 0x20040030); + sta.intervals->tmi[4] = TONEMAP_INDEX_INTERVAL_UNAVAILABLE; + test_fail_if (ce_rx_bl_intervals_get_tmi_used_list (&sta, true) + != 0x20040030); + } test_end; + test_begin (t, "Excluding default one.") + { + test_fail_if (ce_rx_bl_intervals_get_tmi_used_list (&sta, false) + != 0x20000030); + } test_end; + + /* Clean. */ + tonemaps_release (sta.rx_tonemaps); + ce_rx_bl_intervals_free (sta.intervals); + mac_interval_fsm_count_ = old_fsm_nb; + mac_interval_repetition_count_ = old_repetition_nb; +} + /** * Time transformation from pbproc information to ATU. */ @@ -504,6 +556,8 @@ test_suite_ce_rx_bl_intervals (test_t t) { /* Intervals init and uninit. */ test_suite_ce_rx_bl_intervals_init (t); + /* Get used tonemap list. */ + test_suite_ce_rx_bl_intervals_get_tmi_used_list (t); /* Time transformation from pbproc information to ATU. */ test_suite_ce_rx_bl_intervals_measure_to_date (t); /* Measure to interval computation. */ -- cgit v1.2.3