From patchwork Wed Jul 3 14:34:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: asivery X-Patchwork-Id: 50304 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp3129968vqv; Wed, 3 Jul 2024 07:35:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWsJh4zSNWDVfE3OzlhY0TCxvYUS/FGgkT301rixPTPWvrj2tbG4SQJJnzsUykC7hyPvvHFTwVjIw/g+XfQSzSuINTgGEINHO0QNg== X-Google-Smtp-Source: AGHT+IHrldcuOo4QDYajYKw710xysZmVMTGWxS5nZN6xaIJJSoY9OD74drFw0OkxWKkaxVEWq2Pl X-Received: by 2002:a05:6512:3a95:b0:52c:d67a:3953 with SMTP id 2adb3069b0e04-52e8273ef8fmr7503577e87.58.1720017306766; Wed, 03 Jul 2024 07:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720017305; cv=none; d=google.com; s=arc-20160816; b=hUSHnHvvv/gK18Hjxf1+DgwO1OEv0kaH7h1SGI/4tWIvq/TShFRHCQYVqm3kTrKA+F 4AeG9DeWYCD6FYn/f96FC/cqEMjzPUZIowtUn29UyyzLn/DXJIspveAKZITX+lVcDXOF v1w7iB2XGOuOjXzAYkKxwuWdu0G8Oa+ZiIBB27zf+KWjdUYAWYgjZekWgr6aBwo6OOJj UWMNHCGGBMF9meG84sr/5K6Zeu/+J4LwFtfzYoYecDnNVXUesY2XMAZzPU7F73rSEr0K A4XAgy4LMrc1dC1DBQB3wpDUWDxMaon0LcM15wsr2MjXyqlgt0YtaWjinnbApqKAywLC Vgkw== 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=UWaTDx6MSpDTcseVlfV542kRWsKIY603upGz49/DJ/Y=; fh=u80yT+qzWs2ja31JaF27zBvuVs1fHfNU0TDICwejBHk=; b=yUwHzZOG4jiE0eHFLxSWFRA5gFBS3hoFT3SE8fR48qQJh/wxbNsT/WTIvHvefKsiP5 5FLzN+p7ERQs2FPnBF65bX+YEXGi5EqnYmstwBQMy2+azjhq+aIDWmxLHqXifLL50v9Q uvt8X3OPC7gZAdlDxLS5SEAPGDaahKvLW1wIGzXSDgFGpcgV2IglixhB5t6zAOXD+yPb BUn9915KoP4vT0qdO6ciw5YCxWSTrNzJAxSVBMUjd43SQRfjLGPHWjUVke2k5YbROxtg N5maOP9c+dAWLomIsoKFaAKd2TvOA3M/IUM5e9WbmpHZZUnzyJcNr6+zMqw+tpccbx3X 0Q/A==; 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 2adb3069b0e04-52e935f5777si729139e87.462.2024.07.03.07.35.05; Wed, 03 Jul 2024 07:35:05 -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 1DC8168D90B; Wed, 3 Jul 2024 17:35:01 +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 EA20368D8FD for ; Wed, 3 Jul 2024 17:34:53 +0300 (EEST) Date: Wed, 03 Jul 2024 14:34:41 +0000 To: FFmpeg development discussions and patches Message-ID: Feedback-ID: 33509725:user:proton X-Pm-Message-ID: c4af8e294fbebe355feb86de28b5d2085a4742f2 MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] [PATCH 1/2] 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: 6LNVkxpO3vqA I'm sending the patch again, so that it is correctly rebased on the current master. Here are the two sample files required by the FATE test: https://0x0.st/Xaw2.aea/boxboy333_house_music_multitrack.aea https://0x0.st/Xaw_.pcm/boxboy333_house_music_multitrack.pcm Please let me know if I need to provide anything else. From 22b988b046c1a1eb02033416710a3f3244f8859a Mon Sep 17 00:00:00 2001 From: asivery Date: Wed, 3 Jul 2024 16:24:41 +0200 Subject: [PATCH 1/2] 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.45.2