mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 06:48:33 +00:00
The FAX modem receive synchronisation algorithms have been changed to prevent
occasional false recognition of a fast modem when its really the V.21 modem. This was sometimes messing up T.38 gateway operation.
This commit is contained in:
1 parent
aa6bb702de
commit
cfce1fd240
8 files changed
+78
-97
No files matched your search
+14
-13
@@ -600,8 +600,8 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample)
|
||||
{
|
||||
/* Record the current phase angle */
|
||||
s->training_stage = TRAINING_STAGE_LOG_PHASE;
|
||||
s->angles[0] =
|
||||
s->start_angles[0] = arctan2(z.im, z.re);
|
||||
vec_zeroi32(s->diff_angles, 16);
|
||||
s->last_angles[0] = arctan2(z.im, z.re);
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
if (s->agc_scaling_save == 0)
|
||||
s->agc_scaling_save = s->agc_scaling;
|
||||
@@ -614,8 +614,7 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample)
|
||||
case TRAINING_STAGE_LOG_PHASE:
|
||||
/* Record the current alternate phase angle */
|
||||
target = &zero;
|
||||
s->angles[1] =
|
||||
s->start_angles[1] = arctan2(z.im, z.re);
|
||||
s->last_angles[1] = arctan2(z.im, z.re);
|
||||
s->training_count = 1;
|
||||
s->training_stage = TRAINING_STAGE_WAIT_FOR_CDCD;
|
||||
break;
|
||||
@@ -624,9 +623,11 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample)
|
||||
angle = arctan2(z.im, z.re);
|
||||
/* Look for the initial ABAB sequence to display a phase reversal, which will
|
||||
signal the start of the scrambled CDCD segment */
|
||||
ang = angle - s->angles[(s->training_count - 1) & 0xF];
|
||||
s->angles[(s->training_count + 1) & 0xF] = angle;
|
||||
if ((ang > 0x20000000 || ang < -0x20000000) && s->training_count >= 13)
|
||||
i = s->training_count + 1;
|
||||
ang = angle - s->last_angles[i & 1];
|
||||
s->last_angles[i & 1] = angle;
|
||||
s->diff_angles[i & 0xF] = s->diff_angles[(i - 2) & 0xF] + (ang >> 4);
|
||||
if ((ang > DDS_PHASE(45.0f) || ang < DDS_PHASE(-45.0f)) && s->training_count >= 13)
|
||||
{
|
||||
/* We seem to have a phase reversal */
|
||||
/* Slam the carrier frequency into line, based on the total phase drift over the last
|
||||
@@ -636,17 +637,17 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample)
|
||||
/* Step back a few symbols so we don't get ISI distorting things. */
|
||||
i = (s->training_count - 8) & ~1;
|
||||
/* Avoid the possibility of a divide by zero */
|
||||
if (i)
|
||||
if (i > 1)
|
||||
{
|
||||
j = i & 0xF;
|
||||
ang = (s->angles[j] - s->start_angles[0])/i + (s->angles[j | 0x1] - s->start_angles[1])/i;
|
||||
s->carrier_phase_rate += 3*(ang/20);
|
||||
ang = (s->diff_angles[j] + s->diff_angles[j | 0x1])/(i - 1);
|
||||
s->carrier_phase_rate += 3*16*(ang/20);
|
||||
}
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Coarse carrier frequency %7.2f\n", dds_frequencyf(s->carrier_phase_rate));
|
||||
/* Check if the carrier frequency is plausible */
|
||||
if (s->carrier_phase_rate < dds_phase_ratef(CARRIER_NOMINAL_FREQ - 20.0f)
|
||||
if (s->carrier_phase_rate < DDS_PHASE_RATE(CARRIER_NOMINAL_FREQ - 20.0f)
|
||||
||
|
||||
s->carrier_phase_rate > dds_phase_ratef(CARRIER_NOMINAL_FREQ + 20.0f))
|
||||
s->carrier_phase_rate > DDS_PHASE_RATE(CARRIER_NOMINAL_FREQ + 20.0f))
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n");
|
||||
/* Park this modem */
|
||||
@@ -1111,7 +1112,7 @@ SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train)
|
||||
}
|
||||
else
|
||||
{
|
||||
s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ);
|
||||
s->carrier_phase_rate = DDS_PHASE_RATE(CARRIER_NOMINAL_FREQ);
|
||||
equalizer_reset(s);
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
s->agc_scaling_save = 0;
|
||||
|
||||
Reference in new issue
Block a user