1833 |
1833 |
return bits;
|
1834 |
1834 |
}
|
1835 |
1835 |
|
|
1836 |
static float computeEdgeCI(const signalVector *rot)
|
|
1837 |
{
|
|
1838 |
float err_pwr = 0.0f;
|
|
1839 |
float step = 2.0f * M_PI_F / 8.0f;
|
|
1840 |
|
|
1841 |
for (int i=8; i<rot->size()-8; i++) {
|
|
1842 |
/* Compute the ideal symbol */
|
|
1843 |
complex sym = (*rot)[i];
|
|
1844 |
float phase = step * roundf(sym.arg() / step);
|
|
1845 |
complex ideal = complex(cos(phase), sin(phase));
|
|
1846 |
|
|
1847 |
/* Compute the error vector */
|
|
1848 |
complex err = ideal - sym;
|
|
1849 |
|
|
1850 |
/* Accumulate power */
|
|
1851 |
err_pwr += err.norm2();
|
|
1852 |
}
|
|
1853 |
|
|
1854 |
return 3.0103f * log2f(1.0f * (rot->size() - 16) / err_pwr);
|
|
1855 |
}
|
|
1856 |
|
1836 |
1857 |
/*
|
1837 |
1858 |
* Demodulate an 8-PSK burst. Prior to symbol rotation, operate at
|
1838 |
1859 |
* 4 SPS (if activated) to minimize distortion through the fractional
|
... | ... | |
1844 |
1865 |
* nearly unrecoverable.
|
1845 |
1866 |
*/
|
1846 |
1867 |
static SoftVector *demodEdgeBurst(const signalVector &burst,
|
1847 |
|
int sps, complex chan, float toa)
|
|
1868 |
int sps, complex chan, float toa,
|
|
1869 |
struct estim_burst_params *ebp)
|
1848 |
1870 |
{
|
1849 |
1871 |
SoftVector *bits;
|
1850 |
1872 |
signalVector *dec, *rot, *eq;
|
... | ... | |
1856 |
1878 |
/* Equalize and derotate */
|
1857 |
1879 |
eq = convolve(dec, GSMPulse4->c0_inv, NULL, NO_DELAY);
|
1858 |
1880 |
rot = derotateEdgeBurst(*eq, 1);
|
|
1881 |
ebp->ci = computeEdgeCI(rot);
|
1859 |
1882 |
|
1860 |
1883 |
/* Soft slice and normalize */
|
1861 |
1884 |
bits = softSliceEdgeBurst(*rot);
|
... | ... | |
1868 |
1891 |
}
|
1869 |
1892 |
|
1870 |
1893 |
SoftVector *demodAnyBurst(const signalVector &burst, int sps, complex amp,
|
1871 |
|
float toa, CorrType type)
|
|
1894 |
float toa, CorrType type,
|
|
1895 |
struct estim_burst_params *ebp)
|
1872 |
1896 |
{
|
1873 |
1897 |
if (type == EDGE)
|
1874 |
|
return demodEdgeBurst(burst, sps, amp, toa);
|
|
1898 |
return demodEdgeBurst(burst, sps, amp, toa, ebp);
|
1875 |
1899 |
else
|
1876 |
1900 |
return demodGmskBurst(burst, sps, amp, toa);
|
1877 |
1901 |
}
|