Remove local copy of associated osmo libraries

Change-Id: I2b4afedd9f2d568b5287d791891b2c2893fc6843
porting_to_gr38
Piotr Krysik 2 years ago
parent df417739b0
commit e4da417f8d
  1. 4
      CMakeLists.txt
  2. 23
      lib/CMakeLists.txt
  3. 10
      lib/decoding/CMakeLists.txt
  4. 6
      lib/decoding/osmocom/codec/CMakeLists.txt
  5. 81
      lib/decoding/osmocom/codec/codec.h
  6. 336
      lib/decoding/osmocom/codec/gsm610.c
  7. 272
      lib/decoding/osmocom/codec/gsm610_bits.h
  8. 297
      lib/decoding/osmocom/codec/gsm620.c
  9. 259
      lib/decoding/osmocom/codec/gsm660.c
  10. 318
      lib/decoding/osmocom/codec/gsm690.c
  11. 27
      lib/decoding/osmocom/coding/CMakeLists.txt
  12. 2066
      lib/decoding/osmocom/coding/gsm0503_coding.c
  13. 85
      lib/decoding/osmocom/coding/gsm0503_coding.h
  14. 1918
      lib/decoding/osmocom/coding/gsm0503_conv.c
  15. 685
      lib/decoding/osmocom/coding/gsm0503_interleaving.c
  16. 61
      lib/decoding/osmocom/coding/gsm0503_interleaving.h
  17. 300
      lib/decoding/osmocom/coding/gsm0503_mapping.c
  18. 44
      lib/decoding/osmocom/coding/gsm0503_mapping.h
  19. 137
      lib/decoding/osmocom/coding/gsm0503_parity.c
  20. 23
      lib/decoding/osmocom/coding/gsm0503_parity.h
  21. 1747
      lib/decoding/osmocom/coding/gsm0503_tables.c
  22. 61
      lib/decoding/osmocom/coding/gsm0503_tables.h
  23. 11
      lib/decoding/osmocom/core/CMakeLists.txt
  24. 105
      lib/decoding/osmocom/core/bit16gen.h
  25. 105
      lib/decoding/osmocom/core/bit32gen.h
  26. 105
      lib/decoding/osmocom/core/bit64gen.h
  27. 311
      lib/decoding/osmocom/core/bits.c
  28. 122
      lib/decoding/osmocom/core/bits.h
  29. 709
      lib/decoding/osmocom/core/bitvec.c
  30. 87
      lib/decoding/osmocom/core/bitvec.h
  31. 644
      lib/decoding/osmocom/core/conv.c
  32. 139
      lib/decoding/osmocom/core/conv.h
  33. 720
      lib/decoding/osmocom/core/conv_acc.c
  34. 214
      lib/decoding/osmocom/core/conv_acc_generic.c
  35. 120
      lib/decoding/osmocom/core/crc16gen.c
  36. 56
      lib/decoding/osmocom/core/crc16gen.h
  37. 56
      lib/decoding/osmocom/core/crc32gen.h
  38. 120
      lib/decoding/osmocom/core/crc64gen.c
  39. 56
      lib/decoding/osmocom/core/crc64gen.h
  40. 120
      lib/decoding/osmocom/core/crc8gen.c
  41. 56
      lib/decoding/osmocom/core/crc8gen.h
  42. 34
      lib/decoding/osmocom/core/crcgen.h
  43. 53
      lib/decoding/osmocom/core/defs.h
  44. 62
      lib/decoding/osmocom/core/endian.h
  45. 409
      lib/decoding/osmocom/core/linuxlist.h
  46. 100
      lib/decoding/osmocom/core/panic.c
  47. 15
      lib/decoding/osmocom/core/panic.h
  48. 135
      lib/decoding/osmocom/core/utils.h
  49. 111
      lib/decoding/osmocom/crypt/auth.h
  50. 6
      lib/decoding/osmocom/gsm/CMakeLists.txt
  51. 446
      lib/decoding/osmocom/gsm/a5.c
  52. 55
      lib/decoding/osmocom/gsm/a5.h
  53. 252
      lib/decoding/osmocom/gsm/auth_core.c
  54. 285
      lib/decoding/osmocom/gsm/gsm0503.h
  55. 1247
      lib/decoding/osmocom/gsm/gsm48_ie.c
  56. 116
      lib/decoding/osmocom/gsm/gsm48_ie.h
  57. 188
      lib/decoding/osmocom/gsm/kasumi.c
  58. 48
      lib/decoding/osmocom/gsm/kasumi.h
  59. 1683
      lib/decoding/osmocom/gsm/protocol/gsm_04_08.h

@ -129,14 +129,10 @@ find_package(Doxygen)
########################################################################
# Find osmocom build dependencies
########################################################################
option(LOCAL_OSMOCOM "Build with local osmocom libraries" OFF)
find_package(Libosmocore)
find_package(Libosmocodec)
find_package(Libosmocoding)
find_package(Libosmogsm)
if(NOT LIBOSMOCORE_FOUND OR NOT LIBOSMOCODEC_FOUND OR NOT LIBOSMOGSM_FOUND)
set(LOCAL_OSMOCOM ON)
endif()
########################################################################
# Setup doxygen option

@ -76,33 +76,14 @@ add_subdirectory(receiver)
add_subdirectory(transmitter)
add_subdirectory(trx)
if(NOT LOCAL_OSMOCOM)
list (APPEND grgsm_link_libraries ${LIBOSMOCORE_LIBRARY} ${LIBOSMOCODEC_LIBRARY} ${LIBOSMOGSM_LIBRARY})
if(LIBOSMOCODING_FOUND)
list (APPEND grgsm_link_libraries
${LIBOSMOCODING_LIBRARY}
)
list (APPEND grgsm_include_directories
PUBLIC $<BUILD_INTERFACE:${LIBOSMOCORE_INCLUDE_DIR}>
)
else()
list (APPEND grgsm_include_directories
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/decoding>
)
endif()
else(NOT LOCAL_OSMOCOM)
list (APPEND grgsm_include_directories
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/decoding>
)
endif(NOT LOCAL_OSMOCOM)
list (APPEND grgsm_link_libraries ${LIBOSMOCORE_LIBRARY} ${LIBOSMOCODEC_LIBRARY} ${LIBOSMOGSM_LIBRARY} ${LIBOSMOCODING_LIBRARY})
add_library(grgsm SHARED ${grgsm_sources})
target_link_libraries(grgsm gnuradio::gnuradio-runtime gnuradio::gnuradio-filter volk ${grgsm_link_libraries})
target_include_directories(grgsm
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/receiver>
${grgsm_include_directories}
PUBLIC $<BUILD_INTERFACE:${LIBOSMOCORE_INCLUDE_DIR}>
PUBLIC $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
PUBLIC $<INSTALL_INTERFACE:include>
)

