#include "phaseexp.h"
#include "bpf.h"
#include "bpfb.h"
+#include "newamp1.h"
void synth_one_frame(int n_samp, codec2_fftr_cfg fftr_inv_cfg, short buf[], MODEL *model, float Sn_[], float Pn[], int prede, float *de_mem, float gain);
void print_help(const struct option *long_options, int num_opts, char* argv[]);
/* Initialise ------------------------------------------------------------*/
- fft_fwd_cfg = codec2_fft_alloc(FFT_ENC, 0, NULL, NULL); /* fwd FFT,used in several places */
+ fft_fwd_cfg = codec2_fft_alloc(FFT_ENC, 0, NULL, NULL); /* fwd FFT,used in several places */
fftr_fwd_cfg = codec2_fftr_alloc(FFT_ENC, 0, NULL, NULL); /* fwd FFT,used in several places */
fftr_inv_cfg = codec2_fftr_alloc(FFT_DEC, 1, NULL, NULL); /* inverse FFT, used just for synth */
+ codec2_fft_cfg phase_fft_fwd_cfg = codec2_fft_alloc(NEWAMP1_PHASE_NFFT, 0, NULL, NULL);
+ codec2_fft_cfg phase_fft_inv_cfg = codec2_fft_alloc(NEWAMP1_PHASE_NFFT, 1, NULL, NULL);
+
make_analysis_window(&c2const, fft_fwd_cfg, w, W);
make_synthesis_window(&c2const, Pn);
quantise_init();
int ret = fread(H, sizeof(COMP), MAX_AMP, fhm);
assert(ret == MAX_AMP);
} else {
- sample_phase(&model_dec[i], H, Aw);
+ determine_phase(&c2const, H, &model_dec[i], NEWAMP1_PHASE_NFFT, phase_fft_fwd_cfg, phase_fft_inv_cfg);
+ //sample_phase(&model_dec[i], H, Aw);
}
phase_synth_zero_order(n_samp, &model_dec[i], ex_phase, H);
}
void dump_model(MODEL *model) {
int l;
char s[MAX_STR];
- char line[2048];
+ char line[MAX_STR*10];
if (!dumpon) return;
for(l=1; l<=model->L; l++) {
sprintf(s,"%12f ",model->A[l]);
strcat(line, s);
+ assert(strlen(line) < MAX_STR*10);
}
for(l=model->L+1; l<=MAX_AMP; l++) {
sprintf(s,"%12f ", 0.0);
strcat(line,s);
+ assert(strlen(line) < MAX_STR*10);
}
sprintf(s,"%d\n",model->voiced);