From patchwork Tue Aug 18 19:25:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 21711 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id DB78D447A04 for ; Tue, 18 Aug 2020 22:34:10 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C3DD068803D; Tue, 18 Aug 2020 22:34:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F112C687F9E for ; Tue, 18 Aug 2020 22:34:03 +0300 (EEST) Received: by mail-lj1-f196.google.com with SMTP id m22so22722108ljj.5 for ; Tue, 18 Aug 2020 12:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=0rtPrdwDTMwBIkHAYOMEYew6qG0QY9sqhW7WEJJPQFw=; b=rX8zZbpbWt11sv8Y/cjlWnlyN4r+7ucW9q5kiTrojFrxwXks6NM+Zq6G41AnGQKtdh zpi+Vm0W+hMdwoZtVW4hHaCvD2UFfGqv54jjaFt45ZXItU1oFGLqbcxpitALBHXQXEQv mCJXX6gYzFtVcxyOYsFN+MSdJI+ThZS0IbBNyKtwDyv5J+IAL+C1zPQ3/o2GTofqxmxX 2RZcFT33ET02eCtVpqO38SXJufw7FxSYPRXk6glJMRtGCXM/URUKNWPvGwl2msPpue5q 1sOjihuVs2r8a79d1I9tzlTCJYNWJ6xGfjplGGS4T4ZlUwFznf45FljUGODDTatM3m0F 932A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0rtPrdwDTMwBIkHAYOMEYew6qG0QY9sqhW7WEJJPQFw=; b=LfUErcgoESaPIle8e8DkRG3769X4E9930rPw7TFGAHJrmADv8i2ubgIyK1L/eZkPuq H0MY/1yBbmcJf2MgNod2Zq+RUvQ4VuChnO+T0nfyFop5QAOHmHIfqMpzrnnnmaAXJLTv Ju8eakKtvbjRmDX7rGWO4bVIW7S5890sY4+4X81rS0J79krCaW9G0+j0zudlkUfILkm+ YcWtt9/U5pzG8foxer8EZfl1ZHOkoVdJWUoTJXXv5S47WOA2SrTtQmiRUo0JQwXa8SFQ Ob/cbKIkzawVZhx7MhidndOklJd5neDiSvr6NhlnhxKcwm/jjIqO94TqWlMkmJtaYQId 9pGQ== X-Gm-Message-State: AOAM530rqKwST0++b0MMeZooy6n1rGIAF+IcE2NFn3FfekBVdZZ2Hq1O r2fKkysv7Gn55LIiRMtFEQRUg5chNJw= X-Google-Smtp-Source: ABdhPJw96KT2Ph0rmsGRcptBNNB6gxr8YNkOtEBQ5qgUnPJafcEC6gDKEIcZiCHSWlZ2BohaRXKtHg== X-Received: by 2002:a19:ccf:: with SMTP id 198mr10528307lfm.108.1597778741307; Tue, 18 Aug 2020 12:25:41 -0700 (PDT) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id 1sm6140940ljr.6.2020.08.18.12.25.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 12:25:40 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Aug 2020 22:25:36 +0300 Message-Id: <20200818192538.35023-2-jeebjp@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200818192538.35023-1-jeebjp@gmail.com> References: <20200818192538.35023-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/aacdec_template: keep tabs on layout in sniff_channel_order X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" This way the layout set at various points can be checked instead of only having the layout at the end. --- libavcodec/aacdec_template.c | 53 ++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 8c5048cc13..9eef1c0158 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -198,7 +198,7 @@ struct elem_to_channel { static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t (*layout_map)[3], int offset, uint64_t left, - uint64_t right, int pos) + uint64_t right, int pos, uint64_t *layout) { if (layout_map[offset][0] == TYPE_CPE) { e2c_vec[offset] = (struct elem_to_channel) { @@ -207,6 +207,9 @@ static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID], .elem_id = layout_map[offset][1], .aac_position = pos }; + if (e2c_vec[offset].av_position != UINT64_MAX) + *layout |= e2c_vec[offset].av_position; + return 1; } else { e2c_vec[offset] = (struct elem_to_channel) { @@ -221,6 +224,9 @@ static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID], .elem_id = layout_map[offset + 1][1], .aac_position = pos }; + if ((left|right) != UINT64_MAX) + *layout |= (left|right); + return 2; } } @@ -262,7 +268,7 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) int i, n, total_non_cc_elements; struct elem_to_channel e2c_vec[4 * MAX_ELEM_ID] = { { 0 } }; int num_front_channels, num_side_channels, num_back_channels; - uint64_t layout; + uint64_t layout = 0; if (FF_ARRAY_ELEMS(e2c_vec) < tags) return 0; @@ -294,6 +300,7 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_FRONT }; + layout |= e2c_vec[i].av_position; i++; num_front_channels--; } @@ -301,21 +308,21 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) i += assign_pair(e2c_vec, layout_map, i, AV_CH_FRONT_LEFT_OF_CENTER, AV_CH_FRONT_RIGHT_OF_CENTER, - AAC_CHANNEL_FRONT); + AAC_CHANNEL_FRONT, &layout); num_front_channels -= 2; } if (num_front_channels >= 2) { i += assign_pair(e2c_vec, layout_map, i, AV_CH_FRONT_LEFT, AV_CH_FRONT_RIGHT, - AAC_CHANNEL_FRONT); + 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); + AAC_CHANNEL_FRONT, &layout); num_front_channels -= 2; } @@ -323,14 +330,14 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) i += assign_pair(e2c_vec, layout_map, i, AV_CH_SIDE_LEFT, AV_CH_SIDE_RIGHT, - AAC_CHANNEL_FRONT); + 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); + AAC_CHANNEL_SIDE, &layout); num_side_channels -= 2; } @@ -338,14 +345,14 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) i += assign_pair(e2c_vec, layout_map, i, UINT64_MAX, UINT64_MAX, - AAC_CHANNEL_BACK); + 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, AV_CH_BACK_RIGHT, - AAC_CHANNEL_BACK); + AAC_CHANNEL_BACK, &layout); num_back_channels -= 2; } if (num_back_channels) { @@ -355,6 +362,7 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_BACK }; + layout |= e2c_vec[i].av_position; i++; num_back_channels--; } @@ -366,6 +374,7 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_LFE }; + layout |= e2c_vec[i].av_position; i++; } if (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) { @@ -375,6 +384,7 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_LFE }; + layout |= e2c_vec[i].av_position; i++; } while (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) { @@ -384,6 +394,7 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_LFE }; + layout |= e2c_vec[i].av_position; i++; } @@ -394,41 +405,45 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] - }; i++; + }; layout |= e2c_vec[i].av_position; i++; i += assign_pair(e2c_vec, layout_map, i, AV_CH_TOP_FRONT_LEFT, AV_CH_TOP_FRONT_RIGHT, - AAC_CHANNEL_FRONT); + AAC_CHANNEL_FRONT, + &layout); i += assign_pair(e2c_vec, layout_map, i, AV_CH_TOP_SIDE_LEFT, AV_CH_TOP_SIDE_RIGHT, - AAC_CHANNEL_SIDE); + AAC_CHANNEL_SIDE, + &layout); e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_TOP_CENTER, .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] - }; i++; + }; layout |= e2c_vec[i].av_position; i++; i += assign_pair(e2c_vec, layout_map, i, AV_CH_TOP_BACK_LEFT, AV_CH_TOP_BACK_RIGHT, - AAC_CHANNEL_BACK); + AAC_CHANNEL_BACK, + &layout); e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_TOP_BACK_CENTER, .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] - }; i++; + }; layout |= e2c_vec[i].av_position; i++; e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_BOTTOM_FRONT_CENTER, .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] - }; i++; + }; layout |= e2c_vec[i].av_position; i++; i += assign_pair(e2c_vec, layout_map, i, AV_CH_BOTTOM_FRONT_LEFT, AV_CH_BOTTOM_FRONT_RIGHT, - AAC_CHANNEL_FRONT); + AAC_CHANNEL_FRONT, + &layout); } total_non_cc_elements = n = i; @@ -459,14 +474,10 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) } - layout = 0; for (i = 0; i < total_non_cc_elements; i++) { layout_map[i][0] = e2c_vec[i].syn_ele; layout_map[i][1] = e2c_vec[i].elem_id; layout_map[i][2] = e2c_vec[i].aac_position; - if (e2c_vec[i].av_position != UINT64_MAX) { - layout |= e2c_vec[i].av_position; - } } return layout; From patchwork Tue Aug 18 19:25:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 21709 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id DAFC5447941 for ; Tue, 18 Aug 2020 22:33:18 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B9DCC6880D5; Tue, 18 Aug 2020 22:33:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8B564687FF1 for ; Tue, 18 Aug 2020 22:33:12 +0300 (EEST) Received: by mail-lj1-f195.google.com with SMTP id i10so22752040ljn.2 for ; Tue, 18 Aug 2020 12:33:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=OD3o9fq+dy4zC3A1zPI3NjmLatfpR+IJDODopgn4GOU=; b=Hjtv9Vpcj5JXzXubRWadTE3i68f0dBmNYRy9nhjnDxM1Hi6SqLxgqqlRIGbv42Q6xN Yed4gmEXwigmYROTcFCwjc9vFyJRud2AYLWoPOkrrLUaAXWlYjWMAX7WGebEwSzYE1XO 3srcQkIk6IEou0y5WUGmPqIBau9ACQzLM+YYFnkdgRNY9Dfdxv3hEowQYetEaHVcYnOI u08JV/kWJepxkCzV9XnNRzzXF3XYYjWmkiZsYfg9/B7hKlbPwvkgDM2H4rRVGfuYTsUS te4N+BIwhoJ5lx9aK9Ythhs5WEKO4eBKcOa+dzVwM2q2ngAy+bYM+q5HWNMP73kUHVTN bQXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OD3o9fq+dy4zC3A1zPI3NjmLatfpR+IJDODopgn4GOU=; b=Ds6ZG+lGZiHKW4tEHM45DzQ00YIw/bXikR4xB0ybfKM1ZbcKVO7EM/QxHuPIkBJWxy tQ8Bd5zfyS4hBrp1M5kinWZ774aAiVhdR68jQdgldpM7GPt6eM+8ERLcpVNIiqiETUuQ 32qkYzOqS46L0Pw40UUPOqOImcfLb70zSxiBFplqDYWA24uc3OLqPO6ROicWSeNBYSr+ BahhGMBYEjCaunikRgzDfYBjuJ3VA6TxZ2nhzTSNSo3T4qV/D+u9o4iDl7oV8PLF/NGf s+wRcvFynLFsXA+B5q+7HMEksZveTK5stXi3wXN51A+yu6CZnJuwTq07ivYNo6RqJguQ yXRg== X-Gm-Message-State: AOAM531fMdDk9dyVWmB49fb+NCVzS+tdMDyGtGFrLq4KIyStmC7KXSJc XIdlGCOwsICWjmhn86o4/fWDxutL7kI= X-Google-Smtp-Source: ABdhPJzvkgCHCn2Y1PIEMko5eQN+eu8IzOSVW4V8g8CkEIOzn04YE6VlxSclvk3NHMaL2x3QwBVigw== X-Received: by 2002:a2e:9a53:: with SMTP id k19mr10578670ljj.272.1597778742294; Tue, 18 Aug 2020 12:25:42 -0700 (PDT) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id 1sm6140940ljr.6.2020.08.18.12.25.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 12:25:41 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Aug 2020 22:25:37 +0300 Message-Id: <20200818192538.35023-3-jeebjp@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200818192538.35023-1-jeebjp@gmail.com> References: <20200818192538.35023-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/aacdec_template: add more checks to make sure only 22.2 gets to 22.2 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" This way we can check that we have exactly the required things for 22.2. Fixes #8845 --- libavcodec/aacdec_template.c | 40 ++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 9eef1c0158..1e112ccf76 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -263,6 +263,7 @@ static int count_paired_channels(uint8_t (*layout_map)[3], int tags, int pos, return num_pos_channels; } +#define PREFIX_FOR_22POINT2 (AV_CH_LAYOUT_7POINT1_WIDE_BACK|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_LOW_FREQUENCY_2) static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) { int i, n, total_non_cc_elements; @@ -399,46 +400,78 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) } // The previous checks would end up at 8 at this point for 22.2 - if (tags == 16 && i == 8) { + if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { + if (layout_map[i][2] != AAC_CHANNEL_FRONT) + goto end_of_layout_definition; + e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_TOP_FRONT_CENTER, .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] }; layout |= e2c_vec[i].av_position; i++; + + if (layout_map[i][2] != AAC_CHANNEL_FRONT) + 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); + + if (layout_map[i][2] != AAC_CHANNEL_SIDE) + goto end_of_layout_definition; + i += assign_pair(e2c_vec, layout_map, i, AV_CH_TOP_SIDE_LEFT, AV_CH_TOP_SIDE_RIGHT, AAC_CHANNEL_SIDE, &layout); + + if (layout_map[i][2] != AAC_CHANNEL_FRONT) + goto end_of_layout_definition; + e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_TOP_CENTER, .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] }; layout |= e2c_vec[i].av_position; i++; + + if (layout_map[i][2] != AAC_CHANNEL_BACK) + goto end_of_layout_definition; + i += assign_pair(e2c_vec, layout_map, i, AV_CH_TOP_BACK_LEFT, AV_CH_TOP_BACK_RIGHT, AAC_CHANNEL_BACK, &layout); + + if (layout_map[i][2] != AAC_CHANNEL_BACK) + goto end_of_layout_definition; + e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_TOP_BACK_CENTER, .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] }; layout |= e2c_vec[i].av_position; i++; + + + if (layout_map[i][2] != AAC_CHANNEL_FRONT) + goto end_of_layout_definition; + e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_BOTTOM_FRONT_CENTER, .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] }; layout |= e2c_vec[i].av_position; i++; + + if (layout_map[i][2] != AAC_CHANNEL_FRONT) + goto end_of_layout_definition; + i += assign_pair(e2c_vec, layout_map, i, AV_CH_BOTTOM_FRONT_LEFT, AV_CH_BOTTOM_FRONT_RIGHT, @@ -446,9 +479,12 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) &layout); } +end_of_layout_definition: + total_non_cc_elements = n = i; - if (tags == 16 && total_non_cc_elements == 16) { + if (layout == AV_CH_LAYOUT_22POINT2 && + tags == 16 && total_non_cc_elements == 16) { // For 22.2 reorder the result as needed FFSWAP(struct elem_to_channel, e2c_vec[2], e2c_vec[0]); // FL & FR first (final), FC third FFSWAP(struct elem_to_channel, e2c_vec[2], e2c_vec[1]); // FC second (final), FLc & FRc third From patchwork Tue Aug 18 19:25:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 21708 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 790D944BD02 for ; Tue, 18 Aug 2020 22:31:22 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5B92C688084; Tue, 18 Aug 2020 22:31:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5928F680B6D for ; Tue, 18 Aug 2020 22:31:16 +0300 (EEST) Received: by mail-lj1-f170.google.com with SMTP id f26so22722116ljc.8 for ; Tue, 18 Aug 2020 12:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=KNoigT4tofTDFSLT1kUTtQwQtNoYE4qcqeKKfkUm62I=; b=uQ82CEpm9sOiDlZVMeSmYOMTgwxqFBdLZiiFV/MJeseHM29LbyjdFmm+8TqZ1HWnq/ xhcxcEs6zgY+ckFohJSA+MYA/ve8Te6DBmlYXEqqsVt1RHcs8gpkh4MhZ/AI0/yrG33w CILEG2tjd9ynqwt/W/34tspn++C0ngUa2392jHNusq4el5qBB0bz0lG3+/u/m1dtiY55 wI7xZCTWAcqWLAO/lZF64crfnqyCcV4FPmyVYLJsDSZmHad2CdX8wS608yHYUNxiEm9U v2Bvz5YtCxMXEzJFXVtnZki1A8ek2dMjPHTSwzQPalFfCXxWCUiWeqdSC1ZLrqt0Ezzl kSig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KNoigT4tofTDFSLT1kUTtQwQtNoYE4qcqeKKfkUm62I=; b=sIbZX3cSbjkV3Ovq6BGkYF+TFCtZzf/HlqTNUXbOy1UlbdBI8AzViVEXfNcD6LEWCQ nXWAUgESKatvDL/DIY44gFNMmp7EjgfqPzsHlGaeXhobXJiPjVGZJ/VfKXW8BPtvu8ON PTGIGrkfSgDx51J/7hFpWXe2RtjdSmmS+XYihndN1ytxFH2VTsnfwkm7CPJoe2HQ2uN5 kxX2tqJruB9H6cpowAX62qwbGtj5AxAxUMf0KubKjEHF4kJ62weKId4/VifC1V8J+CWm /JijHpAO7MD824Kf0WbkR+S1Z6kBxfqOuS+P8m5RWBzQYOqc0F5hzxl4Wt4Qc3Fa0feM DeUg== X-Gm-Message-State: AOAM532mBiN0XYztJgmnvL+d1Vv2yKJ6rjTdHW07qlq/tWjibObo0Bba Q3E9AaWY/sFueH/Xzc/W23B0+bKe4o8= X-Google-Smtp-Source: ABdhPJzl82rnFylW4hNfnTbESKRWZs2dZWyo5YF0p3UQ4LgyV7icaXdv/YRmeFg/VY/oHMhCjFeEdw== X-Received: by 2002:a19:e45:: with SMTP id 66mr10449613lfo.82.1597778743261; Tue, 18 Aug 2020 12:25:43 -0700 (PDT) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id 1sm6140940ljr.6.2020.08.18.12.25.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 12:25:42 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Aug 2020 22:25:38 +0300 Message-Id: <20200818192538.35023-4-jeebjp@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200818192538.35023-1-jeebjp@gmail.com> References: <20200818192538.35023-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/aacdec_template: log the element order before/after reordering X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" This was quite useful to verify that 22.2 got properly handled, among other things. --- libavcodec/aacdec_template.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 1e112ccf76..4662bbe41a 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -263,6 +263,22 @@ static int count_paired_channels(uint8_t (*layout_map)[3], int tags, int pos, return num_pos_channels; } +static void log_e2c(int num, struct elem_to_channel e2c) { + char buf[128] = { 0 }; + + av_get_channel_layout_string(buf, sizeof(buf), -1, e2c.av_position); + + av_log(NULL, AV_LOG_DEBUG, + "tag %d = { position(s): %s (0x%"PRIx64"), syn_elem: %s, elem_id: %"PRIu8" }\n", + num, + e2c.av_position == UINT64_MAX ? "Unset/Ignored" : buf, + e2c.av_position, + e2c.syn_ele == TYPE_SCE ? "SCE" : + e2c.syn_ele == TYPE_CPE ? "CPE" : + e2c.syn_ele == TYPE_LFE ? "LFE" : "", + e2c.elem_id); +} + #define PREFIX_FOR_22POINT2 (AV_CH_LAYOUT_7POINT1_WIDE_BACK|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_LOW_FREQUENCY_2) static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) { @@ -483,6 +499,11 @@ end_of_layout_definition: total_non_cc_elements = n = i; + av_log(NULL, AV_LOG_DEBUG, "Element order before reorder:\n"); + for (i = 0; i < n; i++) { + log_e2c(i, e2c_vec[i]); + } + if (layout == AV_CH_LAYOUT_22POINT2 && tags == 16 && total_non_cc_elements == 16) { // For 22.2 reorder the result as needed @@ -510,6 +531,11 @@ end_of_layout_definition: } + av_log(NULL, AV_LOG_DEBUG, "Element order after reorder:\n"); + for (i = 0; i < total_non_cc_elements; i++) { + log_e2c(i, e2c_vec[i]); + } + for (i = 0; i < total_non_cc_elements; i++) { layout_map[i][0] = e2c_vec[i].syn_ele; layout_map[i][1] = e2c_vec[i].elem_id;