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 E581F448CB for ; Sun, 30 Oct 2022 19:41:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1A4C268BCD4; Sun, 30 Oct 2022 21:41:54 +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 86B8C68B9B7 for ; Sun, 30 Oct 2022 21:41:48 +0200 (EET) Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-13ba9a4430cso11637900fac.11 for ; Sun, 30 Oct 2022 12:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=OV9eZl/p0Hu1z/CO3R7j0ev6VQ5pjWw5/YViR6vUop8=; b=Sapdx++U7UF4V8Dt68q8n6E/VoehmsH11+zk3FCQta0PTCgDYa3Bdf2GEnEhbHIfRq ir54YQ6WLvWxgjr+Sgb/mXhzotzXPi8w/mtH91eo7FNty9PH5qEXmsd0Y8MaDWlS1oyZ baTklviNyXlM4fvUU32Nr6u2L+R92+EVzN72fB9JIiyIWTHZBZ5mlb61Sj78NFeP0tBu ox9qb7GdX+vRWs3vIs9KzstYznFx5W9PoFcec8/EgDgE8CaWa+yDtV58HZ8yiogOX5R5 h5rCYTfyEsaDKa8qLQC7M1eaccHOPk22dpBSRbnp+29kvlD57VVM+14oSIMSmh8B4CJH UwzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OV9eZl/p0Hu1z/CO3R7j0ev6VQ5pjWw5/YViR6vUop8=; b=Feuf8uEyGcWQFda2VFOjGZJv8j9WbMLwlmAMC2XfdXZmUD3/Jg0aW/qDhykJ0kklRW qN58nShDdIWlpnCTK3PupJr5E8NDu95K/MHT7Iov9WcMA4fQfN5eD0zGZXQscs1l67mL g4KJ5ALWYYnU2uvmXyYbl8iQ5C57V4W3Q/20ZQb9ArzERELAA6CDbUEp+Hk9jAkVmngn WxPeRmirBgCRthaHQHBsYC/1Hew0S1UoK3YyuJKjLoxrtKPeZ3h90iypEUh/7CmAvaxa qlxd0rD3MA5jGbdFg3SuZBzPObGN0x+SnygdNUhHMelvmr8A8VZDhNijqycu2w2FV0nL WqKA== X-Gm-Message-State: ACrzQf0bI2CPtY/l5WspD41rKBeEDCE3MXyPNrZEESqdaabG3SlcE4bZ WDeJ81Xt33Y1ilwWj9gkZ2Bjclmw4yw= X-Google-Smtp-Source: AMsMyM6ySkGpqmSfRXhwBMbVZUrikGgJUIoKSg6Jm8EK5UMCXQXzS05vtdDmSotKVraJa3tYocRGBw== X-Received: by 2002:a05:6871:152:b0:13c:c1a9:e96e with SMTP id z18-20020a056871015200b0013cc1a9e96emr3659164oab.258.1667158906734; Sun, 30 Oct 2022 12:41:46 -0700 (PDT) Received: from [192.168.0.13] ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id bx25-20020a056830601900b0066c312b044dsm2004858otb.27.2022.10.30.12.41.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 30 Oct 2022 12:41:46 -0700 (PDT) Message-ID: Date: Sun, 30 Oct 2022 16:41:44 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <103b6b6c-5c56-2af7-bde6-1e1706d21930@gmail.com> <3a38e8dc-0c3a-eec2-9278-75f2bc6118aa@gmail.com> <01478b24-aae8-ad9c-9947-cefb696ffb39@gmail.com> <2a8d16ba-7f6a-720e-f068-d6bfcaf2679b@gmail.com> From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] avfilter: add ambisonic decoder filter 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 10/30/2022 4:19 PM, Paul B Mahol wrote: > On 10/30/22, James Almer wrote: >> On 10/30/2022 3:58 PM, Paul B Mahol wrote: >>> On 10/30/22, James Almer wrote: >>>> On 10/30/2022 3:29 PM, Paul B Mahol wrote: >>>>> On 10/30/22, James Almer wrote: >>>>>> >>>>>> >>>>>> On 10/30/2022 3:19 PM, Paul B Mahol wrote: >>>>>>> On 10/30/22, James Almer wrote: >>>>>>>> On 10/30/2022 12:34 PM, Paul B Mahol wrote: >>>>>>>>> +static const struct { >>>>>>>>> + const int order; >>>>>>>>> + const int inputs; >>>>>>>>> + const int speakers; >>>>>>>>> + const int near_field; >>>>>>>>> + const int type; >>>>>>>>> + const double xover; >>>>>>>>> + const AVChannelLayout outlayout; >>>>>>>>> + const double *speakers_azimuth; >>>>>>>>> + const double *speakers_elevation; >>>>>>>>> + const double *speakers_distance; >>>>>>>>> +} ambisonic_tab[] = { >>>>>>>>> + [MONO] = { >>>>>>>>> + .order = 0, >>>>>>>>> + .inputs = 1, >>>>>>>>> + .speakers = 1, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO, >>>>>>>>> + .speakers_azimuth = (const double[1]){ 0. }, >>>>>>>>> + .speakers_distance = (const double[1]){ 1. }, >>>>>>>>> + }, >>>>>>>>> + [STEREO] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 2, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, >>>>>>>>> + .speakers_azimuth = (const double[2]){ -30, 30}, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [STEREO_DOWNMIX] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 2, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = >>>>>>>>> (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO_DOWNMIX, >>>>>>>>> + .speakers_azimuth = (const double[2]){ -90, 90 }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [SURROUND] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 3, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_SURROUND, >>>>>>>>> + .speakers_azimuth = (const double[3]){ -45, 45, 0 }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [L2_1] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 3, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_2_1, >>>>>>>>> + .speakers_azimuth = (const double[3]){ -45, 45, 180 }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [TRIANGLE] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 3, >>>>>>>>> + .type = 1, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_SURROUND, >>>>>>>>> + .speakers_azimuth = (const double[3]){ -120, 120, 0 }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [QUAD] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 4, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_QUAD, >>>>>>>>> + .speakers_azimuth = (const double[4]){ -45, 45, -135, 135 >>>>>>>>> }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [SQUARE] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 4, >>>>>>>>> + .type = 1, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_4POINT0, >>>>>>>>> + .speakers_azimuth = (const double[4]){ 0, -90, 180, 90 }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [L4_0] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 4, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_4POINT0, >>>>>>>>> + .speakers_azimuth = (const double[4]){ -30, 30, 0, 180 }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [L5_0] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 5, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = >>>>>>>>> (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0_BACK, >>>>>>>>> + .speakers_azimuth = (const double[5]){ -30, 30, 0, -145, >>>>>>>>> 145 >>>>>>>>> }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [L5_0_SIDE] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 5, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0, >>>>>>>>> + .speakers_azimuth = (const double[5]){ -30, 30, 0, -110, >>>>>>>>> 110 >>>>>>>>> }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [L6_0] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 6, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT0, >>>>>>>>> + .speakers_azimuth = (const double[6]){ -30, 30, 0, 180, >>>>>>>>> -110, >>>>>>>>> 110 >>>>>>>>> }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [L7_0] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 7, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT0, >>>>>>>>> + .speakers_azimuth = (const double[7]){ -30, 30, 0, -145, >>>>>>>>> 145, >>>>>>>>> -110, 110 }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [TETRA] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 4, >>>>>>>>> + .type = 2, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_QUAD, >>>>>>>>> + .speakers_azimuth = (const double[4]){ -90, 90, 0, 180 }, >>>>>>>>> + .speakers_elevation = (const double[4]){ -35.3, -35.3, >>>>>>>>> 35.3, >>>>>>>>> 35.3 >>>>>>>>> }, >>>>>>>>> + .speakers_distance = same_distance, >>>>>>>>> + }, >>>>>>>>> + [CUBE] = { >>>>>>>>> + .order = 1, >>>>>>>>> + .inputs = 4, >>>>>>>>> + .speakers = 8, >>>>>>>>> + .type = 2, >>>>>>>>> + .near_field = NF_NONE, >>>>>>>>> + .xover = 0., >>>>>>>>> + .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1, >>>>>>>> >>>>>>>> 7.1 defines an LFE channel, which is clearly not intended here, so >>>>>>>> it >>>>>>>> should be either: >>>>>>>> >>>>>>>> .outlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MASK(8, >>>>>>>> AV_CH_LAYOUT_QUAD | >>>>>>>> AV_CH_TOP_FRONT_LEFT | >>>>>>>> AV_CH_TOP_FRONT_RIGHT | >>>>>>>> AV_CH_TOP_BACK_LEFT | >>>>>>>> AV_CH_TOP_BACK_RIGHT), >>>>>>>> >>>>>>>> Or the AV_CHANNEL_LAYOUT_CUBE layout (using the exact same bitmask >>>>>>>> as >>>>>>>> above) after the patch i sent just now is committed. >>>>>>> >>>>>>> CUBE is as real cube in 3d space. No current layout in API can be >>>>>>> described correctly. >>>>>> >>>>>> the TOP_* channels are in a different height layer than the other >>>>>> channels, namely above them. The result for this bitmask is a 3D cube >>>>>> layout (Left and right speakers both front and back, in two different >>>>>> height layers). >>>>> >>>>> https://en.wikipedia.org/wiki/Ambisonic_reproduction_systems#Cube >>>> >>>> "If all speakers are placed in room corners", So a 7.1 layout, besides >>>> defining one channel as LFE, is also not ideal given that it defines two >>>> speaker positions in places other than the room corners, and by no means >>>> describes a 3D cube since all speakers are at the same height. >>>> The TOP channel ids let you assign four channels to speakers placed in >>>> the top room corners. >>> >>> 7.1 is there just because it have 8 channels. No other reasons. >> >> If you want to just say "there are eight channels", then make the >> AVChannelLayout define 8 channels of order UNSPEC. Let the user then >> figure out what to do with them. But if you want to actually give each >> channel a position, then you need to use the proper IDs to describe the >> intended layout. >> >> Using 7.1 here is lying to the user, as it's telling them he needs to >> place two speakers at the front, two at the back, two to the sides, and >> all at the same height, plus one channel wrongly feeding the sub woofer. >> Not to mention what would happen if you try to downmix the stream. swr >> would just generate awful results. >> Meanwhile, using cube you'll tell the user to place one speaker on every >> corner in the room, or a downmixer how to properly handle the channels >> to get good results (e.g. on headphones). > > I never claimed it is perfect solution. > > Is there a way to let it use unspec but still not confuse swr to abort > and do pointless messages? swr will reject any layout order other than native if the process requires rematrix (It should print a "Rematrix is needed" message then error out) because it obviously has no information about how to handle the channels. ffmpeg.c however might try to guess the layout if it gets a stream of uspec order, and for an 8 channel stream it will just set it to 7.1, which again is not ideal here and will make swr do bad things. Just use the CUBE layout. I pushed it just now. Swr will downmix it in a better way than if you tell it it's 7.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".