提交 287678bc authored 作者: Steve Underwood's avatar Steve Underwood

Tweaks to spandsp tests

Addition of tones to modem connect tones
Repeat function for V.18 TDD
上级 860b5318
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
MAINTAINERCLEANFILES = Makefile.in
DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \ DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \
$(srcdir)/math_fixed_tables.h \ $(srcdir)/math_fixed_tables.h \
$(srcdir)/v17_v32bis_rx_fixed_rrc.h \ $(srcdir)/v17_v32bis_rx_fixed_rrc.h \
...@@ -46,6 +44,10 @@ DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \ ...@@ -46,6 +44,10 @@ DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \
$(srcdir)/v29tx_fixed_rrc.h \ $(srcdir)/v29tx_fixed_rrc.h \
$(srcdir)/v29tx_floating_rrc.h $(srcdir)/v29tx_floating_rrc.h
CLEANFILES = ${DISTCLEANFILES}
MOSTLYCLEANFILES = ${DISTCLEANFILES}
MAINTAINERCLEANFILES = ${DISTCLEANFILES}
EXTRA_DIST = floating_fudge.h \ EXTRA_DIST = floating_fudge.h \
libspandsp.dsp \ libspandsp.dsp \
libspandsp.2005.sln \ libspandsp.2005.sln \
...@@ -322,7 +324,8 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \ ...@@ -322,7 +324,8 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \
nodist_include_HEADERS = spandsp.h nodist_include_HEADERS = spandsp.h
noinst_HEADERS = faxfont.h \ noinst_HEADERS = cielab_luts.h \
faxfont.h \
filter_tools.h \ filter_tools.h \
gsm0610_local.h \ gsm0610_local.h \
lpc10_encdecs.h \ lpc10_encdecs.h \
......
...@@ -179,27 +179,30 @@ SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data, int bit) ...@@ -179,27 +179,30 @@ SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data, int bit)
{ {
/* Align the received value */ /* Align the received value */
if (s->data_bits < 8) if (s->data_bits < 8)
s->byte_in_progress >>= (8 - s->data_bits); s->byte_in_progress = (s->byte_in_progress & 0xFF) >> (8 - s->data_bits);
s->put_byte(s->user_data, s->byte_in_progress); s->put_byte(s->user_data, s->byte_in_progress);
s->bitpos = 0; s->bitpos = 0;
} }
else if (s->use_v14)
{
/* This is actually the start bit for the next character, and
the stop bit has been dropped from the stream. This is the
rate adaption specified in V.14 */
/* Align the received value */
if (s->data_bits < 8)
s->byte_in_progress >>= (8 - s->data_bits);
s->put_byte(s->user_data, s->byte_in_progress);
s->bitpos = 1;
s->parity_bit = 0;
s->byte_in_progress = 0;
}
else else
{ {
s->framing_errors++; if (s->use_v14)
s->bitpos = 0; {
/* This is actually the start bit for the next character, and
the stop bit has been dropped from the stream. This is the
rate adaption specified in V.14 */
/* Align the received value */
if (s->data_bits < 8)
s->byte_in_progress = (s->byte_in_progress & 0xFF) >> (8 - s->data_bits);
s->put_byte(s->user_data, s->byte_in_progress);
s->bitpos = 1;
s->parity_bit = 0;
s->byte_in_progress = 0;
}
else
{
s->framing_errors++;
s->bitpos = 0;
}
} }
} }
} }
......
差异被折叠。
...@@ -336,6 +336,7 @@ SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s) ...@@ -336,6 +336,7 @@ SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s)
{ {
if (s) if (s)
free(s); free(s);
/*endif*/
return 0; return 0;
} }
/*- End of function --------------------------------------------------------*/ /*- End of function --------------------------------------------------------*/
......
...@@ -70,16 +70,16 @@ const fsk_spec_t preset_fsk_specs[] = ...@@ -70,16 +70,16 @@ const fsk_spec_t preset_fsk_specs[] =
}, },
{ {
"V23 ch 1", "V23 ch 1",
2100, 1700 + 400,
1300, 1700 - 400,
-14, -14,
-30, -30,
1200*100 1200*100
}, },
{ {
"V23 ch 2", "V23 ch 2",
450, 420 + 30,
390, 420 - 30,
-14, -14,
-30, -30,
75*100 75*100
...@@ -102,27 +102,35 @@ const fsk_spec_t preset_fsk_specs[] = ...@@ -102,27 +102,35 @@ const fsk_spec_t preset_fsk_specs[] =
}, },
{ {
"Bell202", "Bell202",
2200, 1700 + 500,
1200, 1700 - 500,
-14, -14,
-30, -30,
1200*100 1200*100
}, },
{ {
"Weitbrecht 45.45", /* Used for TDD (Telecoms Device for the Deaf) */ "Weitbrecht 45.45", /* Used for US TDD (Telecoms Device for the Deaf) */
1800, 1600 + 200,
1400, 1600 - 200,
-14, -14,
-30, -30,
4545 4545
}, },
{ {
"Weitbrecht 50", /* Used for TDD (Telecoms Device for the Deaf) */ "Weitbrecht 50", /* Used for Internatioal TDD (Telecoms Device for the Deaf) */
1800, 1600 + 200,
1400, 1600 - 200,
-14, -14,
-30, -30,
5000 50*100
},
{
"V21 (110bps) ch 1",
1080 + 100,
1080 - 100,
-14,
-30,
110*100
} }
}; };
...@@ -476,6 +484,10 @@ SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len) ...@@ -476,6 +484,10 @@ SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len)
s->put_bit(s->put_bit_user_data, baudstate); s->put_bit(s->put_bit_user_data, baudstate);
} }
break; break;
case FSK_FRAME_MODE_5N1_FRAMES:
case FSK_FRAME_MODE_7N1_FRAMES:
case FSK_FRAME_MODE_7E1_FRAMES:
case FSK_FRAME_MODE_7E2_FRAMES:
default: default:
/* Gather the specified number of bits, with robust checking to ensure reasonable voice immunity. /* Gather the specified number of bits, with robust checking to ensure reasonable voice immunity.
The first bit should be a start bit (0), and the last bit should be a stop bit (1) */ The first bit should be a start bit (0), and the last bit should be a stop bit (1) */
...@@ -527,24 +539,22 @@ SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len) ...@@ -527,24 +539,22 @@ SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len)
state as the next bit */ state as the next bit */
if (s->last_bit == baudstate) if (s->last_bit == baudstate)
{ {
s->frame_bits |= (baudstate << s->framing_mode);
s->frame_bits >>= 1;
s->baud_phase -= (SAMPLE_RATE*100);
if (++s->frame_state > s->framing_mode) if (++s->frame_state > s->framing_mode)
{ {
/* Check we have a stop bit */ /* Check we have a stop bit and a start bit */
if (baudstate == 1) if (baudstate == 1 && (s->frame_bits & 0x02) == 0)
{ {
/* Check we have a start bit */ /* Drop the start bit, and pass the rest back */
if ((s->frame_bits & 1) == 0) s->put_bit(s->put_bit_user_data, s->frame_bits >> 2);
{
/* Drop the start bit, and pass the rest back */
s->frame_bits >>= 1;
s->put_bit(s->put_bit_user_data, s->frame_bits);
}
} }
s->frame_state = 0; s->frame_state = 0;
} }
else
{
s->frame_bits |= (baudstate << s->framing_mode);
s->frame_bits >>= 1;
}
s->baud_phase -= (SAMPLE_RATE*100);
} }
else else
{ {
......
...@@ -94,6 +94,8 @@ SPAN_DECLARE(const char *) modem_connect_tone_to_str(int tone) ...@@ -94,6 +94,8 @@ SPAN_DECLARE(const char *) modem_connect_tone_to_str(int tone)
return "FAX preamble"; return "FAX preamble";
case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE: case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE:
return "FAX CED or preamble"; return "FAX CED or preamble";
case MODEM_CONNECT_TONES_BELL_ANS:
return "Bell ANS";
case MODEM_CONNECT_TONES_CALLING_TONE: case MODEM_CONNECT_TONES_CALLING_TONE:
return "Calling tone"; return "Calling tone";
} }
...@@ -206,6 +208,20 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t * ...@@ -206,6 +208,20 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *
} }
s->duration_timer -= len; s->duration_timer -= len;
break; break;
case MODEM_CONNECT_TONES_BELL_ANS:
if (s->duration_timer < len)
len = s->duration_timer;
if (s->duration_timer > ms_to_samples(2600))
{
/* There is some initial silence to be generated. */
if ((i = s->duration_timer - ms_to_samples(2600)) > len)
i = len;
memset(amp, 0, sizeof(int16_t)*i);
}
for ( ; i < len; i++)
amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, s->level, 0);
s->duration_timer -= len;
break;
case MODEM_CONNECT_TONES_CALLING_TONE: case MODEM_CONNECT_TONES_CALLING_TONE:
for ( ; i < len; i++) for ( ; i < len; i++)
{ {
...@@ -301,6 +317,17 @@ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem ...@@ -301,6 +317,17 @@ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem
s->mod_phase = 0; s->mod_phase = 0;
s->hop_timer = ms_to_samples(450); s->hop_timer = ms_to_samples(450);
break; break;
case MODEM_CONNECT_TONES_BELL_ANS:
/* 0.2s of silence, then 2.6s to 4s of 2225Hz+-15Hz tone, then 75ms of silence. */
s->tone_phase_rate = dds_phase_rate(2225.0);
s->level = dds_scaling_dbm0(-11);
s->mod_phase_rate = 0;
s->mod_level = 0;
s->duration_timer = ms_to_samples(200 + 2600);
s->tone_phase = 0;
s->mod_phase = 0;
s->hop_timer = 0;
break;
case MODEM_CONNECT_TONES_CALLING_TONE: case MODEM_CONNECT_TONES_CALLING_TONE:
/* 0.6s of 1300Hz+-15Hz + 2.0s of silence repeating. */ /* 0.6s of 1300Hz+-15Hz + 2.0s of silence repeating. */
s->tone_phase_rate = dds_phase_rate(1300.0); s->tone_phase_rate = dds_phase_rate(1300.0);
...@@ -441,7 +468,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * ...@@ -441,7 +468,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
/* A Cauer notch at 1100Hz, spread just wide enough to meet our detection bandwidth /* A Cauer notch at 1100Hz, spread just wide enough to meet our detection bandwidth
criteria. */ criteria. */
/* Poles 0.736618498*exp(+-1047/4000 * PI * j) /* Poles 0.736618498*exp(+-1047/4000 * PI * j)
Zeroes exp(+-1099.5 * PI * j) */ Zeroes exp(+-1099.5/4000 * PI * j) */
v1 = 0.792928f*famp + 1.0018744927985f*s->znotch_1 - 0.54196833412465f*s->znotch_2; v1 = 0.792928f*famp + 1.0018744927985f*s->znotch_1 - 0.54196833412465f*s->znotch_2;
famp = v1 - 1.2994747954630f*s->znotch_1 + s->znotch_2; famp = v1 - 1.2994747954630f*s->znotch_1 + s->znotch_2;
s->znotch_2 = s->znotch_1; s->znotch_2 = s->znotch_1;
...@@ -487,7 +514,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * ...@@ -487,7 +514,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
famp = amp[i]; famp = amp[i];
/* A Cauer bandpass at 15Hz, with which we demodulate the AM signal. */ /* A Cauer bandpass at 15Hz, with which we demodulate the AM signal. */
/* Poles 0.9983989*exp(+-15/4000 * PI * j) /* Poles 0.9983989*exp(+-15/4000 * PI * j)
Zeroes exp(0 * PI * j) */ Zeroes exp(0/4000 * PI * j) */
v1 = fabs(famp) + 1.996667f*s->z15hz_1 - 0.9968004f*s->z15hz_2; v1 = fabs(famp) + 1.996667f*s->z15hz_1 - 0.9968004f*s->z15hz_2;
filtered = 0.001599787f*(v1 - s->z15hz_2); filtered = 0.001599787f*(v1 - s->z15hz_2);
s->z15hz_2 = s->z15hz_1; s->z15hz_2 = s->z15hz_1;
...@@ -497,8 +524,8 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * ...@@ -497,8 +524,8 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
/* A Cauer notch at 2100Hz, spread just wide enough to meet our detection bandwidth /* A Cauer notch at 2100Hz, spread just wide enough to meet our detection bandwidth
criteria. */ criteria. */
/* Poles 0.7144255*exp(+-2105.612/4000 * PI * j) /* Poles 0.7144255*exp(+-2105.612/4000 * PI * j)
Zeroes exp(+-2099.9 * PI * j) */ Zeroes exp(+-2099.9/4000 * PI * j) */
v1 = 0.76000f*famp - 0.1183852f*s->znotch_1 - 0.5104039f*s->znotch_2; v1 = 0.7552f*famp - 0.1183852f*s->znotch_1 - 0.5104039f*s->znotch_2;
famp = v1 + 0.1567596f*s->znotch_1 + s->znotch_2; famp = v1 + 0.1567596f*s->znotch_1 + s->znotch_2;
s->znotch_2 = s->znotch_1; s->znotch_2 = s->znotch_1;
s->znotch_1 = v1; s->znotch_1 = v1;
...@@ -585,6 +612,44 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * ...@@ -585,6 +612,44 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
} }
} }
break; break;
case MODEM_CONNECT_TONES_BELL_ANS:
for (i = 0; i < len; i++)
{
famp = amp[i];
/* A Cauer notch at 2225Hz, spread just wide enough to meet our detection bandwidth
criteria. */
/* Poles 0.7144255*exp(+-2230.612/4000 * PI * j)
Zeroes exp(+-2224.9/4000 * PI * j) */
v1 = 0.739651f*famp - 0.257384f*s->znotch_1 - 0.510404f*s->znotch_2;
famp = v1 + 0.351437f*s->znotch_1 + s->znotch_2;
s->znotch_2 = s->znotch_1;
s->znotch_1 = v1;
notched = (int16_t) lfastrintf(famp);
/* Estimate the overall energy in the channel, and the energy in
the notch (i.e. overall channel energy - tone energy => noise).
Use abs instead of multiply for speed (is it really faster?). */
s->channel_level += ((abs(amp[i]) - s->channel_level) >> 5);
s->notch_level += ((abs(notched) - s->notch_level) >> 5);
if (s->channel_level > 70 && s->notch_level*6 < s->channel_level)
{
/* There is adequate energy in the channel, and it is mostly at 2225Hz. */
if (s->tone_present != MODEM_CONNECT_TONES_BELL_ANS)
{
if (++s->tone_cycle_duration >= ms_to_samples(415))
report_tone_state(s, MODEM_CONNECT_TONES_BELL_ANS, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
}
}
else
{
/* If the signal looks wrong, even for a moment, we consider this the
end of the tone. */
if (s->tone_present == MODEM_CONNECT_TONES_BELL_ANS)
report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99);
s->tone_cycle_duration = 0;
}
}
break;
case MODEM_CONNECT_TONES_CALLING_TONE: case MODEM_CONNECT_TONES_CALLING_TONE:
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
...@@ -592,7 +657,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * ...@@ -592,7 +657,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
/* A Cauer notch at 1300Hz, spread just wide enough to meet our detection bandwidth /* A Cauer notch at 1300Hz, spread just wide enough to meet our detection bandwidth
criteria. */ criteria. */
/* Poles 0.736618498*exp(+-1247/4000 * PI * j) /* Poles 0.736618498*exp(+-1247/4000 * PI * j)
Zeroes exp(+-1299.5 * PI * j) */ Zeroes exp(+-1299.5/4000 * PI * j) */
v1 = 0.755582f*famp + 0.820887174515f*s->znotch_1 - 0.541968324778f*s->znotch_2; v1 = 0.755582f*famp + 0.820887174515f*s->znotch_1 - 0.541968324778f*s->znotch_2;
famp = v1 - 1.0456667108f*s->znotch_1 + s->znotch_2; famp = v1 - 1.0456667108f*s->znotch_1 + s->znotch_2;
s->znotch_2 = s->znotch_1; s->znotch_2 = s->znotch_1;
......
...@@ -110,7 +110,8 @@ enum ...@@ -110,7 +110,8 @@ enum
FSK_BELL103CH2, FSK_BELL103CH2,
FSK_BELL202, FSK_BELL202,
FSK_WEITBRECHT, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */ FSK_WEITBRECHT, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */
FSK_WEITBRECHT50 /* 50 baud version, used for TDD (Telecom Device for the Deaf) */ FSK_WEITBRECHT50, /* 50 baud version, used for TDD (Telecom Device for the Deaf) */
FSK_V21CH1_110 /* 110 bps version of V.21 channel 1, as used by V.18 */
}; };
enum enum
...@@ -119,7 +120,8 @@ enum ...@@ -119,7 +120,8 @@ enum
FSK_FRAME_MODE_SYNC = 1, FSK_FRAME_MODE_SYNC = 1,
FSK_FRAME_MODE_5N1_FRAMES = 7, /* 5 bits of data + start bit + stop bit */ FSK_FRAME_MODE_5N1_FRAMES = 7, /* 5 bits of data + start bit + stop bit */
FSK_FRAME_MODE_7N1_FRAMES = 9, /* 7 bits of data + start bit + stop bit */ FSK_FRAME_MODE_7N1_FRAMES = 9, /* 7 bits of data + start bit + stop bit */
FSK_FRAME_MODE_8N1_FRAMES = 10 /* 8 bits of data + start bit + stop bit */ FSK_FRAME_MODE_7E1_FRAMES = 10, /* 7 bits of data + even parity + start bit + stop bit */
FSK_FRAME_MODE_7E2_FRAMES = 11 /* 7 bits of data + even parity + start bit + 2 stop bits */
}; };
SPAN_DECLARE_DATA extern const fsk_spec_t preset_fsk_specs[]; SPAN_DECLARE_DATA extern const fsk_spec_t preset_fsk_specs[];
......
...@@ -76,9 +76,11 @@ enum ...@@ -76,9 +76,11 @@ enum
This is only valid as a tone type to receive. It is never reported as a detected tone This is only valid as a tone type to receive. It is never reported as a detected tone
type. The report will either be for FAX preamble or CED/ANS tone. */ type. The report will either be for FAX preamble or CED/ANS tone. */
MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE = 7, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE = 7,
/*! \brief Bell ANS tone is a pure continuous 2225Hz+-15Hz tone for 3.3s+-0.7s. */
MODEM_CONNECT_TONES_BELL_ANS = 8,
/*! \brief Calling tone is a pure 1300Hz tone, in 0.6s bursts, with 2s silences in between. The /*! \brief Calling tone is a pure 1300Hz tone, in 0.6s bursts, with 2s silences in between. The
bursts repeat for as long as is required. */ bursts repeat for as long as is required. */
MODEM_CONNECT_TONES_CALLING_TONE = 8 MODEM_CONNECT_TONES_CALLING_TONE = 9
}; };
/*! \brief FAX CED tone is the same as ANS tone. */ /*! \brief FAX CED tone is the same as ANS tone. */
......
...@@ -45,7 +45,7 @@ struct async_tx_state_s ...@@ -45,7 +45,7 @@ struct async_tx_state_s
void *user_data; void *user_data;
/*! \brief A current, partially transmitted, character. */ /*! \brief A current, partially transmitted, character. */
int byte_in_progress; unsigned int byte_in_progress;
/*! \brief The current bit position within a partially transmitted character. */ /*! \brief The current bit position within a partially transmitted character. */
int bitpos; int bitpos;
/*! \brief Parity bit. */ /*! \brief Parity bit. */
...@@ -73,7 +73,7 @@ struct async_rx_state_s ...@@ -73,7 +73,7 @@ struct async_rx_state_s
void *user_data; void *user_data;
/*! \brief A current, partially complete, character. */ /*! \brief A current, partially complete, character. */
int byte_in_progress; unsigned int byte_in_progress;
/*! \brief The current bit position within a partially complete character. */ /*! \brief The current bit position within a partially complete character. */
int bitpos; int bitpos;
/*! \brief Parity bit. */ /*! \brief Parity bit. */
......
...@@ -56,6 +56,7 @@ struct v18_state_s ...@@ -56,6 +56,7 @@ struct v18_state_s
int rx_msg_len; int rx_msg_len;
int bit_pos; int bit_pos;
int in_progress; int in_progress;
int repeat_shifts;
/*! \brief Error and flow logging control */ /*! \brief Error and flow logging control */
logging_state_t logging; logging_state_t logging;
......
差异被折叠。
...@@ -479,7 +479,7 @@ int main(int argc, char *argv[]) ...@@ -479,7 +479,7 @@ int main(int argc, char *argv[])
int attack_packets; int attack_packets;
int opt; int opt;
attack_packets = 10000000; attack_packets = 100000;
while ((opt = getopt(argc, argv, "a:")) != -1) while ((opt = getopt(argc, argv, "a:")) != -1)
{ {
switch (opt) switch (opt)
......
...@@ -62,7 +62,7 @@ t4_state_t receive_state; ...@@ -62,7 +62,7 @@ t4_state_t receive_state;
#define FILL_670 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_70 #define FILL_670 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_70
#define FILL_980 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_80 #define FILL_980 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_80
static const char t4_test_patterns[][1728 + 1] = static const char t4_t6_test_patterns[][1728 + 1] =
{ {
"XXXXXX " FILL_980 " XXX XXX X " FILL_670 " XXXX", "XXXXXX " FILL_980 " XXX XXX X " FILL_670 " XXXX",
"XXXXXX " FILL_980 " XXX X " FILL_670 " XXXX", "XXXXXX " FILL_980 " XXX X " FILL_670 " XXXX",
...@@ -145,7 +145,7 @@ static int row_read_handler(void *user_data, uint8_t buf[], size_t len) ...@@ -145,7 +145,7 @@ static int row_read_handler(void *user_data, uint8_t buf[], size_t len)
/* Send the test pattern. */ /* Send the test pattern. */
if (rows_read >= 16) if (rows_read >= 16)
return 0; return 0;
s = t4_test_patterns[rows_read++]; s = t4_t6_test_patterns[rows_read++];
memset(buf, 0, len); memset(buf, 0, len);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
...@@ -171,7 +171,7 @@ static int row_write_handler(void *user_data, const uint8_t buf[], size_t len) ...@@ -171,7 +171,7 @@ static int row_write_handler(void *user_data, const uint8_t buf[], size_t len)
/* Verify that what is received matches the test pattern. */ /* Verify that what is received matches the test pattern. */
if (len == 0) if (len == 0)
return 0; return 0;
s = t4_test_patterns[rows_written++]; s = t4_t6_test_patterns[rows_written++];
memset(ref, 0, len); memset(ref, 0, len);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
......
...@@ -972,7 +972,6 @@ static int next_step(faxtester_state_t *s) ...@@ -972,7 +972,6 @@ static int next_step(faxtester_state_t *s)
printf("Test failed\n"); printf("Test failed\n");
exit(2); exit(2);
} }
t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits);
t4_tx_set_header_info(&t4_tx_state, NULL); t4_tx_set_header_info(&t4_tx_state, NULL);
compression_type = T4_COMPRESSION_ITU_T4_1D; compression_type = T4_COMPRESSION_ITU_T4_1D;
if (compression) if (compression)
...@@ -983,6 +982,7 @@ static int next_step(faxtester_state_t *s) ...@@ -983,6 +982,7 @@ static int next_step(faxtester_state_t *s)
compression_type = T4_COMPRESSION_ITU_T6; compression_type = T4_COMPRESSION_ITU_T6;
} }
t4_tx_set_tx_encoding(&t4_tx_state, compression_type); t4_tx_set_tx_encoding(&t4_tx_state, compression_type);
t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits);
if (t4_tx_start_page(&t4_tx_state)) if (t4_tx_start_page(&t4_tx_state))
{ {
span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n"); span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n");
...@@ -996,7 +996,7 @@ static int next_step(faxtester_state_t *s) ...@@ -996,7 +996,7 @@ static int next_step(faxtester_state_t *s)
corrupt_image(s, image, len, (const char *) bad_rows); corrupt_image(s, image, len, (const char *) bad_rows);
} }
t4_tx_release(&t4_tx_state); t4_tx_release(&t4_tx_state);
span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM image is %d bytes\n", len); span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM image is %d bytes (min row bits %d)\n", len, min_row_bits);
faxtester_set_non_ecm_image_buffer(s, image, len); faxtester_set_non_ecm_image_buffer(s, image, len);
} }
else if (strcasecmp((const char *) type, "PP") == 0) else if (strcasecmp((const char *) type, "PP") == 0)
...@@ -1012,7 +1012,6 @@ static int next_step(faxtester_state_t *s) ...@@ -1012,7 +1012,6 @@ static int next_step(faxtester_state_t *s)
printf("Test failed\n"); printf("Test failed\n");
exit(2); exit(2);
} }
t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits);
t4_tx_set_header_info(&t4_tx_state, NULL); t4_tx_set_header_info(&t4_tx_state, NULL);
compression_type = T4_COMPRESSION_ITU_T4_1D; compression_type = T4_COMPRESSION_ITU_T4_1D;
if (compression) if (compression)
...@@ -1023,6 +1022,7 @@ static int next_step(faxtester_state_t *s) ...@@ -1023,6 +1022,7 @@ static int next_step(faxtester_state_t *s)
compression_type = T4_COMPRESSION_ITU_T6; compression_type = T4_COMPRESSION_ITU_T6;
} }
t4_tx_set_tx_encoding(&t4_tx_state, compression_type); t4_tx_set_tx_encoding(&t4_tx_state, compression_type);
t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits);
if (t4_tx_start_page(&t4_tx_state)) if (t4_tx_start_page(&t4_tx_state))
{ {
span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n"); span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n");
...@@ -1038,7 +1038,7 @@ static int next_step(faxtester_state_t *s) ...@@ -1038,7 +1038,7 @@ static int next_step(faxtester_state_t *s)
} }
/*endif*/ /*endif*/
t4_tx_release(&t4_tx_state); t4_tx_release(&t4_tx_state);
span_log(&s->logging, SPAN_LOG_FLOW, "ECM image is %d bytes\n", len); span_log(&s->logging, SPAN_LOG_FLOW, "ECM image is %d bytes (min row bits %d)\n", len, min_row_bits);
faxtester_set_ecm_image_buffer(s, image, len, ecm_block, ecm_frame_size, i); faxtester_set_ecm_image_buffer(s, image, len, ecm_block, ecm_frame_size, i);
} }
else else
......
...@@ -227,11 +227,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex ...@@ -227,11 +227,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
#endif #endif
#if defined(ENABLE_GUI) #if defined(ENABLE_GUI)
if (use_gui) if (use_gui)
{
#if defined(SPANDSP_USE_FIXED_POINTx) #if defined(SPANDSP_USE_FIXED_POINTx)
qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); qam_monitor_update_int_equalizer(qam_monitor, coeffs, len);
#else #else
qam_monitor_update_equalizer(qam_monitor, coeffs, len); qam_monitor_update_equalizer(qam_monitor, coeffs, len);
#endif #endif
}
#endif #endif
update_interval = 100; update_interval = 100;
} }
......
...@@ -228,11 +228,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex ...@@ -228,11 +228,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
#endif #endif
#if defined(ENABLE_GUI) #if defined(ENABLE_GUI)
if (use_gui) if (use_gui)
{
#if defined(SPANDSP_USE_FIXED_POINTx) #if defined(SPANDSP_USE_FIXED_POINTx)
qam_monitor_update_int_equalizer(s->qam_monitor, coeffs, len); qam_monitor_update_int_equalizer(s->qam_monitor, coeffs, len);
#else #else
qam_monitor_update_equalizer(s->qam_monitor, coeffs, len); qam_monitor_update_equalizer(s->qam_monitor, coeffs, len);
#endif #endif
}
#endif #endif
} }
} }
......
...@@ -260,11 +260,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex ...@@ -260,11 +260,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
#endif #endif
#if defined(ENABLE_GUI) #if defined(ENABLE_GUI)
if (use_gui) if (use_gui)
{
#if defined(SPANDSP_USE_FIXED_POINTx) #if defined(SPANDSP_USE_FIXED_POINTx)
qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); qam_monitor_update_int_equalizer(qam_monitor, coeffs, len);
#else #else
qam_monitor_update_equalizer(qam_monitor, coeffs, len); qam_monitor_update_equalizer(qam_monitor, coeffs, len);
#endif #endif
}
#endif #endif
} }
} }
......
...@@ -244,11 +244,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex ...@@ -244,11 +244,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
#endif #endif
#if defined(ENABLE_GUI) #if defined(ENABLE_GUI)
if (use_gui) if (use_gui)
{
#if defined(SPANDSP_USE_FIXED_POINT) #if defined(SPANDSP_USE_FIXED_POINT)
qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); qam_monitor_update_int_equalizer(qam_monitor, coeffs, len);
#else #else
qam_monitor_update_equalizer(qam_monitor, coeffs, len); qam_monitor_update_equalizer(qam_monitor, coeffs, len);
#endif #endif
}
#endif #endif
update_interval = 100; update_interval = 100;
} }
......
...@@ -206,6 +206,8 @@ static int v8_calls_v8_tests(SNDFILE *outhandle) ...@@ -206,6 +206,8 @@ static int v8_calls_v8_tests(SNDFILE *outhandle)
negotiations_ok = 0; negotiations_ok = 0;
v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE; v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
v8_call_parms.send_ci = TRUE;
v8_call_parms.v92 = -1;
v8_call_parms.call_function = V8_CALL_V_SERIES; v8_call_parms.call_function = V8_CALL_V_SERIES;
v8_call_parms.modulations = caller_available_modulations; v8_call_parms.modulations = caller_available_modulations;
v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42; v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42;
...@@ -219,6 +221,8 @@ static int v8_calls_v8_tests(SNDFILE *outhandle) ...@@ -219,6 +221,8 @@ static int v8_calls_v8_tests(SNDFILE *outhandle)
handler, handler,
(void *) "caller"); (void *) "caller");
v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR;
v8_answer_parms.send_ci = TRUE;
v8_answer_parms.v92 = -1;
v8_answer_parms.call_function = V8_CALL_V_SERIES; v8_answer_parms.call_function = V8_CALL_V_SERIES;
v8_answer_parms.modulations = answerer_available_modulations; v8_answer_parms.modulations = answerer_available_modulations;
v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42; v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42;
...@@ -329,6 +333,8 @@ static int non_v8_calls_v8_tests(SNDFILE *outhandle) ...@@ -329,6 +333,8 @@ static int non_v8_calls_v8_tests(SNDFILE *outhandle)
non_v8_caller_rx = modem_connect_tones_rx_init(NULL, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL); non_v8_caller_rx = modem_connect_tones_rx_init(NULL, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL);
v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR;
v8_answer_parms.send_ci = TRUE;
v8_answer_parms.v92 = -1;
v8_answer_parms.call_function = V8_CALL_V_SERIES; v8_answer_parms.call_function = V8_CALL_V_SERIES;
v8_answer_parms.modulations = answerer_available_modulations; v8_answer_parms.modulations = answerer_available_modulations;
v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42; v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42;
...@@ -439,6 +445,8 @@ static int v8_calls_non_v8_tests(SNDFILE *outhandle) ...@@ -439,6 +445,8 @@ static int v8_calls_non_v8_tests(SNDFILE *outhandle)
negotiations_ok = 0; negotiations_ok = 0;
v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE; v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
v8_call_parms.send_ci = TRUE;
v8_call_parms.v92 = -1;
v8_call_parms.call_function = V8_CALL_V_SERIES; v8_call_parms.call_function = V8_CALL_V_SERIES;
v8_call_parms.modulations = caller_available_modulations; v8_call_parms.modulations = caller_available_modulations;
v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42; v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42;
...@@ -578,6 +586,8 @@ int main(int argc, char *argv[]) ...@@ -578,6 +586,8 @@ int main(int argc, char *argv[])
printf("Decode file '%s'\n", decode_test_file); printf("Decode file '%s'\n", decode_test_file);
v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE; v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
v8_call_parms.send_ci = TRUE;
v8_call_parms.v92 = -1;
v8_call_parms.call_function = V8_CALL_V_SERIES; v8_call_parms.call_function = V8_CALL_V_SERIES;
v8_call_parms.modulations = caller_available_modulations; v8_call_parms.modulations = caller_available_modulations;
v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42; v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42;
...@@ -595,6 +605,8 @@ int main(int argc, char *argv[]) ...@@ -595,6 +605,8 @@ int main(int argc, char *argv[])
span_log_set_tag(logging, "caller"); span_log_set_tag(logging, "caller");
v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR;
v8_answer_parms.send_ci = TRUE;
v8_answer_parms.v92 = -1;
v8_answer_parms.call_function = V8_CALL_V_SERIES; v8_answer_parms.call_function = V8_CALL_V_SERIES;
v8_answer_parms.modulations = answerer_available_modulations; v8_answer_parms.modulations = answerer_available_modulations;
v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42; v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论