FFmpeg
Macros | Functions | Variables
tx_template.c File Reference

Go to the source code of this file.

Macros

#define INIT_FF_COS_TABS_FUNC(index, size)
 
#define DECL_FFT5(NAME, D0, D1, D2, D3, D4)
 
#define BUTTERFLIES(a0, a1, a2, a3)
 
#define BUTTERFLIES_BIG(a0, a1, a2, a3)
 
#define TRANSFORM(a0, a1, a2, a3, wre, wim)
 
#define TRANSFORM_ZERO(a0, a1, a2, a3)
 
#define PASS(name)
 
#define BUTTERFLIES   BUTTERFLIES_BIG
 
#define DECL_FFT(n, n2, n4)
 
#define pass   pass_big
 
#define DECL_COMP_FFT(N)
 
#define DECL_COMP_IMDCT(N)
 
#define DECL_COMP_MDCT(N)
 
#define CHECK_FACTOR(DST, FACTOR, SRC)
 

Functions

 COSTABLE (16)
 
 COSTABLE (32)
 
 COSTABLE (64)
 
 COSTABLE (128)
 
 COSTABLE (256)
 
 COSTABLE (512)
 
 COSTABLE (1024)
 
 COSTABLE (2048)
 
 COSTABLE (4096)
 
 COSTABLE (8192)
 
 COSTABLE (16384)
 
 COSTABLE (32768)
 
 COSTABLE (65536)
 
 COSTABLE (131072)
 
FFTComplex TX_NAME (ff_cos_53)[4]
 
static av_always_inline void init_cos_tabs_idx (int index)
 
static av_cold void ff_init_53_tabs (void)
 
static av_cold void init_cos_tabs (int index)
 
static av_always_inline void fft3 (FFTComplex *out, FFTComplex *in, ptrdiff_t stride)
 
static av_always_inline void fft15 (FFTComplex *out, FFTComplex *in, ptrdiff_t stride)
 
static void fft2 (FFTComplex *z)
 
static void fft4 (FFTComplex *z)
 
static void fft8 (FFTComplex *z)
 
static void fft16 (FFTComplex *z)
 
static void monolithic_fft (AVTXContext *s, void *_out, void *_in, ptrdiff_t stride)
 
static void naive_fft (AVTXContext *s, void *_out, void *_in, ptrdiff_t stride)
 
static void monolithic_imdct (AVTXContext *s, void *_dst, void *_src, ptrdiff_t stride)
 
static void monolithic_mdct (AVTXContext *s, void *_dst, void *_src, ptrdiff_t stride)
 
static void naive_imdct (AVTXContext *s, void *_dst, void *_src, ptrdiff_t stride)
 
static void naive_mdct (AVTXContext *s, void *_dst, void *_src, ptrdiff_t stride)
 
static int gen_mdct_exptab (AVTXContext *s, int len4, double scale)
 
int TX_NAME() ff_tx_init_mdct_fft (AVTXContext *s, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
 

Variables

static FFTSample *const cos_tabs [18]
 
static CosTabsInitOnce cos_tabs_init_once []
 
static void(*const fft_dispatch [])(FFTComplex *)
 

Macro Definition Documentation

◆ INIT_FF_COS_TABS_FUNC

#define INIT_FF_COS_TABS_FUNC (   index,
  size 
)
Value:
static av_cold void init_cos_tabs_ ## size (void) \
{ \
init_cos_tabs_idx(index); \
}

Definition at line 74 of file tx_template.c.

◆ DECL_FFT5

#define DECL_FFT5 (   NAME,
  D0,
  D1,
  D2,
  D3,
  D4 
)

Definition at line 165 of file tx_template.c.

◆ BUTTERFLIES [1/2]

#define BUTTERFLIES (   a0,
  a1,
  a2,
  a3 
)
Value:
{\
BF(t3, t5, t5, t1);\
BF(a2.re, a0.re, a0.re, t5);\
BF(a3.im, a1.im, a1.im, t3);\
BF(t4, t6, t2, t6);\
BF(a3.re, a1.re, a1.re, t4);\
BF(a2.im, a0.im, a0.im, t6);\
}

Definition at line 277 of file tx_template.c.

◆ BUTTERFLIES_BIG

