summaryrefslogtreecommitdiff
path: root/sys/dev/mulaw.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/mulaw.c')
-rw-r--r--sys/dev/mulaw.c29
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
*/