Advertisement
Guest User

Untitled

a guest
Jan 6th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
  2. {
  3.   FFTContext fftctx;
  4.   int chan;
  5.  
  6.   for (chan = 0; chan < inlink->channels; chan++) {
  7.     FFTComplex *data = av_calloc(sizeof(*data), frame->nb_samples);
  8.     int i;
  9.     ff_fft_init(&fftctx, (int)log2((float)frame->nb_samples), 0);
  10.     for (i = 0; i < frame->nb_samples; i++)
  11.       data[i].re = frame->extended_data[chan][i];
  12.     fftctx.fft_permute(&fftctx, data);
  13.     fftctx.fft_calc(&fftctx, data);
  14.     ff_fft_end(&fftctx);
  15.     /* Inverse. */
  16.     ff_fft_init(&fftctx, (int)log2((float)frame->nb_samples), 1);
  17.     fftctx.fft_permute(&fftctx, data);
  18.     fftctx.fft_calc(&fftctx, data);
  19.     ff_fft_end(&fftctx);
  20.     for (i = 0; i < frame->nb_samples; i++)
  21.       frame->extended_data[chan][i] = data[i].re;
  22.     av_free(data);
  23.   }
  24.   return ff_filter_frame(ctx->outputs[0], frame);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement