mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-05 22:40:09 +01:00
avformat/aeadec, avcodec/atrac1: Fix 8 and 4-channel ATRAC1 support
Signed-off-by: asivery <asivery@protonmail.com> (cherry picked from commit 81cdf42222961c2959f1ede2d86fea0d1dcbbfcb)
This commit is contained in:
@@ -49,7 +49,7 @@
|
|||||||
#define AT1_SU_SAMPLES 512 ///< number of samples in a sound unit
|
#define AT1_SU_SAMPLES 512 ///< number of samples in a sound unit
|
||||||
#define AT1_FRAME_SIZE AT1_SU_SIZE * 2
|
#define AT1_FRAME_SIZE AT1_SU_SIZE * 2
|
||||||
#define AT1_SU_MAX_BITS AT1_SU_SIZE * 8
|
#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 AT1_QMF_BANDS 3
|
||||||
#define IDX_LOW_BAND 0
|
#define IDX_LOW_BAND 0
|
||||||
@@ -339,7 +339,7 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
|
|||||||
AVFloatDSPContext *fdsp;
|
AVFloatDSPContext *fdsp;
|
||||||
int channels = avctx->ch_layout.nb_channels;
|
int channels = avctx->ch_layout.nb_channels;
|
||||||
float scale = -1.0 / (1 << 15);
|
float scale = -1.0 / (1 << 15);
|
||||||
int ret;
|
int ret, ch;
|
||||||
|
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
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;
|
q->bands[2] = q->high;
|
||||||
|
|
||||||
/* Prepare the mdct overlap buffers */
|
/* Prepare the mdct overlap buffers */
|
||||||
q->SUs[0].spectrum[0] = q->SUs[0].spec1;
|
for (ch = 0; ch < AT1_MAX_CHANNELS; ch++) {
|
||||||
q->SUs[0].spectrum[1] = q->SUs[0].spec2;
|
q->SUs[ch].spectrum[0] = q->SUs[ch].spec1;
|
||||||
q->SUs[1].spectrum[0] = q->SUs[1].spec1;
|
q->SUs[ch].spectrum[1] = q->SUs[ch].spec2;
|
||||||
q->SUs[1].spectrum[1] = q->SUs[1].spec2;
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ static int aea_read_header(AVFormatContext *s)
|
|||||||
st->codecpar->sample_rate = 44100;
|
st->codecpar->sample_rate = 44100;
|
||||||
st->codecpar->bit_rate = 146000 * channels;
|
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);
|
av_log(s, AV_LOG_ERROR, "Channels %d not supported!\n", channels);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user