diff options
author | jmvalin <jmvalin@0101bb08-14d6-0310-b084-bc0e0c8e3800> | 2002-04-15 09:04:51 +0400 |
---|---|---|
committer | jmvalin <jmvalin@0101bb08-14d6-0310-b084-bc0e0c8e3800> | 2002-04-15 09:04:51 +0400 |
commit | 0f4d3993866d448da1fbca8c719def17572e50ca (patch) | |
tree | 48789c25f5fd9fdda4558a91dd01bf5039f00295 | |
parent | fef7993b00d809edcb5097e775148a1d665ac91d (diff) |
Moving on for 0.0.2, updated the "real" encoder and decoder (speexenc,Speex-0.0.2
speexdec). Fixed a memory leak.
git-svn-id: http://svn.xiph.org/trunk/speex@3251 0101bb08-14d6-0310-b084-bc0e0c8e3800
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | libspeex/mpulse.c | 1 | ||||
-rw-r--r-- | libspeex/speex.c | 4 | ||||
-rw-r--r-- | libspeex/testenc_sb.c | 1 | ||||
-rw-r--r-- | src/speexdec.c | 31 | ||||
-rw-r--r-- | src/speexenc.c | 27 |
6 files changed, 49 insertions, 17 deletions
diff --git a/configure.in b/configure.in index b7da22f..d360f8f 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ AC_INIT(libspeex/speex.h) SPEEX_MAJOR_VERSION=0 SPEEX_MINOR_VERSION=0 -SPEEX_MICRO_VERSION=1 +SPEEX_MICRO_VERSION=2 SPEEX_VERSION=$SPEEX_MAJOR_VERSION.$SPEEX_MINOR_VERSION.$SPEEX_MICRO_VERSION SPEEX_BINARY_AGE=0 SPEEX_INTERFACE_AGE=0 diff --git a/libspeex/mpulse.c b/libspeex/mpulse.c index 689e364..26e8f4c 100644 --- a/libspeex/mpulse.c +++ b/libspeex/mpulse.c @@ -359,7 +359,6 @@ float *stack syn_filt_zero(resp, awk2, resp, nsf, p); f=((.1+(xcorr(resp,target,nsf)))/(.1+xcorr(resp,resp,nsf))); - printf ("gain correction %f\n", f); /*for (i=0;i<nsf;i++) e[i]*=f;*/ g *= f; diff --git a/libspeex/speex.c b/libspeex/speex.c index 1db461b..4258c36 100644 --- a/libspeex/speex.c +++ b/libspeex/speex.c @@ -140,7 +140,7 @@ void encoder_destroy(EncState *st) free(st->inBuf); free(st->excBuf); free(st->swBuf); - + free(st->os_filt); free(st->stack); free(st->window); @@ -148,7 +148,7 @@ void encoder_destroy(EncState *st) free(st->lpc); free(st->interp_lpc); free(st->interp_qlpc); - + free(st->bw_lpc1); free(st->bw_lpc2); free(st->autocorr); diff --git a/libspeex/testenc_sb.c b/libspeex/testenc_sb.c index 0389853..00887b5 100644 --- a/libspeex/testenc_sb.c +++ b/libspeex/testenc_sb.c @@ -56,6 +56,7 @@ int main(int argc, char **argv) } snr = 10*log10((esig+1)/(enoise+1)); } + frame_bits_rewind(&bits); sb_decode(&dec, &bits, input); diff --git a/src/speexdec.c b/src/speexdec.c index 27be46f..8ac98cc 100644 --- a/src/speexdec.c +++ b/src/speexdec.c @@ -24,6 +24,7 @@ #include "modes.h" #include "speex.h" +#include "sb_celp.h" #define MAX_FRAME_SIZE 2000 #define MAX_FRAME_BYTES 1000 @@ -52,9 +53,11 @@ int main(int argc, char **argv) int frame_size; SpeexMode *mode=NULL; DecState st; + SBDecState sb_st; FrameBits bits; char cbits[MAX_FRAME_BYTES]; int at_end=0; + int narrowband=0, wideband=0; struct option long_options[] = { {"help", no_argument, NULL, 0}, @@ -136,18 +139,26 @@ int main(int argc, char **argv) } header[5]=0; if (strcmp(header,"spexn")==0) + { mode=&mp_nb_mode; - else if (strcmp(header,"spexw")==0) - mode=&mp_wb_mode; - else + decoder_init(&st, mode); + narrowband=1; + } else if (strcmp(header,"spexw")==0) + { + mode=&mp_sb_mode; + sb_decoder_init(&sb_st, mode); + wideband=1; + } else { fprintf (stderr, "This does not look like a Speex " VERSION " file\n"); exit(1); } } - decoder_init(&st, mode); frame_size=mode->frameSize; + if (wideband) + frame_size*=2; + frame_bits_init(&bits); while (1) { @@ -164,8 +175,11 @@ int main(int argc, char **argv) if (((bits.nbBits>>3)-bits.bytePtr)<2) break; - - decode(&st, &bits, output); + + if (narrowband) + decode(&st, &bits, output); + if (wideband) + sb_decode(&sb_st, &bits, output); for (i=0;i<frame_size;i++) { if (output[i]>32000) @@ -177,7 +191,10 @@ int main(int argc, char **argv) out[i]=output[i]; fwrite(out, sizeof(short), frame_size, fout); } - decoder_destroy(&st); + if (narrowband) + decoder_destroy(&st); + if (wideband) + sb_decoder_destroy(&sb_st); exit(0); return 1; } diff --git a/src/speexenc.c b/src/speexenc.c index 7ac1aec..73c6f98 100644 --- a/src/speexenc.c +++ b/src/speexenc.c @@ -24,6 +24,7 @@ #include "modes.h" #include "speex.h" +#include "sb_celp.h" #define MAX_FRAME_SIZE 2000 #define MAX_FRAME_BYTES 1000 @@ -57,6 +58,7 @@ int main(int argc, char **argv) int i,nbBytes; SpeexMode *mode=NULL; EncState st; + SBEncState sb_st; FrameBits bits; char cbits[MAX_FRAME_BYTES]; struct option long_options[] = @@ -127,10 +129,16 @@ int main(int argc, char **argv) if (!wideband) narrowband=1; if (narrowband) + { mode=&mp_nb_mode; - if (wideband) - mode=&mp_wb_mode; + encoder_init(&st, mode); + } + if (wideband) + { + mode=&mp_sb_mode; + sb_encoder_init(&sb_st, mode); + } if (strcmp(inFile, "-")==0) fin=stdin; else @@ -156,7 +164,7 @@ int main(int argc, char **argv) /*Temporary header*/ { - char *header; + char *header=""; if (narrowband) header="spexn"; if (wideband) @@ -167,8 +175,9 @@ int main(int argc, char **argv) } } - encoder_init(&st, mode); frame_size=mode->frameSize; + if (wideband) + frame_size*=2; while (1) { @@ -177,13 +186,19 @@ int main(int argc, char **argv) break; for (i=0;i<frame_size;i++) input[i]=in[i]; - encode(&st, input, &bits); + if (narrowband) + encode(&st, input, &bits); + if (wideband) + sb_encode(&sb_st, input, &bits); nbBytes = frame_bits_write_whole_bytes(&bits, cbits, 200); fwrite(cbits, 1, nbBytes, fout); } nbBytes = frame_bits_write(&bits, cbits, 200); fwrite(cbits, 1, nbBytes, fout); - encoder_destroy(&st); + if (narrowband) + encoder_destroy(&st); + if (wideband) + sb_encoder_destroy(&sb_st); exit(0); return 1; } |