@ -17,15 +17,6 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
if(LOCAL_OSMOCOM)
add_subdirectory(osmocom/core)
add_subdirectory(osmocom/codec)
add_subdirectory(osmocom/gsm)
add_subdirectory(osmocom/coding)
elseif(NOT LIBOSMOCODING_FOUND)
add_subdirectory(osmocom/coding)
endif()
add_subdirectory(openbts)
add_sources(
@ -34,4 +25,3 @@ add_sources(
tch_h_decoder_impl.cc
sch.c
)

@ -1,6 +0,0 @@
add_sources(
gsm610.c
gsm620.c
gsm660.c
gsm690.c
)

@ -1,81 +0,0 @@
/*! \file codec.h */
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <osmocom/core/utils.h>
/* TS 101318 Chapter 5.1: 260 bits + 4bit sig */
#define GSM_FR_BYTES 33
/* TS 101318 Chapter 5.2: 112 bits, no sig */
#define GSM_HR_BYTES 14
/* TS 101318 Chapter 5.3: 244 bits + 4bit sig */
#define GSM_EFR_BYTES 31
extern const uint16_t gsm610_bitorder[]; /* FR */
extern const uint16_t gsm620_unvoiced_bitorder[]; /* HR unvoiced */
extern const uint16_t gsm620_voiced_bitorder[]; /* HR voiced */
extern const uint16_t gsm660_bitorder[]; /* EFR */
extern const uint16_t gsm690_12_2_bitorder[]; /* AMR 12.2 kbits */
extern const uint16_t gsm690_10_2_bitorder[]; /* AMR 10.2 kbits */
extern const uint16_t gsm690_7_95_bitorder[]; /* AMR 7.95 kbits */
extern const uint16_t gsm690_7_4_bitorder[]; /* AMR 7.4 kbits */
extern const uint16_t gsm690_6_7_bitorder[]; /* AMR 6.7 kbits */
extern const uint16_t gsm690_5_9_bitorder[]; /* AMR 5.9 kbits */
extern const uint16_t gsm690_5_15_bitorder[]; /* AMR 5.15 kbits */
extern const uint16_t gsm690_4_75_bitorder[]; /* AMR 4.75 kbits */
extern const struct value_string osmo_amr_type_names[];
enum osmo_amr_type {
AMR_4_75 = 0,
AMR_5_15 = 1,
AMR_5_90 = 2,
AMR_6_70 = 3,
AMR_7_40 = 4,
AMR_7_95 = 5,
AMR_10_2 = 6,
AMR_12_2 = 7,
AMR_SID = 8,
AMR_GSM_EFR_SID = 9,
AMR_TDMA_EFR_SID = 10,
AMR_PDC_EFR_SID = 11,
AMR_NO_DATA = 15,
};
enum osmo_amr_quality {
AMR_BAD = 0,
AMR_GOOD = 1
};
/*! Check if given AMR Frame Type is a speech frame
* \param[in] ft AMR Frame Type
* \returns true if AMR with given Frame Type contains voice, false otherwise
*/
static inline bool osmo_amr_is_speech(enum osmo_amr_type ft)
{
switch (ft) {
case AMR_4_75:
case AMR_5_15:
case AMR_5_90:
case AMR_6_70:
case AMR_7_40:
case AMR_7_95:
case AMR_10_2:
case AMR_12_2:
return true;
default:
return false;
}
}
bool osmo_fr_check_sid(const uint8_t *rtp_payload, size_t payload_len);
bool osmo_hr_check_sid(const uint8_t *rtp_payload, size_t payload_len);
int osmo_amr_rtp_enc(uint8_t *payload, uint8_t cmr, enum osmo_amr_type ft,
enum osmo_amr_quality bfi);
int osmo_amr_rtp_dec(const uint8_t *payload, int payload_len, uint8_t *cmr,
int8_t *cmi, enum osmo_amr_type *ft,
enum osmo_amr_quality *bfi, int8_t *sti);

@ -1,336 +0,0 @@
/*! \file gsm610.c
* GSM 06.10 - GSM FR codec. */
/*
* (C) 2010 Sylvain Munaut <tnt@246tNt.com>
*
* All Rights Reserved
*
* SPDX-License-Identifier: GPL-2.0+
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include <stdint.h>
#include <stdbool.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/utils.h>
#include <osmocom/codec/codec.h>
/* GSM FR - subjective importance bit ordering */
/* This array encodes GSM 05.03 Table 2.
* It's also GSM 06.10 Table A.2.1a
*
* It converts between serial parameter output by the encoder and the
* order needed before channel encoding.
*/
const uint16_t gsm610_bitorder[260] = {
0, /* LARc0:5 */
47, /* Xmaxc0:5 */
103, /* Xmaxc1:5 */
159, /* Xmaxc2:5 */
215, /* Xmaxc3:5 */
1, /* LARc0:4 */
6, /* LARc1:5 */
12, /* LARc2:4 */
2, /* LARc0:3 */
7, /* LARc1:4 */
13, /* LARc2:3 */
17, /* LARc3:4 */
36, /* Nc0:6 */
92, /* Nc1:6 */
148, /* Nc2:6 */
204, /* Nc3:6 */
48, /* Xmaxc0:4 */
104, /* Xmaxc1:4 */
160, /* Xmaxc2:4 */
216, /* Xmaxc3:4 */
8, /* LARc1:3 */
22, /* LARc4:3 */
26, /* LARc5:3 */
37, /* Nc0:5 */
93, /* Nc1:5 */
149, /* Nc2:5 */
205, /* Nc3:5 */
38, /* Nc0:4 */
94, /* Nc1:4 */
150, /* Nc2:4 */
206, /* Nc3:4 */
39, /* Nc0:3 */
95, /* Nc1:3 */
151, /* Nc2:3 */
207, /* Nc3:3 */
40, /* Nc0:2 */
96, /* Nc1:2 */
152, /* Nc2:2 */
208, /* Nc3:2 */
49, /* Xmaxc0:3 */
105, /* Xmaxc1:3 */
161, /* Xmaxc2:3 */
217, /* Xmaxc3:3 */
3, /* LARc0:2 */
18, /* LARc3:3 */
30, /* LARc6:2 */
41, /* Nc0:1 */
97, /* Nc1:1 */
153, /* Nc2:1 */
209, /* Nc3:1 */
23, /* LARc4:2 */
27, /* LARc5:2 */
43, /* bc0:1 */
99, /* bc1:1 */
155, /* bc2:1 */
211, /* bc3:1 */
42, /* Nc0:0 */
98, /* Nc1:0 */
154, /* Nc2:0 */
210, /* Nc3:0 */
45, /* Mc0:1 */
101, /* Mc1:1 */
157, /* Mc2:1 */
213, /* Mc3:1 */
4, /* LARc0:1 */
9, /* LARc1:2 */
14, /* LARc2:2 */
33, /* LARc7:2 */
19, /* LARc3:2 */
24, /* LARc4:1 */
31, /* LARc6:1 */
44, /* bc0:0 */
100, /* bc1:0 */
156, /* bc2:0 */
212, /* bc3:0 */
50, /* Xmaxc0:2 */
106, /* Xmaxc1:2 */
162, /* Xmaxc2:2 */
218, /* Xmaxc3:2 */
53, /* xmc0_0:2 */
56, /* xmc0_1:2 */
59, /* xmc0_2:2 */
62, /* xmc0_3:2 */
65, /* xmc0_4:2 */
68, /* xmc0_5:2 */
71, /* xmc0_6:2 */
74, /* xmc0_7:2 */
77, /* xmc0_8:2 */
80, /* xmc0_9:2 */
83, /* xmc0_10:2 */
86, /* xmc0_11:2 */
89, /* xmc0_12:2 */
109, /* xmc1_0:2 */
112, /* xmc1_1:2 */
115, /* xmc1_2:2 */
118, /* xmc1_3:2 */
121, /* xmc1_4:2 */
124, /* xmc1_5:2 */
127, /* xmc1_6:2 */
130, /* xmc1_7:2 */
133, /* xmc1_8:2 */
136, /* xmc1_9:2 */
139, /* xmc1_10:2 */
142, /* xmc1_11:2 */
145, /* xmc1_12:2 */
165, /* xmc2_0:2 */
168, /* xmc2_1:2 */
171, /* xmc2_2:2 */
174, /* xmc2_3:2 */
177, /* xmc2_4:2 */
180, /* xmc2_5:2 */
183, /* xmc2_6:2 */
186, /* xmc2_7:2 */
189, /* xmc2_8:2 */
192, /* xmc2_9:2 */
195, /* xmc2_10:2 */
198, /* xmc2_11:2 */
201, /* xmc2_12:2 */
221, /* xmc3_0:2 */
224, /* xmc3_1:2 */
227, /* xmc3_2:2 */
230, /* xmc3_3:2 */
233, /* xmc3_4:2 */
236, /* xmc3_5:2 */
239, /* xmc3_6:2 */
242, /* xmc3_7:2 */
245, /* xmc3_8:2 */
248, /* xmc3_9:2 */
251, /* xmc3_10:2 */
254, /* xmc3_11:2 */
257, /* xmc3_12:2 */
46, /* Mc0:0 */
102, /* Mc1:0 */
158, /* Mc2:0 */
214, /* Mc3:0 */
51, /* Xmaxc0:1 */
107, /* Xmaxc1:1 */
163, /* Xmaxc2:1 */
219, /* Xmaxc3:1 */
54, /* xmc0_0:1 */
57, /* xmc0_1:1 */
60, /* xmc0_2:1 */
63, /* xmc0_3:1 */
66, /* xmc0_4:1 */
69, /* xmc0_5:1 */
72, /* xmc0_6:1 */
75, /* xmc0_7:1 */
78, /* xmc0_8:1 */
81, /* xmc0_9:1 */
84, /* xmc0_10:1 */
87, /* xmc0_11:1 */
90, /* xmc0_12:1 */
110, /* xmc1_0:1 */
113, /* xmc1_1:1 */
116, /* xmc1_2:1 */
119, /* xmc1_3:1 */
122, /* xmc1_4:1 */
125, /* xmc1_5:1 */
128, /* xmc1_6:1 */
131, /* xmc1_7:1 */
134, /* xmc1_8:1 */
137, /* xmc1_9:1 */
140, /* xmc1_10:1 */
143, /* xmc1_11:1 */
146, /* xmc1_12:1 */
166, /* xmc2_0:1 */
169, /* xmc2_1:1 */
172, /* xmc2_2:1 */
175, /* xmc2_3:1 */
178, /* xmc2_4:1 */
181, /* xmc2_5:1 */
184, /* xmc2_6:1 */
187, /* xmc2_7:1 */
190, /* xmc2_8:1 */
193, /* xmc2_9:1 */
196, /* xmc2_10:1 */
199, /* xmc2_11:1 */
202, /* xmc2_12:1 */
222, /* xmc3_0:1 */
225, /* xmc3_1:1 */
228, /* xmc3_2:1 */
231, /* xmc3_3:1 */
234, /* xmc3_4:1 */
237, /* xmc3_5:1 */
240, /* xmc3_6:1 */
243, /* xmc3_7:1 */
246, /* xmc3_8:1 */
249, /* xmc3_9:1 */
252, /* xmc3_10:1 */
255, /* xmc3_11:1 */
258, /* xmc3_12:1 */
5, /* LARc0:0 */
10, /* LARc1:1 */
15, /* LARc2:1 */
28, /* LARc5:1 */
32, /* LARc6:0 */
34, /* LARc7:1 */
35, /* LARc7:0 */
16, /* LARc2:0 */
20, /* LARc3:1 */
21, /* LARc3:0 */
25, /* LARc4:0 */
52, /* Xmaxc0:0 */
108, /* Xmaxc1:0 */
164, /* Xmaxc2:0 */
220, /* Xmaxc3:0 */
55, /* xmc0_0:0 */
58, /* xmc0_1:0 */
61, /* xmc0_2:0 */
64, /* xmc0_3:0 */
67, /* xmc0_4:0 */
70, /* xmc0_5:0 */
73, /* xmc0_6:0 */
76, /* xmc0_7:0 */
79, /* xmc0_8:0 */
82, /* xmc0_9:0 */
85, /* xmc0_10:0 */
88, /* xmc0_11:0 */
91, /* xmc0_12:0 */
111, /* xmc1_0:0 */
114, /* xmc1_1:0 */
117, /* xmc1_2:0 */
120, /* xmc1_3:0 */
123, /* xmc1_4:0 */
126, /* xmc1_5:0 */
129, /* xmc1_6:0 */
132, /* xmc1_7:0 */
135, /* xmc1_8:0 */
138, /* xmc1_9:0 */
141, /* xmc1_10:0 */
144, /* xmc1_11:0 */
147, /* xmc1_12:0 */
167, /* xmc2_0:0 */
170, /* xmc2_1:0 */
173, /* xmc2_2:0 */
176, /* xmc2_3:0 */
179, /* xmc2_4:0 */
182, /* xmc2_5:0 */
185, /* xmc2_6:0 */
188, /* xmc2_7:0 */
191, /* xmc2_8:0 */
194, /* xmc2_9:0 */
197, /* xmc2_10:0 */
200, /* xmc2_11:0 */
203, /* xmc2_12:0 */
223, /* xmc3_0:0 */
226, /* xmc3_1:0 */
229, /* xmc3_2:0 */
232, /* xmc3_3:0 */
235, /* xmc3_4:0 */
238, /* xmc3_5:0 */
241, /* xmc3_6:0 */
244, /* xmc3_7:0 */
247, /* xmc3_8:0 */
250, /* xmc3_9:0 */
253, /* xmc3_10:0 */
256, /* xmc3_11:0 */
259, /* xmc3_12:0 */
11, /* LARc1:0 */
29, /* LARc5:0 */
};
/*! Check whether RTP frame contains FR SID code word according to
* TS 101 318 §5.1.2
* \param[in] rtp_payload Buffer with RTP payload
* \param[in] payload_len Length of payload
* \returns true if code word is found, false otherwise
*/
bool osmo_fr_check_sid(const uint8_t *rtp_payload, size_t payload_len)
{
struct bitvec bv;
uint16_t i, z_bits[] = { 57, 58, 60, 61, 63, 64, 66, 67, 69, 70, 72, 73,
75, 76, 78, 79, 81, 82, 84, 85, 87, 88, 90, 91,
93, 94, 113, 114, 116, 117, 119, 120, 122, 123,
125, 126, 128, 129, 131, 132, 134, 135, 137,
138, 140, 141, 143, 144, 146, 147, 149, 150,
169, 170, 172, 173, 175, 176, 178, 179, 181,
182, 184, 185, 187, 188, 190, 191, 193, 194,
196, 197, 199, 200, 202, 203, 205, 206, 225,
226, 228, 229, 231, 232, 234, 235, 237, 240,
243, 246, 249, 252, 255, 258, 261 };
/* signature does not match Full Rate SID */
if ((rtp_payload[0] >> 4) != 0xD)
return false;
bv.data = (uint8_t *) rtp_payload;
bv.data_len = payload_len;
/* code word is all 0 at given bits, numbered from 1 */
for (i = 0; i < ARRAY_SIZE(z_bits); i++)
if (bitvec_get_bit_pos(&bv, z_bits[i]) != ZERO)
return false;
return true;
}

@ -1,272 +0,0 @@
/*! \file gsm610_bits.h */
#pragma once
/* This enumeration describs a GSM-FR (GSM 06.10) frame in ints RTP bit order
* representation. See also RFC 3551 Table 3: GSM payload format */
enum gsm610_rtp_bit_offsets {
GSM610_RTP_SIGNATURE_0,
GSM610_RTP_SIGNATURE_1,
GSM610_RTP_SIGNATURE_2,
GSM610_RTP_SIGNATURE_3,
GSM610_RTP_LARC0_0,
GSM610_RTP_LARC0_1,
GSM610_RTP_LARC0_2,
GSM610_RTP_LARC0_3,
GSM610_RTP_LARC0_4,
GSM610_RTP_LARC0_5,
GSM610_RTP_LARC1_0,
GSM610_RTP_LARC1_1,
GSM610_RTP_LARC1_2,
GSM610_RTP_LARC1_3,
GSM610_RTP_LARC1_4,
GSM610_RTP_LARC1_5,
GSM610_RTP_LARC2_0,
GSM610_RTP_LARC2_1,
GSM610_RTP_LARC2_2,
GSM610_RTP_LARC2_3,
GSM610_RTP_LARC2_4,
GSM610_RTP_LARC3_0,
GSM610_RTP_LARC3_1,
GSM610_RTP_LARC3_2,
GSM610_RTP_LARC3_3,
GSM610_RTP_LARC3_4,
GSM610_RTP_LARC4_0,
GSM610_RTP_LARC4_1,
GSM610_RTP_LARC4_2,
GSM610_RTP_LARC4_3,
GSM610_RTP_LARC5_0,
GSM610_RTP_LARC5_1,
GSM610_RTP_LARC5_2,
GSM610_RTP_LARC5_3,
GSM610_RTP_LARC6_0,
GSM610_RTP_LARC6_1,
GSM610_RTP_LARC6_2,
GSM610_RTP_LARC7_0,
GSM610_RTP_LARC7_1,
GSM610_RTP_LARC7_2,
GSM610_RTP_NC0_0,
GSM610_RTP_NC0_1,
GSM610_RTP_NC0_2,
GSM610_RTP_NC0_3,
GSM610_RTP_NC0_4,
GSM610_RTP_NC0_5,
GSM610_RTP_NC0_6,
GSM610_RTP_BC0_0,
GSM610_RTP_BC0_1,
GSM610_RTP_MC0_0,
GSM610_RTP_MC0_1,
GSM610_RTP_XMAXC00,
GSM610_RTP_XMAXC01,
GSM610_RTP_XMAXC02,
GSM610_RTP_XMAXC03,
GSM610_RTP_XMAXC04,
GSM610_RTP_XMAXC05,
GSM610_RTP_XMC0_0,
GSM610_RTP_XMC0_1,
GSM610_RTP_XMC0_2,
GSM610_RTP_XMC1_0,
GSM610_RTP_XMC1_1,
GSM610_RTP_XMC1_2,
GSM610_RTP_XMC2_0,
GSM610_RTP_XMC2_1,
GSM610_RTP_XMC2_2,
GSM610_RTP_XMC3_0,
GSM610_RTP_XMC3_1,
GSM610_RTP_XMC3_2,
GSM610_RTP_XMC4_0,
GSM610_RTP_XMC4_1,
GSM610_RTP_XMC4_2,
GSM610_RTP_XMC5_0,
GSM610_RTP_XMC5_1,
GSM610_RTP_XMC5_2,
GSM610_RTP_XMC6_0,
GSM610_RTP_XMC6_1,
GSM610_RTP_XMC6_2,
GSM610_RTP_XMC7_0,
GSM610_RTP_XMC7_1,
GSM610_RTP_XMC7_2,
GSM610_RTP_XMC8_0,
GSM610_RTP_XMC8_1,
GSM610_RTP_XMC8_2,
GSM610_RTP_XMC9_0,
GSM610_RTP_XMC9_1,
GSM610_RTP_XMC9_2,
GSM610_RTP_XMC10_0,
GSM610_RTP_XMC10_1,
GSM610_RTP_XMC10_2,
GSM610_RTP_XMC11_0,
GSM610_RTP_XMC11_1,
GSM610_RTP_XMC11_2,
GSM610_RTP_XMC12_0,
GSM610_RTP_XMC12_1,
GSM610_RTP_XCM12_2,
GSM610_RTP_NC1_0,
GSM610_RTP_NC1_1,
GSM610_RTP_NC1_2,
GSM610_RTP_NC1_3,
GSM610_RTP_NC1_4,
GSM610_RTP_NC1_5,
GSM610_RTP_NC1_6,
GSM610_RTP_BC1_0,
GSM610_RTP_BC1_1,
GSM610_RTP_MC1_0,
GSM610_RTP_MC1_1,
GSM610_RTP_XMAXC10,
GSM610_RTP_XMAXC11,
GSM610_RTP_XMAXC12,
GSM610_RTP_XMAXC13,
GSM610_RTP_XMAXC14,
GSM610_RTP_XMAX15,
GSM610_RTP_XMC13_0,
GSM610_RTP_XMC13_1,
GSM610_RTP_XMC13_2,
GSM610_RTP_XMC14_0,
GSM610_RTP_XMC14_1,
GSM610_RTP_XMC14_2,
GSM610_RTP_XMC15_0,
GSM610_RTP_XMC15_1,
GSM610_RTP_XMC15_2,
GSM610_RTP_XMC16_0,
GSM610_RTP_XMC16_1,
GSM610_RTP_XMC16_2,
GSM610_RTP_XMC17_0,
GSM610_RTP_XMC17_1,
GSM610_RTP_XMC17_2,
GSM610_RTP_XMC18_0,
GSM610_RTP_XMC18_1,
GSM610_RTP_XMC18_2,
GSM610_RTP_XMC19_0,
GSM610_RTP_XMC19_1,
GSM610_RTP_XMC19_2,
GSM610_RTP_XMC20_0,
GSM610_RTP_XMC20_1,
GSM610_RTP_XMC20_2,
GSM610_RTP_XMC21_0,
GSM610_RTP_XMC21_1,
GSM610_RTP_XMC21_2,
GSM610_RTP_XMC22_0,
GSM610_RTP_XMC22_1,
GSM610_RTP_XMC22_2,
GSM610_RTP_XMC23_0,
GSM610_RTP_XMC23_1,
GSM610_RTP_XMC23_2,
GSM610_RTP_XMC24_0,
GSM610_RTP_XMC24_1,
GSM610_RTP_XMC24_2,
GSM610_RTP_XMC25_0,
GSM610_RTP_XMC25_1,
GSM610_RTP_XMC25_2,
GSM610_RTP_NC2_0,
GSM610_RTP_NC2_1,
GSM610_RTP_NC2_2,
GSM610_RTP_NC2_3,
GSM610_RTP_NC2_4,
GSM610_RTP_NC2_5,
GSM610_RTP_NC2_6,
GSM610_RTP_BC2_0,
GSM610_RTP_BC2_1,
GSM610_RTP_MC2_0,
GSM610_RTP_MC2_1,
GSM610_RTP_XMAXC20,
GSM610_RTP_XMAXC21,
GSM610_RTP_XMAXC22,
GSM610_RTP_XMAXC23,
GSM610_RTP_XMAXC24,
GSM610_RTP_XMAXC25,
GSM610_RTP_XMC26_0,
GSM610_RTP_XMC26_1,
GSM610_RTP_XMC26_2,
GSM610_RTP_XMC27_0,
GSM610_RTP_XMC27_1,
GSM610_RTP_XMC27_2,
GSM610_RTP_XMC28_0,
GSM610_RTP_XMC28_1,
GSM610_RTP_XMC28_2,
GSM610_RTP_XMC29_0,
GSM610_RTP_XMC29_1,
GSM610_RTP_XMC29_2,
GSM610_RTP_XMC30_0,
GSM610_RTP_XMC30_1,
GSM610_RTP_XMC30_2,
GSM610_RTP_XMC31_0,
GSM610_RTP_XMC31_1,
GSM610_RTP_XMC31_2,
GSM610_RTP_XMC32_0,
GSM610_RTP_XMC32_1,
GSM610_RTP_XMC32_2,
GSM610_RTP_XMC33_0,
GSM610_RTP_XMC33_1,
GSM610_RTP_XMC33_2,
GSM610_RTP_XMC34_0,
GSM610_RTP_XMC34_1,
GSM610_RTP_XMC34_2,
GSM610_RTP_XMC35_0,
GSM610_RTP_XMC35_1,
GSM610_RTP_XMC35_2,
GSM610_RTP_XMC36_0,
GSM610_RTP_XMC36_1,
GSM610_RTP_XMC36_2,
GSM610_RTP_XMC37_0,
GSM610_RTP_XMC37_1,
GSM610_RTP_XMC37_2,
GSM610_RTP_XMC38_0,
GSM610_RTP_XMC38_1,
GSM610_RTP_XMC38_2,
GSM610_RTP_NC3_0,
GSM610_RTP_NC3_1,
GSM610_RTP_NC3_2,
GSM610_RTP_NC3_3,
GSM610_RTP_NC3_4,
GSM610_RTP_NC3_5,
GSM610_RTP_NC3_6,
GSM610_RTP_BC3_0,
GSM610_RTP_BC3_1,
GSM610_RTP_MC3_0,
GSM610_RTP_MC3_1,
GSM610_RTP_XMAXC30,
GSM610_RTP_XMAXC31,
GSM610_RTP_XMAXC32,
GSM610_RTP_XMAXC33,
GSM610_RTP_XMAXC34,
GSM610_RTP_XMAXC35,
GSM610_RTP_XMC39_0,
GSM610_RTP_XMC39_1,
GSM610_RTP_XMC39_2,
GSM610_RTP_XMC40_0,
GSM610_RTP_XMC40_1,
GSM610_RTP_XMC40_2,
GSM610_RTP_XMC41_0,
GSM610_RTP_XMC41_1,
GSM610_RTP_XMC41_2,
GSM610_RTP_XMC42_0,
GSM610_RTP_XMC42_1,
GSM610_RTP_XMC42_2,
GSM610_RTP_XMC43_0,
GSM610_RTP_XMC43_1,
GSM610_RTP_XMC43_2,
GSM610_RTP_XMC44_0,
GSM610_RTP_XMC44_1,
GSM610_RTP_XMC44_2,
GSM610_RTP_XMC45_0,
GSM610_RTP_XMC45_1,
GSM610_RTP_XMC45_2,
GSM610_RTP_XMC46_0,
GSM610_RTP_XMC46_1,
GSM610_RTP_XMC46_2,
GSM610_RTP_XMC47_0,
GSM610_RTP_XMC47_1,
GSM610_RTP_XMC47_2,
GSM610_RTP_XMC48_0,
GSM610_RTP_XMC48_1,
GSM610_RTP_XMC48_2,
GSM610_RTP_XMC49_0,
GSM610_RTP_XMC49_1,
GSM610_RTP_XMC49_2,
GSM610_RTP_XMC50_0,
GSM610_RTP_XMC50_1,
GSM610_RTP_XMC50_2,
GSM610_RTP_XMC51_0,
GSM610_RTP_XMC51_1,
GSM610_RTP_XMC51_2
};

@ -1,297 +0,0 @@
/*! \file gsm620.c
* GSM 06.20 - GSM HR codec. */
/*
* (C) 2010 Sylvain Munaut <tnt@246tNt.com>
*
* All Rights Reserved
*
* SPDX-License-Identifier: GPL-2.0+
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include <stdint.h>
#include <stdbool.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/utils.h>
#include <osmocom/codec/codec.h>
/* GSM HR unvoiced (mode=0) frames - subjective importance bit ordering */
/* This array encode mapping between GSM 05.03 Table 3a (bits
* ordering before channel coding on TCH) and GSM 06.20 Table B.1
* (bit ordering on A-bis */
const uint16_t gsm620_unvoiced_bitorder[112] = {
3, /* R0:1 */
25, /* LPC 3:7 */
52, /* GSP 0-1:2 */
71, /* GSP 0-2:2 */
90, /* GSP 0-3:2 */
109, /* GSP 0-4:2 */
15, /* LPC 1:0 */
19, /* LPC 2:5 */
20, /* LPC 2:4 */
21, /* LPC 2:3 */
22, /* LPC 2:2 */
23, /* LPC 2:1 */
26, /* LPC 3:6 */
27, /* LPC 3:5 */
28, /* LPC 3:4 */
29, /* LPC 3:3 */
30, /* LPC 3:2 */
31, /* LPC 3:1 */
61, /* Code 1-2:0 */
62, /* Code 2-2:6 */
63, /* Code 2-2:5 */
64, /* Code 2-2:4 */
65, /* Code 2-2:3 */
66, /* Code 2-2:2 */
67, /* Code 2-2:1 */
68, /* Code 2-2:0 */
74, /* Code 1-3:6 */
75, /* Code 1-3:5 */
76, /* Code 1-3:4 */
77, /* Code 1-3:3 */
78, /* Code 1-3:2 */
79, /* Code 1-3:1 */
80, /* Code 1-3:0 */
81, /* Code 2-3:6 */
82, /* Code 2-3:5 */
83, /* Code 2-3:4 */
84, /* Code 2-3:3 */
32, /* LPC 3:0 */
4, /* R0:0 */
33, /* INT-LPC:0 */
60, /* Code 1-2:1 */
59, /* Code 1-2:2 */
58, /* Code 1-2:3 */
57, /* Code 1-2:4 */
56, /* Code 1-2:5 */
55, /* Code 1-2:6 */
49, /* Code 2-1:0 */
48, /* Code 2-1:1 */
47, /* Code 2-1:2 */
46, /* Code 2-1:3 */
45, /* Code 2-1:4 */
44, /* Code 2-1:5 */
43, /* Code 2-1:6 */
42, /* Code 1-1:0 */
41, /* Code 1-1:1 */
40, /* Code 1-1:2 */
39, /* Code 1-1:3 */
38, /* Code 1-1:4 */
37, /* Code 1-1:5 */
36, /* Code 1-1:6 */
111, /* GSP 0-4:0 */
92, /* GSP 0-3:0 */
73, /* GSP 0-2:0 */
54, /* GSP 0-1:0 */
24, /* LPC 2:0 */
110, /* GSP 0-4:1 */
91, /* GSP 0-3:1 */
72, /* GSP 0-2:1 */
53, /* GSP 0-1:1 */
14, /* LPC 1:1 */
13, /* LPC 1:2 */
12, /* LPC 1:3 */
11, /* LPC 1:4 */
10, /* LPC 1:5 */
108, /* GSP 0-4:3 */
89, /* GSP 0-3:3 */
70, /* GSP 0-2:3 */
51, /* GSP 0-1:3 */
16, /* LPC 2:8 */
17, /* LPC 2:7 */
18, /* LPC 2:6 */
107, /* GSP 0-4:4 */
88, /* GSP 0-3:4 */
69, /* GSP 0-2:4 */
50, /* GSP 0-1:4 */
9, /* LPC 1:6 */
8, /* LPC 1:7 */
7, /* LPC 1:8 */
6, /* LPC 1:9 */
2, /* R0:2 */
5, /* LPC 1:10 */
1, /* R0:3 */
0, /* R0:4 */
35, /* Mode:0 */
34, /* Mode:1 */
106, /* Code 2-4:0 */
105, /* Code 2-4:1 */
104, /* Code 2-4:2 */
103, /* Code 2-4:3 */
102, /* Code 2-4:4 */
101, /* Code 2-4:5 */
100, /* Code 2-4:6 */
99, /* Code 1-4:0 */
98, /* Code 1-4:1 */
97, /* Code 1-4:2 */
96, /* Code 1-4:3 */
95, /* Code 1-4:4 */
94, /* Code 1-4:5 */
93, /* Code 1-4:6 */
87, /* Code 2-3:0 */
86, /* Code 2-3:1 */
85, /* Code 2-3:2 */
};
/* GSM HR voiced (mode=1,2,3) frames - subjective importance bit ordering */
/* This array encode mapping between GSM 05.03 Table 3b (bits
* ordering before channel coding on TCH) and GSM 06.20 Table B.2
* (bit ordering on A-bis */
const uint16_t gsm620_voiced_bitorder[112] = {
13, /* LPC 1:2 */
14, /* LPC 1:1 */
18, /* LPC 2:6 */
19, /* LPC 2:5 */
20, /* LPC 2:4 */
53, /* GSP 0-1:4 */
71, /* GSP 0-2:4 */
89, /* GSP 0-3:4 */
107, /* GSP 0-4:4 */
54, /* GSP 0-1:3 */
72, /* GSP 0-2:3 */
90, /* GSP 0-3:3 */
108, /* GSP 0-4:3 */
55, /* GSP 0-1:2 */
73, /* GSP 0-2:2 */
91, /* GSP 0-3:2 */
109, /* GSP 0-4:2 */
44, /* Code 1:8 */
45, /* Code 1:7 */
46, /* Code 1:6 */
47, /* Code 1:5 */
48, /* Code 1:4 */
49, /* Code 1:3 */
50, /* Code 1:2 */
51, /* Code 1:1 */
52, /* Code 1:0 */
62, /* Code 2:8 */
63, /* Code 2:7 */
64, /* Code 2:6 */
65, /* Code 2:5 */
68, /* Code 2:2 */
69, /* Code 2:1 */
70, /* Code 2:0 */
80, /* Code 3:8 */
66, /* Code 2:4 */
67, /* Code 2:3 */
56, /* GSP 0-1:1 */
74, /* GSP 0-2:1 */
92, /* GSP 0-3:1 */
110, /* GSP 0-4:1 */
57, /* GSP 0-1:0 */
75, /* GSP 0-2:0 */
93, /* GSP 0-3:0 */
111, /* GSP 0-4:0 */
33, /* INT-LPC:0 */
24, /* LPC 2:0 */
32, /* LPC 3:0 */
97, /* LAG 4:0 */
31, /* LPC 3:1 */
23, /* LPC 2:1 */
96, /* LAG 4:1 */
79, /* LAG 3:0 */
61, /* LAG 2:0 */
43, /* LAG 1:0 */
95, /* LAG 4:2 */
78, /* LAG 3:1 */
60, /* LAG 2:1 */
42, /* LAG 1:1 */
30, /* LPC 3:2 */
29, /* LPC 3:3 */
28, /* LPC 3:4 */
22, /* LPC 2:2 */
27, /* LPC 3:5 */
26, /* LPC 3:6 */
21, /* LPC 2:3 */
4, /* R0:0 */
25, /* LPC 3:7 */
15, /* LPC 1:0 */
94, /* LAG 4:3 */
77, /* LAG 3:2 */
59, /* LAG 2:2 */
41, /* LAG 1:2 */
3, /* R0:1 */
76, /* LAG 3:3 */
58, /* LAG 2:3 */
40, /* LAG 1:3 */
39, /* LAG 1:4 */
17, /* LPC 2:7 */
16, /* LPC 2:8 */
12, /* LPC 1:3 */
11, /* LPC 1:4 */
10, /* LPC 1:5 */
9, /* LPC 1:6 */
2, /* R0:2 */
38, /* LAG 1:5 */
37, /* LAG 1:6 */
36, /* LAG 1:7 */
8, /* LPC 1:7 */
7, /* LPC 1:8 */
6, /* LPC 1:9 */
5, /* LPC 1:10 */
1, /* R0:3 */
0, /* R0:4 */
35, /* Mode:0 */
34, /* Mode:1 */
106, /* Code 4:0 */
105, /* Code 4:1 */
104, /* Code 4:2 */
103, /* Code 4:3 */
102, /* Code 4:4 */
101, /* Code 4:5 */
100, /* Code 4:6 */
99, /* Code 4:7 */
98, /* Code 4:8 */
88, /* Code 3:0 */
87, /* Code 3:1 */
86, /* Code 3:2 */
85, /* Code 3:3 */
84, /* Code 3:4 */
83, /* Code 3:5 */
82, /* Code 3:6 */
81, /* Code 3:7 */
};
static inline uint16_t mask(const uint8_t msb)
{
const uint16_t m = (uint16_t)1 << (msb - 1);
return (m - 1) ^ m;
}
/*! Check whether RTP frame contains HR SID code word according to
* TS 101 318 §5.2.2
* \param[in] rtp_payload Buffer with RTP payload
* \param[in] payload_len Length of payload
* \returns true if code word is found, false otherwise
*/
bool osmo_hr_check_sid(const uint8_t *rtp_payload, size_t payload_len)
{
uint8_t i, bits[] = { 1, 2, 8, 9, 5, 4, 9, 5, 4, 9, 5, 4, 9, 5 };
struct bitvec bv;
bv.data = (uint8_t *) rtp_payload;
bv.data_len = payload_len;
bv.cur_bit = 33;
/* code word is all 1 at given bits, numbered from 1, MODE is always 3 */
for (i = 0; i < ARRAY_SIZE(bits); i++)
if (bitvec_get_uint(&bv, bits[i]) != mask(bits[i]))
return false;
return true;
}

@ -1,259 +0,0 @@
/*! \file gsm660.c
* GSM 06.60 - GSM EFR Codec. */
/*
* (C) 2010 Sylvain Munaut <tnt@246tNt.com>
*
* All Rights Reserved
*
* SPDX-License-Identifier: GPL-2.0+
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include <stdint.h>
#include <osmocom/codec/codec.h>
/* GSM EFR - subjective importance bit ordering */
/* This array encodes GSM 05.03 Table 6.
*
* It converts between serial parameter output (as described in
* GSM 06.60 Table 6 and GSM 05.03 Table 5) and the order needed
* before channel encoding. CRC poly and bit repetition must be
* applied prior to this table, as in GSM 05.03 3.1.1, to get 260
* bits from a 244 bits raw EFR frame.
*/
const uint16_t gsm660_bitorder[260] = {
38, 39, 40, 41, 42, 43, /* 0 -> LTP-LAG 1: b8..b3 */
145, 146, 147, 148, 149, 150, /* 6 -> LTP-LAG 3: b8..b3 */
93, 94, /* 12 -> LTP-LAG 2: b5..b4 */
200, 201, /* 14 -> LTP-LAG 4: b5..b4 */
47, /* 16 -> LTP-GAIN 1: b3 */
88, /* 17 -> FCB-GAIN 1: b4 */
99, /* 18 -> LTP-GAIN 2: b3 */
140, /* 19 -> FCB-GAIN 2: b4 */
44, /* 20 -> LTP-LAG 1: b2 */
151, /* 21 -> LTP-LAG 3: b2 */
95, /* 22 -> LTP-LAG 2: b3 */
202, /* 23 -> LTP-LAG 4: b3 */
1, 2, /* 24 -> LPC 1: b5..b4 */
7, /* 26 -> LPC 2: b7 */
9, /* 27 -> LPC 2: b5 */
17, 18, /* 28 -> LPC 3: b6..b5 */
23, /* 30 -> LPC 3: b0 */
45, 46, /* 31 -> LTP-LAG 1: b1..b0 */
152, 153, /* 33 -> LTP-LAG 3: b1..b0 */
96, /* 35 -> LTP-LAG 2: b2 */
203, /* 36 -> LTP-LAG 4: b2 */
3, 4, /* 37 -> LPC 1: b3..b2 */
10, 11, /* 39 -> LPC 2: b4..b3 */
15, /* 41 -> LPC 3: b8 */
8, /* 42 -> LPC 2: b6 */
5, 6, /* 43 -> LPC 1: b1..b0 */
12, /* 45 -> LPC 2: b2 */
16, /* 46 -> LPC 3: b7 */
19, /* 47 -> LPC 3: b4 */
97, /* 48 -> LTP-LAG 2: b1 */
204, /* 49 -> LTP-LAG 4: b1 */
0, /* 50 -> LPC 1: b6 */
13, 14, /* 51 -> LPC 2: b1..b0 */
20, /* 53 -> LPC 3: b3 */
24, 25, /* 54 -> LPC 4: b7..b6 */
27, /* 56 -> LPC 4: b4 */
154, /* 57 -> LTP-GAIN 3: b3 */
206, /* 58 -> LTP-GAIN 4: b3 */
195, /* 59 -> FCB-GAIN 3: b4 */
247, /* 60 -> FCB-GAIN 4: b4 */
89, /* 61 -> FCB-GAIN 1: b3 */
141, /* 62 -> FCB-GAIN 2: b3 */
196, /* 63 -> FCB-GAIN 3: b3 */
248, /* 64 -> FCB-GAIN 4: b3 */
252, 253, 254, 255, 256, 257, 258, 259, /* 65 -> CRC-POLY: b7..b0 */
48, /* 73 -> LTP-GAIN 1: b2 */
100, /* 74 -> LTP-GAIN 2: b2 */
155, /* 75 -> LTP-GAIN 3: b2 */
207, /* 76 -> LTP-GAIN 4: b2 */
21, 22, /* 77 -> LPC 3: b2..b1 */
26, /* 79 -> LPC 4: b5 */
28, /* 80 -> LPC 4: b3 */
51, /* 81 -> PULSE 1_1: b3 */
55, /* 82 -> PULSE 1_2: b3 */
59, /* 83 -> PULSE 1_3: b3 */
63, /* 84 -> PULSE 1_4: b3 */
67, /* 85 -> PULSE 1_5: b3 */
103, /* 86 -> PULSE 2_1: b3 */
107, /* 87 -> PULSE 2_2: b3 */
111, /* 88 -> PULSE 2_3: b3 */
115, /* 89 -> PULSE 2_4: b3 */
119, /* 90 -> PULSE 2_5: b3 */
158, /* 91 -> PULSE 3_1: b3 */
162, /* 92 -> PULSE 3_2: b3 */
166, /* 93 -> PULSE 3_3: b3 */
170, /* 94 -> PULSE 3_4: b3 */
174, /* 95 -> PULSE 3_5: b3 */
210, /* 96 -> PULSE 4_1: b3 */
214, /* 97 -> PULSE 4_2: b3 */
218, /* 98 -> PULSE 4_3: b3 */
222, /* 99 -> PULSE 4_4: b3 */
226, /* 100 -> PULSE 4_5: b3 */
90, /* 101 -> FCB-GAIN 1: b2 */
142, /* 102 -> FCB-GAIN 2: b2 */
197, /* 103 -> FCB-GAIN 3: b2 */
249, /* 104 -> FCB-GAIN 4: b2 */
49, /* 105 -> LTP-GAIN 1: b1 */
101, /* 106 -> LTP-GAIN 2: b1 */
156, /* 107 -> LTP-GAIN 3: b1 */
208, /* 108 -> LTP-GAIN 4: b1 */
29, 30, 31, /* 109 -> LPC 4: b2..b0 */
32, 33, 34, 35, /* 112 -> LPC 5: b5..b2 */
98, /* 116 -> LTP-LAG 2: b0 */
205, /* 117 -> LTP-LAG 4: b0 */
52, /* 118 -> PULSE 1_1: b2 */
56, /* 119 -> PULSE 1_2: b2 */
60, /* 120 -> PULSE 1_3: b2 */
64, /* 121 -> PULSE 1_4: b2 */
68, /* 122 -> PULSE 1_5: b2 */
104, /* 123 -> PULSE 2_1: b2 */
108, /* 124 -> PULSE 2_2: b2 */
112, /* 125 -> PULSE 2_3: b2 */
116, /* 126 -> PULSE 2_4: b2 */
120, /* 127 -> PULSE 2_5: b2 */
159, /* 128 -> PULSE 3_1: b2 */
163, /* 129 -> PULSE 3_2: b2 */
167, /* 130 -> PULSE 3_3: b2 */
171, /* 131 -> PULSE 3_4: b2 */
175, /* 132 -> PULSE 3_5: b2 */
211, /* 133 -> PULSE 4_1: b2 */
215, /* 134 -> PULSE 4_2: b2 */
219, /* 135 -> PULSE 4_3: b2 */
223, /* 136 -> PULSE 4_4: b2 */
227, /* 137 -> PULSE 4_5: b2 */
53, /* 138 -> PULSE 1_1: b1 */
57, /* 139 -> PULSE 1_2: b1 */
61, /* 140 -> PULSE 1_3: b1 */
65, /* 141 -> PULSE 1_4: b1 */
105, /* 142 -> PULSE 2_1: b1 */
109, /* 143 -> PULSE 2_2: b1 */
113, /* 144 -> PULSE 2_3: b1 */
117, /* 145 -> PULSE 2_4: b1 */
160, /* 146 -> PULSE 3_1: b1 */
164, /* 147 -> PULSE 3_2: b1 */
168, /* 148 -> PULSE 3_3: b1 */
172, /* 149 -> PULSE 3_4: b1 */
212, /* 150 -> PULSE 4_1: b1 */
220, /* 151 -> PULSE 4_3: b1 */
224, /* 152 -> PULSE 4_4: b1 */
91, /* 153 -> FCB-GAIN 1: b1 */
143, /* 154 -> FCB-GAIN 2: b1 */
198, /* 155 -> FCB-GAIN 3: b1 */
250, /* 156 -> FCB-GAIN 4: b1 */
50, /* 157 -> LTP-GAIN 1: b0 */
102, /* 158 -> LTP-GAIN 2: b0 */
157, /* 159 -> LTP-GAIN 3: b0 */
209, /* 160 -> LTP-GAIN 4: b0 */
92, /* 161 -> FCB-GAIN 1: b0 */
144, /* 162 -> FCB-GAIN 2: b0 */
199, /* 163 -> FCB-GAIN 3: b0 */
251, /* 164 -> FCB-GAIN 4: b0 */
54, /* 165 -> PULSE 1_1: b0 */
58, /* 166 -> PULSE 1_2: b0 */
62, /* 167 -> PULSE 1_3: b0 */
66, /* 168 -> PULSE 1_4: b0 */
106, /* 169 -> PULSE 2_1: b0 */
110, /* 170 -> PULSE 2_2: b0 */
114, /* 171 -> PULSE 2_3: b0 */
118, /* 172 -> PULSE 2_4: b0 */
161, /* 173 -> PULSE 3_1: b0 */
165, /* 174 -> PULSE 3_2: b0 */
169, /* 175 -> PULSE 3_3: b0 */
173, /* 176 -> PULSE 3_4: b0 */
213, /* 177 -> PULSE 4_1: b0 */
221, /* 178 -> PULSE 4_3: b0 */
225, /* 179 -> PULSE 4_4: b0 */
36, 37, /* 180 -> LPC 5: b1..b0 */
69, /* 182 -> PULSE 1_5: b1 */
71, 72, /* 183 -> PULSE 1_5: b1..b1 */
121, /* 185 -> PULSE 2_5: b1 */
123, 124, /* 186 -> PULSE 2_5: b1..b1 */
176, /* 188 -> PULSE 3_5: b1 */
178, 179, /* 189 -> PULSE 3_5: b1..b1 */
228, /* 191 -> PULSE 4_5: b1 */
230, 231, /* 192 -> PULSE 4_5: b1..b1 */
216, 217, /* 194 -> PULSE 4_2: b1..b0 */
70, /* 196 -> PULSE 1_5: b0 */
122, /* 197 -> PULSE 2_5: b0 */
177, /* 198 -> PULSE 3_5: b0 */
229, /* 199 -> PULSE 4_5: b0 */
73, /* 200 -> PULSE 1_6: b2 */
76, /* 201 -> PULSE 1_7: b2 */
79, /* 202 -> PULSE 1_8: b2 */
82, /* 203 -> PULSE 1_9: b2 */
85, /* 204 -> PULSE 1_10: b2 */
125, /* 205 -> PULSE 2_6: b2 */
128, /* 206 -> PULSE 2_7: b2 */
131, /* 207 -> PULSE 2_8: b2 */
134, /* 208 -> PULSE 2_9: b2 */
137, /* 209 -> PULSE 2_10: b2 */
180, /* 210 -> PULSE 3_6: b2 */
183, /* 211 -> PULSE 3_7: b2 */
186, /* 212 -> PULSE 3_8: b2 */
189, /* 213 -> PULSE 3_9: b2 */
192, /* 214 -> PULSE 3_10: b2 */
232, /* 215 -> PULSE 4_6: b2 */
235, /* 216 -> PULSE 4_7: b2 */
238, /* 217 -> PULSE 4_8: b2 */
241, /* 218 -> PULSE 4_9: b2 */
244, /* 219 -> PULSE 4_10: b2 */
74, /* 220 -> PULSE 1_6: b1 */
77, /* 221 -> PULSE 1_7: b1 */
80, /* 222 -> PULSE 1_8: b1 */
83, /* 223 -> PULSE 1_9: b1 */
86, /* 224 -> PULSE 1_10: b1 */
126, /* 225 -> PULSE 2_6: b1 */
129, /* 226 -> PULSE 2_7: b1 */
132, /* 227 -> PULSE 2_8: b1 */
135, /* 228 -> PULSE 2_9: b1 */
138, /* 229 -> PULSE 2_10: b1 */
181, /* 230 -> PULSE 3_6: b1 */
184, /* 231 -> PULSE 3_7: b1 */
187, /* 232 -> PULSE 3_8: b1 */
190, /* 233 -> PULSE 3_9: b1 */
193, /* 234 -> PULSE 3_10: b1 */
233, /* 235 -> PULSE 4_6: b1 */
236, /* 236 -> PULSE 4_7: b1 */
239, /* 237 -> PULSE 4_8: b1 */
242, /* 238 -> PULSE 4_9: b1 */
245, /* 239 -> PULSE 4_10: b1 */
75, /* 240 -> PULSE 1_6: b0 */
78, /* 241 -> PULSE 1_7: b0 */
81, /* 242 -> PULSE 1_8: b0 */
84, /* 243 -> PULSE 1_9: b0 */
87, /* 244 -> PULSE 1_10: b0 */
127, /* 245 -> PULSE 2_6: b0 */
130, /* 246 -> PULSE 2_7: b0 */
133, /* 247 -> PULSE 2_8: b0 */
136, /* 248 -> PULSE 2_9: b0 */
139, /* 249 -> PULSE 2_10: b0 */
182, /* 250 -> PULSE 3_6: b0 */
185, /* 251 -> PULSE 3_7: b0 */
188, /* 252 -> PULSE 3_8: b0 */
191, /* 253 -> PULSE 3_9: b0 */
194, /* 254 -> PULSE 3_10: b0 */
234, /* 255 -> PULSE 4_6: b0 */
237, /* 256 -> PULSE 4_7: b0 */
240, /* 257 -> PULSE 4_8: b0 */
243, /* 258 -> PULSE 4_9: b0 */
246, /* 259 -> PULSE 4_10: b0 */
};

@ -1,318 +0,0 @@
/*! \file gsm690.c
* GSM 06.90 - GSM AMR Codec. */
/*
* (C) 2010 Sylvain Munaut <tnt@246tNt.com>
*
* All Rights Reserved
*
* SPDX-License-Identifier: GPL-2.0+
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include <stdint.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <osmocom/core/utils.h>
#include <osmocom/codec/codec.h>
/*
* These table map between the raw encoder parameter output and
* the format used before channel coding. Both in GSM and in various
* file/network format (same tables used in several specs).
*/
/* AMR 12.2 kbits - subjective importance bit ordering */
/* This array encodes GSM 05.03 Table 7
* It's also TS 26.101 Table B.8
*/
const uint16_t gsm690_12_2_bitorder[244] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 23, 15, 16, 17, 18,
19, 20, 21, 22, 24, 25, 26, 27, 28, 38,