⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gsm_expl.c

📁 IP网络语音通讯软件源代码. 不可多得的语音源代码
💻 C
字号:
/*
 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
 * Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
 * details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
 */

/* $Header: n:\\development/speak_freely/GSM/GSM_EXPL.C,v 1.1.1.1 1998/10/15 00:47:39 Administrator Exp $ */

#include "private.h"
#include "gsm.h"
#include "proto.h"

int gsm_explode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target)
{
		/* GSM_MAGIC  = (*c >> 4) & 0xF; */

		if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1;

#define LARc	target

		LARc[0]  = (*c++ & 0xF) << 2;			/* 1 */
		LARc[0] |= (*c >> 6) & 0x3;
		LARc[1]  = *c++ & 0x3F;
		LARc[2]  = (*c >> 3) & 0x1F;
		LARc[3]  = (*c++ & 0x7) << 2;
		LARc[3] |= (*c >> 6) & 0x3;
		LARc[4]  = (*c >> 2) & 0xF;
		LARc[5]  = (*c++ & 0x3) << 2;
		LARc[5] |= (*c >> 6) & 0x3;
		LARc[6]  = (*c >> 3) & 0x7;
		LARc[7]  = *c++ & 0x7;

#define Nc		(target + 8)

		Nc[0]  = (*c >> 1) & 0x7F;

#define bc		(target + 9)

		bc[0]  = (*c++ & 0x1) << 1;
		bc[0] |= (*c >> 7) & 0x1;

#define Mc		(target + 10)

		Mc[0]  = (*c >> 5) & 0x3;

#define xmaxc	(target + 11)

		xmaxc[0]  = (*c++ & 0x1F) << 1;
		xmaxc[0] |= (*c >> 7) & 0x1;

#define xmc 	(target + 12)

		xmc[0]	= (*c >> 4) & 0x7;
		xmc[1]	= (*c >> 1) & 0x7;
		xmc[2]	= (*c++ & 0x1) << 2;
		xmc[2] |= (*c >> 6) & 0x3;
		xmc[3]	= (*c >> 3) & 0x7;
		xmc[4]	= *c++ & 0x7;
		xmc[5]	= (*c >> 5) & 0x7;
		xmc[6]	= (*c >> 2) & 0x7;
		xmc[7]	= (*c++ & 0x3) << 1;			/* 10 */
		xmc[7] |= (*c >> 7) & 0x1;
		xmc[8]	= (*c >> 4) & 0x7;
		xmc[9]	= (*c >> 1) & 0x7;
		xmc[10]  = (*c++ & 0x1) << 2;
		xmc[10] |= (*c >> 6) & 0x3;
		xmc[11]  = (*c >> 3) & 0x7;
		xmc[12]  = *c++ & 0x7;

#undef	Nc
#define Nc		(target + 25 - 1)

		Nc[1]  = (*c >> 1) & 0x7F;

#undef	bc
#define bc		(target + 26 - 1)

		bc[1]  = (*c++ & 0x1) << 1;
		bc[1] |= (*c >> 7) & 0x1;

#undef	Mc
#define Mc		(target + 27 - 1)

		Mc[1]  = (*c >> 5) & 0x3;

#undef	xmaxc
#define xmaxc	(target + 28 - 1)

		xmaxc[1]  = (*c++ & 0x1F) << 1;
		xmaxc[1] |= (*c >> 7) & 0x1;

#undef	xmc
#define xmc 	(target + 29 - 13)

		xmc[13]  = (*c >> 4) & 0x7;
		xmc[14]  = (*c >> 1) & 0x7;
		xmc[15]  = (*c++ & 0x1) << 2;
		xmc[15] |= (*c >> 6) & 0x3;
		xmc[16]  = (*c >> 3) & 0x7;
		xmc[17]  = *c++ & 0x7;
		xmc[18]  = (*c >> 5) & 0x7;
		xmc[19]  = (*c >> 2) & 0x7;
		xmc[20]  = (*c++ & 0x3) << 1;
		xmc[20] |= (*c >> 7) & 0x1;
		xmc[21]  = (*c >> 4) & 0x7;
		xmc[22]  = (*c >> 1) & 0x7;
		xmc[23]  = (*c++ & 0x1) << 2;
		xmc[23] |= (*c >> 6) & 0x3;
		xmc[24]  = (*c >> 3) & 0x7;
		xmc[25]  = *c++ & 0x7;

#undef	Nc
#define Nc		(target + 42 - 2) 

		Nc[2]  = (*c >> 1) & 0x7F;

#undef	bc
#define bc		(target + 43 - 2)

		bc[2]  = (*c++ & 0x1) << 1; 			/* 20 */
		bc[2] |= (*c >> 7) & 0x1;

#undef	Mc
#define Mc		(target + 44 - 2)

		Mc[2]  = (*c >> 5) & 0x3;

#undef	xmaxc
#define xmaxc	(target + 45 - 2)

		xmaxc[2]  = (*c++ & 0x1F) << 1;
		xmaxc[2] |= (*c >> 7) & 0x1;

#undef	xmc
#define xmc 	(target + 46 - 26)

		xmc[26]  = (*c >> 4) & 0x7;
		xmc[27]  = (*c >> 1) & 0x7;
		xmc[28]  = (*c++ & 0x1) << 2;
		xmc[28] |= (*c >> 6) & 0x3;
		xmc[29]  = (*c >> 3) & 0x7;
		xmc[30]  = *c++ & 0x7;
		xmc[31]  = (*c >> 5) & 0x7;
		xmc[32]  = (*c >> 2) & 0x7;
		xmc[33]  = (*c++ & 0x3) << 1;
		xmc[33] |= (*c >> 7) & 0x1;
		xmc[34]  = (*c >> 4) & 0x7;
		xmc[35]  = (*c >> 1) & 0x7;
		xmc[36]  = (*c++ & 0x1) << 2;
		xmc[36] |= (*c >> 6) & 0x3;
		xmc[37]  = (*c >> 3) & 0x7;
		xmc[38]  = *c++ & 0x7;

#undef	Nc
#define Nc		(target + 59 - 3)

		Nc[3]  = (*c >> 1) & 0x7F;

#undef	bc
#define bc		(target + 60 - 3)

		bc[3]  = (*c++ & 0x1) << 1;
		bc[3] |= (*c >> 7) & 0x1;

#undef	Mc
#define Mc		(target + 61 - 3)

		Mc[3]  = (*c >> 5) & 0x3;

#undef	xmaxc
#define xmaxc	(target + 62 - 3)

		xmaxc[3]  = (*c++ & 0x1F) << 1;
		xmaxc[3] |= (*c >> 7) & 0x1;

#undef	xmc
#define xmc 	(target + 63 - 39)

		xmc[39]  = (*c >> 4) & 0x7;
		xmc[40]  = (*c >> 1) & 0x7;
		xmc[41]  = (*c++ & 0x1) << 2;
		xmc[41] |= (*c >> 6) & 0x3;
		xmc[42]  = (*c >> 3) & 0x7;
		xmc[43]  = *c++ & 0x7;					/* 30  */
		xmc[44]  = (*c >> 5) & 0x7;
		xmc[45]  = (*c >> 2) & 0x7;
		xmc[46]  = (*c++ & 0x3) << 1;
		xmc[46] |= (*c >> 7) & 0x1;
		xmc[47]  = (*c >> 4) & 0x7;
		xmc[48]  = (*c >> 1) & 0x7;
		xmc[49]  = (*c++ & 0x1) << 2;
		xmc[49] |= (*c >> 6) & 0x3;
		xmc[50]  = (*c >> 3) & 0x7;
		xmc[51]  = *c & 0x7;					/* 33 */

		return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -