From eed8ea1b827de2c56e3a5f003f76ae1c533d7920 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 16 Jun 2010 23:26:15 +0800 Subject: [PATCH] Further changes to polish the long training/short training issues that spoilt T.38 gateway operation with some FAX machines --- libs/spandsp/src/t38_gateway.c | 2 ++ libs/spandsp/src/v17rx.c | 14 ++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index 824ee16e4b..e4fac8067c 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -1627,6 +1627,7 @@ static void non_ecm_rx_status(void *user_data, int status) s->audio.modems.rx_trained = TRUE; s->core.timed_mode = TIMED_MODE_IDLE; s->core.samples_to_timeout = 0; + s->core.short_train = TRUE; to_t38_buffer_init(&s->core.to_t38); break; case SIG_STATUS_CARRIER_UP: @@ -1792,6 +1793,7 @@ static void hdlc_rx_status(hdlc_rx_state_t *t, int status) /* The modem is now trained. */ s->audio.modems.rx_signal_present = TRUE; s->audio.modems.rx_trained = TRUE; + s->core.short_train = TRUE; /* Behave like HDLC preamble has been announced. */ t->framing_ok_announced = TRUE; to_t38_buffer_init(&s->core.to_t38); diff --git a/libs/spandsp/src/v17rx.c b/libs/spandsp/src/v17rx.c index b5ba221cae..78311a8a43 100644 --- a/libs/spandsp/src/v17rx.c +++ b/libs/spandsp/src/v17rx.c @@ -1358,12 +1358,12 @@ SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_trai s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ); equalizer_reset(s); #if defined(SPANDSP_USE_FIXED_POINTx) - //s->agc_scaling_save = 0; + s->agc_scaling_save = 0; s->agc_scaling = (float) FP_FACTOR*32768.0f*0.0017f/RX_PULSESHAPER_GAIN; s->carrier_track_i = 5000; s->carrier_track_p = 40000; #else - //s->agc_scaling_save = 0.0f; + s->agc_scaling_save = 0.0f; s->agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN; s->carrier_track_i = 5000.0f; s->carrier_track_p = 40000.0f; @@ -1371,6 +1371,7 @@ SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_trai } s->last_sample = 0; span_log(&s->logging, SPAN_LOG_FLOW, "Phase rates %f %f\n", dds_frequencyf(s->carrier_phase_rate), dds_frequencyf(s->carrier_phase_rate_save)); + span_log(&s->logging, SPAN_LOG_FLOW, "Gains %f %f\n", s->agc_scaling_save, s->agc_scaling); /* Initialise the working data for symbol timing synchronisation */ #if defined(SPANDSP_USE_FIXED_POINTx) @@ -1407,7 +1408,7 @@ SPAN_DECLARE(v17_rx_state_t *) v17_rx_init(v17_rx_state_t *s, int bit_rate, put_ case 9600: case 7200: case 4800: - /* 4800 is an extension of V.17, to provide full converage of the V.32bis modes */ + /* 4800 is an extension of V.17, to provide full coverage of the V.32bis modes */ break; default: return NULL; @@ -1425,13 +1426,6 @@ SPAN_DECLARE(v17_rx_state_t *) v17_rx_init(v17_rx_state_t *s, int bit_rate, put_ s->short_train = FALSE; //s->scrambler_tap = 18 - 1; v17_rx_signal_cutoff(s, -45.5f); -#if defined(SPANDSP_USE_FIXED_POINTx) - s->agc_scaling_save = 0; - s->agc_scaling = (float) FP_FACTOR*32768.0f*0.0017f/RX_PULSESHAPER_GAIN; -#else - s->agc_scaling_save = 0.0f; - s->agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN; -#endif s->carrier_phase_rate_save = dds_phase_ratef(CARRIER_NOMINAL_FREQ); v17_rx_restart(s, bit_rate, s->short_train); return s;