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

Michael Niedermayer michaelni at gmx.at
Tue Mar 3 13:41:25 CET 2015


On Tue, Mar 03, 2015 at 12:06:09PM +0530, arwa arif wrote:
> I tried to change the name to fft, but it is conflicting with
> libavcodec/fft. So, I am unable to change that. I have updated the patch,
> adding support to coloured images.

yes, the names could conflict in configure indeed


[...]
> +
> +#include "libavfilter/internal.h"
> +#include "libavutil/common.h"
> +#include "libavutil/imgutils.h"
> +#include "libavutil/opt.h"
> +#include "libavutil/pixdesc.h"
> +#include "libavcodec/avfft.h"
> +#include "libavutil/eval.h"
> +
> +typedef struct {
> +    const AVClass *class;
> +
> +    RDFTContext *rdft;
> +    int rdft_hbits[3];
> +    int rdft_vbits[3];
> +    size_t rdft_hlen[3];
> +    size_t rdft_vlen[3];
> +    FFTSample *rdft_hdata[3];
> +    FFTSample *rdft_vdata[3];
> +
> +    int dc;
> +    char *lum_str;
> +    AVExpr *lum_expr;
> +    double *lum_data;
> +
> +} FFTFILTContext;
> +
> +static const char *const var_names[] = {   "X",   "Y",   "W",   "H",     NULL    };
> +enum                                   { VAR_X, VAR_Y, VAR_W, VAR_H, VAR_VARS_NB };
> +
> +#define OFFSET(x) offsetof(FFTFILTContext, x)
> +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
> +

> +static const AVOption fftfilt_options[] = {
> +    { "dc",  "adjust gain",              OFFSET(dc),      AV_OPT_TYPE_INT,    {.i64 = 0},      0,     1000,     FLAGS },
> +    { "lum", "set luminance expression", OFFSET(lum_str), AV_OPT_TYPE_STRING, {.str = "1"}, CHAR_MIN, CHAR_MAX, FLAGS },
> +    {NULL},

The user should be able to set seperate dc / "lum" for teh 3 planes
that is if only the first dc and first exression is set then they
should be used for all 3 planes
otherwise, if teh user set 3 dc values and 3 expressions then each
plane should use the specific expression



[...]
> +
> +        memset(fftfilt->rdft_hdata[plane] + i * fftfilt->rdft_hlen[plane], 0,
> +               fftfilt->rdft_hlen[plane] * sizeof(*fftfilt->rdft_hdata[plane]));

the memseting should ideally be replaced by mirroring, this leads
to better quality

for example
matrixbench_mpeg2.mpg -vf fftfilt=dc=128:lum="'(1 / (1 + exp(-(Y+X)/10.0+H/100.0)))'"
results in a pink border due to this

that is instead of for each line
1 2 3 3 7 9 10 11 23
it should not be changed to:
1 2 3 3 7 9 10 11 23  0  0  0  0  0  0  0
but
1 2 3 3 7 9 10 11 23 23 11 10  x  3  2  1

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- 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/20150303/5ec8f942/attachment.asc>


More information about the ffmpeg-devel mailing list