Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1726725/?format=api
{ "id": 1726725, "url": "http://patchwork.ozlabs.org/api/patches/1726725/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20230115131224.30751-9-volker.ruemelin@t-online.de/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20230115131224.30751-9-volker.ruemelin@t-online.de>", "list_archive_url": null, "date": "2023-01-15T13:12:16", "name": "[09/17] audio/mixeng: calculate number of input frames", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "15acd7bbc36ad7ea1e80cd5e83b444d40d048923", "submitter": { "id": 83211, "url": "http://patchwork.ozlabs.org/api/people/83211/?format=api", "name": "Volker Rümelin", "email": "volker.ruemelin@t-online.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20230115131224.30751-9-volker.ruemelin@t-online.de/mbox/", "series": [ { "id": 336714, "url": "http://patchwork.ozlabs.org/api/series/336714/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=336714", "date": "2023-01-15T13:08:29", "name": "[01/17] audio: change type of mix_buf and conv_buf", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/336714/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1726725/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1726725/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=<UNKNOWN>)", "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4Nvwcl2wPtz23fk\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 16 Jan 2023 00:15:17 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1pH2oa-00044k-AO; Sun, 15 Jan 2023 08:12:48 -0500", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <volker.ruemelin@t-online.de>)\n id 1pH2oZ-00044K-4x\n for qemu-devel@nongnu.org; Sun, 15 Jan 2023 08:12:47 -0500", "from mailout02.t-online.de ([194.25.134.17])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <volker.ruemelin@t-online.de>)\n id 1pH2oX-0005Ak-Gw\n for qemu-devel@nongnu.org; Sun, 15 Jan 2023 08:12:46 -0500", "from fwd79.dcpf.telekom.de (fwd79.aul.t-online.de [10.223.144.105])\n by mailout02.t-online.de (Postfix) with SMTP id 4BC1313B18;\n Sun, 15 Jan 2023 14:12:44 +0100 (CET)", "from linpower.localnet ([79.208.25.151]) by fwd79.t-online.de\n with (TLSv1.3:TLS_AES_256_GCM_SHA384 encrypted)\n esmtp id 1pH2oV-01srmj0; Sun, 15 Jan 2023 14:12:43 +0100", "by linpower.localnet (Postfix, from userid 1000)\n id 66EDC20063C; Sun, 15 Jan 2023 14:12:24 +0100 (CET)" ], "From": "=?utf-8?q?Volker_R=C3=BCmelin?= <volker.ruemelin@t-online.de>", "To": "Gerd Hoffmann <kraxel@redhat.com>", "Cc": "qemu-devel@nongnu.org", "Subject": "[PATCH 09/17] audio/mixeng: calculate number of input frames", "Date": "Sun, 15 Jan 2023 14:12:16 +0100", "Message-Id": "<20230115131224.30751-9-volker.ruemelin@t-online.de>", "X-Mailer": "git-send-email 2.35.3", "In-Reply-To": "<61bd351f-0683-7f58-b746-66c9578a7cdc@t-online.de>", "References": "<61bd351f-0683-7f58-b746-66c9578a7cdc@t-online.de>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-TOI-MSGID": "96d41563-2a40-434e-8c7e-37f66554e933", "Received-SPF": "none client-ip=194.25.134.17;\n envelope-from=volker.ruemelin@t-online.de; helo=mailout02.t-online.de", "X-Spam_score_int": "-25", "X-Spam_score": "-2.6", "X-Spam_bar": "--", "X-Spam_report": "(-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\n SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "From: Volker Rümelin <vr_qemu@t-online.de>\n\nCalculate the exact number of audio input frames needed to get\na given number of audio output frames. The exact number of\nframes depends only on the difference of opos - ipos and the\nnumber of output frames. When downsampling, this function\nreturns the maximum number of input frames needed.\n\nThis function will later replace the audio_frontend_frames_out()\nfunction, which calculates the average number of input frames\nrounded down to the nearest integer.\n\nSigned-off-by: Volker Rümelin <vr_qemu@t-online.de>\n---\n audio/mixeng.c | 36 ++++++++++++++++++++++++++++++++++++\n audio/mixeng.h | 1 +\n 2 files changed, 37 insertions(+)", "diff": "diff --git a/audio/mixeng.c b/audio/mixeng.c\nindex fe454e0725..6bb3d54f77 100644\n--- a/audio/mixeng.c\n+++ b/audio/mixeng.c\n@@ -440,6 +440,42 @@ void st_rate_stop (void *opaque)\n g_free (opaque);\n }\n \n+/**\n+ * st_rate_frames_in() - returns the number of frames needed to\n+ * get frames_out frames after resampling\n+ *\n+ * @opaque: pointer to struct rate\n+ * @frames_out: number of frames\n+ */\n+uint32_t st_rate_frames_in(void *opaque, uint32_t frames_out)\n+{\n+ struct rate *rate = opaque;\n+ uint64_t opos_start, opos_end;\n+ uint32_t ipos_start, ipos_end;\n+\n+ if (rate->opos_inc == 1ULL << 32) {\n+ return frames_out;\n+ }\n+\n+ if (frames_out) {\n+ opos_start = rate->opos;\n+ ipos_start = rate->ipos;\n+ } else {\n+ uint64_t offset;\n+\n+ /* add offset = ceil(opos_inc) to opos and ipos to avoid an underflow */\n+ offset = (rate->opos_inc + (1ULL << 32) - 1) & ~((1ULL << 32) - 1);\n+ opos_start = rate->opos + offset;\n+ ipos_start = rate->ipos + (offset >> 32);\n+ }\n+ /* last frame written was at opos_start - rate->opos_inc */\n+ opos_end = opos_start - rate->opos_inc + rate->opos_inc * frames_out;\n+ ipos_end = (opos_end >> 32) + 1;\n+\n+ /* last frame read was at ipos_start - 1 */\n+ return ipos_end + 1 > ipos_start ? ipos_end + 1 - ipos_start : 0;\n+}\n+\n void mixeng_clear (struct st_sample *buf, int len)\n {\n memset (buf, 0, len * sizeof (struct st_sample));\ndiff --git a/audio/mixeng.h b/audio/mixeng.h\nindex 2dcd6df245..64c1e231cc 100644\n--- a/audio/mixeng.h\n+++ b/audio/mixeng.h\n@@ -52,6 +52,7 @@ void st_rate_flow(void *opaque, st_sample *ibuf, st_sample *obuf,\n void st_rate_flow_mix(void *opaque, st_sample *ibuf, st_sample *obuf,\n size_t *isamp, size_t *osamp);\n void st_rate_stop (void *opaque);\n+uint32_t st_rate_frames_in(void *opaque, uint32_t frames_out);\n void mixeng_clear (struct st_sample *buf, int len);\n void mixeng_volume (struct st_sample *buf, int len, struct mixeng_volume *vol);\n \n", "prefixes": [ "09/17" ] }