[FFmpeg-cvslog] cookdec: convert to lavu/tx
Lynne
git at videolan.org
Sun Nov 6 15:41:34 EET 2022
ffmpeg | branch: master | Lynne <dev at lynne.ee> | Sat Oct 29 23:03:45 2022 +0200| [1d810b650ceb4ce1bb8d73685b4cb4f03b723da6] | committer: Lynne
cookdec: convert to lavu/tx
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1d810b650ceb4ce1bb8d73685b4cb4f03b723da6
---
configure | 2 +-
libavcodec/cook.c | 15 ++++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/configure b/configure
index 037e86c233..499379a7e4 100755
--- a/configure
+++ b/configure
@@ -2804,7 +2804,7 @@ cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
clearvideo_decoder_select="idctdsp"
cllc_decoder_select="bswapdsp"
comfortnoise_encoder_select="lpc"
-cook_decoder_select="audiodsp mdct sinewin"
+cook_decoder_select="audiodsp sinewin"
cri_decoder_select="mjpeg_decoder"
cscd_decoder_suggest="zlib"
dca_decoder_select="mdct"
diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index 7c666f5cfe..7d05afcca8 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -46,6 +46,7 @@
#include "libavutil/lfg.h"
#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
+#include "libavutil/tx.h"
#include "audiodsp.h"
#include "avcodec.h"
@@ -53,7 +54,6 @@
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
-#include "fft.h"
#include "sinewin.h"
#include "unary.h"
@@ -140,7 +140,8 @@ typedef struct cook {
int discarded_packets;
/* transform data */
- FFTContext mdct_ctx;
+ AVTXContext *mdct_ctx;
+ av_tx_fn mdct_fn;
float* mlt_window;
/* VLC data */
@@ -248,6 +249,7 @@ static av_cold int init_cook_mlt(COOKContext *q)
{
int j, ret;
int mlt_size = q->samples_per_channel;
+ const float scale = 1.0 / 32768.0;
if (!(q->mlt_window = av_malloc_array(mlt_size, sizeof(*q->mlt_window))))
return AVERROR(ENOMEM);
@@ -258,11 +260,10 @@ static av_cold int init_cook_mlt(COOKContext *q)
q->mlt_window[j] *= sqrt(2.0 / q->samples_per_channel);
/* Initialize the MDCT. */
- ret = ff_mdct_init(&q->mdct_ctx, av_log2(mlt_size) + 1, 1, 1.0 / 32768.0);
+ ret = av_tx_init(&q->mdct_ctx, &q->mdct_fn, AV_TX_FLOAT_MDCT,
+ 1, mlt_size, &scale, AV_TX_FULL_IMDCT);
if (ret < 0)
return ret;
- av_log(q->avctx, AV_LOG_DEBUG, "MDCT initialized, order = %d.\n",
- av_log2(mlt_size) + 1);
return 0;
}
@@ -336,7 +337,7 @@ static av_cold int cook_decode_close(AVCodecContext *avctx)
av_freep(&q->decoded_bytes_buffer);
/* Free the transform. */
- ff_mdct_end(&q->mdct_ctx);
+ av_tx_uninit(&q->mdct_ctx);
/* Free the VLC tables. */
for (i = 0; i < 13; i++)
@@ -743,7 +744,7 @@ static void imlt_gain(COOKContext *q, float *inbuffer,
int i;
/* Inverse modified discrete cosine transform */
- q->mdct_ctx.imdct_calc(&q->mdct_ctx, q->mono_mdct_output, inbuffer);
+ q->mdct_fn(q->mdct_ctx, q->mono_mdct_output, inbuffer, sizeof(float));
q->imlt_window(q, buffer1, gains_ptr, previous_buffer);
More information about the ffmpeg-cvslog
mailing list