fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/35754?usp=email )

Change subject: coding: fix artificial bit errors for PDTCH CS2 and CS3
......................................................................

coding: fix artificial bit errors for PDTCH CS2 and CS3

GPRS coding schemes CS2 and CS3 (defined in 3GPP TS 45.003 sections
5.1.2 and 5.1.3, respectively) employ so-called puncturing, which
can be described as intentional removal of coded bits.  The goal
of puncturing is to reduce the number of coded bits, so that they
fit into 4 bursts.  The receiving side recovers punctured bits,
as if they were received corrupted.

The puncturing is also used for other channel types like TCH/F9.6,
TCH/F14.4, TCH/AFS and TCH/AHS, but only for CS2 and CS3 we're
doing puncturing/depuncturing *manually*.  This explains why
we're seeing artificial bit errors only for CS2 and CS3.

gsm0503_pdtch_decode() should not be reporting punctured bits as
bit errors, fix this by using osmo_conv_decode_ber_punctured().

Change-Id: I024276d167e769396187998d881f8e7626461249
Related: OS#6342, OS#6200
---
M src/coding/gsm0503_coding.c
M tests/coding/coding_test.ok
2 files changed, 36 insertions(+), 8 deletions(-)

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




diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c
index 9272fdb..69a7ad4 100644
--- a/src/coding/gsm0503_coding.c
+++ b/src/coding/gsm0503_coding.c
@@ -1066,8 +1066,10 @@
                                cB[i] = 0;
                }

-               osmo_conv_decode_ber(&gsm0503_cs2_np, cB,
-                       conv, n_errors, n_bits_total);
+               osmo_conv_decode_ber_punctured(&gsm0503_cs2_np, cB, conv,
+                                              n_errors, n_bits_total,
+                                              gsm0503_puncture_cs2);
+

                /* 5.1.2.2 a) the three USF bits d(0),d(1),d(2) are precoded 
into six bits */
                for (i = 0; i < 8; i++) {
@@ -1102,8 +1104,9 @@
                                cB[i] = 0;
                }

