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 A98B143C81 for ; Fri, 28 Oct 2022 12:34:15 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0EF3168BCED; Fri, 28 Oct 2022 15:34:13 +0300 (EEST) Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 04C4068BCC3 for ; Fri, 28 Oct 2022 15:34:07 +0300 (EEST) Received: by mail-ot1-f46.google.com with SMTP id d26-20020a05683018fa00b0066ab705617aso2873553otf.13 for ; Fri, 28 Oct 2022 05:34:06 -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:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=MA6TX2DEHVknba3rPsDbEbmSZAie22M8MQ2PBIBRF6E=; b=FFq1bFtz2izOzsKai7wZc4GMPC6i0JagCxUM02HBAP/3IGwyg7CkixtvWJSCmAhAAJ OGMvb9FKlzkowCPO1hcxcCKLFMBJxqESo2yqCuVmhdpHUmUZNvgpVWdbUDSV4N+kD5lb oJB6mYZTkSwrPRTQlD+3UqSP9FKlrtIv51RWsgyj6UInrYVZ3IWV3RjBJc7j7IXKqtUm AQ3PE57uw1gQ7/eUH2TNwhhIv6cL/t0eYtQWWGUz26ka1afvx7PJX6CwzVdFRG8o2ivu x2kNPYDu++FDhpoE6W0oS5+F+9fRQwck0Rd0b44eAykoaoKYoL/N+rK3AtUOm6Ju1DOp 65qQ== 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:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MA6TX2DEHVknba3rPsDbEbmSZAie22M8MQ2PBIBRF6E=; b=XRftealN46PpBSyIi5gTASgiz6zI2t9GqzS2QcdmJIHmIMEQSGjbclXdMq0dYMmaqs E55bvmfg7g35fo48BazQs0js4UMI3VPTTgwP/QiwrwsTSo421WrH6UW6rbuinnlqY7lC cPHrcJbQrPVFXnm7PEkVk/hGtYaxIGUbeFBBWStCNRnRbOZPtR57l3jIGCk6Sy+KOwcf lq86aGgA84oRmQIEl5Q6ClWV3A7/elrsf74NbB4GfvDmLg8cAvX1kc/67nav4vWhGJpB EuLJN50O3wXECcCT6rYRquVuYoNOIFAF0QTYQx4qxqnyLW4RLrd1WAUK5sOerepPf8wK b6zQ== X-Gm-Message-State: ACrzQf2Zx8I3OtgmH7Sg5fhRc8OZO0yogaKHF8Xc16wGYOtQ/9YdS6sz p0EnnOx/jYeODLTKdB/aZTVBL3uhjuM= X-Google-Smtp-Source: AMsMyM4d0W6p2U0WaABwmxWPFXGkYOBkpv+fX9Bzk4rl/Nwop+/ZqL8uwP+hn1L8k8QEcCGSZwpgFQ== X-Received: by 2002:a9d:4e6:0:b0:65b:f9ff:327b with SMTP id 93-20020a9d04e6000000b0065bf9ff327bmr27048119otm.163.1666960445083; Fri, 28 Oct 2022 05:34:05 -0700 (PDT) Received: from [192.168.0.13] ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id e14-20020a056870238e00b00132784a3a1fsm1978475oap.46.2022.10.28.05.34.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 05:34:04 -0700 (PDT) Message-ID: Date: Fri, 28 Oct 2022 09:34:20 -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 To: ffmpeg-devel@ffmpeg.org References: <20221028122140.1885-1-jamrial@gmail.com> <20221028122140.1885-3-jamrial@gmail.com> Content-Language: en-US From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 3/4 v2] 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 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/28/2022 9:31 AM, Andreas Rheinhardt wrote: > James Almer: >> It corresponds to the 7.1(top) layout. >> >> Signed-off-by: James Almer >> --- >> libavcodec/aacdec_template.c | 23 ++++++++++++++++++++++- >> libavcodec/aacdectab.h | 6 +++--- >> libavcodec/mpeg4audio.c | 5 +++-- >> libavcodec/mpeg4audio.h | 2 +- >> 4 files changed, 29 insertions(+), 7 deletions(-) >> >> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c >> index c10bc743b6..4b8e29ba71 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 && 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) || >> diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h >> index b820f10556..e9bbd1fe13 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_SIDE }, { 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, >> 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, >> 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 > > Is it guaranteed that 8 will always be the last element of this array? > If not, you should use "8,", so that the comma won't have to be added > when someone makes an addition in the future. What does the pedantic gcc option say about this? I recall it complained about either having or missing the comma in the last element, so given that it makes no real difference I'd go with whatever keeps it quiet. > >> }; >> >> 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. > > _______________________________________________ > 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". _______________________________________________ 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".