From patchwork Sat Jun 15 05:57:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: asivery X-Patchwork-Id: 49923 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9196:0:b0:460:55fa:d5ed with SMTP id s22csp798713vqg; Fri, 14 Jun 2024 22:57:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWkSWGmK/l2cX7DkRoMIjsINu9xCG+aEEqD8HI2NQ8prTrHSrT8Sz+MWTD5uNVIi+zi1JYxd/rRj9IIa8hhitGkfauDL+Kp4fx4Ng== X-Google-Smtp-Source: AGHT+IGKUiCHUCfGYMNjaDmv7A9BygrNAva7/u4ytR1oNewwVzHJ9ihHY0qJgT4p2GpJ3TVMapmN X-Received: by 2002:a2e:a172:0:b0:2ea:78e5:f57c with SMTP id 38308e7fff4ca-2ec0e5c6d5emr42958981fa.19.1718431042944; Fri, 14 Jun 2024 22:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718431042; cv=none; d=google.com; s=arc-20160816; b=SKeawg+cLLPs718snMKYQ4fxTbPsWM9TXKqXYqPOQtTi/F8O6PnkXlN2MBijlAzkNY Yu64pQDmCVryDSjYsXqnoRW/T4fsbERnMgPf62ZFNaQebqrA83LIHDXtZqeIEsAEBKKp hN+K2ld84IgI0gFw+83DXbWGyzAca/QZsIct+8sqPAWpA1ou//ggocBYjK7DAoRVk2Kz jLf5KH2oqO7Q8cCw7uRtLBfYYwIifKuSMltqr14fDfcdISr+W16UL+e5URYGmY+BuGX4 AE+S3pLGDTwcPpjbIQ1SXTzul9oHKY8vGpewkfc5KBNX+n7X/L6KPTOvCurEvkU29hIU 79GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:feedback-id:message-id:to:date:delivered-to; bh=dvPowzzbYps/1AabTdzGpaVzE7e76IsBI7zDW3R+SII=; fh=u80yT+qzWs2ja31JaF27zBvuVs1fHfNU0TDICwejBHk=; b=kytXwMY+Q9IgjDjYGvpiPN80lufgArZeKJ7IpzO8GVAqwCevgy0gY6qGh0xXvfBcFw 6AMNY1Tdwh+n3UfzkBPSHQmMBRnLIw6ndY2yEdLCeVyaoWjRwLXW41/ORMBbewBcFu2y T1N0LPjb2hTt1cWTzPzK8pMeLX1IK5dqnWZdASJBMVmpeWexctlXWTrw4T/DMRR4HzBf PjBJHb11we0Or9WxSJQXhsnoO5NQ2d/cv10ek+P4twUZ7kVJiSEaAK/+jZLUOoFn4N8/ W5OGZit69XiGsZziHV/imH6liu/3PULV3KAeX1BLGEeOHpCmWGK+FDG7NoRMNs7ZMaik AMMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-57cb742c3f5si2555297a12.299.2024.06.14.22.57.22; Fri, 14 Jun 2024 22:57:22 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D2B6068D282; Sat, 15 Jun 2024 08:57:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-40138.protonmail.ch (mail-40138.protonmail.ch [185.70.40.138]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A8BB968D282 for ; Sat, 15 Jun 2024 08:57:11 +0300 (EEST) Date: Sat, 15 Jun 2024 05:57:05 +0000 To: FFmpeg development discussions and patches Message-ID: Feedback-ID: 33509725:user:proton X-Pm-Message-ID: 494eec1de1c37d193a9e1c8d9696f0cc1ad1a5e5 MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] [PATCH] avformat/aeadec, avcodec/atrac1: Fix 8 and 4-channel ATRAC1 support 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: , X-Patchwork-Original-From: asivery via ffmpeg-devel From: asivery Reply-To: FFmpeg development discussions and patches Cc: asivery Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: aOLmL21DInLg Right now both the ATRAC1 decoder implementation, and the AEA demuxer don't accept 4-track and 8-track ATRAC data. This patch fixes that problem. From c42e05855a018e28159bf29b49137bb33f5e45fd Mon Sep 17 00:00:00 2001 From: asivery Date: Sat, 15 Jun 2024 07:47:40 +0200 Subject: [PATCH] avformat/aeadec, avcodec/atrac1: Fix 8 and 4-channel ATRAC1 support Signed-off-by: asivery --- libavcodec/atrac1.c | 12 ++++++------ libavformat/aeadec.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c index cdcc7a669e..448bdfc7e9 100644 --- a/libavcodec/atrac1.c +++ b/libavcodec/atrac1.c @@ -49,7 +49,7 @@ #define AT1_SU_SAMPLES 512 ///< number of samples in a sound unit #define AT1_FRAME_SIZE AT1_SU_SIZE * 2 #define AT1_SU_MAX_BITS AT1_SU_SIZE * 8 -#define AT1_MAX_CHANNELS 2 +#define AT1_MAX_CHANNELS 8 #define AT1_QMF_BANDS 3 #define IDX_LOW_BAND 0 @@ -339,7 +339,7 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx) AVFloatDSPContext *fdsp; int channels = avctx->ch_layout.nb_channels; float scale = -1.0 / (1 << 15); - int ret; + int ret, ch; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; @@ -380,10 +380,10 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx) q->bands[2] = q->high; /* Prepare the mdct overlap buffers */ - q->SUs[0].spectrum[0] = q->SUs[0].spec1; - q->SUs[0].spectrum[1] = q->SUs[0].spec2; - q->SUs[1].spectrum[0] = q->SUs[1].spec1; - q->SUs[1].spectrum[1] = q->SUs[1].spec2; + for (ch = 0; ch < AT1_MAX_CHANNELS; ch++) { + q->SUs[ch].spectrum[0] = q->SUs[ch].spec1; + q->SUs[ch].spectrum[1] = q->SUs[ch].spec2; + } return 0; } diff --git a/libavformat/aeadec.c b/libavformat/aeadec.c index be18e7b725..0a3d09a89d 100644 --- a/libavformat/aeadec.c +++ b/libavformat/aeadec.c @@ -84,7 +84,7 @@ static int aea_read_header(AVFormatContext *s) st->codecpar->sample_rate = 44100; st->codecpar->bit_rate = 146000 * channels; - if (channels != 1 && channels != 2) { + if (channels < 1 || channels > 8) { av_log(s, AV_LOG_ERROR, "Channels %d not supported!\n", channels); return AVERROR_INVALIDDATA; } -- 2.34.1