fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/27550 )

Change subject: osmo-bts-trx: rx_tchh_fn(): use proper meas averaging mode
......................................................................

osmo-bts-trx: rx_tchh_fn(): use proper meas averaging mode

Compared to TCH/F, TCH/H is a bit special in a way that:

* speech frames are interleaved over 4 consecutive bursts,
* while FACCH frames are interleaved over 6 consecutive bursts.

This is why in rx_tchh_fn() we allocate a buffer large enough to
store up to 6 bursts.  Let's say we have that buffer filled up
completely with all 6 bursts (from 'a' to 'f').  Now attempting
to decode them may yield either a speech frame or a FACCH frame:

  +---+---+---+---+---+---+
  | a | b | c | d | e | f |  Burst 'a' received first, 'f' last
  +---+---+---+---+---+---+
   ^^^^^^^^^^^^^^^           Speech frame (bursts 'a' .. 'd')
   ^^^^^^^^^^^^^^^^^^^^^^^   FACCH frame  (bursts 'a' .. 'f')

For FACCH we use measurement averaging mode SCHED_MEAS_AVG_M_S6N6,
so that 6 last samples are averaged - so far so good.  For speech
we use SCHED_MEAS_AVG_M_S4N4, so that 4 last samples corresponding
to bursts 'c', 'd', 'e', 'f' are averaged - this is wrong.

We actually need to average the *first* 4 samples corresponding to
bursts 'a', 'b', 'c', 'd' in the case of speech.  Let's add and use
a new averaging mode SCHED_MEAS_AVG_M_S6N4 for that.

Change-Id: Iea6f4e5471550f4c2b57aaebeac83c80e879489d
---
M include/osmo-bts/scheduler.h
M src/osmo-bts-trx/sched_lchan_tchh.c
M src/osmo-bts-trx/scheduler_trx.c
3 files changed, 5 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 8643edd..1e1a2d7 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -306,10 +306,12 @@

 /* Averaging mode for trx_sched_meas_avg() */
 enum sched_meas_avg_mode {
-       /* last 4 bursts (default for xCCH, TCH/H, PTCCH and PDTCH) */
+       /* last 4 bursts (default for xCCH, PTCCH and PDTCH) */
        SCHED_MEAS_AVG_M_S4N4,
        /* last 8 bursts (default for TCH/F and FACCH/F) */
        SCHED_MEAS_AVG_M_S8N8,
+       /* first 4 of last 6 bursts (default for TCH/H) */
+       SCHED_MEAS_AVG_M_S6N4,
        /* last 6 bursts (default for FACCH/H) */
        SCHED_MEAS_AVG_M_S6N6,
        /* first 4 of last 8 bursts */
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c 
b/src/osmo-bts-trx/sched_lchan_tchh.c
index 8264163..edbb566 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -64,7 +64,7 @@
         * Even FN ending at: 10,11,19,20,2,3
         */
        int fn_is_odd = (((bi->fn + 26 - 10) % 26) >> 2) & 1;
-       enum sched_meas_avg_mode meas_avg_mode = SCHED_MEAS_AVG_M_S4N4;
+       enum sched_meas_avg_mode meas_avg_mode = SCHED_MEAS_AVG_M_S6N4;
        struct l1sched_meas_set meas_avg;
        unsigned int fn_begin;
        unsigned int fn_tch_end;
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 78c7b4a..6ce5a9a 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -635,6 +635,7 @@
 static const uint8_t trx_sched_meas_modeset[][2] = {
        [SCHED_MEAS_AVG_M_S4N4] = { 4, 4 },
        [SCHED_MEAS_AVG_M_S8N8] = { 8, 8 },
+       [SCHED_MEAS_AVG_M_S6N4] = { 6, 4 },
        [SCHED_MEAS_AVG_M_S6N6] = { 6, 6 },
        [SCHED_MEAS_AVG_M_S8N4] = { 8, 4 },
        [SCHED_MEAS_AVG_M_S6N2] = { 6, 2 },

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/27550
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Iea6f4e5471550f4c2b57aaebeac83c80e879489d
Gerrit-Change-Number: 27550
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-MessageType: merged

Reply via email to