diff options
author | Paul B Mahol <onemda@gmail.com> | 2020-08-27 18:49:02 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2020-08-27 20:39:33 +0200 |
commit | ace1cc616308ef8f4aedc7814778b08eca2fd92b (patch) | |
tree | 1a4adf7e7181e9d35a9951df417bfa43cd71294e /libavfilter | |
parent | 0d46043619a137ec949f117206b8ee5b776ad7eb (diff) | |
download | ffmpeg-ace1cc616308ef8f4aedc7814778b08eca2fd92b.tar.gz |
avfilter/af_arnndn: use scalarproduct_float() in dct function
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/af_arnndn.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/libavfilter/af_arnndn.c b/libavfilter/af_arnndn.c index d2722fb202..123bc45157 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); } } |