[FFmpeg-devel] [PATCH] avfilter: add arbitrary audio FIR filter
Paul B Mahol
onemda at gmail.com
Mon May 8 11:43:24 EEST 2017
On 5/8/17, Muhammad Faiz <mfcc64 at gmail.com> wrote:
> On Mon, May 8, 2017 at 1:22 AM, Paul B Mahol <onemda at gmail.com> wrote:
>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>> ---
>> configure | 2 +
>> doc/filters.texi | 30 +++
>> libavfilter/Makefile | 1 +
>> libavfilter/af_afir.c | 541
>> +++++++++++++++++++++++++++++++++++++++++++++++
>> libavfilter/allfilters.c | 1 +
>> 5 files changed, 575 insertions(+)
>> create mode 100644 libavfilter/af_afir.c
>>
>> + at item auto
>> +Enable auto gain calculation of Impulse Response coefficients.
>> +By default is enabled.
>> + at end table
>> +
>
> Probably, these options aren't required if algo is correct.
Which ones? All of them or just last one?
>> + for (i = 0; i < s->nb_partitions; i++) {
>> + const int coffset = i * (s->part_size + 1);
>> +
>> + for (n = 0; n < s->part_size; n++) {
>> + const float cre = coeff[coffset + n].re;
>> + const float cim = coeff[coffset + n].im;
>> + const float tre = block[2 * n ];
>> + const float tim = block[2 * n + 1];
>> +
>> + sum[2 * n ] += tre * cre - tim * cim;
>> + sum[2 * n + 1] += tre * cim + tim * cre;
>> + }
>> + sum[2 * n] += block[2 * n] * coeff[coffset + n].re;
>> + }
>
> This is still wrong.
> As I read in articles, each ir partition is convoluted with different
> data block.
Hmm, could you re-check it? The code I looked doesn't do that.
> Test:
>
> aevalsrc = 'if(n, 0, 1)',
> firequalizer =
> delay = 0.023:
> fixed = on:
> wfunc = nuttall:
> gain = 'if(between(f, 1000, 5000), -INF, 0)',
> atrim = end_sample = 2048 [ir];
The size of IR is too short. If I increase it to 12048 I get desired output.
>
> aevalsrc = '0.7*sin(3000*t*t)' [data];
>
> [data][ir]
> afir,
> asplit [out0],
> showspectrum=s=1024x512:win_func=nuttall,
> format = rgb24 [out1]
>
>
More information about the ffmpeg-devel
mailing list