view libgsmefr/frame2params.c @ 540:5595293e4f29

gsmx-to-tw5a utility: use emit_hex_frame() in libtest
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 22 Sep 2024 00:36:35 +0000
parents 4ae1dd43e332
children
line wrap: on
line source

/*
 * In this module we implement our EFR_frame2params() unpacking function.
 */

#include "gsm_efr.h"

void EFR_frame2params(const uint8_t *frame, int16_t *params)
{
	const uint8_t *c = frame;

	/* EFR_MAGIC  = (*c >> 4) & 0xF; */
	params[0]  = (*c++ & 0xF) << 3;
	params[0] |= (*c >> 5) & 0x7;
	params[1]  = (*c++ & 0x1F) << 3;
	params[1] |= (*c >> 5) & 0x7;
	params[2]  = (*c++ & 0x1F) << 4;
	params[2] |= (*c >> 4) & 0xF;
	params[3]  = (*c++ & 0xF) << 4;
	params[3] |= (*c >> 4) & 0xF;
	params[4]  = (*c++ & 0xF) << 2;
	params[4] |= (*c >> 6) & 0x3;
	params[5]  = (*c++ & 0x3F) << 3;
	params[5] |= (*c >> 5) & 0x7;
	params[6]  = (*c >> 1) & 0xF;
	params[7]  = (*c++ & 0x1) << 3;
	params[7] |= (*c >> 5) & 0x7;
	params[8]  = (*c >> 1) & 0xF;
	params[9]  = (*c++ & 0x1) << 3;
	params[9] |= (*c >> 5) & 0x7;
	params[10]  = (*c >> 1) & 0xF;
	params[11]  = (*c++ & 0x1) << 3;
	params[11] |= (*c >> 5) & 0x7;
	params[12]  = (*c >> 2) & 0x7;
	params[13]  = (*c++ & 0x3) << 1;
	params[13] |= (*c >> 7) & 0x1;
	params[14]  = (*c >> 4) & 0x7;
	params[15]  = (*c >> 1) & 0x7;
	params[16]  = (*c++ & 0x1) << 2;
	params[16] |= (*c >> 6) & 0x3;
	params[17]  = (*c >> 1) & 0x1F;
	params[18]  = (*c++ & 0x1) << 5;
	params[18] |= (*c >> 3) & 0x1F;
	params[19]  = (*c++ & 0x7) << 1;
	params[19] |= (*c >> 7) & 0x1;
	params[20]  = (*c >> 3) & 0xF;
	params[21]  = (*c++ & 0x7) << 1;
	params[21] |= (*c >> 7) & 0x1;
	params[22]  = (*c >> 3) & 0xF;
	params[23]  = (*c++ & 0x7) << 1;
	params[23] |= (*c >> 7) & 0x1;
	params[24]  = (*c >> 3) & 0xF;
	params[25]  = *c++ & 0x7;
	params[26]  = (*c >> 5) & 0x7;
	params[27]  = (*c >> 2) & 0x7;
	params[28]  = (*c++ & 0x3) << 1;
	params[28] |= (*c >> 7) & 0x1;
	params[29]  = (*c >> 4) & 0x7;
	params[30]  = (*c++ & 0xF) << 1;
	params[30] |= (*c >> 7) & 0x1;
	params[31]  = (*c++ & 0x7F) << 2;
	params[31] |= (*c >> 6) & 0x3;
	params[32]  = (*c >> 2) & 0xF;
	params[33]  = (*c++ & 0x3) << 2;
	params[33] |= (*c >> 6) & 0x3;
	params[34]  = (*c >> 2) & 0xF;
	params[35]  = (*c++ & 0x3) << 2;
	params[35] |= (*c >> 6) & 0x3;
	params[36]  = (*c >> 2) & 0xF;
	params[37]  = (*c++ & 0x3) << 2;
	params[37] |= (*c >> 6) & 0x3;
	params[38]  = (*c >> 3) & 0x7;
	params[39]  = *c++ & 0x7;
	params[40]  = (*c >> 5) & 0x7;
	params[41]  = (*c >> 2) & 0x7;
	params[42]  = (*c++ & 0x3) << 1;
	params[42] |= (*c >> 7) & 0x1;
	params[43]  = (*c >> 2) & 0x1F;
	params[44]  = (*c++ & 0x3) << 4;
	params[44] |= (*c >> 4) & 0xF;
	params[45]  = *c++ & 0xF;
	params[46]  = (*c >> 4) & 0xF;
	params[47]  = *c++ & 0xF;
	params[48]  = (*c >> 4) & 0xF;
	params[49]  = *c++ & 0xF;
	params[50]  = (*c >> 4) & 0xF;
	params[51]  = (*c >> 1) & 0x7;
	params[52]  = (*c++ & 0x1) << 2;
	params[52] |= (*c >> 6) & 0x3;
	params[53]  = (*c >> 3) & 0x7;
	params[54]  = *c++ & 0x7;
	params[55]  = (*c >> 5) & 0x7;
	params[56]  = *c++ & 0x1F;
}