From 26bb0f8ac15d36397ef876df1f383861d2e8b890 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Mon, 12 Jun 2017 01:04:28 +0000 Subject: [PATCH] fixed up tnewamp1.c for 16kHz changes git-svn-id: https://svn.code.sf.net/p/freetel/code@3178 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/unittest/CMakeLists.txt | 3 -- codec2-dev/unittest/tnewamp1.c | 48 +++++++++++++++++------------- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/codec2-dev/unittest/CMakeLists.txt b/codec2-dev/unittest/CMakeLists.txt index c45706ca..a4b06b9e 100644 --- a/codec2-dev/unittest/CMakeLists.txt +++ b/codec2-dev/unittest/CMakeLists.txt @@ -24,9 +24,6 @@ set(CODEBOOKS ../src/codebook.c ../src/codebookd.c ../src/codebookvq.c ../src/co add_executable(tnlp tnlp.c ../src/sine.c ../src/nlp.c ../src/kiss_fft.c ../src/dump.c) target_link_libraries(tnlp codec2) -add_executable(tquant tquant.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/kiss_fft.c ${CODEBOOKS}) -target_link_libraries(tquant codec2) - add_executable(scalarlsptest scalarlsptest.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/kiss_fft.c ${CODEBOOKS}) target_link_libraries(scalarlsptest codec2) diff --git a/codec2-dev/unittest/tnewamp1.c b/codec2-dev/unittest/tnewamp1.c index 93791efd..35be03e1 100644 --- a/codec2-dev/unittest/tnewamp1.c +++ b/codec2-dev/unittest/tnewamp1.c @@ -40,31 +40,35 @@ #define FRAMES 300 int main(int argc, char *argv[]) { - short buf[N_SAMP]; /* input/output buffer */ - float Sn[M_PITCH]; /* float input speech samples */ + int Fs = 8000; + C2CONST c2const = c2const_create(Fs); + int n_samp = c2const.n_samp; + int m_pitch = c2const.m_pitch; + short buf[n_samp]; /* input/output buffer */ + float Sn[m_pitch]; /* float input speech samples */ COMP Sw[FFT_ENC]; /* DFT of Sn[] */ codec2_fft_cfg fft_fwd_cfg; /* fwd FFT states */ - float w[M_PITCH]; /* time domain hamming window */ + float w[m_pitch]; /* time domain hamming window */ COMP W[FFT_ENC]; /* DFT of w[] */ MODEL model; void *nlp_states; codec2_fft_cfg phase_fft_fwd_cfg, phase_fft_inv_cfg; - float pitch, prev_uq_Wo; + float pitch, prev_f0; int i,m,f,k; if (argc != 2) { printf("usage: ./tnewamp1 RawFile\n"); exit(1); } - nlp_states = nlp_create(M_PITCH); - prev_uq_Wo = TWO_PI/P_MAX; + nlp_states = nlp_create(&c2const); + prev_f0 = 1.0/P_MAX_S; fft_fwd_cfg = codec2_fft_alloc(FFT_ENC, 0, NULL, NULL); - make_analysis_window(fft_fwd_cfg, w, W); + make_analysis_window(&c2const,fft_fwd_cfg, w, W); phase_fft_fwd_cfg = codec2_fft_alloc(NEWAMP1_PHASE_NFFT, 0, NULL, NULL); phase_fft_inv_cfg = codec2_fft_alloc(NEWAMP1_PHASE_NFFT, 1, NULL, NULL); - for(i=0; i