comparison alaw.c @ 1:3b5f5d1c5041

Initial revision
author arpi_esp
date Sat, 24 Feb 2001 20:28:24 +0000
parents
children b562c8bcf704
comparison
equal deleted inserted replaced
0:c1bb2c071d63 1:3b5f5d1c5041
1 // code from xanim sources...
2 // (I hope that not hurt copyright :o)
3
4 #define xaLONG long
5 #define xaULONG unsigned long
6 #define xaBYTE char
7 #define xaUBYTE unsigned char
8
9 xaULONG long xa_alaw_2_sign[256];
10
11 void Gen_aLaw_2_Signed()
12 { xaULONG i;
13 for(i=0;i<256;i++)
14 { xaUBYTE data = (xaUBYTE)(i);
15 xaLONG d, t, seg;
16
17 data ^= 0x55;
18
19 t = (data & 0xf) << 4;
20 seg = (data & 0x70) >> 4;
21 if (seg == 0) t += 8;
22 else if (seg == 1) t += 0x108;
23 else { t += 108; t <<= seg - 1; }
24
25 d = (data & 0x80)?(t):(-t);
26 xa_alaw_2_sign[i] = (xaULONG)((xaULONG)(d) & 0xffff);
27 }
28 }
29