FreeCalypso > hg > gsm-net-reveng
view trau-decode/parse-fr.c @ 94:f9ef582c199c
tfo-ut: check in tfo-fr.bin and tfo-efr.bin
Each of these binary files is an extract from MSC-side E1 timeslot
recording in a Nokia TCSM2 TFO session involving a cross-connect
between two TRAU channels. The extracts have been chosen to begin
at the point where the TRAU starts emitting TFO frames, thereby
beginning with a series of TFO frames that contain an embedded
TFO_TRANS message. In each experiment, one of the two cross-connected
TRAU channels emitted two "plain" TFO frames (not containing embedded
TFO messages) in between the initial embedded TFO_TRANS and the
subsequent embedded TFO_REQ_L; this channel was chosen for the
present extracts. Each extract is thus 2560 PCM samples, containing
16 aligned TFO frames: 5 carrying TFO_TRANS, 2 plain, 9 carrying
TFO_REQ_L.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Tue, 18 Mar 2025 22:56:23 +0000 |
| parents | 64b15810dc4c |
| children |
line wrap: on
line source
/* * This module implements the FR decoding part of trau-parse. */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <tw_gsmfr.h> /* this corresponds to the bit-lengths of the individual codec * parameters as indicated in Table 1.1 of TS 46.010 */ static const uint8_t gsm_fr_map[GSMFR_NUM_PARAMS] = { 6, 6, 5, 5, 4, 4, 3, 3, 7, 2, 2, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 2, 2, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 2, 2, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 2, 2, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; static unsigned get_le(bits, nbits) uint8_t *bits; unsigned nbits; { unsigned accum, mask; unsigned n; accum = 0; mask = 1; for (n = 0; n < nbits; n++) { if (*bits) accum |= mask; bits++; mask <<= 1; } return accum; } static void dbits_to_params(d_bits, params) uint8_t *d_bits; int16_t *params; { unsigned np, len; uint8_t *ip; int16_t *op; ip = d_bits; op = params; for (np = 0; np < GSMFR_NUM_PARAMS; np++) { len = gsm_fr_map[np]; *op++ = get_le(ip, len); ip += len; } } void print_fr_frame(d_bits) uint8_t *d_bits; { int16_t params[GSMFR_NUM_PARAMS]; uint8_t rtp_pack[GSMFR_RTP_FRAME_LEN]; int i, j, n, sid; dbits_to_params(d_bits, params); fputs(" FR frame:\n LARc", stdout); n = 0; for (i = 0; i < 8; i++) printf(" %d", params[n++]); putchar('\n'); for (i = 0; i < 4; i++) { fputs(" ", stdout); for (j = 0; j < 17; j++) printf(" %d", params[n++]); putchar('\n'); } gsmfr_pack_from_array(params, rtp_pack); sid = gsmfr_preproc_sid_classify(rtp_pack); printf(" SID recompute: %d\n", sid); if (!bcmp(rtp_pack, gsmfr_decoder_homing_frame, GSMFR_RTP_FRAME_LEN)) puts(" Matches DHF"); }
