From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id F213C44A79 for ; Mon, 31 Oct 2022 21:18:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A195568BE20; Mon, 31 Oct 2022 23:18:56 +0200 (EET) Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 30AB668BD8A for ; Mon, 31 Oct 2022 23:18:51 +0200 (EET) Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-13c2cfd1126so14839932fac.10 for ; Mon, 31 Oct 2022 14:18:51 -0700 (PDT) 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=hezne1Ixn8xhnLFqK1PuTCE1/nTGKX15U7vS2DJ82zE=; b=JyoIFoCkr7mj3Nlg3MqwdxjBL3AbPClDkCiM37abfBUdE5e0BMsNo7BAHUiH/Nzr+W opDCW4PWYeXqZUjBhk4SXWbiT8ufS1Ut0OFqNBwtJD3QGlOaVFVPpPmZeX+mzpPrf3zl e21AVp6wFDFJF4LRciZK+W1jldqzIlns7HN6+3BTj/Oh3wze0u59o0yjPw1XWwWuS9iK 9tQ7f2Yp/o5MB1Wwuym4JYaz6/CR7NP84KXKNM1ttYD0++d4KsA87sVm0Vq7VEy10h43 wldkCXtlewScmKF6T7JR8OOscjBIi/gmcegwwnEACwpL4SzSWXHRnw2Hd/NvzcfT9QAe 302w== 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=hezne1Ixn8xhnLFqK1PuTCE1/nTGKX15U7vS2DJ82zE=; b=096wL+q8/V9J/sHCpf2ctshs+QPcnpBwYkb9R9GZSU89fKfCrTlxiXgT79nMfwjXff izB0q64zYhxlbZ80JuIaA+BQqGZrSSlKCGmVY6FMr2hpPPZDFHFwNwILszbsbuUMVO+I BDrFPluXjMJzIty8ks4Zj7gyVESQ1Bn6ZoCqjDmf70kZY076NPu8de2m6Tdiv0YA/esy g+adC7R/It8qjYxH7eab/5S1Syvk+yd90v/0+i/stA+/CuEBgxagk6ZpC8ECB38XioyP BFk59Kk+C67PWjjkNeqczaCITEJcfQHNU7JzVObkkqkAXDsq1XPPiAGAC61yxAFBOH/y faBA== X-Gm-Message-State: ACrzQf2GuLullJdaEnEHi7J6sEzhsf8VSnHgnB1iUTGTH75N8Kgwg/Gu 3zKR/CGZqNvQmx1dcaq5OSGOzig799U= X-Google-Smtp-Source: AMsMyM79uOYBaCew2K+FoEtYXXiyEo+JeF41gRIDidiJ04U9BmVFiLDi7vRwUEsWWBcTqANyvUQScA== X-Received: by 2002:a05:6871:5cb:b0:13c:6ef9:a1b6 with SMTP id v11-20020a05687105cb00b0013c6ef9a1b6mr12195029oan.48.1667251129629; Mon, 31 Oct 2022 14:18:49 -0700 (PDT) Received: from localhost.localdomain ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id x26-20020a9d629a000000b006619dd066fbsm3183892otk.5.2022.10.31.14.18.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 14:18:49 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 31 Oct 2022 18:18:29 -0300 Message-Id: <20221031211832.8213-1-jamrial@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031211554.8176-1-jamrial@gmail.com> References: <20221031211554.8176-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] swresample/rematrix: support mixing top front left/right channels 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: James Almer --- libswresample/rematrix.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index fe823dc575..0c3fff6c42 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -138,6 +138,8 @@ static int sane_layout(AVChannelLayout *ch_layout) { return 0; if(!even(av_channel_layout_subset(ch_layout, (AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER)))) return 0; + if(!even(av_channel_layout_subset(ch_layout, (AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT)))) + return 0; if(ch_layout->nb_channels >= SWR_CH_MAX) return 0; @@ -369,6 +371,28 @@ av_cold int swr_build_matrix2(const AVChannelLayout *in_layout, const AVChannelL }else av_assert0(0); } + + if (unaccounted & AV_CH_TOP_FRONT_LEFT) { + if (av_channel_layout_index_from_channel(&out_ch_layout, AV_CHAN_TOP_FRONT_CENTER) >= 0) { + matrix[TOP_FRONT_CENTER][TOP_FRONT_LEFT ] += M_SQRT1_2; + matrix[TOP_FRONT_CENTER][TOP_FRONT_RIGHT] += M_SQRT1_2; + if (av_channel_layout_index_from_channel(&in_ch_layout, AV_CHAN_TOP_FRONT_CENTER) >= 0) + matrix[TOP_FRONT_CENTER][TOP_FRONT_CENTER] = center_mix_level * sqrt(2); + } else if (av_channel_layout_index_from_channel(&out_ch_layout, AV_CHAN_FRONT_LEFT) >= 0) { + if (av_channel_layout_index_from_channel(&in_ch_layout, AV_CHAN_FRONT_LEFT) >= 0) { + matrix[FRONT_LEFT ][TOP_FRONT_LEFT ] += M_SQRT1_2; + matrix[FRONT_RIGHT][TOP_FRONT_RIGHT] += M_SQRT1_2; + } else { + matrix[FRONT_LEFT ][TOP_FRONT_LEFT ] += 1.0; + matrix[FRONT_RIGHT][TOP_FRONT_RIGHT] += 1.0; + } + } else if (av_channel_layout_index_from_channel(&out_ch_layout, AV_CHAN_FRONT_CENTER) >= 0) { + matrix[FRONT_CENTER][TOP_FRONT_LEFT ] += M_SQRT1_2; + matrix[FRONT_CENTER][TOP_FRONT_RIGHT] += M_SQRT1_2; + } else + av_assert0(0); + } + /* mix LFE into front left/right or center */ if (unaccounted & AV_CH_LOW_FREQUENCY) { if (av_channel_layout_index_from_channel(&out_ch_layout, AV_CHAN_FRONT_CENTER) >= 0) { -- 2.38.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".