From: drowe67 Date: Thu, 1 Mar 2012 19:57:43 +0000 (+0000) Subject: BW expansion of {ak} was causing neagtive LPC energy values so I took it out. Hopefu... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=6dabdb7afc0fca713126943bf990a6045b26199f;p=freetel-svn-tracking.git BW expansion of {ak} was causing neagtive LPC energy values so I took it out. Hopefully this won't cause occasional LSP root finding fails git-svn-id: https://svn.code.sf.net/p/freetel/code@336 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/c2sim.c b/codec2-dev/src/c2sim.c index 29f66bbe..928cc7c8 100644 --- a/codec2-dev/src/c2sim.c +++ b/codec2-dev/src/c2sim.c @@ -113,6 +113,8 @@ int main(int argc, char *argv[]) float hpf_states[2]; int scalar_quant_Wo_e = 0; int vector_quant_Wo_e = 0; + int dump_pitch_e = 0; + FILE *fjvm = NULL; char* opt_string = "ho:"; struct option long_options[] = { @@ -131,6 +133,7 @@ int main(int argc, char *argv[]) { "hand_voicing", required_argument, &hand_voicing, 1 }, { "dec", no_argument, &decimate, 1 }, { "dt", no_argument, &dt, 1 }, + { "dump_pitch_e", required_argument, &dump_pitch_e, 1 }, { "sq_pitch_e", no_argument, &scalar_quant_Wo_e, 1 }, { "vq_pitch_e", no_argument, &vector_quant_Wo_e, 1 }, { "rate", required_argument, NULL, 0 }, @@ -218,7 +221,13 @@ int main(int argc, char *argv[]) optarg, strerror(errno)); exit(1); } - } else if(strcmp(long_options[option_index].name, "rate") == 0) { + } else if(strcmp(long_options[option_index].name, "dump_pitch_e") == 0) { + if ((fjvm = fopen(optarg,"wt")) == NULL) { + fprintf(stderr, "Error opening pitch & energy dump file: %s: %s.\n", + optarg, strerror(errno)); + exit(1); + } + } else if(strcmp(long_options[option_index].name, "rate") == 0) { if(strcmp(optarg,"2500") == 0) { lpc_model = 1; order = 10; scalar_quant_Wo_e = 1; @@ -358,6 +367,10 @@ int main(int argc, char *argv[]) /* determine voicing */ snr = est_voicing_mbe(&model, Sw, W, Sw_, Ew, prev_uq_Wo); + + if (dump_pitch_e) + fprintf(fjvm, "%f %f %d ", model.Wo, snr, model.voiced); + //printf("snr %3.2f v: %d Wo: %f prev_Wo: %f\n", snr, model.voiced, // model.Wo, prev_uq_Wo); #ifdef DUMP @@ -386,6 +399,24 @@ int main(int argc, char *argv[]) e = speech_to_uq_lsps(lsps, ak, Sn, w, order); + /* tracking down -ve energy values with BW expansion */ + /* + if (e < 0.0) { + int i; + FILE*f=fopen("x.txt","wt"); + for(i=0; i