Module Name:    src
Committed By:   nat
Date:           Sun Jun 25 02:16:41 UTC 2017

Modified Files:
        src/sys/dev: mulaw.c mulaw.h

Log Message:
Use LINEARNTOMULAW for 8 bits as well.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/mulaw.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/mulaw.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mulaw.c
diff -u src/sys/dev/mulaw.c:1.29 src/sys/dev/mulaw.c:1.30
--- src/sys/dev/mulaw.c:1.29	Tue Jun 20 07:21:50 2017
+++ src/sys/dev/mulaw.c	Sun Jun 25 02:16:41 2017
@@ -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(32, 32)
 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)
 {

Index: src/sys/dev/mulaw.h
diff -u src/sys/dev/mulaw.h:1.23 src/sys/dev/mulaw.h:1.24
--- src/sys/dev/mulaw.h:1.23	Sun Jun 25 02:14:16 2017
+++ src/sys/dev/mulaw.h	Sun Jun 25 02:16:41 2017
@@ -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 @@ extern stream_filter_factory_t linear16_
 #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;

Reply via email to