[FFmpeg-devel] [PATCH] avfilter: add arnndn filter
Paul B Mahol
onemda at gmail.com
Fri Sep 27 19:38:36 EEST 2019
On 7/27/19, Lynne <dev at lynne.ee> wrote:
> Jul 26, 2019, 4:37 PM by onemda at gmail.com <mailto:onemda at gmail.com>:
>> +static void biquad(float *y, float mem[2], const float *x,
>> + const float *b, const float *a, int N)
>> +{
>> + for (int i = 0; i < N; i++) {
>> + float xi, yi;
>> + xi = x[i];
>> + yi = x[i] + mem[0];
>> + mem[0] = mem[1] + (b[0]*(double)xi - a[0]*(double)yi);
>> + mem[1] = (b[1]*(double)xi - a[1]*(double)yi);
>> + y[i] = yi;
>> + }
>> +}
>
> Do you really need double precision here?
>
Removed.
>
>> +static void apply_window(float *x, float *half_window)
>> +{
>> + for (int i = 0; i < FRAME_SIZE; i++) {
>> + x[i] *= half_window[i];
>> + x[WINDOW_SIZE - 1 - i] *= half_window[i];
>> + }
>> +}
>
> Use vector_fmul_window.
Cant use that, but use another one.
>
>
>> +#define FRAME_SIZE_SHIFT 2
>> +#define FRAME_SIZE (120<<FRAME_SIZE_SHIFT)
>> +#define WINDOW_SIZE (2*FRAME_SIZE)
>> +#define FREQ_SIZE (FRAME_SIZE + 1)
>>
>> + AVComplexFloat y[WINDOW_SIZE];
>>
>> + st->tx_fn(st->tx, y, x, 0);
>> +
>> + for (int i = 0; i < FREQ_SIZE; i++) {
>> + out[i] = y[i];
>> + }
>
> Make y and x aligned and set the tx stride to sizeof(float) for when SIMD is
> implemented.
> I can't see how this could even work with stride = 0.
> Why is FREQ_SIZE = FRAME_SIZE + 1?
>
>
>> + st->tx_fn(st->tx, y, x, 0);
>> +
>> + /* output in reverse order for IFFT. */
>> + out[0] = y[0].re / WINDOW_SIZE;
>> + for (i=1; i < WINDOW_SIZE; i++) {
>> + out[i] = y[WINDOW_SIZE - i].re / WINDOW_SIZE;
>> + }
>
> Make another tx context for an inverse transform, also same as above, and
> use float_dsp to divide all by WINDOW_SIZE.
>
>
>> + for (int i=0;i<FRAME_SIZE;i++)
>> + out[i] = x[i] + st->synthesis_mem[i]
>
> float_dsp? If you can afford to overwrite and overread the arrays odd sizes
> will work.
>
There is not such function.
>
>> + for (int i = 0; i < FRAME_SIZE; i++)
>> + s->half_window[i] = sin(.5*M_PI*sin(.5*M_PI*(i+.5)/FRAME_SIZE) *
>> sin(.5*M_PI*(i+.5)/FRAME_SIZE));
>
> Just copy ff_celt_window and use it.
>
>
That does something else.
> Also fix coding style and upload a weights file somewhere.
Weights are available on github.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list