Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev Pull up following revision(s) (requested by nat i...



details:   https://anonhg.NetBSD.org/src/rev/2370731184e8
branches:  netbsd-8
changeset: 850767:2370731184e8
user:      snj <snj%NetBSD.org@localhost>
date:      Fri Jun 30 06:38:00 2017 +0000

description:
Pull up following revision(s) (requested by nat in ticket #70):
        sys/dev/auconv.c: 1.27, 1.28
        sys/dev/mulaw.c: 1.29, 1.30
        sys/dev/mulaw.h: revision 1.21-1.24
        sys/dev/auconv.h: 1.17, 1.18
Add support for more formats.  At present 24 bit formats do not work and
have been disabled.
Ok christos@.
--
Fix defines to proper function names.
--
comment out unused variables.
--
Remove stray ";" from defines.
--
Use LINEARNTOMULAW for 8 bits as well.

diffstat:

 sys/dev/auconv.c |  559 +++++++++++++++++++++++++++++++++++++-----------------
 sys/dev/auconv.h |   28 ++-
 sys/dev/mulaw.c  |  385 +++++++++++++++++++++----------------
 sys/dev/mulaw.h  |   29 ++-
 4 files changed, 652 insertions(+), 349 deletions(-)

diffs (truncated from 1159 to 300 lines):

diff -r 0b739415349b -r 2370731184e8 sys/dev/auconv.c
--- a/sys/dev/auconv.c  Fri Jun 30 06:34:20 2017 +0000
+++ b/sys/dev/auconv.c  Fri Jun 30 06:38:00 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auconv.c,v 1.26 2017/06/01 09:44:30 pgoyette Exp $     */
+/*     $NetBSD: auconv.c,v 1.26.2.1 2017/06/30 06:38:00 snj Exp $      */
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.26 2017/06/01 09:44:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.26.2.1 2017/06/30 06:38:00 snj Exp $");
 
 #include <sys/types.h>
 #include <sys/audioio.h>
@@ -113,86 +113,218 @@
        stream_filter_factory_t *play_conv;
        stream_filter_factory_t *rec_conv;
 };
+#define TABLE_LIST(prec, valid, target)                                \
+       {AUDIO_ENCODING_SLINEAR_LE, prec, valid,                        \
+        linear##target##_##target##_to_linear##prec,                   \
+               linear##prec##_##valid##_to_linear##target},            \
+       {AUDIO_ENCODING_SLINEAR_BE, prec, valid,                        \
+        linear##target##_##target##_to_linear##prec,                   \
+               linear##prec##_##valid##_to_linear##target},            \
+       {AUDIO_ENCODING_ULINEAR_LE, prec, valid,                        \
+        linear##target##_##target##_to_linear##prec,                   \
+               linear##prec##_##valid##_to_linear##target},            \
+       {AUDIO_ENCODING_ULINEAR_BE, prec, valid,                        \
+        linear##target##_##target##_to_linear##prec,                   \
+               linear##prec##_##valid##_to_linear##target},
+#if NMULAW > 0
+#define MULAW_TABLE(prec, valid, target)                               \
+       {AUDIO_ENCODING_ULAW, 8, 8,                                     \
+        linear##prec##_##valid##_to_mulaw,                             \
+        mulaw_to_linear##target},                                      \
+       {AUDIO_ENCODING_ALAW, 8, 8,                                     \
+        linear##prec##_##valid##_to_alaw,                              \
+        alaw_to_linear##target},
+#endif
 /*
  * SLINEAR-16 or SLINEAR-24 should precede in a table because
  * aurateconv supports only SLINEAR.
  */
 static const struct conv_table s8_table[] = {
-       {AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-        linear8_to_linear16, linear16_to_linear8},
-       {AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-        linear8_to_linear16, linear16_to_linear8},
-       {AUDIO_ENCODING_ULINEAR_LE, 8, 8,
-        change_sign8, change_sign8},
+       TABLE_LIST(32, 32, 8)
+       TABLE_LIST(24, 32, 8)
+       TABLE_LIST(24, 24, 8)
+       TABLE_LIST(16, 16, 8)
+       TABLE_LIST(8, 8, 8)
+#if NMULAW > 0
+       MULAW_TABLE(8, 8, 8)
+#endif
        {0, 0, 0, NULL, NULL}};
 static const struct conv_table u8_table[] = {
-       {AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-        linear8_to_linear16, linear16_to_linear8},
-       {AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-        linear8_to_linear16, linear16_to_linear8},
-       {AUDIO_ENCODING_SLINEAR_LE, 8, 8,
-        change_sign8, change_sign8},
-       {AUDIO_ENCODING_ULINEAR_LE, 16, 16,
-        linear8_to_linear16, linear16_to_linear8},
-       {AUDIO_ENCODING_ULINEAR_BE, 16, 16,
-        linear8_to_linear16, linear16_to_linear8},
+       TABLE_LIST(32, 32, 8)
+       TABLE_LIST(24, 32, 8)
+       TABLE_LIST(24, 24, 8)
+       TABLE_LIST(16, 16, 8)
+       TABLE_LIST(8, 8, 8)
+#if NMULAW > 0
+       MULAW_TABLE(8, 8, 8)
+#endif
        {0, 0, 0, NULL, NULL}};
 static const struct conv_table s16le_table[] = {
-       {AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-        swap_bytes, swap_bytes},
-       {AUDIO_ENCODING_ULINEAR_LE, 16, 16,
-        change_sign16, change_sign16},
-       {AUDIO_ENCODING_ULINEAR_BE, 16, 16,
-        swap_bytes_change_sign16, swap_bytes_change_sign16},
+       TABLE_LIST(32, 32, 16)
+       TABLE_LIST(24, 32, 16)
+       TABLE_LIST(24, 24, 16)
+       TABLE_LIST(16, 16, 16)
+       TABLE_LIST(8, 8, 16)
+#if NMULAW > 0
+       MULAW_TABLE(16, 16, 16)
+#endif
        {0, 0, 0, NULL, NULL}};
 static const struct conv_table s16be_table[] = {
-       {AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-        swap_bytes, swap_bytes},
-       {AUDIO_ENCODING_ULINEAR_BE, 16, 16,
-        change_sign16, change_sign16},
-       {AUDIO_ENCODING_ULINEAR_LE, 16, 16,
-        swap_bytes_change_sign16, swap_bytes_change_sign16},
+       TABLE_LIST(32, 32, 16)
+       TABLE_LIST(24, 32, 16)
+       TABLE_LIST(24, 24, 16)
+       TABLE_LIST(16, 16, 16)
+       TABLE_LIST(8, 8, 16)
+#if NMULAW > 0
+       MULAW_TABLE(16, 16, 16)
+#endif
        {0, 0, 0, NULL, NULL}};
 static const struct conv_table u16le_table[] = {
-       {AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-        change_sign16, change_sign16},
-       {AUDIO_ENCODING_ULINEAR_BE, 16, 16,
-        swap_bytes, swap_bytes},
-       {AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-        swap_bytes_change_sign16, swap_bytes_change_sign16},
+       TABLE_LIST(32, 32, 16)
+       TABLE_LIST(24, 32, 16)
+       TABLE_LIST(24, 24, 16)
+       TABLE_LIST(16, 16, 16)
+       TABLE_LIST(8, 8, 16)
+#if NMULAW > 0
+       MULAW_TABLE(16, 16, 16)
+#endif
        {0, 0, 0, NULL, NULL}};
 static const struct conv_table u16be_table[] = {
-       {AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-        change_sign16, change_sign16},
-       {AUDIO_ENCODING_ULINEAR_LE, 16, 16,
-        swap_bytes, swap_bytes},
-       {AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-        swap_bytes_change_sign16, swap_bytes_change_sign16},
+       TABLE_LIST(32, 32, 16)
+       TABLE_LIST(24, 32, 16)
+       TABLE_LIST(24, 24, 16)
+       TABLE_LIST(16, 16, 16)
+       TABLE_LIST(8, 8, 16)
+#if NMULAW > 0
+       MULAW_TABLE(16, 16, 16)
+#endif
+       {0, 0, 0, NULL, NULL}};
+#ifdef notdef
+static const struct conv_table s24le_table[] = {
+       TABLE_LIST(32, 32, 24)
+       TABLE_LIST(24, 32, 24)
+       TABLE_LIST(24, 24, 24)
+       TABLE_LIST(16, 16, 24)
+       TABLE_LIST(8, 8, 24)
+#if NMULAW > 0
+       MULAW_TABLE(24, 24, 24)
+#endif
+       {0, 0, 0, NULL, NULL}};
+static const struct conv_table s24be_table[] = {
+       TABLE_LIST(32, 32, 24)
+       TABLE_LIST(24, 32, 24)
+       TABLE_LIST(24, 24, 24)
+       TABLE_LIST(16, 16, 24)
+       TABLE_LIST(8, 8, 24)
+#if NMULAW > 0
+       MULAW_TABLE(24, 24, 24)
+#endif
+       {0, 0, 0, NULL, NULL}};
+static const struct conv_table u24le_table[] = {
+       TABLE_LIST(32, 32, 24)
+       TABLE_LIST(24, 32, 24)
+       TABLE_LIST(24, 24, 24)
+       TABLE_LIST(16, 16, 24)
+       TABLE_LIST(8, 8, 24)
+#if NMULAW > 0
+       MULAW_TABLE(24, 24, 24)
+#endif
+       {0, 0, 0, NULL, NULL}};
+static const struct conv_table u24be_table[] = {
+       TABLE_LIST(32, 32, 24)
+       TABLE_LIST(24, 32, 24)
+       TABLE_LIST(24, 24, 24)
+       TABLE_LIST(16, 16, 24)
+       TABLE_LIST(8, 8, 24)
+#if NMULAW > 0
+       MULAW_TABLE(24, 24, 24)
+#endif
+       {0, 0, 0, NULL, NULL}};
+#endif
+static const struct conv_table s32le_table[] = {
+       TABLE_LIST(32, 32, 32)
+       TABLE_LIST(24, 32, 32)
+       TABLE_LIST(24, 24, 32)
+       TABLE_LIST(16, 16, 32)
+       TABLE_LIST(8, 8, 32)
+#if NMULAW > 0
+       MULAW_TABLE(32, 32, 32)
+#endif
+       {0, 0, 0, NULL, NULL}};
+static const struct conv_table s32be_table[] = {
+       TABLE_LIST(32, 32, 32)
+       TABLE_LIST(24, 32, 32)
+       TABLE_LIST(24, 24, 32)
+       TABLE_LIST(16, 16, 32)
+       TABLE_LIST(8, 8, 32)
+#if NMULAW > 0
+       MULAW_TABLE(32, 32, 32)
+#endif
+       {0, 0, 0, NULL, NULL}};
+static const struct conv_table u32le_table[] = {
+       TABLE_LIST(32, 32, 32)
+       TABLE_LIST(24, 32, 32)
+       TABLE_LIST(24, 24, 32)
+       TABLE_LIST(16, 16, 32)
+       TABLE_LIST(8, 8, 32)
+#if NMULAW > 0
+       MULAW_TABLE(32, 32, 32)
+#endif
+       {0, 0, 0, NULL, NULL}};
+static const struct conv_table u32be_table[] = {
+       TABLE_LIST(32, 32, 32)
+       TABLE_LIST(24, 32, 32)
+       TABLE_LIST(24, 24, 32)
+       TABLE_LIST(16, 16, 32)
+       TABLE_LIST(8, 8, 32)
+#if NMULAW > 0
+       MULAW_TABLE(32, 32, 32)
+#endif
        {0, 0, 0, NULL, NULL}};
 #if NMULAW > 0
+#define MULAW_LIST(prec, valid, target)                                \
+       {AUDIO_ENCODING_SLINEAR_LE, prec, valid,                        \
+        mulaw_to_linear##target,                                       \
+        linear##prec##_##valid##_to_mulaw},                            \
+       {AUDIO_ENCODING_SLINEAR_BE, prec, valid,                        \
+        mulaw_to_linear##target,                                       \
+        linear##prec##_##valid##_to_mulaw},                            \
+       {AUDIO_ENCODING_ULINEAR_LE, prec, valid,                        \
+        mulaw_to_linear##target,                                       \
+        linear##prec##_##valid##_to_mulaw},                            \
+       {AUDIO_ENCODING_ULINEAR_BE, prec, valid,                        \
+        mulaw_to_linear##target,                                       \
+        linear##prec##_##valid##_to_mulaw},
+
+#define ALAW_LIST(prec, valid, target)                                         \
+       {AUDIO_ENCODING_SLINEAR_LE, prec, valid,                        \
+        alaw_to_linear##target,                                        \
+        linear##prec##_##valid##_to_alaw},                             \
+       {AUDIO_ENCODING_SLINEAR_BE, prec, valid,                        \
+        alaw_to_linear##target,                                        \
+        linear##prec##_##valid##_to_alaw},                             \
+       {AUDIO_ENCODING_ULINEAR_LE, prec, valid,                        \
+        alaw_to_linear##target,                                        \
+        linear##prec##_##valid##_to_alaw},                             \
+       {AUDIO_ENCODING_ULINEAR_BE, prec, valid,                        \
+        alaw_to_linear##target,                                        \
+        linear##prec##_##valid##_to_alaw},
+
 static const struct conv_table mulaw_table[] = {
-       {AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-        mulaw_to_linear16, linear16_to_mulaw},
-       {AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-        mulaw_to_linear16, linear16_to_mulaw},
-       {AUDIO_ENCODING_ULINEAR_LE, 16, 16,
-        mulaw_to_linear16, linear16_to_mulaw},
-       {AUDIO_ENCODING_ULINEAR_BE, 16, 16,
-        mulaw_to_linear16, linear16_to_mulaw},
+       MULAW_LIST(32, 32, 32)
+       MULAW_LIST(24, 32, 24)
+       MULAW_LIST(24, 24, 24)
+       MULAW_LIST(16, 16, 16)
        {AUDIO_ENCODING_SLINEAR_LE, 8, 8,
         mulaw_to_linear8, linear8_to_mulaw},
        {AUDIO_ENCODING_ULINEAR_LE, 8, 8,
         mulaw_to_linear8, linear8_to_mulaw},
        {0, 0, 0, NULL, NULL}};
 static const struct conv_table alaw_table[] = {
-       {AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-        alaw_to_linear16, linear16_to_alaw},
-       {AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-        alaw_to_linear16, linear16_to_alaw},
-       {AUDIO_ENCODING_ULINEAR_LE, 16, 16,
-        alaw_to_linear16, linear16_to_alaw},
-       {AUDIO_ENCODING_ULINEAR_BE, 16, 16,
-        alaw_to_linear16, linear16_to_alaw},
+       ALAW_LIST(32, 32, 32)
+       ALAW_LIST(24, 32, 24)
+       ALAW_LIST(24, 24, 24)
+       ALAW_LIST(16, 16, 16)
        {AUDIO_ENCODING_SLINEAR_LE, 8, 8,
         alaw_to_linear8, linear8_to_alaw},
        {AUDIO_ENCODING_ULINEAR_LE, 8, 8,
@@ -351,124 +483,193 @@
        return 0;
 }
 
-DEFINE_FILTER(linear8_to_linear16)
-{
-       stream_filter_t *this;



Home | Main Index | Thread Index | Old Index