1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

lavu/tx: support out-of-place transforms in fft_inplace

This makes testing easier, as a unified path can be used for in/out of
place transforms.
This commit is contained in:
Lynne
2022-11-17 20:06:43 +01:00
parent d260796f11
commit fff3e1d848

View File

@@ -773,6 +773,7 @@ static void TX_NAME(ff_tx_fft)(AVTXContext *s, void *_dst,
static void TX_NAME(ff_tx_fft_inplace)(AVTXContext *s, void *_dst, static void TX_NAME(ff_tx_fft_inplace)(AVTXContext *s, void *_dst,
void *_src, ptrdiff_t stride) void *_src, ptrdiff_t stride)
{ {
TXComplex *src = _src;
TXComplex *dst = _dst; TXComplex *dst = _dst;
TXComplex tmp; TXComplex tmp;
const int *map = s->sub->map; const int *map = s->sub->map;
@@ -781,16 +782,16 @@ static void TX_NAME(ff_tx_fft_inplace)(AVTXContext *s, void *_dst,
src_idx = *inplace_idx++; src_idx = *inplace_idx++;
do { do {
tmp = dst[src_idx]; tmp = src[src_idx];
dst_idx = map[src_idx]; dst_idx = map[src_idx];
do { do {
FFSWAP(TXComplex, tmp, dst[dst_idx]); FFSWAP(TXComplex, tmp, src[dst_idx]);
dst_idx = map[dst_idx]; dst_idx = map[dst_idx];
} while (dst_idx != src_idx); /* Can be > as well, but was less predictable */ } while (dst_idx != src_idx); /* Can be > as well, but was less predictable */
dst[dst_idx] = tmp; src[dst_idx] = tmp;
} while ((src_idx = *inplace_idx++)); } while ((src_idx = *inplace_idx++));
s->fn[0](&s->sub[0], dst, dst, stride); s->fn[0](&s->sub[0], dst, src, stride);
} }
static const FFTXCodelet TX_NAME(ff_tx_fft_def) = { static const FFTXCodelet TX_NAME(ff_tx_fft_def) = {
@@ -810,13 +811,13 @@ static const FFTXCodelet TX_NAME(ff_tx_fft_inplace_def) = {
.name = TX_NAME_STR("fft_inplace"), .name = TX_NAME_STR("fft_inplace"),
.function = TX_NAME(ff_tx_fft_inplace), .function = TX_NAME(ff_tx_fft_inplace),
.type = TX_TYPE(FFT), .type = TX_TYPE(FFT),
.flags = AV_TX_UNALIGNED | AV_TX_INPLACE, .flags = AV_TX_UNALIGNED | FF_TX_OUT_OF_PLACE | AV_TX_INPLACE,
.factors[0] = TX_FACTOR_ANY, .factors[0] = TX_FACTOR_ANY,
.min_len = 2, .min_len = 2,
.max_len = TX_LEN_UNLIMITED, .max_len = TX_LEN_UNLIMITED,
.init = TX_NAME(ff_tx_fft_init), .init = TX_NAME(ff_tx_fft_init),
.cpu_flags = FF_TX_CPU_FLAGS_ALL, .cpu_flags = FF_TX_CPU_FLAGS_ALL,
.prio = FF_TX_PRIO_BASE, .prio = FF_TX_PRIO_BASE - 512,
}; };
static av_cold int TX_NAME(ff_tx_fft_init_naive_small)(AVTXContext *s, static av_cold int TX_NAME(ff_tx_fft_init_naive_small)(AVTXContext *s,