diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-23 23:59:22 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-23 23:59:22 +0000 |
commit | 345124bb1dcb085c967c6fdb5aea344542dc38f3 (patch) | |
tree | 1568d5fdb0673e4c97b2bc13d09534ab924aeb9b /sys/dev/mulaw.c | |
parent | c3dd54778b9a6ace1f2623d40984fdb318a44190 (diff) |
slinear to alaw converters; from netbsd, via jakemsr@jakemsr.com
Diffstat (limited to 'sys/dev/mulaw.c')
-rw-r--r-- | sys/dev/mulaw.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/sys/dev/mulaw.c b/sys/dev/mulaw.c index 3d9496b3a4f..0c7f7dcfce9 100644 --- a/sys/dev/mulaw.c +++ b/sys/dev/mulaw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mulaw.c,v 1.10 2003/06/27 00:23:43 jason Exp $ */ +/* $OpenBSD: mulaw.c,v 1.11 2004/02/23 23:59:21 deraadt Exp $ */ /* $NetBSD: mulaw.c,v 1.15 2001/01/18 20:28:20 jdolecek Exp $ */ /* @@ -40,7 +40,7 @@ #include <dev/mulaw.h> /* - * This table converts a (8 bit) mulaw value two a 16 bit value. + * This table converts a (8 bit) mu-law value two a 16 bit value. * The 16 bits are represented as an array of two bytes for easier access * to the individual bytes. */ @@ -455,6 +455,31 @@ slinear8_to_alaw(void *v, u_char *p, int cc) } } +void +slinear16_to_alaw_le(void *v, u_char *p, int cc) +{ + u_char *q = p; + + while (--cc >= 0) { + *p = lintoalaw[q[1] ^ 0x80]; + ++p; + q += 2; + } +} + + +void +slinear16_to_alaw_be(void *v, u_char *p, int cc) +{ + u_char *q = p; + + while (--cc >= 0) { + *p = lintoalaw[q[0] ^ 0x80]; + ++p; + q += 2; + } +} + /* * same as mulaw_to_ulinear16_le(), plus expand mono to stereo */ |