libavcodec/fft.c File Reference

FFT/IFFT transforms. More...

#include <stdlib.h>
#include <string.h>
#include "libavutil/mathematics.h"
#include "fft.h"

Go to the source code of this file.

Defines

#define sqrthalf   (float)M_SQRT1_2
#define BF(x, y, a, b)
#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

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)
static void ff_fft_permute_c (FFTContext *s, FFTComplex *z)
static void ff_fft_calc_c (FFTContext *s, FFTComplex *z)
static int split_radix_permutation (int i, int n, int inverse)
av_cold void ff_init_ff_cos_tabs (int index)
 Initialize the cosine table in ff_cos_tabs[index].
av_cold int ff_fft_init (FFTContext *s, int nbits, int inverse)
 Set up a complex FFT.
av_cold void ff_fft_end (FFTContext *s)
static void fft4 (FFTComplex *z)
static void fft8 (FFTComplex *z)
static void fft16 (FFTComplex *z)

Variables

COSTABLE_CONST FFTSample *const ff_cos_tabs []
static void(*const fft_dispatch [])(FFTComplex *)


Detailed Description

FFT/IFFT transforms.

Definition in file fft.c.


Define Documentation

#define BF ( x,
y,
a,
 ) 

Value:

{\
    x = a - b;\
    y = a + b;\
}

Definition at line 149 of file fft.c.

#define BUTTERFLIES   BUTTERFLIES_BIG

Definition at line 216 of file fft.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);\
}

Definition at line 216 of file fft.c.

#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 166 of file fft.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,ff_cos_##n,n4/2);\
}

Definition at line 219 of file fft.c.

#define pass   pass_big

#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 193 of file fft.c.

#define sqrthalf   (float)M_SQRT1_2

Definition at line 147 of file fft.c.

Referenced by fft16(), and fft8().

#define TRANSFORM ( a0,
a1,
a2,
a3,
wre,
wim   ) 

Value:

{\
    t1 = a2.re * wre + a2.im * wim;\
    t2 = a2.im * wre - a2.re * wim;\
    t5 = a3.re * wre - a3.im * wim;\
    t6 = a3.im * wre + a3.re * wim;\
    BUTTERFLIES(a0,a1,a2,a3)\
}

Definition at line 176 of file fft.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;\
    BUTTERFLIES(a0,a1,a2,a3)\
}

Definition at line 184 of file fft.c.

Referenced by fft16().


Function Documentation

COSTABLE ( 65536   ) 

COSTABLE ( 32768   ) 

COSTABLE ( 16384   ) 

COSTABLE ( 8192   ) 

COSTABLE ( 4096   ) 

COSTABLE ( 2048   ) 

COSTABLE ( 1024   ) 

COSTABLE ( 512   ) 

COSTABLE ( 256   ) 

COSTABLE ( 128   ) 

COSTABLE ( 64   ) 

COSTABLE ( 32   ) 

COSTABLE ( 16   ) 

static void ff_fft_calc_c ( FFTContext s,
FFTComplex z 
) [static]

Definition at line 300 of file fft.c.

Referenced by ff_fft_init().

av_cold void ff_fft_end ( FFTContext s  ) 

Definition at line 141 of file fft.c.

Referenced by av_fft_end(), ff_mdct_end(), ff_rdft_end(), imc_decode_close(), and main().

av_cold int ff_fft_init ( FFTContext s,
int  nbits,
int  inverse 
)

Set up a complex FFT.

Parameters:
nbits log2 of the length of the input array
inverse if 0 perform the forward transform, if 1 perform the inverse

Definition at line 84 of file fft.c.

Referenced by av_fft_init(), ff_mdct_init(), ff_rdft_init(), imc_decode_init(), and main().

static void ff_fft_permute_c ( FFTContext s,
FFTComplex z 
) [static]

Definition at line 131 of file fft.c.

Referenced by ff_fft_init().

av_cold void ff_init_ff_cos_tabs ( int  index  ) 

Initialize the cosine table in ff_cos_tabs[index].

Parameters:
index index in ff_cos_tabs array of the table to initialize

Definition at line 70 of file fft.c.

Referenced by ff_dct_init(), ff_fft_init(), and ff_rdft_init().

static void fft16 ( FFTComplex z  )  [static]

Definition at line 263 of file fft.c.

static void fft4 ( FFTComplex z  )  [static]

Definition at line 228 of file fft.c.

Referenced by fft16(), and fft8().

static void fft8 ( FFTComplex z  )  [static]

Definition at line 242 of file fft.c.

Referenced by fft16().

static int split_radix_permutation ( int  i,
int  n,
int  inverse 
) [static]

Definition at line 59 of file fft.c.

Referenced by ff_fft_init().


Variable Documentation

COSTABLE_CONST FFTSample* const ff_cos_tabs[]

Initial value:

 {
    NULL, NULL, NULL, NULL,
    ff_cos_16, ff_cos_32, ff_cos_64, ff_cos_128, ff_cos_256, ff_cos_512, ff_cos_1024,
    ff_cos_2048, ff_cos_4096, ff_cos_8192, ff_cos_16384, ff_cos_32768, ff_cos_65536,
}

Definition at line 50 of file fft.c.

Referenced by ff_dct_init(), ff_init_ff_cos_tabs(), and ff_rdft_init().

void(* const fft_dispatch[])(FFTComplex *) [static]

Initial value:

 {
    fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024,
    fft2048, fft4096, fft8192, fft16384, fft32768, fft65536,
}

Referenced by ff_fft_calc_c().


Generated on Mon May 2 19:50:17 2011 for FFmpeg by  doxygen 1.5.6