mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
avfilter/af_arnndn: use scalarproduct_float() in dct function
This commit is contained in:
parent
0d46043619
commit
ace1cc6163
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user