#define BUTTERFLIES_BIG (   a0,
  a1,
  a2,
  a3 
)
Value:
{\
FFTSample r0=a0.re, i0=a0.im, r1=a1.re, i1=a1.im;\
BF(t3, t5, t5, t1);\
BF(a2.re, a0.re, r0, t5);\
BF(a3.im, a1.im, i1, t3);\
BF(t4, t6, t2, t6);\
BF(a3.re, a1.re, r1, t4);\
BF(a2.im, a0.im, i0, t6);\
}

Definition at line 229 of file tx_template.c.

◆ TRANSFORM

#define TRANSFORM (   a0,
  a1,
  a2,
  a3,
  wre,
  wim 
)
Value:
{\
CMUL(t1, t2, a2.re, a2.im, wre, -wim);\
CMUL(t5, t6, a3.re, a3.im, wre, wim);\
BUTTERFLIES(a0,a1,a2,a3)\
}

Definition at line 239 of file tx_template.c.

◆ TRANSFORM_ZERO

#define TRANSFORM_ZERO (   a0,
  a1,
  a2,
  a3 
)
Value:
{\
t1 = a2.re;\
t2 = a2.im;\
t5 = a3.re;\
t6 = a3.im;\
BUTTERFLIES(a0,a1,a2,a3)\
}

Definition at line 245 of file tx_template.c.

◆ PASS

#define PASS (   name)
Value:
static void name(FFTComplex *z, const FFTSample *wre, unsigned int n)\
{\
FFTSample t1, t2, t3, t4, t5, t6;\
int o1 = 2*n;\
int o2 = 4*n;\
int o3 = 6*n;\
const FFTSample *wim = wre+o1;\
n--;\
TRANSFORM_ZERO(z[0],z[o1],z[o2],z[o3]);\
TRANSFORM(z[1],z[o1+1],z[o2+1],z[o3+1],wre[1],wim[-1]);\
do {\
z += 2;\
wre += 2;\
wim -= 2;\
TRANSFORM(z[0],z[o1],z[o2],z[o3],wre[0],wim[0]);\
TRANSFORM(z[1],z[o1+1],z[o2+1],z[o3+1],wre[1],wim[-1]);\
} while(--n);\
}

Definition at line 254 of file tx_template.c.

◆ BUTTERFLIES [2/2]

#define BUTTERFLIES   BUTTERFLIES_BIG

Definition at line 277 of file tx_template.c.

◆ DECL_FFT

#define DECL_FFT (   n,
  n2,
  n4 
)
Value:
static void fft##n(FFTComplex *z)\
{\
fft##n2(z);\
fft##n4(z+n4*2);\
fft##n4(z+n4*3);\
pass(z,TX_NAME(ff_cos_##n),n4/2);\
}

Definition at line 280 of file tx_template.c.

◆ pass

#define pass   pass_big

Definition at line 347 of file tx_template.c.

◆ DECL_COMP_FFT

#define DECL_COMP_FFT (   N)
Value:
static void compound_fft_##N##xM(AVTXContext *s, void *_out, \
void *_in, ptrdiff_t stride) \
{ \
const int m = s->m, *in_map = s->pfatab, *out_map = in_map + N*m; \
FFTComplex *in = _in; \
FFTComplex *out = _out; \
FFTComplex fft##N##in[N]; \
void (*fftp)(FFTComplex *z) = fft_dispatch[av_log2(m)]; \
for (int i = 0; i < m; i++) { \
for (int j = 0; j < N; j++) \
fft##N##in[j] = in[in_map[i*N + j]]; \
fft##N(s->tmp + s->revtab[i], fft##N##in, m); \
} \
for (int i = 0; i < N; i++) \
fftp(s->tmp + m*i); \
for (int i = 0; i < N*m; i++) \
out[i] = s->tmp[out_map[i]]; \
}

Definition at line 362 of file tx_template.c.

◆ DECL_COMP_IMDCT

#define DECL_COMP_IMDCT (   N)

Definition at line 444 of file tx_template.c.

◆ DECL_COMP_MDCT

#define DECL_COMP_MDCT (   N)

Definition at line 486 of file tx_template.c.

◆ CHECK_FACTOR

#define CHECK_FACTOR (   DST,
  FACTOR,
  SRC 
)
Value:
if (DST == 1 && !(SRC % FACTOR)) { \
DST = FACTOR; \
SRC /= FACTOR; \
}

Function Documentation

◆ COSTABLE() [1/14]

COSTABLE ( 16  )

◆ COSTABLE() [2/14]

COSTABLE ( 32  )

◆ COSTABLE() [3/14]

COSTABLE ( 64  )

◆ COSTABLE() [4/14]

COSTABLE ( 128  )

