diff mbox series

[FFmpeg-devel,1/2] avformat/aeadec, avcodec/atrac1: Fix 8 and 4-channel ATRAC1 support

Message ID hK2YvSmkl_TUdaAXbc9eMwThZo3KVpk1rulfTdH0P_jBHv4fX8E3A-TSGlQ1oJRDbuM8jPTCOuQnU35Yg6bk_o-NR9_w_QSudDh_qR5t7Os=@protonmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] avformat/aeadec, avcodec/atrac1: Fix 8 and 4-channel ATRAC1 support | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

asivery July 3, 2024, 2:34 p.m. UTC
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.

Comments

Andreas Rheinhardt July 3, 2024, 2:49 p.m. UTC | #1
asivery via ffmpeg-devel:
> 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.
> 

Why such a gigantic file? And why actually a multi-channel file given
that there are no special coding modes for multi-channel files?

- Andreas
asivery July 3, 2024, 2:56 p.m. UTC | #2
On Sat, 15 Jun 2024 I was asked for samples by Anton Khirnov - this is why I wrote the test.
If the test is not necessary after all, that patch doesn't need to be applied. I can also shorten the test file, if it's required.

On Wednesday, July 3rd, 2024 at 4:49 PM, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote:

> asivery via ffmpeg-devel:
> 
> > 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.
> 
> 
> Why such a gigantic file? And why actually a multi-channel file given
> that there are no special coding modes for multi-channel files?
> 
> - Andreas
> 
> _______________________________________________
> 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".
Anton Khirnov July 5, 2024, 11:08 a.m. UTC | #3
Quoting Andreas Rheinhardt (2024-07-03 16:49:55)
> asivery via ffmpeg-devel:
> > 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.
> > 
> 
> Why such a gigantic file? And why actually a multi-channel file given
> that there are no special coding modes for multi-channel files?

In what world is this gigantic?

I find your obsession with FATE sample sizes to be very
counterproductive. Storage is cheap, developer time is not.
diff mbox series

Patch

From 22b988b046c1a1eb02033416710a3f3244f8859a Mon Sep 17 00:00:00 2001
From: asivery <asivery@protonmail.com>
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 <asivery@protonmail.com>
---
 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