After converting atsc_fpll to handle complex input (to eliminate one

upconverter) it almost works, only the video out has problems.

The problem starts when this:

float I = input.real() * a_sin;

float Q = input.real() * a_cos;

is changed to this:

gr_complex IQ = input * gr_complex(a_cos,-a_sin);

which would be necessary to handle negative frequencies I think.

Everything else checks out ok, I even tried using gr_sincos.h in place

of gr_nco.h like in gr_pll_carriertracking_cc and it behaves exectly the

same.

Working:

gr_complex input = agc.scale(in[k]);

gr_sincosf(d_phase,&a_sin,&a_cos);

float I = input.real() * a_sin;

float Q = input.real() * a_cos;

out[k] = I;

gr_complex filtered_IQ = afc.filter(gr_complex(I,Q));

float x = phase_detector(filtered_IQ,0);

static const float alpha = 0.001;

static const float beta = alpha * alpha / 4;

d_freq = d_freq + beta * x;

d_phase = mod_2pi(d_phase + d_freq + alpha * x);

mpeg_packet_error_rate.py: 485526 errors out of 2165316 packets. 1679790

good packets. Error rate = 0.224

Almost working:

gr_complex input = agc.scale(in[k]);

gr_sincosf(d_phase,&a_sin,&a_cos);

gr_complex IQ = input * gr_complex(a_cos,-a_sin);

out[k] = IQ.real();

gr_complex filtered_IQ = afc.filter(gr_complex(I,Q));

float x = phase_detector(filtered_IQ,0);

static const float alpha = 0.001;

static const float beta = alpha * alpha / 4;

d_freq = d_freq + beta * x;

d_phase = mod_2pi(d_phase + d_freq + alpha * x);

mpeg_packet_error_rate.py: 258539 errors out of 2165280 packets. 1906741

good packets. Error rate = 0.119

Looks like a 36 missing packets, even tho the error rate is less, as the

video is certainly worse in mplayer.

–Chuck