summaryrefslogtreecommitdiffstats
path: root/alaw.c
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-02-24 20:28:24 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-02-24 20:28:24 +0000
commitd34041569e71fc9bd772354e94dc9d16061072a5 (patch)
tree8f481cae1c70f32d1756fbe5f39000577b73042d /alaw.c
parente95a95ece09bac96bdfd37322f96c6f57ef79ebc (diff)
downloadmpv-d34041569e71fc9bd772354e94dc9d16061072a5.tar.bz2
mpv-d34041569e71fc9bd772354e94dc9d16061072a5.tar.xz
Initial revision
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'alaw.c')
-rw-r--r--alaw.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/alaw.c b/alaw.c
new file mode 100644
index 0000000000..de8c43962c
--- /dev/null
+++ b/alaw.c
@@ -0,0 +1,29 @@
+// code from xanim sources...
+// (I hope that not hurt copyright :o)
+
+#define xaLONG long
+#define xaULONG unsigned long
+#define xaBYTE char
+#define xaUBYTE unsigned char
+
+xaULONG long xa_alaw_2_sign[256];
+
+void Gen_aLaw_2_Signed()
+{ xaULONG i;
+ for(i=0;i<256;i++)
+ { xaUBYTE data = (xaUBYTE)(i);
+ xaLONG d, t, seg;
+
+ data ^= 0x55;
+
+ t = (data & 0xf) << 4;
+ seg = (data & 0x70) >> 4;
+ if (seg == 0) t += 8;
+ else if (seg == 1) t += 0x108;
+ else { t += 108; t <<= seg - 1; }
+
+ d = (data & 0x80)?(t):(-t);
+ xa_alaw_2_sign[i] = (xaULONG)((xaULONG)(d) & 0xffff);
+ }
+}
+