History

avfilter/af_arnndn: use scalarproduct_float() in dct function

Paul B Mahol committed 6 years ago

Commit ace1cc61 parent 0d460431 file · +7 −9Browse files

Unified · Split

libavfilter/af_arnndn.c+7−9
@@ -141,7 +141,7 @@ typedef struct AudioRNNContext { · 140 unmodified lines
141141 DenoiseState *st;
142142
143143 DECLARE_ALIGNED(32, float, window)[WINDOW_SIZE];
144− float dct_table[NB_BANDS*NB_BANDS];
144+ DECLARE_ALIGNED(32, float, dct_table)[FFALIGN(NB_BANDS, 4)][FFALIGN(NB_BANDS, 4)];
145145
146146 RNNModel *model;
147147
@@ -991,11 +991,9 @@ static void pitch_search(const float *x_lp, float *y, · 843 unmodified lines
991991 static void dct(AudioRNNContext *s, float *out, const float *in)
992992 {
993993 for (int i = 0; i < NB_BANDS; i++) {
994− float sum = 0.f;
994+ float sum;
995995
996− for (int j = 0; j < NB_BANDS; j++) {
997− sum += in[j] * s->dct_table[j * NB_BANDS + i];
998− }
996+ sum = s->fdsp->scalarproduct_float(in, s->dct_table[i], FFALIGN(NB_BANDS, 4));
999997 out[i] = sum * sqrtf(2.f / 22);
1000998 }
1001999 }
@@ -1006,7 +1004,7 @@ static int compute_frame_features(AudioRNNContext *s, DenoiseState *st, AVComple · 4 unmodified lines
10061004 float E = 0;
10071005 float *ceps_0, *ceps_1, *ceps_2;
10081006 float spec_variability = 0;
1009− float Ly[NB_BANDS];
1007+ LOCAL_ALIGNED_32(float, Ly, [NB_BANDS]);
10101008 LOCAL_ALIGNED_32(float, p, [WINDOW_SIZE]);
10111009 float pitch_buf[PITCH_BUF_SIZE>>1];
10121010 int pitch_index;
@@ -1348,7 +1346,7 @@ static float rnnoise_channel(AudioRNNContext *s, DenoiseState *st, float *out, c · 335 unmodified lines
13481346 AVComplexFloat P[WINDOW_SIZE];
13491347 float x[FRAME_SIZE];
13501348 float Ex[NB_BANDS], Ep[NB_BANDS];
1351− float Exp[NB_BANDS];
1349+ LOCAL_ALIGNED_32(float, Exp, [NB_BANDS]);
13521350 float features[NB_FEATURES];
13531351 float g[NB_BANDS];
13541352 float gf[FREQ_SIZE];
@@ -1476,9 +1474,9 @@ static av_cold int init(AVFilterContext *ctx) · 121 unmodified lines
14761474
14771475 for (int i = 0; i < NB_BANDS; i++) {
14781476 for (int j = 0; j < NB_BANDS; j++) {
1479− s->dct_table[i*NB_BANDS + j] = cosf((i + .5f) * j * M_PI / NB_BANDS);
1477+ s->dct_table[j][i] = cosf((i + .5f) * j * M_PI / NB_BANDS);
14801478 if (j == 0)
1481− s->dct_table[i*NB_BANDS + j] *= sqrtf(.5);
1479+ s->dct_table[j][i] *= sqrtf(.5);
14821480 }
14831481 }
14841482

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t