[FFmpeg-cvslog] lavu/tx: generalize single-factor transforms

Lynne git at videolan.org
Thu Nov 24 16:59:12 EET 2022


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Sat Sep 24 06:49:16 2022 +0200| [45bd4bf79f9b69ac4cec1bd00c433407b3aa7ae4] | committer: Lynne

lavu/tx: generalize single-factor transforms

Not that useful, but it gives us fast small odd-length transforms.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=45bd4bf79f9b69ac4cec1bd00c433407b3aa7ae4
---

 libavutil/tx.c          |  4 ++--
 libavutil/tx_priv.h     |  2 +-
 libavutil/tx_template.c | 46 +++++++++++++++++++++++-----------------------
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/libavutil/tx.c b/libavutil/tx.c
index 556fcbb94b..246a7aa980 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -121,9 +121,9 @@ int ff_tx_gen_ptwo_revtab(AVTXContext *s, int invert_lookup)
     return 0;
 }
 
-int ff_tx_gen_ptwo_inplace_revtab_idx(AVTXContext *s)
+int ff_tx_gen_inplace_map(AVTXContext *s, int len)
 {
-    int *src_map, out_map_idx = 0, len = s->len;
+    int *src_map, out_map_idx = 0;
 
     if (!s->sub || !s->sub->map)
         return AVERROR(EINVAL);
diff --git a/libavutil/tx_priv.h b/libavutil/tx_priv.h
index fb61119009..56e78631ba 100644
--- a/libavutil/tx_priv.h
+++ b/libavutil/tx_priv.h
@@ -259,7 +259,7 @@ int ff_tx_gen_ptwo_revtab(AVTXContext *s, int invert_lookup);
  * specific order, allows the revtab to be done in-place. The sub-transform
  * and its map should already be initialized.
  */
-int ff_tx_gen_ptwo_inplace_revtab_idx(AVTXContext *s);
+int ff_tx_gen_inplace_map(AVTXContext *s, int len);
 
 /*
  * This generates a parity-based revtab of length len and direction inv.
diff --git a/libavutil/tx_template.c b/libavutil/tx_template.c
index 6c8d0a1ebc..b547800447 100644
--- a/libavutil/tx_template.c
+++ b/libavutil/tx_template.c
@@ -650,12 +650,12 @@ DECL_SR_CODELET(32768,16384,8192)
 DECL_SR_CODELET(65536,32768,16384)
 DECL_SR_CODELET(131072,65536,32768)
 
-static av_cold int TX_NAME(ff_tx_fft_sr_init)(AVTXContext *s,
-                                              const FFTXCodelet *cd,
-                                              uint64_t flags,
-                                              FFTXCodeletOptions *opts,
-                                              int len, int inv,
-                                              const void *scale)
+static av_cold int TX_NAME(ff_tx_fft_init)(AVTXContext *s,
+                                           const FFTXCodelet *cd,
+                                           uint64_t flags,
+                                           FFTXCodeletOptions *opts,
+                                           int len, int inv,
+                                           const void *scale)
 {
     int ret;
     int is_inplace = !!(flags & AV_TX_INPLACE);
@@ -668,14 +668,14 @@ static av_cold int TX_NAME(ff_tx_fft_sr_init)(AVTXContext *s,
     if ((ret = ff_tx_init_subtx(s, TX_TYPE(FFT), flags, &sub_opts, len, inv, scale)))
         return ret;
 
-    if (is_inplace && (ret = ff_tx_gen_ptwo_inplace_revtab_idx(s)))
+    if (is_inplace && (ret = ff_tx_gen_inplace_map(s, len)))
         return ret;
 
     return 0;
 }
 
-static void TX_NAME(ff_tx_fft_sr)(AVTXContext *s, void *_dst,
-                                  void *_src, ptrdiff_t stride)
+static void TX_NAME(ff_tx_fft)(AVTXContext *s, void *_dst,
+                               void *_src, ptrdiff_t stride)
 {
     TXComplex *src = _src;
     TXComplex *dst = _dst;
@@ -690,8 +690,8 @@ static void TX_NAME(ff_tx_fft_sr)(AVTXContext *s, void *_dst,
     s->fn[0](&s->sub[0], dst, dst, stride);
 }
 
-static void TX_NAME(ff_tx_fft_sr_inplace)(AVTXContext *s, void *_dst,
-                                          void *_src, ptrdiff_t stride)
+static void TX_NAME(ff_tx_fft_inplace)(AVTXContext *s, void *_dst,
+                                       void *_src, ptrdiff_t stride)
 {
     TXComplex *dst = _dst;
     TXComplex tmp;
@@ -713,28 +713,28 @@ static void TX_NAME(ff_tx_fft_sr_inplace)(AVTXContext *s, void *_dst,
     s->fn[0](&s->sub[0], dst, dst, stride);
 }
 
-static const FFTXCodelet TX_NAME(ff_tx_fft_sr_def) = {
-    .name       = TX_NAME_STR("fft_sr"),
-    .function   = TX_NAME(ff_tx_fft_sr),
+static const FFTXCodelet TX_NAME(ff_tx_fft_def) = {
+    .name       = TX_NAME_STR("fft"),
+    .function   = TX_NAME(ff_tx_fft),
     .type       = TX_TYPE(FFT),
     .flags      = AV_TX_UNALIGNED | FF_TX_OUT_OF_PLACE,
-    .factors[0] = 2,
+    .factors[0] = TX_FACTOR_ANY,
     .min_len    = 2,
     .max_len    = TX_LEN_UNLIMITED,
-    .init       = TX_NAME(ff_tx_fft_sr_init),
+    .init       = TX_NAME(ff_tx_fft_init),
     .cpu_flags  = FF_TX_CPU_FLAGS_ALL,
     .prio       = FF_TX_PRIO_BASE,
 };
 
-static const FFTXCodelet TX_NAME(ff_tx_fft_sr_inplace_def) = {
-    .name       = TX_NAME_STR("fft_sr_inplace"),
-    .function   = TX_NAME(ff_tx_fft_sr_inplace),
+static const FFTXCodelet TX_NAME(ff_tx_fft_inplace_def) = {
+    .name       = TX_NAME_STR("fft_inplace"),
+    .function   = TX_NAME(ff_tx_fft_inplace),
     .type       = TX_TYPE(FFT),
     .flags      = AV_TX_UNALIGNED | AV_TX_INPLACE,
-    .factors[0] = 2,
+    .factors[0] = TX_FACTOR_ANY,
     .min_len    = 2,
     .max_len    = TX_LEN_UNLIMITED,
-    .init       = TX_NAME(ff_tx_fft_sr_init),
+    .init       = TX_NAME(ff_tx_fft_init),
     .cpu_flags  = FF_TX_CPU_FLAGS_ALL,
     .prio       = FF_TX_PRIO_BASE,
 };
@@ -1484,8 +1484,8 @@ const FFTXCodelet * const TX_NAME(ff_tx_codelet_list)[] = {
     &TX_NAME(ff_tx_fft131072_ns_def),
 
     /* Standalone transforms */
-    &TX_NAME(ff_tx_fft_sr_def),
-    &TX_NAME(ff_tx_fft_sr_inplace_def),
+    &TX_NAME(ff_tx_fft_def),
+    &TX_NAME(ff_tx_fft_inplace_def),
     &TX_NAME(ff_tx_fft_pfa_3xM_def),
     &TX_NAME(ff_tx_fft_pfa_5xM_def),
     &TX_NAME(ff_tx_fft_pfa_7xM_def),



More information about the ffmpeg-cvslog mailing list