Some tweaks to spandsp tests

This commit is contained in:
Steve Underwood 2011-12-06 00:44:47 +08:00
parent 7da637d119
commit 62f21d8d57
4 changed files with 16 additions and 17 deletions

View File

@ -228,7 +228,6 @@ static int test_x_06(void)
char dtmf[1024]; char dtmf[1024];
char result[1024]; char result[1024];
const char *ref; const char *ref;
int len;
int i; int i;
/* III.5.4.5.6 DTMF character conversion */ /* III.5.4.5.6 DTMF character conversion */
@ -237,14 +236,14 @@ static int test_x_06(void)
msg[127] = '\0'; msg[127] = '\0';
printf("%s\n", msg); printf("%s\n", msg);
len = v18_encode_dtmf(NULL, dtmf, msg); v18_encode_dtmf(NULL, dtmf, msg);
printf("%s\n", dtmf); printf("%s\n", dtmf);
len = v18_decode_dtmf(NULL, result, dtmf); v18_decode_dtmf(NULL, result, dtmf);
ref = "\b \n\n\n?\n\n\n %+().+,-.0123456789:;(=)" ref = "\b \n\n\n?\n\n\n %+().+,-.0123456789:;(=)"
"?XABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ" "?XABCDEFGHIJKLMNOPQRSTUVWXYZ\xC6\xD8\xC5"
" abcdefghijklmnopqrstuvwxyzæøå \b"; " abcdefghijklmnopqrstuvwxyz\xE6\xF8\xE5 \b";
printf("Result:\n%s\n", result); printf("Result:\n%s\n", result);
printf("Reference result:\n%s\n", ref); printf("Reference result:\n%s\n", ref);

View File

@ -224,6 +224,7 @@ int main(int argc, char *argv[])
int log_audio; int log_audio;
int channel_codec; int channel_codec;
int rbs_pattern; int rbs_pattern;
int guard_tone_option;
int opt; int opt;
channel_codec = MUNGE_CODEC_NONE; channel_codec = MUNGE_CODEC_NONE;
@ -234,8 +235,9 @@ int main(int argc, char *argv[])
noise_level = -70; noise_level = -70;
signal_level = -13; signal_level = -13;
bits_per_test = 50000; bits_per_test = 50000;
guard_tone_option = V22BIS_GUARD_TONE_1800HZ;
log_audio = FALSE; log_audio = FALSE;
while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:r:s:")) != -1) while ((opt = getopt(argc, argv, "b:B:c:d:gG:lm:n:r:s:")) != -1)
{ {
switch (opt) switch (opt)
{ {
@ -264,6 +266,9 @@ int main(int argc, char *argv[])
exit(2); exit(2);
#endif #endif
break; break;
case 'G':
guard_tone_option = atoi(optarg);
break;
case 'l': case 'l':
log_audio = TRUE; log_audio = TRUE;
break; break;
@ -309,7 +314,7 @@ int main(int argc, char *argv[])
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
endpoint[i].v22bis = v22bis_init(NULL, test_bps, V22BIS_GUARD_TONE_1800HZ, (i == 0), v22bis_getbit, &endpoint[i], v22bis_putbit, &endpoint[i]); endpoint[i].v22bis = v22bis_init(NULL, test_bps, guard_tone_option, (i == 0), v22bis_getbit, &endpoint[i], v22bis_putbit, &endpoint[i]);
v22bis_tx_power(endpoint[i].v22bis, signal_level); v22bis_tx_power(endpoint[i].v22bis, signal_level);
/* Move the carrier off a bit */ /* Move the carrier off a bit */
endpoint[i].v22bis->tx.carrier_phase_rate = dds_phase_ratef((i == 0) ? 1207.0f : 2407.0f); endpoint[i].v22bis->tx.carrier_phase_rate = dds_phase_ratef((i == 0) ? 1207.0f : 2407.0f);
@ -420,7 +425,7 @@ int main(int argc, char *argv[])
} }
if (log_audio) if (log_audio)
{ {
if (sf_close_telephony(outhandle) != 0) if (sf_close_telephony(outhandle))
{ {
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME);
exit(2); exit(2);

View File

@ -514,7 +514,6 @@ int main(int argc, char *argv[])
{ {
int16_t amp[SAMPLES_PER_CHUNK]; int16_t amp[SAMPLES_PER_CHUNK];
int samples; int samples;
int remnant;
int caller_available_modulations; int caller_available_modulations;
int answerer_available_modulations; int answerer_available_modulations;
SNDFILE *inhandle; SNDFILE *inhandle;
@ -622,10 +621,10 @@ int main(int argc, char *argv[])
while ((samples = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK))) while ((samples = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK)))
{ {
remnant = v8_rx(v8_caller, amp, samples); v8_rx(v8_caller, amp, samples);
remnant = v8_rx(v8_answerer, amp, samples); v8_rx(v8_answerer, amp, samples);
remnant = v8_tx(v8_caller, amp, samples); v8_tx(v8_caller, amp, samples);
remnant = v8_tx(v8_answerer, amp, samples); v8_tx(v8_answerer, amp, samples);
} }
/*endwhile*/ /*endwhile*/

View File

@ -110,15 +110,11 @@ static int test_vec_min_maxi16(void)
int32_t za; int32_t za;
int32_t zb; int32_t zb;
int16_t x[99]; int16_t x[99];
int16_t y[99];
int16_t outa[2]; int16_t outa[2];
int16_t outb[2]; int16_t outb[2];
for (i = 0; i < 99; i++) for (i = 0; i < 99; i++)
{
x[i] = rand(); x[i] = rand();
y[i] = rand();
}
x[42] = -32768; x[42] = -32768;
za = vec_min_maxi16_dumb(x, 99, outa); za = vec_min_maxi16_dumb(x, 99, outa);