Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Add slinear16_to_mulaw_le().



details:   https://anonhg.NetBSD.org/src/rev/fd0541b6c403
branches:  trunk
changeset: 521995:fd0541b6c403
user:      kent <kent%NetBSD.org@localhost>
date:      Sun Feb 10 06:27:06 2002 +0000

description:
Add slinear16_to_mulaw_le().

diffstat:

 sys/dev/mulaw.c |  15 +++++++++++++--
 sys/dev/mulaw.h |   5 +++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diffs (57 lines):

diff -r 223c88f238df -r fd0541b6c403 sys/dev/mulaw.c
--- a/sys/dev/mulaw.c   Sun Feb 10 02:46:27 2002 +0000
+++ b/sys/dev/mulaw.c   Sun Feb 10 06:27:06 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mulaw.c,v 1.18 2001/11/13 05:32:50 lukem Exp $ */
+/*     $NetBSD: mulaw.c,v 1.19 2002/02/10 06:27:06 kent Exp $  */
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.18 2001/11/13 05:32:50 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.19 2002/02/10 06:27:06 kent Exp $");
 
 #include <sys/types.h>
 #include <sys/audioio.h>
@@ -331,6 +331,17 @@
 }
 
 void
+slinear16_to_mulaw_le(void *v, u_char* p, int cc)
+{
+       u_char *q = p + 1;      /* q points higher byte. */
+
+       while (--cc >= 0) {
+               *p++ = lintomulaw[*q ^ 0x80];
+               q +=2 ;
+       }
+}
+
+void
 ulinear8_to_mulaw(void *v, u_char *p, int cc)
 {
        while (--cc >= 0) {
diff -r 223c88f238df -r fd0541b6c403 sys/dev/mulaw.h
--- a/sys/dev/mulaw.h   Sun Feb 10 02:46:27 2002 +0000
+++ b/sys/dev/mulaw.h   Sun Feb 10 06:27:06 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mulaw.h,v 1.12 2001/10/02 23:31:55 augustss Exp $      */
+/*     $NetBSD: mulaw.h,v 1.13 2002/02/10 06:27:06 kent Exp $  */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -39,9 +39,10 @@
 /* Convert 8-bit mu-law to 16 bit unsigned linear. */
 extern void mulaw_to_ulinear16_le(void *, u_char *buf, int cnt);
 extern void mulaw_to_ulinear16_be(void *, u_char *buf, int cnt);
-/* Convert 8-bit mu-law to 16 bit signed linear. */
+/* Convert 8-bit mu-law from/to 16 bit signed linear. */
 extern void mulaw_to_slinear16_le(void *, u_char *buf, int cnt);
 extern void mulaw_to_slinear16_be(void *, u_char *buf, int cnt);
+extern void slinear16_to_mulaw_le(void *, u_char *buf, int cnt);
 /* Convert 8-bit mu-law to/from 8 bit unsigned linear. */
 extern void mulaw_to_ulinear8(void *, u_char *buf, int cnt);
 extern void ulinear8_to_mulaw(void *, u_char *buf, int cnt);



Home | Main Index | Thread Index | Old Index