Go to the documentation of this file.
19 #ifndef AVUTIL_TX_PRIV_H
20 #define AVUTIL_TX_PRIV_H
29 #define TX_TAB(x) x ## _float
30 #define TX_NAME(x) x ## _float_c
31 #define TX_NAME_STR(x) NULL_IF_CONFIG_SMALL(x "_float_c")
32 #define TX_TYPE(x) AV_TX_FLOAT_ ## x
33 #define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _float_ ## suffix
34 #define TX_FN_NAME_STR(fn, suffix) NULL_IF_CONFIG_SMALL(#fn "_float_" #suffix)
35 #define MULT(x, m) ((x) * (m))
36 #define SCALE_TYPE float
37 typedef float TXSample;
38 typedef float TXUSample;
40 #elif defined(TX_DOUBLE)
41 #define TX_TAB(x) x ## _double
42 #define TX_NAME(x) x ## _double_c
43 #define TX_NAME_STR(x) NULL_IF_CONFIG_SMALL(x "_double_c")
44 #define TX_TYPE(x) AV_TX_DOUBLE_ ## x
45 #define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _double_ ## suffix
46 #define TX_FN_NAME_STR(fn, suffix) NULL_IF_CONFIG_SMALL(#fn "_double_" #suffix)
47 #define MULT(x, m) ((x) * (m))
48 #define SCALE_TYPE double
49 typedef double TXSample;
50 typedef double TXUSample;
52 #elif defined(TX_INT32)
53 #define TX_TAB(x) x ## _int32
54 #define TX_NAME(x) x ## _int32_c
55 #define TX_NAME_STR(x) NULL_IF_CONFIG_SMALL(x "_int32_c")
56 #define TX_TYPE(x) AV_TX_INT32_ ## x
57 #define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _int32_ ## suffix
58 #define TX_FN_NAME_STR(fn, suffix) NULL_IF_CONFIG_SMALL(#fn "_int32_" #suffix)
59 #define MULT(x, m) (((((int64_t)(x)) * (int64_t)(m)) + 0x40000000) >> 31)
60 #define SCALE_TYPE float
62 typedef uint32_t TXUSample;
68 #define TX_DECL_FN(fn, suffix) \
69 void TX_FN_NAME(fn, suffix)(AVTXContext *s, void *o, void *i, ptrdiff_t st);
71 #define TX_DEF(fn, tx_type, len_min, len_max, f1, f2, \
72 p, init_fn, suffix, cf, cd_flags, cf2) \
73 &(const FFTXCodelet){ \
74 .name = TX_FN_NAME_STR(fn, suffix), \
75 .function = TX_FN_NAME(fn, suffix), \
76 .type = TX_TYPE(tx_type), \
77 .flags = FF_TX_ALIGNED | FF_TX_OUT_OF_PLACE | cd_flags, \
78 .factors = { (f1), (f2) }, \
79 .nb_factors = !!(f1) + !!(f2), \
83 .cpu_flags = cf2 | AV_CPU_FLAG_ ## cf, \
87 #if defined(TX_FLOAT) || defined(TX_DOUBLE)
89 #define CMUL(dre, dim, are, aim, bre, bim) \
91 (dre) = (are) * (bre) - (aim) * (bim); \
92 (dim) = (are) * (bim) + (aim) * (bre); \
95 #define SMUL(dre, dim, are, aim, bre, bim) \
97 (dre) = (are) * (bre) - (aim) * (bim); \
98 (dim) = (are) * (bim) - (aim) * (bre); \
101 #define UNSCALE(x) (x)
102 #define RESCALE(x) (x)
104 #define FOLD(a, b) ((a) + (b))
106 #define BF(x, y, a, b) \
112 #elif defined(TX_INT32)
115 #define CMUL(dre, dim, are, aim, bre, bim) \
118 (accu) = (int64_t)(bre) * (are); \
119 (accu) -= (int64_t)(bim) * (aim); \
120 (dre) = (int)(((accu) + 0x40000000) >> 31); \
121 (accu) = (int64_t)(bim) * (are); \
122 (accu) += (int64_t)(bre) * (aim); \
123 (dim) = (int)(((accu) + 0x40000000) >> 31); \
126 #define SMUL(dre, dim, are, aim, bre, bim) \
129 (accu) = (int64_t)(bre) * (are); \
130 (accu) -= (int64_t)(bim) * (aim); \
131 (dre) = (int)(((accu) + 0x40000000) >> 31); \
132 (accu) = (int64_t)(bim) * (are); \
133 (accu) -= (int64_t)(bre) * (aim); \
134 (dim) = (int)(((accu) + 0x40000000) >> 31); \
137 #define UNSCALE(x) ((double)(x)/2147483648.0)
138 #define RESCALE(x) (av_clip64(llrintf((x) * 2147483648.0), INT32_MIN, INT32_MAX))
140 #define FOLD(x, y) ((int32_t)((x) + (unsigned)(y) + 32) >> 6)
142 #define BF(x, y, a, b) \
144 x = (a) - (unsigned)(b); \
145 y = (a) + (unsigned)(b); \
150 #define CMUL3(c, a, b) CMUL((c).re, (c).im, (a).re, (a).im, (b).re, (b).im)
154 #define FF_TX_OUT_OF_PLACE (1ULL << 63)
155 #define FF_TX_ALIGNED (1ULL << 62)
156 #define FF_TX_PRESHUFFLE (1ULL << 61)
157 #define FF_TX_INVERSE_ONLY (1ULL << 60)
158 #define FF_TX_FORWARD_ONLY (1ULL << 59)
159 #define FF_TX_ASM_CALL (1ULL << 58)
191 #define TX_MAX_FACTORS 16
197 #define TX_MAX_DECOMPOSITIONS 512
203 #define TX_TYPE_ANY INT32_MAX
209 #define TX_FACTOR_ANY -1
220 #define TX_LEN_UNLIMITED -1
234 #define FF_TX_CPU_FLAGS_ALL 0x0
275 #define TX_EMBED_INPUT_PFA_MAP(map, tot_len, d1, d2) \
277 int mtmp[(d1)*(d2)]; \
278 for (int k = 0; k < tot_len; k += (d1)*(d2)) { \
279 memcpy(mtmp, &map[k], (d1)*(d2)*sizeof(*mtmp)); \
280 for (int m = 0; m < (d2); m++) \
281 for (int n = 0; n < (d1); n++) \
282 map[k + m*(d1) + n] = mtmp[(m*(d1) + n*(d2)) % ((d1)*(d2))]; \
296 int len,
int inv,
const void *
scale);
317 int inv,
int n,
int m);
367 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
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)
static void scale(int *out, const int *in, const int w, const int h, const int shift)
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]