From: drowe67 Date: Wed, 22 Sep 2010 07:04:58 +0000 (+0000) Subject: valgrind fixes, thanks Torok X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=e8f410819cc3e1e235ff2935a5a69a9e53653bbc;p=freetel-svn-tracking.git valgrind fixes, thanks Torok git-svn-id: https://svn.code.sf.net/p/freetel/code@194 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2/src/Makefile b/codec2/src/Makefile index f192954c..66af79f4 100644 --- a/codec2/src/Makefile +++ b/codec2/src/Makefile @@ -1,5 +1,5 @@ CC=gcc -CFLAGS=-g -Wall -I. -I../src -Wall -g -DFLOATING_POINT -DVAR_ARRAYS +CFLAGS=-g -Wall -I. -I../src -Wall -g -DFLOATING_POINT -DVAR_ARRAYS -O2 C2SIM_OBJ = sine.o nlp.o four1.o dump.o quantise.o lpc.o lsp.o phase.o \ pack.o postfilter.o interp.o codec2.o c2sim.o diff --git a/codec2/src/c2sim.c b/codec2/src/c2sim.c index b9e5f0f7..72c5632f 100644 --- a/codec2/src/c2sim.c +++ b/codec2/src/c2sim.c @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) int frames; float prev_Wo; float pitch; - int voiced1; + int voiced1 = 0; char out_file[MAX_STR]; int arg; @@ -372,6 +372,7 @@ int main(int argc, char *argv[]) if (fout != NULL) fwrite(buf,sizeof(short),N,fout); } } + fclose(fin); if (fout != NULL) fclose(fout); diff --git a/codec2/src/codec2.c b/codec2/src/codec2.c index 30142fec..a09de717 100644 --- a/codec2/src/codec2.c +++ b/codec2/src/codec2.c @@ -109,6 +109,8 @@ void *codec2_create() for(l=1; l<=MAX_AMP; l++) c2->prev_model.A[l] = 0.0; c2->prev_model.Wo = TWO_PI/P_MAX; + c2->prev_model.L = PI/c2->prev_model.Wo; + c2->prev_model.voiced = 0; c2->nlp = nlp_create(); if (c2->nlp == NULL) { @@ -250,6 +252,7 @@ void codec2_decode(void *codec2_state, short speech[], model.Wo = decode_Wo(Wo_index); model.L = PI/model.Wo; + memset(&model.A, 0, (model.L+1)*sizeof(model.A[0])); decode_amplitudes(&model, ak, lsp_indexes, @@ -258,6 +261,8 @@ void codec2_decode(void *codec2_state, short speech[], model.voiced = voiced2; model_interp.voiced = voiced1; + model_interp.Wo = P_MAX/2; + memset(&model_interp.A, 0, MAX_AMP*sizeof(model_interp.A[0])); interpolate(&model_interp, &c2->prev_model, &model); synthesise_one_frame(c2, speech, &model_interp, ak);