ref: 9d0425d88be5de3278f687f766df1f0b3d14005a
parent: f5821193e61292280accd10c77fb24bcf6be1fc0
author: Jean-Marc Valin <jmvalin@amazon.com>
date: Fri Nov 24 08:23:52 EST 2023
Remove feature writing (fwrite()) from libopus
--- a/dnn/dump_data.c
+++ b/dnn/dump_data.c
@@ -263,7 +263,8 @@
}
fwrite(pitch_features, PITCH_MAX_PERIOD-PITCH_MIN_PERIOD+PITCH_IF_FEATURES, 1, ffeat);
} else {
- process_single_frame(st, ffeat);
+ process_single_frame(st);
+ fwrite(st->features, sizeof(float), NB_TOTAL_FEATURES, ffeat);
}
/*if(pitch) fwrite(pcm, FRAME_SIZE, 2, stdout);*/
if (fpcm) write_audio(st, pcm, noisebuf, fpcm);
--- a/dnn/lpcnet_enc.c
+++ b/dnn/lpcnet_enc.c
@@ -168,7 +168,7 @@
st->dnn_pitch = compute_pitchdnn(&st->pitchdnn, st->if_features, st->xcorr_features, arch);
}
-void process_single_frame(LPCNetEncState *st, FILE *ffeat) {
+void process_single_frame(LPCNetEncState *st) {
float frame_corr;
float xy, xx, yy;
/*int pitch = (best[2]+best[3])/2;*/
@@ -181,9 +181,6 @@
frame_corr = log(1.f+exp(5.f*frame_corr))/log(1+exp(5.f));
st->features[NB_BANDS] = st->dnn_pitch;
st->features[NB_BANDS + 1] = frame_corr-.5f;
- if (ffeat) {
- fwrite(st->features, sizeof(float), NB_TOTAL_FEATURES, ffeat);
- }
}
void preemphasis(float *y, float *mem, const float *x, float coef, int N) {
@@ -199,7 +196,7 @@
static int lpcnet_compute_single_frame_features_impl(LPCNetEncState *st, float *x, float features[NB_TOTAL_FEATURES], int arch) {
preemphasis(x, &st->mem_preemph, x, PREEMPHASIS, FRAME_SIZE);
compute_frame_features(st, x, arch);
- process_single_frame(st, NULL);
+ process_single_frame(st);
OPUS_COPY(features, &st->features[0], NB_TOTAL_FEATURES);
return 0;
}
--- a/dnn/lpcnet_private.h
+++ b/dnn/lpcnet_private.h
@@ -77,9 +77,7 @@
void lpcnet_synthesize_tail_impl(LPCNetState *lpcnet, opus_int16 *output, int N, int preload);
void lpcnet_synthesize_impl(LPCNetState *lpcnet, const float *features, opus_int16 *output, int N, int preload);
void lpcnet_synthesize_blend_impl(LPCNetState *lpcnet, const opus_int16 *pcm_in, opus_int16 *output, int N);
-void process_single_frame(LPCNetEncState *st, FILE *ffeat);
-
-void process_single_frame(LPCNetEncState *st, FILE *ffeat);
+void process_single_frame(LPCNetEncState *st);
void run_frame_network(LPCNetState *lpcnet, float *gru_a_condition, float *gru_b_condition, float *lpc, const float *features);
--
⑨