From patchwork Mon Aug 1 12:23:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37067 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp2469848pzb; Mon, 1 Aug 2022 05:24:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sYTSKtxRyjzu8G2eYqDRo5kV6LZeukiYjEgXve9l8a0puavbabvBruPReqJpUxmYaBlCUM X-Received: by 2002:a05:6402:248f:b0:43a:b89c:20e3 with SMTP id q15-20020a056402248f00b0043ab89c20e3mr15718706eda.335.1659356677057; Mon, 01 Aug 2022 05:24:37 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v17-20020a1709063bd100b0072b85847dbasi8548737ejf.526.2022.08.01.05.24.36; Mon, 01 Aug 2022 05:24:37 -0700 (PDT) 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=@outlook.com header.s=selector1 header.b="jZnHjs/f"; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B315C68B969; Mon, 1 Aug 2022 15:24:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-oln040092068044.outbound.protection.outlook.com [40.92.68.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D91AD68B93D for ; Mon, 1 Aug 2022 15:24:13 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nuWScKAzqopr6n6ef8bj+r0C/xJ852VJcsQE3Zs0vM4l6KQE+hYMpfFDfV/4dryukKBzZ+EcRUm4QBN/couiHaeY1mtoImELAw7xJckLVGmFdLrfk0ohZ53meiuIEfaIH5rvWeRnOu0ITPdfYT3lpNLgYdpVXgAU4t+saGp4pJ4HfGi+RDidbZUF0RpDI+oLhJHkD8E1t6mtNmmvpiomMoohCD6YtKF0NVQpRts4qeW/WjCPyOdLpSmXxhPjCfqZiGZdOmHZQhkcukB3v/l82fYz+M1UA2WtoYa2vuKHtDnvoNLG3IVtkPVsbfNtDs6w4GLYMtrR0EO+Y1CGF9jGpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FT3rYZGuCidGyDTBjaRtZARtV5abcqu1mVHrrQZjWnQ=; b=V2lWMyFxXsVgFuL26Hl2w9LVdHE41FJElOFqE4gnYGC5xic5nEQiUyo8EIKbnAupIUwEjqB5CTCskCHj8wlaNReBcNgQ/K0LEcx7bNshUxeIzeqXDx0YuGsb6Lqe2PZ0vKozk9Xrm9LkV0519+tayJWsIVn98oxPU3un8uArBloGM0PGWuNn88yzKkCAclqSftmKsprUsv/s5/xhbx4WfftzhZ/QkELbmojBmmtdBHwrwjtrry7jY/T1kA4353+Kk1bQ8FTgfZSjoveZfO479HJjwEhSZFfrZlvV5oOPxzSMgzc236m5FDGUw09XDhX5UySaiYbPzcFKD22c8myyUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FT3rYZGuCidGyDTBjaRtZARtV5abcqu1mVHrrQZjWnQ=; b=jZnHjs/f2ka/ZBuTcDVWxHhjr9cn+43r0BJPabwxuCxFtsFg2wmnWHVVKCQnvNj4ynfjbCUO1EnnHGJgGf4vrpqVo9r+lyCVAReDsi4niK8/lyVBNDfbeX2k3gqow0otCSjICya+08sqTJtGRO/ub1Oni2c+5VDezkcU5WFxFkXDo/pGvplmRVHFYW8WWfPyHTmNsGy5pZ3hOD1b7iS7qlmFwssvEh1FMMt9ifVpnzar/NcLeumJ5W9BhObNYlCOPSNgk0ujRaohZ3gSocSDN2YCi6AdqdW/V0DEKEVcPuqoGhvk785YE+Asz27lhYnyCt5nt0A2MkpYSOfUN0VIZw== Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) by HE1PR0101MB2425.eurprd01.prod.exchangelabs.com (2603:10a6:3:85::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.14; Mon, 1 Aug 2022 12:24:09 +0000 Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::210e:b627:bcc9:8c46]) by DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::210e:b627:bcc9:8c46%11]) with mapi id 15.20.5482.016; Mon, 1 Aug 2022 12:24:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 1 Aug 2022 14:23:43 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [yOK3qcl/zLF8JoXjJSUUanAgcp8zd17m] X-ClientProxiedBy: FR0P281CA0137.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:96::13) To DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) X-Microsoft-Original-Message-ID: <20220801122349.3996066-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b11eec37-456a-4057-0388-08da73b8bbb4 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNVakJMqjhoreY9eRj3hMzSfY17CI5UUfYB4cWiE/X6I2Irj1aTx5POIdZjLBm1qDLmHAbNAEgn282ZWgYnnpjUCwlqxLwpqu1KMmOw2wXoEJ5+qW2byIhqyWERqQHDXV6Yylr2Cz7+xT4y8GCj4uT1tvcPi4oyVDr36S54S6zgHtJv2s2+Ck8evt5BDBkHV7gpRiKJilO9RdAx41fiEYS4417CcxLoklYPW/oQeXXUvU6tkdnAFbYbII8Q99RyTc3GviPSKdqvkRjfFK3tHAYVXWTMX5inlt/MgU81pUzEAyNQ1sGTornLy+6YxQwNWvufLUflydiYlOWvPamC0Z3VlXUG08EoYCTB8vwkiDRvVmDLeBn1nbZyB/f57S9fAIt1SCcTwbUSyUEXMDb1landCww40iHJZGxmidmxCm7wZX45qrwCX9MIjFm/P+5AWMm8CuNd7f7sKjkBKYUSsftAez4vD7wdJDJWwF1sNvCeSQnheG9/dtlXigryyd7QD7lmIJwmMnXbAJhFLBspClwMbJEbuKT0slhmGdAbGfHtgNw0tb+pPqLUaRrQ4bhhF2V28sn93nRvfQ7js0rNtzTuryyao95M98OMVUE8RmZKY7K4TGd7Vzh7AexeoBLic6ikkwQJXHhWp5ZAn0KCR5gt3JOA07YktbRaLHYGAyQsTipOcE9fV00LTe/ciDJpsEcqY4sKXcm4zEkvwk9HIXIC1yMQZsJETW7Y= X-MS-TrafficTypeDiagnostic: HE1PR0101MB2425:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uq6h04z2d5UUPv4xHCLtZF1spSD4Fq69DoTXK8xvE920IDne+ld29yBF4CPUbKyYhjS1aqdqA+EIeXWoCxC+79bsFUophQzJ5ljsjINWI9iF6iUPn/8UcLI8LBXm/jU2WVAWLy4ON7Bv/XIhAYXpN3am9hsHfDnr/t/Egn/Oy6lQtKacBFNDrcBRvbw3ocKzFBRuLBPpiXM4ZMX7ByGLKVR3FBCHD2Q06Hba+Op62TOM28IzDv8HtMsZgQG4T9E1f2kWppCpDanW4GLp0M0z6QXvgOFStbM4RZb7uaL4Jn7cWXcIB5Y3SeL05jMg4aEgZIGEhW/rEYw+t2MiMAZySwsqJozpGF8QggZkXv2UJYeUu8cRUdsw/pH9+MG9dPGHb99BgoAyUEEKZALCFKxJuvqkP+4LxsDdwwzOtw841aWMugXZHWE8AxZZaaDVC0f9nrBXHTQvKxZamPYUWneCXgt0H5l/Bzqt+tMe4FVn99wYzka38SZ81IqSX04RPu9W4HmxsJRB8R48kyyDY6c8vmxj4eVO2H+EwTZt2UrrPUIKIPTBfpjr6HjNoSUtoYl9s/bM9jCeUF+1GTCCKIeFVTygrY9LTvr3hPt9NLcLf4vjUM3Km/x5vipuSGzY4ThzFp+ELb4MEzCF8mZNTunkKA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D2J62l41f3YmZhXhwCQ3y8bpsUOJNXpjUIlqhMFAb7RrPesXMuC2Knju9HqyRY7wji5g/KaDCodSjyrqreH26WbbdiG0AIMgc8XLKtI1U1OwIWeY46zc8FVdqqLuX3kAqzecEOfhFNFCbhK/bNgEolWGOzG/j4Vv9BgpKMg544bteU3vnpGga6JWkvTvW5+Wf3sqWms/v4GJzDbS7W5XOpW+leFBP4jxc4rSo3IxH5fc3zYkwBwDXqSLfhJIfHEiUnngyR23F/V8OYD2cx4uEphSGdTzDnJDkJ0RwbDXEP/BLmUx8T7Heygp5MhGyR2ofzUVyUnu8jNozdJKgS164ZPh53Coibthv08EvKIEFrpnJSANRksvsEMVKxBC2o7BGj/J57XxP7wBpyuand4H8tpTJ4quy3ZmQ2dZlgRFQIoFBPESUYzLf5S8SMDoBW6dddigQQ/nKQBVytLqYEi0rN9kQ072dCzQM7op9Ufcdvi5eh1uGrq/V25DkcG2gElcLaAIKxl45Zl1NM4SAaLeV0INiOMWyDTNvCoXOd/UA6NJBaG5+k5JP2/FcfD4eumc3hlExwFvxeB8Q2a/s1u5renhbTkZLi96l3Of4PGb8t/F0z6qlU8VEAH2yqNhNBbHM6B6HQ/zCsgC4i/YL4xLZpGyZ7FUPOlzr7ikK2sVMBOLBIWyCF+8GoIGLN+sgA0luk3oP8inCq3dWzM/sQwOFL0TyLtBi6pJ4Q2v4bK/n8t2pz5+RZfm4GZh0M7nChDLRh1QbmAOeqiHdLec4WVZfNibY+cKsE5TM6p/Zc3+bqd++udpEQIOVWmEB+v1gaaRLQB+s6SytxGIsyimVR4a6dG8ej1ijJJBxP+pXTC9hK3/7wd/2MOLiG8bTUgtFdRMFkaVB312N6xYP7iSPu8saa2BHBlEGyUA8jzWAhCqNJBsRaFiI3hs8yTeFPkOUwceZSpZ1zJhFPMc99AGBs5o+em2X3ht4bTEMVCDsYEZlhmKjyz/eH+LYUvkjqlThu5a8zCBdm6NjmnezPxy2ywxe5bn5qcJFtETh4VrLPFHV9EalcXajmgs64k54gtMAdGgrr58eKMpVsBVQ8qQgStc7QWj5vt8r+w+8Mz9/O6woSOuAOXSzEKJJyRk3sC9/LPWMEkcL3Ns9QLKiqDfAdWhQZdk3Le80ZWljJHXuu4YSSd5CWKQhRlg3Mj6Bev0bNDXlsOYw4EEOam4NKI7e9UFCNbFBJ474p7TGKYKS3jVei9h32TYQJtUDyrGcp5b2ca2SpbZGhZsAGaQBWJhFe70W4aHXGWIggEH+BDw+a/DOIQ= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b11eec37-456a-4057-0388-08da73b8bbb4 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0101MB2214.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2022 12:24:08.9628 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0101MB2425 Subject: [FFmpeg-devel] [PATCH 05/11] avcodec/aacenc: Move aac_pce_configs to its only user 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 7vcwBUdFtvid Signed-off-by: Andreas Rheinhardt --- libavcodec/aacenc.c | 273 ++++++++++++++++++++++++++++++++++++++++++++ libavcodec/aacenc.h | 273 -------------------------------------------- 2 files changed, 273 insertions(+), 273 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index ee179542bd..4f51485fc4 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -51,6 +51,279 @@ #include "psymodel.h" +/** + * List of PCE (Program Configuration Element) for the channel layouts listed + * in channel_layout.h + * + * For those wishing in the future to add other layouts: + * + * - num_ele: number of elements in each group of front, side, back, lfe channels + * (an element is of type SCE (single channel), CPE (channel pair) for + * the first 3 groups; and is LFE for LFE group). + * + * - pairing: 0 for an SCE element or 1 for a CPE; does not apply to LFE group + * + * - index: there are three independent indices for SCE, CPE and LFE; + * they are incremented irrespective of the group to which the element belongs; + * they are not reset when going from one group to another + * + * Example: for 7.0 channel layout, + * .pairing = { { 1, 0 }, { 1 }, { 1 }, }, (3 CPE and 1 SCE in front group) + * .index = { { 0, 0 }, { 1 }, { 2 }, }, + * (index is 0 for the single SCE but goes from 0 to 2 for the CPEs) + * + * The index order impacts the channel ordering. But is otherwise arbitrary + * (the sequence could have been 2, 0, 1 instead of 0, 1, 2). + * + * Spec allows for discontinuous indices, e.g. if one has a total of two SCE, + * SCE.0 SCE.15 is OK per spec; BUT it won't be decoded by our AAC decoder + * which at this time requires that indices fully cover some range starting + * from 0 (SCE.1 SCE.0 is OK but not SCE.0 SCE.15). + * + * - config_map: total number of elements and their types. Beware, the way the + * types are ordered impacts the final channel ordering. + * + * - reorder_map: reorders the channels. + * + */ +static const AACPCEInfo aac_pce_configs[] = { + { + .layout = AV_CHANNEL_LAYOUT_MONO, + .num_ele = { 1, 0, 0, 0 }, + .pairing = { { 0 }, }, + .index = { { 0 }, }, + .config_map = { 1, TYPE_SCE, }, + .reorder_map = { 0 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_STEREO, + .num_ele = { 1, 0, 0, 0 }, + .pairing = { { 1 }, }, + .index = { { 0 }, }, + .config_map = { 1, TYPE_CPE, }, + .reorder_map = { 0, 1 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_2POINT1, + .num_ele = { 1, 0, 0, 1 }, + .pairing = { { 1 }, }, + .index = { { 0 },{ 0 },{ 0 },{ 0 } }, + .config_map = { 2, TYPE_CPE, TYPE_LFE }, + .reorder_map = { 0, 1, 2 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_2_1, + .num_ele = { 1, 0, 1, 0 }, + .pairing = { { 1 },{ 0 },{ 0 } }, + .index = { { 0 },{ 0 },{ 0 }, }, + .config_map = { 2, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 0, 1, 2 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_SURROUND, + .num_ele = { 2, 0, 0, 0 }, + .pairing = { { 1, 0 }, }, + .index = { { 0, 0 }, }, + .config_map = { 2, TYPE_CPE, TYPE_SCE, }, + .reorder_map = { 0, 1, 2 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_3POINT1, + .num_ele = { 2, 0, 0, 1 }, + .pairing = { { 1, 0 }, }, + .index = { { 0, 0 }, { 0 }, { 0 }, { 0 }, }, + .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_LFE }, + .reorder_map = { 0, 1, 2, 3 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_4POINT0, + .num_ele = { 2, 0, 1, 0 }, + .pairing = { { 1, 0 }, { 0 }, { 0 }, }, + .index = { { 0, 0 }, { 0 }, { 1 } }, + .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_SCE }, + .reorder_map = { 0, 1, 2, 3 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_4POINT1, + .num_ele = { 2, 1, 1, 0 }, + .pairing = { { 1, 0 }, { 0 }, { 0 }, }, + .index = { { 0, 0 }, { 1 }, { 2 }, { 0 } }, + .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_SCE }, + .reorder_map = { 0, 1, 2, 3, 4 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_2_2, + .num_ele = { 1, 1, 0, 0 }, + .pairing = { { 1 }, { 1 }, }, + .index = { { 0 }, { 1 }, }, + .config_map = { 2, TYPE_CPE, TYPE_CPE }, + .reorder_map = { 0, 1, 2, 3 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_QUAD, + .num_ele = { 1, 0, 1, 0 }, + .pairing = { { 1 }, { 0 }, { 1 }, }, + .index = { { 0 }, { 0 }, { 1 } }, + .config_map = { 2, TYPE_CPE, TYPE_CPE }, + .reorder_map = { 0, 1, 2, 3 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_5POINT0, + .num_ele = { 2, 1, 0, 0 }, + .pairing = { { 1, 0 }, { 1 }, }, + .index = { { 0, 0 }, { 1 } }, + .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE }, + .reorder_map = { 0, 1, 2, 3, 4 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_5POINT1, + .num_ele = { 2, 1, 1, 0 }, + .pairing = { { 1, 0 }, { 0 }, { 1 }, }, + .index = { { 0, 0 }, { 1 }, { 1 } }, + .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE }, + .reorder_map = { 0, 1, 2, 3, 4, 5 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_5POINT0_BACK, + .num_ele = { 2, 0, 1, 0 }, + .pairing = { { 1, 0 }, { 0 }, { 1 } }, + .index = { { 0, 0 }, { 0 }, { 1 } }, + .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE }, + .reorder_map = { 0, 1, 2, 3, 4 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_5POINT1_BACK, + .num_ele = { 2, 1, 1, 0 }, + .pairing = { { 1, 0 }, { 0 }, { 1 }, }, + .index = { { 0, 0 }, { 1 }, { 1 } }, + .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE }, + .reorder_map = { 0, 1, 2, 3, 4, 5 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_6POINT0, + .num_ele = { 2, 1, 1, 0 }, + .pairing = { { 1, 0 }, { 1 }, { 0 }, }, + .index = { { 0, 0 }, { 1 }, { 1 } }, + .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 0, 1, 2, 3, 4, 5 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_6POINT0_FRONT, + .num_ele = { 2, 1, 0, 0 }, + .pairing = { { 1, 1 }, { 1 } }, + .index = { { 1, 0 }, { 2 }, }, + .config_map = { 3, TYPE_CPE, TYPE_CPE, TYPE_CPE, }, + .reorder_map = { 0, 1, 2, 3, 4, 5 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_HEXAGONAL, + .num_ele = { 2, 0, 2, 0 }, + .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, }, + .index = { { 0, 0 },{ 0 },{ 1, 1 } }, + .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, }, + .reorder_map = { 0, 1, 2, 3, 4, 5 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_6POINT1, + .num_ele = { 2, 1, 2, 0 }, + .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, }, + .index = { { 0, 0 },{ 1 },{ 1, 2 } }, + .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_6POINT1_BACK, + .num_ele = { 2, 1, 2, 0 }, + .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, }, + .index = { { 0, 0 }, { 1 }, { 1, 2 } }, + .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_6POINT1_FRONT, + .num_ele = { 2, 1, 2, 0 }, + .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, }, + .index = { { 0, 0 }, { 1 }, { 1, 2 } }, + .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_7POINT0, + .num_ele = { 2, 1, 1, 0 }, + .pairing = { { 1, 0 }, { 1 }, { 1 }, }, + .index = { { 0, 0 }, { 1 }, { 2 }, }, + .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_7POINT0_FRONT, + .num_ele = { 2, 1, 1, 0 }, + .pairing = { { 1, 0 }, { 1 }, { 1 }, }, + .index = { { 0, 0 }, { 1 }, { 2 }, }, + .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_7POINT1, + .num_ele = { 2, 1, 2, 0 }, + .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, }, + .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } }, + .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE, + .num_ele = { 2, 1, 2, 0 }, + .pairing = { { 1, 0 }, { 0 },{ 1, 1 }, }, + .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } }, + .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK, + .num_ele = { 2, 1, 2, 0 }, + .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, }, + .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } }, + .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_OCTAGONAL, + .num_ele = { 2, 1, 2, 0 }, + .pairing = { { 1, 0 }, { 1 }, { 1, 0 }, }, + .index = { { 0, 0 }, { 1 }, { 2, 1 } }, + .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, + }, + { /* Meant for order 2/mixed ambisonics */ + .layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 9, + .u.mask = AV_CH_LAYOUT_OCTAGONAL | AV_CH_TOP_CENTER }, + .num_ele = { 2, 2, 2, 0 }, + .pairing = { { 1, 0 }, { 1, 0 }, { 1, 0 }, }, + .index = { { 0, 0 }, { 1, 1 }, { 2, 2 } }, + .config_map = { 6, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, + }, + { /* Meant for order 2/mixed ambisonics */ + .layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 10, + .u.mask = AV_CH_LAYOUT_6POINT0_FRONT | AV_CH_BACK_CENTER | + AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT | AV_CH_TOP_CENTER }, + .num_ele = { 2, 2, 2, 0 }, + .pairing = { { 1, 1 }, { 1, 0 }, { 1, 0 }, }, + .index = { { 0, 1 }, { 2, 0 }, { 3, 1 } }, + .config_map = { 6, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, + }, + { + .layout = AV_CHANNEL_LAYOUT_HEXADECAGONAL, + .num_ele = { 4, 2, 4, 0 }, + .pairing = { { 1, 0, 1, 0 }, { 1, 1 }, { 1, 0, 1, 0 }, }, + .index = { { 0, 0, 1, 1 }, { 2, 3 }, { 4, 2, 5, 3 } }, + .config_map = { 10, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + }, +}; + static void put_pce(PutBitContext *pb, AVCodecContext *avctx) { int i, j; diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h index a001c7ca60..f5a2b78c6d 100644 --- a/libavcodec/aacenc.h +++ b/libavcodec/aacenc.h @@ -102,279 +102,6 @@ typedef struct AACPCEInfo { uint8_t reorder_map[16]; ///< maps channels from lavc to aac order } AACPCEInfo; -/** - * List of PCE (Program Configuration Element) for the channel layouts listed - * in channel_layout.h - * - * For those wishing in the future to add other layouts: - * - * - num_ele: number of elements in each group of front, side, back, lfe channels - * (an element is of type SCE (single channel), CPE (channel pair) for - * the first 3 groups; and is LFE for LFE group). - * - * - pairing: 0 for an SCE element or 1 for a CPE; does not apply to LFE group - * - * - index: there are three independent indices for SCE, CPE and LFE; - * they are incremented irrespective of the group to which the element belongs; - * they are not reset when going from one group to another - * - * Example: for 7.0 channel layout, - * .pairing = { { 1, 0 }, { 1 }, { 1 }, }, (3 CPE and 1 SCE in front group) - * .index = { { 0, 0 }, { 1 }, { 2 }, }, - * (index is 0 for the single SCE but goes from 0 to 2 for the CPEs) - * - * The index order impacts the channel ordering. But is otherwise arbitrary - * (the sequence could have been 2, 0, 1 instead of 0, 1, 2). - * - * Spec allows for discontinuous indices, e.g. if one has a total of two SCE, - * SCE.0 SCE.15 is OK per spec; BUT it won't be decoded by our AAC decoder - * which at this time requires that indices fully cover some range starting - * from 0 (SCE.1 SCE.0 is OK but not SCE.0 SCE.15). - * - * - config_map: total number of elements and their types. Beware, the way the - * types are ordered impacts the final channel ordering. - * - * - reorder_map: reorders the channels. - * - */ -static const AACPCEInfo aac_pce_configs[] = { - { - .layout = AV_CHANNEL_LAYOUT_MONO, - .num_ele = { 1, 0, 0, 0 }, - .pairing = { { 0 }, }, - .index = { { 0 }, }, - .config_map = { 1, TYPE_SCE, }, - .reorder_map = { 0 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_STEREO, - .num_ele = { 1, 0, 0, 0 }, - .pairing = { { 1 }, }, - .index = { { 0 }, }, - .config_map = { 1, TYPE_CPE, }, - .reorder_map = { 0, 1 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_2POINT1, - .num_ele = { 1, 0, 0, 1 }, - .pairing = { { 1 }, }, - .index = { { 0 },{ 0 },{ 0 },{ 0 } }, - .config_map = { 2, TYPE_CPE, TYPE_LFE }, - .reorder_map = { 0, 1, 2 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_2_1, - .num_ele = { 1, 0, 1, 0 }, - .pairing = { { 1 },{ 0 },{ 0 } }, - .index = { { 0 },{ 0 },{ 0 }, }, - .config_map = { 2, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_SURROUND, - .num_ele = { 2, 0, 0, 0 }, - .pairing = { { 1, 0 }, }, - .index = { { 0, 0 }, }, - .config_map = { 2, TYPE_CPE, TYPE_SCE, }, - .reorder_map = { 0, 1, 2 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_3POINT1, - .num_ele = { 2, 0, 0, 1 }, - .pairing = { { 1, 0 }, }, - .index = { { 0, 0 }, { 0 }, { 0 }, { 0 }, }, - .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_LFE }, - .reorder_map = { 0, 1, 2, 3 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_4POINT0, - .num_ele = { 2, 0, 1, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 0 }, }, - .index = { { 0, 0 }, { 0 }, { 1 } }, - .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_4POINT1, - .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 0 }, }, - .index = { { 0, 0 }, { 1 }, { 2 }, { 0 } }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_2_2, - .num_ele = { 1, 1, 0, 0 }, - .pairing = { { 1 }, { 1 }, }, - .index = { { 0 }, { 1 }, }, - .config_map = { 2, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_QUAD, - .num_ele = { 1, 0, 1, 0 }, - .pairing = { { 1 }, { 0 }, { 1 }, }, - .index = { { 0 }, { 0 }, { 1 } }, - .config_map = { 2, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_5POINT0, - .num_ele = { 2, 1, 0, 0 }, - .pairing = { { 1, 0 }, { 1 }, }, - .index = { { 0, 0 }, { 1 } }, - .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_5POINT1, - .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1 }, }, - .index = { { 0, 0 }, { 1 }, { 1 } }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_5POINT0_BACK, - .num_ele = { 2, 0, 1, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1 } }, - .index = { { 0, 0 }, { 0 }, { 1 } }, - .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_5POINT1_BACK, - .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1 }, }, - .index = { { 0, 0 }, { 1 }, { 1 } }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_6POINT0, - .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 1 }, { 0 }, }, - .index = { { 0, 0 }, { 1 }, { 1 } }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_6POINT0_FRONT, - .num_ele = { 2, 1, 0, 0 }, - .pairing = { { 1, 1 }, { 1 } }, - .index = { { 1, 0 }, { 2 }, }, - .config_map = { 3, TYPE_CPE, TYPE_CPE, TYPE_CPE, }, - .reorder_map = { 0, 1, 2, 3, 4, 5 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_HEXAGONAL, - .num_ele = { 2, 0, 2, 0 }, - .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, }, - .index = { { 0, 0 },{ 0 },{ 1, 1 } }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, }, - .reorder_map = { 0, 1, 2, 3, 4, 5 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_6POINT1, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, }, - .index = { { 0, 0 },{ 1 },{ 1, 2 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_6POINT1_BACK, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, }, - .index = { { 0, 0 }, { 1 }, { 1, 2 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_6POINT1_FRONT, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, }, - .index = { { 0, 0 }, { 1 }, { 1, 2 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_7POINT0, - .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 1 }, { 1 }, }, - .index = { { 0, 0 }, { 1 }, { 2 }, }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_7POINT0_FRONT, - .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 1 }, { 1 }, }, - .index = { { 0, 0 }, { 1 }, { 2 }, }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_7POINT1, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, }, - .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 0 },{ 1, 1 }, }, - .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, }, - .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_OCTAGONAL, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 1 }, { 1, 0 }, }, - .index = { { 0, 0 }, { 1 }, { 2, 1 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, - }, - { /* Meant for order 2/mixed ambisonics */ - .layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 9, - .u.mask = AV_CH_LAYOUT_OCTAGONAL | AV_CH_TOP_CENTER }, - .num_ele = { 2, 2, 2, 0 }, - .pairing = { { 1, 0 }, { 1, 0 }, { 1, 0 }, }, - .index = { { 0, 0 }, { 1, 1 }, { 2, 2 } }, - .config_map = { 6, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, - }, - { /* Meant for order 2/mixed ambisonics */ - .layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 10, - .u.mask = AV_CH_LAYOUT_6POINT0_FRONT | AV_CH_BACK_CENTER | - AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT | AV_CH_TOP_CENTER }, - .num_ele = { 2, 2, 2, 0 }, - .pairing = { { 1, 1 }, { 1, 0 }, { 1, 0 }, }, - .index = { { 0, 1 }, { 2, 0 }, { 3, 1 } }, - .config_map = { 6, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_HEXADECAGONAL, - .num_ele = { 4, 2, 4, 0 }, - .pairing = { { 1, 0, 1, 0 }, { 1, 1 }, { 1, 0, 1, 0 }, }, - .index = { { 0, 0, 1, 1 }, { 2, 3 }, { 4, 2, 5, 3 } }, - .config_map = { 10, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, - }, -}; - /** * AAC encoder context */