voici une fonction qui convertie un buffeur audio sous forme G.711 (utiliser dans la voix sur ip )en buffeur linear pcm cet fonction est développer par Sun Microsystems
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <unistd.h>
#include <netinet/in_systm.h>
#define	SIGN_BIT	(0x80)		/* Sign bit for a A-law byte. */
#define	QUANT_MASK	(0xf)		/* Quantization field mask. */
#define	NSEGS		(8)		/* Number of A-law segments. */
#define	SEG_SHIFT	(4)		/* Left shift for segment number. */
#define	SEG_MASK	(0x70)		/* Segment field mask. */
 
#define	BIAS		(0x84)		/* Bias for linear code. */
#define CLIP            8159
 short int
ulaw2linear(	unsigned char u_val)
{
	int	t;
 
	/* Complement to obtain normal u-law value. */
	u_val = ~u_val;
 
	/*
	 * Extract and bias the quantization bits. Then
	 * shift up by the segment number and subtract out the bias.
	 */
	t = ((u_val & QUANT_MASK) << 3) + BIAS;
	t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT;
 
	return ((u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS));
}
mon problème est que j'arrive pas a comprendre les 3 dernier instruction
quelqu'un peut m'expliquer ces 3 instruction ?
merci d'avance !