Go to the documentation of this file.
   64 #define MUL16(a, b) ((a) * (b)) 
   66 #define CMAC(pre, pim, are, aim, bre, bim)          \ 
   68         pre += (MUL16(are, bre) - MUL16(aim, bim)); \ 
   69         pim += (MUL16(are, bim) + MUL16(bre, aim)); \ 
   72 #if FFT_FLOAT || AVFFT 
   74 #define REF_SCALE(x, bits)  (x) 
   78 #define REF_SCALE(x, bits) (x) 
   88     int i, n = 1 << nbits;
 
   94     for (
i = 0; 
i < (n / 2); 
i++) {
 
  111     for (
i = 0; 
i < n; 
i++) {
 
  112         double tmp_re = 0, tmp_im = 0;
 
  114         for (j = 0; j < n; j++) {
 
  116             int k = (
i * j) & (n - 1);
 
  135     int i, k, n = 1 << nbits;
 
  137     for (
i = 0; 
i < n; 
i++) {
 
  139         for (k = 0; k < n / 2; k++) {
 
  140             int a = (2 * 
i + 1 + (n / 2)) * (2 * k + 1);
 
  141             double f = cos(
M_PI * 
a / (
double) (2 * n));
 
  151     int i, k, n = 1 << nbits;
 
  154     for (k = 0; k < n / 2; k++) {
 
  156         for (
i = 0; 
i < n; 
i++) {
 
  157             double a = (2 * 
M_PI * (2 * 
i + 1 + n / 2) * (2 * k + 1) / (4 * n));
 
  169     int i, k, n = 1 << nbits;
 
  172     for (
i = 0; 
i < n; 
i++) {
 
  173         double s = 0.5 * 
input[0];
 
  174         for (k = 1; k < n; k++) {
 
  175             double a = 
M_PI * k * (
i + 0.5) / n;
 
  184     int i, k, n = 1 << nbits;
 
  187     for (k = 0; k < n; k++) {
 
  189         for (
i = 0; 
i < n; 
i++) {
 
  190             double a = 
M_PI * k * (
i + 0.5) / n;
 
  209     for (
i = 0; 
i < n; 
i++) {
 
  267     s->fft_permute(
s, z);
 
  322     r->rdft_calc(
r, 
tab);
 
  357            "usage: fft-test [-h] [-s] [-i] [-n b]\n" 
  358            "-h     print this help\n" 
  363            "-i     inverse transform test\n" 
  364            "-n b   set the transform size to 2^b\n" 
  365            "-f x   set scale factor for output data of (I)MDCT to x\n");
 
  379 int main(
int argc, 
char **argv)
 
  390     int do_speed = 0, do_inverse = 0;
 
  391     int fft_nbits = 9, fft_size;
 
  400 #if !AVFFT && FFT_FLOAT 
  408         int c = 
getopt(argc, argv, 
"hsimrdn:f:c:");
 
  449     fft_size = 1 << fft_nbits;
 
  466         mdct_init(&m, fft_nbits, do_inverse, 
scale);
 
  508     for (
i = 0; 
i < fft_size; 
i++) {
 
  520             imdct_ref(&tab_ref->
re, &
tab1->re, fft_nbits);
 
  524             mdct_ref(&tab_ref->
re, &
tab1->re, fft_nbits);
 
  542         int fft_size_2 = fft_size >> 1;
 
  545             tab1[fft_size_2].im = 0;
 
  546             for (
i = 1; 
i < fft_size_2; 
i++) {
 
  547                 tab1[fft_size_2 + 
i].re =  
tab1[fft_size_2 - 
i].re;
 
  548                 tab1[fft_size_2 + 
i].im = -
tab1[fft_size_2 - 
i].im;
 
  556             for (
i = 0; 
i < fft_size; 
i++) {
 
  562             for (
i = 0; 
i < fft_size; 
i++) {
 
  568             tab_ref[0].
im = tab_ref[fft_size_2].
re;
 
  577         dct_calc(
d, &
tab->re);
 
  579             idct_ref(&tab_ref->
re, &
tab1->re, fft_nbits);
 
  581             dct_ref(&tab_ref->
re, &
tab1->re, fft_nbits);
 
  599             for (
it = 0; 
it < nb_its; 
it++) {
 
  606                         mdct_calc(m, &
tab->re, &
tab1->re);
 
  631                "time: %0.1f us/transform [total time=%0.2f s its=%d]\n",
 
  672 #if !AVFFT && FFT_FLOAT 
  678         printf(
"Error: %d.\n", err);
 
  
static void error(const char *err)
void av_force_cpu_flags(int arg)
Disables cpu detection and forces the specified flags.
#define FF_ENABLE_DEPRECATION_WARNINGS
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
void av_dct_calc(DCTContext *s, FFTSample *data)
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static void imdct_calc(DBEDecodeContext *s1, DBEGroup *g, float *result, float *values)
void av_fft_calc(FFTContext *s, FFTComplex *z)
Do a complex FFT with the parameters defined in av_fft_init().
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
static av_cold void cleanup(FlashSV2Context *s)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
#define CMAC(pre, pim, are, aim, bre, bim)
int av_parse_cpu_caps(unsigned *flags, const char *s)
Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
static const struct twinvq_data tab
av_cold void ff_rdft_end(RDFTContext *s)
#define REF_SCALE(x, bits)
static av_always_inline float scale(float x, float s)
static FFTSample frandom(AVLFG *prng)
int main(int argc, char **argv)
av_cold void av_mdct_end(FFTContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int getopt(int argc, char *argv[], char *opts)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
static void fft_end(FFTContext *s)
void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
static __device__ float fabs(float a)
FFTContext * av_fft_init(int nbits, int inverse)
Set up a complex FFT.
static const int8_t transform[32][32]
static void fft_calc(FFTContext *s, FFTComplex *z)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
av_cold void av_rdft_end(RDFTContext *s)
static void fft_permute(FFTContext *s, FFTComplex *z)
FFTContext * av_mdct_init(int nbits, int inverse, double scale)
Context structure for the Lagged Fibonacci PRNG.
static struct @156 * exptab
printf("static const uint8_t my_array[100] = {\n")
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
av_cold void ff_dct_end(DCTContext *s)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
#define AV_LOG_INFO
Standard information.
void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
Set up a real FFT.
av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
Set up DCT.
#define i(width, name, range_min, range_max)
#define av_malloc_array(a, b)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static int fft_ref_init(int nbits, int inverse)
static void fft_init(FFTContext **s, int nbits, int inverse)
DCTContext * av_dct_init(int nbits, enum DCTTransformType inverse)
Set up DCT.
static void mdct_end(FFTContext *s)
static av_cold int dct_init(MpegEncContext *s)
static int check_diff(FFTSample *tab1, FFTSample *tab2, int n, double scale)
#define FF_DISABLE_DEPRECATION_WARNINGS
void av_rdft_calc(RDFTContext *s, FFTSample *data)
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s it
static const int16_t alpha[]
static void fft_ref(FFTComplex *tabr, FFTComplex *tab, int nbits)
av_cold void av_dct_end(DCTContext *s)
av_cold void av_fft_end(FFTContext *s)
RDFTContext * av_rdft_init(int nbits, enum RDFTransformType trans)
Set up a real FFT.
void av_fft_permute(FFTContext *s, FFTComplex *z)
Do the permutation needed BEFORE calling ff_fft_calc().