Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Use LINEARNTOMULAW for 8 bits as well.



details:   https://anonhg.NetBSD.org/src/rev/dc8d0f69cd6f
branches:  trunk
changeset: 824975:dc8d0f69cd6f
user:      nat <nat%NetBSD.org@localhost>
date:      Sun Jun 25 02:16:41 2017 +0000

description:
Use LINEARNTOMULAW for 8 bits as well.

diffstat:

 sys/dev/mulaw.c |  27 +++------------------------
 sys/dev/mulaw.h |   6 +++---
 2 files changed, 6 insertions(+), 27 deletions(-)

diffs (68 lines):

diff -r 44306311f4c5 -r dc8d0f69cd6f sys/dev/mulaw.c
--- a/sys/dev/mulaw.c   Sun Jun 25 02:14:16 2017 +0000
+++ b/sys/dev/mulaw.c   Sun Jun 25 02:16:41 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mulaw.c,v 1.29 2017/06/20 07:21:50 nat Exp $   */
+/*     $NetBSD: mulaw.c,v 1.30 2017/06/25 02:16:41 nat 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.29 2017/06/20 07:21:50 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.30 2017/06/25 02:16:41 nat Exp $");
 
 #include <sys/types.h>
 #include <sys/systm.h>
@@ -406,28 +406,7 @@
 LINEARNTOMULAW(24, 32)
 LINEARNTOMULAW(24, 24)
 LINEARNTOMULAW(16, 16)
-
-DEFINE_FILTER(linear8_to_mulaw)
-{
-       stream_filter_t *this;
-       int m, err;
-
-       this = (stream_filter_t *)self;
-       if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
-               return err;
-       m = dst->end - dst->start;
-       m = min(m, max_used);
-       if (this->src->param.encoding == AUDIO_ENCODING_ULINEAR_LE) {
-               FILTER_LOOP_PROLOGUE(this->src, 1, dst, 1, m) {
-                       *d = lintomulaw[*s];
-               } FILTER_LOOP_EPILOGUE(this->src, dst);
-       } else {                /* SLINEAR_LE */
-               FILTER_LOOP_PROLOGUE(this->src, 1, dst, 1, m) {
-                       *d = lintomulaw[*s ^ 0x80];
-               } FILTER_LOOP_EPILOGUE(this->src, dst);
-       }
-       return 0;
-}
+LINEARNTOMULAW(8, 8)
 
 DEFINE_FILTER(alaw_to_linear8)
 {
diff -r 44306311f4c5 -r dc8d0f69cd6f sys/dev/mulaw.h
--- a/sys/dev/mulaw.h   Sun Jun 25 02:14:16 2017 +0000
+++ b/sys/dev/mulaw.h   Sun Jun 25 02:16:41 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mulaw.h,v 1.23 2017/06/25 02:14:16 nat Exp $   */
+/*     $NetBSD: mulaw.h,v 1.24 2017/06/25 02:16:41 nat Exp $   */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -46,8 +46,8 @@
 #define linear16_to_mulaw linear16_16_to_mulaw
 /* Convert 8-bit mu-law to/from 8 bit unsigned/signed linear. */
 extern stream_filter_factory_t mulaw_to_linear8;
-extern stream_filter_factory_t linear8_to_mulaw;
-#define linear8_8_to_mulaw linear8_to_mulaw
+extern stream_filter_factory_t linear8_8_to_mulaw;
+#define linear8_to_mulaw linear8_8_to_mulaw
 
 /* Convert 8-bit alaw to/from 32 bit unsigned/signed linear. */
 extern stream_filter_factory_t alaw_to_linear32;



Home | Main Index | Thread Index | Old Index