view trau-decode/parse-fr-common.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 d4ee42801cdc
children
line wrap: on
line source

/*
 * This module contains a bit of code that has been factored out of
 * trau-parse and tfo-parse-fr16 programs; it handles FR and EFR codecs.
 */

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>

static void
collect_d_bits(frame_bits, d_bits)
	uint8_t *frame_bits, *d_bits;
{
	bcopy(frame_bits + 33, d_bits, 15);
	bcopy(frame_bits + 49, d_bits + 15, 15);
	bcopy(frame_bits + 65, d_bits + 30, 15);
	bcopy(frame_bits + 81, d_bits + 45, 15);
	bcopy(frame_bits + 97, d_bits + 60, 15);
	bcopy(frame_bits + 113, d_bits + 75, 15);
	bcopy(frame_bits + 129, d_bits + 90, 15);
	bcopy(frame_bits + 145, d_bits + 105, 15);
	bcopy(frame_bits + 161, d_bits + 120, 15);
	bcopy(frame_bits + 177, d_bits + 135, 15);
	bcopy(frame_bits + 193, d_bits + 150, 15);
	bcopy(frame_bits + 209, d_bits + 165, 15);
	bcopy(frame_bits + 225, d_bits + 180, 15);
	bcopy(frame_bits + 241, d_bits + 195, 15);
	bcopy(frame_bits + 257, d_bits + 210, 15);
	bcopy(frame_bits + 273, d_bits + 225, 15);
	bcopy(frame_bits + 289, d_bits + 240, 15);
	bcopy(frame_bits + 305, d_bits + 255, 5);
}

void
print_fr_efr_frame(frame_bits, c1_5)
	uint8_t *frame_bits;
	unsigned c1_5;
{
	uint8_t d_bits[260];

	switch (c1_5) {
	case 0x02:
	case 0x1C:
		collect_d_bits(frame_bits, d_bits);
		print_fr_frame(d_bits);
		break;
	case 0x1A:
		collect_d_bits(frame_bits, d_bits);
		check_efr_crc(d_bits);
		print_efr_frame(d_bits);
		break;
	}
}