annotate alaw.c @ 576:5cbbf47cae1e

fastmemcpy benchmark by Felix Buenemann
author arpi_esp
date Sun, 22 Apr 2001 16:09:23 +0000
parents 3b5f5d1c5041
children b562c8bcf704
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 // code from xanim sources...
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 // (I hope that not hurt copyright :o)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 #define xaLONG long
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 #define xaULONG unsigned long
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 #define xaBYTE char
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 #define xaUBYTE unsigned char
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 xaULONG long xa_alaw_2_sign[256];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 void Gen_aLaw_2_Signed()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 { xaULONG i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 for(i=0;i<256;i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 { xaUBYTE data = (xaUBYTE)(i);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 xaLONG d, t, seg;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 data ^= 0x55;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 t = (data & 0xf) << 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 seg = (data & 0x70) >> 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 if (seg == 0) t += 8;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 else if (seg == 1) t += 0x108;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 else { t += 108; t <<= seg - 1; }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 d = (data & 0x80)?(t):(-t);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 xa_alaw_2_sign[i] = (xaULONG)((xaULONG)(d) & 0xffff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29