FFmpeg
Data Structures | Macros | Functions | Variables
tx.c File Reference
#include "avassert.h"
#include "intmath.h"
#include "cpu.h"
#include "mem.h"
#include "qsort.h"
#include "bprint.h"
#include "tx_priv.h"

Go to the source code of this file.

Data Structures

struct  FFTXLenDecomp
 
struct  TXCodeletMatch
 

Macros

#define TYPE_IS(type, x)
 

Functions

static av_always_inline int mulinv (int n, int m)
 
int ff_tx_gen_pfa_input_map (AVTXContext *s, FFTXCodeletOptions *opts, int d1, int d2)
 
int ff_tx_gen_compound_mapping (AVTXContext *s, FFTXCodeletOptions *opts, int inv, int n, int m)
 
static int split_radix_permutation (int i, int len, int inv)
 
int ff_tx_gen_ptwo_revtab (AVTXContext *s, FFTXCodeletOptions *opts)
 
int ff_tx_gen_inplace_map (AVTXContext *s, int len)
 
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_gen_split_radix_parity_revtab (AVTXContext *s, int len, int inv, FFTXCodeletOptions *opts, int basis, int dual_stride)
 
static void reset_ctx (AVTXContext *s, int free_sub)
 
void ff_tx_clear_ctx (AVTXContext *s)
 
av_cold void av_tx_uninit (AVTXContext **ctx)
 Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL. More...
 
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)
 
static void ff_tx_null (AVTXContext *s, void *_out, void *_in, ptrdiff_t stride)
 
static int get_codelet_prio (const FFTXCodelet *cd, int cpu_flags, int len)
 
static int cmp_decomp (FFTXLenDecomp *a, FFTXLenDecomp *b)
 
int ff_tx_decompose_length (int dst[TX_MAX_DECOMPOSITIONS], enum AVTXType type, int len, int inv)
 
int ff_tx_gen_default_map (AVTXContext *s, FFTXCodeletOptions *opts)
 
static void print_flags (AVBPrint *bp, uint64_t f)
 
static void print_type (AVBPrint *bp, enum AVTXType type)
 
static void print_cd_info (const FFTXCodelet *cd, int prio, int len, int print_prio, int log_level)
 
static void print_tx_structure (AVTXContext *s, int depth)
 
static int cmp_matches (TXCodeletMatch *a, TXCodeletMatch *b)
 
static int check_cd_factors (const FFTXCodelet *cd, int len)
 
av_cold int ff_tx_init_subtx (AVTXContext *s, enum AVTXType type, uint64_t flags, FFTXCodeletOptions *opts, int len, int inv, const void *scale)
 
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 not supported. More...
 

Variables

static const FFTXCodelet ff_tx_null_def
 
static const FFTXCodelet *const ff_tx_null_list []
 
static const FFTXCodelet *const *const codelet_list []
 
static const int codelet_list_num = FF_ARRAY_ELEMS(codelet_list)
 
static const int cpu_slow_mask
 
static const int cpu_slow_penalties [][2]
 

Macro Definition Documentation

◆ TYPE_IS

