1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-05-13 21:26:33 +02:00

atrac3: convert to lavu/tx

This commit is contained in:
Lynne 2022-11-01 09:09:35 +01:00
parent 5f52094f3d
commit b59e6b5d99
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
2 changed files with 8 additions and 7 deletions

2
configure vendored
View File

@ -2792,8 +2792,6 @@ 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="sinewin" atrac1_decoder_select="sinewin"
atrac3_decoder_select="mdct"
atrac3al_decoder_select="mdct"
atrac3p_decoder_select="mdct sinewin" atrac3p_decoder_select="mdct sinewin"
atrac3pal_decoder_select="mdct sinewin" atrac3pal_decoder_select="mdct sinewin"
av1_decoder_select="av1_frame_split_bsf cbs_av1" av1_decoder_select="av1_frame_split_bsf cbs_av1"

View File

@ -40,12 +40,12 @@
#include "libavutil/libm.h" #include "libavutil/libm.h"
#include "libavutil/mem_internal.h" #include "libavutil/mem_internal.h"
#include "libavutil/thread.h" #include "libavutil/thread.h"
#include "libavutil/tx.h"
#include "avcodec.h" #include "avcodec.h"
#include "bytestream.h" #include "bytestream.h"
#include "codec_internal.h" #include "codec_internal.h"
#include "decode.h" #include "decode.h"
#include "fft.h"
#include "get_bits.h" #include "get_bits.h"
#include "atrac.h" #include "atrac.h"
@ -115,7 +115,8 @@ typedef struct ATRAC3Context {
//@} //@}
AtracGCContext gainc_ctx; AtracGCContext gainc_ctx;
FFTContext mdct_ctx; AVTXContext *mdct_ctx;
av_tx_fn mdct_fn;
void (*vector_fmul)(float *dst, const float *src0, const float *src1, void (*vector_fmul)(float *dst, const float *src0, const float *src1,
int len); int len);
} ATRAC3Context; } ATRAC3Context;
@ -147,7 +148,7 @@ static void imlt(ATRAC3Context *q, float *input, float *output, int odd_band)
FFSWAP(float, input[i], input[255 - i]); FFSWAP(float, input[i], input[255 - i]);
} }
q->mdct_ctx.imdct_calc(&q->mdct_ctx, output, input); q->mdct_fn(q->mdct_ctx, output, input, sizeof(float));
/* Perform windowing on the output. */ /* Perform windowing on the output. */
q->vector_fmul(output, output, mdct_window, MDCT_SIZE); q->vector_fmul(output, output, mdct_window, MDCT_SIZE);
@ -201,7 +202,7 @@ static av_cold int atrac3_decode_close(AVCodecContext *avctx)
av_freep(&q->units); av_freep(&q->units);
av_freep(&q->decoded_bytes_buffer); av_freep(&q->decoded_bytes_buffer);
ff_mdct_end(&q->mdct_ctx); av_tx_uninit(&q->mdct_ctx);
return 0; return 0;
} }
@ -879,6 +880,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
const uint8_t *edata_ptr = avctx->extradata; const uint8_t *edata_ptr = avctx->extradata;
ATRAC3Context *q = avctx->priv_data; ATRAC3Context *q = avctx->priv_data;
AVFloatDSPContext *fdsp; AVFloatDSPContext *fdsp;
float scale = 1.0 / 32768;
int channels = avctx->ch_layout.nb_channels; int channels = avctx->ch_layout.nb_channels;
if (channels < MIN_CHANNELS || channels > MAX_CHANNELS) { if (channels < MIN_CHANNELS || channels > MAX_CHANNELS) {
@ -977,7 +979,8 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
/* initialize the MDCT transform */ /* initialize the MDCT transform */
if ((ret = ff_mdct_init(&q->mdct_ctx, 9, 1, 1.0 / 32768)) < 0) { if ((ret = av_tx_init(&q->mdct_ctx, &q->mdct_fn, AV_TX_FLOAT_MDCT, 1, 256,
&scale, AV_TX_FULL_IMDCT)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n"); av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n");
return ret; return ret;
} }