From nobody Wed Dec 04 12:04:14 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y3GQk5mWPz5gS7f; Wed, 04 Dec 2024 12:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y3GQk2vlyz46Wt; Wed, 4 Dec 2024 12:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733313854; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LSRc2VPDKbld9tpcjl8Y8WMdEPcyMRByw2f5J6dfPHQ=; b=sGjURQiHHPn0u6ULfjysvos+peDJUV3rMsJ8C7OQZ8g0LLEer48TIvDtiygfuYbC7gfcVn chzXhyK89gDanEW+cGtDwmRFP8zIiG/eZiMFblBGn3dyziSHdjPkYUR2kjh+HgAueJZSjS 2oy87kuamnGFOTIDdm279QnjUgv/3BKLJcYjzvvx2XAdGsX+Ui0aYvXXBz2xsclWPujDHx 2aGYksNFGvnoyKZ/bP4ms5EZXgdPmLcyoJfhz0BNKvtXB6Pf/C6bQJxPaWh1NLb55w9180 6YOu5KHeVgxN4vIKwpZszrBHzZlPjhGYsfrT8X2d39nwEOMPjE3q+dM7JbDKxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733313854; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LSRc2VPDKbld9tpcjl8Y8WMdEPcyMRByw2f5J6dfPHQ=; b=h5mvygU2na53VcVi+STDokvo7Vw6FMZzZGAkFQkKuSJahJmFSpj0L9TXaXmzTWEKIMKTFf uwQFJVedBYwbb4iSx2H7Ke//likfdQol9+TjjbcpxcPHhkxBsp3aD01XNiUoj+kANigNTN qPBiAOj2hSH2CaOoSbDvirFMxoR319+xNnRe1/DnQddh+4Hm6LYK/orVKrlfMUU4RpvLi1 F92rldup0i4oIiR0kKfSF0c5QZF5mHfhBqiV72V+b2KtuoZtAKjOsgkRo8E6c90a9M5Mle aQeEWqJVJV7BzBDtchJwCc7du4VaXNsnXPC7EgXnSK/kZM4JXWJ+qY0DtyfX+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733313854; a=rsa-sha256; cv=none; b=kiTMq/JrzCEkOUWudgZwrsxGL8plTyd1FKBZ1yM9Ctql/88MT0Pfn0ULKJKbVP9gzAMiV4 VrhsNtukTeDPd//MZTBtQ5o7HJXrliLnATxT9B9d/LJFb38+icavQ/oiMfYnQPMztfGllR XfacRVmCm8GZ62y7bvJeWKK0u1groMVPJYNb/FkD+gr3BRfqU5OWGbjPXQFKmS9tkwxJh/ UpjcJqYY8l4VuuvxrTF8Ohyb0NLUDbpP96m5lsFcQ2eCKRr5LN1s0A8eJVtY5el33K3Hse qrI+d4TXJtBhGmsXF2JOHqrD40jUfItML4Q8JSCBn17Sl2vr6qjm2SEdiuExrQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y3GQk200cz16F9; Wed, 4 Dec 2024 12:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B4C4Ets049823; Wed, 4 Dec 2024 12:04:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B4C4EtT049820; Wed, 4 Dec 2024 12:04:14 GMT (envelope-from git) Date: Wed, 4 Dec 2024 12:04:14 GMT Message-Id: <202412041204.4B4C4EtT049820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: 1b4b19841cbd - stable/14 - sound: Dissolve pcm/intpcm.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1b4b19841cbdf537ef723b38eb22f21493c0174d Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=1b4b19841cbdf537ef723b38eb22f21493c0174d commit 1b4b19841cbdf537ef723b38eb22f21493c0174d Author: Christos Margiolis AuthorDate: 2024-12-02 16:26:38 +0000 Commit: Christos Margiolis CommitDate: 2024-12-04 12:03:36 +0000 sound: Dissolve pcm/intpcm.h Part of a series of patches to cleanup/simplify pcm/. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D47736 (cherry picked from commit 88eaa1504d12c82a36d83c16e9fd6c41175d2e0a) --- sys/dev/sound/pcm/feeder.h | 7 ++ sys/dev/sound/pcm/feeder_format.c | 106 ++++++++++++++++++++++++++++-- sys/dev/sound/pcm/g711.h | 11 ---- sys/dev/sound/pcm/intpcm.h | 135 -------------------------------------- sys/dev/sound/pcm/sound.h | 1 + 5 files changed, 109 insertions(+), 151 deletions(-) diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h index 60b8280e59ef..bd0d9dcb8f9c 100644 --- a/sys/dev/sound/pcm/feeder.h +++ b/sys/dev/sound/pcm/feeder.h @@ -161,6 +161,13 @@ int feeder_matrix_setup(struct pcm_feeder *, struct pcmchan_matrix *, struct pcmchan_matrix *); int feeder_matrix_compare(struct pcmchan_matrix *, struct pcmchan_matrix *); +/* feeder_format */ +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); + /* 4Front OSS stuffs */ int feeder_matrix_oss_get_channel_order(struct pcmchan_matrix *, unsigned long long *); diff --git a/sys/dev/sound/pcm/feeder_format.c b/sys/dev/sound/pcm/feeder_format.c index 3bdd808df0ee..53c7d3768a32 100644 --- a/sys/dev/sound/pcm/feeder_format.c +++ b/sys/dev/sound/pcm/feeder_format.c @@ -36,9 +36,7 @@ #include "opt_snd.h" #endif #include -#include #include -#include #include "feeder_if.h" #define SND_USE_FXDIV @@ -47,8 +45,6 @@ #define FEEDFORMAT_RESERVOIR (SND_CHN_MAX * PCM_32_BPS) -INTPCM_DECLARE(intpcm_conv_tables) - struct feed_format_info { uint32_t ibps, obps; uint32_t ialign, oalign, channels; @@ -57,6 +53,107 @@ struct feed_format_info { 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]; + const uint8_t u8_to_ulaw[G711_TABLE_SIZE]; + const uint8_t u8_to_alaw[G711_TABLE_SIZE]; +} xlaw_conv_tables = { + ULAW_TO_U8, + ALAW_TO_U8, + U8_TO_ULAW, + 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) +{ + *dst = _INTPCM_TO_G711(xlaw_conv_tables.u8_to_ulaw, v >> 24); +} + +static __inline void +intpcm_write_alaw(uint8_t *dst, intpcm_t v) +{ + *dst = _INTPCM_TO_G711(xlaw_conv_tables.u8_to_alaw, v >> 24); +} + /* * dummy ac3/dts passthrough, etc. * XXX assume as s16le. @@ -269,7 +366,6 @@ static kobj_method_t feeder_format_methods[] = { FEEDER_DECLARE(feeder_format, NULL); -/* Extern */ intpcm_read_t * feeder_format_read_op(uint32_t format) { diff --git a/sys/dev/sound/pcm/g711.h b/sys/dev/sound/pcm/g711.h index b7a57dd17a6b..481ef368e144 100644 --- a/sys/dev/sound/pcm/g711.h +++ b/sys/dev/sound/pcm/g711.h @@ -176,15 +176,4 @@ #define _INTPCM_TO_G711(t, v) ((t)[(uint8_t)((v) ^ 0x80)]) -#define G711_DECLARE_TABLE(t) \ -static const struct { \ - const uint8_t ulaw_to_u8[G711_TABLE_SIZE]; \ - const uint8_t alaw_to_u8[G711_TABLE_SIZE]; \ - const uint8_t u8_to_ulaw[G711_TABLE_SIZE]; \ - const uint8_t u8_to_alaw[G711_TABLE_SIZE]; \ -} t = { \ - ULAW_TO_U8, ALAW_TO_U8, \ - U8_TO_ULAW, U8_TO_ALAW \ -} - #endif /* !_SND_G711_H_ */ diff --git a/sys/dev/sound/pcm/intpcm.h b/sys/dev/sound/pcm/intpcm.h deleted file mode 100644 index 1e85535feec1..000000000000 --- a/sys/dev/sound/pcm/intpcm.h +++ /dev/null @@ -1,135 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2008-2009 Ariff Abdullah - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _SND_INTPCM_H_ -#define _SND_INTPCM_H_ - -typedef intpcm_t intpcm_read_t(uint8_t *); -typedef void intpcm_write_t(uint8_t *, intpcm_t); - -extern intpcm_read_t *feeder_format_read_op(uint32_t); -extern intpcm_write_t *feeder_format_write_op(uint32_t); - -#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); \ -} - -#define INTPCM_DECLARE(t) \ - \ -G711_DECLARE_TABLE(t); \ - \ -static __inline intpcm_t \ -intpcm_read_ulaw(uint8_t *src) \ -{ \ - \ - return (_G711_TO_INTPCM((t).ulaw_to_u8, *src) << 24); \ -} \ - \ -static __inline intpcm_t \ -intpcm_read_alaw(uint8_t *src) \ -{ \ - \ - return (_G711_TO_INTPCM((t).alaw_to_u8, *src) << 24); \ -} \ - \ -static __inline void \ -intpcm_write_ulaw(uint8_t *dst, intpcm_t v) \ -{ \ - \ - *dst = _INTPCM_TO_G711((t).u8_to_ulaw, v >> 24); \ -} \ - \ -static __inline void \ -intpcm_write_alaw(uint8_t *dst, intpcm_t v) \ -{ \ - \ - *dst = _INTPCM_TO_G711((t).u8_to_alaw, v >> 24); \ -} \ - \ -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) - -#endif /* !_SND_INTPCM_H_ */ diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index 467adad2ddff..e70a61f3b6d5 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -85,6 +85,7 @@ struct snd_mixer; #include #include #include +#include #include #include #include