mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-16 08:49:01 +00:00
update to snapshot spandsp-20080911.tar.gz
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9767 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
61cd1f8219
commit
1d99b900fd
@ -1 +1 @@
|
||||
Wed Sep 3 14:32:49 CDT 2008
|
||||
Tue Sep 30 23:52:21 EDT 2008
|
||||
|
@ -35,7 +35,6 @@
|
||||
<!ELEMENT call-waiting-tone (step)* >
|
||||
<!ATTLIST call-waiting-tone
|
||||
domain CDATA #IMPLIED
|
||||
type CDATA #IMPLIED
|
||||
>
|
||||
<!ELEMENT pay-tone (step)* >
|
||||
<!ATTLIST pay-tone
|
||||
@ -191,5 +190,4 @@
|
||||
level CDATA #IMPLIED
|
||||
length CDATA #IMPLIED
|
||||
recorded-announcement CDATA #IMPLIED
|
||||
recognition-length CDATA #IMPLIED
|
||||
>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: dds_int.c,v 1.10 2008/09/01 16:07:33 steveu Exp $
|
||||
* $Id: dds_int.c,v 1.11 2008/09/11 15:13:42 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@ -252,11 +252,11 @@ int16_t dds(uint32_t *phase_acc, int32_t phase_rate)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int16_t dds_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase)
|
||||
int16_t dds_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
|
||||
{
|
||||
int16_t amp;
|
||||
|
||||
amp = (int16_t) ((dds_lookup(*phase_acc + phase)*scale) >> 15);
|
||||
amp = (int16_t) (((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15);
|
||||
*phase_acc += phase_rate;
|
||||
return amp;
|
||||
}
|
||||
@ -278,12 +278,12 @@ complexi_t dds_complexi(uint32_t *phase_acc, int32_t phase_rate)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
complexi_t dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase)
|
||||
complexi_t dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
|
||||
{
|
||||
complexi_t amp;
|
||||
|
||||
amp = complex_seti((dds_lookup(*phase_acc + phase + (1 << 30))*scale) >> 15,
|
||||
(dds_lookup(*phase_acc + phase)*scale) >> 15);
|
||||
amp = complex_seti(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15,
|
||||
((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15);
|
||||
*phase_acc += phase_rate;
|
||||
return amp;
|
||||
}
|
||||
@ -305,12 +305,12 @@ complexi16_t dds_complexi16(uint32_t *phase_acc, int32_t phase_rate)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
complexi16_t dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase)
|
||||
complexi16_t dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
|
||||
{
|
||||
complexi16_t amp;
|
||||
|
||||
amp = complex_seti16((dds_lookup(*phase_acc + phase + (1 << 30))*scale) >> 15,
|
||||
(dds_lookup(*phase_acc + phase)*scale) >> 15);
|
||||
amp = complex_seti16(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15,
|
||||
((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15);
|
||||
*phase_acc += phase_rate;
|
||||
return amp;
|
||||
}
|
||||
@ -332,12 +332,12 @@ complexi32_t dds_complexi32(uint32_t *phase_acc, int32_t phase_rate)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
complexi32_t dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase)
|
||||
complexi32_t dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
|
||||
{
|
||||
complexi32_t amp;
|
||||
|
||||
amp = complex_seti32((dds_lookup(*phase_acc + phase + (1 << 30))*scale) >> 15,
|
||||
(dds_lookup(*phase_acc + phase)*scale) >> 15);
|
||||
amp = complex_seti32(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15,
|
||||
((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15);
|
||||
*phase_acc += phase_rate;
|
||||
return amp;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: dds.h,v 1.20 2008/09/04 14:40:05 steveu Exp $
|
||||
* $Id: dds.h,v 1.21 2008/09/11 15:13:42 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@ -98,7 +98,7 @@ int16_t dds_lookup(uint32_t phase);
|
||||
\param phase The phase offset.
|
||||
\return The signal amplitude, between -32767 and 32767.
|
||||
*/
|
||||
int16_t dds_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase);
|
||||
int16_t dds_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
|
||||
|
||||
/*! \brief Lookup the complex integer value of a specified phase.
|
||||
\param phase The phase accumulator value to be looked up.
|
||||
@ -120,7 +120,7 @@ complexi_t dds_complexi(uint32_t *phase_acc, int32_t phase_rate);
|
||||
\param phase The phase offset.
|
||||
\return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
|
||||
*/
|
||||
complexi_t dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase);
|
||||
complexi_t dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
|
||||
|
||||
/*! \brief Generate a complex 16 bit integer tone sample.
|
||||
\param phase_acc A pointer to a phase accumulator value.
|
||||
@ -143,7 +143,7 @@ complexi16_t dds_complexi16(uint32_t *phase_acc, int32_t phase_rate);
|
||||
\param phase The phase offset.
|
||||
\return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
|
||||
*/
|
||||
complexi16_t dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase);
|
||||
complexi16_t dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
|
||||
|
||||
/*! \brief Generate a complex 32 bit integer tone sample, with modulation.
|
||||
\param phase_acc A pointer to a phase accumulator value.
|
||||
@ -152,7 +152,7 @@ complexi16_t dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int sca
|
||||
\param phase The phase offset.
|
||||
\return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
|
||||
*/
|
||||
complexi32_t dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase);
|
||||
complexi32_t dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
|
||||
|
||||
/*! \brief Generate a complex 32 bit integer tone sample.
|
||||
\param phase_acc A pointer to a phase accumulator value.
|
||||
@ -175,7 +175,7 @@ complexi32_t dds_complexi32(uint32_t *phase_acc, int32_t phase_rate);
|
||||
\param phase The phase offset.
|
||||
\return The complex signal amplitude, between (-32767, -32767) and (32767, 32767).
|
||||
*/
|
||||
complexi32_t dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase);
|
||||
complexi32_t dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase);
|
||||
|
||||
/*! \brief Find the phase rate equivalent to a frequency, in Hz.
|
||||
\param frequency The frequency, in Hz.
|
||||
|
@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: tone_generate.h,v 1.33 2008/04/17 14:27:01 steveu Exp $
|
||||
* $Id: tone_generate.h,v 1.34 2008/09/11 15:13:42 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@ -48,7 +48,11 @@ conditions in which we will use it.
|
||||
typedef struct
|
||||
{
|
||||
int32_t phase_rate;
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
int16_t gain;
|
||||
#else
|
||||
float gain;
|
||||
#endif
|
||||
} tone_gen_tone_descriptor_t;
|
||||
|
||||
/*!
|
||||
|
@ -30,8 +30,8 @@
|
||||
|
||||
/* The date and time of the version are in UTC form. */
|
||||
|
||||
#define SPANDSP_RELEASE_DATE 20080909
|
||||
#define SPANDSP_RELEASE_TIME 162813
|
||||
#define SPANDSP_RELEASE_DATE 20080911
|
||||
#define SPANDSP_RELEASE_TIME 151652
|
||||
|
||||
#endif
|
||||
/*- End of file ------------------------------------------------------------*/
|
||||
|
@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: t30.c,v 1.264 2008/09/09 15:30:43 steveu Exp $
|
||||
* $Id: t30.c,v 1.266 2008/09/11 15:13:42 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@ -682,6 +682,15 @@ static int send_next_ecm_frame(t30_state_t *s)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int send_rr(t30_state_t *s)
|
||||
{
|
||||
if (s->current_status != T30_ERR_TX_T5EXP)
|
||||
send_simple_frame(s, T30_RR);
|
||||
else
|
||||
send_dcn(s);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int send_first_ecm_frame(t30_state_t *s)
|
||||
{
|
||||
s->ecm_current_tx_frame = 0;
|
||||
@ -1517,6 +1526,26 @@ static void send_dcn(t30_state_t *s)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static void return_to_phase_b(t30_state_t *s, int with_fallback)
|
||||
{
|
||||
/* This is what we do after things like T30_EOM is exchanged. */
|
||||
if (step_fallback_entry(s) < 0)
|
||||
{
|
||||
/* We have fallen back as far as we can go. Give up. */
|
||||
s->current_fallback = 0;
|
||||
s->current_status = T30_ERR_CANNOT_TRAIN;
|
||||
send_dcn(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s->calling_party)
|
||||
set_state(s, T30_STATE_T);
|
||||
else
|
||||
set_state(s, T30_STATE_R);
|
||||
}
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int send_dis_or_dtc_sequence(t30_state_t *s, int start)
|
||||
{
|
||||
/* (NSF) (CSI) DIS */
|
||||
@ -2668,12 +2697,14 @@ static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len
|
||||
break;
|
||||
case T30_DIS:
|
||||
/* It appears they didn't see what we sent - retry the TCF */
|
||||
if (++s->retries > MAX_MESSAGE_TRIES)
|
||||
if (++s->retries >= MAX_MESSAGE_TRIES)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Too many retries. Giving up.\n");
|
||||
s->current_status = T30_ERR_RETRYDCN;
|
||||
send_dcn(s);
|
||||
break;
|
||||
}
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Retry number %d\n", s->retries);
|
||||
queue_phase(s, T30_PHASE_B_TX);
|
||||
/* TODO: should we reassess the new DIS message, and possibly adjust the DCS we use? */
|
||||
send_dcs_sequence(s, TRUE);
|
||||
@ -2759,7 +2790,10 @@ static void process_state_f_ftt(t30_state_t *s, const uint8_t *msg, int len)
|
||||
static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int len)
|
||||
{
|
||||
/* If we are getting HDLC messages, and we have not moved to the _POST_DOC_NON_ECM
|
||||
state, it looks like we didn't see the image data carrier properly. */
|
||||
state, it looks like either:
|
||||
- we didn't see the image data carrier properly, or
|
||||
- they didn't see our T30_CFR, and are repeating the DCS/TCF sequence.
|
||||
- they didn't see out T30_MCF, and are repeating the end of page message. */
|
||||
switch (msg[2] & 0xFE)
|
||||
{
|
||||
case T30_DIS:
|
||||
@ -3319,12 +3353,12 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
|
||||
s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
|
||||
t4_tx_end(&(s->t4));
|
||||
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
|
||||
set_state(s, T30_STATE_R);
|
||||
if (span_log_test(&s->logging, SPAN_LOG_FLOW))
|
||||
{
|
||||
t4_get_transfer_statistics(&s->t4, &stats);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred);
|
||||
}
|
||||
return_to_phase_b(s, FALSE);
|
||||
break;
|
||||
case T30_EOP:
|
||||
case T30_PRI_EOP:
|
||||
@ -3349,8 +3383,14 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
|
||||
case T30_MPS:
|
||||
case T30_PRI_MPS:
|
||||
s->retries = 0;
|
||||
t4_tx_end_page(&(s->t4));
|
||||
if (s->phase_d_handler)
|
||||
s->phase_d_handler(s, s->phase_d_user_data, T30_RTP);
|
||||
if (tx_start_page(s))
|
||||
{
|
||||
/* TODO: recover */
|
||||
break;
|
||||
}
|
||||
/* Send fresh training, and then the next page */
|
||||
if (step_fallback_entry(s) < 0)
|
||||
{
|
||||
@ -3367,24 +3407,20 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
|
||||
case T30_PRI_EOM:
|
||||
case T30_EOS:
|
||||
s->retries = 0;
|
||||
t4_tx_end_page(&(s->t4));
|
||||
if (s->phase_d_handler)
|
||||
s->phase_d_handler(s, s->phase_d_user_data, T30_RTP);
|
||||
if (step_fallback_entry(s) < 0)
|
||||
{
|
||||
/* We have fallen back as far as we can go. Give up. */
|
||||
s->current_fallback = 0;
|
||||
s->current_status = T30_ERR_CANNOT_TRAIN;
|
||||
send_dcn(s);
|
||||
break;
|
||||
}
|
||||
t4_tx_end(&(s->t4));
|
||||
/* TODO: should go back to T, and resend */
|
||||
set_state(s, T30_STATE_R);
|
||||
return_to_phase_b(s, TRUE);
|
||||
break;
|
||||
case T30_EOP:
|
||||
case T30_PRI_EOP:
|
||||
s->retries = 0;
|
||||
t4_tx_end_page(&(s->t4));
|
||||
if (s->phase_d_handler)
|
||||
s->phase_d_handler(s, s->phase_d_user_data, T30_RTP);
|
||||
t4_tx_end(&(s->t4));
|
||||
s->current_status = T30_ERR_TX_INVALRSP;
|
||||
send_dcn(s);
|
||||
break;
|
||||
@ -3410,11 +3446,17 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
|
||||
queue_phase(s, T30_PHASE_B_TX);
|
||||
restart_sending_document(s);
|
||||
break;
|
||||
case T30_EOP:
|
||||
case T30_PRI_EOP:
|
||||
case T30_EOM:
|
||||
case T30_PRI_EOM:
|
||||
case T30_EOS:
|
||||
s->retries = 0;
|
||||
if (s->phase_d_handler)
|
||||
s->phase_d_handler(s, s->phase_d_user_data, T30_RTN);
|
||||
s->current_status = T30_ERR_TX_INVALRSP;
|
||||
return_to_phase_b(s, TRUE);
|
||||
break;
|
||||
case T30_EOP:
|
||||
case T30_PRI_EOP:
|
||||
s->retries = 0;
|
||||
if (s->phase_d_handler)
|
||||
s->phase_d_handler(s, s->phase_d_user_data, T30_RTN);
|
||||
@ -3639,12 +3681,12 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le
|
||||
s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
|
||||
t4_tx_end(&(s->t4));
|
||||
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
|
||||
set_state(s, T30_STATE_R);
|
||||
if (span_log_test(&s->logging, SPAN_LOG_FLOW))
|
||||
{
|
||||
t4_get_transfer_statistics(&s->t4, &stats);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred);
|
||||
}
|
||||
return_to_phase_b(s, FALSE);
|
||||
break;
|
||||
case T30_EOP:
|
||||
case T30_PRI_EOP:
|
||||
@ -3672,7 +3714,7 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le
|
||||
s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5);
|
||||
queue_phase(s, T30_PHASE_D_TX);
|
||||
set_state(s, T30_STATE_IV_PPS_RNR);
|
||||
send_simple_frame(s, T30_RR);
|
||||
send_rr(s);
|
||||
break;
|
||||
case T30_DCN:
|
||||
s->current_status = T30_ERR_TX_BADPG;
|
||||
@ -3714,7 +3756,6 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Moving on to the next page\n");
|
||||
switch (s->next_tx_step)
|
||||
{
|
||||
@ -3745,12 +3786,12 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
|
||||
s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
|
||||
t4_tx_end(&(s->t4));
|
||||
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
|
||||
set_state(s, T30_STATE_R);
|
||||
if (span_log_test(&s->logging, SPAN_LOG_FLOW))
|
||||
{
|
||||
t4_get_transfer_statistics(&s->t4, &stats);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred);
|
||||
}
|
||||
return_to_phase_b(s, FALSE);
|
||||
break;
|
||||
case T30_EOP:
|
||||
case T30_PRI_EOP:
|
||||
@ -3775,7 +3816,7 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
|
||||
s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5);
|
||||
queue_phase(s, T30_PHASE_D_TX);
|
||||
set_state(s, T30_STATE_IV_PPS_RNR);
|
||||
send_simple_frame(s, T30_RR);
|
||||
send_rr(s);
|
||||
break;
|
||||
case T30_PIP:
|
||||
s->retries = 0;
|
||||
@ -3866,12 +3907,12 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len
|
||||
s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
|
||||
t4_tx_end(&(s->t4));
|
||||
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
|
||||
set_state(s, T30_STATE_R);
|
||||
if (span_log_test(&s->logging, SPAN_LOG_FLOW))
|
||||
{
|
||||
t4_get_transfer_statistics(&s->t4, &stats);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred);
|
||||
}
|
||||
return_to_phase_b(s, FALSE);
|
||||
break;
|
||||
case T30_EOP:
|
||||
case T30_PRI_EOP:
|
||||
@ -3896,7 +3937,7 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len
|
||||
s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5);
|
||||
queue_phase(s, T30_PHASE_D_TX);
|
||||
set_state(s, T30_STATE_IV_PPS_RNR);
|
||||
send_simple_frame(s, T30_RR);
|
||||
send_rr(s);
|
||||
break;
|
||||
case T30_PIP:
|
||||
s->retries = 0;
|
||||
@ -3968,7 +4009,7 @@ static void process_state_iv_eor(t30_state_t *s, const uint8_t *msg, int len)
|
||||
s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5);
|
||||
queue_phase(s, T30_PHASE_D_TX);
|
||||
set_state(s, T30_STATE_IV_EOR_RNR);
|
||||
send_simple_frame(s, T30_RR);
|
||||
send_rr(s);
|
||||
break;
|
||||
case T30_PIN:
|
||||
s->retries = 0;
|
||||
@ -4006,7 +4047,7 @@ static void process_state_iv_eor_rnr(t30_state_t *s, const uint8_t *msg, int len
|
||||
s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5);
|
||||
queue_phase(s, T30_PHASE_D_TX);
|
||||
set_state(s, T30_STATE_IV_EOR_RNR);
|
||||
send_simple_frame(s, T30_RR);
|
||||
send_rr(s);
|
||||
break;
|
||||
case T30_PIN:
|
||||
s->retries = 0;
|
||||
@ -4341,98 +4382,109 @@ static void queue_phase(t30_state_t *s, int phase)
|
||||
|
||||
static void set_phase(t30_state_t *s, int phase)
|
||||
{
|
||||
if (phase != s->phase)
|
||||
//if (phase = s->phase)
|
||||
// return;
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Changing from phase %s to %s\n", phase_names[s->phase], phase_names[phase]);
|
||||
/* We may be killing a receiver before it has declared the end of the
|
||||
signal. Force the signal present indicator to off, because the
|
||||
receiver will never be able to. */
|
||||
if (s->phase != T30_PHASE_A_CED && s->phase != T30_PHASE_A_CNG)
|
||||
s->rx_signal_present = FALSE;
|
||||
s->rx_trained = FALSE;
|
||||
s->rx_frame_received = FALSE;
|
||||
s->phase = phase;
|
||||
switch (phase)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Changing from phase %s to %s\n", phase_names[s->phase], phase_names[phase]);
|
||||
/* We may be killing a receiver before it has declared the end of the
|
||||
signal. Force the signal present indicator to off, because the
|
||||
receiver will never be able to. */
|
||||
if (s->phase != T30_PHASE_A_CED && s->phase != T30_PHASE_A_CNG)
|
||||
s->rx_signal_present = FALSE;
|
||||
s->rx_trained = FALSE;
|
||||
s->rx_frame_received = FALSE;
|
||||
s->phase = phase;
|
||||
switch (phase)
|
||||
case T30_PHASE_A_CED:
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CED, 0, FALSE, FALSE);
|
||||
break;
|
||||
case T30_PHASE_A_CNG:
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CNG, 0, FALSE, FALSE);
|
||||
break;
|
||||
case T30_PHASE_B_RX:
|
||||
case T30_PHASE_D_RX:
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
break;
|
||||
case T30_PHASE_B_TX:
|
||||
case T30_PHASE_D_TX:
|
||||
if (!s->far_end_detected && s->timer_t0_t1 > 0)
|
||||
{
|
||||
case T30_PHASE_A_CED:
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CED, 0, FALSE, FALSE);
|
||||
break;
|
||||
case T30_PHASE_A_CNG:
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CNG, 0, FALSE, FALSE);
|
||||
break;
|
||||
case T30_PHASE_B_RX:
|
||||
case T30_PHASE_D_RX:
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
break;
|
||||
case T30_PHASE_B_TX:
|
||||
case T30_PHASE_D_TX:
|
||||
if (!s->far_end_detected && s->timer_t0_t1 > 0)
|
||||
{
|
||||
s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T1);
|
||||
s->far_end_detected = TRUE;
|
||||
}
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
|
||||
break;
|
||||
case T30_PHASE_C_NON_ECM_RX:
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, FALSE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
break;
|
||||
case T30_PHASE_C_NON_ECM_TX:
|
||||
/* Pause before switching from anything to phase C */
|
||||
/* Always prime the training count for 1.5s of data at the current rate. Its harmless if
|
||||
we prime it and are not doing TCF. */
|
||||
s->tcf_test_bits = (3*fallback_sequence[s->current_fallback].bit_rate)/2;
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, FALSE);
|
||||
break;
|
||||
case T30_PHASE_C_ECM_RX:
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, TRUE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
break;
|
||||
case T30_PHASE_C_ECM_TX:
|
||||
/* Pause before switching from anything to phase C */
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, TRUE);
|
||||
break;
|
||||
case T30_PHASE_E:
|
||||
/* Send a little silence before ending things, to ensure the
|
||||
buffers are all flushed through, and the far end has seen
|
||||
the last message we sent. */
|
||||
s->tcf_test_bits = 0;
|
||||
s->tcf_current_zeros = 0;
|
||||
s->tcf_most_zeros = 0;
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_PAUSE, 0, FINAL_FLUSH_TIME, FALSE);
|
||||
break;
|
||||
case T30_PHASE_CALL_FINISHED:
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_DONE, 0, FALSE, FALSE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_DONE, 0, FALSE, FALSE);
|
||||
break;
|
||||
s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T1);
|
||||
s->far_end_detected = TRUE;
|
||||
}
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
|
||||
break;
|
||||
case T30_PHASE_C_NON_ECM_RX:
|
||||
if (s->set_rx_type_handler)
|
||||
{
|
||||
/* Momentarily stop the receive modem, so the next change is forced to happen. If we don't do this
|
||||
an HDLC message on the slow modem, which has disabled the fast modem, will prevent the same
|
||||
fast modem from restarting. */
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, FALSE);
|
||||
}
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
break;
|
||||
case T30_PHASE_C_NON_ECM_TX:
|
||||
/* Pause before switching from anything to phase C */
|
||||
/* Always prime the training count for 1.5s of data at the current rate. Its harmless if
|
||||
we prime it and are not doing TCF. */
|
||||
s->tcf_test_bits = (3*fallback_sequence[s->current_fallback].bit_rate)/2;
|
||||
if (s->set_rx_type_handler)
|
||||
{
|
||||
/* Momentarily stop the receive modem, so the next change is forced to happen. If we don't do this
|
||||
an HDLC message on the slow modem, which has disabled the fast modem, will prevent the same
|
||||
fast modem from restarting. */
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
}
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, FALSE);
|
||||
break;
|
||||
case T30_PHASE_C_ECM_RX:
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, TRUE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
break;
|
||||
case T30_PHASE_C_ECM_TX:
|
||||
/* Pause before switching from anything to phase C */
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, TRUE);
|
||||
break;
|
||||
case T30_PHASE_E:
|
||||
/* Send a little silence before ending things, to ensure the
|
||||
buffers are all flushed through, and the far end has seen
|
||||
the last message we sent. */
|
||||
s->tcf_test_bits = 0;
|
||||
s->tcf_current_zeros = 0;
|
||||
s->tcf_most_zeros = 0;
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_PAUSE, 0, FINAL_FLUSH_TIME, FALSE);
|
||||
break;
|
||||
case T30_PHASE_CALL_FINISHED:
|
||||
if (s->set_rx_type_handler)
|
||||
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_DONE, 0, FALSE, FALSE);
|
||||
if (s->set_tx_type_handler)
|
||||
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_DONE, 0, FALSE, FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@ -4451,6 +4503,30 @@ static void set_state(t30_state_t *s, int state)
|
||||
static void repeat_last_command(t30_state_t *s)
|
||||
{
|
||||
s->step = 0;
|
||||
if (++s->retries >= MAX_MESSAGE_TRIES)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Too many retries. Giving up.\n");
|
||||
switch (s->state)
|
||||
{
|
||||
case T30_STATE_D_POST_TCF:
|
||||
/* Received no response to DCS or TCF */
|
||||
s->current_status = T30_ERR_TX_PHBDEAD;
|
||||
break;
|
||||
case T30_STATE_II_Q:
|
||||
case T30_STATE_IV_PPS_NULL:
|
||||
case T30_STATE_IV_PPS_Q:
|
||||
/* No response after sending a page */
|
||||
s->current_status = T30_ERR_TX_PHDDEAD;
|
||||
break;
|
||||
default:
|
||||
/* Disconnected after permitted retries */
|
||||
s->current_status = T30_ERR_RETRYDCN;
|
||||
break;
|
||||
}
|
||||
send_dcn(s);
|
||||
return;
|
||||
}
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Retry number %d\n", s->retries);
|
||||
switch (s->state)
|
||||
{
|
||||
case T30_STATE_R:
|
||||
@ -4482,7 +4558,7 @@ static void repeat_last_command(t30_state_t *s)
|
||||
case T30_STATE_IV_PPS_RNR:
|
||||
case T30_STATE_IV_EOR_RNR:
|
||||
queue_phase(s, T30_PHASE_D_TX);
|
||||
send_simple_frame(s, T30_RNR);
|
||||
send_rr(s);
|
||||
break;
|
||||
case T30_STATE_D:
|
||||
queue_phase(s, T30_PHASE_B_TX);
|
||||
@ -4693,28 +4769,6 @@ static void timer_t4_expired(t30_state_t *s)
|
||||
/* There was no response (or only a corrupt response) to a command,
|
||||
within the T4 timeout period. */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "T4 expired in phase %s, state %d\n", phase_names[s->phase], s->state);
|
||||
if (++s->retries > MAX_MESSAGE_TRIES)
|
||||
{
|
||||
switch (s->state)
|
||||
{
|
||||
case T30_STATE_D_POST_TCF:
|
||||
/* Received no response to DCS or TCF */
|
||||
s->current_status = T30_ERR_TX_PHBDEAD;
|
||||
break;
|
||||
case T30_STATE_II_Q:
|
||||
case T30_STATE_IV_PPS_NULL:
|
||||
case T30_STATE_IV_PPS_Q:
|
||||
/* No response after sending a page */
|
||||
s->current_status = T30_ERR_TX_PHDDEAD;
|
||||
break;
|
||||
default:
|
||||
/* Disconnected after permitted retries */
|
||||
s->current_status = T30_ERR_RETRYDCN;
|
||||
break;
|
||||
}
|
||||
send_dcn(s);
|
||||
return;
|
||||
}
|
||||
/* Of course, things might just be a little late, especially if there are T.38
|
||||
links in the path. There is no point in simply timing out, and resending,
|
||||
if we are currently receiving something from the far end - its a half-duplex
|
||||
@ -4746,7 +4800,6 @@ static void timer_t5_expired(t30_state_t *s)
|
||||
/* Give up waiting for the receiver to become ready in error correction mode */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "T5 expired in phase %s, state %d\n", phase_names[s->phase], s->state);
|
||||
s->current_status = T30_ERR_TX_T5EXP;
|
||||
send_dcn(s);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
@ -5605,8 +5658,7 @@ void t30_timer_update(t30_state_t *s, int samples)
|
||||
{
|
||||
if (s->timer_t0_t1 > 0)
|
||||
{
|
||||
s->timer_t0_t1 -= samples;
|
||||
if (s->timer_t0_t1 <= 0)
|
||||
if ((s->timer_t0_t1 -= samples) <= 0)
|
||||
{
|
||||
if (s->far_end_detected)
|
||||
timer_t1_expired(s);
|
||||
@ -5616,14 +5668,12 @@ void t30_timer_update(t30_state_t *s, int samples)
|
||||
}
|
||||
if (s->timer_t3 > 0)
|
||||
{
|
||||
s->timer_t3 -= samples;
|
||||
if (s->timer_t3 <= 0)
|
||||
if ((s->timer_t3 -= samples) <= 0)
|
||||
timer_t3_expired(s);
|
||||
}
|
||||
if (s->timer_t2_t4 > 0)
|
||||
{
|
||||
s->timer_t2_t4 -= samples;
|
||||
if (s->timer_t2_t4 <= 0)
|
||||
if ((s->timer_t2_t4 -= samples) <= 0)
|
||||
{
|
||||
switch (s->timer_t2_t4_is)
|
||||
{
|
||||
@ -5650,8 +5700,7 @@ void t30_timer_update(t30_state_t *s, int samples)
|
||||
}
|
||||
if (s->timer_t5 > 0)
|
||||
{
|
||||
s->timer_t5 -= samples;
|
||||
if (s->timer_t5 <= 0)
|
||||
if ((s->timer_t5 -= samples) <= 0)
|
||||
timer_t5_expired(s);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: tone_generate.c,v 1.43 2008/07/02 14:48:26 steveu Exp $
|
||||
* $Id: tone_generate.c,v 1.46 2008/09/11 15:13:42 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@ -72,15 +72,27 @@ void make_tone_gen_descriptor(tone_gen_descriptor_t *s,
|
||||
memset(s, 0, sizeof(*s));
|
||||
if (f1)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
s->tone[0].phase_rate = dds_phase_rate((float) f1);
|
||||
if (f2 < 0)
|
||||
s->tone[0].phase_rate = -s->tone[0].phase_rate;
|
||||
s->tone[0].gain = dds_scaling_dbm0((float) l1);
|
||||
#else
|
||||
s->tone[0].phase_rate = dds_phase_ratef((float) f1);
|
||||
if (f2 < 0)
|
||||
s->tone[0].phase_rate = -s->tone[0].phase_rate;
|
||||
s->tone[0].gain = dds_scaling_dbm0f((float) l1);
|
||||
#endif
|
||||
}
|
||||
if (f2)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
s->tone[1].phase_rate = dds_phase_rate((float) abs(f2));
|
||||
s->tone[1].gain = (f2 < 0) ? (float) 32767.0f*l2/100.0f : dds_scaling_dbm0((float) l2);
|
||||
#else
|
||||
s->tone[1].phase_rate = dds_phase_ratef((float) abs(f2));
|
||||
s->tone[1].gain = (f2 < 0) ? (float) l2/100.0f : dds_scaling_dbm0f((float) l2);
|
||||
#endif
|
||||
}
|
||||
|
||||
s->duration[0] = d1*SAMPLE_RATE/1000;
|
||||
@ -118,7 +130,11 @@ int tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples)
|
||||
{
|
||||
int samples;
|
||||
int limit;
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
int16_t xamp;
|
||||
#else
|
||||
float xamp;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
if (s->current_section < 0)
|
||||
@ -141,30 +157,49 @@ int tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples)
|
||||
{
|
||||
if (s->tone[0].phase_rate < 0)
|
||||
{
|
||||
/* Modulated tone */
|
||||
for ( ; samples < limit; samples++)
|
||||
{
|
||||
/* There must be two, and only two tones */
|
||||
/* There must be two, and only two, tones */
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
xamp = ((int32_t) dds_mod(&s->phase[0], -s->tone[0].phase_rate, s->tone[0].gain, 0)
|
||||
*(32767 + (int32_t) dds_mod(&s->phase[1], s->tone[1].phase_rate, s->tone[1].gain, 0))) >> 15;
|
||||
amp[samples] = xamp;
|
||||
#else
|
||||
xamp = dds_modf(&s->phase[0], -s->tone[0].phase_rate, s->tone[0].gain, 0)
|
||||
*(1.0f + dds_modf(&s->phase[1], s->tone[1].phase_rate, s->tone[1].gain, 0));
|
||||
amp[samples] = (int16_t) lrintf(xamp);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( ; samples < limit; samples++)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
xamp = 0;
|
||||
#else
|
||||
xamp = 0.0f;
|
||||
#endif
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (s->tone[i].phase_rate == 0)
|
||||
break;
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
xamp += dds_mod(&s->phase[i], s->tone[i].phase_rate, s->tone[i].gain, 0);
|
||||
#else
|
||||
xamp += dds_modf(&s->phase[i], s->tone[i].phase_rate, s->tone[i].gain, 0);
|
||||
#endif
|
||||
}
|
||||
/* Saturation of the answer is the right thing at this point.
|
||||
However, we are normally generating well controlled tones,
|
||||
that cannot clip. So, the overhead of doing saturation is
|
||||
a waste of valuable time. */
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
amp[samples] = xamp;
|
||||
#else
|
||||
amp[samples] = (int16_t) lrintf(xamp);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## $Id: Makefile.am,v 1.1 2008/07/10 12:44:54 steveu Exp $
|
||||
## $Id: Makefile.am,v 1.2 2008/09/10 16:55:15 steveu Exp $
|
||||
|
||||
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
||||
|
||||
@ -25,13 +25,17 @@ FAX2TIFF = fax2tiff
|
||||
|
||||
EXTRA_DIST =
|
||||
|
||||
nobase_data_DATA = etsi_300_242_white.tif \
|
||||
etsi_300_242_stairstep.tif \
|
||||
etsi_300_242_diago1.tif \
|
||||
etsi_300_242_diago2.tif \
|
||||
etsi_300_242_impress.tif \
|
||||
etsi_300_242_error.tif
|
||||
|
||||
nobase_data_DATA = etsi_300_242_a4_diago1.tif \
|
||||
etsi_300_242_a4_diago2.tif \
|
||||
etsi_300_242_a4_duration1.tif \
|
||||
etsi_300_242_a4_duration2.tif \
|
||||
etsi_300_242_a4_error.tif \
|
||||
etsi_300_242_a4_impress.tif \
|
||||
etsi_300_242_a4_impress_white.tif \
|
||||
etsi_300_242_a4_stairstep.tif \
|
||||
etsi_300_242_a4_white.tif \
|
||||
etsi_300_242_a4_white_2p.tif
|
||||
|
||||
noinst_PROGRAMS = generate_etsi_300_242_pages
|
||||
|
||||
generate_etsi_300_242_pages_SOURCES = generate_etsi_300_242_pages.c
|
||||
@ -46,10 +50,14 @@ clean:
|
||||
.pbm.g3:
|
||||
${PBM2G3} $*.pbm >$*.g3
|
||||
|
||||
etsi_300_242_white.tif \
|
||||
etsi_300_242_stairstep.tif \
|
||||
etsi_300_242_diago1.tif \
|
||||
etsi_300_242_diago2.tif \
|
||||
etsi_300_242_impress.tif \
|
||||
etsi_300_242_error.tif: generate_etsi_300_242_pages$(EXEEXT)
|
||||
etsi_300_242_a4_diago1.tif \
|
||||
etsi_300_242_a4_diago2.tif \
|
||||
etsi_300_242_a4_duration1.tif \
|
||||
etsi_300_242_a4_duration2.tif \
|
||||
etsi_300_242_a4_error.tif \
|
||||
etsi_300_242_a4_impress.tif \
|
||||
etsi_300_242_a4_impress_white.tif \
|
||||
etsi_300_242_a4_stairstep.tif \
|
||||
etsi_300_242_a4_white.tif \
|
||||
etsi_300_242_a4_white_2p.tif: generate_etsi_300_242_pages$(EXEEXT)
|
||||
./generate_etsi_300_242_pages$(EXEEXT)
|
||||
|
@ -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: generate_etsi_300_242_pages.c,v 1.1 2008/07/10 12:44:54 steveu Exp $
|
||||
* $Id: generate_etsi_300_242_pages.c,v 1.2 2008/09/10 16:55:15 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@ -61,7 +61,7 @@ struct
|
||||
} sequence[] =
|
||||
{
|
||||
{
|
||||
"etsi_300_242_white.tif",
|
||||
"etsi_300_242_a4_diago1.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
@ -70,7 +70,7 @@ struct
|
||||
0
|
||||
},
|
||||
{
|
||||
"etsi_300_242_stairstep.tif",
|
||||
"etsi_300_242_a4_diago2.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
@ -79,7 +79,7 @@ struct
|
||||
1
|
||||
},
|
||||
{
|
||||
"etsi_300_242_diago1.tif",
|
||||
"etsi_300_242_a4_duration1.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
@ -88,7 +88,7 @@ struct
|
||||
2
|
||||
},
|
||||
{
|
||||
"etsi_300_242_diago2.tif",
|
||||
"etsi_300_242_a4_duration2.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
@ -97,7 +97,7 @@ struct
|
||||
3
|
||||
},
|
||||
{
|
||||
"etsi_300_242_impress.tif",
|
||||
"etsi_300_242_a4_error.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
@ -106,7 +106,7 @@ struct
|
||||
4
|
||||
},
|
||||
{
|
||||
"etsi_300_242_duration1.tif",
|
||||
"etsi_300_242_a4_impress.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
@ -115,7 +115,7 @@ struct
|
||||
5
|
||||
},
|
||||
{
|
||||
"etsi_300_242_duration2.tif",
|
||||
"etsi_300_242_a4_stairstep.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
@ -124,7 +124,43 @@ struct
|
||||
6
|
||||
},
|
||||
{
|
||||
"etsi_300_242_error.tif",
|
||||
"etsi_300_242_a4_white.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
1100,
|
||||
COMPRESSION_CCITT_T4,
|
||||
7
|
||||
},
|
||||
{
|
||||
"etsi_300_242_a4_white_2p.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
1100,
|
||||
COMPRESSION_CCITT_T4,
|
||||
7
|
||||
},
|
||||
{ /* Second page of the above file */
|
||||
"",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
1100,
|
||||
COMPRESSION_CCITT_T4,
|
||||
7
|
||||
},
|
||||
{
|
||||
"etsi_300_242_a4_impress_white.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
1100,
|
||||
COMPRESSION_CCITT_T4,
|
||||
5
|
||||
},
|
||||
{ /* Second page of the above file */
|
||||
"",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_STANDARD,
|
||||
T4_WIDTH_R8_A4,
|
||||
@ -512,11 +548,16 @@ int main(int argc, char *argv[])
|
||||
int i;
|
||||
int image_length;
|
||||
|
||||
tiff_file = NULL;
|
||||
for (i = 0; sequence[i].name; i++)
|
||||
{
|
||||
if ((tiff_file = TIFFOpen(sequence[i].name, "w")) == NULL)
|
||||
exit(2);
|
||||
|
||||
if (sequence[i].name[0])
|
||||
{
|
||||
if (tiff_file)
|
||||
TIFFClose(tiff_file);
|
||||
if ((tiff_file = TIFFOpen(sequence[i].name, "w")) == NULL)
|
||||
exit(2);
|
||||
}
|
||||
/* Prepare the directory entry fully before writing the image, or libtiff complains */
|
||||
TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, sequence[i].compression);
|
||||
if (sequence[i].compression == COMPRESSION_CCITT_T4)
|
||||
@ -565,37 +606,37 @@ int main(int argc, char *argv[])
|
||||
switch (sequence[i].type)
|
||||
{
|
||||
case 0:
|
||||
/* A white A4 page */
|
||||
image_length = create_white_page(tiff_file);
|
||||
break;
|
||||
case 1:
|
||||
/* A stairstep of 64 pixel dashes */
|
||||
image_length = create_stairstep_page(tiff_file);
|
||||
break;
|
||||
case 2:
|
||||
/* The DIAGO1 page */
|
||||
image_length = create_diago1_page(tiff_file);
|
||||
break;
|
||||
case 3:
|
||||
case 1:
|
||||
/* The DIAGO2 page */
|
||||
image_length = create_diago2_page(tiff_file);
|
||||
break;
|
||||
case 4:
|
||||
/* The IMPRESS page */
|
||||
image_length = create_impress_page(tiff_file);
|
||||
break;
|
||||
case 5:
|
||||
case 2:
|
||||
/* The DURATION1 page */
|
||||
image_length = create_duration1_page(tiff_file);
|
||||
break;
|
||||
case 6:
|
||||
case 3:
|
||||
/* The DURATION2 page */
|
||||
image_length = create_duration2_page(tiff_file);
|
||||
break;
|
||||
case 7:
|
||||
case 4:
|
||||
/* The ERROR page */
|
||||
image_length = create_error_page(tiff_file);
|
||||
break;
|
||||
case 5:
|
||||
/* The IMPRESS page */
|
||||
image_length = create_impress_page(tiff_file);
|
||||
break;
|
||||
case 6:
|
||||
/* A stairstep of 64 pixel dashes */
|
||||
image_length = create_stairstep_page(tiff_file);
|
||||
break;
|
||||
case 7:
|
||||
/* A white A4 page */
|
||||
image_length = create_white_page(tiff_file);
|
||||
break;
|
||||
}
|
||||
/* ....then the directory entry, and libtiff is happy. */
|
||||
TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, image_length);
|
||||
@ -603,8 +644,9 @@ int main(int argc, char *argv[])
|
||||
TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN);
|
||||
|
||||
TIFFWriteDirectory(tiff_file);
|
||||
TIFFClose(tiff_file);
|
||||
}
|
||||
if (tiff_file)
|
||||
TIFFClose(tiff_file);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
@ -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: tone_generate_tests.c,v 1.19 2008/08/16 15:24:16 steveu Exp $
|
||||
* $Id: tone_generate_tests.c,v 1.20 2008/09/11 15:13:42 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \page tone_generate_tests_page Tone generation tests
|
||||
@ -60,7 +60,8 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
/* Try a tone pair */
|
||||
make_tone_gen_descriptor(&tone_desc,
|
||||
440,
|
||||
-10,
|
||||
@ -85,15 +86,16 @@ int main(int argc, char *argv[])
|
||||
len);
|
||||
}
|
||||
|
||||
/* Try a different tone pair */
|
||||
make_tone_gen_descriptor(&tone_desc,
|
||||
350,
|
||||
-10,
|
||||
440,
|
||||
-15,
|
||||
100,
|
||||
200,
|
||||
300,
|
||||
400,
|
||||
300,
|
||||
200,
|
||||
100,
|
||||
TRUE);
|
||||
tone_gen_init(&tone_state, &tone_desc);
|
||||
|
||||
@ -108,7 +110,8 @@ int main(int argc, char *argv[])
|
||||
amp,
|
||||
len);
|
||||
}
|
||||
|
||||
|
||||
/* Try a different tone pair */
|
||||
make_tone_gen_descriptor(&tone_desc,
|
||||
400,
|
||||
-10,
|
||||
@ -121,6 +124,106 @@ int main(int argc, char *argv[])
|
||||
TRUE);
|
||||
tone_gen_init(&tone_state, &tone_desc);
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
len = tone_gen(&tone_state, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
if (len <= 0)
|
||||
break;
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
}
|
||||
|
||||
/* Try a single tone */
|
||||
make_tone_gen_descriptor(&tone_desc,
|
||||
400,
|
||||
-10,
|
||||
0,
|
||||
0,
|
||||
100,
|
||||
200,
|
||||
300,
|
||||
400,
|
||||
TRUE);
|
||||
tone_gen_init(&tone_state, &tone_desc);
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
len = tone_gen(&tone_state, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
if (len <= 0)
|
||||
break;
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
}
|
||||
|
||||
/* Try a single non-repeating tone */
|
||||
make_tone_gen_descriptor(&tone_desc,
|
||||
820,
|
||||
-10,
|
||||
0,
|
||||
0,
|
||||
2000,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
FALSE);
|
||||
tone_gen_init(&tone_state, &tone_desc);
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
len = tone_gen(&tone_state, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
if (len <= 0)
|
||||
break;
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
}
|
||||
|
||||
/* Try a single non-repeating tone at 0dBm0 */
|
||||
make_tone_gen_descriptor(&tone_desc,
|
||||
820,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2000,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
FALSE);
|
||||
tone_gen_init(&tone_state, &tone_desc);
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
len = tone_gen(&tone_state, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
if (len <= 0)
|
||||
break;
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
}
|
||||
|
||||
/* Try an AM modulated tone at a modest modulation level (25%) */
|
||||
make_tone_gen_descriptor(&tone_desc,
|
||||
425,
|
||||
-10,
|
||||
-50,
|
||||
25,
|
||||
100,
|
||||
200,
|
||||
300,
|
||||
400,
|
||||
TRUE);
|
||||
tone_gen_init(&tone_state, &tone_desc);
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
len = tone_gen(&tone_state, amp, 160);
|
||||
@ -133,6 +236,7 @@ int main(int argc, char *argv[])
|
||||
len);
|
||||
}
|
||||
|
||||
/* Try an AM modulated tone at maximum modulation level (100%) */
|
||||
make_tone_gen_descriptor(&tone_desc,
|
||||
425,
|
||||
-10,
|
||||
|
@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: tsb85_tests.c,v 1.22 2008/09/09 15:30:43 steveu Exp $
|
||||
* $Id: tsb85_tests.c,v 1.23 2008/09/10 16:55:15 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@ -86,6 +86,8 @@ int awaited_len = 0;
|
||||
|
||||
t30_exchanged_info_t expected_rx_info;
|
||||
|
||||
char next_tx_file[1000];
|
||||
|
||||
static int next_step(faxtester_state_t *s);
|
||||
|
||||
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
|
||||
@ -317,6 +319,12 @@ static int document_handler(t30_state_t *s, void *user_data, int event)
|
||||
|
||||
i = (intptr_t) user_data;
|
||||
fprintf(stderr, "%d: Document handler on channel %d - event %d\n", i, i, event);
|
||||
if (next_tx_file[0])
|
||||
{
|
||||
t30_set_tx_file(s, next_tx_file, -1, -1);
|
||||
next_tx_file[0] = '\0';
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@ -329,7 +337,9 @@ static void faxtester_real_time_frame_handler(faxtester_state_t *s,
|
||||
{
|
||||
if (msg == NULL)
|
||||
{
|
||||
next_step(s);
|
||||
while (next_step(s) == 0)
|
||||
;
|
||||
/*endwhile*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -352,14 +362,20 @@ static void faxtester_real_time_frame_handler(faxtester_state_t *s,
|
||||
}
|
||||
}
|
||||
if (msg[1] == awaited[1])
|
||||
next_step(s);
|
||||
{
|
||||
while (next_step(s) == 0)
|
||||
;
|
||||
/*endwhile*/
|
||||
}
|
||||
}
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static void faxtester_front_end_step_complete_handler(faxtester_state_t *s, void *user_data)
|
||||
{
|
||||
next_step(s);
|
||||
while (next_step(s) == 0)
|
||||
;
|
||||
/*endwhile*/
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
@ -611,7 +627,9 @@ static int next_step(faxtester_state_t *s)
|
||||
xmlChar *crc_error;
|
||||
xmlChar *pattern;
|
||||
xmlChar *timeout;
|
||||
xmlChar *min_time;
|
||||
xmlChar *min_bits;
|
||||
xmlChar *frame_size;
|
||||
xmlChar *compression;
|
||||
uint8_t buf[1000];
|
||||
uint8_t mask[1000];
|
||||
int i;
|
||||
@ -619,8 +637,8 @@ static int next_step(faxtester_state_t *s)
|
||||
int hdlc;
|
||||
int short_train;
|
||||
int min_row_bits;
|
||||
int compression;
|
||||
int compression_step;
|
||||
int ecm_frame_size;
|
||||
int compression_type;
|
||||
int timer;
|
||||
int len;
|
||||
t4_state_t t4_state;
|
||||
@ -658,7 +676,9 @@ static int next_step(faxtester_state_t *s)
|
||||
crc_error = xmlGetProp(s->cur, (const xmlChar *) "crc_error");
|
||||
pattern = xmlGetProp(s->cur, (const xmlChar *) "pattern");
|
||||
timeout = xmlGetProp(s->cur, (const xmlChar *) "timeout");
|
||||
min_time = xmlGetProp(s->cur, (const xmlChar *) "min_time");
|
||||
min_bits = xmlGetProp(s->cur, (const xmlChar *) "min_bits");
|
||||
frame_size = xmlGetProp(s->cur, (const xmlChar *) "frame_size");
|
||||
compression = xmlGetProp(s->cur, (const xmlChar *) "compression");
|
||||
|
||||
s->cur = s->cur->next;
|
||||
|
||||
@ -857,15 +877,21 @@ static int next_step(faxtester_state_t *s)
|
||||
t30_set_rx_file(t30, output_tiff_file_name, -1);
|
||||
}
|
||||
else if (strcasecmp((const char *) tag, "TXFILE") == 0)
|
||||
t30_set_tx_file(t30, (const char *) value, -1, -1);
|
||||
{
|
||||
strcpy(next_tx_file, (const char *) value);
|
||||
printf("Push '%s'\n", next_tx_file);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (strcasecmp((const char *) type, "CALL") == 0)
|
||||
{
|
||||
fax_init(&fax, FALSE);
|
||||
fax_prepare();
|
||||
next_tx_file[0] = '\0';
|
||||
t30 = fax_get_t30_state(&fax);
|
||||
t30_set_rx_file(t30, output_tiff_file_name, -1);
|
||||
/* Avoid libtiff 3.8.2 and earlier bug on complex 2D lines. */
|
||||
t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T4_1D);
|
||||
if (value)
|
||||
t30_set_tx_file(t30, (const char *) value, -1, -1);
|
||||
return 0;
|
||||
@ -874,7 +900,10 @@ static int next_step(faxtester_state_t *s)
|
||||
{
|
||||
fax_init(&fax, TRUE);
|
||||
fax_prepare();
|
||||
next_tx_file[0] = '\0';
|
||||
t30 = fax_get_t30_state(&fax);
|
||||
/* Avoid libtiff 3.8.2 and earlier bug on complex 2D lines. */
|
||||
t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T4_1D);
|
||||
if (value)
|
||||
t30_set_tx_file(t30, (const char *) value, -1, -1);
|
||||
return 0;
|
||||
@ -937,8 +966,10 @@ static int next_step(faxtester_state_t *s)
|
||||
else if (strcasecmp((const char *) type, "MSG") == 0)
|
||||
{
|
||||
/* A non-ECM page */
|
||||
min_row_bits = 0;
|
||||
compression_step = 0;
|
||||
if (min_bits)
|
||||
min_row_bits = atoi((const char *) min_bits);
|
||||
else
|
||||
min_row_bits = 0;
|
||||
if (t4_tx_init(&t4_state, (const char *) value, -1, -1) == NULL)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Failed to init T.4 send\n");
|
||||
@ -946,19 +977,15 @@ static int next_step(faxtester_state_t *s)
|
||||
}
|
||||
t4_tx_set_min_row_bits(&t4_state, min_row_bits);
|
||||
t4_tx_set_header_info(&t4_state, NULL);
|
||||
switch (compression_step)
|
||||
compression_type = T4_COMPRESSION_ITU_T4_1D;
|
||||
if (compression)
|
||||
{
|
||||
case 0:
|
||||
compression = T4_COMPRESSION_ITU_T4_1D;
|
||||
break;
|
||||
case 1:
|
||||
compression = T4_COMPRESSION_ITU_T4_2D;
|
||||
break;
|
||||
case 2:
|
||||
compression = T4_COMPRESSION_ITU_T6;
|
||||
break;
|
||||
if (strcasecmp((const char *) compression, "T.4 2D") == 0)
|
||||
compression_type = T4_COMPRESSION_ITU_T4_2D;
|
||||
else if (strcasecmp((const char *) compression, "T.6") == 0)
|
||||
compression_type = T4_COMPRESSION_ITU_T6;
|
||||
}
|
||||
t4_tx_set_tx_encoding(&t4_state, compression);
|
||||
t4_tx_set_tx_encoding(&t4_state, compression_type);
|
||||
if (t4_tx_start_page(&t4_state))
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n");
|
||||
@ -971,51 +998,58 @@ static int next_step(faxtester_state_t *s)
|
||||
corrupt_image(s, image, len, (const char *) bad_rows);
|
||||
}
|
||||
t4_tx_end(&t4_state);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM image is %d bytes\n", len);
|
||||
faxtester_set_non_ecm_image_buffer(s, image, len);
|
||||
}
|
||||
else if (strcasecmp((const char *) type, "PP") == 0)
|
||||
{
|
||||
compression_step = 0;
|
||||
if (t4_tx_init(&t4_state, (const char *) value, -1, -1) == NULL)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Failed to init T.4 send\n");
|
||||
exit(2);
|
||||
}
|
||||
t4_tx_set_min_row_bits(&t4_state, 0);
|
||||
t4_tx_set_header_info(&t4_state, NULL);
|
||||
switch (compression_step)
|
||||
{
|
||||
case 0:
|
||||
compression = T4_COMPRESSION_ITU_T4_1D;
|
||||
break;
|
||||
case 1:
|
||||
compression = T4_COMPRESSION_ITU_T4_2D;
|
||||
break;
|
||||
case 2:
|
||||
compression = T4_COMPRESSION_ITU_T6;
|
||||
break;
|
||||
}
|
||||
t4_tx_set_tx_encoding(&t4_state, compression);
|
||||
if (t4_tx_start_page(&t4_state))
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n");
|
||||
exit(2);
|
||||
}
|
||||
if (min_bits)
|
||||
min_row_bits = atoi((const char *) min_bits);
|
||||
else
|
||||
min_row_bits = 0;
|
||||
/*endif*/
|
||||
len = t4_tx_get_chunk(&t4_state, image, sizeof(image));
|
||||
if (bad_rows)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "We need to corrupt the image\n");
|
||||
corrupt_image(s, image, len, (const char *) bad_rows);
|
||||
}
|
||||
if (frame_size)
|
||||
ecm_frame_size = atoi((const char *) frame_size);
|
||||
else
|
||||
ecm_frame_size = 64;
|
||||
/*endif*/
|
||||
t4_tx_end(&t4_state);
|
||||
if (crc_error)
|
||||
i = atoi((const char *) crc_error);
|
||||
else
|
||||
i = -1;
|
||||
/*endif*/
|
||||
faxtester_set_ecm_image_buffer(s, image, len, 64, i);
|
||||
if (t4_tx_init(&t4_state, (const char *) value, -1, -1) == NULL)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Failed to init T.4 send\n");
|
||||
exit(2);
|
||||
}
|
||||
t4_tx_set_min_row_bits(&t4_state, min_row_bits);
|
||||
t4_tx_set_header_info(&t4_state, NULL);
|
||||
compression_type = T4_COMPRESSION_ITU_T4_1D;
|
||||
if (compression)
|
||||
{
|
||||
if (strcasecmp((const char *) compression, "T.4 2D") == 0)
|
||||
compression_type = T4_COMPRESSION_ITU_T4_2D;
|
||||
else if (strcasecmp((const char *) compression, "T.6") == 0)
|
||||
compression_type = T4_COMPRESSION_ITU_T6;
|
||||
}
|
||||
t4_tx_set_tx_encoding(&t4_state, compression_type);
|
||||
if (t4_tx_start_page(&t4_state))
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n");
|
||||
exit(2);
|
||||
}
|
||||
/*endif*/
|
||||
len = t4_tx_get_chunk(&t4_state, image, sizeof(image));
|
||||
if (bad_rows)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "We need to corrupt the image\n");
|
||||
corrupt_image(s, image, len, (const char *) bad_rows);
|
||||
}
|
||||
/*endif*/
|
||||
t4_tx_end(&t4_state);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "ECM image is %d bytes\n", len);
|
||||
faxtester_set_ecm_image_buffer(s, image, len, ecm_frame_size, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1061,6 +1095,7 @@ static void exchange(faxtester_state_t *s)
|
||||
|
||||
fax_init(&fax, FALSE);
|
||||
fax_prepare();
|
||||
next_tx_file[0] = '\0';
|
||||
|
||||
while (next_step(s) == 0)
|
||||
;
|
||||
@ -1147,39 +1182,36 @@ static int get_test_set(faxtester_state_t *s, const char *test_file, const char
|
||||
xmlDocPtr doc;
|
||||
xmlNsPtr ns;
|
||||
xmlNodePtr cur;
|
||||
#if 1
|
||||
xmlValidCtxt valid;
|
||||
#endif
|
||||
|
||||
ns = NULL;
|
||||
xmlKeepBlanksDefault(0);
|
||||
xmlCleanupParser();
|
||||
if ((doc = xmlParseFile(test_file)) == NULL)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "No document\n");
|
||||
fprintf(stderr, "No document\n");
|
||||
exit(2);
|
||||
}
|
||||
/*endif*/
|
||||
xmlXIncludeProcess(doc);
|
||||
#if 1
|
||||
if (!xmlValidateDocument(&valid, doc))
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Invalid document\n");
|
||||
fprintf(stderr, "Invalid document\n");
|
||||
exit(2);
|
||||
}
|
||||
/*endif*/
|
||||
#endif
|
||||
|
||||
/* Check the document is of the right kind */
|
||||
if ((cur = xmlDocGetRootElement(doc)) == NULL)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Empty document\n");
|
||||
fprintf(stderr, "Empty document\n");
|
||||
xmlFreeDoc(doc);
|
||||
exit(2);
|
||||
}
|
||||
/*endif*/
|
||||
if (xmlStrcmp(cur->name, (const xmlChar *) "fax-tests"))
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Document of the wrong type, root node != fax-tests");
|
||||
fprintf(stderr, "Document of the wrong type, root node != fax-tests");
|
||||
xmlFreeDoc(doc);
|
||||
exit(2);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# $Id: tsb85_tests.sh,v 1.4 2008/09/09 15:30:43 steveu Exp $
|
||||
# $Id: tsb85_tests.sh,v 1.6 2008/09/11 15:13:42 steveu Exp $
|
||||
#
|
||||
|
||||
run_tsb85_test()
|
||||
@ -35,6 +35,12 @@ for TEST in MRGN01 MRGN02 MRGN03 MRGN04 MRGN05 MRGN06a MRGN06b MRGN07 MRGN08 ; d
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
#MRGN14 fails because ???
|
||||
#MRGN16 fails because we don't adequately distinguish between receiving a
|
||||
#bad image signal and receiving none at all.
|
||||
#MRGN17 fails because we don't adequately distinguish between receiving a
|
||||
#bad HDLC message and receiving none at all.
|
||||
|
||||
#for TEST in MRGN09 MRGN10 MRGN11 MRGN12 MRGN13 MRGN14 MRGN15 MRGN16 MRGN17 ; do
|
||||
for TEST in MRGN09 MRGN10 MRGN11 MRGN12 MRGN13 MRGN15 ; do
|
||||
run_tsb85_test
|
||||
@ -48,50 +54,62 @@ for TEST in OREN01 OREN02 OREN03 OREN04 OREN05 OREN06 OREN07 OREN08 OREN09 OREN1
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
# MRGX05 is failing because we don't distinguish MPS immediately after MCF from MPS after
|
||||
# a corrupt image signal.
|
||||
|
||||
#for TEST in MRGX01 MRGX02 MRGX03 MRGX04 MRGX05 MRGX06 MRGX07 MRGX08 ; do
|
||||
for TEST in MRGX02 MRGX04 MRGX06 MRGX07 MRGX08 ; do
|
||||
for TEST in MRGX01 MRGX02 MRGX03 MRGX04 MRGX06 MRGX07 MRGX08 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
#for TEST in MRGX09 MRGX10 MRGX11 MRGX12 MRGX13 MRGX14 MRGX15 ; do
|
||||
for TEST in MRGX09 MRGX11 ; do
|
||||
for TEST in MRGX09 MRGX10 MRGX11 MRGX12 MRGX13 MRGX14 MRGX15 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
#for TEST in MTGP01 MTGP02 OTGP03 ; do
|
||||
# run_tsb85_test
|
||||
#done
|
||||
for TEST in MTGP01 MTGP02 OTGP03 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
#for TEST in MTGN01 MTGN02 MTGN03 MTGN04 MTGN05 MTGN06 MTGN07 MTGN08 MTGN09 MTGN10 ; do
|
||||
# run_tsb85_test
|
||||
#done
|
||||
for TEST in MTGN01 MTGN02 MTGN03 MTGN04 MTGN05 MTGN06 MTGN07 MTGN08 MTGN09 MTGN10 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
#for TEST in MTGN11 MTGN12 MTGN13 MTGN14 MTGN15 MTGN16 MTGN17 MTGN18 MTGN19 MTGN20 ; do
|
||||
# run_tsb85_test
|
||||
#done
|
||||
for TEST in MTGN11 MTGN12 MTGN13 MTGN14 MTGN15 MTGN16 MTGN17 MTGN18 MTGN19 MTGN20 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
#for TEST in MTGN21 MTGN22 MTGN23 MTGN24 MTGN25 MTGN26 MTGN27 MTGN28 ; do
|
||||
# run_tsb85_test
|
||||
#done
|
||||
for TEST in MTGN21 MTGN22 MTGN23 MTGN24 MTGN25 MTGN26 MTGN27 MTGN28 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
#for TEST in OTGC01 OTGC02 OTGC03 OTGC04 OTGC05 OTGC06 OTGC07 OTGC08 OTGC09 OTGC10 OTGC11 ; do
|
||||
# run_tsb85_test
|
||||
#done
|
||||
for TEST in OTGC01 OTGC02 OTGC03 OTGC04 OTGC05 OTGC06 OTGC07 OTGC08 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
#for TEST in OTEN01 OTEN02 OTEN03 OTEN04 OTEN05 OTEN06 ; do
|
||||
# run_tsb85_test
|
||||
#done
|
||||
for TEST in OTGC09-01 OTGC09-02 OTGC09-03 OTGC09-04 OTGC09-05 OTGC09-06 OTGC09-07 OTGC09-08 OTGC09-09 OTGC09-10 OTGC09-11 OTGC09-12 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
for TEST in OTGC10 OTGC11 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
for TEST in OTEN01 OTEN02 OTEN03 OTEN04 OTEN05 OTEN06 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
#MTGX02 fails because ?????
|
||||
|
||||
#for TEST in MTGX01 MTGX02 MTGX03 MTGX04 MTGX05 MTGX06 MTGX07 MTGX08 ; do
|
||||
# run_tsb85_test
|
||||
#done
|
||||
for TEST in MTGX01 MTGX03 MTGX04 MTGX05 MTGX06 MTGX07 MTGX08 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
#for TEST in MTGX09 MTGX10 MTGX11 MTGX12 MTGX13 MTGX14 MTGX15 MTGX16 ; do
|
||||
# run_tsb85_test
|
||||
#done
|
||||
for TEST in MTGX09 MTGX10 MTGX11 MTGX12 MTGX13 MTGX14 MTGX15 MTGX16 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
#for TEST in MTGX17 MTGX18 MTGX19 MTGX20 MTGX21 MTGX22 MTGX23 ; do
|
||||
for TEST in MTGX18 MTGX19 MTGX20 MTGX21 MTGX22 MTGX23 ; do
|
||||
for TEST in MTGX17 MTGX18 MTGX19 MTGX20 MTGX21 MTGX22 MTGX23 ; do
|
||||
run_tsb85_test
|
||||
done
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user