-               osmo_conv_decode_ber(&gsm0503_cs3_np, cB,
-                       conv, n_errors, n_bits_total);
+               osmo_conv_decode_ber_punctured(&gsm0503_cs3_np, cB, conv,
+                                              n_errors, n_bits_total,
+                                              gsm0503_puncture_cs3);

                /* 5.1.3.2 a) the three USF bits d(0),d(1),d(2) are precoded 
into six bits */
                for (i = 0; i < 8; i++) {
diff --git a/tests/coding/coding_test.ok b/tests/coding/coding_test.ok
index 1fc2f1d..ad8a98d 100644
--- a/tests/coding/coding_test.ok
+++ b/tests/coding/coding_test.ok
@@ -270,7 +270,7 @@
 7f 7f 7f 81 7f 81 81 81 81 81 81 81 81 81 7f 7f 7f 7f 7f 81 81 81 81 7f 81 81 
7f 7f 7f 7f 7f 81 81 7f 7f 7f 7f 7f 7f 81 7f 7f 81 81 7f 7f 7f 81 81 7f 81 7f 
7f 7f 81 81 7f  81  7f  7f 81 81 7f 81 7f 7f 81 81 7f 81 7f 7f 81 7f 7f 81 7f 
81 81 7f 7f 7f 7f 7f 81 7f 81 7f 7f 7f 7f 81 81 7f 7f 81 81 7f 7f 7f 7f 81 81 
7f 81 81 7f 81 81 7f 7f 81 81 7f 81 81
 7f 81 81 81 81 7f 81 7f 7f 7f 81 81 7f 7f 7f 7f 81 81 81 7f 7f 7f 81 7f 81 7f 
7f 7f 81 81 81 7f 81 81 81 7f 7f 7f 81 81 81 7f 81 81 7f 81 81 7f 7f 81 81 7f 
81 81 81 81 81  7f  7f  7f 7f 7f 81 81 81 81 7f 7f 7f 81 81 81 7f 7f 7f 81 81 
7f 81 7f 7f 7f 81 81 7f 81 81 81 7f 7f 81 7f 81 81 81 7f 81 81 81 81 81 7f 81 
7f 81 81 81 81 81 7f 81 81 7f 7f 81 81
 Decoded: a3 af 5f c6 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 
42 a3 af 5f c6 36 43 44 ab a3 2f
-pdtch_decode: n_errors=132 n_bits_total=588 ber=0.22
+pdtch_decode: n_errors=0 n_bits_total=588 ber=0.00

 Encoding: a3 af 5f c6 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 
42 a3 af 5f c6 36 43 44 ab a3 af 5f c6 36 43 44 03
 U-Bits:
@@ -284,7 +284,7 @@
 81 81 7f 7f 7f 81 81 7f 7f 7f 7f 7f 7f 7f 81 7f 7f 7f 7f 81 7f 81 7f 81 7f 81 
81 81 81 81 81 7f 81 7f 81 81 7f 7f 7f 81 81 81 7f 81 7f 81 81 81 81 81 7f 7f 
81 81 81 81 7f  7f  7f  81 7f 7f 7f 7f 81 81 7f 81 81 7f 7f 7f 81 81 7f 7f 81 
81 7f 81 81 7f 7f 81 81 7f 81 81 7f 7f 7f 7f 81 7f 81 7f 7f 7f 7f 7f 81 7f 7f 
7f 7f 7f 81 7f 81 81 7f 7f 81 81 81 7f
 7f 81 81 81 7f 7f 7f 7f 81 7f 81 7f 7f 7f 7f 81 7f 7f 81 7f 7f 81 7f 81 7f 7f 
81 7f 7f 7f 81 7f 7f 81 81 7f 81 7f 7f 81 81 81 7f 81 7f 7f 7f 7f 81 7f 81 81 
81 7f 7f 7f 7f  7f  81  81 81 81 81 7f 7f 81 81 7f 7f 7f 7f 7f 81 81 7f 7f 81 
7f 7f 81 81 7f 81 81 81 7f 81 7f 7f 81 81 81 81 7f 81 7f 7f 81 7f 81 7f 7f 81 
81 81 81 7f 81 7f 7f 81 81 7f 7f 81 81
 Decoded: a3 af 5f c6 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 
42 a3 af 5f c6 36 43 44 ab a3 af 5f c6 36 43 44 03
-pdtch_decode: n_errors=220 n_bits_total=676 ber=0.33
+pdtch_decode: n_errors=0 n_bits_total=676 ber=0.00

 Encoding: a3 af 5f c6 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 
42 a3 af 5f c6 36 43 44 ab a3 af 5f c6 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 
27 5d 71 7a 28
 U-Bits:
@@ -326,7 +326,7 @@
 7f 7f 81 7f 81 81 7f 7f 7f 81 7f 7f 7f 81 81 7f 81 7f 81 7f 7f 7f 7f 7f 81 7f 
81 81 81 7f 81 7f 7f 7f 81 7f 7f 81 7f 7f 81 7f 7f 7f 81 7f 81 81 81 81 7f 81 
7f 81 7f 7f 81  81  7f  7f 7f 7f 81 81 7f 7f 7f 7f 7f 81 81 7f 7f 7f 81 7f 7f 
7f 81 81 7f 7f 7f 81 7f 7f 81 7f 81 7f 7f 7f 81 7f 7f 7f 7f 81 7f 7f 7f 7f 7f 
7f 81 7f 7f 81 7f 81 7f 7f 81 7f 81 81
 81 7f 81 7f 7f 81 7f 7f 81 81 7f 7f 81 7f 81 7f 7f 81 81 81 7f 81 7f 81 81 7f 
81 7f 81 7f 81 7f 81 7f 7f 7f 7f 7f 7f 81 81 7f 81 7f 7f 7f 81 7f 7f 7f 7f 7f 
81 7f 81 7f 81  7f  7f  7f 81 7f 81 7f 7f 81 7f 81 81 81 7f 7f 81 7f 7f 7f 81 
7f 7f 7f 7f 81 81 7f 81 81 81 7f 7f 7f 81 7f 7f 7f 7f 81 81 81 7f 7f 7f 7f 81 
7f 7f 81 7f 81 7f 7f 81 81 7f 7f 81 7f
 Decoded: 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 
00 00 00 00 00 00 00 00 00 00 00
-pdtch_decode: n_errors=132 n_bits_total=588 ber=0.22
+pdtch_decode: n_errors=0 n_bits_total=588 ber=0.00

 Encoding: 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 U-Bits:
@@ -340,7 +340,7 @@
 81 7f 81 7f 81 81 7f 7f 7f 81 7f 81 7f 7f 81 7f 7f 7f 81 7f 7f 81 7f 7f 7f 7f 
81 7f 7f 7f 7f 7f 81 81 7f 7f 7f 7f 7f 81 81 81 7f 7f 7f 7f 81 81 7f 81 7f 7f 
7f 7f 7f 81 7f  7f  7f  7f 81 7f 81 81 7f 7f 7f 81 7f 81 81 7f 81 7f 7f 7f 81 
7f 7f 7f 7f 81 7f 7f 7f 81 7f 7f 81 7f 7f 7f 7f 81 7f 81 7f 81 7f 7f 81 7f 81 
7f 7f 7f 7f 7f 7f 7f 7f 81 81 81 7f 7f
 7f 7f 81 7f 7f 7f 7f 81 7f 81 7f 7f 81 7f 7f 7f 7f 81 7f 81 7f 7f 7f 81 7f 7f 
81 7f 7f 7f 81 81 7f 81 7f 7f 7f 81 7f 81 7f 7f 7f 7f 81 81 7f 81 7f 81 7f 7f 
81 7f 81 7f 81  7f  81  7f 7f 7f 7f 7f 7f 81 7f 81 81 81 81 7f 7f 7f 7f 7f 7f 
81 7f 7f 7f 81 81 7f 81 7f 81 7f 7f 7f 81 7f 7f 81 7f 81 81 7f 81 7f 81 7f 7f 
7f 7f 81 7f 7f 7f 81 81 81 81 7f 7f 7f
 Decoded: 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-pdtch_decode: n_errors=220 n_bits_total=676 ber=0.33
+pdtch_decode: n_errors=0 n_bits_total=676 ber=0.00

 Encoding: 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00
 U-Bits:

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35754?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I024276d167e769396187998d881f8e7626461249
Gerrit-Change-Number: 35754
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to