Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
- {
- FFTContext fftctx;
- int chan;
- for (chan = 0; chan < inlink->channels; chan++) {
- FFTComplex *data = av_calloc(sizeof(*data), frame->nb_samples);
- int i;
- ff_fft_init(&fftctx, (int)log2((float)frame->nb_samples), 0);
- for (i = 0; i < frame->nb_samples; i++)
- data[i].re = frame->extended_data[chan][i];
- fftctx.fft_permute(&fftctx, data);
- fftctx.fft_calc(&fftctx, data);
- ff_fft_end(&fftctx);
- /* Inverse. */
- ff_fft_init(&fftctx, (int)log2((float)frame->nb_samples), 1);
- fftctx.fft_permute(&fftctx, data);
- fftctx.fft_calc(&fftctx, data);
- ff_fft_end(&fftctx);
- for (i = 0; i < frame->nb_samples; i++)
- frame->extended_data[chan][i] = data[i].re;
- av_free(data);
- }
- return ff_filter_frame(ctx->outputs[0], frame);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement