TCM absolutely transformed the phone line modem business.
*/
+#if defined(SPANDSP_USE_FIXED_POINT)
+#define V17_CONSTELLATION_SCALING_FACTOR 1024.0
+#else
+#define V17_CONSTELLATION_SCALING_FACTOR 1.0
+#endif
+
/*!
V.17 modem receive side descriptor. This defines the working state for a
single instance of a V.17 modem receiver.
#if !defined(_SPANDSP_V22BIS_H_)
#define _SPANDSP_V22BIS_H_
+#if defined(SPANDSP_USE_FIXED_POINT)
+#define V22BIS_CONSTELLATION_SCALING_FACTOR 1024.0
+#else
+#define V22BIS_CONSTELLATION_SCALING_FACTOR 1.0
+#endif
+
enum
{
V22BIS_GUARD_TONE_NONE,
straightforward.
*/
+#if defined(SPANDSP_USE_FIXED_POINT)
+#define V27TER_CONSTELLATION_SCALING_FACTOR 1024.0
+#else
+#define V27TER_CONSTELLATION_SCALING_FACTOR 1.0
+#endif
+
/*!
V.27ter modem receive side descriptor. This defines the working state for a
single instance of a V.27ter modem receiver.
therefore, only tests that bits starting at bit 24 are really ones.
*/
+#if defined(SPANDSP_USE_FIXED_POINT)
+#define V29_CONSTELLATION_SCALING_FACTOR 4096.0
+#else
+#define V29_CONSTELLATION_SCALING_FACTOR 1.0
+#endif
+
#if defined(SPANDSP_USE_FIXED_POINT)
typedef void (*qam_report_handler_t)(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol);
#else
{
#if defined(SPANDSP_USE_FIXED_POINT)
*coeffs = NULL;
+ return 0;
#else
*coeffs = s->eq_coeff;
-#endif
return V17_EQUALIZER_LEN;
+#endif
}
/*- End of function --------------------------------------------------------*/
#define SYMBOL_TRACKER_POINTS 12000
#define CARRIER_TRACKER_POINTS 12000
-#define FP_FACTOR 4096
-
struct qam_monitor_s
{
+ float constel_scaling;
+
Fl_Double_Window *w;
Fl_Group *c_const;
Fl_Group *c_right;
for (i = 0; i < len; i++)
{
s->eq_re_plot[2*i] = (i - len/2)/2.0;
- s->eq_re_plot[2*i + 1] = coeffs[i].re;
+ s->eq_re_plot[2*i + 1] = coeffs[i].re*s->constel_scaling;
if (min > coeffs[i].re)
min = coeffs[i].re;
if (max < coeffs[i].re)
max = coeffs[i].re;
s->eq_im_plot[2*i] = (i - len/2)/2.0;
- s->eq_im_plot[2*i + 1] = coeffs[i].im;
+ s->eq_im_plot[2*i + 1] = coeffs[i].im*s->constel_scaling;
if (min > coeffs[i].im)
min = coeffs[i].im;
if (max < coeffs[i].im)
max = coeffs[i].im;
for (i = 0; i < len; i++)
{
- s->eq_re_plot[2*i] = (i - len/2)/2.0f;
- s->eq_re_plot[2*i + 1] = coeffs[i].re/(float) FP_FACTOR;
if (min > coeffs[i].re)
min = coeffs[i].re;
if (max < coeffs[i].re)
max = coeffs[i].re;
+ s->eq_re_plot[2*i] = (i - len/2)/2.0f;
+ s->eq_re_plot[2*i + 1] = coeffs[i].re*s->constel_scaling;
- s->eq_im_plot[2*i] = (i - len/2)/2.0f;
- s->eq_im_plot[2*i + 1] = coeffs[i].im/(float) FP_FACTOR;
if (min > coeffs[i].im)
min = coeffs[i].im;
if (max < coeffs[i].im)
max = coeffs[i].im;
+ s->eq_im_plot[2*i] = (i - len/2)/2.0f;
+ s->eq_im_plot[2*i + 1] = coeffs[i].im*s->constel_scaling;
}
- min /= (float) FP_FACTOR;
- max /= (float) FP_FACTOR;
+ min *= s->constel_scaling;
+ max *= s->constel_scaling;
s->eq_x->minimum(-len/4.0);
s->eq_x->maximum(len/4.0);
max = s->symbol_tracker[0];
for (i = s->symbol_track_ptr, j = 0; i < s->symbol_track_points; i++, j++)
{
- s->symbol_track_plot[2*j] = j;
- s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i];
if (min > s->symbol_tracker[i])
min = s->symbol_tracker[i];
if (max < s->symbol_tracker[i])
max = s->symbol_tracker[i];
+ s->symbol_track_plot[2*j] = j;
+ s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i];
}
for (i = 0; i < s->symbol_track_ptr; i++, j++)
{
- s->symbol_track_plot[2*j] = j;
- s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i];
if (min > s->symbol_tracker[i])
min = s->symbol_tracker[i];
if (max < s->symbol_tracker[i])
max = s->symbol_tracker[i];
+ s->symbol_track_plot[2*j] = j;
+ s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i];
}
s->symbol_track_y->maximum((fabs(max - min) < 0.05) ? max + 0.05 : max);
s->symbol_track_y->minimum(min);
}
/*- End of function --------------------------------------------------------*/
-qam_monitor_t *qam_monitor_init(float constel_width, const char *tag)
+qam_monitor_t *qam_monitor_init(float constel_width, float constel_scaling, const char *tag)
{
char buf[132 + 1];
float x;
s->w = new Fl_Double_Window(905, 400, (tag) ? tag : "QAM monitor");
+ s->constel_scaling = 1.0/constel_scaling;
+
s->c_const = new Fl_Group(0, 0, 380, 400);
s->c_const->box(FL_DOWN_BOX);
s->c_const->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
{
#endif
-qam_monitor_t *qam_monitor_init(float constel_width, const char *tag);
+qam_monitor_t *qam_monitor_init(float constel_width, float constel_scaling, const char *tag);
int qam_monitor_clear_constel(qam_monitor_t *s);
int qam_monitor_update_constel(qam_monitor_t *s, const complexf_t *pt);
int qam_monitor_update_equalizer(qam_monitor_t *s, const complexf_t *coeffs, int len);
switch (status)
{
case SIG_STATUS_TRAINING_SUCCEEDED:
- len = v17_rx_equalizer_state(s, &coeffs);
- printf("Equalizer:\n");
- for (i = 0; i < len; i++)
+ printf("Training succeeded\n");
+ if ((len = v17_rx_equalizer_state(s, &coeffs)))
+ {
+ printf("Equalizer:\n");
+ for (i = 0; i < len; i++)
#if defined(SPANDSP_USE_FIXED_POINT)
- printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f);
+ printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V17_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V17_CONSTELLATION_SCALING_FACTOR);
#else
- printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
+ printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
#endif
+ }
break;
}
}
int len;
#if defined(SPANDSP_USE_FIXED_POINT)
complexi16_t *coeffs;
- complexf_t constel_point;
#else
complexf_t *coeffs;
#endif
+ complexf_t constel_point;
+ complexf_t target_point;
float fpower;
v17_rx_state_t *rx;
static float smooth_power = 0.0f;
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
+ constel_point.re = constel->re/V17_CONSTELLATION_SCALING_FACTOR;
+ constel_point.im = constel->im/V17_CONSTELLATION_SCALING_FACTOR;
+ target_point.re = target->re/V17_CONSTELLATION_SCALING_FACTOR,
+ target_point.im = target->im/V17_CONSTELLATION_SCALING_FACTOR,
+ fpower = (constel_point.re - target_point.re)*(constel_point.re - target_point.re)
+ + (constel_point.im - target_point.im)*(constel_point.im - target_point.im);
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
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
+ constel_point.re,
+ constel_point.im,
+ target_point.re,
+ target_point.im,
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));
symbol_no++;
if (--update_interval <= 0)
{
- len = v17_rx_equalizer_state(rx, &coeffs);
- printf("Equalizer A:\n");
- for (i = 0; i < len; i++)
+ if ((len = v17_rx_equalizer_state(rx, &coeffs)))
+ {
+ printf("Equalizer A:\n");
+ for (i = 0; i < len; i++)
#if defined(SPANDSP_USE_FIXED_POINT)
- printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f);
+ printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V17_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V17_CONSTELLATION_SCALING_FACTOR);
#else
- printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
+ printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
#endif
#if defined(ENABLE_GUI)
- if (use_gui)
- {
+ if (use_gui)
+ {
#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
- qam_monitor_update_equalizer(qam_monitor, coeffs, len);
+ qam_monitor_update_equalizer(qam_monitor, coeffs, len);
#endif
- }
+ }
#endif
+ }
update_interval = 100;
}
}
#if defined(ENABLE_GUI)
if (use_gui)
{
- qam_monitor = qam_monitor_init(10.0f, NULL);
+ qam_monitor = qam_monitor_init(10.0f, V17_CONSTELLATION_SCALING_FACTOR, NULL);
if (!decode_test_file)
{
start_line_model_monitor(129);
case SIG_STATUS_TRAINING_SUCCEEDED:
bit_rate = v22bis_get_current_bit_rate(s->v22bis);
printf("Negotiated bit rate: %d\n", bit_rate);
- len = v22bis_rx_equalizer_state(s->v22bis, &coeffs);
- printf("Equalizer:\n");
- for (i = 0; i < len; i++)
+ if ((len = v22bis_rx_equalizer_state(s->v22bis, &coeffs)))
+ {
+ printf("Equalizer:\n");
+ for (i = 0; i < len; i++)
#if defined(SPANDSP_USE_FIXED_POINT)
- printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f);
+ printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V22BIS_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V22BIS_CONSTELLATION_SCALING_FACTOR);
#else
- printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
+ printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
#endif
+ }
break;
}
}
int len;
#if defined(SPANDSP_USE_FIXED_POINT)
complexi16_t *coeffs;
- complexf_t constel_point;
#else
complexf_t *coeffs;
#endif
+ complexf_t constel_point;
+ complexf_t target_point;
float fpower;
endpoint_t *s;
s = (endpoint_t *) user_data;
if (constel)
{
+ constel_point.re = constel->re/V22BIS_CONSTELLATION_SCALING_FACTOR;
+ constel_point.im = constel->im/V22BIS_CONSTELLATION_SCALING_FACTOR;
+ target_point.re = target->re/V22BIS_CONSTELLATION_SCALING_FACTOR;
+ target_point.im = target->im/V22BIS_CONSTELLATION_SCALING_FACTOR;
#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));
}
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
+ constel_point.re,
+ constel_point.im,
+ target_point.re,
+ target_point.im,
symbol,
fpower,
s->smooth_power,
else
{
printf("Gardner step %d\n", symbol);
- len = v22bis_rx_equalizer_state(s->v22bis, &coeffs);
- printf("Equalizer A:\n");
- for (i = 0; i < len; i++)
+ if ((len = v22bis_rx_equalizer_state(s->v22bis, &coeffs)))
+ {
+ printf("Equalizer A:\n");
+ for (i = 0; i < len; i++)
#if defined(SPANDSP_USE_FIXED_POINT)
- printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f);
+ printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V22BIS_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V22BIS_CONSTELLATION_SCALING_FACTOR);
#else
- printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
+ printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
#endif
#if defined(ENABLE_GUI)
- if (use_gui)
- {
+ if (use_gui)
+ {
#if defined(SPANDSP_USE_FIXED_POINT)
- qam_monitor_update_int_equalizer(s->qam_monitor, coeffs, len);
+ qam_monitor_update_int_equalizer(s->qam_monitor, coeffs, len);
#else
- qam_monitor_update_equalizer(s->qam_monitor, coeffs, len);
+ qam_monitor_update_equalizer(s->qam_monitor, coeffs, len);
#endif
- }
+ }
#endif
+ }
}
}
/*- End of function --------------------------------------------------------*/
#if defined(ENABLE_GUI)
if (use_gui)
{
- endpoint[0].qam_monitor = qam_monitor_init(6.0f, "Calling modem");
- endpoint[1].qam_monitor = qam_monitor_init(6.0f, "Answering modem");
+ endpoint[0].qam_monitor = qam_monitor_init(6.0f, V22BIS_CONSTELLATION_SCALING_FACTOR, "Calling modem");
+ endpoint[1].qam_monitor = qam_monitor_init(6.0f, V22BIS_CONSTELLATION_SCALING_FACTOR, "Answering modem");
}
#endif
if ((model = both_ways_line_model_init(line_model_no,
switch (status)
{
case SIG_STATUS_TRAINING_SUCCEEDED:
- len = v27ter_rx_equalizer_state(s, &coeffs);
- printf("Equalizer:\n");
- for (i = 0; i < len; i++)
+ if ((len = v27ter_rx_equalizer_state(s, &coeffs)))
+ {
+ printf("Equalizer:\n");
+ for (i = 0; i < len; i++)
#if defined(SPANDSP_USE_FIXED_POINT)
- printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f);
+ printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V27TER_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V27TER_CONSTELLATION_SCALING_FACTOR);
#else
- printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
+ printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
#endif
+ }
break;
}
}
int len;
#if defined(SPANDSP_USE_FIXED_POINT)
complexi16_t *coeffs;
- complexf_t constel_point;
#else
complexf_t *coeffs;
#endif
+ complexf_t constel_point;
+ complexf_t target_point;
float fpower;
float error;
v27ter_rx_state_t *rx;
static float smooth_power = 0.0f;
-#if defined(ENABLE_GUI)
- static int reports = 0;
-#endif
+ static int update_interval = 100;
rx = (v27ter_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 /= 1024.0*1024.0;
-#endif
+ constel_point.re = constel->re/V27TER_CONSTELLATION_SCALING_FACTOR;
+ constel_point.im = constel->im/V27TER_CONSTELLATION_SCALING_FACTOR;
+ target_point.re = target->re/V27TER_CONSTELLATION_SCALING_FACTOR;
+ target_point.im = target->im/V27TER_CONSTELLATION_SCALING_FACTOR;
+ fpower = (constel_point.re - target_point.re)*(constel_point.re - target_point.re)
+ + (constel_point.im - target_point.im)*(constel_point.im - target_point.im);
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("Tracking error %f %f %f %f %f %f\n", error, v27ter_rx_carrier_frequency(rx), constel_point.re, constel_point.im, target_point.re, target_point.im);
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
+ constel_point.re,
+ constel_point.im,
+ target_point.re,
+ target_point.im,
symbol,
fpower,
smooth_power,
v27ter_rx_carrier_frequency(rx),
v27ter_rx_signal_power(rx),
v27ter_rx_symbol_timing_correction(rx));
- len = v27ter_rx_equalizer_state(rx, &coeffs);
- printf("Equalizer B:\n");
- for (i = 0; i < len; i++)
-#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]));
-#endif
-#if defined(WITH_SPANDSP_INTERNALS)
- printf("Gardtest %d %f %d\n", symbol_no, v27ter_rx_symbol_timing_correction(rx), rx->gardner_integrate);
-#endif
- printf("Carcar %d %f\n", symbol_no, v27ter_rx_carrier_frequency(rx));
-#if defined(ENABLE_GUI)
- if (use_gui)
+ symbol_no++;
+ if (--update_interval <= 0)
{
- if (++reports >= 1000)
+ if ((len = v27ter_rx_equalizer_state(rx, &coeffs)))
{
+ printf("Equalizer B:\n");
+ for (i = 0; i < len; i++)
+ printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V27TER_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V27TER_CONSTELLATION_SCALING_FACTOR);
+#if defined(ENABLE_GUI)
+ if (use_gui)
+ {
#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
- qam_monitor_update_equalizer(qam_monitor, coeffs, len);
+ qam_monitor_update_equalizer(qam_monitor, coeffs, len);
#endif
- reports = 0;
+ }
}
+ update_interval = 100;
}
#endif
- symbol_no++;
}
else
{
printf("Gardner step %d\n", symbol);
- len = v27ter_rx_equalizer_state(rx, &coeffs);
- printf("Equalizer A:\n");
- for (i = 0; i < len; i++)
+ if ((len = v27ter_rx_equalizer_state(rx, &coeffs)))
+ {
+ printf("Equalizer A:\n");
+ for (i = 0; i < len; i++)
#if defined(SPANDSP_USE_FIXED_POINT)
- printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f);
+ printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V27TER_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V27TER_CONSTELLATION_SCALING_FACTOR);
#else
- printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
+ printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
#endif
#if defined(ENABLE_GUI)
- if (use_gui)
- {
+ if (use_gui)
+ {
#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
- qam_monitor_update_equalizer(qam_monitor, coeffs, len);
+ qam_monitor_update_equalizer(qam_monitor, coeffs, len);
#endif
- }
+ }
#endif
+ }
}
}
/*- End of function --------------------------------------------------------*/
#if defined(ENABLE_GUI)
if (use_gui)
{
- qam_monitor = qam_monitor_init(2.0f, NULL);
+ qam_monitor = qam_monitor_init(2.0f, V27TER_CONSTELLATION_SCALING_FACTOR, NULL);
if (!decode_test_file)
{
start_line_model_monitor(129);
{
case SIG_STATUS_TRAINING_SUCCEEDED:
printf("Training succeeded\n");
- len = v29_rx_equalizer_state(s, &coeffs);
- printf("Equalizer:\n");
- for (i = 0; i < len; i++)
+ if ((len = v29_rx_equalizer_state(s, &coeffs)))
+ {
+ printf("Equalizer:\n");
+ for (i = 0; i < len; i++)
#if defined(SPANDSP_USE_FIXED_POINT)
- printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f);
+ printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V29_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V29_CONSTELLATION_SCALING_FACTOR);
#else
- printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
+ printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
#endif
+ }
break;
}
}
int len;
#if defined(SPANDSP_USE_FIXED_POINT)
complexi16_t *coeffs;
- complexf_t constel_point;
#else
complexf_t *coeffs;
#endif
+ complexf_t constel_point;
+ complexf_t target_point;
float fpower;
v29_rx_state_t *rx;
static float smooth_power = 0.0f;
rx = (v29_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
+ constel_point.re = constel->re/V29_CONSTELLATION_SCALING_FACTOR;
+ constel_point.im = constel->im/V29_CONSTELLATION_SCALING_FACTOR;
+ target_point.re = target->re/V29_CONSTELLATION_SCALING_FACTOR,
+ target_point.im = target->im/V29_CONSTELLATION_SCALING_FACTOR,
+ fpower = (constel_point.re - target_point.re)*(constel_point.re - target_point.re)
+ + (constel_point.im - target_point.im)*(constel_point.im - target_point.im);
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, v29_rx_carrier_frequency(rx));
//qam_monitor_update_carrier_tracking(qam_monitor, (fpower) ? fpower : 0.001f);
qam_monitor_update_symbol_tracking(qam_monitor, v29_rx_symbol_timing_correction(rx));
#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/4096.0,
- constel->im/4096.0,
- target->re/4096.0,
- target->im/4096.0,
-#else
- constel->re,
- constel->im,
- target->re,
- target->im,
-#endif
+ constel_point.re,
+ constel_point.im,
+ target_point.re,
+ target_point.im,
symbol,
fpower,
smooth_power,
symbol_no++;
if (--update_interval <= 0)
{
- len = v29_rx_equalizer_state(rx, &coeffs);
- printf("Equalizer A:\n");
- for (i = 0; i < len; i++)
+ if ((len = v29_rx_equalizer_state(rx, &coeffs)))
+ {
+ printf("Equalizer A:\n");
+ for (i = 0; i < len; i++)
#if defined(SPANDSP_USE_FIXED_POINT)
- printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f);
+ printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V29_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V29_CONSTELLATION_SCALING_FACTOR);
#else
- printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
+ printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
#endif
#if defined(ENABLE_GUI)
- if (use_gui)
- {
+ if (use_gui)
+ {
#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
- qam_monitor_update_equalizer(qam_monitor, coeffs, len);
+ qam_monitor_update_equalizer(qam_monitor, coeffs, len);
#endif
- }
+ }
#endif
+ }
update_interval = 100;
}
}
#if defined(ENABLE_GUI)
if (use_gui)
{
- qam_monitor = qam_monitor_init(6.0f, NULL);
+ qam_monitor = qam_monitor_init(6.0f, V29_CONSTELLATION_SCALING_FACTOR, NULL);
if (!decode_test_file)
{
start_line_model_monitor(129);