* [FFmpeg-devel] [PATCH] avformat/aeadec, avcodec/atrac1: Fix 8 and 4-channel ATRAC1 support
@ 2024-06-15 5:57 asivery via ffmpeg-devel
2024-06-26 7:54 ` Anton Khirnov
0 siblings, 1 reply; 2+ messages in thread
From: asivery via ffmpeg-devel @ 2024-06-15 5:57 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: asivery
[-- Attachment #1: Type: text/plain, Size: 145 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-avformat-aea-avcodec-atrac1-fix-8-channel-ATRAC1-sup.patch --]
[-- Type: text/x-patch; name=0001-avformat-aea-avcodec-atrac1-fix-8-channel-ATRAC1-sup.patch, Size: 2178 bytes --]
From c42e05855a018e28159bf29b49137bb33f5e45fd Mon Sep 17 00:00:00 2001
From: asivery <asivery@protonmail.com>
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 <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.34.1
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/aeadec, avcodec/atrac1: Fix 8 and 4-channel ATRAC1 support
2024-06-15 5:57 [FFmpeg-devel] [PATCH] avformat/aeadec, avcodec/atrac1: Fix 8 and 4-channel ATRAC1 support asivery via ffmpeg-devel
@ 2024-06-26 7:54 ` Anton Khirnov
0 siblings, 0 replies; 2+ messages in thread
From: Anton Khirnov @ 2024-06-26 7:54 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: asivery
Quoting asivery via ffmpeg-devel (2024-06-15 07:57:05)
> 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 <asivery@protonmail.com>
> 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 <asivery@protonmail.com>
> ---
> libavcodec/atrac1.c | 12 ++++++------
> libavformat/aeadec.c | 2 +-
> 2 files changed, 7 insertions(+), 7 deletions(-)
Got any samples you can share? A test would be nice.
--
Anton Khirnov
_______________________________________________
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-26 7:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-15 5:57 [FFmpeg-devel] [PATCH] avformat/aeadec, avcodec/atrac1: Fix 8 and 4-channel ATRAC1 support asivery via ffmpeg-devel
2024-06-26 7:54 ` Anton Khirnov
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git