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-11-24 21:23:52 +0300
committerJean-Marc Valin <jmvalin@amazon.com>2023-11-24 21:23:52 +0300
commit9d0425d88be5de3278f687f766df1f0b3d14005a (patch)
tree2a3f9c014a69a57da09d8ded9de0a9925db61889
parentf5821193e61292280accd10c77fb24bcf6be1fc0 (diff)
Remove feature writing (fwrite()) from libopus
-rw-r--r--dnn/dump_data.c3
-rw-r--r--dnn/lpcnet_enc.c7
-rw-r--r--dnn/lpcnet_private.h4
3 files changed, 5 insertions, 9 deletions
diff --git a/dnn/dump_data.c b/dnn/dump_data.c
index e7acfb11..257e627a 100644
--- a/dnn/dump_data.c
+++ b/dnn/dump_data.c
@@ -263,7 +263,8 @@ int main(int argc, char **argv) {
}
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);
diff --git a/dnn/lpcnet_enc.c b/dnn/lpcnet_enc.c
index 8e3164df..1e248e6a 100644
--- a/dnn/lpcnet_enc.c
+++ b/dnn/lpcnet_enc.c
@@ -168,7 +168,7 @@ void compute_frame_features(LPCNetEncState *st, const float *in, int arch) {
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 @@ void process_single_frame(LPCNetEncState *st, FILE *ffeat) {
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 @@ void preemphasis(float *y, float *mem, const float *x, float coef, int N) {
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;
}
diff --git a/dnn/lpcnet_private.h b/dnn/lpcnet_private.h
index 9a68c718..85325e31 100644
--- a/dnn/lpcnet_private.h
+++ b/dnn/lpcnet_private.h
@@ -77,9 +77,7 @@ void run_frame_network_flush(LPCNetState *lpcnet);
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);