From patchwork Fri Feb 17 19:55:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 40430 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp89094pzk; Fri, 17 Feb 2023 11:55:41 -0800 (PST) X-Google-Smtp-Source: AK7set/x78EdDrKnGEElRwykGL0lSvlJdpTwVcj8cdw5vDdolg6VoRD8npVivnRPRyCLQT1wJV+N X-Received: by 2002:a17:907:849:b0:8b1:d5c:986e with SMTP id ww9-20020a170907084900b008b10d5c986emr2479203ejb.15.1676663741190; Fri, 17 Feb 2023 11:55:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676663741; cv=none; d=google.com; s=arc-20160816; b=UrFR2PNXQeGRKEbtO87nKJDd4IHJ25uTEwPyRLVsNY6n8RIgwcOxzMsrd27BQ0i+nd VaIAWbOFQaot46hul5h1XvJaAZ9tlkE3CQzbss6UucsPTRJ2w3Gd/6/Yb0BU+jxdX703 JJ7MD4VlLsgawuoO3jf4Z7q0nQFwy2saW9x6HftPqvl24xeEP1w9DG5RzbHda5HH6VeF u25jNDBFVGszMfp1CRXpaZMTqhdNi9RxZ4oy1Qe4EjOIU5qSChX/XO7nixrpGzbSiUe6 Ms6tf8q5TfqfMUIqZKxe+omWgeAdUy+QzlJ/kiXXSxcS/J12Js7rKyNdzxg4jPLGHE27 CH4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=4KZAhFKZdMKJJQnLQxfDx6Byjo0QBeszR2X9FXSY360=; b=ofAC/oYpohZZXl3Q2HNKPwSJfwiA83T5CwM2L6RovQn6qz/TCzJ/fAblj2FXtBujXz qZW6/l/KptXXq/olGybYn/8SfiZsMkKnkdMBuTPt6K2yjEq8xMcjUB2LQRyyEGPILjOF V9Rv0Wg9bgzmp+u0XzpUAaLHHQvQIGnLEKaF0mfFuHz9CQb9fNLlTjw64REv+RowfHkP 29xU4Q8W+/Oc+R4/l6NxxCpbbZZFLB4jV7/qNHcr/omnaOrJ2hdOIhlxCzwN6/BD1I3Y 8EosxJgrpN46Tl+fH8YZ4rpihoL7vZC8K1O0SOqbhwfdM1exHOGD53+abOWS1oXDeVlb Mz3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="Pg/0Syfh"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id mt30-20020a170907619e00b008aac189f502si3600096ejc.504.2023.02.17.11.55.17; Fri, 17 Feb 2023 11:55:41 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="Pg/0Syfh"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 151CD68AEB3; Fri, 17 Feb 2023 21:55:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9F49268AEB3 for ; Fri, 17 Feb 2023 21:55:07 +0200 (EET) Received: by mail-oi1-f175.google.com with SMTP id q28so2285845oij.3 for ; Fri, 17 Feb 2023 11:55:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=pWniScVnSfXjjULK8iWnO3keGs99lCmSapMUSsdWkos=; b=Pg/0SyfhnRGqQ1/JKT41dbTWSL4qF9SHQ+iPBar8f9uXA8deb4DQhGibHSH3GBa4zE SEQuKVk0jSKM1ZemYF3bCwarRFzHUF3WMg8lCKDAecreFER6mhK5Ud2dTeSldpP08m1t LA+qe00Q5DjLmQOTDUI4f1UsrN0zubAmQkPN4KrYBwzMgWGvrKwKRgOAt9/uPODIXcRb 0NmPMHPaIz+8mRuWONnjqSQ08PZiHGDhLS5HVfMzw02UUGMyPzBInv1RVNXfwnAnOcpy T7ElqhyN7XL2GeEzihzUeUtsLQxjuDvvkzHApoMHOvSZ/SvCzkVmqSbAv46QpXFUsZOY 3gaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pWniScVnSfXjjULK8iWnO3keGs99lCmSapMUSsdWkos=; b=xdKU9wBy9u4EZ+61GsbYAO6+HDHlsb/zDRyCL8eyG/Z/6dz1LJ+j3KCgbAySB2vlBz wwa2pH9JsaIAuqeQF8/pxAwas049sh9ouDuG61gMlUA8F3yXZZVewobU+3jFxPcGpS1L CBQ4Bw/RtnQWn0lLgOvXwXuBsCi2HaW5Mmr/8gV17OHloFqd4V4OdFnhmhVhuh8PpPXp aahkTNnc0OCAZXKITuqY2gGUpxT2yJMhFtPvRO6BUTxcaiZTS/t7qjH+KSc83qZtCyZR b6JGAl9pbAS8iX741pUTaqgluqwl1YFnhEfoM186bhRpkWDTgd0kPzztD4sIhHWuDlvm lmMA== X-Gm-Message-State: AO0yUKV52Kgvjo+zuiTTE/fRmHDwVQK3cac65+LeiQbdhpquEqfo1V7U vhFvXDvcs7aPaB4CxAorzifCQK20tuI= X-Received: by 2002:a05:6808:7d9:b0:36d:ea30:7bdf with SMTP id f25-20020a05680807d900b0036dea307bdfmr1104510oij.49.1676663705536; Fri, 17 Feb 2023 11:55:05 -0800 (PST) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id q186-20020acac0c3000000b0037d74967ef6sm2158721oif.44.2023.02.17.11.55.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Feb 2023 11:55:04 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 Feb 2023 16:55:02 -0300 Message-Id: <20230217195504.43368-1-jamrial@gmail.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] doc/resampler.texi: add missing swr channel layout options X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: cvYehgF1sfKJ Signed-off-by: James Almer --- doc/resampler.texi | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/doc/resampler.texi b/doc/resampler.texi index 5ed3f4377a..d55654e7bc 100644 --- a/doc/resampler.texi +++ b/doc/resampler.texi @@ -11,16 +11,6 @@ programmatic use. @table @option -@item ich, in_channel_count -Set the number of input channels. Default value is 0. Setting this -value is not mandatory if the corresponding channel layout -@option{in_channel_layout} is set. - -@item och, out_channel_count -Set the number of output channels. Default value is 0. Setting this -value is not mandatory if the corresponding channel layout -@option{out_channel_layout} is set. - @item uch, used_channel_count Set the number of used input channels. Default value is 0. This option is only used for special remapping. @@ -41,8 +31,8 @@ Specify the output sample format. It is set by default to @code{none}. Set the internal sample format. Default value is @code{none}. This will automatically be chosen when it is not explicitly set. -@item icl, in_channel_layout -@item ocl, out_channel_layout +@item ichl, in_chlayout +@item ochl, out_chlayout Set the input/output channel layout. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils} From patchwork Fri Feb 17 19:55:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 40431 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp89149pzk; Fri, 17 Feb 2023 11:55:50 -0800 (PST) X-Google-Smtp-Source: AK7set90YHuIPi1PUgI1Y2SDc/znfwV5vnvJxdBNj6QIyDNhtK3WMuGfZ0PIjUky7YkZzl4qGbUK X-Received: by 2002:a17:906:3552:b0:889:ed81:dff7 with SMTP id s18-20020a170906355200b00889ed81dff7mr10399442eja.9.1676663749586; Fri, 17 Feb 2023 11:55:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676663749; cv=none; d=google.com; s=arc-20160816; b=wih8fXri/oCF1LYfNrI5z6vqILdsEhfmTR+oWwqDe17bf2StkVHM9ZmeftcqhqlrTm Ivp8WG0Dwv8plG+1CZJeLq3vay4MOlYiPk27wLcaqqqBaFhbCNbZ9GAzWeF9gi2PhgVL 91FqbdB6Br1XULZWYe+NjYwoad5dFivN0Ro8mmaraY/GBP6Ay4Fykl+aNZqYI9iRHrpR Sde59Psanj8b9hlA3AyKpUctNCAD5AGvKf2XLC7Yaphtqa7ZpsbNFOLlv+frGkiQfww8 Q24fD70XYYSkhCiNLvWm7UQtRCjTPwxaTXlj+VObVCKKbDHTKu3q1Y69Ij1k+MWPP0hr 5H0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=/8msJq8i0yG90MwRHrlRn+EBsTvNlLHu+mFSuwDsXRI=; b=MuO9ExfdTBaHqcL+bH+ZgEA3q68sCfmXdiHCIfEUAM2TmpMg6I3WEyfDMJ7ShO0GMI Mksq5IF/EVCeY85nlMQkr0eeuMMR3tyDO03Yr365hYRUsxgEbdeFhtqztspQSOhtwTjq gETqDuiqOWeLNsu0HskvqxuyZ+b64WAI/EsZIvPDC02pCS3XlXu1AzaowpjYWZVWeax3 c/Ypoeh91KeiP84r2emxUQlv16ruy3LgUL2Fwu+B7Z56+9a+xOy+3rMLJ3ymQT2xKmD6 6YnOWzb3O1cgKBKAXYMiJmv2nitObPmF1YBSYwa8hSQIszoIDntss3jp07Z0OwnWUpe/ NCBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ULShrGW9; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h7-20020a17090791c700b008b1347fa16esi5536910ejz.973.2023.02.17.11.55.26; Fri, 17 Feb 2023 11:55:49 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ULShrGW9; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 032E668BE77; Fri, 17 Feb 2023 21:55:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A3E6C68BDFD for ; Fri, 17 Feb 2023 21:55:09 +0200 (EET) Received: by mail-oi1-f177.google.com with SMTP id az13so2284446oib.12 for ; Fri, 17 Feb 2023 11:55:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xzIu2K59aBjFz5GfgVU1At97wgCPQ9Awk7+nbyk88i0=; b=ULShrGW9ZQriMS8bUGEchY+Q1vbSV9++4VRcBbTybtkq6FyHg0jyihwr9e2D53Js4l HWnUCtzy2G7xGHlaL39w6YEeVicpiH3P6bOxBKtYkELRWe0aubQS1XMNax1drEF9nsgm /cmHCzX1w1SlkcvGIzyzqSh3U0MApGrKOCAtp+hWrgLK0JN6aa61tRX1P6yOnoAm60bl jiGWSMNFmVTK3ynO66Qu48GxNz3OqP+BAIAYYrDAk0VgaGEJ9KS7s9zm3pZ76EOxAY9g UvuQCxZqFOQn56eqwXyxVmtk+kfojKCJuUa8UGbIojpC4h50eFmTna3wCYIDW9fWu5Uh T9vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xzIu2K59aBjFz5GfgVU1At97wgCPQ9Awk7+nbyk88i0=; b=ZDt4ZUiAg6U0GlZbmwKGJea5Bl8PGKcvEPTBAKUul5oikayxhu1HVK7samS4wZepVk cNsYDVSaM4FkBB4WRQdvjbRWLMww3B/GR3eSb8rgk4huVWROcZ8POz0Pix5KqlxN0FTW cfXXyo7KSk1kTVnXEu2TH2AWcYUkW9wUSwrOIqw5BsPs20UYvDeWLnNwUpxmCKAfpMuI Z/Q9mn/NHm4/pZ/gApEoxrXC8hhdfaYEKZQgwgUBjqfPjLZLtWqouAQ29J4RKZpsaE4+ B6rjJV7HodK88EwT01CJMDyiv78Hbb/RdZz3v4L4b1oZEbat/7OB0SAn4qu+QsGP5pTU /Hvg== X-Gm-Message-State: AO0yUKVyM8Kdx7FnqGvGdL0sUR/k+qfWyoA1UQUxaNd97Q/Dl2HIVwvV mbTtKNt1Urvuql0o6t95hALeDaDp6cw= X-Received: by 2002:a54:480e:0:b0:37d:574a:1290 with SMTP id j14-20020a54480e000000b0037d574a1290mr946598oij.42.1676663707516; Fri, 17 Feb 2023 11:55:07 -0800 (PST) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id q186-20020acac0c3000000b0037d74967ef6sm2158721oif.44.2023.02.17.11.55.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Feb 2023 11:55:06 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 Feb 2023 16:55:03 -0300 Message-Id: <20230217195504.43368-2-jamrial@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230217195504.43368-1-jamrial@gmail.com> References: <20230217195504.43368-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] swresample/swresample: add a used channel layout option using the new API X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 35c7KwRnxWi8 Replaces the "used channel count" option, which is now deprecated. Signed-off-by: James Almer --- doc/resampler.texi | 4 +-- libswresample/options.c | 6 ++-- libswresample/rematrix.c | 2 +- libswresample/swresample.c | 56 ++++++++++++++++++----------- libswresample/swresample_internal.h | 5 +-- libswresample/x86/rematrix_init.c | 2 +- 6 files changed, 46 insertions(+), 29 deletions(-) diff --git a/doc/resampler.texi b/doc/resampler.texi index d55654e7bc..a6224eefb3 100644 --- a/doc/resampler.texi +++ b/doc/resampler.texi @@ -11,8 +11,8 @@ programmatic use. @table @option -@item uch, used_channel_count -Set the number of used input channels. Default value is 0. This option is +@item uchl, used_chlayout +Set used input channel layout. Default is unset. This option is only used for special remapping. @item isr, in_sample_rate diff --git a/libswresample/options.c b/libswresample/options.c index ffa27c590d..fb109fdbab 100644 --- a/libswresample/options.c +++ b/libswresample/options.c @@ -46,9 +46,9 @@ static const AVOption options[]={ OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM|DEPREC}, {"out_channel_count" , "set output channel count (Deprecated, use out_chlayout)", OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM|DEPREC}, +{"uch" , "set used channel count" , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM|DEPREC}, +{"used_channel_count" , "set used channel count" , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM|DEPREC}, #endif -{"uch" , "set used channel count" , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM}, -{"used_channel_count" , "set used channel count" , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM}, {"isr" , "set input sample rate" , OFFSET( in_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM}, {"in_sample_rate" , "set input sample rate" , OFFSET( in_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM}, {"osr" , "set output sample rate" , OFFSET(out_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM}, @@ -73,6 +73,8 @@ static const AVOption options[]={ {"in_chlayout" , "set input channel layout" , OFFSET(user_in_chlayout ), AV_OPT_TYPE_CHLAYOUT, {.str=NULL }, 0, 0 , PARAM, "chlayout"}, {"ochl" , "set output channel layout" , OFFSET(user_out_chlayout), AV_OPT_TYPE_CHLAYOUT, {.str=NULL }, 0, 0 , PARAM, "chlayout"}, {"out_chlayout" , "set output channel layout" , OFFSET(user_out_chlayout), AV_OPT_TYPE_CHLAYOUT, {.str=NULL }, 0, 0 , PARAM, "chlayout"}, +{"uchl" , "set used channel layout" , OFFSET(user_used_chlayout), AV_OPT_TYPE_CHLAYOUT, {.str=NULL }, 0, 0 , PARAM, "chlayout"}, +{"used_chlayout" , "set used channel layout" , OFFSET(user_used_chlayout), AV_OPT_TYPE_CHLAYOUT, {.str=NULL }, 0, 0 , PARAM, "chlayout"}, {"clev" , "set center mix level" , OFFSET(clev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM}, {"center_mix_level" , "set center mix level" , OFFSET(clev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM}, {"slev" , "set surround mix level" , OFFSET(slev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM}, diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index 0c3fff6c42..d57c488aca 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -492,7 +492,7 @@ av_cold static int auto_matrix(SwrContext *s) av_cold int swri_rematrix_init(SwrContext *s){ int i, j; - int nb_in = s->used_ch_count; + int nb_in = s->used_chlayout.nb_channels; int nb_out = s->out.ch_count; s->mix_any_f = NULL; diff --git a/libswresample/swresample.c b/libswresample/swresample.c index 5884f8d533..deb1959e89 100644 --- a/libswresample/swresample.c +++ b/libswresample/swresample.c @@ -161,6 +161,7 @@ static void clear_context(SwrContext *s){ free_temp(&s->dither.temp); av_channel_layout_uninit(&s->in_ch_layout); av_channel_layout_uninit(&s->out_ch_layout); + av_channel_layout_uninit(&s->used_chlayout); swri_audio_convert_free(&s-> in_convert); swri_audio_convert_free(&s->out_convert); swri_audio_convert_free(&s->full_convert); @@ -176,6 +177,7 @@ av_cold void swr_free(SwrContext **ss){ clear_context(s); av_channel_layout_uninit(&s->user_in_chlayout); av_channel_layout_uninit(&s->user_out_chlayout); + av_channel_layout_uninit(&s->user_used_chlayout); if (s->resampler) s->resampler->free(&s->resample); @@ -211,12 +213,20 @@ av_cold int swr_init(struct SwrContext *s){ av_log(s, AV_LOG_ERROR, "Requested output sample rate %d is invalid\n", s->out_sample_rate); return AVERROR(EINVAL); } - s->used_ch_count = s->user_used_ch_count; #if FF_API_OLD_CHANNEL_LAYOUT s->out.ch_count = s-> user_out_ch_count; s-> in.ch_count = s-> user_in_ch_count; // if the old/new fields are set inconsistently, prefer the old ones + if (s->user_used_ch_count && s->user_used_ch_count != s->user_used_chlayout.nb_channels) { + av_channel_layout_uninit(&s->used_chlayout); + s->used_chlayout.order = AV_CHANNEL_ORDER_UNSPEC; + s->used_chlayout.nb_channels = s->user_used_ch_count; + } else if (av_channel_layout_check(&s->user_used_chlayout)) { + ret = av_channel_layout_copy(&s->used_chlayout, &s->user_used_chlayout); + if (ret < 0) + return ret; + } if ((s->user_in_ch_count && s->user_in_ch_count != s->user_in_chlayout.nb_channels) || (s->user_in_ch_layout && (s->user_in_chlayout.order != AV_CHANNEL_ORDER_NATIVE || s->user_in_chlayout.u.mask != s->user_in_ch_layout))) { @@ -243,9 +253,9 @@ av_cold int swr_init(struct SwrContext *s){ } else if (av_channel_layout_check(&s->user_out_chlayout)) av_channel_layout_copy(&s->out_ch_layout, &s->user_out_chlayout); - if (!s->out.ch_count && !s->user_out_ch_layout) + if (!s->out.ch_count) s->out.ch_count = s->out_ch_layout.nb_channels; - if (!s-> in.ch_count && !s-> user_in_ch_layout) + if (!s-> in.ch_count) s-> in.ch_count = s->in_ch_layout.nb_channels; if (!(ret = av_channel_layout_check(&s->in_ch_layout)) || s->in_ch_layout.nb_channels > SWR_CH_MAX) { @@ -281,6 +291,7 @@ av_cold int swr_init(struct SwrContext *s){ ret = av_channel_layout_copy(&s->in_ch_layout, &s->user_in_chlayout); ret |= av_channel_layout_copy(&s->out_ch_layout, &s->user_out_chlayout); + ret |= av_channel_layout_copy(&s->used_chlayout, &s->user_used_chlayout); if (ret < 0) return ret; #endif @@ -299,16 +310,19 @@ av_cold int swr_init(struct SwrContext *s){ return AVERROR(EINVAL); } - if(!s->used_ch_count) - s->used_ch_count= s->in.ch_count; + if (!av_channel_layout_check(&s->used_chlayout)) + av_channel_layout_default(&s->used_chlayout, s->in.ch_count); - if (s->used_ch_count && s->in_ch_layout.order != AV_CHANNEL_ORDER_UNSPEC && s->used_ch_count != s->in_ch_layout.nb_channels) { - av_log(s, AV_LOG_WARNING, "Input channel layout has a different number of channels than the number of used channels, ignoring layout\n"); + if (s->used_chlayout.nb_channels != s->in_ch_layout.nb_channels) av_channel_layout_uninit(&s->in_ch_layout); - } - if (s->in_ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) - av_channel_layout_default(&s->in_ch_layout, s->used_ch_count); + if (s->used_chlayout.order == AV_CHANNEL_ORDER_UNSPEC) + av_channel_layout_default(&s->used_chlayout, s->used_chlayout.nb_channels); + if (s->in_ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) { + ret = av_channel_layout_copy(&s->in_ch_layout, &s->used_chlayout); + if (ret < 0) + return ret; + } if (s->out_ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) av_channel_layout_default(&s->out_ch_layout, s->out.ch_count); @@ -389,8 +403,8 @@ av_cold int swr_init(struct SwrContext *s){ #define RSC 1 //FIXME finetune if(!s-> in.ch_count) s-> in.ch_count = s->in_ch_layout.nb_channels; - if(!s->used_ch_count) - s->used_ch_count= s->in.ch_count; + if (!av_channel_layout_check(&s->used_chlayout)) + av_channel_layout_default(&s->used_chlayout, s->in.ch_count); if(!s->out.ch_count) s->out.ch_count = s->out_ch_layout.nb_channels; @@ -410,23 +424,23 @@ av_cold int swr_init(struct SwrContext *s){ } #endif av_channel_layout_describe(&s->in_ch_layout, l1, sizeof(l1)); - if (s->in_ch_layout.order != AV_CHANNEL_ORDER_UNSPEC && s->used_ch_count != s->in_ch_layout.nb_channels) { - av_log(s, AV_LOG_ERROR, "Input channel layout %s mismatches specified channel count %d\n", l1, s->used_ch_count); + if (s->in_ch_layout.order != AV_CHANNEL_ORDER_UNSPEC && s->used_chlayout.nb_channels != s->in_ch_layout.nb_channels) { + av_log(s, AV_LOG_ERROR, "Input channel layout %s mismatches specified channel count %d\n", l1, s->used_chlayout.nb_channels); ret = AVERROR(EINVAL); goto fail; } if (( s->out_ch_layout.order == AV_CHANNEL_ORDER_UNSPEC - || s-> in_ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) && s->used_ch_count != s->out.ch_count && !s->rematrix_custom) { + || s-> in_ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) && s->used_chlayout.nb_channels != s->out.ch_count && !s->rematrix_custom) { av_log(s, AV_LOG_ERROR, "Rematrix is needed between %s and %s " "but there is not enough information to do it\n", l1, l2); ret = AVERROR(EINVAL); goto fail; } -av_assert0(s->used_ch_count); +av_assert0(s->used_chlayout.nb_channels); av_assert0(s->out.ch_count); - s->resample_first= RSC*s->out.ch_count/s->used_ch_count - RSC < s->out_sample_rate/(float)s-> in_sample_rate - 1.0; + s->resample_first= RSC*s->out.ch_count/s->used_chlayout.nb_channels - RSC < s->out_sample_rate/(float)s-> in_sample_rate - 1.0; s->in_buffer= s->in; s->silence = s->in; @@ -442,7 +456,7 @@ av_assert0(s->out.ch_count); } s->in_convert = swri_audio_convert_alloc(s->int_sample_fmt, - s-> in_sample_fmt, s->used_ch_count, s->channel_map, 0); + s-> in_sample_fmt, s->used_chlayout.nb_channels, s->channel_map, 0); s->out_convert= swri_audio_convert_alloc(s->out_sample_fmt, s->int_sample_fmt, s->out.ch_count, NULL, 0); @@ -457,9 +471,9 @@ av_assert0(s->out.ch_count); if(s->channel_map){ s->postin.ch_count= - s->midbuf.ch_count= s->used_ch_count; + s->midbuf.ch_count= s->used_chlayout.nb_channels; if(s->resample) - s->in_buffer.ch_count= s->used_ch_count; + s->in_buffer.ch_count= s->used_chlayout.nb_channels; } if(!s->resample_first){ s->midbuf.ch_count= s->out.ch_count; @@ -697,7 +711,7 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co if((ret=swri_realloc_audio(&s->postin, in_count))<0) return ret; if(s->resample_first){ - av_assert0(s->midbuf.ch_count == s->used_ch_count); + av_assert0(s->midbuf.ch_count == s->used_chlayout.nb_channels); if((ret=swri_realloc_audio(&s->midbuf, out_count))<0) return ret; }else{ diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h index 262a0e2b8c..c426cd782a 100644 --- a/libswresample/swresample_internal.h +++ b/libswresample/swresample_internal.h @@ -99,6 +99,7 @@ struct SwrContext { enum AVSampleFormat in_sample_fmt; ///< input sample format enum AVSampleFormat int_sample_fmt; ///< internal sample format (AV_SAMPLE_FMT_FLTP or AV_SAMPLE_FMT_S16P) enum AVSampleFormat out_sample_fmt; ///< output sample format + AVChannelLayout used_chlayout; ///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count) AVChannelLayout in_ch_layout; ///< input channel layout AVChannelLayout out_ch_layout; ///< output channel layout int in_sample_rate; ///< input sample rate @@ -111,16 +112,16 @@ struct SwrContext { float rematrix_maxval; ///< maximum value for rematrixing output int matrix_encoding; /**< matrixed stereo encoding */ const int *channel_map; ///< channel index (or -1 if muted channel) map - int used_ch_count; ///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count) int engine; - int user_used_ch_count; ///< User set used channel count #if FF_API_OLD_CHANNEL_LAYOUT + int user_used_ch_count; ///< User set used channel count int user_in_ch_count; ///< User set input channel count int user_out_ch_count; ///< User set output channel count int64_t user_in_ch_layout; ///< User set input channel layout int64_t user_out_ch_layout; ///< User set output channel layout #endif + AVChannelLayout user_used_chlayout; ///< User set used channel layout AVChannelLayout user_in_chlayout; ///< User set input channel layout AVChannelLayout user_out_chlayout; ///< User set output channel layout enum AVSampleFormat user_int_sample_fmt; ///< User set internal sample format diff --git a/libswresample/x86/rematrix_init.c b/libswresample/x86/rematrix_init.c index b6ed38bf67..6cd8e109c4 100644 --- a/libswresample/x86/rematrix_init.c +++ b/libswresample/x86/rematrix_init.c @@ -33,7 +33,7 @@ D(int16, sse2) av_cold int swri_rematrix_init_x86(struct SwrContext *s){ #if HAVE_X86ASM int mm_flags = av_get_cpu_flags(); - int nb_in = s->used_ch_count; + int nb_in = s->used_chlayout.nb_channels; int nb_out = s->out.ch_count; int num = nb_in * nb_out; int i,j; From patchwork Fri Feb 17 19:55:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 40429 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp89057pzk; Fri, 17 Feb 2023 11:55:36 -0800 (PST) X-Google-Smtp-Source: AK7set/jrujNDov39cVAjeyMKpmiWEgUYemoR1qJ/AsJVILZ8+ZZDGTPUvs3NfrZCqcisj0jPOs7 X-Received: by 2002:a17:906:27c3:b0:885:2eb5:68a5 with SMTP id k3-20020a17090627c300b008852eb568a5mr295984ejc.66.1676663736675; Fri, 17 Feb 2023 11:55:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676663736; cv=none; d=google.com; s=arc-20160816; b=bRQTP9RZXMvMrxQBi9p0VuyTiOdAd7xOhzbJmtrpHcxCMlwPv6KsBCBErTS4ikocc4 dO519XU5c4eZV9+ENPN7C2h2mz0/GT5xVPhd5sxfAcMV0SvMCdIldOHiTvisC9+5hiIL qaqr2xZZTVBA9zOz9ID/rCpilbFa0awVQtpeCyDgqtebv3SZDzAXoaaxYM/SiViZFAD3 Id0vbuoncEHhrbhtOIRmAg/RBQhDH0zOiaXEYs2++mrOrThNPrPBoXFGncTMZtDMr2V4 R+w4O28paVN/YZIwP9gUyKKOrg993O58GbAamp8n6ShEEXgpCclpdJKSLbnRSkYFRvJG BHOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=tXOIGpTa7OjtqWrud/TGJJe5B286DD8jwhouK8Noz3Y=; b=0D1GEkJePtZHdAkRbMIBB3E5wLVto3m2ugmNfqu0dQC8LGTnHsRANiqhzZR3PktBnE Tm7xxMDDESPyRGnwLypQFbXpio5RnPx/SzzZEQIXAQfSRY154s5EO2ux11xmeXUGNHba sSGASVeeiTgEMoegCScnvFwjqiuiR4mvTCcIg0VvFkRmgnhPjCi5a1iaPLUCjfaREL0T 3DXjJyfJlAdQfMjLSlA4YqPazy1HVCiG5WZxoHsMszS1ypLvy25AUCS8vx7vipTBdZM8 2rq30rr/y4icf9FYWFD03lu5uNFJX3qgGgR66IPsrq4fqu+ZdjKGYgbokKem58oTZ29Q G5YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=TiLx7qxT; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id fe17-20020a1709072a5100b00882aebb981asi5486755ejc.444.2023.02.17.11.55.36; Fri, 17 Feb 2023 11:55:36 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=TiLx7qxT; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 07E6368BE76; Fri, 17 Feb 2023 21:55:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6DE5868BE25 for ; Fri, 17 Feb 2023 21:55:11 +0200 (EET) Received: by mail-oi1-f181.google.com with SMTP id q1so2353974oiv.6 for ; Fri, 17 Feb 2023 11:55:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=XrLr9oBqqe7Vj8tSc4fEo68/U/J8jpUmilYheG1qjjE=; b=TiLx7qxTJH4yj5vb0QKVbpfpbQJF5VOqDE4dpdLL6m2GUHMT9sFml3LwRZ3ekxszXM /9v9UgxHuRAnusSQuzsF8swf7kHEQmvNg6Xfdd6LayIT9tH3W0uYelSVh5/mooZwrERH QbdD41PPlEVZpBLZfZcNb29UQrZbt7h7t3lUcVNIfAfiCy33naYo4Uw893v+XXjc+YDo m7t62jnizpT1DzyxpaCBttagfKx1MUk+npipLYAdykP2Cwu/b8k7ZOnRQYi9Xm1YzdIX xe/ow6jjCs6T9zkEYQiqRZhJplZHm3QfFJ46zhKTkqI2L+bs4xbxkxcaPmZuwk6mwNm6 OMLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XrLr9oBqqe7Vj8tSc4fEo68/U/J8jpUmilYheG1qjjE=; b=XOHAwec9swXUwXHokoF7L//Mg58rNjp0kXt2PKcGIGvjegEY+oBJ67FTjD4Sbs4Lza xDf9CFluLJEqt6xoQk77x4twJkizbU2Klj4Dlwm8O6NNTYBJvAO5HSQ1RN+MwSoTBh79 zicxk8D6ii6FF0E09SB9ZSQnhAEcXH2D9+R6N6WM4Ng+32cTB4gVDLo8yjwb16WMJAIK OGptCaj5sAKrIfWCSe47XBNU7fhgd24baY+PLudIbHm4Yy1KgIrWfJUQYEQufEiq48z5 HhvTKTnfI+0LYU+fh4qb+sdo9wpVnH+P4OkbDxEitLUO+n+KG8NZ9PUdxdyJW7qfN68K 64Ww== X-Gm-Message-State: AO0yUKXAufsvG2m3U/L94papLc2Az3fH2zXs0R6X8a7Nbb6DBZdDk+qo 0wWZbclOqhN4L7oWHF//NcMK7SOajXU= X-Received: by 2002:aca:1c04:0:b0:36c:d1c7:ba37 with SMTP id c4-20020aca1c04000000b0036cd1c7ba37mr882732oic.41.1676663709856; Fri, 17 Feb 2023 11:55:09 -0800 (PST) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id q186-20020acac0c3000000b0037d74967ef6sm2158721oif.44.2023.02.17.11.55.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Feb 2023 11:55:08 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 Feb 2023 16:55:04 -0300 Message-Id: <20230217195504.43368-3-jamrial@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230217195504.43368-1-jamrial@gmail.com> References: <20230217195504.43368-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avfilter/af_pan: use the new swr used channel layout option X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: +j/7CGkFQncf Fixes ticket #10180 Signed-off-by: James Almer --- libavfilter/af_pan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index 067f646805..4672648d46 100644 --- a/libavfilter/af_pan.c +++ b/libavfilter/af_pan.c @@ -313,7 +313,7 @@ static int config_props(AVFilterLink *link) pan->channel_map[i] = ch_id; } - av_opt_set_int(pan->swr, "uch", pan->nb_output_channels, 0); + av_opt_set_chlayout(pan->swr, "uchl", &pan->out_channel_layout, 0); swr_set_channel_mapping(pan->swr, pan->channel_map); } else { // renormalize