diff options
author | Lynne <dev@lynne.ee> | 2021-04-10 03:55:37 +0200 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2021-04-24 17:17:27 +0200 |
commit | 0072a4238817c18e31e1f59cf8ec9a30bdf42a5c (patch) | |
tree | 39b04294b66621fd47abf5437dea5df441df7dcd /libavutil/tx_template.c | |
parent | aa6c757d50ca060cab05c3a822a43563934823a1 (diff) | |
download | ffmpeg-0072a4238817c18e31e1f59cf8ec9a30bdf42a5c.tar.gz |
lavu/tx: add full-sized iMDCT transform flag
Diffstat (limited to 'libavutil/tx_template.c')
-rw-r--r-- | libavutil/tx_template.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/libavutil/tx_template.c b/libavutil/tx_template.c index b3532c1c5e..a68a84dcd5 100644 --- a/libavutil/tx_template.c +++ b/libavutil/tx_template.c @@ -875,6 +875,24 @@ static void naive_mdct(AVTXContext *s, void *_dst, void *_src, } } +static void full_imdct_wrapper_fn(AVTXContext *s, void *_dst, void *_src, + ptrdiff_t stride) +{ + int len = s->m*s->n*4; + int len2 = len >> 1; + int len4 = len >> 2; + FFTSample *dst = _dst; + + s->top_tx(s, dst + len4, _src, stride); + + stride /= sizeof(*dst); + + for (int i = 0; i < len4; i++) { + dst[ i*stride] = -dst[(len2 - i - 1)*stride]; + dst[(len - i - 1)*stride] = dst[(len2 + i + 0)*stride]; + } +} + static int gen_mdct_exptab(AVTXContext *s, int len4, double scale) { const double theta = (scale < 0 ? len4 : 0) + 1.0/8.0; @@ -942,6 +960,10 @@ int TX_NAME(ff_tx_init_mdct_fft)(AVTXContext *s, av_tx_fn *tx, if (is_mdct) { s->scale = *((SCALE_TYPE *)scale); *tx = inv ? naive_imdct : naive_mdct; + if (inv && (flags & AV_TX_FULL_IMDCT)) { + s->top_tx = *tx; + *tx = full_imdct_wrapper_fn; + } } return 0; } @@ -990,8 +1012,13 @@ int TX_NAME(ff_tx_init_mdct_fft)(AVTXContext *s, av_tx_fn *tx, init_cos_tabs(i); } - if (is_mdct) + if (is_mdct) { + if (inv && (flags & AV_TX_FULL_IMDCT)) { + s->top_tx = *tx; + *tx = full_imdct_wrapper_fn; + } return gen_mdct_exptab(s, n*m, *((SCALE_TYPE *)scale)); + } return 0; } |