ref: bfcf94de2a6dbc245f6b92f6a4d5a301845f2549
parent: 5f830b4578c5f0e5dcb6ddc88db8d1d50b270416
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Mon Mar 11 11:00:12 EDT 2019
cleanup
--- a/dnn/dump_data.c
+++ b/dnn/dump_data.c
@@ -292,10 +292,8 @@
}
}
-void perform_double_interp(float features[4][NB_FEATURES], const float *mem) {
+void perform_double_interp(float features[4][NB_FEATURES], const float *mem, int best_id) {
int id0, id1;
- int best_id;
- best_id = double_interp_search(features, mem);
best_id += (best_id >= FORBIDDEN_INTERP);
id0 = best_id / 3;
id1 = best_id % 3;
@@ -303,6 +301,30 @@
single_interp(features[2], features[1], features[3], id1);
}
+void perform_interp_relaxation(float features[4][NB_FEATURES], const float *mem) {
+ int id0, id1;
+ int best_id;
+ int i;
+ float count, count_1;
+ best_id = double_interp_search(features, mem);
+ best_id += (best_id >= FORBIDDEN_INTERP);
+ id0 = best_id / 3;
+ id1 = best_id % 3;
+ count = 1;
+ if (id0 != 1) {
+ float t = (id0==0) ? .5 : 1.;
+ for (i=0;i<NB_BANDS;i++) features[1][i] += t*features[0][i];
+ count += t;
+ }
+ if (id1 != 2) {
+ float t = (id1==0) ? .5 : 1.;
+ for (i=0;i<NB_BANDS;i++) features[1][i] += t*features[2][i];
+ count += t;
+ }
+ count_1 = 1.f/count;
+ for (i=0;i<NB_BANDS;i++) features[1][i] *= count_1;
+}
+
typedef struct {
float analysis_mem[OVERLAP_SIZE];
float cepstral_mem[CEPS_MEM][NB_BANDS];
@@ -543,14 +565,14 @@
//printf("%f\n", st->features[3][0]);
st->features[3][0] = floor(.5 + st->features[3][0]*5)/5;
quantize_2stage(&st->features[3][1]);
+ /*perform_interp_relaxation(st->features, vq_mem);*/
quantize_diff(&st->features[1][0], vq_mem, &st->features[3][0], ceps_codebook_diff4, 11, 1);
- double_interp_search(st->features, vq_mem);
- //quantize_2stage(&st->features[1][1]);
#if 0
interp_diff(&st->features[0][0], vq_mem, &st->features[1][0], ceps_codebook_diff2, 6, 0);
interp_diff(&st->features[2][0], &st->features[1][0], &st->features[3][0], ceps_codebook_diff2, 6, 0);
#else
- perform_double_interp(st->features, vq_mem);
+ int interp_id = double_interp_search(st->features, vq_mem);
+ perform_double_interp(st->features, vq_mem, interp_id);
#endif
//printf("\n");
RNN_COPY(vq_mem, &st->features[3][0], NB_BANDS);
--
⑨