From ef1ca21e9259f10c41e9ce5b6399f8f1fd111aa9 Mon Sep 17 00:00:00 2001 From: nat Date: Sun, 25 Jun 2017 02:16:41 +0000 Subject: [PATCH] Use LINEARNTOMULAW for 8 bits as well. --- sys/dev/mulaw.c | 27 +++------------------------ sys/dev/mulaw.h | 6 +++--- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/sys/dev/mulaw.c b/sys/dev/mulaw.c index 82f25301aaf5..0de5a4e98ced 100644 --- a/sys/dev/mulaw.c +++ b/sys/dev/mulaw.c @@ -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 -__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 #include @@ -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) { diff --git a/sys/dev/mulaw.h b/sys/dev/mulaw.h index 07970a20314c..d14105bc501f 100644 --- a/sys/dev/mulaw.h +++ b/sys/dev/mulaw.h @@ -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_16_to_mulaw; #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;