Go to the documentation of this file.
28 #define TYPE_IS(type, x) \
29 (((x) == AV_TX_FLOAT_ ## type) || \
30 ((x) == AV_TX_DOUBLE_ ## type) || \
31 ((x) == AV_TX_INT32_ ## type))
37 for (
int x = 1; x < m; x++)
38 if (((n * x) % m) == 1)
53 for (
int k = 0; k <
s->len; k += sl) {
55 for (
int m = 0; m < d2; m++)
56 for (
int n = 0; n < d1; n++)
57 s->map[k + ((m*d1 + n*d2) % (sl))] = m*d1 + n;
59 for (
int m = 0; m < d2; m++)
60 for (
int n = 0; n < d1; n++)
61 s->map[k + m*d1 + n] = (m*d1 + n*d2) % (sl);
65 for (
int w = 1;
w <= ((sl) >> 1);
w++)
66 FFSWAP(
int,
s->map[k +
w],
s->map[k + sl -
w]);
76 int inv,
int n,
int m)
78 int *in_map, *out_map;
93 out_map =
s->map +
len;
97 for (
int j = 0; j < m; j++) {
98 for (
int i = 0;
i < n;
i++) {
99 in_map[(
i*m + j*n) %
len] = j*n +
i;
100 out_map[(
i*m*m_inv + j*n*n_inv) %
len] =
i*m + j;
104 for (
int j = 0; j < m; j++) {
105 for (
int i = 0;
i < n;
i++) {
106 in_map[j*n +
i] = (
i*m + j*n) %
len;
107 out_map[(
i*m*m_inv + j*n*n_inv) %
len] =
i*m + j;
113 for (
int i = 0;
i < m;
i++) {
114 int *in = &in_map[
i*n + 1];
115 for (
int j = 0; j < ((n - 1) >> 1); j++)
116 FFSWAP(
int, in[j], in[n - j - 2]);
144 for (
int i = 0;
i <
s->len;
i++)
147 for (
int i = 0;
i <
s->len;
i++)
158 int *src_map, out_map_idx = 0;
160 if (!
s->sub || !
s->sub->map)
166 src_map =
s->sub->map;
180 for (
int j = 0; j < out_map_idx; j++) {
181 if (
dst ==
s->map[j]) {
187 }
while (
dst !=
src && !found);
190 s->map[out_map_idx++] =
src;
193 s->map[out_map_idx++] = 0;
199 int is_dual,
int dual_high,
int len,
200 int basis,
int dual_stride,
int inv_lookup)
205 int k1, k2,
stride, even_idx, odd_idx;
207 is_dual = is_dual && dual_stride;
208 dual_high = is_dual & dual_high;
212 odd_idx = even_idx +
len + (is_dual && !dual_high)*
len + dual_high*
len;
214 for (
int i = 0;
i <
len;
i++) {
218 revtab[even_idx++] = k1;
219 revtab[odd_idx++] = k2;
221 revtab[k1] = even_idx++;
222 revtab[k2] = odd_idx++;
234 0, 0,
len >> 0,
basis, dual_stride, inv_lookup);
236 1, 0,
len >> 1,
basis, dual_stride, inv_lookup);
238 1, 1,
len >> 1,
basis, dual_stride, inv_lookup);
243 int basis,
int dual_stride)
252 av_assert0(!dual_stride || !(dual_stride & (dual_stride - 1)));
273 if (
s->cd_self &&
s->cd_self->uninit)
274 s->cd_self->uninit(
s);
287 memset(
s->fn, 0,
sizeof(*
s->fn));
306 int len,
int inv,
const void *
scale)
317 memcpy(_out, _in,
stride);
395 prio += 16*max_factor;
423 while (codelet_list_idx--) {
427 while ((cd = *
list++)) {
430 int factors_product = 1, factors_mod = 0;
457 factors_product *= fl;
458 }
else if (!(fl % cd->
factors[
i])) {
463 factors_product <<=
b;
474 if ((factors_mod < cd->nb_factors) || (
len == factors_product))
477 if (
av_gcd(factors_product, fl) != 1)
481 if ((factors_product < cd->min_len) ||
488 for (
int i = 0;
i < nb_decomp;
i++) {
489 if (factors_product == ld[
i].
len) {
491 if (prio > ld[
i].prio)
500 ld[nb_decomp].
cd = cd;
501 ld[nb_decomp].
len = factors_product;
502 ld[nb_decomp].
len2 = fl;
503 ld[nb_decomp].
prio = prio;
515 for (
int i = 0;
i < nb_decomp;
i++) {
516 if (ld[
i].cd->nb_factors > 1)
533 for (
int i = 1;
i <
s->len;
i++)
534 s->map[
i] =
s->len -
i;
536 for (
int i = 1;
i <
s->len;
i++)
548 const char *sep =
", ";
553 av_bprintf(bp,
"%sunaligned", prev > 1 ? sep :
"");
555 av_bprintf(bp,
"%sinplace", prev > 1 ? sep :
"");
557 av_bprintf(bp,
"%sout_of_place", prev > 1 ? sep :
"");
559 av_bprintf(bp,
"%sfwd_only", prev > 1 ? sep :
"");
561 av_bprintf(bp,
"%sinv_only", prev > 1 ? sep :
"");
563 av_bprintf(bp,
"%spreshuf", prev > 1 ? sep :
"");
565 av_bprintf(bp,
"%simdct_full", prev > 1 ? sep :
"");
567 av_bprintf(bp,
"%sreal_to_real", prev > 1 ? sep :
"");
569 av_bprintf(bp,
"%sreal_to_imaginary", prev > 1 ? sep :
"");
571 av_bprintf(bp,
"%sasm_call", prev > 1 ? sep :
"");
655 for (
int i = 0;
i <= depth;
i++)
660 for (
int i = 0;
i <
s->nb_sub;
i++)
678 int matches = 0, any_flag = 0;
709 return (cd->
nb_factors <= matches) && (any_flag ||
len == 1);
714 int len,
int inv,
const void *
scale)
719 unsigned int cd_matches_size = 0;
721 int nb_cd_matches = 0;
731 uint64_t req_flags =
flags;
752 while (codelet_list_idx--) {
756 while ((cd = *
list++)) {
769 if (((req_flags & cd->
flags) != (req_flags)) ||
770 ((inv_req_mask & cd->
flags) != (req_flags & inv_req_mask)))
788 sizeof(*cd_tmp) * (nb_cd_matches + 1));
795 cd_matches[nb_cd_matches].
cd = cd;
805 inv ?
"inverse" :
"forward");
809 av_bprintf(&bp,
", found %i matches%s", nb_cd_matches,
810 nb_cd_matches ?
":" :
".");
823 for (
int i = 0;
i < nb_cd_matches;
i++) {
838 for (
int i = 0;
i < nb_cd_matches;
i++) {
849 s->cd[
s->nb_sub] = cd;
866 for (
int i = 0;
i <
len;
i++)
877 for (
int i = 0;
i <
len;
i++)
908 const double default_scale_d = 1.0;
909 const float default_scale_f = 1.0f;
922 scale = &default_scale_d;
924 scale = &default_scale_f;
@ AV_TX_REAL_TO_REAL
Perform a real to half-complex RDFT.
#define AV_CPU_FLAG_SSSE3SLOW
SSSE3 supported, but usually not faster.
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 int cmp_decomp(FFTXLenDecomp *a, FFTXLenDecomp *b)
static void print_cd_info(const FFTXCodelet *cd, int prio, int len, int print_prio, int log_level)
#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_split_radix_parity_revtab(AVTXContext *s, int len, int inv, FFTXCodeletOptions *opts, int basis, int dual_stride)
#define TX_MAX_DECOMPOSITIONS
int ff_tx_gen_inplace_map(AVTXContext *s, int len)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
#define FF_TX_CPU_FLAGS_ALL
int ff_tx_gen_compound_mapping(AVTXContext *s, FFTXCodeletOptions *opts, int inv, int n, int m)
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
#define FFDIFFSIGN(x, y)
Comparator.
#define AV_CPU_FLAG_SLOW_GATHER
CPU has slow gathers.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
int factors[TX_MAX_FACTORS]
#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.
#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)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static const int codelet_list_num
@ AV_TX_FULL_IMDCT
Performs a full inverse MDCT rather than leaving out samples that can be derived through symmetry.
@ AV_TX_REAL_TO_IMAGINARY
@ AV_TX_INPLACE
Allows for in-place transformations, where input == output.
int ff_tx_gen_ptwo_revtab(AVTXContext *s, FFTXCodeletOptions *opts)
static void ff_tx_null(AVTXContext *s, void *_out, void *_in, ptrdiff_t stride)
static const int cpu_slow_mask
#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().
static int get_codelet_prio(const FFTXCodelet *cd, int cpu_flags, int len)
void ff_tx_clear_ctx(AVTXContext *s)
static void reset_ctx(AVTXContext *s, int free_sub)
int ff_tx_gen_default_map(AVTXContext *s, FFTXCodeletOptions *opts)
@ AV_TX_FLOAT_DCT_I
Discrete Cosine Transform I.
#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)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const FFTXCodelet *const ff_tx_codelet_list_float_aarch64[]
#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.
static const int cpu_slow_penalties[][2]
#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...
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.
@ AV_TX_FLOAT_DST_I
Discrete Sine Transform I.
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 void scale(int *out, const int *in, const int w, const int h, const int shift)
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[]
int ff_tx_gen_pfa_input_map(AVTXContext *s, FFTXCodeletOptions *opts, int d1, int d2)
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)
int ff_tx_decompose_length(int dst[TX_MAX_DECOMPOSITIONS], enum AVTXType type, int len, int inv)
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
static const FFTXCodelet *const *const codelet_list[]