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;
38 #elif defined(TX_DOUBLE)
39 #define TX_TAB(x) x ## _double
40 #define TX_NAME(x) x ## _double_c
41 #define TX_NAME_STR(x) NULL_IF_CONFIG_SMALL(x "_double_c")
42 #define TX_TYPE(x) AV_TX_DOUBLE_ ## x
43 #define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _double_ ## suffix
44 #define TX_FN_NAME_STR(fn, suffix) NULL_IF_CONFIG_SMALL(#fn "_double_" #suffix)
45 #define MULT(x, m) ((x) * (m))
46 #define SCALE_TYPE double
47 typedef double TXSample;
49 #elif defined(TX_INT32)
50 #define TX_TAB(x) x ## _int32
51 #define TX_NAME(x) x ## _int32_c
52 #define TX_NAME_STR(x) NULL_IF_CONFIG_SMALL(x "_int32_c")
53 #define TX_TYPE(x) AV_TX_INT32_ ## x
54 #define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _int32_ ## suffix
55 #define TX_FN_NAME_STR(fn, suffix) NULL_IF_CONFIG_SMALL(#fn "_int32_" #suffix)
56 #define MULT(x, m) (((((int64_t)(x)) * (int64_t)(m)) + 0x40000000) >> 31)
57 #define SCALE_TYPE float
64 #define TX_DECL_FN(fn, suffix) \
65 void TX_FN_NAME(fn, suffix)(AVTXContext *s, void *o, void *i, ptrdiff_t st);
67 #define TX_DEF(fn, tx_type, len_min, len_max, f1, f2, \
68 p, init_fn, suffix, cf, cd_flags, cf2) \
69 &(const FFTXCodelet){ \
70 .name = TX_FN_NAME_STR(fn, suffix), \
71 .function = TX_FN_NAME(fn, suffix), \
72 .type = TX_TYPE(tx_type), \
73 .flags = FF_TX_ALIGNED | FF_TX_OUT_OF_PLACE | cd_flags, \
74 .factors = { f1, f2 }, \
78 .cpu_flags = cf2 | AV_CPU_FLAG_ ## cf, \
82 #if defined(TX_FLOAT) || defined(TX_DOUBLE)
84 #define CMUL(dre, dim, are, aim, bre, bim) \
86 (dre) = (are) * (bre) - (aim) * (bim); \
87 (dim) = (are) * (bim) + (aim) * (bre); \
90 #define SMUL(dre, dim, are, aim, bre, bim) \
92 (dre) = (are) * (bre) - (aim) * (bim); \
93 (dim) = (are) * (bim) - (aim) * (bre); \
96 #define UNSCALE(x) (x)
97 #define RESCALE(x) (x)
99 #define FOLD(a, b) ((a) + (b))
101 #elif defined(TX_INT32)
104 #define CMUL(dre, dim, are, aim, bre, bim) \
107 (accu) = (int64_t)(bre) * (are); \
108 (accu) -= (int64_t)(bim) * (aim); \
109 (dre) = (int)(((accu) + 0x40000000) >> 31); \
110 (accu) = (int64_t)(bim) * (are); \
111 (accu) += (int64_t)(bre) * (aim); \
112 (dim) = (int)(((accu) + 0x40000000) >> 31); \
115 #define SMUL(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 UNSCALE(x) ((double)(x)/2147483648.0)
127 #define RESCALE(x) (av_clip64(lrintf((x) * 2147483648.0), INT32_MIN, INT32_MAX))
129 #define FOLD(x, y) ((int32_t)((x) + (unsigned)(y) + 32) >> 6)
133 #define BF(x, y, a, b) \
139 #define CMUL3(c, a, b) CMUL((c).re, (c).im, (a).re, (a).im, (b).re, (b).im)
143 #define FF_TX_OUT_OF_PLACE (1ULL << 63)
144 #define FF_TX_ALIGNED (1ULL << 62)
145 #define FF_TX_PRESHUFFLE (1ULL << 61)
146 #define FF_TX_INVERSE_ONLY (1ULL << 60)
147 #define FF_TX_FORWARD_ONLY (1ULL << 59)
172 #define TX_TYPE_ANY INT32_MAX
178 #define TX_FACTOR_ANY -1
186 #define TX_LEN_UNLIMITED -1
200 #define FF_TX_CPU_FLAGS_ALL 0x0
240 int len,
int inv,
const void *
scale);
292 int basis,
int dual_stride);
void ff_tx_init_tabs_float(int len)
static int16_t basis[64][64]
int ff_tx_mdct_gen_exp_float(AVTXContext *s)
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)
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
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_mdct_gen_exp_double(AVTXContext *s)
int(* init)(AVTXContext *s, const struct FFTXCodelet *cd, uint64_t flags, FFTXCodeletOptions *opts, int len, int inv, const void *scale)
int ff_tx_mdct_gen_exp_int32(AVTXContext *s)
int ff_tx_gen_compound_mapping(AVTXContext *s, int n, int m)
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_gen_ptwo_revtab(AVTXContext *s, int invert_lookup)
int ff_tx_gen_ptwo_inplace_revtab_idx(AVTXContext *s)
const FFTXCodelet *const ff_tx_codelet_list_float_c[]
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[]
int ff_tx_gen_split_radix_parity_revtab(AVTXContext *s, int invert_lookup, int basis, int dual_stride)
const FFTXCodelet * cd[TX_MAX_SUB]