Updated SpanDSP to snapshot on 2009-06-03 with some additions:

Fixed VS2005 version of make_modem_filter

  Fixed a couple of places where declaration and definition of functions do not have the same calling conventions. Only relevant for Win32 compiles.


git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13831 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Robert Joly committed 2009-06-18 06:13:59 +00:00
1 parent 832bab2a4a
commit e791f33545
131 files changed
+8988 -2017

No files matched your search

+41 -99
View File
@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: line_model_tests.c,v 1.26 2009/01/12 17:20:59 steveu Exp $
* $Id: line_model_tests.c,v 1.27 2009/05/30 15:23:14 steveu Exp $
*/
/*! \page line_model_tests_page Telephony line model tests
@@ -43,7 +43,7 @@
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <audiofile.h>
#include <sndfile.h>
//#if defined(WITH_SPANDSP_INTERNALS)
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
@@ -73,25 +73,14 @@ static void complexify_tests(void)
complexf_t cc;
int16_t amp;
int i;
AFfilehandle outhandle;
AFfilesetup filesetup;
SNDFILE *outhandle;
int outframes;
int16_t out[40000];
awgn_state_t noise1;
if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
{
fprintf(stderr, " Failed to create file setup\n");
exit(2);
}
afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
afInitFileFormat(filesetup, AF_FILE_WAVE);
afInitChannels(filesetup, AF_DEFAULT_TRACK, 2);
if ((outhandle = afOpenFile(OUT_FILE_COMPLEXIFY, "w", filesetup)) == AF_NULL_FILEHANDLE)
if ((outhandle = sf_open_telephony_write(OUT_FILE_COMPLEXIFY, 2)) == NULL)
{
fprintf(stderr, " Cannot create wave file '%s'\n", OUT_FILE_COMPLEXIFY);
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_COMPLEXIFY);
exit(2);
}
awgn_init_dbm0(&noise1, 1234567, -10.0f);
@@ -103,21 +92,17 @@ static void complexify_tests(void)
out[2*i] = cc.re;
out[2*i + 1] = cc.im;
}
outframes = afWriteFrames(outhandle,
AF_DEFAULT_TRACK,
out,
20000);
outframes = sf_writef_short(outhandle, out, 20000);
if (outframes != 20000)
{
fprintf(stderr, " Error writing wave file\n");
fprintf(stderr, " Error writing audio file\n");
exit(2);
}
if (afCloseFile(outhandle))
if (sf_close(outhandle))
{
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_COMPLEXIFY);
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_COMPLEXIFY);
exit(2);
}
afFreeFileSetup(filesetup);
}
/*- End of function --------------------------------------------------------*/
@@ -127,9 +112,8 @@ static void test_one_way_model(int line_model_no, int speech_test)
int16_t input1[BLOCK_LEN];
int16_t output1[BLOCK_LEN];
int16_t amp[2*BLOCK_LEN];
AFfilehandle inhandle1;
AFfilehandle outhandle;
AFfilesetup filesetup;
SNDFILE *inhandle1;
SNDFILE *outhandle;
int outframes;
int samples;
int i;
@@ -144,34 +128,21 @@ static void test_one_way_model(int line_model_no, int speech_test)
awgn_init_dbm0(&noise1, 1234567, -10.0f);
if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
{
fprintf(stderr, " Failed to create file setup\n");
fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME1);
exit(2);
}
afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
afInitFileFormat(filesetup, AF_FILE_WAVE);
afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
if ((inhandle1 = afOpenFile(IN_FILE_NAME1, "r", NULL)) == AF_NULL_FILEHANDLE)
if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME1, 1)) == NULL)
{
fprintf(stderr, " Cannot open wave file '%s'\n", IN_FILE_NAME1);
exit(2);
}
if ((outhandle = afOpenFile(OUT_FILE_NAME1, "w", filesetup)) == AF_NULL_FILEHANDLE)
{
fprintf(stderr, " Cannot create wave file '%s'\n", OUT_FILE_NAME1);
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME1);
exit(2);
}
for (i = 0; i < 10000; i++)
{
if (speech_test)
{
samples = afReadFrames(inhandle1,
AF_DEFAULT_TRACK,
input1,
BLOCK_LEN);
samples = sf_readf_short(inhandle1, input1, BLOCK_LEN);
if (samples == 0)
break;
}
@@ -189,27 +160,23 @@ static void test_one_way_model(int line_model_no, int speech_test)
1);
amp[j] = output1[j];
}
outframes = afWriteFrames(outhandle,
AF_DEFAULT_TRACK,
amp,
samples);
outframes = sf_writef_short(outhandle, amp, samples);
if (outframes != samples)
{
fprintf(stderr, " Error writing wave file\n");
fprintf(stderr, " Error writing audio file\n");
exit(2);
}
}
if (afCloseFile(inhandle1))
if (sf_close(inhandle1))
{
fprintf(stderr, " Cannot close wave file '%s'\n", IN_FILE_NAME1);
fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME1);
exit(2);
}
if (afCloseFile(outhandle))
if (sf_close(outhandle))
{
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_NAME1);
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME1);
exit(2);
}
afFreeFileSetup(filesetup);
one_way_line_model_release(model);
}
/*- End of function --------------------------------------------------------*/
@@ -222,10 +189,9 @@ static void test_both_ways_model(int line_model_no, int speech_test)
int16_t output1[BLOCK_LEN];
int16_t output2[BLOCK_LEN];
int16_t amp[2*BLOCK_LEN];
AFfilehandle inhandle1;
AFfilehandle inhandle2;
AFfilehandle outhandle;
AFfilesetup filesetup;
SNDFILE *inhandle1;
SNDFILE *inhandle2;
SNDFILE *outhandle;
int outframes;
int samples;
int i;
@@ -242,49 +208,29 @@ static void test_both_ways_model(int line_model_no, int speech_test)
awgn_init_dbm0(&noise1, 1234567, -10.0f);
awgn_init_dbm0(&noise2, 1234567, -10.0f);
filesetup = afNewFileSetup();
if (filesetup == AF_NULL_FILESETUP)
if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
{
fprintf(stderr, " Failed to create file setup\n");
fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME1);
exit(2);
}
afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
afInitFileFormat(filesetup, AF_FILE_WAVE);
afInitChannels(filesetup, AF_DEFAULT_TRACK, 2);
inhandle1 = afOpenFile(IN_FILE_NAME1, "r", NULL);
if (inhandle1 == AF_NULL_FILEHANDLE)
if ((inhandle2 = sf_open_telephony_read(IN_FILE_NAME2, 1)) == NULL)
{
fprintf(stderr, " Cannot open wave file '%s'\n", IN_FILE_NAME1);
fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME2);
exit(2);
}
inhandle2 = afOpenFile(IN_FILE_NAME2, "r", NULL);
if (inhandle2 == AF_NULL_FILEHANDLE)
if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 2)) == NULL)
{
fprintf(stderr, " Cannot open wave file '%s'\n", IN_FILE_NAME2);
exit(2);
}
outhandle = afOpenFile(OUT_FILE_NAME, "w", filesetup);
if (outhandle == AF_NULL_FILEHANDLE)
{
fprintf(stderr, " Cannot create wave file '%s'\n", OUT_FILE_NAME);
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME);
exit(2);
}
for (i = 0; i < 10000; i++)
{
if (speech_test)
{
samples = afReadFrames(inhandle1,
AF_DEFAULT_TRACK,
input1,
BLOCK_LEN);
samples = sf_readf_short(inhandle1, input1, BLOCK_LEN);
if (samples == 0)
break;
samples = afReadFrames(inhandle2,
AF_DEFAULT_TRACK,
input2,
samples);
samples = sf_readf_short(inhandle2, input2, samples);
if (samples == 0)
break;
}
@@ -308,32 +254,28 @@ static void test_both_ways_model(int line_model_no, int speech_test)
amp[2*j] = output1[j];
amp[2*j + 1] = output2[j];
}
outframes = afWriteFrames(outhandle,
AF_DEFAULT_TRACK,
amp,
samples);
outframes = sf_writef_short(outhandle, amp, samples);
if (outframes != samples)
{
fprintf(stderr, " Error writing wave file\n");
fprintf(stderr, " Error writing audio file\n");
exit(2);
}
}
if (afCloseFile(inhandle1))
if (sf_close(inhandle1))
{
fprintf(stderr, " Cannot close wave file '%s'\n", IN_FILE_NAME1);
fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME1);
exit(2);
}
if (afCloseFile(inhandle2))
if (sf_close(inhandle2))
{
fprintf(stderr, " Cannot close wave file '%s'\n", IN_FILE_NAME2);
fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME2);
exit(2);
}
if (afCloseFile(outhandle))
if (sf_close(outhandle))
{
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_NAME);
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME);
exit(2);
}
afFreeFileSetup(filesetup);
both_ways_line_model_release(model);
}
/*- End of function --------------------------------------------------------*/