summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading/src/pber.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/ce/rx/bitloading/src/pber.c')
-rw-r--r--cesar/ce/rx/bitloading/src/pber.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/cesar/ce/rx/bitloading/src/pber.c b/cesar/ce/rx/bitloading/src/pber.c
index ce1e1b56c8..85c0987b48 100644
--- a/cesar/ce/rx/bitloading/src/pber.c
+++ b/cesar/ce/rx/bitloading/src/pber.c
@@ -14,6 +14,7 @@
#include "mac/common/defs.h"
#include "ce/rx/bitloading/pber.h"
+#include "ce/rx/bitloading/inc/pber.h"
/**
* Maximum value of the PB error rate quantified.
@@ -28,8 +29,8 @@
ce_rx_bl_pber_conf_t ce_rx_bl_pber_conf
= {
- .mean_coef = { 2040, 2048 },
- .mean_init = CE_RX_BL_PBER_MAX + 1,
+ .mean_coef = 6912,
+ .mean_init = 655,
};
void
@@ -41,39 +42,27 @@ ce_rx_bl_pber_reset (ce_rx_bl_pber_t *ctx)
ctx->mean_q16 = ce_rx_bl_pber_conf.mean_init;
}
-u32
-ce_rx_bl_pber_compute (uint pb_total, uint pb_crc_false)
-{
- /* Check parameters. */
- dbg_assert (pb_total <= MAC_MAX_PB_PER_MPDU || !pb_total);
- dbg_assert (pb_crc_false <= pb_total);
-
- return pb_crc_false * (1 << 16) / pb_total;
-}
-
void
-ce_rx_bl_pber_update (ce_rx_bl_pber_t *ctx, u32 pber_q16)
+ce_rx_bl_pber_update (ce_rx_bl_pber_t *ctx, uint pb_total, uint pb_crc_false)
{
/* Check parameters. */
dbg_assert (ctx);
- dbg_assert (pber_q16 <= CE_RX_BL_PBER_MAX);
+ dbg_assert (pb_total);
+
+ /* Quantify PBER mean of current frame by PB. */
+ uint pb_mean_q16 = pb_crc_false * CE_RX_BL_PBER_QUANT;
/* If set to impossible value, this is the first frame. */
if (ctx->mean_q16 > CE_RX_BL_PBER_MAX)
- ctx->mean_q16 = pber_q16;
+ ctx->mean_q16 = pb_mean_q16;
else
{
- dbg_assert (ce_rx_bl_pber_conf.mean_coef[CE_RX_BL_PBER_COEF_D]
- > ce_rx_bl_pber_conf.mean_coef[CE_RX_BL_PBER_COEF_C]);
- dbg_assert (ce_rx_bl_pber_conf.mean_coef[CE_RX_BL_PBER_COEF_D]);
-
- uint prev = ce_rx_bl_pber_conf.mean_coef[CE_RX_BL_PBER_COEF_C];
- uint new
- = ce_rx_bl_pber_conf.mean_coef[CE_RX_BL_PBER_COEF_D]
- - ce_rx_bl_pber_conf.mean_coef[CE_RX_BL_PBER_COEF_C];
+ dbg_assert (pb_crc_false <= pb_total);
+ dbg_assert (pb_total < CE_RX_BL_PBER_MAX_PB_PER_FRAME);
+ dbg_assert (pb_total < ce_rx_bl_pber_conf.mean_coef);
ctx->mean_q16
- = ((prev * ctx->mean_q16) + (new * pber_q16))
- / ce_rx_bl_pber_conf.mean_coef[CE_RX_BL_PBER_COEF_D];
+ = (ctx->mean_q16 * (ce_rx_bl_pber_conf.mean_coef - pb_total)
+ + pb_mean_q16)
+ / ce_rx_bl_pber_conf.mean_coef;
}
-
}