Go to the documentation of this file.
19 #ifndef AVUTIL_TX_PRIV_H
20 #define AVUTIL_TX_PRIV_H
28 #define TX_TAB(x) x ## _float
29 #define TX_NAME(x) x ## _float_c
30 #define TX_NAME_STR(x) NULL_IF_CONFIG_SMALL(x "_float_c")
31 #define TX_TYPE(x) AV_TX_FLOAT_ ## x
32 #define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _float_ ## suffix
33 #define TX_FN_NAME_STR(fn, suffix) NULL_IF_CONFIG_SMALL(#fn "_float_" #suffix)
34 #define MULT(x, m) ((x) * (m))
35 #define SCALE_TYPE float
36 typedef float TXSample;
37 typedef float TXUSample;
39 #elif defined(TX_DOUBLE)
40 #define TX_TAB(x) x ## _double
41 #define TX_NAME(x) x ## _double_c
42 #define TX_NAME_STR(x) NULL_IF_CONFIG_SMALL(x "_double_c")
43 #define TX_TYPE(x) AV_TX_DOUBLE_ ## x
44 #define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _double_ ## suffix
45 #define TX_FN_NAME_STR(fn, suffix) NULL_IF_CONFIG_SMALL(#fn "_double_" #suffix)
46 #define MULT(x, m) ((x) * (m))
47 #define SCALE_TYPE double
48 typedef double TXSample;
49 typedef double TXUSample;
51 #elif defined(TX_INT32)
52 #define TX_TAB(x) x ## _int32
53 #define TX_NAME(x) x ## _int32_c
54 #define TX_NAME_STR(x) NULL_IF_CONFIG_SMALL(x "_int32_c")
55 #define TX_TYPE(x) AV_TX_INT32_ ## x
56 #define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _int32_ ## suffix
57 #define TX_FN_NAME_STR(fn, suffix) NULL_IF_CONFIG_SMALL(#fn "_int32_" #suffix)
58 #define MULT(x, m) (((((int64_t)(x)) * (int64_t)(m)) + 0x40000000) >> 31)
59 #define SCALE_TYPE float
61 typedef uint32_t TXUSample;
67 #define TX_DECL_FN(fn, suffix) \
68 void TX_FN_NAME(fn, suffix)(AVTXContext *s, void *o, void *i, ptrdiff_t st);
70 #define TX_DEF(fn, tx_type, len_min, len_max, f1, f2, \
71 p, init_fn, suffix, cf, cd_flags, cf2) \
72 &(const FFTXCodelet){ \
73 .name = TX_FN_NAME_STR(fn, suffix), \
74 .function = TX_FN_NAME(fn, suffix), \
75 .type = TX_TYPE(tx_type), \
76 .flags = FF_TX_ALIGNED | FF_TX_OUT_OF_PLACE | cd_flags, \
77 .factors = { (f1), (f2) }, \
78 .nb_factors = !!(f1) + !!(f2), \
82 .cpu_flags = cf2 | AV_CPU_FLAG_ ## cf, \
86 #if defined(TX_FLOAT) || defined(TX_DOUBLE)
88 #define CMUL(dre, dim, are, aim, bre, bim) \
90 (dre) = (are) * (bre) - (aim) * (bim); \
91 (dim) = (are) * (bim) + (aim) * (bre); \
94 #define SMUL(dre, dim, are, aim, bre, bim) \
96 (dre) = (are) * (bre) - (aim) * (bim); \
97 (dim) = (are) * (bim) - (aim) * (bre); \
100 #define UNSCALE(x) (x)
101 #define RESCALE(x) (x)
103 #define FOLD(a, b) ((a) + (b))
105 #elif defined(TX_INT32)
108 #define CMUL(dre, dim, are, aim, bre, bim) \
111 (accu) = (int64_t)(bre) * (are); \
112 (accu) -= (int64_t)(bim) * (aim); \
113 (dre) = (int)(((accu) + 0x40000000) >> 31); \
114 (accu) = (int64_t)(bim) * (are); \
115 (accu) += (int64_t)(bre) * (aim); \
116 (dim) = (int)(((accu) + 0x40000000) >> 31); \
119 #define SMUL(dre, dim, are, aim, bre, bim) \
122 (accu) = (int64_t)(bre) * (are); \
123 (accu) -= (int64_t)(bim) * (aim); \
124 (dre) = (int)(((accu) + 0x40000000) >> 31); \
125 (accu) = (int64_t)(bim) * (are); \
126 (accu) -= (int64_t)(bre) * (aim); \
127 (dim) = (int)(((accu) + 0x40000000) >> 31); \
130 #define UNSCALE(x) ((double)(x)/2147483648.0)
131 #define RESCALE(x) (av_clip64(llrintf((x) * 2147483648.0), INT32_MIN, INT32_MAX))
133 #define FOLD(x, y) ((int32_t)((x) + (unsigned)(y) + 32) >> 6)
137 #define BF(x, y, a, b) \
143 #define CMUL3(c, a, b) CMUL((c).re, (c).im, (a).re, (a).im, (b).re, (b).im)
147 #define FF_TX_OUT_OF_PLACE (1ULL << 63)
148 #define FF_TX_ALIGNED (1ULL << 62)
149 #define FF_TX_PRESHUFFLE (1ULL << 61)
150 #define FF_TX_INVERSE_ONLY (1ULL << 60)
151 #define FF_TX_FORWARD_ONLY (1ULL << 59)
152 #define FF_TX_ASM_CALL (1ULL << 58)
184 #define TX_MAX_FACTORS 16
190 #define TX_MAX_DECOMPOSITIONS 512
196 #define TX_TYPE_ANY INT32_MAX
202 #define TX_FACTOR_ANY -1
213 #define TX_LEN_UNLIMITED -1
227 #define FF_TX_CPU_FLAGS_ALL 0x0
268 #define TX_EMBED_INPUT_PFA_MAP(map, tot_len, d1, d2) \
270 int mtmp[(d1)*(d2)]; \
271 for (int k = 0; k < tot_len; k += (d1)*(d2)) { \
272 memcpy(mtmp, &map[k], (d1)*(d2)*sizeof(*mtmp)); \
273 for (int m = 0; m < (d2); m++) \
274 for (int n = 0; n < (d1); n++) \
275 map[k + m*(d1) + n] = mtmp[(m*(d1) + n*(d2)) % ((d1)*(d2))]; \
289 int len,
int inv,
const void *
scale);
310 int inv,
int n,
int m);
360 int basis,
int dual_stride);
void ff_tx_init_tabs_float(int len)
void ff_tx_clear_ctx(AVTXContext *s)
static int16_t basis[64][64]
#define TX_MAX_DECOMPOSITIONS
int ff_tx_mdct_gen_exp_int32(AVTXContext *s, int *pre_tab)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
static av_always_inline float scale(float x, float s)
int ff_tx_gen_compound_mapping(AVTXContext *s, FFTXCodeletOptions *opts, int inv, int n, int m)
int factors[TX_MAX_FACTORS]
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
int ff_tx_mdct_gen_exp_float(AVTXContext *s, int *pre_tab)
int ff_tx_gen_inplace_map(AVTXContext *s, int len)
int ff_tx_mdct_gen_exp_double(AVTXContext *s, int *pre_tab)
int(* uninit)(AVTXContext *s)
int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type, uint64_t flags, FFTXCodeletOptions *opts, int len, int inv, const void *scale)
int ff_tx_gen_pfa_input_map(AVTXContext *s, FFTXCodeletOptions *opts, int d1, int d2)
int(* init)(AVTXContext *s, const struct FFTXCodelet *cd, uint64_t flags, FFTXCodeletOptions *opts, int len, int inv, const void *scale)
const FFTXCodelet *const ff_tx_codelet_list_float_aarch64[]
int ff_tx_gen_split_radix_parity_revtab(AVTXContext *s, int len, int inv, FFTXCodeletOptions *opts, int basis, int dual_stride)
const FFTXCodelet *const ff_tx_codelet_list_double_c[]
void ff_tx_init_tabs_int32(int len)
void ff_tx_init_tabs_double(int len)
int ff_tx_decompose_length(int dst[TX_MAX_DECOMPOSITIONS], enum AVTXType type, int len, int inv)
int ff_tx_gen_ptwo_revtab(AVTXContext *s, FFTXCodeletOptions *opts)
const FFTXCodelet *const ff_tx_codelet_list_float_c[]
int ff_tx_gen_default_map(AVTXContext *s, FFTXCodeletOptions *opts)
const FFTXCodelet * cd_self
const FFTXCodelet *const ff_tx_codelet_list_float_x86[]
#define flags(name, subs,...)
const FFTXCodelet *const ff_tx_codelet_list_int32_c[]
const FFTXCodelet * cd[TX_MAX_SUB]