◆ COSTABLE() [5/14]

COSTABLE ( 256  )

◆ COSTABLE() [6/14]

COSTABLE ( 512  )

◆ COSTABLE() [7/14]

COSTABLE ( 1024  )

◆ COSTABLE() [8/14]

COSTABLE ( 2048  )

◆ COSTABLE() [9/14]

COSTABLE ( 4096  )

◆ COSTABLE() [10/14]

COSTABLE ( 8192  )

◆ COSTABLE() [11/14]

COSTABLE ( 16384  )

◆ COSTABLE() [12/14]

COSTABLE ( 32768  )

◆ COSTABLE() [13/14]

COSTABLE ( 65536  )

◆ COSTABLE() [14/14]

COSTABLE ( 131072  )

◆ TX_NAME()

FFTComplex TX_NAME ( ff_cos_53  )

Referenced by ff_init_53_tabs(), fft16(), and fft3().

◆ init_cos_tabs_idx()

static av_always_inline void init_cos_tabs_idx ( int  index)
static

Definition at line 63 of file tx_template.c.

◆ ff_init_53_tabs()

static av_cold void ff_init_53_tabs ( void  )
static

Definition at line 95 of file tx_template.c.

◆ init_cos_tabs()

static av_cold void init_cos_tabs ( int  index)
static

Definition at line 124 of file tx_template.c.

Referenced by ff_tx_init_mdct_fft().

◆ fft3()

static av_always_inline void fft3 ( FFTComplex out,
FFTComplex in,
ptrdiff_t  stride 
)
static

Definition at line 130 of file tx_template.c.

Referenced by fft15().

◆ fft15()

static av_always_inline void fft15 ( FFTComplex out,
FFTComplex in,
ptrdiff_t  stride 
)
static

Definition at line 204 of file tx_template.c.

◆ fft2()

static void fft2 ( FFTComplex z)
static

Definition at line 289 of file tx_template.c.

◆ fft4()

static void fft4 ( FFTComplex z)
static

Definition at line 297 of file tx_template.c.

Referenced by fft16(), and fft8().

◆ fft8()

static void fft8 ( FFTComplex z)
static

Definition at line 311 of file tx_template.c.

Referenced by fft16().

◆ fft16()

static void fft16 ( FFTComplex z)
static

Definition at line 326 of file tx_template.c.

◆ monolithic_fft()

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

Definition at line 389 of file tx_template.c.

Referenced by ff_tx_init_mdct_fft().

◆ naive_fft()

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

Definition at line 419 of file tx_template.c.

Referenced by ff_tx_init_mdct_fft().

◆ monolithic_imdct()

static void monolithic_imdct ( AVTXContext s,
void *  _dst,
void *  _src,
ptrdiff_t  stride 
)
static

Definition at line 534 of file tx_template.c.

Referenced by ff_tx_init_mdct_fft().

◆ monolithic_mdct()

static void monolithic_mdct ( AVTXContext s,
void *  _dst,
void *  _src,
ptrdiff_t  stride 
)
static

Definition at line 563 of file tx_template.c.

Referenced by ff_tx_init_mdct_fft().

◆ naive_imdct()

static void naive_imdct ( AVTXContext s,
void *  _dst,
void *  _src,
ptrdiff_t  stride 
)
static

Definition at line 600 of file tx_template.c.

Referenced by ff_tx_init_mdct_fft().

◆ naive_mdct()

static void naive_mdct ( AVTXContext s,
void *  _dst,
void *  _src,
ptrdiff_t  stride 
)
static

Definition at line 630 of file tx_template.c.

Referenced by ff_tx_init_mdct_fft().

◆ gen_mdct_exptab()

static int gen_mdct_exptab ( AVTXContext s,
int  len4,
double  scale 
)
static

Definition at line 651 of file tx_template.c.

Referenced by ff_tx_init_mdct_fft().

◆ ff_tx_init_mdct_fft()

int TX_NAME() ff_tx_init_mdct_fft ( AVTXContext s,
av_tx_fn tx,
enum AVTXType  type,
int  inv,
int  len,
const void *  scale,
uint64_t  flags 
)

Definition at line 668 of file tx_template.c.

Variable Documentation

◆ cos_tabs

