From nobody Thu Nov 13 21:55:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583696068; cv=none; d=zohomail.com; s=zohoarc; b=EpLUMjmjYy4Ec2ZTT/F3ikDeVYnrgif1qr8L7Y/yR4EUS9r/MhOmli31wfq0HRUBdDT1ooCqr5SS57ayEAhFihsk+jCb/Z+p/5TlXjpOjoi8Ie94+GxfMv4eW58lWeZnCQdOeXrwKer1HbVRAyCO7mp50O6spKVS+gRCO+Cm2dI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583696068; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Nuw2PWPV3b4+8bh5UZTSfiKZnhg48b+BZW9CDDj9iyQ=; b=GUXVxlu5DcqLjg/yMz2iZRyLivNqU/ggC5+5CGTuSAPhGaf6U/BqClzBxDuUpkGNls0sEHAUz45P8HPdtoQ82d1zvX6UwBklMLJxe0/u3K2YqWC8KewjiiEkxlgQpwoCKJ3jD9zl11KzFasuPhWiTH4/KeEWlJrw6pqfOkKRzwQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583696068568827.9738032058534; Sun, 8 Mar 2020 12:34:28 -0700 (PDT) Received: from localhost ([::1]:32782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1gx-00037w-AZ for importer@patchew.org; Sun, 08 Mar 2020 15:34:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37217) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1g4-0002M1-8L for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jB1g3-0006yr-5E for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:32 -0400 Received: from mailout10.t-online.de ([194.25.134.21]:49888) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jB1g2-0006wP-Vk for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:31 -0400 Received: from fwd06.aul.t-online.de (fwd06.aul.t-online.de [172.20.26.150]) by mailout10.t-online.de (Postfix) with SMTP id 14FAE4165D96; Sun, 8 Mar 2020 20:33:29 +0100 (CET) Received: from linpower.localnet (XReU-mZZQhI6NGU+UoUy87MrAIlOqJbOOXetIVaUTayBZ-aL+q3mTM4XvB0LV+sQpf@[79.208.31.100]) by fwd06.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1jB1fu-1l2zU80; Sun, 8 Mar 2020 20:33:22 +0100 Received: by linpower.localnet (Postfix, from userid 1000) id 928792000A6; Sun, 8 Mar 2020 20:33:21 +0100 (CET) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Gerd Hoffmann , Eric Blake , Markus Armbruster Subject: [PATCH v2 1/6] qapi/audio: add documentation for AudioFormat Date: Sun, 8 Mar 2020 20:33:16 +0100 Message-Id: <20200308193321.20668-1-vr_qemu@t-online.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> References: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> MIME-Version: 1.0 X-ID: XReU-mZZQhI6NGU+UoUy87MrAIlOqJbOOXetIVaUTayBZ-aL+q3mTM4XvB0LV+sQpf X-TOI-MSGID: 74427376-a2b6-4fac-85d0-4a967bf350b2 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.25.134.21 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Arbuckle , Howard Spoelstra , Mark Cave-Ayland , QEMU , =?UTF-8?q?Zolt=C3=A1n=20K=C5=91v=C3=A1g=C3=B3?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The review for patch ed2a4a7941 "audio: proper support for float samples in mixeng" suggested this would be a good idea. Acked-by: Markus Armbruster Signed-off-by: Volker R=C3=BCmelin Tested-by: John Arbuckle --- qapi/audio.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qapi/audio.json b/qapi/audio.json index d8c507cced..c31251f45b 100644 --- a/qapi/audio.json +++ b/qapi/audio.json @@ -273,6 +273,20 @@ # # An enumeration of possible audio formats. # +# @u8: unsigned 8 bit integer +# +# @s8: signed 8 bit integer +# +# @u16: unsigned 16 bit integer +# +# @s16: signed 16 bit integer +# +# @u32: unsigned 32 bit integer +# +# @s32: signed 32 bit integer +# +# @f32: single precision floating-point (since 5.0) +# # Since: 4.0 ## { 'enum': 'AudioFormat', --=20 2.16.4 From nobody Thu Nov 13 21:55:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583696071; cv=none; d=zohomail.com; s=zohoarc; b=j2JB63JLSTlnbB1AG6X2Gg1CTCXg3+AzA33M39JuDg6YGctnUpWvcI6mj+Dgc2H+RIOQKXajo3MaAmN5QpHiGBqMlokSl9eI7Diit+UJJZnZOuZ8y6jtcpsxB6VXUsFdP+7azwG2EC1u3HwIQv1HCTbqGQAUSJs6RqMfGntS0kQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583696071; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GntLXVGHD3UYm5nYNi/s7lQdO8kwaYrYamlt4IjbEQQ=; b=ONM6Wnj1YRd7UP86JuVL4k26dVYlMRGzk95UjcZiA9ZHyiYYIzYLV36RZmSVVysXiB8fK05e8kUJo11uAQlxy5J69pY6BeoX8E02n1NeyEeEgq1cYq+VAjpCd8ZTZnl4wITzpnNyIfieDuOG0DGZw3LgIRu76dAxtRqu8GMULBE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15836960715207.166618386946766; Sun, 8 Mar 2020 12:34:31 -0700 (PDT) Received: from localhost ([::1]:32784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1h0-0003DM-JA for importer@patchew.org; Sun, 08 Mar 2020 15:34:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37235) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1g5-0002M8-BM for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jB1g3-0006yz-Ab for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:32 -0400 Received: from mailout09.t-online.de ([194.25.134.84]:48622) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jB1g3-0006wU-0p for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:31 -0400 Received: from fwd25.aul.t-online.de (fwd25.aul.t-online.de [172.20.26.130]) by mailout09.t-online.de (Postfix) with SMTP id 19EDE4230EEB; Sun, 8 Mar 2020 20:33:29 +0100 (CET) Received: from linpower.localnet (GWwSMcZCohoZDM9rI++fNADFZQEoH8vN3SJNnetaZW4WDBrCd9lH8gqyjD6HFGTwwa@[79.208.31.100]) by fwd25.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1jB1fw-1s6DFQ0; Sun, 8 Mar 2020 20:33:24 +0100 Received: by linpower.localnet (Postfix, from userid 1000) id 94C5D200637; Sun, 8 Mar 2020 20:33:21 +0100 (CET) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Gerd Hoffmann , Eric Blake , Markus Armbruster Subject: [PATCH v2 2/6] audio: change naming scheme of FLOAT_CONV macros Date: Sun, 8 Mar 2020 20:33:17 +0100 Message-Id: <20200308193321.20668-2-vr_qemu@t-online.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> References: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> MIME-Version: 1.0 X-ID: GWwSMcZCohoZDM9rI++fNADFZQEoH8vN3SJNnetaZW4WDBrCd9lH8gqyjD6HFGTwwa X-TOI-MSGID: b5b192e7-bc73-4bf1-bcc8-50842ebb173f Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.25.134.84 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Arbuckle , Howard Spoelstra , Mark Cave-Ayland , QEMU , =?UTF-8?q?Zolt=C3=A1n=20K=C5=91v=C3=A1g=C3=B3?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This patch changes the naming scheme of the FLOAT_CONV_TO and FLOAT_CONV_FROM macros to the scheme used in mixeng_template.h. Signed-off-by: Volker R=C3=BCmelin --- audio/mixeng.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/audio/mixeng.c b/audio/mixeng.c index c14b0d874c..b57fad83bf 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -268,17 +268,17 @@ f_sample *mixeng_clip[2][2][2][3] =3D { }; =20 #ifdef FLOAT_MIXENG -#define FLOAT_CONV_TO(x) (x) -#define FLOAT_CONV_FROM(x) (x) +#define CONV_NATURAL_FLOAT(x) (x) +#define CLIP_NATURAL_FLOAT(x) (x) #else static const float float_scale =3D UINT_MAX; -#define FLOAT_CONV_TO(x) ((x) * float_scale) +#define CONV_NATURAL_FLOAT(x) ((x) * float_scale) =20 #ifdef RECIPROCAL static const float float_scale_reciprocal =3D 1.f / UINT_MAX; -#define FLOAT_CONV_FROM(x) ((x) * float_scale_reciprocal) +#define CLIP_NATURAL_FLOAT(x) ((x) * float_scale_reciprocal) #else -#define FLOAT_CONV_FROM(x) ((x) / float_scale) +#define CLIP_NATURAL_FLOAT(x) ((x) / float_scale) #endif #endif =20 @@ -288,7 +288,7 @@ static void conv_natural_float_to_mono(struct st_sample= *dst, const void *src, float *in =3D (float *)src; =20 while (samples--) { - dst->r =3D dst->l =3D FLOAT_CONV_TO(*in++); + dst->r =3D dst->l =3D CONV_NATURAL_FLOAT(*in++); dst++; } } @@ -299,8 +299,8 @@ static void conv_natural_float_to_stereo(struct st_samp= le *dst, const void *src, float *in =3D (float *)src; =20 while (samples--) { - dst->l =3D FLOAT_CONV_TO(*in++); - dst->r =3D FLOAT_CONV_TO(*in++); + dst->l =3D CONV_NATURAL_FLOAT(*in++); + dst->r =3D CONV_NATURAL_FLOAT(*in++); dst++; } } @@ -316,7 +316,7 @@ static void clip_natural_float_from_mono(void *dst, con= st struct st_sample *src, float *out =3D (float *)dst; =20 while (samples--) { - *out++ =3D FLOAT_CONV_FROM(src->l) + FLOAT_CONV_FROM(src->r); + *out++ =3D CLIP_NATURAL_FLOAT(src->l) + CLIP_NATURAL_FLOAT(src->r); src++; } } @@ -327,8 +327,8 @@ static void clip_natural_float_from_stereo( float *out =3D (float *)dst; =20 while (samples--) { - *out++ =3D FLOAT_CONV_FROM(src->l); - *out++ =3D FLOAT_CONV_FROM(src->r); + *out++ =3D CLIP_NATURAL_FLOAT(src->l); + *out++ =3D CLIP_NATURAL_FLOAT(src->r); src++; } } --=20 2.16.4 From nobody Thu Nov 13 21:55:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583696239; cv=none; d=zohomail.com; s=zohoarc; b=jU8tz5H3fIhCDu3XSD+bK8yDlSSUGA9nIj4FuAIwmuLuXyR0M6WGfx89ATu49CLOYTrwdOwF5btDpxcZzSCD7Pv/WJA4nBHivoutGPQKYltMilWDgnMvArg1ykbxIKtiSkswIPcyZB17F+y5+UWV49afDgH9+bpDiyjBualGwHc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583696239; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1nawZfC8o5ovTki9+dr/K8Rdkcy1znxgyGy8ZagPCo0=; b=ihaRBGWC2QLEqpC9o65HDczkIZLqha/k5nI0cD5LpTKQoExv0qDsSEbDZgHVdMzYutZ16c84IbfziH2kO7n3U8uYJJtTvNsgKwre2qX9/jIwCsuuaePfBTZSQEUJGQWFpUlErzxGzGzx9Gooqvj22+cLHroF+wEBmV6l98jKpqk= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583696239907105.22917646006397; Sun, 8 Mar 2020 12:37:19 -0700 (PDT) Received: from localhost ([::1]:32818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1ji-0006bs-LL for importer@patchew.org; Sun, 08 Mar 2020 15:37:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37245) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1g5-0002M9-Ns for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jB1g3-0006zD-S3 for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:33 -0400 Received: from mailout10.t-online.de ([194.25.134.21]:49904) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jB1g3-0006yO-M8 for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:31 -0400 Received: from fwd21.aul.t-online.de (fwd21.aul.t-online.de [172.20.27.66]) by mailout10.t-online.de (Postfix) with SMTP id C08114165D92; Sun, 8 Mar 2020 20:33:30 +0100 (CET) Received: from linpower.localnet (rfXi7EZcYhEYaecl9IiV6vn0SfQ5qcJ2B5vqiHMlset2WbpnC2qcATxOtNr2iJUwwm@[79.208.31.100]) by fwd21.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1jB1fz-2eqGjw0; Sun, 8 Mar 2020 20:33:27 +0100 Received: by linpower.localnet (Postfix, from userid 1000) id 95A842006CD; Sun, 8 Mar 2020 20:33:21 +0100 (CET) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Gerd Hoffmann , Eric Blake , Markus Armbruster Subject: [PATCH v2 3/6] audio: consistency changes Date: Sun, 8 Mar 2020 20:33:18 +0100 Message-Id: <20200308193321.20668-3-vr_qemu@t-online.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> References: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> MIME-Version: 1.0 X-ID: rfXi7EZcYhEYaecl9IiV6vn0SfQ5qcJ2B5vqiHMlset2WbpnC2qcATxOtNr2iJUwwm X-TOI-MSGID: 4f0e0210-3d2d-468a-a782-98d07c436075 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.25.134.21 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Arbuckle , Howard Spoelstra , Mark Cave-Ayland , QEMU , =?UTF-8?q?Zolt=C3=A1n=20K=C5=91v=C3=A1g=C3=B3?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Change the clip_natural_float_from_mono() function in audio/mixeng.c to be consistent with the clip_*_from_mono() functions in audio/mixeng_template.h. Signed-off-by: Volker R=C3=BCmelin --- audio/mixeng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/mixeng.c b/audio/mixeng.c index b57fad83bf..725b529be7 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -316,7 +316,7 @@ static void clip_natural_float_from_mono(void *dst, con= st struct st_sample *src, float *out =3D (float *)dst; =20 while (samples--) { - *out++ =3D CLIP_NATURAL_FLOAT(src->l) + CLIP_NATURAL_FLOAT(src->r); + *out++ =3D CLIP_NATURAL_FLOAT(src->l + src->r); src++; } } --=20 2.16.4 From nobody Thu Nov 13 21:55:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583696171; cv=none; d=zohomail.com; s=zohoarc; b=G9ibBYODjd11g2eUOynFK7kospxk4KTAtnJkgGZe3OY1Xxauc8kUTrxg+nn01FA3Zz5ihJePjysSh4DzjGnidnlXLfr5l5BzvrY2VtEOG3E8kyKGmANK5c1+hrop4vZOm86iIohb6g8i5IPWdnOdGzwK+gZWVS7Pu6Wpl6bgLAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583696171; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jG6FWE6X+WHSFmSXDMb5ENhfNfFUhlMEkQks32dQFoQ=; b=WIumxVBP7he/se5rpIJMKmTVsSPIJu2M+NDcACKQk8CqcMCeTZBStyU+hFTlA4hdtDW7qtsd/e6M4OysmHwahMLdmgeVmZijPDn+KsDZQ5ViDae9Xi4ye1e4oD2KReH2KN2nkCieC1clBZIjG/bN4qlOZSvHT1Wy57zU8kvfzt8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583696171519839.2874941914408; Sun, 8 Mar 2020 12:36:11 -0700 (PDT) Received: from localhost ([::1]:32806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1ib-0004x9-RI for importer@patchew.org; Sun, 08 Mar 2020 15:36:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37232) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1g5-0002M3-4Q for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jB1g4-0006zS-2I for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:33 -0400 Received: from mailout03.t-online.de ([194.25.134.81]:34764) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jB1g3-0006y8-O0 for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:32 -0400 Received: from fwd30.aul.t-online.de (fwd30.aul.t-online.de [172.20.26.135]) by mailout03.t-online.de (Postfix) with SMTP id 3BF4B427E7BA; Sun, 8 Mar 2020 20:33:30 +0100 (CET) Received: from linpower.localnet (bKrPuwZpghIMNnwLloP6R4aXGWFA3l4WO3GmYYVfqsj5gGep5BSwUkf0Y5u7mHrgLk@[79.208.31.100]) by fwd30.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1jB1g2-3QOuAq0; Sun, 8 Mar 2020 20:33:30 +0100 Received: by linpower.localnet (Postfix, from userid 1000) id 978482006CE; Sun, 8 Mar 2020 20:33:21 +0100 (CET) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Gerd Hoffmann , Eric Blake , Markus Armbruster Subject: [PATCH v2 4/6] audio: change mixing engine float range to [-1.f, 1.f] Date: Sun, 8 Mar 2020 20:33:19 +0100 Message-Id: <20200308193321.20668-4-vr_qemu@t-online.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> References: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> MIME-Version: 1.0 X-ID: bKrPuwZpghIMNnwLloP6R4aXGWFA3l4WO3GmYYVfqsj5gGep5BSwUkf0Y5u7mHrgLk X-TOI-MSGID: 89289e91-17ab-489f-bae7-5654794d4ba6 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.25.134.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Arbuckle , Howard Spoelstra , Mark Cave-Ayland , QEMU , =?UTF-8?q?Zolt=C3=A1n=20K=C5=91v=C3=A1g=C3=B3?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Currently the internal float range of the mixing engine is [-.5f, .5f]. PulseAudio, SDL2 and libasound use a [-1.f, 1.f] range. This means with float samples the audio playback volume is 6dB too low and audio recording signals will be clipped in most cases. To avoid another scaling factor in the conv_natural_float_* and clip_natural_float_* functions with FLOAT_MIXENG defined this patch changes the mixing engine float range to [-1.f, 1.f]. Signed-off-by: Volker R=C3=BCmelin --- audio/mixeng.c | 4 ++-- audio/mixeng_template.h | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/audio/mixeng.c b/audio/mixeng.c index 725b529be7..739a500449 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -271,11 +271,11 @@ f_sample *mixeng_clip[2][2][2][3] =3D { #define CONV_NATURAL_FLOAT(x) (x) #define CLIP_NATURAL_FLOAT(x) (x) #else -static const float float_scale =3D UINT_MAX; +static const float float_scale =3D UINT_MAX / 2.f; #define CONV_NATURAL_FLOAT(x) ((x) * float_scale) =20 #ifdef RECIPROCAL -static const float float_scale_reciprocal =3D 1.f / UINT_MAX; +static const float float_scale_reciprocal =3D 2.f / UINT_MAX; #define CLIP_NATURAL_FLOAT(x) ((x) * float_scale_reciprocal) #else #define CLIP_NATURAL_FLOAT(x) ((x) / float_scale) diff --git a/audio/mixeng_template.h b/audio/mixeng_template.h index 77cc89b9e8..fc8e1d4d9e 100644 --- a/audio/mixeng_template.h +++ b/audio/mixeng_template.h @@ -41,32 +41,31 @@ static inline mixeng_real glue (conv_, ET) (IN_T v) =20 #ifdef RECIPROCAL #ifdef SIGNED - return nv * (1.f / (mixeng_real) (IN_MAX - IN_MIN)); + return nv * (2.f / ((mixeng_real)IN_MAX - IN_MIN)); #else - return (nv - HALF) * (1.f / (mixeng_real) IN_MAX); + return (nv - HALF) * (2.f / (mixeng_real)IN_MAX); #endif #else /* !RECIPROCAL */ #ifdef SIGNED - return nv / (mixeng_real) ((mixeng_real) IN_MAX - IN_MIN); + return nv / (((mixeng_real)IN_MAX - IN_MIN) / 2.f); #else - return (nv - HALF) / (mixeng_real) IN_MAX; + return (nv - HALF) / ((mixeng_real)IN_MAX / 2.f); #endif #endif } =20 static inline IN_T glue (clip_, ET) (mixeng_real v) { - if (v >=3D 0.5) { + if (v >=3D 1.f) { return IN_MAX; - } - else if (v < -0.5) { + } else if (v < -1.f) { return IN_MIN; } =20 #ifdef SIGNED - return ENDIAN_CONVERT ((IN_T) (v * ((mixeng_real) IN_MAX - IN_MIN))); + return ENDIAN_CONVERT((IN_T)(v * (((mixeng_real)IN_MAX - IN_MIN) / 2.f= ))); #else - return ENDIAN_CONVERT ((IN_T) ((v * IN_MAX) + HALF)); + return ENDIAN_CONVERT((IN_T)((v * ((mixeng_real)IN_MAX / 2.f)) + HALF)= ); #endif } =20 --=20 2.16.4 From nobody Thu Nov 13 21:55:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583696172; cv=none; d=zohomail.com; s=zohoarc; b=nn9aubaAXpjaZUI+VgJOmpHdUrUSg5aGyHVUXr+PdzF6wCNBKgLLlFkSgiJ/CLi9W8AcS9lOTqK87z+g9uxc+aom15eXmd6KF0lQPxyChY/YBiDLTek4soq+67ODCtBn6Zpykzu7w2LEvERQKv8WyviP29WDd/66nP6tQ+ZbxbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583696172; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2P7DtZP9Ew8I3tQ9CE1ef2w0h0dKJQ1zJOs1xQCaz7U=; b=U5yN1HxBqsXZoeF+bTaP1eaUQnLD1PfWwFCcJJkD8fZkB3U4bLv04pQGpnkDofLDhVtLjAqV7iFIzmMJQhsSCPON7J0+YnbgdzF/Ij05/zlyaAl9dmqiBQ+rDqeev3ip0mD1GwXvCv9RxXYDevgccWiszm1nwr7FB+1o2G9k90w= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583696172549687.4958253917071; Sun, 8 Mar 2020 12:36:12 -0700 (PDT) Received: from localhost ([::1]:32808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1id-0004yi-93 for importer@patchew.org; Sun, 08 Mar 2020 15:36:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37267) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1g9-0002Rk-RQ for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jB1g8-000723-UQ for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:37 -0400 Received: from mailout06.t-online.de ([194.25.134.19]:48954) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jB1g8-00071Z-OI for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:36 -0400 Received: from fwd24.aul.t-online.de (fwd24.aul.t-online.de [172.20.26.129]) by mailout06.t-online.de (Postfix) with SMTP id 6CF10417E467; Sun, 8 Mar 2020 20:33:35 +0100 (CET) Received: from linpower.localnet (rXpqIYZfohqLY+clO6MgLyQ3aZgR2oSiY7BLQbrYIZnbOIaXplSPlwfrDvRRXsLZPv@[79.208.31.100]) by fwd24.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1jB1g4-1Samyu0; Sun, 8 Mar 2020 20:33:32 +0100 Received: by linpower.localnet (Postfix, from userid 1000) id 99A702006D0; Sun, 8 Mar 2020 20:33:21 +0100 (CET) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Gerd Hoffmann , Eric Blake , Markus Armbruster Subject: [PATCH v2 5/6] audio: fix saturation nonlinearity in clip_* functions Date: Sun, 8 Mar 2020 20:33:20 +0100 Message-Id: <20200308193321.20668-5-vr_qemu@t-online.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> References: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> MIME-Version: 1.0 X-ID: rXpqIYZfohqLY+clO6MgLyQ3aZgR2oSiY7BLQbrYIZnbOIaXplSPlwfrDvRRXsLZPv X-TOI-MSGID: ea02d5cd-b794-468a-8c7a-c5530fe25ba6 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.25.134.19 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Arbuckle , Howard Spoelstra , Mark Cave-Ayland , QEMU , =?UTF-8?q?Zolt=C3=A1n=20K=C5=91v=C3=A1g=C3=B3?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The current positive limit for the saturation nonlinearity is only correct if the type of the result has 8 bits or less. Signed-off-by: Volker R=C3=BCmelin --- audio/mixeng_template.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/audio/mixeng_template.h b/audio/mixeng_template.h index fc8e1d4d9e..bc8509e423 100644 --- a/audio/mixeng_template.h +++ b/audio/mixeng_template.h @@ -83,10 +83,9 @@ static inline int64_t glue (conv_, ET) (IN_T v) =20 static inline IN_T glue (clip_, ET) (int64_t v) { - if (v >=3D 0x7f000000) { + if (v >=3D 0x7fffffffLL) { return IN_MAX; - } - else if (v < -2147483648LL) { + } else if (v < -2147483648LL) { return IN_MIN; } =20 --=20 2.16.4 From nobody Thu Nov 13 21:55:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583696242; cv=none; d=zohomail.com; s=zohoarc; b=RcGiJxeJNdl4tKz7Qgz5F5xQFe1Ns/WMPSPFp3tiCZYJunM8QWtircLksleoUcXo/LUmL3E7itKa78y0LzvVzssINT85O6rQKGnfWCKaIgBGCtTQWGRZLAfezXs+Wp1P+9cl4ew6bqgTGncaE5XPbbZS/9meQTWvzQvlP/qWz1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583696242; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MTC3IO1Ks6d1oDzbTH7rYqxOi1tt5KllBN52OjwWIzk=; b=ZWjpOHSu4CLCB1BYtI8wh+OYFDPeLitYuY/+7f/btaWJ7HkcePqhGW0gsRjVhBOR912QyxMXs0DF18YRosWcF9TYtHkeDIq8uxvABBe1m9yPO0Ykew6h6o6BeyB8UXJX6kN3UuMG4fSaYWDXc8EVaC4335/PWrWFaliNgfUOuA0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583696242123659.0161804614285; Sun, 8 Mar 2020 12:37:22 -0700 (PDT) Received: from localhost ([::1]:32820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1jk-0006fh-Vm for importer@patchew.org; Sun, 08 Mar 2020 15:37:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37278) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jB1gF-0002b1-SY for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jB1gD-00074I-VI for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:43 -0400 Received: from mailout04.t-online.de ([194.25.134.18]:59386) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jB1gD-00073f-PT for qemu-devel@nongnu.org; Sun, 08 Mar 2020 15:33:41 -0400 Received: from fwd23.aul.t-online.de (fwd23.aul.t-online.de [172.20.26.128]) by mailout04.t-online.de (Postfix) with SMTP id 7A76241FBAE9; Sun, 8 Mar 2020 20:33:40 +0100 (CET) Received: from linpower.localnet (ZGIpCEZfYhOFuRT-iXyhPwadEndrGEIus5q6UampyI1dAeVKSKH820GPUD2w-jhZUD@[79.208.31.100]) by fwd23.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1jB1g7-4CbgkS0; Sun, 8 Mar 2020 20:33:35 +0100 Received: by linpower.localnet (Postfix, from userid 1000) id 9BC152006D1; Sun, 8 Mar 2020 20:33:21 +0100 (CET) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Gerd Hoffmann , Eric Blake , Markus Armbruster Subject: [PATCH v2 6/6] audio: add audiodev format=f32 option documentation Date: Sun, 8 Mar 2020 20:33:21 +0100 Message-Id: <20200308193321.20668-6-vr_qemu@t-online.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> References: <2a4ade5f-d39b-3094-578f-6cced4650720@t-online.de> MIME-Version: 1.0 X-ID: ZGIpCEZfYhOFuRT-iXyhPwadEndrGEIus5q6UampyI1dAeVKSKH820GPUD2w-jhZUD X-TOI-MSGID: d23c3cc6-9297-41cf-8435-c13075e488a8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.25.134.18 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Arbuckle , Howard Spoelstra , Mark Cave-Ayland , QEMU , =?UTF-8?q?Zolt=C3=A1n=20K=C5=91v=C3=A1g=C3=B3?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The documentaion for -audiodev format=3Df32 option was missing. Signed-off-by: Volker R=C3=BCmelin --- qemu-options.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index f9fefd43be..2919eddf4d 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -551,7 +551,7 @@ DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev, " in|out.frequency=3D frequency to use with fixed setti= ngs\n" " in|out.channels=3D number of channels to use with fix= ed settings\n" " in|out.format=3D sample format to use with fixed sett= ings\n" - " valid values: s8, s16, s32, u8, u16, u32\n" + " valid values: s8, s16, s32, u8, u16, u32, f32\n" " in|out.voices=3D number of voices to use\n" " in|out.buffer-length=3D length of buffer in microseco= nds\n" "-audiodev none,id=3Did,[,prop[=3Dvalue][,...]]\n" @@ -647,7 +647,7 @@ SRST ``in|out.format=3Dformat`` Specify the sample format to use when using fixed-settings. Valid values are: ``s8``, ``s16``, ``s32``, ``u8``, ``u16``, - ``u32``. Default is ``s16``. + ``u32``, ``f32``. Default is ``s16``. =20 ``in|out.voices=3Dvoices`` Specify the number of voices to use. Default is 1. --=20 2.16.4