Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@amazon.com>2023-10-29 09:20:35 +0300
committerJean-Marc Valin <jmvalin@amazon.com>2023-10-29 09:20:35 +0300
commit4259d354df7159e44b580257981635611ed075ab (patch)
tree4c79eaf8255b61f5725905ab12dc281d3d319943
parentb22b11a412977570ef0a8581cb7ebc9edbaf4e39 (diff)
Reusing already-optimized celt_fir()
-rw-r--r--dnn/lpcnet_enc.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/dnn/lpcnet_enc.c b/dnn/lpcnet_enc.c
index 4082a54c..bd06976f 100644
--- a/dnn/lpcnet_enc.c
+++ b/dnn/lpcnet_enc.c
@@ -42,6 +42,7 @@
#include "lpcnet.h"
#include "os_support.h"
#include "_kiss_fft_guts.h"
+#include "celt_lpc.h"
int lpcnet_encoder_get_size(void) {
@@ -98,6 +99,7 @@ void compute_frame_features(LPCNetEncState *st, const float *in) {
float xcorr[PITCH_MAX_PERIOD];
float ener0;
float ener;
+ float x[FRAME_SIZE+LPC_ORDER];
/* [b,a]=ellip(2, 2, 20, 1200/8000); */
static const float lp_b[2] = {-0.84946f, 1.f};
static const float lp_a[2] = {-1.54220f, 0.70781f};
@@ -131,16 +133,13 @@ void compute_frame_features(LPCNetEncState *st, const float *in) {
OPUS_MOVE(st->exc_buf, &st->exc_buf[FRAME_SIZE], PITCH_MAX_PERIOD);
OPUS_MOVE(st->lp_buf, &st->lp_buf[FRAME_SIZE], PITCH_MAX_PERIOD);
OPUS_COPY(&aligned_in[TRAINING_OFFSET], in, FRAME_SIZE-TRAINING_OFFSET);
+ OPUS_COPY(&x[0], st->pitch_mem, LPC_ORDER);
+ OPUS_COPY(&x[LPC_ORDER], aligned_in, FRAME_SIZE);
+ OPUS_COPY(st->pitch_mem, &aligned_in[FRAME_SIZE-LPC_ORDER], LPC_ORDER);
+ celt_fir(&x[LPC_ORDER], st->lpc, &st->lp_buf[PITCH_MAX_PERIOD], FRAME_SIZE, LPC_ORDER, st->arch);
for (i=0;i<FRAME_SIZE;i++) {
- int j;
- float sum = aligned_in[i];
- for (j=0;j<LPC_ORDER;j++)
- sum += st->lpc[j]*st->pitch_mem[j];
- OPUS_MOVE(st->pitch_mem+1, st->pitch_mem, LPC_ORDER-1);
- st->pitch_mem[0] = aligned_in[i];
- st->lp_buf[PITCH_MAX_PERIOD+i] = sum;
- st->exc_buf[PITCH_MAX_PERIOD+i] = sum + .7f*st->pitch_filt;
- st->pitch_filt = sum;
+ st->exc_buf[PITCH_MAX_PERIOD+i] = st->lp_buf[PITCH_MAX_PERIOD+i] + .7f*st->pitch_filt;
+ st->pitch_filt = st->lp_buf[PITCH_MAX_PERIOD+i];
/*printf("%f\n", st->exc_buf[PITCH_MAX_PERIOD+i]);*/
}
biquad(&st->lp_buf[PITCH_MAX_PERIOD], st->lp_mem, &st->lp_buf[PITCH_MAX_PERIOD], lp_b, lp_a, FRAME_SIZE);