#define BF(x, y, a, b) \ do { \
x = (a) - (unsigned)(b); \
y = (a) + (unsigned)(b); \
} while (0)
#endif/* TX_INT32 */
#define CMUL3(c, a, b) CMUL((c).re, (c).im, (a).re, (a).im, (b).re, (b).im)
/* Codelet flags, used to pick codelets. Must be a superset of enum AVTXFlags,
* but if it runs out of bits, it can be made separate. */ #define FF_TX_OUT_OF_PLACE (1ULL << 63) /* Can be OR'd with AV_TX_INPLACE */ #define FF_TX_ALIGNED (1ULL << 62) /* Cannot be OR'd with AV_TX_UNALIGNED */ #define FF_TX_PRESHUFFLE (1ULL << 61) /* Codelet expects permuted coeffs */ #define FF_TX_INVERSE_ONLY (1ULL << 60) /* For non-orthogonal inverse-only transforms */ #define FF_TX_FORWARD_ONLY (1ULL << 59) /* For non-orthogonal forward-only transforms */ #define FF_TX_ASM_CALL (1ULL << 58) /* For asm->asm functions only */
/* For SIMD, set base prio to the register size in bits and increment in
* steps of 64 depending on faster/slower features, like FMA. */
FF_TX_PRIO_MIN = -131072, /* For naive implementations */
FF_TX_PRIO_MAX = 32768, /* For custom implementations/ASICs */
} FFTXCodeletPriority;
typedefenum FFTXMapDirection { /* No map. Make a map up. */
FF_TX_MAP_NONE = 0,
/* Lookup table must be applied via dst[i] = src[lut[i]]; */
FF_TX_MAP_GATHER,
/* Lookup table must be applied via dst[lut[i]] = src[i]; */
FF_TX_MAP_SCATTER,
} FFTXMapDirection;
/* Codelet options */ typedefstruct FFTXCodeletOptions { /* Request a specific lookup table direction. Codelets MUST put the *directioninAVTXContext.Ifthecodeletdoesnotrespectthis,a
* conversion will be performed. */
FFTXMapDirection map_dir;
} FFTXCodeletOptions;
/* Maximum number of factors a codelet may have. Arbitrary. */ #define TX_MAX_FACTORS 16
/* Maximum amount of subtransform functions, subtransforms and factors. Arbitrary. */ #define TX_MAX_SUB 4
/* Maximum number of returned results for ff_tx_decompose_length. Arbitrary. */ #define TX_MAX_DECOMPOSITIONS 512
typedefstruct FFTXCodelet { constchar *name; /* Codelet name, for debugging */
av_tx_fn function; /* Codelet function, != NULL */ enum AVTXType type; /* Type of codelet transform */ #define TX_TYPE_ANY INT32_MAX /* Special type to allow all types */
uint64_t flags; /* A combination of AVTXFlags and codelet
* flags that describe its properties. */
int factors[TX_MAX_FACTORS]; /* Length factors. MUST be coprime. */ #define TX_FACTOR_ANY -1/* When used alone, signals that the codelet *supportsallfactors.Otherwise,ifother *factorsarepresent,itsignalsthatwhatever *remainswillbesupported,aslongasthe
* other factors are a component of the length */
int nb_factors; /* Minimum number of factors that have to
* be a modulo of the length. Must not be 0. */
int min_len; /* Minimum length of transform, must be >= 1 */ int max_len; /* Maximum length of transform */ #define TX_LEN_UNLIMITED -1/* Special length value to permit all lengths */
int (*init)(AVTXContext *s, /* Optional callback for current context initialization. */ conststruct FFTXCodelet *cd,
uint64_t flags,
FFTXCodeletOptions *opts, int len, int inv, constvoid *scale);
int (*uninit)(AVTXContext *s); /* Optional callback for uninitialization. */
int cpu_flags; /* CPU flags. If any negative flags like *SLOWarepresent,willavoidpicking.
* 0x0 to signal it's a C codelet */ #define FF_TX_CPU_FLAGS_ALL 0x0 /* Special CPU flag for C */
int prio; /* < 0 = least, 0 = no pref, > 0 = prefer */
} FFTXCodelet;
struct AVTXContext { /* Fields the root transform and subtransforms use or may use.
* NOTE: This section is used by assembly, do not reorder or change */ int len; /* Length of the transform */ int inv; /* If transform is inverse */ int *map; /* Lookup table(s) */
TXComplex *exp; /* Any non-pre-baked multiplication factors,
* or extra temporary buffer */
TXComplex *tmp; /* Temporary buffer, if needed */
AVTXContext *sub; /* Subtransform context(s), if needed */
av_tx_fn fn[TX_MAX_SUB]; /* Function(s) for the subtransforms */ int nb_sub; /* Number of subtransforms. *Thereasonallofthesearesethere *ratherthanineachseparatecontext *istoeliminateextrapointer
* dereferences. */
/* Fields mainly useul/applicable for the root transform or initialization.
* Fields below are not used by assembly code. */ const FFTXCodelet *cd[TX_MAX_SUB]; /* Subtransform codelets */ const FFTXCodelet *cd_self; /* Codelet for the current context */ enum AVTXType type; /* Type of transform */
uint64_t flags; /* A combination of AVTXFlags and
* codelet flags used when creating */
FFTXMapDirection map_dir; /* Direction of AVTXContext->map */ float scale_f; double scale_d; void *opaque; /* Free to use by implementations */
};
/* This function embeds a Ruritanian PFA input map into an existing lookup table *toavoiddoublepermutation.Thisallowsforcompoundfactorstobe *synthesizedasfastPFAFFTsandembeddedintoeitherotherorstandalone *transforms.
* The output CRT map must still be pre-baked into the transform. */ #define TX_EMBED_INPUT_PFA_MAP(map, tot_len, d1, d2) \ do { \ int mtmp[(d1)*(d2)]; \ for (int k = 0; k < tot_len; k += (d1)*(d2)) { \
memcpy(mtmp, &map[k], (d1)*(d2)*sizeof(*mtmp)); \ for (int m = 0; m < (d2); m++) \ for (int n = 0; n < (d1); n++) \
map[k + m*(d1) + n] = mtmp[(m*(d1) + n*(d2)) % ((d1)*(d2))]; \
} \
} while (0)
/* This function generates a Ruritanian PFA input map into s->map. */ int ff_tx_gen_pfa_input_map(AVTXContext *s, FFTXCodeletOptions *opts, int d1, int d2);
/* Create a subtransform in the current context with the given parameters. *TheflagsparameterfromFFTXCodelet.init()shouldbepreservedasmuch *asthat'spossible.
* MUST be called during the sub() callback of each codelet. */ int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
uint64_t flags, FFTXCodeletOptions *opts, int len, int inv, constvoid *scale);
/* Clear the context by freeing all tables, maps and subtransforms. */ void ff_tx_clear_ctx(AVTXContext *s);
/* Attempt to factorize a length into 2 integers such that
* len / dst1 == dst2, where dst1 and dst2 are coprime. */ int ff_tx_decompose_length(int dst[TX_MAX_DECOMPOSITIONS], enum AVTXType type, int len, int inv);
/* Generate a default map (0->len or 0, (len-1)->1 for inverse transforms)
* for a context. */ int ff_tx_gen_default_map(AVTXContext *s, FFTXCodeletOptions *opts);
/* *GeneratesthePFApermutationtableintoAVTXContext->pfatab.Theendtable *isappendedtothestarttable. *The`inv`flagshouldonlybeenabledifthelookuptablesofsubtransforms *won'tgetflattened.
*/ int ff_tx_gen_compound_mapping(AVTXContext *s, FFTXCodeletOptions *opts, int inv, int n, int m);
/* *GeneratesanindexintoAVTXContext->inplace_idxthatiffollowedinthe *specificorder,allowstherevtabtobedonein-place.Thesub-transform *anditsmapshouldalreadybeinitialized.
*/ int ff_tx_gen_inplace_map(AVTXContext *s, int len);
/* *Thisgeneratesaparity-basedrevtaboflengthlenanddirectioninv. * *Paritymeansevenandoddcomplexnumberswillbesplit,e.g.theeven *coefficientswillcomefirst,afterwhichtheoddcoefficientswillbe *placed.Forexample,a4-pointtransform'scoefficientsafterreordering: *z[0].re,z[0].im,z[2].re,z[2].im,z[1].re,z[1].im,z[3].re,z[3].im * *Thebasisargumentisthelengthofthelargestnon-compositetransform *supported,andalsoimpliesthatthebasis/2transformissupportedaswell, *asthesplit-radixalgorithmrequiresittobe. * *Thedual_strideargumentindicatesthatboththebasis,aswellasthe *basis/2transformssupportdoingtwotransformsatonce,andthecoefficients *willbeinterleavedbetweeneachpairinasplit-radixlikeso(stride==2): *tx1[0],tx1[2],tx2[0],tx2[2],tx1[1],tx1[3],tx2[1],tx2[3] *Anon-zeronumberswitchesthison,withthevalueindicatingthestride *(howmanyvaluesof1transformtoputfirstbeforeswitchingtotheother). *Mustbeapoweroftwoor0.Mustbelessthanthebasis. *Valuewillbeclippedtothetransformsize,soforabasisof16anda *dual_strideof8,dual8-pointtransformswillbelaidoutasifdual_stride *wassetto4. *Usuallyyou'llsetthistohalfthecomplexnumbersthatfitinasingle *registeror0.ThisallowstoreuseSSEfunctionsasdual-transform *functionsinAVXmode. * *Iflengthissmallerthanbasis/2thisfunctionwillnotdoanything. * *Ifinv_lookupissetto1,itwillflipthelookupfromout[map[i]]=src[i] *toout[i]=src[map[i]].
*/ int ff_tx_gen_split_radix_parity_revtab(AVTXContext *s, int len, int inv,
FFTXCodeletOptions *opts, int basis, int dual_stride);
/* Typed init function to initialize shared tables. Will initialize all tables
* for all factors of a length. */ void ff_tx_init_tabs_float (int len); void ff_tx_init_tabs_double(int len); void ff_tx_init_tabs_int32 (int len);
/* Typed init function to initialize an MDCT exptab in a context. *Ifpre_tabisset,duplicatestheentiretable,withthefirst *copybeingshuffledaccordingtopre_tab,andthesecondcopy
* being the original. */ int ff_tx_mdct_gen_exp_float (AVTXContext *s, int *pre_tab); int ff_tx_mdct_gen_exp_double(AVTXContext *s, int *pre_tab); int ff_tx_mdct_gen_exp_int32 (AVTXContext *s, int *pre_tab);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.17Bemerkung:
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.