You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-11-23 21:54:53 +02:00
atrac1: convert to lavu/tx
This commit is contained in:
2
configure
vendored
2
configure
vendored
@@ -2791,7 +2791,7 @@ asv1_decoder_select="blockdsp bswapdsp idctdsp"
|
|||||||
asv1_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
|
asv1_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
|
||||||
asv2_decoder_select="blockdsp bswapdsp idctdsp"
|
asv2_decoder_select="blockdsp bswapdsp idctdsp"
|
||||||
asv2_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
|
asv2_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
|
||||||
atrac1_decoder_select="mdct sinewin"
|
atrac1_decoder_select="sinewin"
|
||||||
atrac3_decoder_select="mdct"
|
atrac3_decoder_select="mdct"
|
||||||
atrac3al_decoder_select="mdct"
|
atrac3al_decoder_select="mdct"
|
||||||
atrac3p_decoder_select="mdct sinewin"
|
atrac3p_decoder_select="mdct sinewin"
|
||||||
|
|||||||
@@ -32,12 +32,12 @@
|
|||||||
|
|
||||||
#include "libavutil/float_dsp.h"
|
#include "libavutil/float_dsp.h"
|
||||||
#include "libavutil/mem_internal.h"
|
#include "libavutil/mem_internal.h"
|
||||||
|
#include "libavutil/tx.h"
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "codec_internal.h"
|
#include "codec_internal.h"
|
||||||
#include "decode.h"
|
#include "decode.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
#include "fft.h"
|
|
||||||
#include "sinewin.h"
|
#include "sinewin.h"
|
||||||
|
|
||||||
#include "atrac.h"
|
#include "atrac.h"
|
||||||
@@ -80,7 +80,8 @@ typedef struct AT1Ctx {
|
|||||||
DECLARE_ALIGNED(32, float, mid)[256];
|
DECLARE_ALIGNED(32, float, mid)[256];
|
||||||
DECLARE_ALIGNED(32, float, high)[512];
|
DECLARE_ALIGNED(32, float, high)[512];
|
||||||
float* bands[3];
|
float* bands[3];
|
||||||
FFTContext mdct_ctx[3];
|
AVTXContext *mdct_ctx[3];
|
||||||
|
av_tx_fn mdct_fn[3];
|
||||||
void (*vector_fmul_window)(float *dst, const float *src0,
|
void (*vector_fmul_window)(float *dst, const float *src0,
|
||||||
const float *src1, const float *win, int len);
|
const float *src1, const float *win, int len);
|
||||||
} AT1Ctx;
|
} AT1Ctx;
|
||||||
@@ -93,7 +94,8 @@ static const uint8_t mdct_long_nbits[3] = {7, 7, 8};
|
|||||||
static void at1_imdct(AT1Ctx *q, float *spec, float *out, int nbits,
|
static void at1_imdct(AT1Ctx *q, float *spec, float *out, int nbits,
|
||||||
int rev_spec)
|
int rev_spec)
|
||||||
{
|
{
|
||||||
FFTContext* mdct_context = &q->mdct_ctx[nbits - 5 - (nbits > 6)];
|
AVTXContext *mdct_context = q->mdct_ctx[nbits - 5 - (nbits > 6)];
|
||||||
|
av_tx_fn mdct_fn = q->mdct_fn[nbits - 5 - (nbits > 6)];
|
||||||
int transf_size = 1 << nbits;
|
int transf_size = 1 << nbits;
|
||||||
|
|
||||||
if (rev_spec) {
|
if (rev_spec) {
|
||||||
@@ -101,7 +103,7 @@ static void at1_imdct(AT1Ctx *q, float *spec, float *out, int nbits,
|
|||||||
for (i = 0; i < transf_size / 2; i++)
|
for (i = 0; i < transf_size / 2; i++)
|
||||||
FFSWAP(float, spec[i], spec[transf_size - 1 - i]);
|
FFSWAP(float, spec[i], spec[transf_size - 1 - i]);
|
||||||
}
|
}
|
||||||
mdct_context->imdct_half(mdct_context, out, spec);
|
mdct_fn(mdct_context, out, spec, sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -322,9 +324,9 @@ static av_cold int atrac1_decode_end(AVCodecContext * avctx)
|
|||||||
{
|
{
|
||||||
AT1Ctx *q = avctx->priv_data;
|
AT1Ctx *q = avctx->priv_data;
|
||||||
|
|
||||||
ff_mdct_end(&q->mdct_ctx[0]);
|
av_tx_uninit(&q->mdct_ctx[0]);
|
||||||
ff_mdct_end(&q->mdct_ctx[1]);
|
av_tx_uninit(&q->mdct_ctx[1]);
|
||||||
ff_mdct_end(&q->mdct_ctx[2]);
|
av_tx_uninit(&q->mdct_ctx[2]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -335,6 +337,7 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
|
|||||||
AT1Ctx *q = avctx->priv_data;
|
AT1Ctx *q = avctx->priv_data;
|
||||||
AVFloatDSPContext *fdsp;
|
AVFloatDSPContext *fdsp;
|
||||||
int channels = avctx->ch_layout.nb_channels;
|
int channels = avctx->ch_layout.nb_channels;
|
||||||
|
float scale = -1.0 / (1 << 15);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
||||||
@@ -351,12 +354,15 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Init the mdct transforms */
|
/* Init the mdct transforms */
|
||||||
if ((ret = ff_mdct_init(&q->mdct_ctx[0], 6, 1, -1.0/ (1 << 15))) ||
|
if ((ret = av_tx_init(&q->mdct_ctx[0], &q->mdct_fn[0], AV_TX_FLOAT_MDCT,
|
||||||
(ret = ff_mdct_init(&q->mdct_ctx[1], 8, 1, -1.0/ (1 << 15))) ||
|
1, 32, &scale, 0) < 0))
|
||||||
(ret = ff_mdct_init(&q->mdct_ctx[2], 9, 1, -1.0/ (1 << 15)))) {
|
return ret;
|
||||||
av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n");
|
if ((ret = av_tx_init(&q->mdct_ctx[1], &q->mdct_fn[1], AV_TX_FLOAT_MDCT,
|
||||||
|
1, 128, &scale, 0) < 0))
|
||||||
|
return ret;
|
||||||
|
if ((ret = av_tx_init(&q->mdct_ctx[2], &q->mdct_fn[2], AV_TX_FLOAT_MDCT,
|
||||||
|
1, 256, &scale, 0) < 0))
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
ff_init_ff_sine_windows(5);
|
ff_init_ff_sine_windows(5);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user