From 6dc3a743addde6146b736ec5e1c71159c2150f95 Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Fri, 19 Oct 2007 18:10:28 +0000 Subject: Remove some Speex distribution test code we won't use. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15208 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libspeex/testdenoise.c | 44 ----------- apps/codecs/libspeex/testecho.c | 53 ------------- apps/codecs/libspeex/testenc.c | 142 ----------------------------------- apps/codecs/libspeex/testenc_uwb.c | 137 ---------------------------------- apps/codecs/libspeex/testenc_wb.c | 143 ------------------------------------ apps/codecs/libspeex/testresample.c | 86 ---------------------- 6 files changed, 605 deletions(-) delete mode 100644 apps/codecs/libspeex/testdenoise.c delete mode 100644 apps/codecs/libspeex/testecho.c delete mode 100644 apps/codecs/libspeex/testenc.c delete mode 100644 apps/codecs/libspeex/testenc_uwb.c delete mode 100644 apps/codecs/libspeex/testenc_wb.c delete mode 100644 apps/codecs/libspeex/testresample.c (limited to 'apps/codecs/libspeex') diff --git a/apps/codecs/libspeex/testdenoise.c b/apps/codecs/libspeex/testdenoise.c deleted file mode 100644 index 42644cb011..0000000000 --- a/apps/codecs/libspeex/testdenoise.c +++ /dev/null @@ -1,44 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#define NN 160 - -int main() -{ - short in[NN]; - int i; - SpeexPreprocessState *st; - int count=0; - float f; - - st = speex_preprocess_state_init(NN, 8000); - i=1; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &i); - i=0; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &i); - f=8000; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &f); - i=0; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB, &i); - f=.0; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &f); - f=.0; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &f); - while (1) - { - int vad; - fread(in, sizeof(short), NN, stdin); - if (feof(stdin)) - break; - vad = speex_preprocess_run(st, in); - /*fprintf (stderr, "%d\n", vad);*/ - fwrite(in, sizeof(short), NN, stdout); - count++; - } - speex_preprocess_state_destroy(st); - return 0; -} diff --git a/apps/codecs/libspeex/testecho.c b/apps/codecs/libspeex/testecho.c deleted file mode 100644 index 7c32c8f60e..0000000000 --- a/apps/codecs/libspeex/testecho.c +++ /dev/null @@ -1,53 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include "speex/speex_echo.h" -#include "speex/speex_preprocess.h" - - -#define NN 128 -#define TAIL 1024 - -int main(int argc, char **argv) -{ - int echo_fd, ref_fd, e_fd; - short echo_buf[NN], ref_buf[NN], e_buf[NN]; - SpeexEchoState *st; - SpeexPreprocessState *den; - - if (argc != 4) - { - fprintf (stderr, "testecho mic_signal.sw speaker_signal.sw output.sw\n"); - exit(1); - } - echo_fd = open (argv[2], O_RDONLY); - ref_fd = open (argv[1], O_RDONLY); - e_fd = open (argv[3], O_WRONLY | O_CREAT | O_TRUNC, 0644); - - st = speex_echo_state_init(NN, TAIL); - den = speex_preprocess_state_init(NN, 8000); - int tmp = 8000; - speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &tmp); - speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_ECHO_STATE, st); - - while (read(ref_fd, ref_buf, NN*2)) - { - read(echo_fd, echo_buf, NN*2); - speex_echo_cancellation(st, ref_buf, echo_buf, e_buf); - speex_preprocess_run(den, e_buf); - write(e_fd, e_buf, NN*2); - } - speex_echo_state_destroy(st); - speex_preprocess_state_destroy(den); - close(e_fd); - close(echo_fd); - close(ref_fd); - return 0; -} diff --git a/apps/codecs/libspeex/testenc.c b/apps/codecs/libspeex/testenc.c deleted file mode 100644 index eabd02cc76..0000000000 --- a/apps/codecs/libspeex/testenc.c +++ /dev/null @@ -1,142 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -#ifdef FIXED_DEBUG -extern long long spx_mips; -#endif - -#define FRAME_SIZE 160 -#include -int main(int argc, char **argv) -{ - char *inFile, *outFile, *bitsFile; - FILE *fin, *fout, *fbits=NULL; - short in_short[FRAME_SIZE]; - short out_short[FRAME_SIZE]; - float sigpow,errpow,snr, seg_snr=0; - int snr_frames = 0; - char cbits[200]; - int nbBits; - int i; - void *st; - void *dec; - SpeexBits bits; - spx_int32_t tmp; - int bitCount=0; - spx_int32_t skip_group_delay; - SpeexCallback callback; - - sigpow = 0; - errpow = 0; - - st = speex_encoder_init(&speex_nb_mode); - dec = speex_decoder_init(&speex_nb_mode); - - /* BEGIN: You probably don't need the following in a real application */ - callback.callback_id = SPEEX_INBAND_CHAR; - callback.func = speex_std_char_handler; - callback.data = stderr; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - - callback.callback_id = SPEEX_INBAND_MODE_REQUEST; - callback.func = speex_std_mode_request_handler; - callback.data = st; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - /* END of unnecessary stuff */ - - tmp=1; - speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); - tmp=0; - speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); - tmp=8; - speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); - tmp=1; - speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); - - /* Turn this off if you want to measure SNR (on by default) */ - tmp=1; - speex_encoder_ctl(st, SPEEX_SET_HIGHPASS, &tmp); - speex_decoder_ctl(dec, SPEEX_SET_HIGHPASS, &tmp); - - speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); - speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); - skip_group_delay += tmp; - - if (argc != 4 && argc != 3) - { - fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); - exit(1); - } - inFile = argv[1]; - fin = fopen(inFile, "r"); - outFile = argv[2]; - fout = fopen(outFile, "w+"); - if (argc==4) - { - bitsFile = argv[3]; - fbits = fopen(bitsFile, "w"); - } - speex_bits_init(&bits); - while (!feof(fin)) - { - fread(in_short, sizeof(short), FRAME_SIZE, fin); - if (feof(fin)) - break; - speex_bits_reset(&bits); - - speex_encode_int(st, in_short, &bits); - nbBits = speex_bits_write(&bits, cbits, 200); - bitCount+=bits.nbBits; - - if (argc==4) - fwrite(cbits, 1, nbBits, fbits); - speex_bits_rewind(&bits); - - speex_decode_int(dec, &bits, out_short); - speex_bits_reset(&bits); - - fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout); - skip_group_delay = 0; - } - fprintf (stderr, "Total encoded size: %d bits\n", bitCount); - speex_encoder_destroy(st); - speex_decoder_destroy(dec); - speex_bits_destroy(&bits); - - /* This code just computes SNR, so you don't need it either */ - rewind(fin); - rewind(fout); - - while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin) - && - FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) ) - { - float s=0, e=0; - for (i=0;i -#include -#include -#include - -#ifdef FIXED_DEBUG -extern long long spx_mips; -#endif - -#define FRAME_SIZE 640 -#include -int main(int argc, char **argv) -{ - char *inFile, *outFile, *bitsFile; - FILE *fin, *fout, *fbits=NULL; - short in_short[FRAME_SIZE]; - short out_short[FRAME_SIZE]; - float in_float[FRAME_SIZE]; - float sigpow,errpow,snr, seg_snr=0; - int snr_frames = 0; - char cbits[200]; - int nbBits; - int i; - void *st; - void *dec; - SpeexBits bits; - spx_int32_t tmp; - int bitCount=0; - spx_int32_t skip_group_delay; - SpeexCallback callback; - - sigpow = 0; - errpow = 0; - - st = speex_encoder_init(&speex_uwb_mode); - dec = speex_decoder_init(&speex_uwb_mode); - - callback.callback_id = SPEEX_INBAND_CHAR; - callback.func = speex_std_char_handler; - callback.data = stderr; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - - callback.callback_id = SPEEX_INBAND_MODE_REQUEST; - callback.func = speex_std_mode_request_handler; - callback.data = st; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - - tmp=0; - speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); - tmp=0; - speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); - tmp=7; - speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); - tmp=1; - speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); - - speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); - speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); - skip_group_delay += tmp; - - - if (argc != 4 && argc != 3) - { - fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); - exit(1); - } - inFile = argv[1]; - fin = fopen(inFile, "r"); - outFile = argv[2]; - fout = fopen(outFile, "w+"); - if (argc==4) - { - bitsFile = argv[3]; - fbits = fopen(bitsFile, "w"); - } - speex_bits_init(&bits); - while (!feof(fin)) - { - fread(in_short, sizeof(short), FRAME_SIZE, fin); - if (feof(fin)) - break; - for (i=0;i -#include -#include -#include - -#ifdef FIXED_DEBUG -extern long long spx_mips; -#endif - -#define FRAME_SIZE 320 -#include -int main(int argc, char **argv) -{ - char *inFile, *outFile, *bitsFile; - FILE *fin, *fout, *fbits=NULL; - short in_short[FRAME_SIZE]; - short out_short[FRAME_SIZE]; - float in_float[FRAME_SIZE]; - float sigpow,errpow,snr, seg_snr=0; - int snr_frames = 0; - char cbits[200]; - int nbBits; - int i; - void *st; - void *dec; - SpeexBits bits; - spx_int32_t tmp; - int bitCount=0; - spx_int32_t skip_group_delay; - SpeexCallback callback; - - sigpow = 0; - errpow = 0; - - st = speex_encoder_init(&speex_wb_mode); - dec = speex_decoder_init(&speex_wb_mode); - - callback.callback_id = SPEEX_INBAND_CHAR; - callback.func = speex_std_char_handler; - callback.data = stderr; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - - callback.callback_id = SPEEX_INBAND_MODE_REQUEST; - callback.func = speex_std_mode_request_handler; - callback.data = st; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - - tmp=1; - speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); - tmp=0; - speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); - tmp=8; - speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); - tmp=3; - speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); - /*tmp=3; - speex_encoder_ctl(st, SPEEX_SET_HIGH_MODE, &tmp); - tmp=6; - speex_encoder_ctl(st, SPEEX_SET_LOW_MODE, &tmp); -*/ - - speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); - speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); - skip_group_delay += tmp; - - - if (argc != 4 && argc != 3) - { - fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); - exit(1); - } - inFile = argv[1]; - fin = fopen(inFile, "r"); - outFile = argv[2]; - fout = fopen(outFile, "w+"); - if (argc==4) - { - bitsFile = argv[3]; - fbits = fopen(bitsFile, "w"); - } - speex_bits_init(&bits); - while (!feof(fin)) - { - fread(in_short, sizeof(short), FRAME_SIZE, fin); - if (feof(fin)) - break; - for (i=0;i -#include "speex/speex_resampler.h" -#include -#include - -#define NN 256 - -int main() -{ - spx_uint32_t i; - short *in; - short *out; - float *fin, *fout; - int count = 0; - SpeexResamplerState *st = speex_resampler_init(1, 8000, 12000, 10, NULL); - speex_resampler_set_rate(st, 96000, 44100); - speex_resampler_skip_zeros(st); - - in = malloc(NN*sizeof(short)); - out = malloc(2*NN*sizeof(short)); - fin = malloc(NN*sizeof(float)); - fout = malloc(2*NN*sizeof(float)); - while (1) - { - spx_uint32_t in_len; - spx_uint32_t out_len; - fread(in, sizeof(short), NN, stdin); - if (feof(stdin)) - break; - for (i=0;i