summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading/src/bitloading.c
diff options
context:
space:
mode:
authorJalil Chemseddine2012-10-12 11:14:47 +0200
committerJalil Chemseddine2012-11-07 11:10:06 +0100
commite42453a29c6cb63b21fff75e495591b0f46c3454 (patch)
tree268e48c32041d2e2cf04159f6d76683d86b407d3 /cesar/ce/rx/bitloading/src/bitloading.c
parent2e67e3fdff60d15a64e727de8fac3d0473261d92 (diff)
cesar/ce/rx/bl: remove tonemap update code, closes #3310
Diffstat (limited to 'cesar/ce/rx/bitloading/src/bitloading.c')
-rw-r--r--cesar/ce/rx/bitloading/src/bitloading.c185
1 files changed, 0 insertions, 185 deletions
diff --git a/cesar/ce/rx/bitloading/src/bitloading.c b/cesar/ce/rx/bitloading/src/bitloading.c
index 0bed98e35a..b848d1cd34 100644
--- a/cesar/ce/rx/bitloading/src/bitloading.c
+++ b/cesar/ce/rx/bitloading/src/bitloading.c
@@ -411,188 +411,3 @@ ce_rx_bl_compute_tone_map_iterative (const u64 bpt_initial[PHY_FEC_RATE_NB],
/* Return best tone map. */
return tm[good];
}
-
-ce_rx_bl_tone_map_update_actions_t
-ce_rx_bl_tone_map_update_action (u64 ber_target,
- u64 means[CE_RX_BL_BER_SLIDING_MEAN_NB])
-{
- /* Default action. */
- ce_rx_bl_tone_map_update_actions_t action = CE_RX_BL_TONE_MAP_UPDATE_NONE;
-
- /* Fast mean above target ? */
- if (means[CE_RX_BL_BER_SLIDING_MEAN_FAST] > ber_target)
- action = CE_RX_BL_TONE_MAP_UPDATE_MINUS;
- else
- {
- /* Computing middle zone where no action is performed. */
- u64 middle_limit = ber_target
- - (u64) (ber_target / CE_RX_BL_TONE_MAP_UPDATE_MIDDLE_PERCENTAGE);
- /* Are we located inside this middle zone ? */
- if (means[CE_RX_BL_BER_SLIDING_MEAN_FAST] < middle_limit
- && means[CE_RX_BL_BER_SLIDING_MEAN_SLOW] < middle_limit)
- action = CE_RX_BL_TONE_MAP_UPDATE_PLUS;
- }
- return action;
-}
-
-u16
-ce_rx_bl_tone_map_update_count (ce_rx_bl_tone_map_update_actions_t action,
- u64 ber_target,
- u64 means[CE_RX_BL_BER_SLIDING_MEAN_NB])
-{
- dbg_assert (action < CE_RX_BL_TONE_MAP_UPDATE_NB);
- dbg_assert (ber_target != 0);
-
- u64 nb = 0;
-
- if (action == CE_RX_BL_TONE_MAP_UPDATE_MINUS)
- {
- /* Number of carriers we may shift in the optimization table. */
- nb = ROUND_DIV (CE_RX_BL_TONE_MAP_UPDATE_MINUS_COEFF *
- MAX (means[CE_RX_BL_BER_SLIDING_MEAN_FAST],
- means[CE_RX_BL_BER_SLIDING_MEAN_SLOW]),
- ber_target)
- - CE_RX_BL_TONE_MAP_UPDATE_MINUS_COEFF + 1;
- }
- else if (action == CE_RX_BL_TONE_MAP_UPDATE_PLUS)
- {
- /* Ber target -X% where X is
- * CE_RX_BL_TONE_MAP_UPDATE_MIDDLE_PERCENTAGE. */
- u64 middle_limit = ber_target
- - (u64) (ber_target / CE_RX_BL_TONE_MAP_UPDATE_MIDDLE_PERCENTAGE);
-
- /* Number of carriers we may shift in the optimization table. */
- nb = -1 * ROUND_DIV (CE_RX_BL_TONE_MAP_UPDATE_PLUS_COEFF *
- MAX (means[CE_RX_BL_BER_SLIDING_MEAN_FAST],
- means[CE_RX_BL_BER_SLIDING_MEAN_SLOW]),
- middle_limit)
- + CE_RX_BL_TONE_MAP_UPDATE_PLUS_COEFF + 1;
- }
- else
- return 0;
-
- /* Return value must be <= PHY_CARRIER_NB (max shift value). */
- return (nb > PHY_CARRIER_NB ? PHY_CARRIER_NB : nb);
-}
-
-ce_rx_bl_tone_map_update_status_t
-ce_rx_bl_tone_map_update_compute_new_tonemap (ce_rx_bitloading_t *bl,
- u64 ber_target,
- tonemap_t *tm,
- uint tone_en,
- tonemap_t **new_tonemap)
-{
- /* New generated tone map. */
- tonemap_t *new_tm = NULL;
- uint new_opti_cursor = 0;
- /* Number of tones to shift in the optimization table. */
- u16 shift_count = 0;
- /* Temporary variable of optimization table manipulation. */
- u16 *tmp;
- uint cpt = 0;
- ce_rx_bl_tone_map_update_actions_t action = CE_RX_BL_TONE_MAP_UPDATE_NONE;
- u32 *tone_word = NULL;
- s8 mod = -1;
- /* Output. */
- ce_rx_bl_tone_map_update_status_t out = CE_RX_BL_TONE_MAP_UPDATE_STATUS_OK;
-
- /* Check parameters. */
- dbg_assert (bl);
- dbg_assert (tm);
- dbg_assert (new_tonemap);
-
- /* Compute action and shift count. */
- action = ce_rx_bl_tone_map_update_action (ber_target,
- (u64 *) bl->ber_sliding_mean);
- shift_count = ce_rx_bl_tone_map_update_count (action,
- ber_target,
- (u64 *) bl->ber_sliding_mean);
-
- /* Check optimization table limits and action result. */
- switch (action)
- {
- case CE_RX_BL_TONE_MAP_UPDATE_NONE:
- return CE_RX_BL_TONE_MAP_UPDATE_STATUS_NOTHING;
- break;
- case CE_RX_BL_TONE_MAP_UPDATE_MINUS:
- if (bl->opti_table_cursor == 0)
- return CE_RX_BL_TONE_MAP_UPDATE_STATUS_OUT_OF_RANGE_MIN;
- if ((int) (bl->opti_table_cursor - shift_count) < 0)
- {
- out = CE_RX_BL_TONE_MAP_UPDATE_STATUS_OUT_OF_RANGE_MIN;
- new_opti_cursor = 0;
- }
- else
- new_opti_cursor = bl->opti_table_cursor - shift_count;
- break;
- case CE_RX_BL_TONE_MAP_UPDATE_PLUS:
- if (bl->opti_table_cursor >= tone_en)
- return CE_RX_BL_TONE_MAP_UPDATE_STATUS_OUT_OF_RANGE_MAX;
- if (bl->opti_table_cursor + shift_count >= tone_en)
- {
- out = CE_RX_BL_TONE_MAP_UPDATE_STATUS_OUT_OF_RANGE_MAX;
- new_opti_cursor = tone_en - 1;
- }
- else
- new_opti_cursor = bl->opti_table_cursor + shift_count;
- break;
- default:
- dbg_assert (action < CE_RX_BL_TONE_MAP_UPDATE_NB);
- break;
- }
-
- /* Create a new tone map. */
- new_tm = tonemap_alloc ();
- dbg_assert (new_tm);
-
- /* Copy current tone map to new tone map. */
- tonemap_copy (new_tm, tm);
-
- /*
- * For each adjusted tones from the optimization table,
- * update new tone map.
- */
- if (action == CE_RX_BL_TONE_MAP_UPDATE_MINUS)
- for (cpt = new_opti_cursor;
- cpt < bl->opti_table_cursor;
- cpt++)
- {
- tone_word = NULL;
- tmp = (u16 *) blk_table_get (bl->opti_table, cpt);
- mod = tonemap_get_tone (new_tm, *tmp, &tone_word);
- dbg_assert (tone_word);
-
- /* Decrease tone. */
- dbg_check (tonemap_decrease_tone (new_tm, *tmp));
-
- /* Update bits per symbols. */
- new_tm->bits_per_symbol -= CE_BIT_PER_MOD[mod];
- new_tm->bits_per_symbol += CE_BIT_PER_MOD[mod - 1];
- }
- if (action == CE_RX_BL_TONE_MAP_UPDATE_PLUS)
- /* We must start to boost at the cursor position and stop before new
- * cursor position. */
- for (cpt = bl->opti_table_cursor;
- cpt != new_opti_cursor;
- cpt++)
- {
- tone_word = NULL;
- tmp = (u16 *) blk_table_get (bl->opti_table, cpt);
- mod = tonemap_get_tone (new_tm, *tmp, &tone_word);
- dbg_assert (tone_word);
- /* Increase tone. */
- if (!tonemap_increase_tone (new_tm, *tmp))
- {
- out = CE_RX_BL_TONE_MAP_UPDATE_STATUS_MAX_CARRIAGE;
- break;
- }
-
- /* Update bits per symbols. */
- new_tm->bits_per_symbol -= CE_BIT_PER_MOD[mod];
- new_tm->bits_per_symbol += CE_BIT_PER_MOD[mod + 1];
- }
-
- *new_tonemap = new_tm;
- bl->opti_table_cursor = new_opti_cursor;
- return out;
-}