diff options
author | Lynne <dev@lynne.ee> | 2021-02-27 04:11:04 +0100 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2021-02-27 04:21:05 +0100 |
commit | 8e94b7cff03539bcb4c360d2550a031a5378df03 (patch) | |
tree | d22c567906393c503244f1d43caa4d9c500528fe /libavutil/tx.c | |
parent | 9ddaf0c9f06fab9194161425a32615c4cfc2ec20 (diff) | |
download | ffmpeg-8e94b7cff03539bcb4c360d2550a031a5378df03.tar.gz |
lavu/tx: invert permutation lookups
out[lut[i]] = in[i] lookups were 4.04 times(!) slower than
out[i] = in[lut[i]] lookups for an out-of-place FFT of length 4096.
The permutes remain unchanged for anything but out-of-place monolithic
FFT, as those benefit quite a lot from the current order (it means
there's only 1 lookup necessary to add to an offset, rather than
a full gather).
The code was based around non-power-of-two FFTs, so this wasn't
benchmarked early on.
Diffstat (limited to 'libavutil/tx.c')
-rw-r--r-- | libavutil/tx.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavutil/tx.c b/libavutil/tx.c index ac67b354be..1161df3285 100644 --- a/libavutil/tx.c +++ b/libavutil/tx.c @@ -91,7 +91,7 @@ int ff_tx_gen_compound_mapping(AVTXContext *s) return 0; } -int ff_tx_gen_ptwo_revtab(AVTXContext *s) +int ff_tx_gen_ptwo_revtab(AVTXContext *s, int invert_lookup) { const int m = s->m, inv = s->inv; @@ -101,7 +101,10 @@ int ff_tx_gen_ptwo_revtab(AVTXContext *s) /* Default */ for (int i = 0; i < m; i++) { int k = -split_radix_permutation(i, m, inv) & (m - 1); - s->revtab[k] = i; + if (invert_lookup) + s->revtab[i] = k; + else + s->revtab[k] = i; } return 0; |