[PATCH 1/3] Add structure definition for compression algorithm

sangamesh sajjan sangamesh.sajjan at radisys.com
Wed Mar 30 13:50:43 UTC 2016


Defines new structure for Tree node and
Declaration of zero's run length code list and one's run length
code list
---
 src/Makefile.am               |    6 +-
 src/egprs_rlc_compression.cpp |  169 +++++++++++++++++++++++++++++++++++++++++
 src/egprs_rlc_compression.h   |   25 ++++++
 3 files changed, 198 insertions(+), 2 deletions(-)
 create mode 100644 src/egprs_rlc_compression.cpp
 create mode 100644 src/egprs_rlc_compression.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 6428bef..981d5b1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,7 +57,8 @@ libgprs_la_SOURCES = \
 	rlc.cpp \
 	osmobts_sock.cpp \
 	gprs_codel.c \
-	gprs_coding_scheme.cpp
+	gprs_coding_scheme.cpp \
+	egprs_rlc_compression.cpp
 
 bin_PROGRAMS = \
 	osmo-pcu
@@ -96,7 +97,8 @@ noinst_HEADERS = \
 	pcu_utils.h \
 	cxx_linuxlist.h \
 	gprs_codel.h \
-	gprs_coding_scheme.h
+	gprs_coding_scheme.h \
+	egprs_rlc_compression.h
 
 osmo_pcu_SOURCES = pcu_main.cpp
 
diff --git a/src/egprs_rlc_compression.cpp b/src/egprs_rlc_compression.cpp
new file mode 100644
index 0000000..55ff595
--- /dev/null
+++ b/src/egprs_rlc_compression.cpp
@@ -0,0 +1,169 @@
+/* egprs_rlc_compression.h
+*  Routines for EGPRS RLC bitmap compression handling
+*/
+#include <egprs_rlc_compression.h>
+#include <errno.h>
+
+const char *one_run_len_code_list[MAX_CDWDTBL_LEN] = {
+	"00110101",
+	"000111",
+	"0111",
+	"1000",
+	"1011",
+	"1100",
+	"1110",
+	"1111",
+	"10011",
+	"10100",
+	"00111",
+	"01000",
+	"001000",
+	"000011",
+	"110100",
+	"110101",
+	"101010",
+	"101011",
+	"0100111",
+	"0001100",
+	"0001000",
+	"0010111",
+	"0000011",
+	"0000100",
+	"0101000",
+	"0101011",
+	"0010011",
+	"0100100",
+	"0011000",
+	"00000010",
+	"00000011",
+	"00011010",
+	"00011011",
+	"00010010",
+	"00010011",
+	"00010100",
+	"00010101",
+	"00010110",
+	"00010111",
+	"00101000",
+	"00101001",
+	"00101010",
+	"00101011",
+	"00101100",
+	"00101101",
+	"00000100",
+	"00000101",
+	"00001010",
+	"00001011",
+	"01010010",
+	"01010011",
+	"01010100",
+	"01010101",
+	"00100100",
+	"00100101",
+	"01011000",
+	"01011001",
+	"01011010",
+	"01011011",
+	"01001010",
+	"01001011",
+	"00110010",
+	"00110011",
+	"00110100",
+	"11011",
+	"10010",
+	"010111",
+	"0110111",
+	"00110110",
+	"00110111",
+	"01100100",
+	"01100101",
+	"01101000",
+	"01100111",
+	"011001100",
+	"011001101",
+	"011010010",
+	"011010011",
+	"011010100"
+};
+
+const char *zero_run_len_code_list[MAX_CDWDTBL_LEN] = {
+	"0000110111",
+	"10",
+	"11",
+	"010",
+	"011",
+	"0011",
+	"0010",
+	"00011",
+	"000101",
+	"000100",
+	"0000100",
+	"0000101",
+	"0000111",
+	"00000100",
+	"00000111",
+	"000011000",
+	"0000010111",
+	"0000011000",
+	"0000001000",
+	"00001100111",
+	"00001101000",
+	"00001101100",
+	"00000110111",
+	"00000101000",
+	"00000010111",
+	"00000011000",
+	"000011001010",
+	"000011001011",
+	"000011001100",
+	"000011001101",
+	"000001101000",
+	"000001101001",
+	"000001101010",
+	"000001101011",
+	"000011010010",
+	"000011010011",
+	"000011010100",
+	"000011010101",
+	"000011010110",
+	"000011010111",
+	"000001101100",
+	"000001101101",
+	"000011011010",
+	"000011011011",
+	"000001010100",
+	"000001010101",
+	"000001010110",
+	"000001010111",
+	"000001100100",
+	"000001100101",
+	"000001010010",
+	"000001010011",
+	"000000100100",
+	"000000110111",
+	"000000111000",
+	"000000100111",
+	"000000101000",
+	"000001011000",
+	"000001011001",
+	"000000101011",
+	"000000101100",
+	"000001011010",
+	"000001100110",
+	"000001100111",
+	"0000001111",
+	"000011001000",
+	"000011001001",
+	"000001011011",
+	"000000110011",
+	"000000110100",
+	"000000110101",
+	"0000001101100",
+	"0000001101101",
+	"0000001001010",
+	"0000001001011",
+	"0000001001100",
+	"0000001001101",
+	"0000001110010",
+	"0000001110011"
+};
diff --git a/src/egprs_rlc_compression.h b/src/egprs_rlc_compression.h
new file mode 100644
index 0000000..00d850e
--- /dev/null
+++ b/src/egprs_rlc_compression.h
@@ -0,0 +1,25 @@
+/* egprs_rlc_compression.h
+ *  Routines for EGPRS RLC bitmap compression handling
+ */
+#include <gprs_rlcmac.h>
+#include <gprs_debug.h>
+
+extern "C" {
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/stats.h>
+}
+
+#include <arpa/inet.h>
+#include <errno.h>
+#include <string.h>
+
+#define	MAX_CDWDTBL_LEN          79        /* total number of codewords */
+#define	BITS_TO_BYTES(X)      (X ? (X/8):0)+1
+#define	MOD8(X)             (((X)+8) & (0x07))
+
+typedef struct node {
+	struct node *left;
+	struct node *right;
+	uint16_t *run_length;
+} Node;
-- 
1.7.9.5




More information about the osmocom-net-gprs mailing list