From patchwork Mon Oct 31 21:18:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 39096 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8e01:b0:a3:a294:714c with SMTP id y1csp1160912pzj; Mon, 31 Oct 2022 14:19:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4OvkW1eZtkEfVMqbwTGj+BN8ULrUXaNuq+cttHyAD4Lv8OcR47eoNrfZktcRRyWetBXi/q X-Received: by 2002:a17:907:a42c:b0:7aa:97e5:fac6 with SMTP id sg44-20020a170907a42c00b007aa97e5fac6mr14539640ejc.378.1667251155000; Mon, 31 Oct 2022 14:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667251154; cv=none; d=google.com; s=arc-20160816; b=CrT3rEQJLB5vOM4QFZZHmqcSD/UTezrh7VkatxBd3Qsqaz3VrQSnTO70m0zxFQ3MZE Sy7h85d4rsyU9MCCrtpGVKV3f9uMSc7N0UH1nXBrDlFM8e7pa/TGl1/6U2LYiJfTHwyK h8wxm2sgW+biqwFR8vZJ37zDaXyZyqdZmhWwBN6NGfv2Wr7av76eHDLUlM0WYNCQZ3QI qtwjgR3C9FclM2Vz41rj733FsX62hbLyeuqRYJXehCWceKdnWxznBwZuvIBYvF/8fcZn 6kip8vTMktwe6eUWIKeid27czWTLSD7z9I22ciMkVnhH/nMhQUZhfi1/A068MOCVRxxE tg/Q== 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=pxMUQ+CaT6cPbUD/1i5B9m1ZDXwjV39pqIItWZOGbd0=; b=lQnJaWGuptdz1NRpLdKB87t1krfFqGqaziiDZaWV6n/ylilUPUDMQvR6Id0DAnGCSP uFg0leH+i0xUul7JkJ12ts9Gpi8mljIR44/ovIU7+kMIMkGf2IU6TpK39s1Psds8wt6j MTxNxFfXPvV36DEIu4Y4DfHvE02zH87UoO4s+8kAS6QHplxl3CnJFYxQI4uQtyBIzYuo m8pd7QwhORoA0Me8NNZXEEIY+ny9FcX6gbOzCaODYv/1e95BAFv4I3omEQaBy+yprUYq +wFWODh7qB1N4CZkqK75pP2NBbgfGQRAfKq1DZTj3dFXunMKso1HFMocNZ+l+EkCKDRQ 58XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=HI2h+5fW; 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 i10-20020a170906264a00b00741a18d4a5asi6697319ejc.994.2022.10.31.14.19.14; Mon, 31 Oct 2022 14:19:14 -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=HI2h+5fW; 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 E422168BE18; Mon, 31 Oct 2022 23:19:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E29068BE18 for ; Mon, 31 Oct 2022 23:18:53 +0200 (EET) Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-12c8312131fso14873511fac.4 for ; Mon, 31 Oct 2022 14:18:53 -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=Iqv48OuIziSuYbZY0Et80woXPZA4vE3HI7lt6oYyb9E=; b=HI2h+5fW2gBAW7YO9NCgMa3L9exo9SpggEVwmbVBFnBZ9tYrbZ+SpiReIUJvqk4zJz MIWwPC0gOSfgzwj114uV7vN+yjl4qR70L2a3b2IQBZaI/By5d0OVy5niuGXfnGaLJees zowEy82Njmu8p/ANga/bMYsYziNnxM6B44UldEPoy7crKbUfo5zyj8s9mep4dxrBfWBl roW0bqTX/nazwkbJLNSeIyIdCfiogzmsn9q/JNINyGZMA7MveAnwHCSTP4jATbF0Ry+c /3y3NGf3xpg7EWQAG8VhtdguYneWO/vZhZ1ZY5S/1NMMnd12Tr1omntm7iGVcm1P3Alr v0OA== 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=Iqv48OuIziSuYbZY0Et80woXPZA4vE3HI7lt6oYyb9E=; b=V6NWw7nw23OqgvocLFUgQsZdMHtjM9NMv8M50F8y8Bl8JrWU4j22jWG5h7KQe/ZSgl EhSMyTWZqXTXww2ovvMJanW+NfWKUgIr/VTSIqg/vpItOQOMaU+PNmncoZBz2D5kamZb JYRBfzBRnGPFHuMfjVA4t3ICbDqff/g/kjlCbnWEhXANFzTDnOGCw3+UU3/s1aDWe9XS tXaZeGWYCNRVxnnq5nf5yL2444xE0PLVsqG/5d1YLjvpLVBoG49VjtM6BYRRzsEIZH+S 7aFEV9fRVbulKgrithvXjOg4M7qNRzsBwX20JsjdNwKL1H6sGvpJYh0ACl4uPg8qA67S weXw== X-Gm-Message-State: ACrzQf3eJMKu+oC6R2SkR64CHw88RVMFX18Xy5AxLmhSSg0PIk/Hr5bD DfttdU3kTIWZ2w8HXQtcndByEKx4sOs= X-Received: by 2002:a05:6870:c888:b0:12c:7f3b:d67d with SMTP id er8-20020a056870c88800b0012c7f3bd67dmr9016205oab.229.1667251132035; Mon, 31 Oct 2022 14:18:52 -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.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 14:18:51 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 31 Oct 2022 18:18:31 -0300 Message-Id: <20221031211832.8213-3-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 5/6] avcodec/aacdec: don't force a layout when a channel position is unknown 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: sOajnnxlXtuM If PCE defines channels not covered by those in the standard configurations then don't try to come up with some made up layout and just return them in the coded order. Fixes al08_44.mp4 from the conformance suite, now reporting and decoding all 48 channels instead of 10. Signed-off-by: James Almer --- libavcodec/aacdec_template.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 9a85692069..4a88aeae1d 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -325,36 +325,19 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) AAC_CHANNEL_FRONT, &layout); num_front_channels -= 2; } - while (num_front_channels >= 2) { - i += assign_pair(e2c_vec, layout_map, i, - UINT64_MAX, - UINT64_MAX, - AAC_CHANNEL_FRONT, &layout); - num_front_channels -= 2; - } + if (num_front_channels) + return 0; // Non standard PCE defined layout if (num_side_channels >= 2) { i += assign_pair(e2c_vec, layout_map, i, AV_CH_SIDE_LEFT, AV_CH_SIDE_RIGHT, - AAC_CHANNEL_FRONT, &layout); - num_side_channels -= 2; - } - while (num_side_channels >= 2) { - i += assign_pair(e2c_vec, layout_map, i, - UINT64_MAX, - UINT64_MAX, AAC_CHANNEL_SIDE, &layout); num_side_channels -= 2; } + if (num_side_channels) + return 0; // Non standard PCE defined layout - while (num_back_channels >= 4) { - i += assign_pair(e2c_vec, layout_map, i, - UINT64_MAX, - UINT64_MAX, - AAC_CHANNEL_BACK, &layout); - num_back_channels -= 2; - } if (num_back_channels >= 2) { i += assign_pair(e2c_vec, layout_map, i, AV_CH_BACK_LEFT, @@ -373,6 +356,8 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) i++; num_back_channels--; } + if (num_back_channels) + return 0; // Non standard PCE defined layout if (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) { e2c_vec[i] = (struct elem_to_channel) {