mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-16 14:28:34 +00:00
Some tidying of the V.17 modem. Brought the modem test programs up to date
This commit is contained in:
1 parent
e58b2e7d97
commit
fd8c576c66
9 files changed
+399
-153
No files matched your search
@@ -863,10 +863,22 @@ int main(int argc, char *argv[])
|
||||
| T30_SUPPORT_300_600_RESOLUTION
|
||||
| T30_SUPPORT_400_800_RESOLUTION
|
||||
| T30_SUPPORT_600_1200_RESOLUTION);
|
||||
|
||||
t30_set_ecm_capability(t30_state[i], use_ecm);
|
||||
if (use_ecm)
|
||||
t30_set_supported_compressions(t30_state[i], T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
|
||||
{
|
||||
t30_set_supported_compressions(t30_state[i],
|
||||
T30_SUPPORT_T4_1D_COMPRESSION
|
||||
| T30_SUPPORT_T4_2D_COMPRESSION
|
||||
| T30_SUPPORT_T6_COMPRESSION
|
||||
| T30_SUPPORT_T85_COMPRESSION
|
||||
| T30_SUPPORT_T85_L0_COMPRESSION);
|
||||
}
|
||||
else
|
||||
{
|
||||
t30_set_supported_compressions(t30_state[i],
|
||||
T30_SUPPORT_T4_1D_COMPRESSION
|
||||
| T30_SUPPORT_T4_2D_COMPRESSION);
|
||||
}
|
||||
t30_set_minimum_scan_line_time(t30_state[i], scan_line_time);
|
||||
|
||||
if (mode[i] == T38_GATEWAY_FAX)
|
||||
|
||||
@@ -122,7 +122,7 @@ static void v17_rx_status(void *user_data, int status)
|
||||
v17_rx_state_t *s;
|
||||
int i;
|
||||
int len;
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
complexi16_t *coeffs;
|
||||
#else
|
||||
complexf_t *coeffs;
|
||||
@@ -136,7 +136,7 @@ static void v17_rx_status(void *user_data, int status)
|
||||
len = v17_rx_equalizer_state(s, &coeffs);
|
||||
printf("Equalizer:\n");
|
||||
for (i = 0; i < len; i++)
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f);
|
||||
#else
|
||||
printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
|
||||
@@ -173,7 +173,7 @@ static int v17getbit(void *user_data)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
static void qam_report(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol)
|
||||
#else
|
||||
static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol)
|
||||
@@ -181,7 +181,12 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
{
|
||||
int i;
|
||||
int len;
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
complexi16_t *coeffs;
|
||||
complexf_t constel_point;
|
||||
#else
|
||||
complexf_t *coeffs;
|
||||
#endif
|
||||
float fpower;
|
||||
v17_rx_state_t *rx;
|
||||
static float smooth_power = 0.0f;
|
||||
@@ -190,37 +195,53 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
rx = (v17_rx_state_t *) user_data;
|
||||
if (constel)
|
||||
{
|
||||
fpower = (constel->re - target->re)*(constel->re - target->re)
|
||||
+ (constel->im - target->im)*(constel->im - target->im);
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
fpower /= 4096.0*4096.0;
|
||||
#endif
|
||||
smooth_power = 0.95f*smooth_power + 0.05f*fpower;
|
||||
#if defined(ENABLE_GUI)
|
||||
if (use_gui)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
constel_point.re = constel->re/4096.0;
|
||||
constel_point.im = constel->im/4096.0;
|
||||
qam_monitor_update_constel(qam_monitor, &constel_point);
|
||||
#else
|
||||
qam_monitor_update_constel(qam_monitor, constel);
|
||||
#endif
|
||||
qam_monitor_update_carrier_tracking(qam_monitor, v17_rx_carrier_frequency(rx));
|
||||
qam_monitor_update_symbol_tracking(qam_monitor, v17_rx_symbol_timing_correction(rx));
|
||||
}
|
||||
#endif
|
||||
fpower = (constel->re - target->re)*(constel->re - target->re)
|
||||
+ (constel->im - target->im)*(constel->im - target->im);
|
||||
smooth_power = 0.95f*smooth_power + 0.05f*fpower;
|
||||
printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n",
|
||||
symbol_no,
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
constel->re/4096.0,
|
||||
constel->im/4096.0,
|
||||
target->re/4096.0,
|
||||
target->im/4096.0,
|
||||
#else
|
||||
constel->re,
|
||||
constel->im,
|
||||
target->re,
|
||||
target->im,
|
||||
#endif
|
||||
symbol,
|
||||
fpower,
|
||||
smooth_power,
|
||||
v17_rx_carrier_frequency(rx),
|
||||
v17_rx_signal_power(rx),
|
||||
v17_rx_symbol_timing_correction(rx));
|
||||
printf("Carrier %d %f %f\n", symbol_no, v17_rx_carrier_frequency(rx), v17_rx_symbol_timing_correction(rx));
|
||||
//printf("Carrier %d %f %f\n", symbol_no, v17_rx_carrier_frequency(rx), v17_rx_symbol_timing_correction(rx));
|
||||
symbol_no++;
|
||||
if (--update_interval <= 0)
|
||||
{
|
||||
len = v17_rx_equalizer_state(rx, &coeffs);
|
||||
printf("Equalizer A:\n");
|
||||
for (i = 0; i < len; i++)
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f);
|
||||
#else
|
||||
printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
|
||||
@@ -228,7 +249,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
#if defined(ENABLE_GUI)
|
||||
if (use_gui)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
qam_monitor_update_int_equalizer(qam_monitor, coeffs, len);
|
||||
#else
|
||||
qam_monitor_update_equalizer(qam_monitor, coeffs, len);
|
||||
|
||||
@@ -115,7 +115,7 @@ static void v22bis_rx_status(void *user_data, int status)
|
||||
int bit_rate;
|
||||
int i;
|
||||
int len;
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
complexi16_t *coeffs;
|
||||
#else
|
||||
complexf_t *coeffs;
|
||||
@@ -132,7 +132,7 @@ static void v22bis_rx_status(void *user_data, int status)
|
||||
len = v22bis_rx_equalizer_state(s->v22bis, &coeffs);
|
||||
printf("Equalizer:\n");
|
||||
for (i = 0; i < len; i++)
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f);
|
||||
#else
|
||||
printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
|
||||
@@ -171,7 +171,7 @@ static int v22bis_getbit(void *user_data)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
static void qam_report(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol)
|
||||
#else
|
||||
static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol)
|
||||
@@ -179,7 +179,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
{
|
||||
int i;
|
||||
int len;
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
complexi16_t *coeffs;
|
||||
complexf_t constel_point;
|
||||
#else
|
||||
@@ -194,7 +194,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
#if defined(ENABLE_GUI)
|
||||
if (use_gui)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
constel_point.re = constel->re/1024.0;
|
||||
constel_point.im = constel->im/1024.0;
|
||||
qam_monitor_update_constel(s->qam_monitor, &constel_point);
|
||||
#else
|
||||
qam_monitor_update_constel(s->qam_monitor, constel);
|
||||
#endif
|
||||
qam_monitor_update_carrier_tracking(s->qam_monitor, v22bis_rx_carrier_frequency(s->v22bis));
|
||||
qam_monitor_update_symbol_tracking(s->qam_monitor, v22bis_rx_symbol_timing_correction(s->v22bis));
|
||||
}
|
||||
@@ -205,10 +211,17 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
|
||||
printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %8.4f\n",
|
||||
s->symbol_no,
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
constel->re/1024.0,
|
||||
constel->im/1024.0,
|
||||
target->re/1024.0,
|
||||
target->im/1024.0,
|
||||
#else
|
||||
constel->re,
|
||||
constel->im,
|
||||
target->re,
|
||||
target->im,
|
||||
#endif
|
||||
symbol,
|
||||
fpower,
|
||||
s->smooth_power,
|
||||
@@ -221,7 +234,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
len = v22bis_rx_equalizer_state(s->v22bis, &coeffs);
|
||||
printf("Equalizer A:\n");
|
||||
for (i = 0; i < len; i++)
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f);
|
||||
#else
|
||||
printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
|
||||
@@ -229,7 +242,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
#if defined(ENABLE_GUI)
|
||||
if (use_gui)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
qam_monitor_update_int_equalizer(s->qam_monitor, coeffs, len);
|
||||
#else
|
||||
qam_monitor_update_equalizer(s->qam_monitor, coeffs, len);
|
||||
|
||||
@@ -118,7 +118,7 @@ static void v27ter_rx_status(void *user_data, int status)
|
||||
v27ter_rx_state_t *s;
|
||||
int i;
|
||||
int len;
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
complexi16_t *coeffs;
|
||||
#else
|
||||
complexf_t *coeffs;
|
||||
@@ -132,7 +132,7 @@ static void v27ter_rx_status(void *user_data, int status)
|
||||
len = v27ter_rx_equalizer_state(s, &coeffs);
|
||||
printf("Equalizer:\n");
|
||||
for (i = 0; i < len; i++)
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f);
|
||||
#else
|
||||
printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
|
||||
@@ -169,7 +169,7 @@ static int v27tergetbit(void *user_data)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
static void qam_report(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol)
|
||||
#else
|
||||
static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol)
|
||||
@@ -177,7 +177,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
{
|
||||
int i;
|
||||
int len;
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
complexi16_t *coeffs;
|
||||
complexf_t constel_point;
|
||||
#else
|
||||
@@ -196,23 +196,43 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
{
|
||||
fpower = (constel->re - target->re)*(constel->re - target->re)
|
||||
+ (constel->im - target->im)*(constel->im - target->im);
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
fpower /= 1024.0*1024.0;
|
||||
#endif
|
||||
smooth_power = 0.95f*smooth_power + 0.05f*fpower;
|
||||
#if defined(ENABLE_GUI)
|
||||
if (use_gui)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
constel_point.re = constel->re/1024.0;
|
||||
constel_point.im = constel->im/1024.0;
|
||||
qam_monitor_update_constel(qam_monitor, &constel_point);
|
||||
#else
|
||||
qam_monitor_update_constel(qam_monitor, constel);
|
||||
#endif
|
||||
qam_monitor_update_carrier_tracking(qam_monitor, v27ter_rx_carrier_frequency(rx));
|
||||
qam_monitor_update_symbol_tracking(qam_monitor, v27ter_rx_symbol_timing_correction(rx));
|
||||
}
|
||||
#endif
|
||||
error = constel->im*target->re - constel->re*target->im;
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
printf("Tracking error %f %f %f %f %f %f\n", error, v27ter_rx_carrier_frequency(rx), constel->re/1024.0, constel->im/1024.0, target->re/1024.0, target->im/1024.0);
|
||||
#else
|
||||
printf("Tracking error %f %f %f %f %f %f\n", error, v27ter_rx_carrier_frequency(rx), constel->re, constel->im, target->re, target->im);
|
||||
#endif
|
||||
printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n",
|
||||
symbol_no,
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
constel->re/1024.0,
|
||||
constel->im/1024.0,
|
||||
target->re/1024.0,
|
||||
target->im/1024.0,
|
||||
#else
|
||||
constel->re,
|
||||
constel->im,
|
||||
target->re,
|
||||
target->im,
|
||||
#endif
|
||||
symbol,
|
||||
fpower,
|
||||
smooth_power,
|
||||
@@ -222,7 +242,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
len = v27ter_rx_equalizer_state(rx, &coeffs);
|
||||
printf("Equalizer B:\n");
|
||||
for (i = 0; i < len; i++)
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f);
|
||||
#else
|
||||
printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
|
||||
@@ -236,7 +256,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
{
|
||||
if (++reports >= 1000)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
qam_monitor_update_int_equalizer(qam_monitor, coeffs, len);
|
||||
#else
|
||||
qam_monitor_update_equalizer(qam_monitor, coeffs, len);
|
||||
@@ -253,7 +273,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
len = v27ter_rx_equalizer_state(rx, &coeffs);
|
||||
printf("Equalizer A:\n");
|
||||
for (i = 0; i < len; i++)
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f);
|
||||
#else
|
||||
printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
|
||||
@@ -261,7 +281,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
#if defined(ENABLE_GUI)
|
||||
if (use_gui)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
qam_monitor_update_int_equalizer(qam_monitor, coeffs, len);
|
||||
#else
|
||||
qam_monitor_update_equalizer(qam_monitor, coeffs, len);
|
||||
|
||||
@@ -169,7 +169,7 @@ static int v29getbit(void *user_data)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
static void qam_report(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol)
|
||||
#else
|
||||
static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol)
|
||||
@@ -200,7 +200,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
#if defined(ENABLE_GUI)
|
||||
if (use_gui)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
constel_point.re = constel->re/4096.0;
|
||||
constel_point.im = constel->im/4096.0;
|
||||
qam_monitor_update_constel(qam_monitor, &constel_point);
|
||||
@@ -214,7 +214,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
|
||||
#endif
|
||||
printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n",
|
||||
symbol_no,
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
constel->re/4096.0,
|
||||
constel->im/4096.0,
|
||||
target->re/4096.0,
|
||||
|
||||
Reference in new issue
Block a user