Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144297550
D47932.id147532.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
32 KB
Referenced Files
None
Subscribers
None
D47932.id147532.diff
View Options
diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h
--- a/sys/dev/sound/pcm/feeder.h
+++ b/sys/dev/sound/pcm/feeder.h
@@ -167,8 +167,7 @@
typedef intpcm_t intpcm_read_t(uint8_t *);
typedef void intpcm_write_t(uint8_t *, intpcm_t);
-intpcm_read_t *feeder_format_read_op(uint32_t);
-intpcm_write_t *feeder_format_write_op(uint32_t);
+int feeder_format_getshift(uint32_t);
/* 4Front OSS stuffs */
int feeder_matrix_oss_get_channel_order(struct pcmchan_matrix *,
diff --git a/sys/dev/sound/pcm/feeder_eq.c b/sys/dev/sound/pcm/feeder_eq.c
--- a/sys/dev/sound/pcm/feeder_eq.c
+++ b/sys/dev/sound/pcm/feeder_eq.c
@@ -153,9 +153,9 @@
dst += j * PCM_##BIT##_BPS; \
do { \
dst -= PCM_##BIT##_BPS; \
- v = _PCM_READ_##SIGN##BIT##_##ENDIAN(dst); \
+ v = pcm_sample_read(dst, AFMT_##SIGN##BIT##_##ENDIAN); \
v = ((intpcm64_t)pmul * v) >> pshift; \
- _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, v); \
+ pcm_sample_write(dst, v, AFMT_##SIGN##BIT##_##ENDIAN); \
} while (--j != 0); \
\
return; \
@@ -168,7 +168,7 @@
i = 0; \
j = info->channels; \
do { \
- v = _PCM_READ_##SIGN##BIT##_##ENDIAN(dst); \
+ v = pcm_sample_read(dst, AFMT_##SIGN##BIT##_##ENDIAN); \
v <<= 32 - BIT; \
v = ((intpcm64_t)pmul * v) >> pshift; \
\
@@ -199,7 +199,7 @@
info->bass.o1[i] = v; \
\
v >>= 32 - BIT; \
- _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, v); \
+ pcm_sample_write(dst, v, AFMT_##SIGN##BIT##_##ENDIAN); \
dst += PCM_##BIT##_BPS; \
i++; \
} while (--j != 0); \
diff --git a/sys/dev/sound/pcm/feeder_format.c b/sys/dev/sound/pcm/feeder_format.c
--- a/sys/dev/sound/pcm/feeder_format.c
+++ b/sys/dev/sound/pcm/feeder_format.c
@@ -43,76 +43,11 @@
struct feed_format_info {
uint32_t ibps, obps;
uint32_t ialign, oalign, channels;
- intpcm_read_t *read;
- intpcm_write_t *write;
+ uint32_t rdfmt, wrfmt;
+ int rdshift, wrshift;
uint8_t reservoir[FEEDFORMAT_RESERVOIR];
};
-#define INTPCM_DECLARE_OP_WRITE(SIGN, BIT, ENDIAN, SHIFT) \
-static __inline void \
-intpcm_write_##SIGN##BIT##ENDIAN(uint8_t *dst, intpcm_t v) \
-{ \
- \
- _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, v >> SHIFT); \
-}
-
-#define INTPCM_DECLARE_OP_8(SIGN, ENDIAN) \
-static __inline intpcm_t \
-intpcm_read_##SIGN##8##ENDIAN(uint8_t *src) \
-{ \
- \
- return (_PCM_READ_##SIGN##8##_##ENDIAN(src) << 24); \
-} \
-INTPCM_DECLARE_OP_WRITE(SIGN, 8, ENDIAN, 24)
-
-#define INTPCM_DECLARE_OP_16(SIGN, ENDIAN) \
-static __inline intpcm_t \
-intpcm_read_##SIGN##16##ENDIAN(uint8_t *src) \
-{ \
- \
- return (_PCM_READ_##SIGN##16##_##ENDIAN(src) << 16); \
-} \
-INTPCM_DECLARE_OP_WRITE(SIGN, 16, ENDIAN, 16)
-
-#define INTPCM_DECLARE_OP_24(SIGN, ENDIAN) \
-static __inline intpcm_t \
-intpcm_read_##SIGN##24##ENDIAN(uint8_t *src) \
-{ \
- \
- return (_PCM_READ_##SIGN##24##_##ENDIAN(src) << 8); \
-} \
-INTPCM_DECLARE_OP_WRITE(SIGN, 24, ENDIAN, 8)
-
-#define INTPCM_DECLARE_OP_32(SIGN, ENDIAN) \
-static __inline intpcm_t \
-intpcm_read_##SIGN##32##ENDIAN(uint8_t *src) \
-{ \
- \
- return (_PCM_READ_##SIGN##32##_##ENDIAN(src)); \
-} \
- \
-static __inline void \
-intpcm_write_##SIGN##32##ENDIAN(uint8_t *dst, intpcm_t v) \
-{ \
- \
- _PCM_WRITE_##SIGN##32##_##ENDIAN(dst, v); \
-}
-
-INTPCM_DECLARE_OP_8(S, NE)
-INTPCM_DECLARE_OP_16(S, LE)
-INTPCM_DECLARE_OP_16(S, BE)
-INTPCM_DECLARE_OP_24(S, LE)
-INTPCM_DECLARE_OP_24(S, BE)
-INTPCM_DECLARE_OP_32(S, LE)
-INTPCM_DECLARE_OP_32(S, BE)
-INTPCM_DECLARE_OP_8(U, NE)
-INTPCM_DECLARE_OP_16(U, LE)
-INTPCM_DECLARE_OP_16(U, BE)
-INTPCM_DECLARE_OP_24(U, LE)
-INTPCM_DECLARE_OP_24(U, BE)
-INTPCM_DECLARE_OP_32(U, LE)
-INTPCM_DECLARE_OP_32(U, BE)
-
static const struct {
const uint8_t ulaw_to_u8[G711_TABLE_SIZE];
const uint8_t alaw_to_u8[G711_TABLE_SIZE];
@@ -125,120 +60,282 @@
U8_TO_ALAW
};
-static __inline intpcm_t
-intpcm_read_ulaw(uint8_t *src)
-{
- return (_G711_TO_INTPCM(xlaw_conv_tables.ulaw_to_u8, *src) << 24);
-}
-
-static __inline intpcm_t
-intpcm_read_alaw(uint8_t *src)
-{
- return (_G711_TO_INTPCM(xlaw_conv_tables.alaw_to_u8, *src) << 24);
-}
-
-static __inline void
-intpcm_write_ulaw(uint8_t *dst, intpcm_t v)
+/* Format conversions */
+__always_inline intpcm_t
+pcm_sample_read(uint8_t *src, int fmt)
{
- *dst = _INTPCM_TO_G711(xlaw_conv_tables.u8_to_ulaw, v >> 24);
-}
+ intpcm_t v;
-static __inline void
-intpcm_write_alaw(uint8_t *dst, intpcm_t v)
-{
- *dst = _INTPCM_TO_G711(xlaw_conv_tables.u8_to_alaw, v >> 24);
-}
+ switch (fmt) {
+#if BYTE_ORDER == LITTLE_ENDIAN
+ case AFMT_S16_LE:
+ v = INTPCM_T(*(int16_t *)src);
+ break;
+ case AFMT_S16_BE:
+ v = INTPCM_T(src[1] | (int8_t)src[0] << 8);
+ break;
+ case AFMT_U16_LE:
+ v = INTPCM_T((int16_t)(*(uint16_t *)src) ^ 0x8000);
+ break;
+ case AFMT_U16_BE:
+ v = INTPCM_T(src[1] | ((int8_t)src[0] ^ 0x80) << 8);
+ break;
+ case AFMT_S32_LE:
+ v = INTPCM_T(*(int32_t *)src);
+ break;
+ case AFMT_S32_BE:
+ v = INTPCM_T(src[3] | src[2] << 8 | src[1] << 16 |
+ (int8_t)src[0] << 24);
+ break;
+ case AFMT_U32_LE:
+ v = INTPCM_T((int32_t)(*(uint32_t *)src) ^ 0x80000000);
+ break;
+ case AFMT_U32_BE:
+ v = INTPCM_T(src[3] | src[2] << 8 | src[1] << 16 |
+ ((int8_t)src[0] ^ 0x80) << 24);
+ break;
+#else /* BYTE_ORDER != LITTLE_ENDIAN */
+ case AFMT_S16_LE:
+ v = INTPCM_T(src[0] | (int8_t)src[1] << 8);
+ break;
+ case AFMT_S16_BE:
+ v = INTPCM_T(*(int16_t *)src);
+ break;
+ case AFMT_U16_LE:
+ v = INTPCM_T(src[0] | ((int8_t)src[1] ^ 0x80) << 8);
+ break;
+ case AFMT_U16_BE:
+ v = INTPCM_T((int16_t)(*(uint16_t *)src) ^ 0x8000);
+ break;
+ case AFMT_S32_LE:
+ v = INTPCM_T(src[0] | src[1] << 8 | src[2] << 16 |
+ (int8_t)src[3] << 24);
+ break;
+ case AFMT_S32_BE:
+ v = INTPCM_T(*(int32_t *)src);
+ break;
+ case AFMT_U32_LE:
+ v = INTPCM_T(src[0] | src[1] << 8 | src[2] << 16 |
+ ((int8_t)src[3] ^ 0x80) << 24);
+ break;
+ case AFMT_U32_BE:
+ v = INTPCM_T((int32_t)(*(uint32_t *)src) ^ 0x80000000);
+ break;
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+ case AFMT_S8:
+ v = INTPCM_T(*(int8_t *)src);
+ break;
+ case AFMT_U8:
+ v = INTPCM_T(*(int8_t *)src ^ 0x80);
+ break;
+ case AFMT_S24_LE:
+ v = INTPCM_T(src[0] | src[1] << 8 | (int8_t)src[2] << 16);
+ break;
+ case AFMT_S24_BE:
+ v = INTPCM_T(src[2] | src[1] << 8 | (int8_t)src[0] << 16);
+ break;
+ case AFMT_U24_LE:
+ v = INTPCM_T(src[0] | src[1] << 8 |
+ ((int8_t)src[2] ^ 0x80) << 16);
+ break;
+ case AFMT_U24_BE:
+ v = INTPCM_T(src[2] | src[1] << 8 |
+ ((int8_t)src[0] ^ 0x80) << 16);
+ break;
+ case AFMT_MU_LAW:
+ v = _G711_TO_INTPCM(xlaw_conv_tables.ulaw_to_u8, *src);
+ break;
+ case AFMT_A_LAW:
+ v = _G711_TO_INTPCM(xlaw_conv_tables.alaw_to_u8, *src);
+ break;
+ case AFMT_AC3:
+ v = 0;
+ break;
+ default:
+ printf("%s(): unknown format: %08x\n", __func__, fmt);
+ return (0);
+ }
-/*
- * dummy ac3/dts passthrough, etc.
- * XXX assume as s16le.
- */
-static __inline intpcm_t
-intpcm_read_null(uint8_t *src __unused)
-{
+#ifndef SND_PCM_64
+ v >>= PCM_FXSHIFT;
+#endif
- return (0);
+ return (v);
}
-static __inline void
-intpcm_write_null(uint8_t *dst, intpcm_t v __unused)
+__always_inline void
+pcm_sample_write(uint8_t *dst, intpcm_t v, int fmt)
{
+#ifndef SND_PCM_64
+ v <<= PCM_FXSHIFT;
+#endif
- _PCM_WRITE_S16_LE(dst, 0);
-}
-
-#define FEEDFORMAT_ENTRY(SIGN, BIT, ENDIAN) \
- { \
- AFMT_##SIGN##BIT##_##ENDIAN, \
- intpcm_read_##SIGN##BIT##ENDIAN, \
- intpcm_write_##SIGN##BIT##ENDIAN \
+ switch (fmt) {
+#if BYTE_ORDER == LITTLE_ENDIAN
+ case AFMT_S16_LE:
+ *(int16_t *)dst = v;
+ break;
+ case AFMT_S16_BE:
+ dst[1] = v;
+ dst[0] = v >> 8;
+ break;
+ case AFMT_U16_LE:
+ *(uint16_t *)dst = v ^ 0x8000;
+ break;
+ case AFMT_U16_BE:
+ dst[1] = v;
+ dst[0] = (v >> 8) ^ 0x80;
+ break;
+ case AFMT_S32_LE:
+ *(int32_t *)dst = v;
+ break;
+ case AFMT_S32_BE:
+ dst[3] = v;
+ dst[2] = v >> 8;
+ dst[1] = v >> 16;
+ dst[0] = v >> 24;
+ break;
+ case AFMT_U32_LE:
+ *(uint32_t *)dst = v ^ 0x80000000;
+ break;
+ case AFMT_U32_BE:
+ dst[3] = v;
+ dst[2] = v >> 8;
+ dst[1] = v >> 16;
+ dst[0] = (v >> 24) ^ 0x80;
+ break;
+#else /* BYTE_ORDER != LITTLE_ENDIAN */
+ case AFMT_S16_LE:
+ dst[1] = v;
+ dst[0] = v >> 8;
+ break;
+ case AFMT_S16_BE:
+ *(int16_t *)dst = v;
+ break;
+ case AFMT_U16_LE:
+ dst[1] = v;
+ dst[0] = (v >> 8) ^ 0x80;
+ break;
+ case AFMT_U16_BE:
+ *(uint16_t *)dst = v ^ 0x8000;
+ break;
+ case AFMT_S32_LE:
+ dst[3] = v;
+ dst[2] = v >> 8;
+ dst[1] = v >> 16;
+ dst[0] = v >> 24;
+ break;
+ case AFMT_S32_BE:
+ *(int32_t *)dst = v;
+ break;
+ case AFMT_U32_LE:
+ dst[3] = v;
+ dst[2] = v >> 8;
+ dst[1] = v >> 16;
+ dst[0] = (v >> 24) ^ 0x80;
+ break;
+ case AFMT_U32_BE:
+ *(uint32_t *)dst = v ^ 0x80000000;
+ break;
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+ case AFMT_S8:
+ *(int8_t *)dst = v;
+ break;
+ case AFMT_U8:
+ *(int8_t *)dst = v ^ 0x80;
+ break;
+ case AFMT_S24_LE:
+ dst[0] = v;
+ dst[1] = v >> 8;
+ dst[2] = v >> 16;
+ break;
+ case AFMT_S24_BE:
+ dst[2] = v;
+ dst[1] = v >> 8;
+ dst[0] = v >> 16;
+ break;
+ case AFMT_U24_LE:
+ dst[0] = v;
+ dst[1] = v >> 8;
+ dst[2] = (v >> 16) ^ 0x80;
+ break;
+ case AFMT_U24_BE:
+ dst[2] = v;
+ dst[1] = v >> 8;
+ dst[0] = (v >> 16) ^ 0x80;
+ break;
+ case AFMT_MU_LAW:
+ *dst = _INTPCM_TO_G711(xlaw_conv_tables.u8_to_ulaw, v);
+ break;
+ case AFMT_A_LAW:
+ *dst = _INTPCM_TO_G711(xlaw_conv_tables.u8_to_alaw, v);
+ break;
+ case AFMT_AC3:
+ *(int16_t *)dst = 0;
+ break;
+ default:
+ printf("%s(): unknown format: %08x\n", __func__, fmt);
+ break;
}
+}
static const struct {
uint32_t format;
- intpcm_read_t *read;
- intpcm_write_t *write;
+ int shift;
} feed_format_ops[] = {
- FEEDFORMAT_ENTRY(S, 8, NE),
- FEEDFORMAT_ENTRY(S, 16, LE),
- FEEDFORMAT_ENTRY(S, 24, LE),
- FEEDFORMAT_ENTRY(S, 32, LE),
- FEEDFORMAT_ENTRY(S, 16, BE),
- FEEDFORMAT_ENTRY(S, 24, BE),
- FEEDFORMAT_ENTRY(S, 32, BE),
- FEEDFORMAT_ENTRY(U, 8, NE),
- FEEDFORMAT_ENTRY(U, 16, LE),
- FEEDFORMAT_ENTRY(U, 24, LE),
- FEEDFORMAT_ENTRY(U, 32, LE),
- FEEDFORMAT_ENTRY(U, 16, BE),
- FEEDFORMAT_ENTRY(U, 24, BE),
- FEEDFORMAT_ENTRY(U, 32, BE),
- {
- AFMT_MU_LAW,
- intpcm_read_ulaw, intpcm_write_ulaw
- },
- {
- AFMT_A_LAW,
- intpcm_read_alaw, intpcm_write_alaw
- },
- {
- AFMT_AC3,
- intpcm_read_null, intpcm_write_null
- }
+ { AFMT_S8_NE, 24 },
+ { AFMT_S16_LE, 16 },
+ { AFMT_S16_BE, 16 },
+ { AFMT_S24_LE, 8 },
+ { AFMT_S24_BE, 8 },
+ { AFMT_S32_LE, 0 },
+ { AFMT_S32_BE, 0 },
+ { AFMT_U8_NE, 24 },
+ { AFMT_U16_LE, 16 },
+ { AFMT_U16_BE, 16 },
+ { AFMT_U24_LE, 8 },
+ { AFMT_U24_BE, 8 },
+ { AFMT_U32_LE, 0 },
+ { AFMT_U32_BE, 0 },
+ { AFMT_MU_LAW, 24 },
+ { AFMT_A_LAW, 24 },
+ { AFMT_AC3, 16 },
};
static int
feed_format_init(struct pcm_feeder *f)
{
struct feed_format_info *info;
- intpcm_read_t *rd_op;
- intpcm_write_t *wr_op;
+ uint32_t rdfmt, wrfmt;
+ int rdshift, wrshift;
size_t i;
if (f->desc->in == f->desc->out ||
AFMT_CHANNEL(f->desc->in) != AFMT_CHANNEL(f->desc->out))
return (EINVAL);
- rd_op = NULL;
- wr_op = NULL;
+ rdfmt = wrfmt = 0;
for (i = 0; i < nitems(feed_format_ops) &&
- (rd_op == NULL || wr_op == NULL); i++) {
- if (rd_op == NULL &&
- AFMT_ENCODING(f->desc->in) == feed_format_ops[i].format)
- rd_op = feed_format_ops[i].read;
- if (wr_op == NULL &&
- AFMT_ENCODING(f->desc->out) == feed_format_ops[i].format)
- wr_op = feed_format_ops[i].write;
+ (rdfmt == 0 || wrfmt == 0); i++) {
+ if (AFMT_ENCODING(f->desc->in) == feed_format_ops[i].format)
+ rdfmt = feed_format_ops[i].format;
+ if (AFMT_ENCODING(f->desc->out) == feed_format_ops[i].format)
+ wrfmt = feed_format_ops[i].format;
}
- if (rd_op == NULL || wr_op == NULL) {
+ if (rdfmt == 0 || wrfmt == 0) {
printf("%s(): failed to initialize io ops "
"in=0x%08x out=0x%08x\n",
__func__, f->desc->in, f->desc->out);
return (EINVAL);
}
+ rdshift = feeder_format_getshift(rdfmt);
+ wrshift = feeder_format_getshift(wrfmt);
+ if (rdshift < 0 || wrshift < 0)
+ return (EINVAL);
+
info = malloc(sizeof(*info), M_DEVBUF, M_NOWAIT | M_ZERO);
if (info == NULL)
return (ENOMEM);
@@ -247,11 +344,13 @@
info->ibps = AFMT_BPS(f->desc->in);
info->ialign = info->ibps * info->channels;
- info->read = rd_op;
+ info->rdfmt = rdfmt;
+ info->rdshift = rdshift;
info->obps = AFMT_BPS(f->desc->out);
info->oalign = info->obps * info->channels;
- info->write = wr_op;
+ info->wrfmt = wrfmt;
+ info->wrshift = wrshift;
f->data = info;
@@ -335,8 +434,8 @@
count -= j * info->obps;
do {
- v = info->read(src);
- info->write(dst, v);
+ v = pcm_sample_read(src, info->rdfmt) << info->rdshift;
+ pcm_sample_write(dst, v >> info->wrshift, info->wrfmt);
dst += info->obps;
src += info->ibps;
} while (--j != 0);
@@ -361,28 +460,14 @@
FEEDER_DECLARE(feeder_format, NULL);
-intpcm_read_t *
-feeder_format_read_op(uint32_t format)
+int
+feeder_format_getshift(uint32_t format)
{
size_t i;
- for (i = 0; i < nitems(feed_format_ops); i++) {
+ for (i = 0; i < nitems(feed_format_ops); i++)
if (AFMT_ENCODING(format) == feed_format_ops[i].format)
- return (feed_format_ops[i].read);
- }
-
- return (NULL);
-}
-
-intpcm_write_t *
-feeder_format_write_op(uint32_t format)
-{
- size_t i;
-
- for (i = 0; i < nitems(feed_format_ops); i++) {
- if (AFMT_ENCODING(format) == feed_format_ops[i].format)
- return (feed_format_ops[i].write);
- }
+ return (feed_format_ops[i].shift);
- return (NULL);
+ return (-1);
}
diff --git a/sys/dev/sound/pcm/feeder_matrix.c b/sys/dev/sound/pcm/feeder_matrix.c
--- a/sys/dev/sound/pcm/feeder_matrix.c
+++ b/sys/dev/sound/pcm/feeder_matrix.c
@@ -64,11 +64,8 @@
uint32_t bps;
uint32_t ialign, oalign;
uint32_t in, out;
+ int rdshift, wrshift;
feed_matrix_t apply;
-#ifdef FEEDMATRIX_GENERIC
- intpcm_read_t *rd;
- intpcm_write_t *wr;
-#endif
struct {
int chn[SND_CHN_T_MAX + 1];
int mul, shift;
@@ -127,16 +124,17 @@
for (i = 0; info->matrix[i].chn[0] != SND_CHN_T_EOF; \
i++) { \
if (info->matrix[i].chn[0] == SND_CHN_T_NULL) { \
- _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, \
- 0); \
+ pcm_sample_write(dst, 0, \
+ AFMT_##SIGN##BIT##_##ENDIAN); \
dst += PCM_##BIT##_BPS; \
continue; \
} else if (info->matrix[i].chn[1] == \
SND_CHN_T_EOF) { \
- v = _PCM_READ_##SIGN##BIT##_##ENDIAN( \
- src + info->matrix[i].chn[0]); \
- _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, \
- v); \
+ v = pcm_sample_read( \
+ src + info->matrix[i].chn[0], \
+ AFMT_##SIGN##BIT##_##ENDIAN); \
+ pcm_sample_write(dst, v, \
+ AFMT_##SIGN##BIT##_##ENDIAN); \
dst += PCM_##BIT##_BPS; \
continue; \
} \
@@ -145,8 +143,9 @@
for (j = 0; \
info->matrix[i].chn[j] != SND_CHN_T_EOF; \
j++) { \
- v = _PCM_READ_##SIGN##BIT##_##ENDIAN( \
- src + info->matrix[i].chn[j]); \
+ v = pcm_sample_read( \
+ src + info->matrix[i].chn[j], \
+ AFMT_##SIGN##BIT##_##ENDIAN); \
accum += v; \
} \
\
@@ -160,7 +159,8 @@
((accum < PCM_S##BIT##_MIN) ? \
PCM_S##BIT##_MIN : \
accum); \
- _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, v); \
+ pcm_sample_write(dst, v, \
+ AFMT_##SIGN##BIT##_##ENDIAN); \
dst += PCM_##BIT##_BPS; \
} \
src += info->ialign; \
@@ -249,13 +249,17 @@
for (i = 0; info->matrix[i].chn[0] != SND_CHN_T_EOF;
i++) {
if (info->matrix[i].chn[0] == SND_CHN_T_NULL) {
- info->wr(dst, 0);
+ pcm_sample_write(dst, 0 >> info->wrshift,
+ info->out);
dst += info->bps;
continue;
} else if (info->matrix[i].chn[1] ==
SND_CHN_T_EOF) {
- v = info->rd(src + info->matrix[i].chn[0]);
- info->wr(dst, v);
+ v = pcm_sample_read(src +
+ info->matrix[i].chn[0], info->in) <<
+ info->rdshift;
+ pcm_sample_write(dst, v >> info->wrshift,
+ info->out);
dst += info->bps;
continue;
}
@@ -264,7 +268,9 @@
for (j = 0;
info->matrix[i].chn[j] != SND_CHN_T_EOF;
j++) {
- v = info->rd(src + info->matrix[i].chn[j]);
+ v = pcm_sample_read(src +
+ info->matrix[i].chn[j], info->in) <<
+ info->rdshift;
accum += v;
}
@@ -275,7 +281,7 @@
v = (accum > PCM_S32_MAX) ? PCM_S32_MAX :
((accum < PCM_S32_MIN) ? PCM_S32_MIN : accum);
- info->wr(dst, v);
+ pcm_sample_write(dst, v >> info->wrshift, info->out);
dst += info->bps;
}
src += info->ialign;
@@ -416,9 +422,9 @@
if (info->apply == NULL) {
#ifdef FEEDMATRIX_GENERIC
- info->rd = feeder_format_read_op(info->in);
- info->wr = feeder_format_write_op(info->out);
- if (info->rd == NULL || info->wr == NULL) {
+ info->rdshift = feeder_format_getshift(info->in);
+ info->wrshift = feeder_format_getshift(info->out);
+ if (info->rdshift < 0 || info->wrshift < 0) {
free(info, M_DEVBUF);
return (EINVAL);
}
diff --git a/sys/dev/sound/pcm/feeder_mixer.c b/sys/dev/sound/pcm/feeder_mixer.c
--- a/sys/dev/sound/pcm/feeder_mixer.c
+++ b/sys/dev/sound/pcm/feeder_mixer.c
@@ -53,11 +53,11 @@
src -= PCM_##BIT##_BPS; \
dst -= PCM_##BIT##_BPS; \
count -= PCM_##BIT##_BPS; \
- x = PCM_READ_##SIGN##BIT##_##ENDIAN(src); \
- y = PCM_READ_##SIGN##BIT##_##ENDIAN(dst); \
+ x = pcm_sample_read(src, AFMT_##SIGN##BIT##_##ENDIAN); \
+ y = pcm_sample_read(dst, AFMT_##SIGN##BIT##_##ENDIAN); \
z = INTPCM##BIT##_T(x) + y; \
x = PCM_CLAMP_##SIGN##BIT(z); \
- _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, x); \
+ pcm_sample_write(dst, x, AFMT_##SIGN##BIT##_##ENDIAN); \
} while (count != 0); \
}
diff --git a/sys/dev/sound/pcm/feeder_rate.c b/sys/dev/sound/pcm/feeder_rate.c
--- a/sys/dev/sound/pcm/feeder_rate.c
+++ b/sys/dev/sound/pcm/feeder_rate.c
@@ -466,10 +466,10 @@
ch = info->channels; \
\
do { \
- x = _PCM_READ_##SIGN##BIT##_##ENDIAN(sx); \
- y = _PCM_READ_##SIGN##BIT##_##ENDIAN(sy); \
+ x = pcm_sample_read(sx, AFMT_##SIGN##BIT##_##ENDIAN); \
+ y = pcm_sample_read(sy, AFMT_##SIGN##BIT##_##ENDIAN); \
x = Z_LINEAR_INTERPOLATE_##BIT(z, x, y); \
- _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, x); \
+ pcm_sample_write(dst, x, AFMT_##SIGN##BIT##_##ENDIAN); \
sx += PCM_##BIT##_BPS; \
sy += PCM_##BIT##_BPS; \
dst += PCM_##BIT##_BPS; \
@@ -511,7 +511,7 @@
c += z >> Z_SHIFT; \
z &= Z_MASK; \
coeff = Z_COEFF_INTERPOLATE(z, z_coeff[c], z_dcoeff[c]); \
- x = _PCM_READ_##SIGN##BIT##_##ENDIAN(p); \
+ x = pcm_sample_read(p, AFMT_##SIGN##BIT##_##ENDIAN); \
v += Z_NORM_##BIT((intpcm64_t)x * coeff); \
z += info->z_dy; \
p adv##= info->channels * PCM_##BIT##_BPS
@@ -569,7 +569,8 @@
else \
v >>= Z_COEFF_SHIFT - Z_GUARD_BIT_##BIT; \
Z_CLIP_CHECK(v, BIT); \
- _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, Z_CLAMP(v, BIT)); \
+ pcm_sample_write(dst, Z_CLAMP(v, BIT), \
+ AFMT_##SIGN##BIT##_##ENDIAN); \
} while (ch != 0); \
}
@@ -594,11 +595,11 @@
z_pcoeff = info->z_pcoeff + \
((info->z_alpha * info->z_size) << 1); \
for (i = info->z_size; i != 0; i--) { \
- x = _PCM_READ_##SIGN##BIT##_##ENDIAN(p); \
+ x = pcm_sample_read(p, AFMT_##SIGN##BIT##_##ENDIAN); \
v += Z_NORM_##BIT((intpcm64_t)x * *z_pcoeff); \
z_pcoeff++; \
p += info->channels * PCM_##BIT##_BPS; \
- x = _PCM_READ_##SIGN##BIT##_##ENDIAN(p); \
+ x = pcm_sample_read(p, AFMT_##SIGN##BIT##_##ENDIAN); \
v += Z_NORM_##BIT((intpcm64_t)x * *z_pcoeff); \
z_pcoeff++; \
p += info->channels * PCM_##BIT##_BPS; \
@@ -608,7 +609,8 @@
else \
v >>= Z_COEFF_SHIFT - Z_GUARD_BIT_##BIT; \
Z_CLIP_CHECK(v, BIT); \
- _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, Z_CLAMP(v, BIT)); \
+ pcm_sample_write(dst, Z_CLAMP(v, BIT), \
+ AFMT_##SIGN##BIT##_##ENDIAN); \
} while (ch != 0); \
}
diff --git a/sys/dev/sound/pcm/feeder_volume.c b/sys/dev/sound/pcm/feeder_volume.c
--- a/sys/dev/sound/pcm/feeder_volume.c
+++ b/sys/dev/sound/pcm/feeder_volume.c
@@ -58,10 +58,12 @@
do { \
dst -= PCM_##BIT##_BPS; \
i--; \
- x = PCM_READ_##SIGN##BIT##_##ENDIAN(dst); \
+ x = pcm_sample_read(dst, \
+ AFMT_##SIGN##BIT##_##ENDIAN); \
v = FEEDVOLUME_CALC##BIT(x, vol[matrix[i]]); \
x = PCM_CLAMP_##SIGN##BIT(v); \
- _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, x); \
+ pcm_sample_write(dst, x, \
+ AFMT_##SIGN##BIT##_##ENDIAN); \
} while (i != 0); \
} while (--count != 0); \
}
diff --git a/sys/dev/sound/pcm/pcm.h b/sys/dev/sound/pcm/pcm.h
--- a/sys/dev/sound/pcm/pcm.h
+++ b/sys/dev/sound/pcm/pcm.h
@@ -29,15 +29,6 @@
#ifndef _SND_PCM_H_
#define _SND_PCM_H_
-/*
- * Macros for reading/writing PCM sample / int values from bytes array.
- * Since every process is done using signed integer (and to make our life
- * less miserable), unsigned sample will be converted to its signed
- * counterpart and restored during writing back. To avoid overflow,
- * we truncate 32bit (and only 32bit) samples down to 24bit (see below
- * for the reason), unless SND_PCM_64 is defined.
- */
-
/*
* Automatically turn on 64bit arithmetic on suitable archs
* (amd64 64bit, etc..) for wider 32bit samples / integer processing.
@@ -104,309 +95,6 @@
#define INTPCM24_T(v) ((intpcm24_t)(v))
#define INTPCM32_T(v) ((intpcm32_t)(v))
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define _PCM_READ_S16_LE(b8) INTPCM_T(*((int16_t *)(b8)))
-#define _PCM_READ_S32_LE(b8) INTPCM_T(*((int32_t *)(b8)))
-#define _PCM_READ_S16_BE(b8) \
- INTPCM_T((b8)[1] | (((int8_t)((b8)[0])) << 8))
-#define _PCM_READ_S32_BE(b8) \
- INTPCM_T((b8)[3] | ((b8)[2] << 8) | ((b8)[1] << 16) | \
- (((int8_t)((b8)[0])) << 24))
-
-#define _PCM_WRITE_S16_LE(b8, val) do { \
- *((int16_t *)(b8)) = (val); \
-} while (0)
-#define _PCM_WRITE_S32_LE(b8, val) do { \
- *((int32_t *)(b8)) = (val); \
-} while (0)
-#define _PCM_WRITE_S16_BE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[1] = val; \
- b8[0] = val >> 8; \
-} while (0)
-#define _PCM_WRITE_S32_BE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[3] = val; \
- b8[2] = val >> 8; \
- b8[1] = val >> 16; \
- b8[0] = val >> 24; \
-} while (0)
-
-#define _PCM_READ_U16_LE(b8) \
- INTPCM_T((int16_t)(*((uint16_t *)(b8)) ^ 0x8000))
-#define _PCM_READ_U32_LE(b8) \
- INTPCM_T((int32_t)(*((uint32_t *)(b8)) ^ 0x80000000))
-#define _PCM_READ_U16_BE(b8) \
- INTPCM_T((b8)[1] | (((int8_t)((b8)[0] ^ 0x80)) << 8))
-#define _PCM_READ_U32_BE(b8) \
- INTPCM_T((b8)[3] | ((b8)[2] << 8) | ((b8)[1] << 16) | \
- (((int8_t)((b8)[0] ^ 0x80)) << 24))
-
-#define _PCM_WRITE_U16_LE(b8, val) do { \
- *((uint16_t *)(b8)) = (val) ^ 0x8000; \
-} while (0)
-#define _PCM_WRITE_U32_LE(b8, val) do { \
- *((uint32_t *)(b8)) = (val) ^ 0x80000000; \
-} while (0)
-#define _PCM_WRITE_U16_BE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[1] = val; \
- b8[0] = (val >> 8) ^ 0x80; \
-} while (0)
-#define _PCM_WRITE_U32_BE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[3] = val; \
- b8[2] = val >> 8; \
- b8[1] = val >> 16; \
- b8[0] = (val >> 24) ^ 0x80; \
-} while (0)
-
-#define _PCM_READ_S16_NE(b8) _PCM_READ_S16_LE(b8)
-#define _PCM_READ_U16_NE(b8) _PCM_READ_U16_LE(b8)
-#define _PCM_READ_S32_NE(b8) _PCM_READ_S32_LE(b8)
-#define _PCM_READ_U32_NE(b8) _PCM_READ_U32_LE(b8)
-#define _PCM_WRITE_S16_NE(b6) _PCM_WRITE_S16_LE(b8)
-#define _PCM_WRITE_U16_NE(b6) _PCM_WRITE_U16_LE(b8)
-#define _PCM_WRITE_S32_NE(b6) _PCM_WRITE_S32_LE(b8)
-#define _PCM_WRITE_U32_NE(b6) _PCM_WRITE_U32_LE(b8)
-#else /* !LITTLE_ENDIAN */
-#define _PCM_READ_S16_LE(b8) \
- INTPCM_T((b8)[0] | (((int8_t)((b8)[1])) << 8))
-#define _PCM_READ_S32_LE(b8) \
- INTPCM_T((b8)[0] | ((b8)[1] << 8) | ((b8)[2] << 16) | \
- (((int8_t)((b8)[3])) << 24))
-#define _PCM_READ_S16_BE(b8) INTPCM_T(*((int16_t *)(b8)))
-#define _PCM_READ_S32_BE(b8) INTPCM_T(*((int32_t *)(b8)))
-
-#define _PCM_WRITE_S16_LE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[0] = val; \
- b8[1] = val >> 8; \
-} while (0)
-#define _PCM_WRITE_S32_LE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[0] = val; \
- b8[1] = val >> 8; \
- b8[2] = val >> 16; \
- b8[3] = val >> 24; \
-} while (0)
-#define _PCM_WRITE_S16_BE(b8, val) do { \
- *((int16_t *)(b8)) = (val); \
-} while (0)
-#define _PCM_WRITE_S32_BE(b8, val) do { \
- *((int32_t *)(b8)) = (val); \
-} while (0)
-
-#define _PCM_READ_U16_LE(b8) \
- INTPCM_T((b8)[0] | (((int8_t)((b8)[1] ^ 0x80)) << 8))
-#define _PCM_READ_U32_LE(b8) \
- INTPCM_T((b8)[0] | ((b8)[1] << 8) | ((b8)[2] << 16) | \
- (((int8_t)((b8)[3] ^ 0x80)) << 24))
-#define _PCM_READ_U16_BE(b8) \
- INTPCM_T((int16_t)(*((uint16_t *)(b8)) ^ 0x8000))
-#define _PCM_READ_U32_BE(b8) \
- INTPCM_T((int32_t)(*((uint32_t *)(b8)) ^ 0x80000000))
-
-#define _PCM_WRITE_U16_LE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[0] = val; \
- b8[1] = (val >> 8) ^ 0x80; \
-} while (0)
-#define _PCM_WRITE_U32_LE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[0] = val; \
- b8[1] = val >> 8; \
- b8[2] = val >> 16; \
- b8[3] = (val >> 24) ^ 0x80; \
-} while (0)
-#define _PCM_WRITE_U16_BE(b8, val) do { \
- *((uint16_t *)(b8)) = (val) ^ 0x8000; \
-} while (0)
-#define _PCM_WRITE_U32_BE(b8, val) do { \
- *((uint32_t *)(b8)) = (val) ^ 0x80000000; \
-} while (0)
-
-#define _PCM_READ_S16_NE(b8) _PCM_READ_S16_BE(b8)
-#define _PCM_READ_U16_NE(b8) _PCM_READ_U16_BE(b8)
-#define _PCM_READ_S32_NE(b8) _PCM_READ_S32_BE(b8)
-#define _PCM_READ_U32_NE(b8) _PCM_READ_U32_BE(b8)
-#define _PCM_WRITE_S16_NE(b6) _PCM_WRITE_S16_BE(b8)
-#define _PCM_WRITE_U16_NE(b6) _PCM_WRITE_U16_BE(b8)
-#define _PCM_WRITE_S32_NE(b6) _PCM_WRITE_S32_BE(b8)
-#define _PCM_WRITE_U32_NE(b6) _PCM_WRITE_U32_BE(b8)
-#endif /* LITTLE_ENDIAN */
-
-#define _PCM_READ_S24_LE(b8) \
- INTPCM_T((b8)[0] | ((b8)[1] << 8) | (((int8_t)((b8)[2])) << 16))
-#define _PCM_READ_S24_BE(b8) \
- INTPCM_T((b8)[2] | ((b8)[1] << 8) | (((int8_t)((b8)[0])) << 16))
-
-#define _PCM_WRITE_S24_LE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[0] = val; \
- b8[1] = val >> 8; \
- b8[2] = val >> 16; \
-} while (0)
-#define _PCM_WRITE_S24_BE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[2] = val; \
- b8[1] = val >> 8; \
- b8[0] = val >> 16; \
-} while (0)
-
-#define _PCM_READ_U24_LE(b8) \
- INTPCM_T((b8)[0] | ((b8)[1] << 8) | \
- (((int8_t)((b8)[2] ^ 0x80)) << 16))
-#define _PCM_READ_U24_BE(b8) \
- INTPCM_T((b8)[2] | ((b8)[1] << 8) | \
- (((int8_t)((b8)[0] ^ 0x80)) << 16))
-
-#define _PCM_WRITE_U24_LE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[0] = val; \
- b8[1] = val >> 8; \
- b8[2] = (val >> 16) ^ 0x80; \
-} while (0)
-#define _PCM_WRITE_U24_BE(bb8, vval) do { \
- intpcm_t val = (vval); \
- uint8_t *b8 = (bb8); \
- b8[2] = val; \
- b8[1] = val >> 8; \
- b8[0] = (val >> 16) ^ 0x80; \
-} while (0)
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define _PCM_READ_S24_NE(b8) _PCM_READ_S24_LE(b8)
-#define _PCM_READ_U24_NE(b8) _PCM_READ_U24_LE(b8)
-#define _PCM_WRITE_S24_NE(b6) _PCM_WRITE_S24_LE(b8)
-#define _PCM_WRITE_U24_NE(b6) _PCM_WRITE_U24_LE(b8)
-#else /* !LITTLE_ENDIAN */
-#define _PCM_READ_S24_NE(b8) _PCM_READ_S24_BE(b8)
-#define _PCM_READ_U24_NE(b8) _PCM_READ_U24_BE(b8)
-#define _PCM_WRITE_S24_NE(b6) _PCM_WRITE_S24_BE(b8)
-#define _PCM_WRITE_U24_NE(b6) _PCM_WRITE_U24_BE(b8)
-#endif /* LITTLE_ENDIAN */
-/*
- * 8bit sample is pretty much useless since it doesn't provide
- * sufficient dynamic range throughout our filtering process.
- * For the sake of completeness, declare it anyway.
- */
-#define _PCM_READ_S8_NE(b8) INTPCM_T(*((int8_t *)(b8)))
-#define _PCM_READ_U8_NE(b8) \
- INTPCM_T((int8_t)(*((uint8_t *)(b8)) ^ 0x80))
-
-#define _PCM_WRITE_S8_NE(b8, val) do { \
- *((int8_t *)(b8)) = (val); \
-} while (0)
-#define _PCM_WRITE_U8_NE(b8, val) do { \
- *((uint8_t *)(b8)) = (val) ^ 0x80; \
-} while (0)
-
-/*
- * Common macross. Use this instead of "_", unless we want
- * the real sample value.
- */
-
-/* 8bit */
-#define PCM_READ_S8_NE(b8) _PCM_READ_S8_NE(b8)
-#define PCM_READ_U8_NE(b8) _PCM_READ_U8_NE(b8)
-#define PCM_WRITE_S8_NE(b8, val) _PCM_WRITE_S8_NE(b8, val)
-#define PCM_WRITE_U8_NE(b8, val) _PCM_WRITE_U8_NE(b8, val)
-
-/* 16bit */
-#define PCM_READ_S16_LE(b8) _PCM_READ_S16_LE(b8)
-#define PCM_READ_S16_BE(b8) _PCM_READ_S16_BE(b8)
-#define PCM_READ_U16_LE(b8) _PCM_READ_U16_LE(b8)
-#define PCM_READ_U16_BE(b8) _PCM_READ_U16_BE(b8)
-
-#define PCM_WRITE_S16_LE(b8, val) _PCM_WRITE_S16_LE(b8, val)
-#define PCM_WRITE_S16_BE(b8, val) _PCM_WRITE_S16_BE(b8, val)
-#define PCM_WRITE_U16_LE(b8, val) _PCM_WRITE_U16_LE(b8, val)
-#define PCM_WRITE_U16_BE(b8, val) _PCM_WRITE_U16_BE(b8, val)
-
-#define PCM_READ_S16_NE(b8) _PCM_READ_S16_NE(b8)
-#define PCM_READ_U16_NE(b8) _PCM_READ_U16_NE(b8)
-#define PCM_WRITE_S16_NE(b8) _PCM_WRITE_S16_NE(b8)
-#define PCM_WRITE_U16_NE(b8) _PCM_WRITE_U16_NE(b8)
-
-/* 24bit */
-#define PCM_READ_S24_LE(b8) _PCM_READ_S24_LE(b8)
-#define PCM_READ_S24_BE(b8) _PCM_READ_S24_BE(b8)
-#define PCM_READ_U24_LE(b8) _PCM_READ_U24_LE(b8)
-#define PCM_READ_U24_BE(b8) _PCM_READ_U24_BE(b8)
-
-#define PCM_WRITE_S24_LE(b8, val) _PCM_WRITE_S24_LE(b8, val)
-#define PCM_WRITE_S24_BE(b8, val) _PCM_WRITE_S24_BE(b8, val)
-#define PCM_WRITE_U24_LE(b8, val) _PCM_WRITE_U24_LE(b8, val)
-#define PCM_WRITE_U24_BE(b8, val) _PCM_WRITE_U24_BE(b8, val)
-
-#define PCM_READ_S24_NE(b8) _PCM_READ_S24_NE(b8)
-#define PCM_READ_U24_NE(b8) _PCM_READ_U24_NE(b8)
-#define PCM_WRITE_S24_NE(b8) _PCM_WRITE_S24_NE(b8)
-#define PCM_WRITE_U24_NE(b8) _PCM_WRITE_U24_NE(b8)
-
-/* 32bit */
-#ifdef SND_PCM_64
-#define PCM_READ_S32_LE(b8) _PCM_READ_S32_LE(b8)
-#define PCM_READ_S32_BE(b8) _PCM_READ_S32_BE(b8)
-#define PCM_READ_U32_LE(b8) _PCM_READ_U32_LE(b8)
-#define PCM_READ_U32_BE(b8) _PCM_READ_U32_BE(b8)
-
-#define PCM_WRITE_S32_LE(b8, val) _PCM_WRITE_S32_LE(b8, val)
-#define PCM_WRITE_S32_BE(b8, val) _PCM_WRITE_S32_BE(b8, val)
-#define PCM_WRITE_U32_LE(b8, val) _PCM_WRITE_U32_LE(b8, val)
-#define PCM_WRITE_U32_BE(b8, val) _PCM_WRITE_U32_BE(b8, val)
-
-#define PCM_READ_S32_NE(b8) _PCM_READ_S32_NE(b8)
-#define PCM_READ_U32_NE(b8) _PCM_READ_U32_NE(b8)
-#define PCM_WRITE_S32_NE(b8) _PCM_WRITE_S32_NE(b8)
-#define PCM_WRITE_U32_NE(b8) _PCM_WRITE_U32_NE(b8)
-#else /* !SND_PCM_64 */
-/*
- * 24bit integer ?!? This is quite unfortunate, eh? Get the fact straight:
- * Dynamic range for:
- * 1) Human =~ 140db
- * 2) 16bit = 96db (close enough)
- * 3) 24bit = 144db (perfect)
- * 4) 32bit = 196db (way too much)
- * 5) Bugs Bunny = Gazillion!@%$Erbzzztt-EINVAL db
- * Since we're not Bugs Bunny ..uh..err.. avoiding 64bit arithmetic, 24bit
- * is pretty much sufficient for our signed integer processing.
- */
-#define PCM_READ_S32_LE(b8) (_PCM_READ_S32_LE(b8) >> PCM_FXSHIFT)
-#define PCM_READ_S32_BE(b8) (_PCM_READ_S32_BE(b8) >> PCM_FXSHIFT)
-#define PCM_READ_U32_LE(b8) (_PCM_READ_U32_LE(b8) >> PCM_FXSHIFT)
-#define PCM_READ_U32_BE(b8) (_PCM_READ_U32_BE(b8) >> PCM_FXSHIFT)
-
-#define PCM_READ_S32_NE(b8) (_PCM_READ_S32_NE(b8) >> PCM_FXSHIFT)
-#define PCM_READ_U32_NE(b8) (_PCM_READ_U32_NE(b8) >> PCM_FXSHIFT)
-
-#define PCM_WRITE_S32_LE(b8, val) \
- _PCM_WRITE_S32_LE(b8, (val) << PCM_FXSHIFT)
-#define PCM_WRITE_S32_BE(b8, val) \
- _PCM_WRITE_S32_BE(b8, (val) << PCM_FXSHIFT)
-#define PCM_WRITE_U32_LE(b8, val) \
- _PCM_WRITE_U32_LE(b8, (val) << PCM_FXSHIFT)
-#define PCM_WRITE_U32_BE(b8, val) \
- _PCM_WRITE_U32_BE(b8, (val) << PCM_FXSHIFT)
-
-#define PCM_WRITE_S32_NE(b8, val) \
- _PCM_WRITE_S32_NE(b8, (val) << PCM_FXSHIFT)
-#define PCM_WRITE_U32_NE(b8, val) \
- _PCM_WRITE_U32_NE(b8, (val) << PCM_FXSHIFT)
-#endif /* SND_PCM_64 */
-
#define PCM_CLAMP_S8(val) \
(((val) > PCM_S8_MAX) ? PCM_S8_MAX : \
(((val) < PCM_S8_MIN) ? PCM_S8_MIN : (val)))
@@ -433,4 +121,7 @@
#define PCM_CLAMP_U24(val) PCM_CLAMP_S24(val)
#define PCM_CLAMP_U32(val) PCM_CLAMP_S32(val)
+extern __always_inline intpcm_t pcm_sample_read(uint8_t *, int);
+extern __always_inline void pcm_sample_write(uint8_t *, intpcm_t, int);
+
#endif /* !_SND_PCM_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 8, 5:21 PM (12 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28477784
Default Alt Text
D47932.id147532.diff (32 KB)
Attached To
Mode
D47932: sound: Refactor the format conversion framework
Attached
Detach File
Event Timeline
Log In to Comment