Go to the documentation of this file.
25 #define TYPE_IS(type, x) \
26 (((x) == AV_TX_FLOAT_ ## type) || \
27 ((x) == AV_TX_DOUBLE_ ## type) || \
28 ((x) == AV_TX_INT32_ ## type))
34 for (
int x = 1; x < m; x++)
35 if (((n * x) % m) == 1)
44 int *in_map, *out_map;
45 const int inv =
s->inv;
47 const int mdct =
TYPE_IS(MDCT,
s->type);
61 out_map =
s->map +
len;
64 for (
int j = 0; j < m; j++) {
65 for (
int i = 0;
i < n;
i++) {
67 in_map[j*n +
i] = ((
i*m + j*n) %
len) << mdct;
68 out_map[(
i*m*m_inv + j*n*n_inv) %
len] =
i*m + j;
74 for (
int i = 0;
i < m;
i++) {
75 int *in = &in_map[
i*n + 1];
76 for (
int j = 0; j < ((n - 1) >> 1); j++)
77 FFSWAP(
int, in[j], in[n - j - 2]);
83 for (
int k = 0; k < m; k++) {
85 memcpy(
tmp, &in_map[k*15], 15*
sizeof(*
tmp));
86 for (
int i = 0;
i < 5;
i++) {
87 for (
int j = 0; j < 3; j++)
88 in_map[k*15 +
i*3 + j] =
tmp[(
i*3 + j*5) % 15];
115 for (
int i = 0;
i <
s->len;
i++)
118 for (
int i = 0;
i <
s->len;
i++)
127 int *src_map, out_map_idx = 0,
len =
s->len;
129 if (!
s->sub || !
s->sub->map)
135 src_map =
s->sub->map;
139 int dst = src_map[
src];
149 for (
int j = 0; j < out_map_idx; j++) {
150 if (dst ==
s->map[j]) {
156 }
while (dst !=
src && !found);
159 s->map[out_map_idx++] =
src;
162 s->map[out_map_idx++] = 0;
168 int is_dual,
int dual_high,
int len,
169 int basis,
int dual_stride,
int inv_lookup)
174 int k1, k2,
stride, even_idx, odd_idx;
176 is_dual = is_dual && dual_stride;
177 dual_high = is_dual & dual_high;
181 odd_idx = even_idx +
len + (is_dual && !dual_high)*
len + dual_high*
len;
183 for (
int i = 0;
i <
len;
i++) {
187 revtab[even_idx++] = k1;
188 revtab[odd_idx++] = k2;
190 revtab[k1] = even_idx++;
191 revtab[k2] = odd_idx++;
203 0, 0,
len >> 0,
basis, dual_stride, inv_lookup);
205 1, 0,
len >> 1,
basis, dual_stride, inv_lookup);
207 1, 1,
len >> 1,
basis, dual_stride, inv_lookup);
211 int basis,
int dual_stride)
223 av_assert0(!dual_stride || !(dual_stride & (dual_stride - 1)));
226 basis, dual_stride, invert_lookup);
237 for (
int i = 0;
i <
s->nb_sub;
i++)
240 if (
s->cd_self->uninit)
241 s->cd_self->uninit(
s);
248 memset(
s, 0,
sizeof(*
s));
262 int len,
int inv,
const void *
scale)
273 memcpy(_out, _in,
stride);
299 const char *sep =
", ";
304 av_bprintf(bp,
"%sunaligned", prev > 1 ? sep :
"");
306 av_bprintf(bp,
"%sinplace", prev > 1 ? sep :
"");
308 av_bprintf(bp,
"%sout_of_place", prev > 1 ? sep :
"");
310 av_bprintf(bp,
"%sfwd_only", prev > 1 ? sep :
"");
312 av_bprintf(bp,
"%sinv_only", prev > 1 ? sep :
"");
314 av_bprintf(bp,
"%spreshuf", prev > 1 ? sep :
"");
316 av_bprintf(bp,
"%simdct_full", prev > 1 ? sep :
"");
379 for (
int i = 0;
i <= depth;
i++)
384 for (
int i = 0;
i <
s->nb_sub;
i++)
437 return all_flag || (
len == 1);
442 int len,
int inv,
const void *
scale)
447 unsigned int cd_matches_size = 0;
448 int nb_cd_matches = 0;
454 const FFTXCodelet *
const *
const codelet_list[] = {
472 static const int slow_penalties[][2] = {
482 uint64_t req_flags =
flags;
499 while (codelet_list_num--) {
503 while ((cd = *
list++)) {
516 if (((req_flags & cd->
flags) != (req_flags)) ||
517 ((inv_req_mask & cd->
flags) != (req_flags & inv_req_mask)))
535 sizeof(*cd_tmp) * (nb_cd_matches + 1));
542 cd_matches[nb_cd_matches].
cd = cd;
543 cd_matches[nb_cd_matches].
prio = cd->
prio;
549 cd_matches[nb_cd_matches].prio -= slow_penalties[
i][1];
554 cd_matches[nb_cd_matches].
prio += 64;
558 cd_matches[nb_cd_matches].
prio += 64;
562 cd_matches[nb_cd_matches].
prio += 64;
568 cd_matches[nb_cd_matches].
prio += 16*max_factor;
578 inv ?
"inverse" :
"forward");
582 av_bprintf(&bp,
", found %i matches%s", nb_cd_matches,
583 nb_cd_matches ?
":" :
".");
596 for (
int i = 0;
i < nb_cd_matches;
i++) {
611 for (
int i = 0;
i < nb_cd_matches;
i++) {
622 s->cd[
s->nb_sub] = cd;
654 const double default_scale_d = 1.0;
655 const float default_scale_f = 1.0f;
666 scale = &default_scale_f;
668 scale = &default_scale_d;
#define AV_CPU_FLAG_SSSE3SLOW
SSSE3 supported, but usually not faster.
int ff_tx_gen_ptwo_inplace_revtab_idx(AVTXContext *s)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
static float sub(float src0, float src1)
#define AV_CPU_FLAG_SSE3SLOW
SSE3 supported, but usually not faster.
static const FFTXCodelet ff_tx_null_def
static int16_t basis[64][64]
int ff_tx_gen_compound_mapping(AVTXContext *s, int n, int m)
#define AV_LOG_VERBOSE
Detailed information.
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
#define FF_TX_CPU_FLAGS_ALL
static void print_type(AVBPrint *bp, enum AVTXType type)
static atomic_int cpu_flags
static int cmp_matches(TXCodeletMatch *a, TXCodeletMatch *b)
static void print_flags(AVBPrint *bp, uint64_t f)
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands.
static av_cold int ff_tx_null_init(AVTXContext *s, const FFTXCodelet *cd, uint64_t flags, FFTXCodeletOptions *opts, int len, int inv, const void *scale)
#define AV_BPRINT_SIZE_AUTOMATIC
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)
#define FFDIFFSIGN(x, y)
Comparator.
#define AV_CPU_FLAG_SLOW_GATHER
CPU has slow gathers.
#define FF_ARRAY_ELEMS(a)
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
@ AV_TX_FLOAT_MDCT
Standard MDCT with a sample data type of float, double or int32_t, respecively.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
static void print_cd_info(const FFTXCodelet *cd, int prio, int print_prio)
int ff_tx_gen_split_radix_parity_revtab(AVTXContext *s, int invert_lookup, int basis, int dual_stride)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define FF_TX_FORWARD_ONLY
@ AV_TX_FLOAT_FFT
Standard complex to complex FFT with sample data type of AVComplexFloat, AVComplexDouble or AVComplex...
static int split_radix_permutation(int i, int len, int inv)
@ AV_TX_FULL_IMDCT
Performs a full inverse MDCT rather than leaving out samples that can be derived through symmetry.
static void reset_ctx(AVTXContext *s)
@ AV_TX_INPLACE
Performs an in-place transformation on the input.
static void ff_tx_null(AVTXContext *s, void *_out, void *_in, ptrdiff_t stride)
#define FF_TX_OUT_OF_PLACE
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
int(* init)(AVTXContext *s, const struct FFTXCodelet *cd, uint64_t flags, FFTXCodeletOptions *opts, int len, int inv, const void *scale)
@ AV_TX_UNALIGNED
Relaxes alignment requirement for the in and out arrays of av_tx_fn().
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_CPU_FLAG_AVXSLOW
AVX supported, but slow when using YMM registers (e.g. Bulldozer)
#define AV_CPU_FLAG_SSE2SLOW
SSE2 supported, but usually not faster.
const FFTXCodelet *const ff_tx_codelet_list_double_c[]
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
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 offset
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
#define i(width, name, range_min, range_max)
#define AV_QSORT(p, num, type, cmp)
Quicksort This sort is fast, and fully inplace but not stable and it is possible to construct input t...
int ff_tx_gen_ptwo_revtab(AVTXContext *s, int invert_lookup)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
#define AV_CPU_FLAG_ATOM
Atom processor, some SSSE3 instructions are slower.
av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type, uint64_t flags, FFTXCodeletOptions *opts, int len, int inv, const void *scale)
#define FFSWAP(type, a, b)
#define FF_TX_INVERSE_ONLY
void av_bprintf(AVBPrint *buf, const char *fmt,...)
const FFTXCodelet *const ff_tx_codelet_list_float_c[]
@ AV_TX_FLOAT_RDFT
Real to complex and complex to real DFTs.
static int check_cd_factors(const FFTXCodelet *cd, int len)
const FFTXCodelet * cd_self
static const int factor[16]
const FFTXCodelet *const ff_tx_codelet_list_float_x86[]
static void print_tx_structure(AVTXContext *s, int depth)
static const FFTXCodelet *const ff_tx_null_list[]
#define flags(name, subs,...)
static av_always_inline int mulinv(int n, int m)
const FFTXCodelet *const ff_tx_codelet_list_int32_c[]
static void parity_revtab_generator(int *revtab, int n, int inv, int offset, int is_dual, int dual_high, int len, int basis, int dual_stride, int inv_lookup)