[FFmpeg-devel] [PATCH] Port FFT domain filter.

Michael Niedermayer michaelni at gmx.at
Thu Feb 26 12:22:19 CET 2015


On Thu, Feb 26, 2015 at 01:41:08PM +0530, arwa arif wrote:
> I have updated the patch.
> 
> Can you please explain me which user options to include?

yes
it could be similar to the vf_geq.c flter

so something like
-vf fftfilt=dc=128:lum="'(1 / (1 + exp(-Y/10.0+H/100.0)))'"

could result in the equivalent of this:

@@ -97,6 +98,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)

     av_rdft_end(fftfilt->rdft);

+    for (i = 0; i < rdft_hlen; i++)
+    {
+        for (j = 0; j < rdft_vlen; j++)
+            fftfilt->rdft_vdata[i * rdft_vlen + j] *= (1 / (1 + exp(-j/10.0+h/100.0)));
+    }
+    fftfilt->rdft_vdata[0] += rdft_hlen * rdft_vlen * 128;
+
     /*Vertical pass - IRDFT*/
     fftfilt->rdft = av_rdft_init(rdft_vbits, IDFT_C2R);




further comments below

[...]
> +    /* RDFT - Array initialization for Horizontal pass*/
> +    for (rdft_hbits = 1; 1 << rdft_hbits < 2 * w; rdft_hbits++);
> +    rdft_hlen = 1 << rdft_hbits;
> +    fftfilt->rdft_hdata = av_malloc_array(h, rdft_hlen * sizeof(FFTSample));
> +
> +    /* RDFT - Array initialization for Vertical pass*/
> +    for (rdft_vbits = 1; 1 << rdft_vbits < 2 * h; rdft_vbits++);

without the 2 * the code will be faster


> +    rdft_vlen = 1 << rdft_vbits;

> +    fftfilt->rdft_vdata = av_malloc_array(w, rdft_hlen * rdft_vlen * sizeof(FFTSample));

ftfilt->rdft_vdata = av_malloc_array(rdft_hlen, rdft_vlen * sizeof(FFTSample));
that is without the w

also the av_malloc_array return values need to be checked, the functions
could fail if there is npt enough memory

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150226/17650f23/attachment.asc>


More information about the ffmpeg-devel mailing list