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 CA99844A14 for ; Mon, 31 Oct 2022 20:29:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0CAA568BE04; Mon, 31 Oct 2022 22:29:10 +0200 (EET) Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8F38968BD55 for ; Mon, 31 Oct 2022 22:29:03 +0200 (EET) Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-13ae8117023so14719434fac.9 for ; Mon, 31 Oct 2022 13:29:03 -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=HGgXbOQNEWLkxBCZX5C/+PkmJF+Rv9tAWQmgfnYzHyY=; b=T0cfTf1AOBJcWX2qAA5jEBjmu4BFXMd8SbfOfpHU2daQfAjnGYkR9PtelwHHs/3bDv yUX6tiT7jGWGxP/AfmrCRgo6pYOgvrGklo2NyzoGu2pKQ1zB9cbL2tPw1OGxc7lfMYPs bMIDo72G8cpQcaXJorpSR9+0J/G/slozQSQ/eCZqSyAVucSdTa3EN1D0MHo6SmrWf9cq 4Vt7JmcdvZSKKwgvJwlwgP/edHlXta+GfaUB+2+4gDpi1LgeF8peE6m4ruRPc9qJZ3AB H7Tn7fUJwoiF354HN5NSoPH9QjwrkO5Fz0Fds5Hqc6iMrGFNe84UOnrqhk7vljuDssQi uNlg== 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=HGgXbOQNEWLkxBCZX5C/+PkmJF+Rv9tAWQmgfnYzHyY=; b=kml12AreM3GPBmdvSD2maxWihsnSmEAQeat3BnccuvY45tv9w9whW2Z3alGxR/f7le 9o0++5E3IOSVWwtmEoJVxqB/YTz6/fntQqN3hDdHSWMIP0ClqfiV367LWWLcG+SyfWfy zy7TIv6q4VVeYBYdGKcUQI9VupdvTvPHjZ1qp3oSa+OBGqjgpKRZ6RiwePHOxxw77lW1 6PnC4b1PWpUAr3ALJocy/aROSlfS07MfV0gS9OIZZIgrR4fsJ5QFMTdqYdOkuMQrSAPB kh5lyDOttbxq/hc9FxTED+uIkeivdktMepzxYHEiRvDAFNth6qhCOXxBR1JAkrV6y3/A Gh+A== X-Gm-Message-State: ACrzQf0455wwQMfwFiNy/oYigLMq98TNFrM+tGtxJP7T8NI+IFlHDAtr owhPKYc+fuQdIE/1TYGKQ5bU9wMSTAQ= X-Google-Smtp-Source: AMsMyM4L3VPMTsT2UZbAB6tG7wLjXL06nAOHtfwCmDU8gZyentCwdNpXb+1mpez4iswpd2l2o/b1Kg== X-Received: by 2002:a05:6870:2189:b0:132:ad52:d092 with SMTP id l9-20020a056870218900b00132ad52d092mr2460oae.202.1667248141745; Mon, 31 Oct 2022 13:29:01 -0700 (PDT) Received: from localhost.localdomain ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id e8-20020a544f08000000b00354b575424csm2695007oiy.29.2022.10.31.13.29.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 13:29:01 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 31 Oct 2022 17:28:45 -0300 Message-Id: <20221031202845.1860-1-jamrial@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] avcodec/atrac3plus: reorder channels to match the output 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: The order in which the channels are coded in the bitstream do not always follow the native, bitmask-based order of channels both signaled by the WAV container and forced by this same decoder. This is the case with layouts containing an LFE channel, as it's always coded last. Fixes ticket #9964. Signed-off-by: James Almer --- libavcodec/atrac3plusdec.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libavcodec/atrac3plusdec.c b/libavcodec/atrac3plusdec.c index ee71645a3c..9e12f21930 100644 --- a/libavcodec/atrac3plusdec.c +++ b/libavcodec/atrac3plusdec.c @@ -48,6 +48,17 @@ #include "atrac.h" #include "atrac3plus.h" +static uint8_t channel_map[8][8] = { + { 0, }, + { 0, 1, }, + { 0, 1, 2, }, + { 0, 1, 2, 3, }, + { 0, }, + { 0, 1, 2, 4, 5, 3, }, + { 0, 1, 2, 4, 5, 8, 3, }, + { 0, 1, 2, 4, 5, 9, 10, 3, }, +}; + typedef struct ATRAC3PContext { GetBitContext gb; AVFloatDSPContext *fdsp; @@ -378,7 +389,7 @@ static int atrac3p_decode_frame(AVCodecContext *avctx, AVFrame *frame, channels_to_process, avctx); for (i = 0; i < channels_to_process; i++) - memcpy(samples_p[out_ch_index + i], ctx->outp_buf[i], + memcpy(samples_p[channel_map[frame->ch_layout.nb_channels - 1][out_ch_index + i]], ctx->outp_buf[i], ATRAC3P_FRAME_SAMPLES * sizeof(**samples_p)); ch_block++; -- 2.38.1 _______________________________________________ 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".