aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/atrac1.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-10 13:00:28 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-10 13:01:27 +0200
commiteadba3e94daac2f48fd9ce7c9fdf5a562d3274ed (patch)
treee33c21663364927e22ba4a259ff8afb746e06ec6 /libavcodec/atrac1.c
parentb4e516e30e7004a0454a9009080c4de38987189a (diff)
parentcbcd497f384f0f8ef3f76f85b29b644b900d6b9f (diff)
downloadffmpeg-eadba3e94daac2f48fd9ce7c9fdf5a562d3274ed.tar.gz
Merge commit 'cbcd497f384f0f8ef3f76f85b29b644b900d6b9f'
* commit 'cbcd497f384f0f8ef3f76f85b29b644b900d6b9f': adxdec: use planar sample format adpcmdec: use planar sample format for adpcm_thp adpcmdec: use planar sample format for adpcm_ea_xas adpcmdec: use planar sample format for adpcm_ea_r1/r2/r3 adpcmdec: use planar sample format for adpcm_xa adpcmdec: use planar sample format for adpcm_ima_ws for vqa version 3 adpcmdec: use planar sample format for adpcm_4xm adpcmdec: use planar sample format for adpcm_ima_wav adpcmdec: use planar sample format for adpcm_ima_qt pcmdec: use planar sample format for pcm_lxf mace: use planar sample format atrac1: use planar sample format build: non-x86: Only compile mpegvideo optimizations when necessary rtpdec_mpeg4: au_headers is a single array, simple av_free is enough avcodec: free extended_data instead address of it fate: Add tests of the ff_make_absolute_url function url: Handle relative urls starting with two slashes url: Handle relative urls being just a new query string url: Don't treat slashes in query parameters as directory separators Conflicts: libavcodec/adxdec.c libavcodec/mips/Makefile libavcodec/pcm.c libavcodec/utils.c libavformat/Makefile libavformat/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/atrac1.c')
-rw-r--r--libavcodec/atrac1.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c
index 669035d15d..86d371e8c8 100644
--- a/libavcodec/atrac1.c
+++ b/libavcodec/atrac1.c
@@ -36,7 +36,6 @@
#include "get_bits.h"
#include "dsputil.h"
#include "fft.h"
-#include "fmtconvert.h"
#include "sinewin.h"
#include "atrac.h"
@@ -80,11 +79,9 @@ typedef struct {
DECLARE_ALIGNED(32, float, mid)[256];
DECLARE_ALIGNED(32, float, high)[512];
float* bands[3];
- float *out_samples[AT1_MAX_CHANNELS];
FFTContext mdct_ctx[3];
int channels;
DSPContext dsp;
- FmtConvertContext fmt_conv;
} AT1Ctx;
/** size of the transform in samples in the long mode for each QMF band */
@@ -281,7 +278,6 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
AT1Ctx *q = avctx->priv_data;
int ch, ret;
GetBitContext gb;
- float *samples;
if (buf_size < 212 * q->channels) {
@@ -295,7 +291,6 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples = (float *)q->frame.data[0];
for (ch = 0; ch < q->channels; ch++) {
AT1SUCtx* su = &q->SUs[ch];
@@ -314,13 +309,7 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
ret = at1_imdct_block(su, q);
if (ret < 0)
return ret;
- at1_subband_synthesis(q, su, q->channels == 1 ? samples : q->out_samples[ch]);
- }
-
- /* interleave */
- if (q->channels == 2) {
- q->fmt_conv.float_interleave(samples, (const float **)q->out_samples,
- AT1_SU_SAMPLES, 2);
+ at1_subband_synthesis(q, su, (float *)q->frame.extended_data[ch]);
}
*got_frame_ptr = 1;
@@ -334,8 +323,6 @@ static av_cold int atrac1_decode_end(AVCodecContext * avctx)
{
AT1Ctx *q = avctx->priv_data;
- av_freep(&q->out_samples[0]);
-
ff_mdct_end(&q->mdct_ctx[0]);
ff_mdct_end(&q->mdct_ctx[1]);
ff_mdct_end(&q->mdct_ctx[2]);
@@ -349,7 +336,7 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
AT1Ctx *q = avctx->priv_data;
int ret;
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
if (avctx->channels < 1 || avctx->channels > AT1_MAX_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n",
@@ -358,15 +345,6 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
}
q->channels = avctx->channels;
- if (avctx->channels == 2) {
- q->out_samples[0] = av_malloc(2 * AT1_SU_SAMPLES * sizeof(*q->out_samples[0]));
- q->out_samples[1] = q->out_samples[0] + AT1_SU_SAMPLES;
- if (!q->out_samples[0]) {
- av_freep(&q->out_samples[0]);
- return AVERROR(ENOMEM);
- }
- }
-
/* Init the mdct transforms */
if ((ret = ff_mdct_init(&q->mdct_ctx[0], 6, 1, -1.0/ (1 << 15))) ||
(ret = ff_mdct_init(&q->mdct_ctx[1], 8, 1, -1.0/ (1 << 15))) ||
@@ -381,7 +359,6 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
ff_atrac_generate_tables();
ff_dsputil_init(&q->dsp, avctx);
- ff_fmt_convert_init(&q->fmt_conv, avctx);
q->bands[0] = q->low;
q->bands[1] = q->mid;
@@ -410,4 +387,6 @@ AVCodec ff_atrac1_decoder = {
.decode = atrac1_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Atrac 1 (Adaptive TRansform Acoustic Coding)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
};