From patchwork Thu Oct 27 18:26:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 39020 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:85a8:b0:a2:d5a7:ad9d with SMTP id s40csp337389pzd; Thu, 27 Oct 2022 11:27:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57DZvILliukfwmC7A9p32PKA4sSExysLx1v1AE6o2izYGAbcGrtccFSq0ESDfEB0g1jFPo X-Received: by 2002:a17:907:60c6:b0:797:6704:41b5 with SMTP id hv6-20020a17090760c600b00797670441b5mr34972452ejc.210.1666895224027; Thu, 27 Oct 2022 11:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666895224; cv=none; d=google.com; s=arc-20160816; b=WpEiZ4J7lDMGBOWD/HsJH+O9T6l79xU5ZCNrTMVwayBPHMHdawaQs2ggLPgUYekY2f SFPmqDfB201Hr/v8V3NmGA2zG/7EAT3x0RFv8emsNA2KadfwSViO1B2DGQNG6ZNvrLm6 +fOr/U3t++PORE3w3HFmu2JEpQuDlsT2edpWe9yWfjF46EHeenKI0UFNouKYreoP2uXT eHqozZBwxv0d5LqlWEbogbLBQe+EyJSImu9ynJcCgd4d6HFzUZBIqZesAhY68z7KoKu/ tVo/nr6LfuLMAnhim/WRRSW34PHpJjchC7v4bMGI5j6clnvSHW1vkjrpHWW0OEbpw4Xy rG+A== 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=IyA1fZH+GC/Qh90sCfjirId8s6+BYyF1TKu/1ISntPs=; b=f3RDsZQ1R2Rr1vZ/d6RmbN1QoVdKV1jhJioqn5nxAjxogkt8mkDC5OxtCLj+0pQg8s YfjsMXiMA5V5iFcI9bCTAV7jsLVCcN/bW9o/iYzg1OkYSCIICtRLOvCQP1KC0LsJogNj +ufBsOqXg6RhB6ov2bocAtkz8+UtaOxCQMAcH3TRg5HlfWJWGfR7LQq4hUaQuyjOT+ab 0MROfEKN3ZoK96Gkn9OizdXUN3Lygfyso1+7EOWKakAODGLCgnxqZULD7eg+AWXmAijA wVbI36zTeTdw4diGB3DfPV2pGA3lIM9hbOitvttbB7ptQu8R8PgQuQL/EYcWkwQ7q+xi BwFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=J0Y1KDE5; 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 l8-20020a056402124800b0045a0e39062esi1934157edw.76.2022.10.27.11.27.02; Thu, 27 Oct 2022 11:27:04 -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=@gmail.com header.s=20210112 header.b=J0Y1KDE5; 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 E667168BC1C; Thu, 27 Oct 2022 21:26:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A99F068B554 for ; Thu, 27 Oct 2022 21:26:52 +0300 (EEST) Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-13c569e5ff5so2894784fac.6 for ; Thu, 27 Oct 2022 11:26:52 -0700 (PDT) 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=wXK0ITM7oCnXxT3K3ympAEgq0r+gR5JSsxccejbYp48=; b=J0Y1KDE5ELPWP+6QusjBg0Fk/8K01hRX7sGRRobMk2+sKEq70T2Wqro/2M3s+qByr2 uU3kV8QCXboz2XW1vZfXgx7WUrKhEhBBbqnHqMAepNi2fsgVzHZb7yczoAsUAOIzFoMy b0a+Dh7J2oXNdL3Ol1W/D0f5XrRmW0oHMaySHRNfxhle5CrTC+/TdoVCw/iqVNUsY+8W ANg5W0rXuSd6eULd8nQcRuEbfYMBtORx/2Aje4JKr9pcdrL7D6x2N4WHs0pDuIP1GcQc hmLF0L++stWSpHVMB2VjHLquqX4vKDX0cVGnb6L65i6gGnKGRW+HwFjpEvw1OUOMnQvT FZ3Q== 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=wXK0ITM7oCnXxT3K3ympAEgq0r+gR5JSsxccejbYp48=; b=EGs1Spv1tMVZp0Kqopkzp2YSi/747Mgup+y+F7+p4mUu1zzUcORsb1tEabFmOHtp+u n3DBPyoBZMIPSwcLbjdMd/1hXL2l8Ss+4EjvSn+lmNLHEv77C+pqCHalHGCWpqnSw04S paPDvMikIIRLtRIwbRl13mi0jfWmlBpDxGNcOhtwGHvgJhLWy2SSduop75cOOs7hMxMU kCsztjFxIyRQE1g7BVF2DU+Md1HIrWi/Gc7Rm/ITeBsXTDay9bMx0feb2ngvaqcoQZit BI4E8WWiIDBZ82xas1shPzSeDAzE5T0vPuO6hEvpad5FxK9Xuf2z72FGtuOwp9RiR4vS Bumw== X-Gm-Message-State: ACrzQf05QpFz3FBfqaw5HUrMfJtxRBUnuQ4GeQf/1PXULz5gRHpQueeK HfuVe/c31OZ8qYIPSTk2rcqZG9u11sA= X-Received: by 2002:a05:6870:ec93:b0:13b:8835:97e with SMTP id eo19-20020a056870ec9300b0013b8835097emr6417873oab.191.1666895210899; Thu, 27 Oct 2022 11:26:50 -0700 (PDT) Received: from localhost.localdomain ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id j126-20020aca3c84000000b0035770fc6ca9sm696008oia.16.2022.10.27.11.26.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 11:26:50 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Oct 2022 15:26:50 -0300 Message-Id: <20221027182652.46178-1-jamrial@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/aacdec: fix parsing streams with channel configuration 11 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: 03CtMIvOYw5d Set the correct amount of tags in tags_per_config[]. Also, there are no channels that correspond to a side element in this configuration, so reflect this in the list of known/supported channel layouts. Signed-off-by: James Almer --- libavcodec/aacdec_template.c | 4 +--- libavcodec/aacdectab.h | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 4a9513d53e..c10bc743b6 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -731,9 +731,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2]; } case 11: - if (ac->tags_mapped == 2 && - ac->oc[1].m4ac.chan_config == 11 && - type == TYPE_SCE) { + if (ac->tags_mapped == 3 && type == TYPE_SCE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1]; } diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h index e38b93a534..327efbcde0 100644 --- a/libavcodec/aacdectab.h +++ b/libavcodec/aacdectab.h @@ -35,7 +35,7 @@ #include -static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 4, 5, 16, 5, 0 }; +static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 5, 5, 16, 5, 0 }; static const uint8_t aac_channel_layout_map[16][16][3] = { { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, }, @@ -81,7 +81,7 @@ static const uint64_t aac_channel_layout[] = { AV_CH_LAYOUT_5POINT0_BACK, AV_CH_LAYOUT_5POINT1_BACK, AV_CH_LAYOUT_7POINT1_WIDE_BACK, - AV_CH_LAYOUT_6POINT1, + AV_CH_LAYOUT_6POINT1_BACK, AV_CH_LAYOUT_7POINT1, AV_CH_LAYOUT_22POINT2, 0, @@ -97,7 +97,7 @@ static const AVChannelLayout aac_ch_layout[] = { AV_CHANNEL_LAYOUT_5POINT0_BACK, AV_CHANNEL_LAYOUT_5POINT1_BACK, AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK, - AV_CHANNEL_LAYOUT_6POINT1, + AV_CHANNEL_LAYOUT_6POINT1_BACK, AV_CHANNEL_LAYOUT_7POINT1, AV_CHANNEL_LAYOUT_22POINT2, { 0 }, From patchwork Thu Oct 27 18:26:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 39019 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:85a8:b0:a2:d5a7:ad9d with SMTP id s40csp337378pzd; Thu, 27 Oct 2022 11:27:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7gFOUZJ351ajNoKEga0r2Ty31ZRnjOldHiYfryhV4IBUKZiNFGoC3PXjdeqAmD2RgZfBfU X-Received: by 2002:a05:6402:4441:b0:454:8a74:5459 with SMTP id o1-20020a056402444100b004548a745459mr45892607edb.155.1666895231481; Thu, 27 Oct 2022 11:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666895231; cv=none; d=google.com; s=arc-20160816; b=Ip7X+bzEvZ54gXZ0WqziFMi9C6uyH5YOFKTMcSZjPfsQ0Xh6W8bEfp5H2EuD0icdXf Z6siN9gvjklhchgRVZy8p+eL+xUvaCiCxShO0563VQotf50uf/TGIqXGnDhFR8h0Hww6 NVdPOux6MS3ljYT5A7T3inV7b4vDJ79ZxEix9pSYan2rlbfijayLK+2dpJn92MDiRq4K 9Z+jXaxToDWMORbejZw/9juBNqFv1OSHQcxFQFR/3oNuvxrrRHNnmgMUB/9zt/2G7t0w X3EVlLGV5EDLclzAF0YAKylySjkVUvUenA6fvJEA+8C+Ouod70VjuMeSdLXIBDZbnvfk aUWw== 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=8VF6+A0nEzuXyyHll+CbZa9ZT5OszOjrF/X7/K2TlMM=; b=utaIZh5CIFeloxRljNxPbjZ6awNqCPbp3q5sm7O/MO2zUzPoRb3ncC8sHYukDaZzXX woNTSGKae0XaBpVgGuJAp1vYW3lHe1XEodJyJdnUhqWrBeyuZWkUOXQVxdDWGeL1d0C+ Lx+4/zt0ZJdZ5pfTQqNCICioOlJvwpOHVDgO4Vo8q4+yFHWTP7dKueGSJYVU1DN/F3V3 eHX55i2ol5UTxB59Y74XHQk4NCXU9eXoL9tKssAp3S5etvzgn6Zo+eS/koCAcq8ku8vk SQSeIeajLsUhETi+lQFrAVw3pfUp7GEtvNUfJ8kEOBk2WpzimUP4JhOQv/395hyQK6SF pYfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=qFwtealn; 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 k18-20020a17090632d200b00791a7e441a3si1867805ejk.459.2022.10.27.11.27.11; Thu, 27 Oct 2022 11:27:11 -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=@gmail.com header.s=20210112 header.b=qFwtealn; 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 2097268BC42; Thu, 27 Oct 2022 21:27:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BAA2468BC3B for ; Thu, 27 Oct 2022 21:26:54 +0300 (EEST) Received: by mail-ot1-f48.google.com with SMTP id cy15-20020a056830698f00b0065c530585afso1552340otb.2 for ; Thu, 27 Oct 2022 11:26:54 -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=K/50/wkHlJd0XAdbtDOU++x3IxL2arIRWV7SrEaG788=; b=qFwtealnQ/Ze1BdJBcW1i+oE1ET8qp0A8hvJK/EZ0bErY/OTwfBrt9WMuonAopa+nX X+koYsnEUYFC34K2EcXytITiqBMzJ3FfpK9IfC8qK4AvNBggiHgCnQtI5zcuPJpPSHce zuk6Dh5IEmdFVOwfHAAaRDiAToUJxb5Q/DNn2uKPx0+xkAb/PGs38+bafcaHqcYgrsf+ 3cU80fH23UAikHIP7j9MCPjg05aBI/00ZDakIoswfWeVTBRHY3hCADjdRfpKXkJoMPS1 O+4amIW1ManyAWgAPK6j3HGqaQqSCdvBBfLvfuYTZHmGBIY0NgKBiHyLo7aYETdUSXRb cYsQ== 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=K/50/wkHlJd0XAdbtDOU++x3IxL2arIRWV7SrEaG788=; b=aWFiJ+4GwA7YjSk9dSLq5waGPQvryIVw4j7svNvJbRj+QqZPw6V8VMo9LYLiVrC7L+ ZfCxE+X356hHFGAXKWKMeufQN8TsgkNNxwbBkiXEUqyh5v+xXMyzIEH14a8ytXmSkcL2 pAuZwV4d2dYwpbAWJLuFpDdZgYwkR65MtzSqCvgbO9ioztmKYJ9KfY/wS5+Cuv5FmxaA ezSRYvxHlflyya9wCWOq0f+B6C2zQ5uAhcmgLRBlBWHzaGqEiZ1FEyDYSnQ5zxnVLIAX NqzRj1OSqXYMqCsV7kw1kukqLSEX0X1V3V7luprnY9nnl0nyL+36URnvg8F22uZD7ChW DH9w== X-Gm-Message-State: ACrzQf2ACnKu4izb9hpT4KXrnKoAZVdzZwcjVTgVOVtutS2hkaOXea1y XUBcR+VL38OGH62BTkiQiUpGa8Hm8yc= X-Received: by 2002:a9d:610f:0:b0:661:8e2b:19d3 with SMTP id i15-20020a9d610f000000b006618e2b19d3mr25135458otj.66.1666895212496; Thu, 27 Oct 2022 11:26:52 -0700 (PDT) Received: from localhost.localdomain ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id j126-20020aca3c84000000b0035770fc6ca9sm696008oia.16.2022.10.27.11.26.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 11:26:51 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Oct 2022 15:26:51 -0300 Message-Id: <20221027182652.46178-2-jamrial@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221027182652.46178-1-jamrial@gmail.com> References: <20221027182652.46178-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avutil/channel_layout: add a 7.1(top) channel layout 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: lFcA4d4imS5P Signed-off-by: James Almer --- doc/APIchanges | 3 +++ doc/utils.texi | 2 ++ libavutil/channel_layout.c | 1 + libavutil/channel_layout.h | 2 ++ tests/ref/fate/channel_layout | 1 + 5 files changed, 9 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 5807bf8069..75bbcaddff 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-10-xx - xxxxxxxxxx - lavu 57.xx.xxx - channel_layout.h + Add AV_CH_LAYOUT_7POINT1_TOP and AV_CHANNEL_LAYOUT_7POINT1_TOP. + 2022-10-11 - xxxxxxxxxx - lavu 57.39.101 - pixfmt.h Add AV_PIX_FMT_RGBF32 and AV_PIX_FMT_RGBAF32. diff --git a/doc/utils.texi b/doc/utils.texi index 627b55d154..009452c71d 100644 --- a/doc/utils.texi +++ b/doc/utils.texi @@ -713,6 +713,8 @@ FL+FR+FC+LFE+BL+BR+SL+SR FL+FR+FC+LFE+BL+BR+FLC+FRC @item 7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR +@item 7.1(top) +FL+FR+FC+LFE+BL+BR+TFL+TFR @item octagonal FL+FR+FC+BL+BR+BC+SL+SR @item hexadecagonal diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c index 21b70173b7..bc0016d346 100644 --- a/libavutil/channel_layout.c +++ b/libavutil/channel_layout.c @@ -196,6 +196,7 @@ static const struct channel_layout_name channel_layout_map[] = { { "7.1", AV_CHANNEL_LAYOUT_7POINT1 }, { "7.1(wide)", AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK }, { "7.1(wide-side)", AV_CHANNEL_LAYOUT_7POINT1_WIDE }, + { "7.1(top)", AV_CHANNEL_LAYOUT_7POINT1_TOP }, { "octagonal", AV_CHANNEL_LAYOUT_OCTAGONAL }, { "hexadecagonal", AV_CHANNEL_LAYOUT_HEXADECAGONAL }, { "downmix", AV_CHANNEL_LAYOUT_STEREO_DOWNMIX, }, diff --git a/libavutil/channel_layout.h b/libavutil/channel_layout.h index 059ff70841..0acbdbb9eb 100644 --- a/libavutil/channel_layout.h +++ b/libavutil/channel_layout.h @@ -232,6 +232,7 @@ enum AVChannelOrder { #define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) #define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) #define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1_TOP (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) #define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) #define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) #define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) @@ -388,6 +389,7 @@ typedef struct AVChannelLayout { #define AV_CHANNEL_LAYOUT_7POINT1 AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1) #define AV_CHANNEL_LAYOUT_7POINT1_WIDE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE) #define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK) +#define AV_CHANNEL_LAYOUT_7POINT1_TOP AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_TOP) #define AV_CHANNEL_LAYOUT_OCTAGONAL AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL) #define AV_CHANNEL_LAYOUT_HEXADECAGONAL AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL) #define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO_DOWNMIX) diff --git a/tests/ref/fate/channel_layout b/tests/ref/fate/channel_layout index 19bcbce7d8..4919e23ac4 100644 --- a/tests/ref/fate/channel_layout +++ b/tests/ref/fate/channel_layout @@ -24,6 +24,7 @@ hexagonal FL+FR+FC+BL+BR+BC 7.1 FL+FR+FC+LFE+BL+BR+SL+SR 7.1(wide) FL+FR+FC+LFE+BL+BR+FLC+FRC 7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR +7.1(top) FL+FR+FC+LFE+BL+BR+TFL+TFR octagonal FL+FR+FC+BL+BR+BC+SL+SR hexadecagonal FL+FR+FC+BL+BR+BC+SL+SR+TFL+TFC+TFR+TBL+TBC+TBR+WL+WR downmix DL+DR From patchwork Thu Oct 27 18:26:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 39021 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:85a8:b0:a2:d5a7:ad9d with SMTP id s40csp337481pzd; Thu, 27 Oct 2022 11:27:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5AKc8S9GFznfOOcV0Qfkw5lI/w96ISaVK8wIdDtX32iokyLe4zjXfukksVhIUDp3yojzzr X-Received: by 2002:a17:906:eec9:b0:73d:c369:690f with SMTP id wu9-20020a170906eec900b0073dc369690fmr43754881ejb.767.1666895239739; Thu, 27 Oct 2022 11:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666895239; cv=none; d=google.com; s=arc-20160816; b=lXanhI4fadEPK8Y7MJF+tjiTKFLnYeWsEr1uPEv2X9qZKFHfUFFKNxVddRozXRpUdq V8ROWt1YaQ9vbbfz2pslgrVryygAavtotK36c5YKIJVt00CCHXIxqE9mW5gYBQ3balkw j6YdSd5tKgv2M2hPRGyrvghZqapN86IabTGd500iKxXJmfkf5SbX6rot6BG5XTN38UtE 8/QecM8PLA/cYzXbWvDujHNqXDYTDxfJ87yZv0BJ+9faOC5/sR/s/dfrJ90PSklAppXF KE1hl9LEzNhJoZZZuNYcUJX+lIL5WoG9GquZu2r2pjwtcrqk6lVC5Jfgkm0MC5+t4udN eQnQ== 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=+RvzB/00jCBNRVyT9eECE4bB9jvNq8cYTmo/aCuZ7pE=; b=n9cKnueRLzXMmuM5l+XgwS5jbU5eusBcwwMDra/Oonl0AVNyZXXYnoniwHS9rnO6R2 MWC56k8zj5dHrn2DDzx7GcFuOGZ6fAHSXtMcKFaGkIzQCJnr4rElkn5S+QE8v/KIXqO4 MiEKcIEpgoHcei3fgGA+KJTJ+sm/R/8nDfs0ZSX8vb3t7IHeDvosV9r9nCDeJ5VBOEWx eocwuwcVljF1IXuTNQVrgF6CHzMs6YPkjpmo67qonHry9CJllN9n1D6Qz9/rrxgW9aXD JzHH7Hk3+LLyZyZ4MW4uhZ6Enc2Ln1s/uWGUYBTrWMklEvIQ1n6T9PDUjzELGZpI9oxu RSSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=YFthoSQE; 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 i15-20020a1709064fcf00b007a137bfaa8dsi2290340ejw.148.2022.10.27.11.27.19; Thu, 27 Oct 2022 11:27:19 -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=@gmail.com header.s=20210112 header.b=YFthoSQE; 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 27A5168B554; Thu, 27 Oct 2022 21:27:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AEFFB68BB88 for ; Thu, 27 Oct 2022 21:26:55 +0300 (EEST) Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-13b23e29e36so3266182fac.8 for ; Thu, 27 Oct 2022 11:26:55 -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=iJQsrM0yzbS3RQRXDAk038j/UFa0U41QYc88Sbjh7ks=; b=YFthoSQEbX5ubtpeEkQJnKRIc3zVyxYQBaAVHIGoN+zVh4pdNSNQuhAvXf67NqHLXN F3aDN4q8zrZEgE2nelH6+4leGTG3GaeNwngiv/Uph7JD/dWcfvhFCeW8OPW935qW9FIT yglzwYB7I061EeZJHm9X9p0l4mVkUm9tRK0nxAdIv5DhhJ9yiqygf5Br4Jv90nlI95Kj /DCfeQ6LuN9tc+PcXVT1ipwwAFpX7tiC+M60N497MRu62dztBUF1+W3i27VBzQkun4HX CxepFHqn83TfWtFO7J2Blqse2zY9DXlEhpr5OsJYovaM6URzyyDUYob5KqWHHbu2SaG6 qTLw== 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=iJQsrM0yzbS3RQRXDAk038j/UFa0U41QYc88Sbjh7ks=; b=O47BRhJIlbVnKm8sGbNjyYQLG+HweOynpDmQcM1B5xcbSM6XE82spjoKPBgu7NLNky X+iUTlfhRjZCaxypgE6txoJLkdkRi9MnrfAQFXtXPXiWlNhhE/a/imseZe8T3aC7o61z 18WEvRa5FJOnO4BZBMrp14xQAfJYAJjQS8xjj9AElIhoFY/hIgJLpI41o/2JjR+7bHCc CVuRmSksXep4xeTRe3Z+PLo7M69EOjF5+FK28ef+fxoH8slhr83+eOzDrquXhg37BRBC k6DHfVWnJ6z2bujpPpvN8+D1HhD7NSCKM8ssE4fRz+XlQYwCTppUkuWsdYBOpE/4GBRB 1ZBA== X-Gm-Message-State: ACrzQf1ZnlFje3ugbzi5sYvghqWEoZEYQROiZhqYA0wcOCDj3JqJNqWW LqvFf0S/oaZfXgBAH1DtzhOBQE/Y1CA= X-Received: by 2002:a05:6870:fba9:b0:13b:fe98:53fa with SMTP id kv41-20020a056870fba900b0013bfe9853famr6314780oab.271.1666895213907; Thu, 27 Oct 2022 11:26:53 -0700 (PDT) Received: from localhost.localdomain ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id j126-20020aca3c84000000b0035770fc6ca9sm696008oia.16.2022.10.27.11.26.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 11:26:53 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Oct 2022 15:26:52 -0300 Message-Id: <20221027182652.46178-3-jamrial@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221027182652.46178-1-jamrial@gmail.com> References: <20221027182652.46178-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/aacdec: add support for channel configuration 14 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: IIL1rp+FSLO0 It corresponds to the 7.1(top) layout. Signed-off-by: James Almer --- libavcodec/aacdec_template.c | 25 +++++++++++++++++++++++-- libavcodec/aacdectab.h | 6 +++--- libavcodec/mpeg4audio.c | 5 +++-- libavcodec/mpeg4audio.h | 2 +- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index c10bc743b6..e5ac5bebca 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -404,6 +404,21 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) i++; } + // The previous checks would end up at 4 at this point for chan_config 14 + if (layout == AV_CH_LAYOUT_5POINT1_BACK && tags == 5 && i == 4) { + const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[13]; + for (int j = 0; j < tags; j++) { + if (layout_map[j][0] != reference_layout_map[j][0] || + layout_map[j][2] != reference_layout_map[j][2]) + goto end_of_layout_definition; + } + + i += assign_pair(e2c_vec, layout_map, i, + AV_CH_TOP_FRONT_LEFT, + AV_CH_TOP_FRONT_RIGHT, + AAC_CHANNEL_FRONT, + &layout); + } // The previous checks would end up at 8 at this point for 22.2 if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[12]; @@ -633,7 +648,7 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx, int channel_config) { if (channel_config < 1 || (channel_config > 7 && channel_config < 11) || - channel_config > 13) { + channel_config > 14) { av_log(avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n", channel_config); @@ -717,6 +732,12 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) /* For indexed channel configurations map the channels solely based * on position. */ switch (ac->oc[1].m4ac.chan_config) { + case 14: + if (ac->tags_mapped > 2 && ((type == TYPE_CPE && elem_id < 3) || + (type == TYPE_LFE && elem_id < 1))) { + ac->tags_mapped++; + return ac->tag_che_map[type][elem_id] = ac->che[type][elem_id]; + } case 13: if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id < 8) || (type == TYPE_SCE && elem_id < 6) || @@ -3194,7 +3215,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data, ac->tags_mapped = 0; - if (chan_config < 0 || (chan_config >= 8 && chan_config < 11) || chan_config >= 13) { + if (chan_config < 0 || (chan_config >= 8 && chan_config < 11) || chan_config > 14) { avpriv_request_sample(avctx, "Unknown ER channel configuration %d", chan_config); return AVERROR_INVALIDDATA; diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h index 327efbcde0..55a91cb4fe 100644 --- a/libavcodec/aacdectab.h +++ b/libavcodec/aacdectab.h @@ -68,8 +68,8 @@ static const uint8_t aac_channel_layout_map[16][16][3] = { { TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC, { TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR }, + { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, }, { { 0, } }, - /* TODO: Add 7+1 TOP configuration */ }; #if FF_API_OLD_CHANNEL_LAYOUT @@ -84,8 +84,8 @@ static const uint64_t aac_channel_layout[] = { AV_CH_LAYOUT_6POINT1_BACK, AV_CH_LAYOUT_7POINT1, AV_CH_LAYOUT_22POINT2, + AV_CH_LAYOUT_7POINT1_TOP, 0, - /* AV_CH_LAYOUT_7POINT1_TOP, */ }; #endif @@ -100,8 +100,8 @@ static const AVChannelLayout aac_ch_layout[] = { AV_CHANNEL_LAYOUT_6POINT1_BACK, AV_CHANNEL_LAYOUT_7POINT1, AV_CHANNEL_LAYOUT_22POINT2, + AV_CHANNEL_LAYOUT_7POINT1_TOP, { 0 }, - /* AV_CHANNEL_LAYOUT_7POINT1_TOP, */ }; #endif /* AVCODEC_AACDECTAB_H */ diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c index e38a8c0852..4a996411d1 100644 --- a/libavcodec/mpeg4audio.c +++ b/libavcodec/mpeg4audio.c @@ -56,7 +56,7 @@ static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c, void *logctx return 0; } -const uint8_t ff_mpeg4audio_channels[14] = { +const uint8_t ff_mpeg4audio_channels[15] = { 0, 1, // mono (1/0) 2, // stereo (2/0) @@ -70,7 +70,8 @@ const uint8_t ff_mpeg4audio_channels[14] = { 0, 7, // 3/3.1 8, // 3/2/2.1 - 24 // 3/3/3 - 5/2/3 - 3/0/0.2 + 24, // 3/3/3 - 5/2/3 - 3/0/0.2 + 8 // 3/2.1 - 2/0 }; static inline int get_object_type(GetBitContext *gb) diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h index a6f71cff58..56615ef321 100644 --- a/libavcodec/mpeg4audio.h +++ b/libavcodec/mpeg4audio.h @@ -42,7 +42,7 @@ typedef struct MPEG4AudioConfig { } MPEG4AudioConfig; extern const int ff_mpeg4audio_sample_rates[16]; -extern const uint8_t ff_mpeg4audio_channels[14]; +extern const uint8_t ff_mpeg4audio_channels[15]; /** * Parse MPEG-4 systems extradata from a potentially unaligned GetBitContext to retrieve audio configuration.