#define TYPE_IS (   type,
 
)
Value:
(((x) == AV_TX_FLOAT_ ## type) || \
((x) == AV_TX_DOUBLE_ ## type) || \
((x) == AV_TX_INT32_ ## type))

Definition at line 28 of file tx.c.

Function Documentation

◆ mulinv()

static av_always_inline int mulinv ( int  n,
int  m 
)
static

Definition at line 34 of file tx.c.

Referenced by ff_tx_gen_compound_mapping().

◆ ff_tx_gen_pfa_input_map()

int ff_tx_gen_pfa_input_map ( AVTXContext s,
FFTXCodeletOptions opts,
int  d1,
int  d2 
)

Definition at line 44 of file tx.c.

Referenced by factor_init(), and ff_tx_fft_factor_init().

◆ ff_tx_gen_compound_mapping()

int ff_tx_gen_compound_mapping ( AVTXContext s,
FFTXCodeletOptions opts,
int  inv,
int  n,
int  m 
)

Definition at line 75 of file tx.c.

Referenced by ff_tx_fft_pfa_init(), ff_tx_mdct_pfa_init(), and fft_pfa_init().

◆ split_radix_permutation()

static int split_radix_permutation ( int  i,
int  len,
int  inv 
)
inlinestatic

Definition at line 125 of file tx.c.

Referenced by ff_tx_gen_ptwo_revtab(), and parity_revtab_generator().

◆ ff_tx_gen_ptwo_revtab()

int ff_tx_gen_ptwo_revtab ( AVTXContext s,
FFTXCodeletOptions opts 
)

Definition at line 136 of file tx.c.

Referenced by ff_tx_fft_sr_codelet_init(), and neon_init().

◆ ff_tx_gen_inplace_map()

int ff_tx_gen_inplace_map ( AVTXContext s,
int  len 
)

Definition at line 156 of file tx.c.

Referenced by ff_tx_fft_init().

◆ parity_revtab_generator()

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 
)
static

Definition at line 198 of file tx.c.

Referenced by ff_tx_gen_split_radix_parity_revtab().

◆ ff_tx_gen_split_radix_parity_revtab()

int ff_tx_gen_split_radix_parity_revtab ( AVTXContext s,
int  len,
int  inv,
FFTXCodeletOptions opts,
int  basis,
int  dual_stride 
)

Definition at line 241 of file tx.c.

Referenced by neon_init().

◆ reset_ctx()

static void reset_ctx ( AVTXContext s,
int  free_sub 
)
static

Definition at line 264 of file tx.c.

Referenced by av_tx_uninit(), ff_tx_clear_ctx(), and ff_tx_init_subtx().

◆ ff_tx_clear_ctx()

void ff_tx_clear_ctx ( AVTXContext s)

Definition at line 290 of file tx.c.

Referenced by ff_tx_fft_pfa_init().

◆ av_tx_uninit()

av_cold void av_tx_uninit ( AVTXContext **  ctx)

◆ ff_tx_null_init()

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 
)
static

Definition at line 304 of file tx.c.

◆ ff_tx_null()

static void ff_tx_null ( AVTXContext s,
void *  _out,
void *  _in,
ptrdiff_t  stride 
)
static

Definition at line 315 of file tx.c.

◆ get_codelet_prio()

static int get_codelet_prio ( const FFTXCodelet cd,
int  cpu_flags,
int  len 
)
static

Definition at line 367 of file tx.c.

Referenced by ff_tx_decompose_length(), and ff_tx_init_subtx().

◆ cmp_decomp()

static int cmp_decomp ( FFTXLenDecomp a,
FFTXLenDecomp b 
)
static

Definition at line 407 of file tx.c.

Referenced by ff_tx_decompose_length().

◆ ff_tx_decompose_length()

int ff_tx_decompose_length ( int  dst[TX_MAX_DECOMPOSITIONS],
enum AVTXType  type,
int  len,
int  inv 
)

Definition at line 412 of file tx.c.

Referenced by ff_tx_fft_pfa_init().

◆ ff_tx_gen_default_map()

int ff_tx_gen_default_map ( AVTXContext s,
FFTXCodeletOptions opts 
)

Definition at line 525 of file tx.c.

Referenced by factor_init(), and ff_tx_fft_factor_init().

◆ print_flags()

static void print_flags ( AVBPrint *  bp,
uint64_t  f 
)
static

Definition at line 545 of file tx.c.

Referenced by ff_tx_init_subtx(), and print_cd_info().

◆ print_type()

static void print_type ( AVBPrint *  bp,
enum AVTXType  type 
)
static

Definition at line 575 of file tx.c.

Referenced by ff_tx_init_subtx(), and print_cd_info().

◆ print_cd_info()

static void print_cd_info ( const FFTXCodelet cd,
int  prio,
int  len,
int  print_prio,
int  log_level 
)
static

Definition at line 597 of file tx.c.

Referenced by ff_tx_init_subtx(), and print_tx_structure().

◆ print_tx_structure()

static void print_tx_structure ( AVTXContext s,
int  depth 
)
static

Definition at line 651 of file tx.c.

Referenced by av_tx_init().

◆ cmp_matches()

static int cmp_matches ( TXCodeletMatch a,
TXCodeletMatch b 
)
static

Definition at line 670 of file tx.c.

Referenced by ff_tx_init_subtx().

◆ check_cd_factors()

static int check_cd_factors ( const FFTXCodelet cd,
int  len 
)
inlinestatic

Definition at line 676 of file tx.c.

Referenced by ff_tx_init_subtx().

◆ ff_tx_init_subtx()

av_cold int ff_tx_init_subtx ( AVTXContext s,
enum AVTXType  type,
uint64_t  flags,
FFTXCodeletOptions opts,
int  len,
int  inv,
const void *  scale 
)

◆ av_tx_init()

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 not supported.

Parameters
ctxthe context to allocate, will be NULL on error
txpointer to the transform function pointer to set
typetype the type of transform
invwhether to do an inverse or a forward transform
lenthe size of the transform in samples
scalepointer to the value to scale the output if supported by type
flagsa bitmask of AVTXFlags or 0
Returns
0 on success, negative error code on failure

Definition at line 903 of file tx.c.

Referenced by aac_decode_init(), ac3_decode_init(), ac3_fixed_mdct_init(), ac3_float_mdct_init(), atrac1_decode_init(), atrac3_decode_init(), atrac3p_decode_init(), atrac9_decode_init(), av_dct_init(), av_fft_init(), av_mdct_init(), av_rdft_init(), checkasm_check_synth_filter(), config_eq_output(), config_input(), config_output(), config_props(), convert_coeffs(), de_tx_init(), decode_init(), dolby_e_init(), dsp_init(), encode_init(), equ_init(), ff_aac_sbr_ctx_init(), ff_celt_init(), ff_dca_core_init(), ff_opus_psy_init(), fir_to_phase(), imc_decode_init(), init_cook_mlt(), init_mdct_win(), init_sample_rate(), init_segment(), load_data(), on2avc_decode_init(), opus_encode_init(), qdm2_decode_init(), qdmc_decode_init(), siren_init(), video_audio_display(), vorbis_parse_id_hdr(), wma_decode_init(), wmavoice_decode_init(), and yae_reset().

Variable Documentation

◆ ff_tx_null_def

const FFTXCodelet ff_tx_null_def
static
Initial value:
= {
.name = NULL_IF_CONFIG_SMALL("null"),
.function = ff_tx_null,
.type = TX_TYPE_ANY,
.factors[0] = TX_FACTOR_ANY,
.min_len = 1,
.max_len = 1,
.init = ff_tx_null_init,
.cpu_flags = FF_TX_CPU_FLAGS_ALL,
.prio = FF_TX_PRIO_MAX,
}

Definition at line 320 of file tx.c.

◆ ff_tx_null_list

const FFTXCodelet* const ff_tx_null_list[]
static
Initial value:

Definition at line 334 of file tx.c.

◆ codelet_list

const FFTXCodelet* const * const codelet_list[]
static

◆ codelet_list_num

const int codelet_list_num = FF_ARRAY_ELEMS(codelet_list)
static

Definition at line 352 of file tx.c.

Referenced by ff_tx_decompose_length(), and ff_tx_init_subtx().

◆ cpu_slow_mask

const int cpu_slow_mask
static

◆ cpu_slow_penalties

const int cpu_slow_penalties[][2]
static
Initial value:
= {
{ AV_CPU_FLAG_SSE2SLOW, 1 + 64 },
{ AV_CPU_FLAG_SSE3SLOW, 1 + 64 },
{ AV_CPU_FLAG_SSSE3SLOW, 1 + 64 },
{ AV_CPU_FLAG_ATOM, 1 + 128 },
{ AV_CPU_FLAG_AVXSLOW, 1 + 128 },
}

Definition at line 358 of file tx.c.

Referenced by get_codelet_prio().

AV_CPU_FLAG_SSSE3SLOW
#define AV_CPU_FLAG_SSSE3SLOW
SSSE3 supported, but usually not faster.
Definition: cpu.h:42
AV_CPU_FLAG_SSE3SLOW
#define AV_CPU_FLAG_SSE3SLOW
SSE3 supported, but usually not faster.
Definition: cpu.h:39
ff_tx_null_def
static const FFTXCodelet ff_tx_null_def
Definition: tx.c:320
FF_TX_CPU_FLAGS_ALL
#define FF_TX_CPU_FLAGS_ALL
Definition: tx_priv.h:230
ff_tx_null_init
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)
Definition: tx.c:304
type
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
Definition: writing_filters.txt:86
FF_TX_ALIGNED
#define FF_TX_ALIGNED
Definition: tx_priv.h:155
AV_CPU_FLAG_SLOW_GATHER
#define AV_CPU_FLAG_SLOW_GATHER
CPU has slow gathers.
Definition: cpu.h:58
TX_TYPE_ANY
#define TX_TYPE_ANY
Definition: tx_priv.h:203
NULL
#define NULL
Definition: coverity.c:32
AV_TX_INPLACE
@ AV_TX_INPLACE
Allows for in-place transformations, where input == output.
Definition: tx.h:161
ff_tx_null
static void ff_tx_null(AVTXContext *s, void *_out, void *_in, ptrdiff_t stride)
Definition: tx.c:315
FF_TX_OUT_OF_PLACE
#define FF_TX_OUT_OF_PLACE
Definition: tx_priv.h:154
FF_TX_PRIO_MAX
@ FF_TX_PRIO_MAX
Definition: tx_priv.h:168
AV_TX_UNALIGNED
@ AV_TX_UNALIGNED
Relaxes alignment requirement for the in and out arrays of av_tx_fn().
Definition: tx.h:167
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
AV_CPU_FLAG_AVXSLOW
#define AV_CPU_FLAG_AVXSLOW
AVX supported, but slow when using YMM registers (e.g. Bulldozer)
Definition: cpu.h:48
AV_CPU_FLAG_SSE2SLOW
#define AV_CPU_FLAG_SSE2SLOW
SSE2 supported, but usually not faster.
Definition: cpu.h:35
ff_tx_codelet_list_double_c
const FFTXCodelet *const ff_tx_codelet_list_double_c[]
AV_CPU_FLAG_ATOM
#define AV_CPU_FLAG_ATOM
Atom processor, some SSSE3 instructions are slower.
Definition: cpu.h:43
TX_FACTOR_ANY
#define TX_FACTOR_ANY
Definition: tx_priv.h:209
ff_tx_codelet_list_float_c
const FFTXCodelet *const ff_tx_codelet_list_float_c[]
ff_tx_null_list
static const FFTXCodelet *const ff_tx_null_list[]
Definition: tx.c:334
ff_tx_codelet_list_int32_c
const FFTXCodelet *const ff_tx_codelet_list_int32_c[]