FFTSample* const cos_tabs[18]
static
Initial value:
= {
TX_NAME(ff_cos_16),
TX_NAME(ff_cos_32),
TX_NAME(ff_cos_64),
TX_NAME(ff_cos_128),
TX_NAME(ff_cos_256),
TX_NAME(ff_cos_512),
TX_NAME(ff_cos_1024),
TX_NAME(ff_cos_2048),
TX_NAME(ff_cos_4096),
TX_NAME(ff_cos_8192),
TX_NAME(ff_cos_16384),
TX_NAME(ff_cos_32768),
TX_NAME(ff_cos_65536),
TX_NAME(ff_cos_131072),
}

Definition at line 42 of file tx_template.c.

Referenced by init_cos_tabs_idx().

◆ cos_tabs_init_once

CosTabsInitOnce cos_tabs_init_once[]
static
Initial value:
= {
{ NULL },
{ NULL },
{ NULL },
{ init_cos_tabs_16, AV_ONCE_INIT },
{ init_cos_tabs_32, AV_ONCE_INIT },
{ init_cos_tabs_64, AV_ONCE_INIT },
{ init_cos_tabs_128, AV_ONCE_INIT },
{ init_cos_tabs_256, AV_ONCE_INIT },
{ init_cos_tabs_512, AV_ONCE_INIT },
{ init_cos_tabs_1024, AV_ONCE_INIT },
{ init_cos_tabs_2048, AV_ONCE_INIT },
{ init_cos_tabs_4096, AV_ONCE_INIT },
{ init_cos_tabs_8192, AV_ONCE_INIT },
{ init_cos_tabs_16384, AV_ONCE_INIT },
{ init_cos_tabs_32768, AV_ONCE_INIT },
{ init_cos_tabs_65536, AV_ONCE_INIT },
{ init_cos_tabs_131072, AV_ONCE_INIT },
}

Definition at line 103 of file tx_template.c.

Referenced by init_cos_tabs().

◆ fft_dispatch

void(* const fft_dispatch[])(FFTComplex *)
static
Initial value:
= {
NULL, fft2, fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512,
fft1024, fft2048, fft4096, fft8192, fft16384, fft32768, fft65536, fft131072
}

Definition at line 357 of file tx_template.c.

Referenced by ff_tx_init_mdct_fft(), monolithic_fft(), monolithic_imdct(), and monolithic_mdct().

stride
int stride
Definition: mace.c:144
name
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 default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
fft16
static void fft16(FFTComplex *z)
Definition: tx_template.c:326
out
FILE * out
Definition: movenc.c:54
AVTXContext
Definition: tx_priv.h:108
fft2
static void fft2(FFTComplex *z)
Definition: tx_template.c:289
TRANSFORM_ZERO
#define TRANSFORM_ZERO(a0, a1, a2, a3)
Definition: tx_template.c:245
t1
#define t1
Definition: regdef.h:29
fft4
static void fft4(FFTComplex *z)
Definition: tx_template.c:297
a1
#define a1
Definition: regdef.h:47
av_cold
#define av_cold
Definition: attributes.h:90
fft8
static void fft8(FFTComplex *z)
Definition: tx_template.c:311
s
#define s(width, name)
Definition: cbs_vp9.c:257
ff_init_53_tabs
static av_cold void ff_init_53_tabs(void)
Definition: tx_template.c:95
AV_ONCE_INIT
#define AV_ONCE_INIT
Definition: thread.h:173
NULL
#define NULL
Definition: coverity.c:32
t5
#define t5
Definition: regdef.h:33
t6
#define t6
Definition: regdef.h:34
FFTSample
float FFTSample
Definition: avfft.h:35
index
int index
Definition: gxfenc.c:89
for
for(j=16;j >0;--j)
Definition: h264pred_template.c:469
size
int size
Definition: twinvq_data.h:10344
N
#define N
Definition: af_mcompand.c:54
a0
#define a0
Definition: regdef.h:46
SRC
#define SRC(x, y)
Definition: h264pred_template.c:847
in
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
Definition: audio_convert.c:326
i
int i
Definition: input.c:407
t4
#define t4
Definition: regdef.h:32
t3
#define t3
Definition: regdef.h:31
a2
#define a2
Definition: regdef.h:48
fft_dispatch
static void(*const fft_dispatch[])(FFTComplex *)
Definition: tx_template.c:357
t2
#define t2
Definition: regdef.h:30
TX_NAME
FFTComplex TX_NAME(ff_cos_53)[4]
DST
#define DST(x, y)
Definition: vp9dsp_template.c:781
av_log2
int av_log2(unsigned v)
Definition: intmath.c:26
a3
#define a3
Definition: regdef.h:49
FFTComplex
Definition: avfft.h:37