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/1ae3edb1817f
branches: netbsd-8
changeset: 434539:1ae3edb1817f
user: snj <snj%NetBSD.org@localhost>
date: Tue Jan 09 19:35:03 2018 +0000
description:
Pull up following revision(s) (requested by nat in ticket #485):
sys/dev/auconv.c: 1.32-1.35
sys/dev/auconv.h: 1.20-1.21
sys/dev/mulaw.c: 1.33
sys/dev/mulaw.h: 1.25
Improve LINEAR_LINEARN macro - inparticular BE/LE conversions.
Addresses part of PR kern/52586 analyzed and reported by isaki@.
--
Allow maxused to be an odd number of bytes. This makes single byte
conversions work for the test described in the PR.
Addresses another part of PR kern/52586.
--
Remove 24 bit in a 32 bit container filters.
At present this filter did not work well and has caused problems with
the audio mixer disabled for hdaudio(4).
These filters may return when they are fixed.
--
Replace LINEARN_TO_LINEARN macro with individual optimized functions for
8, 16, 24 and 32 bits linear to linear conversions.
Addresses PR kern/52586.
--
mulaw/alaw_to_linearN macros replaced with individual faster filters.
NFC.
diffstat:
sys/dev/auconv.c | 1593 +++++++++++++++++++++++++++++++++++++++++++++++------
sys/dev/auconv.h | 17 +-
sys/dev/mulaw.c | 589 ++++++++++++-------
sys/dev/mulaw.h | 29 +-
4 files changed, 1775 insertions(+), 453 deletions(-)
diffs (truncated from 2471 to 300 lines):
diff -r b0afd7fbcf90 -r 1ae3edb1817f sys/dev/auconv.c
--- a/sys/dev/auconv.c Tue Jan 09 19:30:45 2018 +0000
+++ b/sys/dev/auconv.c Tue Jan 09 19:35:03 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auconv.c,v 1.26.2.3 2017/08/01 23:23:00 snj Exp $ */
+/* $NetBSD: auconv.c,v 1.26.2.4 2018/01/09 19:35:03 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.2.3 2017/08/01 23:23:00 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.26.2.4 2018/01/09 19:35:03 snj Exp $");
#include <sys/types.h>
#include <sys/audioio.h>
@@ -113,6 +113,7 @@
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, \
@@ -141,7 +142,6 @@
*/
static const struct conv_table s8_table[] = {
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)
@@ -151,7 +151,6 @@
{0, 0, 0, NULL, NULL}};
static const struct conv_table u8_table[] = {
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)
@@ -161,7 +160,6 @@
{0, 0, 0, NULL, NULL}};
static const struct conv_table s16le_table[] = {
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)
@@ -171,7 +169,6 @@
{0, 0, 0, NULL, NULL}};
static const struct conv_table s16be_table[] = {
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)
@@ -181,7 +178,6 @@
{0, 0, 0, NULL, NULL}};
static const struct conv_table u16le_table[] = {
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)
@@ -191,7 +187,6 @@
{0, 0, 0, NULL, NULL}};
static const struct conv_table u16be_table[] = {
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)
@@ -202,7 +197,6 @@
#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)
@@ -212,7 +206,6 @@
{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)
@@ -222,7 +215,6 @@
{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)
@@ -232,7 +224,6 @@
{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)
@@ -243,7 +234,6 @@
#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)
@@ -253,7 +243,6 @@
{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)
@@ -263,7 +252,6 @@
{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)
@@ -273,7 +261,6 @@
{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)
@@ -312,7 +299,6 @@
static const struct conv_table mulaw_table[] = {
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,
@@ -322,7 +308,6 @@
{0, 0, 0, NULL, NULL}};
static const struct conv_table alaw_table[] = {
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,
@@ -501,193 +486,1395 @@
return 0;
}
-#define LINEARN_LINEAR(n_prec, n_validbits, t_prec) \
- DEFINE_FILTER(linear##n_prec##_##n_validbits##_to_linear##t_prec)\
-{ \
- stream_filter_t *this; \
- int m, err, enc_dst, enc_src; \
- int target, valid, hw, i, j; \
- \
- hw = n_prec / NBBY; \
- valid = n_validbits / NBBY; \
- target = t_prec / NBBY; \
- this = (stream_filter_t *)self; \
- max_used = ((max_used / hw) * hw) & ~1; \
- \
- if ((err = this->prev->fetch_to(sc, this->prev, this->src, \
- max_used))) \
- return err; \
- m = (((dst->end - dst->start) / target) * target) & ~1; \
- m = min(m, max_used * hw / target); \
- enc_dst = dst->param.encoding; \
- enc_src = this->src->param.encoding; \
- if ((enc_src == AUDIO_ENCODING_SLINEAR_LE \
- && enc_dst == AUDIO_ENCODING_SLINEAR_LE) \
- || (enc_src == AUDIO_ENCODING_ULINEAR_LE \
- && enc_dst == AUDIO_ENCODING_ULINEAR_LE)) { \
- /* \
- * slinearNle -> slinearNle \
- * ulinearNle -> ulinearNle \
- */ \
- FILTER_LOOP_PROLOGUE(this->src, hw, dst, target, m) { \
- i = valid; \
- j = target; \
- if (j < i) { \
- while (j > 0) \
- d[--j] = s[--i]; \
- } else { \
- while (i > 0) \
- d[--j] = s[--i]; \
- while (j > 0) \
- d[--j] = 0; \
- } \
- } FILTER_LOOP_EPILOGUE(this->src, dst); \
- } else if ((enc_src == AUDIO_ENCODING_SLINEAR_LE \
- && enc_dst == AUDIO_ENCODING_SLINEAR_BE) \
- || (enc_src == AUDIO_ENCODING_ULINEAR_LE \
- && enc_dst == AUDIO_ENCODING_ULINEAR_BE)) { \
- /* \
- * slinearNle -> slinearNbe \
- * ulinearNle -> ulinearNbe \
- */ \
- FILTER_LOOP_PROLOGUE(this->src, hw, dst, target, m) { \
- i = valid; \
- j = target; \
- if (j < i) { \
- while (j > 0) { \
- d[--j] = s[target - i]; \
- i--; \
- } \
- } else { \
- while (j > i) \
- d[--j] = 0; \
- while (j > 0) { \
- d[--j] = s[target - i]; \
- i--; \
- } \
- } \
- } FILTER_LOOP_EPILOGUE(this->src, dst); \
- } else if ((enc_src == AUDIO_ENCODING_ULINEAR_BE \
- && enc_dst == AUDIO_ENCODING_SLINEAR_LE) \
- || (enc_src == AUDIO_ENCODING_SLINEAR_BE \
- && enc_dst == AUDIO_ENCODING_ULINEAR_LE)) { \
- /* \
- * ulinearNbe -> slinearNle \
- * slinearNbe -> ulinearNle \
- */ \
- FILTER_LOOP_PROLOGUE(this->src, hw, dst, target, m) { \
- i = valid; \
- j = target; \
- if (j < i) { \
- while (j > 0) { \
- d[--j] = s[valid - i]; \
- i--; \
- } \
- } else { \
- while (j > 0) { \
- d[--j] = s[valid - i]; \
- i--; \
- } \
- while (j > 0) \
- d[--j] = 0; \
- } \
- d[target - 1] ^= 0x80; \
- } FILTER_LOOP_EPILOGUE(this->src, dst); \
- } else if ((enc_src == AUDIO_ENCODING_SLINEAR_BE \
- && enc_dst == AUDIO_ENCODING_SLINEAR_LE) \
- || (enc_src == AUDIO_ENCODING_ULINEAR_BE \
- && enc_dst == AUDIO_ENCODING_ULINEAR_LE)) { \
- /* \
- * slinearNbe -> slinearNle \
- * ulinearNbe -> ulinearNle \
- */ \
- FILTER_LOOP_PROLOGUE(this->src, hw, dst, target, m) { \
- i = valid; \
- j = target; \
- if (j < i) { \
- while (j > 0) { \
- d[--j] = s[valid - i]; \
- i--; \
- } \
- } else { \
- while (j > 0) { \
- d[--j] = s[valid - i]; \
- i--; \
- } \
- while (j > 0) \
- d[--j] = 0; \
- } \
- } FILTER_LOOP_EPILOGUE(this->src, dst); \
- } else if ((enc_src == AUDIO_ENCODING_SLINEAR_BE \
- && enc_dst == AUDIO_ENCODING_ULINEAR_BE) \
- || (enc_src == AUDIO_ENCODING_ULINEAR_BE \
- && enc_dst == AUDIO_ENCODING_SLINEAR_BE)) { \
- /* \
- * slinearNbe -> ulinearNbe \
- * ulinearNbe -> slinearNbe \
- */ \
- FILTER_LOOP_PROLOGUE(this->src, hw, dst, target, m) { \
- i = valid; \
- j = target; \
- if (j < i) { \
- while (j > 0) { \
- d[target - j] = s[target - j]; \
- j--; \
- } \
- } else { \
- while (i > 0) { \
- d[target - j] = s[target - j]; \
- j--; \
- i--; \
- } \
- while (j > 0) \
- d[target - j] = 0; \
- } \
Home |
Main Index |
Thread Index |
Old Index