From: Paul B Mahol Date: Thu, 27 Aug 2020 16:49:02 +0000 (+0200) Subject: avfilter/af_arnndn: use scalarproduct_float() in dct function X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=ace1cc616308ef8f4aedc7814778b08eca2fd92b;p=ffmpeg avfilter/af_arnndn: use scalarproduct_float() in dct function --- diff --git a/libavfilter/af_arnndn.c b/libavfilter/af_arnndn.c index d2722fb2023..123bc451578 100644 --- a/libavfilter/af_arnndn.c +++ b/libavfilter/af_arnndn.c @@ -141,7 +141,7 @@ typedef struct AudioRNNContext { DenoiseState *st; DECLARE_ALIGNED(32, float, window)[WINDOW_SIZE]; - float dct_table[NB_BANDS*NB_BANDS]; + DECLARE_ALIGNED(32, float, dct_table)[FFALIGN(NB_BANDS, 4)][FFALIGN(NB_BANDS, 4)]; RNNModel *model; @@ -991,11 +991,9 @@ static void pitch_search(const float *x_lp, float *y, static void dct(AudioRNNContext *s, float *out, const float *in) { for (int i = 0; i < NB_BANDS; i++) { - float sum = 0.f; + float sum; - for (int j = 0; j < NB_BANDS; j++) { - sum += in[j] * s->dct_table[j * NB_BANDS + i]; - } + sum = s->fdsp->scalarproduct_float(in, s->dct_table[i], FFALIGN(NB_BANDS, 4)); out[i] = sum * sqrtf(2.f / 22); } } @@ -1006,7 +1004,7 @@ static int compute_frame_features(AudioRNNContext *s, DenoiseState *st, AVComple float E = 0; float *ceps_0, *ceps_1, *ceps_2; float spec_variability = 0; - float Ly[NB_BANDS]; + LOCAL_ALIGNED_32(float, Ly, [NB_BANDS]); LOCAL_ALIGNED_32(float, p, [WINDOW_SIZE]); float pitch_buf[PITCH_BUF_SIZE>>1]; int pitch_index; @@ -1348,7 +1346,7 @@ static float rnnoise_channel(AudioRNNContext *s, DenoiseState *st, float *out, c AVComplexFloat P[WINDOW_SIZE]; float x[FRAME_SIZE]; float Ex[NB_BANDS], Ep[NB_BANDS]; - float Exp[NB_BANDS]; + LOCAL_ALIGNED_32(float, Exp, [NB_BANDS]); float features[NB_FEATURES]; float g[NB_BANDS]; float gf[FREQ_SIZE]; @@ -1476,9 +1474,9 @@ static av_cold int init(AVFilterContext *ctx) for (int i = 0; i < NB_BANDS; i++) { for (int j = 0; j < NB_BANDS; j++) { - s->dct_table[i*NB_BANDS + j] = cosf((i + .5f) * j * M_PI / NB_BANDS); + s->dct_table[j][i] = cosf((i + .5f) * j * M_PI / NB_BANDS); if (j == 0) - s->dct_table[i*NB_BANDS + j] *= sqrtf(.5); + s->dct_table[j][i] *= sqrtf(.5); } }