lavu/tx: refactor assembly codelet definition

This commit does some refactoring to make defining assembly codelets
smaller, and fixes compiler redefinition warnings. It also allows
for other assembly versions to reuse the same boilerplate code as
x86.

Finally, it also adds the out_of_place flag to all assembly codelets.
This changes nothing, as out-of-place operation was assumed to be
available anyway, but this makes it more explicit.
This commit is contained in:
Lynne
2022-02-07 03:30:27 +01:00
parent a10f1aec1f
commit 3bbe9c5e38
2 changed files with 71 additions and 93 deletions
+24
View File
@@ -29,6 +29,8 @@
#define TX_NAME(x) x ## _float_c
#define TX_NAME_STR(x) x "_float_c"
#define TX_TYPE(x) AV_TX_FLOAT_ ## x
#define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _float_ ## suffix
#define TX_FN_NAME_STR(fn, suffix) #fn "_float_" #suffix
#define MULT(x, m) ((x) * (m))
#define SCALE_TYPE float
typedef float TXSample;
@@ -38,6 +40,8 @@ typedef AVComplexFloat TXComplex;
#define TX_NAME(x) x ## _double_c
#define TX_NAME_STR(x) x "_double_c"
#define TX_TYPE(x) AV_TX_DOUBLE_ ## x
#define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _double_ ## suffix
#define TX_FN_NAME_STR(fn, suffix) #fn "_double_" #suffix
#define MULT(x, m) ((x) * (m))
#define SCALE_TYPE double
typedef double TXSample;
@@ -47,6 +51,8 @@ typedef AVComplexDouble TXComplex;
#define TX_NAME(x) x ## _int32_c
#define TX_NAME_STR(x) x "_int32_c"
#define TX_TYPE(x) AV_TX_INT32_ ## x
#define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _int32_ ## suffix
#define TX_FN_NAME_STR(fn, suffix) #fn "_int32_" #suffix
#define MULT(x, m) (((((int64_t)(x)) * (int64_t)(m)) + 0x40000000) >> 31)
#define SCALE_TYPE float
typedef int32_t TXSample;
@@ -55,6 +61,24 @@ typedef AVComplexInt32 TXComplex;
typedef void TXComplex;
#endif
#define TX_DECL_FN(fn, suffix) \
void TX_FN_NAME(fn, suffix)(AVTXContext *s, void *o, void *i, ptrdiff_t st);
#define TX_DEF(fn, tx_type, len_min, len_max, f1, f2, \
p, init_fn, suffix, cf, cd_flags, cf2) \
&(const FFTXCodelet){ \
.name = TX_FN_NAME_STR(fn, suffix), \
.function = TX_FN_NAME(fn, suffix), \
.type = TX_TYPE(tx_type), \
.flags = FF_TX_ALIGNED | FF_TX_OUT_OF_PLACE | cd_flags, \
.factors = { f1, f2 }, \
.min_len = len_min, \
.max_len = len_max, \
.init = init_fn, \
.cpu_flags = cf2 | AV_CPU_FLAG_ ## cf, \
.prio = p, \
}
#if defined(TX_FLOAT) || defined(TX_DOUBLE)
#define CMUL(dre, dim, are, aim, bre, bim) \