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

#define INIT_FF_COS_TABS_FUNC (   index,
  size 
)
Value:
static av_cold void init_cos_tabs_ ## size (void) \
{ \
}
static av_always_inline void init_cos_tabs_idx(int index)
Definition: tx_template.c:63
#define av_cold
Definition: attributes.h:82
ptrdiff_t size
Definition: opengl_enc.c:100
int index
Definition: gxfenc.c:89

Definition at line 74 of file tx_template.c.

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

Definition at line 165 of file tx_template.c.

#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);\
}
#define a0
Definition: regdef.h:46
#define a1
Definition: regdef.h:47
#define a3
Definition: regdef.h:49
#define t1
Definition: regdef.h:29
#define t3
Definition: regdef.h:31
#define a2
Definition: regdef.h:48
#define t5
Definition: regdef.h:33
#define t6
Definition: regdef.h:34
#define t4
Definition: regdef.h:32
#define BF(a, b, c, s)
#define t2
Definition: regdef.h:30

Definition at line 277 of file tx_template.c.

Referenced by fft8().

#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);\
}
#define a0
Definition: regdef.h:46
#define a1
Definition: regdef.h:47
#define a3
Definition: regdef.h:49
#define t1
Definition: regdef.h:29
#define t3
Definition: regdef.h:31
float FFTSample
Definition: avfft.h:35
#define a2
Definition: regdef.h:48
#define t5
Definition: regdef.h:33
#define t6
Definition: regdef.h:34
#define t4
Definition: regdef.h:32
#define BF(a, b, c, s)
#define t2
Definition: regdef.h:30

Definition at line 229 of file tx_template.c.

#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);\
}
#define a0
Definition: regdef.h:46
#define BUTTERFLIES(a0, a1, a2, a3)
Definition: tx_template.c:277
#define a1
Definition: regdef.h:47
#define a3
Definition: regdef.h:49
#define CMUL(dre, dim, are, aim, bre, bim)
Definition: fft-internal.h:76
#define t1
Definition: regdef.h:29
#define a2
Definition: regdef.h:48
#define t5
Definition: regdef.h:33
#define t6
Definition: regdef.h:34
#define t2
Definition: regdef.h:30

Definition at line 239 of file tx_template.c.

Referenced by fft16(), and fft8().

#define TRANSFORM_ZERO (   a0,
  a1,
  a2,
  a3 
)
Value:
{\
t1 = a2.re;\
t2 = a2.im;\
t5 = a3.re;\
t6 = a3.im;\
}
#define a0
Definition: regdef.h:46
#define BUTTERFLIES(a0, a1, a2, a3)
Definition: tx_template.c:277
#define a1
Definition: regdef.h:47
#define a3
Definition: regdef.h:49
#define t1
Definition: regdef.h:29
#define a2
Definition: regdef.h:48
#define t5
Definition: regdef.h:33
#define t6
Definition: regdef.h:34
#define t2
Definition: regdef.h:30

Definition at line 245 of file tx_template.c.

Referenced by fft16().

#define PASS (   name)
Value:
static void name(FFTComplex *z, const FFTSample *wre, unsigned int n)\
{\
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);\
}
#define t1
Definition: regdef.h:29
#define t3
Definition: regdef.h:31
float FFTSample
Definition: avfft.h:35
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 keep it simple and lowercase description are in without and describe what they do
#define t5
Definition: regdef.h:33
int
#define TRANSFORM(a0, a1, a2, a3, wre, wim)
Definition: tx_template.c:239
#define t6
Definition: regdef.h:34
#define TRANSFORM_ZERO(a0, a1, a2, a3)
Definition: tx_template.c:245
#define t4
Definition: regdef.h:32
#define t2
Definition: regdef.h:30
const char * name
Definition: opengl_enc.c:102

Definition at line 254 of file tx_template.c.

#define BUTTERFLIES   BUTTERFLIES_BIG

Definition at line 277 of file tx_template.c.

#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);\
}
FFTComplex TX_NAME(ff_cos_53)[4]
#define pass
Definition: tx_template.c:347

Definition at line 280 of file tx_template.c.

Referenced by fft16().

#define pass   pass_big

Definition at line 347 of file tx_template.c.

#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]; \
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]]; \
}
int av_log2(unsigned v)
Definition: intmath.c:26
void FFTComplex
Definition: tx_priv.h:45
#define N
Definition: af_mcompand.c:54
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
static void(*const fft_dispatch[])(FFTComplex *)
Definition: tx_template.c:357
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
#define s(width, name)
Definition: cbs_vp9.c:257
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
GLint GLenum GLboolean GLsizei stride
Definition: opengl_enc.c:104
FILE * out
Definition: movenc.c:54
for(j=16;j >0;--j)

Definition at line 362 of file tx_template.c.

#define DECL_COMP_IMDCT (   N)

Definition at line 400 of file tx_template.c.

#define DECL_COMP_MDCT (   N)

Definition at line 442 of file tx_template.c.

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

Referenced by ff_tx_init_mdct_fft().

Function Documentation

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  )

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

static av_always_inline void init_cos_tabs_idx ( int  index)
static

Definition at line 63 of file tx_template.c.

static av_cold void ff_init_53_tabs ( void  )
static

Definition at line 95 of file tx_template.c.

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().

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().

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

Definition at line 204 of file tx_template.c.

static void fft2 ( FFTComplex z)
static

Definition at line 289 of file tx_template.c.

static void fft4 ( FFTComplex z)
static

Definition at line 297 of file tx_template.c.

Referenced by fft16(), and fft8().

static void fft8 ( FFTComplex z)
static

Definition at line 311 of file tx_template.c.

Referenced by fft16().

static void fft16 ( FFTComplex z)
static

Definition at line 326 of file tx_template.c.

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().

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

Definition at line 490 of file tx_template.c.

Referenced by ff_tx_init_mdct_fft().

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

Definition at line 519 of file tx_template.c.

Referenced by ff_tx_init_mdct_fft().

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

Definition at line 556 of file tx_template.c.

Referenced by 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 573 of file tx_template.c.

Variable Documentation

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),
}
#define NULL
Definition: coverity.c:32
FFTComplex TX_NAME(ff_cos_53)[4]

Definition at line 42 of file tx_template.c.

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 },
}
#define NULL
Definition: coverity.c:32
static av_cold void ff_init_53_tabs(void)
Definition: tx_template.c:95
#define AV_ONCE_INIT
Definition: thread.h:173

Definition at line 103 of file tx_template.c.

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
}
#define NULL
Definition: coverity.c:32
static void fft8(FFTComplex *z)
Definition: tx_template.c:311
static void fft16(FFTComplex *z)
Definition: tx_template.c:326
static void fft2(FFTComplex *z)
Definition: tx_template.c:289
static void fft4(FFTComplex *z)
Definition: tx_template.c:297

Definition at line 357 of file tx_template.c.

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