提交 6af84a87 authored 作者: Steve Underwood's avatar Steve Underwood

Cleanup of modem filters

上级 f3683699
...@@ -391,133 +391,89 @@ t42.lo: cielab_luts.h ...@@ -391,133 +391,89 @@ t42.lo: cielab_luts.h
cielab_luts.h: make_cielab_luts$(EXEEXT) cielab_luts.h: make_cielab_luts$(EXEEXT)
./make_cielab_luts$(EXEEXT) >cielab_luts.h ./make_cielab_luts$(EXEEXT) >cielab_luts.h
V17_V32BIS_RX_INCL = v17_v32bis_rx_fixed_rrc.h \ V17_V32BIS_RX_INCL = v17_v32bis_rx_rrc.h
v17_v32bis_rx_floating_rrc.h
v17rx.$(OBJEXT): ${V17_V32BIS_RX_INCL} v17rx.$(OBJEXT): ${V17_V32BIS_RX_INCL}
v17rx.lo: ${V17_V32BIS_RX_INCL} v17rx.lo: ${V17_V32BIS_RX_INCL}
v17_v32bis_rx_fixed_rrc.h: make_modem_filter$(EXEEXT) v17_v32bis_rx_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -i -r >v17_v32bis_rx_fixed_rrc.h ./make_modem_filter$(EXEEXT) -m V.17 -r >v17_v32bis_rx_rrc.h
v17_v32bis_rx_floating_rrc.h: make_modem_filter$(EXEEXT) V17_V32BIS_TX_INCL = v17_v32bis_tx_rrc.h
./make_modem_filter$(EXEEXT) -m V.17 -r >v17_v32bis_rx_floating_rrc.h
V17_V32BIS_TX_INCL = v17_v32bis_tx_fixed_rrc.h \
v17_v32bis_tx_floating_rrc.h
v17tx.$(OBJEXT): ${V17_V32BIS_TX_INCL} v17tx.$(OBJEXT): ${V17_V32BIS_TX_INCL}
v17tx.lo: ${V17_V32BIS_TX_INCL} v17tx.lo: ${V17_V32BIS_TX_INCL}
v17_v32bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT) v17_v32bis_tx_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -i -t >v17_v32bis_tx_fixed_rrc.h ./make_modem_filter$(EXEEXT) -m V.17 -t >v17_v32bis_tx_rrc.h
v17_v32bis_tx_floating_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -t >v17_v32bis_tx_floating_rrc.h
V22BIS_RX_INCL = v22bis_rx_1200_fixed_rrc.h \ V22BIS_RX_INCL = v22bis_rx_1200_rrc.h \
v22bis_rx_2400_fixed_rrc.h \ v22bis_rx_2400_rrc.h
v22bis_rx_1200_floating_rrc.h \
v22bis_rx_2400_floating_rrc.h
v22bis_rx.$(OBJEXT): ${V22BIS_RX_INCL} v22bis_rx.$(OBJEXT): ${V22BIS_RX_INCL}
v22bis_rx.lo: ${V22BIS_RX_INCL} v22bis_rx.lo: ${V22BIS_RX_INCL}
v22bis_rx_1200_fixed_rrc.h: make_modem_filter$(EXEEXT) v22bis_rx_1200_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.22bis1200 -i -r >v22bis_rx_1200_fixed_rrc.h ./make_modem_filter$(EXEEXT) -m V.22bis1200 -r >v22bis_rx_1200_rrc.h
v22bis_rx_2400_fixed_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.22bis2400 -i -r >v22bis_rx_2400_fixed_rrc.h
v22bis_rx_1200_floating_rrc.h: make_modem_filter$(EXEEXT) v22bis_rx_2400_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.22bis1200 -r >v22bis_rx_1200_floating_rrc.h ./make_modem_filter$(EXEEXT) -m V.22bis2400 -r >v22bis_rx_2400_rrc.h
v22bis_rx_2400_floating_rrc.h: make_modem_filter$(EXEEXT) V22BIS_TX_INCL = v22bis_tx_rrc.h
./make_modem_filter$(EXEEXT) -m V.22bis2400 -r >v22bis_rx_2400_floating_rrc.h
V22BIS_TX_INCL = v22bis_tx_fixed_rrc.h \
v22bis_tx_floating_rrc.h
v22bis_tx.$(OBJEXT): ${V22BIS_TX_INCL} v22bis_tx.$(OBJEXT): ${V22BIS_TX_INCL}
v22bis_tx.lo: ${V22BIS_TX_INCL} v22bis_tx.lo: ${V22BIS_TX_INCL}
v22bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT) v22bis_tx_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.22bis -i -t >v22bis_tx_fixed_rrc.h ./make_modem_filter$(EXEEXT) -m V.22bis -t >v22bis_tx_rrc.h
v22bis_tx_floating_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.22bis -t >v22bis_tx_floating_rrc.h
V27_RX_INCL = v27ter_rx_2400_fixed_rrc.h \ V27_RX_INCL = v27ter_rx_2400_rrc.h \
v27ter_rx_4800_fixed_rrc.h \ v27ter_rx_4800_rrc.h
v27ter_rx_2400_floating_rrc.h \
v27ter_rx_4800_floating_rrc.h
v27ter_rx.$(OBJEXT): ${V27_RX_INCL} v27ter_rx.$(OBJEXT): ${V27_RX_INCL}
v27ter_rx.lo: ${V27_RX_INCL} v27ter_rx.lo: ${V27_RX_INCL}
v27ter_rx_2400_fixed_rrc.h: make_modem_filter$(EXEEXT) v27ter_rx_2400_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.27ter2400 -i -r >v27ter_rx_2400_fixed_rrc.h ./make_modem_filter$(EXEEXT) -m V.27ter2400 -r >v27ter_rx_2400_rrc.h
v27ter_rx_4800_fixed_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.27ter4800 -i -r >v27ter_rx_4800_fixed_rrc.h
v27ter_rx_2400_floating_rrc.h: make_modem_filter$(EXEEXT) v27ter_rx_4800_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.27ter2400 -r >v27ter_rx_2400_floating_rrc.h ./make_modem_filter$(EXEEXT) -m V.27ter4800 -r >v27ter_rx_4800_rrc.h
v27ter_rx_4800_floating_rrc.h: make_modem_filter$(EXEEXT) V27TER_TX_INCL = v27ter_tx_2400_rrc.h \
./make_modem_filter$(EXEEXT) -m V.27ter4800 -r >v27ter_rx_4800_floating_rrc.h v27ter_tx_4800_rrc.h
V27TER_TX_INCL = v27ter_tx_2400_fixed_rrc.h \
v27ter_tx_4800_fixed_rrc.h \
v27ter_tx_2400_floating_rrc.h \
v27ter_tx_4800_floating_rrc.h
v27ter_tx_.$(OBJEXT): ${V27TER_TX_INCL} v27ter_tx_.$(OBJEXT): ${V27TER_TX_INCL}
v27ter_tx.lo: ${V27TER_TX_INCL} v27ter_tx.lo: ${V27TER_TX_INCL}
v27ter_tx_2400_fixed_rrc.h: make_modem_filter$(EXEEXT) v27ter_tx_2400_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.27ter2400 -i -t >v27ter_tx_2400_fixed_rrc.h ./make_modem_filter$(EXEEXT) -m V.27ter2400 -t >v27ter_tx_2400_rrc.h
v27ter_tx_4800_fixed_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.27ter4800 -i -t >v27ter_tx_4800_fixed_rrc.h
v27ter_tx_2400_floating_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.27ter2400 -t >v27ter_tx_2400_floating_rrc.h
v27ter_tx_4800_floating_rrc.h: make_modem_filter$(EXEEXT) v27ter_tx_4800_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.27ter4800 -t >v27ter_tx_4800_floating_rrc.h ./make_modem_filter$(EXEEXT) -m V.27ter4800 -t >v27ter_tx_4800_rrc.h
V29_RX_INCL = v29rx_fixed_rrc.h \ V29_RX_INCL = v29rx_rrc.h
v29rx_floating_rrc.h
v29rx.$(OBJEXT): ${V29_RX_INCL} v29rx.$(OBJEXT): ${V29_RX_INCL}
v29rx.lo: ${V29_RX_INCL} v29rx.lo: ${V29_RX_INCL}
v29rx_fixed_rrc.h: make_modem_filter$(EXEEXT) v29rx_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.29 -i -r >v29rx_fixed_rrc.h ./make_modem_filter$(EXEEXT) -m V.29 -r >v29rx_rrc.h
v29rx_floating_rrc.h: make_modem_filter$(EXEEXT) V29_TX_INCL = v29tx_rrc.h
./make_modem_filter$(EXEEXT) -m V.29 -r >v29rx_floating_rrc.h
V29_TX_INCL = v29tx_fixed_rrc.h \
v29tx_floating_rrc.h
v29tx.$(OBJEXT): ${V29_TX_INCL} v29tx.$(OBJEXT): ${V29_TX_INCL}
v29tx.lo: ${V29_TX_INCL} v29tx.lo: ${V29_TX_INCL}
v29tx_fixed_rrc.h: make_modem_filter$(EXEEXT) v29tx_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.29 -i -t >v29tx_fixed_rrc.h ./make_modem_filter$(EXEEXT) -m V.29 -t >v29tx_rrc.h
v29tx_floating_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.29 -t >v29tx_floating_rrc.h
DSP = libspandsp.dsp DSP = libspandsp.dsp
VCPROJ8 = libspandsp.2005.vcproj VCPROJ8 = libspandsp.2005.vcproj
......
...@@ -212,42 +212,46 @@ SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data) ...@@ -212,42 +212,46 @@ SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data)
{ {
async_tx_state_t *s; async_tx_state_t *s;
int bit; int bit;
int parity_bit;
s = (async_tx_state_t *) user_data; s = (async_tx_state_t *) user_data;
if (s->bitpos == 0) if (s->bitpos == 0)
{ {
if (s->presend_bits > 0)
{
s->presend_bits--;
return 1;
}
if ((s->byte_in_progress = s->get_byte(s->user_data)) < 0) if ((s->byte_in_progress = s->get_byte(s->user_data)) < 0)
{ {
/* No more data */ if (s->byte_in_progress != SIG_STATUS_LINK_IDLE)
bit = SIG_STATUS_END_OF_DATA; return s->byte_in_progress;
/* Idle for a bit time. If the get byte call configured a presend
time we might idle for longer. */
return 1;
}
s->byte_in_progress &= (0xFFFF >> (16 - s->data_bits));
if (s->parity != ASYNC_PARITY_NONE)
{
parity_bit = parity8(s->byte_in_progress);
if (s->parity == ASYNC_PARITY_ODD)
parity_bit ^= 1;
s->byte_in_progress |= (parity_bit << s->data_bits);
s->byte_in_progress |= (0xFFFF << (s->data_bits + 1));
} }
else else
{ {
/* Start bit */ s->byte_in_progress |= (0xFFFF << s->data_bits);
bit = 0;
s->parity_bit = 0;
s->bitpos++;
} }
} /* Start bit */
else if (s->bitpos <= s->data_bits) bit = 0;
{
bit = s->byte_in_progress & 1;
s->byte_in_progress >>= 1;
s->parity_bit ^= bit;
s->bitpos++;
}
else if (s->parity && s->bitpos == s->data_bits + 1)
{
if (s->parity == ASYNC_PARITY_ODD)
s->parity_bit ^= 1;
bit = s->parity_bit;
s->bitpos++; s->bitpos++;
} }
else else
{ {
/* Stop bit(s) */ bit = s->byte_in_progress & 1;
bit = 1; s->byte_in_progress >>= 1;
if (++s->bitpos > s->data_bits + s->stop_bits) if (++s->bitpos > s->total_bits)
s->bitpos = 0; s->bitpos = 0;
} }
return bit; return bit;
...@@ -278,16 +282,15 @@ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s, ...@@ -278,16 +282,15 @@ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s,
flow control does not exist, so V.14 stuffing is not needed. */ flow control does not exist, so V.14 stuffing is not needed. */
s->data_bits = data_bits; s->data_bits = data_bits;
s->parity = parity; s->parity = parity;
s->stop_bits = stop_bits; s->total_bits = data_bits + stop_bits;
if (parity != ASYNC_PARITY_NONE) if (parity != ASYNC_PARITY_NONE)
s->stop_bits++; s->total_bits++;
s->get_byte = get_byte; s->get_byte = get_byte;
s->user_data = user_data; s->user_data = user_data;
s->byte_in_progress = 0; s->byte_in_progress = 0;
s->bitpos = 0; s->bitpos = 0;
s->parity_bit = 0;
s->presend_bits = 0; s->presend_bits = 0;
return s; return s;
} }
......
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File RelativePath="ademco_contactid.c"></File>
<File RelativePath="adsi.c"></File> <File RelativePath="adsi.c"></File>
<File RelativePath="async.c"></File> <File RelativePath="async.c"></File>
<File RelativePath="at_interpreter.c"></File> <File RelativePath="at_interpreter.c"></File>
...@@ -123,12 +124,14 @@ ...@@ -123,12 +124,14 @@
<File RelativePath="gsm0610_short_term.c"></File> <File RelativePath="gsm0610_short_term.c"></File>
<File RelativePath="hdlc.c"></File> <File RelativePath="hdlc.c"></File>
<File RelativePath="ima_adpcm.c"></File> <File RelativePath="ima_adpcm.c"></File>
<File RelativePath="image_translate.c"></File>
<File RelativePath="logging.c"></File> <File RelativePath="logging.c"></File>
<File RelativePath="lpc10_analyse.c"></File> <File RelativePath="lpc10_analyse.c"></File>
<File RelativePath="lpc10_decode.c"></File> <File RelativePath="lpc10_decode.c"></File>
<File RelativePath="lpc10_encode.c"></File> <File RelativePath="lpc10_encode.c"></File>
<File RelativePath="lpc10_placev.c"></File> <File RelativePath="lpc10_placev.c"></File>
<File RelativePath="lpc10_voicing.c"></File> <File RelativePath="lpc10_voicing.c"></File>
<File RelativePath="math_fixed.c"></File>
<File RelativePath="modem_echo.c"></File> <File RelativePath="modem_echo.c"></File>
<File RelativePath="modem_connect_tones.c"></File> <File RelativePath="modem_connect_tones.c"></File>
<File RelativePath="noise.c"></File> <File RelativePath="noise.c"></File>
...@@ -143,6 +146,8 @@ ...@@ -143,6 +146,8 @@
<File RelativePath="super_tone_rx.c"></File> <File RelativePath="super_tone_rx.c"></File>
<File RelativePath="super_tone_tx.c"></File> <File RelativePath="super_tone_tx.c"></File>
<File RelativePath="swept_tone.c"></File> <File RelativePath="swept_tone.c"></File>
<File RelativePath="t4_t6_decode.c"></File>
<File RelativePath="t4_t6_encode.c"></File>
<File RelativePath="t4_rx.c"></File> <File RelativePath="t4_rx.c"></File>
<File RelativePath="t4_tx.c"></File> <File RelativePath="t4_tx.c"></File>
<File RelativePath="t30.c"></File> <File RelativePath="t30.c"></File>
...@@ -154,8 +159,13 @@ ...@@ -154,8 +159,13 @@
<File RelativePath="t38_gateway.c"></File> <File RelativePath="t38_gateway.c"></File>
<File RelativePath="t38_non_ecm_buffer.c"></File> <File RelativePath="t38_non_ecm_buffer.c"></File>
<File RelativePath="t38_terminal.c"></File> <File RelativePath="t38_terminal.c"></File>
<File RelativePath="t42.c"></File>
<File RelativePath="t81_t82_arith_coding.c"></File>
<File RelativePath="t85_decode.c"></File>
<File RelativePath="t85_encode.c"></File>
<File RelativePath="testcpuid.c"></File> <File RelativePath="testcpuid.c"></File>
<File RelativePath="time_scale.c"></File> <File RelativePath="time_scale.c"></File>
<File RelativePath="timezone.c"></File>
<File RelativePath="tone_detect.c"></File> <File RelativePath="tone_detect.c"></File>
<File RelativePath="tone_generate.c"></File> <File RelativePath="tone_generate.c"></File>
<File RelativePath="v17rx.c"></File> <File RelativePath="v17rx.c"></File>
...@@ -174,6 +184,7 @@ ...@@ -174,6 +184,7 @@
<File RelativePath="vector_int.c"></File> <File RelativePath="vector_int.c"></File>
<File RelativePath=".\msvc\gettimeofday.c"></File> <File RelativePath=".\msvc\gettimeofday.c"></File>
</Filter><Filter Name="Header Files"> </Filter><Filter Name="Header Files">
<File RelativePath="spandsp/ademco_contactid.h"></File>
<File RelativePath="spandsp/adsi.h"></File> <File RelativePath="spandsp/adsi.h"></File>
<File RelativePath="spandsp/async.h"></File> <File RelativePath="spandsp/async.h"></File>
<File RelativePath="spandsp/arctan2.h"></File> <File RelativePath="spandsp/arctan2.h"></File>
...@@ -205,8 +216,10 @@ ...@@ -205,8 +216,10 @@
<File RelativePath="spandsp/gsm0610.h"></File> <File RelativePath="spandsp/gsm0610.h"></File>
<File RelativePath="spandsp/hdlc.h"></File> <File RelativePath="spandsp/hdlc.h"></File>
<File RelativePath="spandsp/ima_adpcm.h"></File> <File RelativePath="spandsp/ima_adpcm.h"></File>
<File RelativePath="spandsp/image_translate.h"></File>
<File RelativePath="spandsp/logging.h"></File> <File RelativePath="spandsp/logging.h"></File>
<File RelativePath="spandsp/lpc10.h"></File> <File RelativePath="spandsp/lpc10.h"></File>
<File RelativePath="spandsp/math_fixed.h"></File>
<File RelativePath="spandsp/modem_echo.h"></File> <File RelativePath="spandsp/modem_echo.h"></File>
<File RelativePath="spandsp/modem_connect_tones.h"></File> <File RelativePath="spandsp/modem_connect_tones.h"></File>
<File RelativePath="spandsp/noise.h"></File> <File RelativePath="spandsp/noise.h"></File>
...@@ -222,8 +235,6 @@ ...@@ -222,8 +235,6 @@
<File RelativePath="spandsp/super_tone_rx.h"></File> <File RelativePath="spandsp/super_tone_rx.h"></File>
<File RelativePath="spandsp/super_tone_tx.h"></File> <File RelativePath="spandsp/super_tone_tx.h"></File>
<File RelativePath="spandsp/swept_tone.h"></File> <File RelativePath="spandsp/swept_tone.h"></File>
<File RelativePath="spandsp/t4_rx.h"></File>
<File RelativePath="spandsp/t4_tx.h"></File>
<File RelativePath="spandsp/t30.h"></File> <File RelativePath="spandsp/t30.h"></File>
<File RelativePath="spandsp/t30_api.h"></File> <File RelativePath="spandsp/t30_api.h"></File>
<File RelativePath="spandsp/t30_fcf.h"></File> <File RelativePath="spandsp/t30_fcf.h"></File>
...@@ -234,8 +245,16 @@ ...@@ -234,8 +245,16 @@
<File RelativePath="spandsp/t38_gateway.h"></File> <File RelativePath="spandsp/t38_gateway.h"></File>
<File RelativePath="spandsp/t38_non_ecm_buffer.h"></File> <File RelativePath="spandsp/t38_non_ecm_buffer.h"></File>
<File RelativePath="spandsp/t38_terminal.h"></File> <File RelativePath="spandsp/t38_terminal.h"></File>
<File RelativePath="spandsp/t4_rx.h"></File>
<File RelativePath="spandsp/t4_tx.h"></File>
<File RelativePath="spandsp/t4_t6_decode.h"></File>
<File RelativePath="spandsp/t4_t6_encode.h"></File>
<File RelativePath="spandsp/t42.h"></File>
<File RelativePath="spandsp/t81_t82_arith_coding.h"></File>
<File RelativePath="spandsp/t85.h"></File>
<File RelativePath="spandsp/telephony.h"></File> <File RelativePath="spandsp/telephony.h"></File>
<File RelativePath="spandsp/time_scale.h"></File> <File RelativePath="spandsp/time_scale.h"></File>
<File RelativePath="spandsp/timezone.h"></File>
<File RelativePath="spandsp/timing.h"></File> <File RelativePath="spandsp/timing.h"></File>
<File RelativePath="spandsp/tone_detect.h"></File> <File RelativePath="spandsp/tone_detect.h"></File>
<File RelativePath="spandsp/tone_generate.h"></File> <File RelativePath="spandsp/tone_generate.h"></File>
...@@ -253,6 +272,7 @@ ...@@ -253,6 +272,7 @@
<File RelativePath="spandsp/vector_float.h"></File> <File RelativePath="spandsp/vector_float.h"></File>
<File RelativePath="spandsp/vector_int.h"></File> <File RelativePath="spandsp/vector_int.h"></File>
<File RelativePath="spandsp/version.h"></File> <File RelativePath="spandsp/version.h"></File>
<File RelativePath="spandsp/private/ademco_contactid.h"></File>
<File RelativePath="spandsp/private/adsi.h"></File> <File RelativePath="spandsp/private/adsi.h"></File>
<File RelativePath="spandsp/private/async.h"></File> <File RelativePath="spandsp/private/async.h"></File>
<File RelativePath="spandsp/private/at_interpreter.h"></File> <File RelativePath="spandsp/private/at_interpreter.h"></File>
...@@ -271,6 +291,7 @@ ...@@ -271,6 +291,7 @@
<File RelativePath="spandsp/private/gsm0610.h"></File> <File RelativePath="spandsp/private/gsm0610.h"></File>
<File RelativePath="spandsp/private/hdlc.h"></File> <File RelativePath="spandsp/private/hdlc.h"></File>
<File RelativePath="spandsp/private/ima_adpcm.h"></File> <File RelativePath="spandsp/private/ima_adpcm.h"></File>
<File RelativePath="spandsp/private/image_translate.h"></File>
<File RelativePath="spandsp/private/logging.h"></File> <File RelativePath="spandsp/private/logging.h"></File>
<File RelativePath="spandsp/private/lpc10.h"></File> <File RelativePath="spandsp/private/lpc10.h"></File>
<File RelativePath="spandsp/private/modem_connect_tones.h"></File> <File RelativePath="spandsp/private/modem_connect_tones.h"></File>
...@@ -293,7 +314,13 @@ ...@@ -293,7 +314,13 @@
<File RelativePath="spandsp/private/t38_terminal.h"></File> <File RelativePath="spandsp/private/t38_terminal.h"></File>
<File RelativePath="spandsp/private/t4_rx.h"></File> <File RelativePath="spandsp/private/t4_rx.h"></File>
<File RelativePath="spandsp/private/t4_tx.h"></File> <File RelativePath="spandsp/private/t4_tx.h"></File>
<File RelativePath="spandsp/private/t4_t6_decode.h"></File>
<File RelativePath="spandsp/private/t4_t6_encode.h"></File>
<File RelativePath="spandsp/private/t42.h"></File>
<File RelativePath="spandsp/private/t81_t82_arith_coding.h"></File>
<File RelativePath="spandsp/private/t85.h"></File>
<File RelativePath="spandsp/private/time_scale.h"></File> <File RelativePath="spandsp/private/time_scale.h"></File>
<File RelativePath="spandsp/private/timezone.h"></File>
<File RelativePath="spandsp/private/tone_detect.h"></File> <File RelativePath="spandsp/private/tone_detect.h"></File>
<File RelativePath="spandsp/private/tone_generate.h"></File> <File RelativePath="spandsp/private/tone_generate.h"></File>
<File RelativePath="spandsp/private/v17rx.h"></File> <File RelativePath="spandsp/private/v17rx.h"></File>
......
...@@ -342,6 +342,10 @@ ...@@ -342,6 +342,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File
RelativePath="ademco_contactid.c"
>
</File>
<File <File
RelativePath="adsi.c" RelativePath="adsi.c"
> >
...@@ -702,16 +706,13 @@ ...@@ -702,16 +706,13 @@
<Filter <Filter
Name="Header Files" Name="Header Files"
> >
<File
RelativePath=".\spandsp\private\image_translate.h"
>
</File> </File>
<File <File
RelativePath=".\spandsp\image_translate.h" RelativePath="spandsp.h"
> >
</File> </File>
<File <File
RelativePath="spandsp.h" RelativePath="spandsp/ademco_contactid.h"
> >
</File> </File>
<File <File
...@@ -842,6 +843,10 @@ ...@@ -842,6 +843,10 @@
RelativePath="spandsp/ima_adpcm.h" RelativePath="spandsp/ima_adpcm.h"
> >
</File> </File>
<File
RelativePath="spandsp/image_translate.h"
>
</File>
<File <File
RelativePath="spandsp/logging.h" RelativePath="spandsp/logging.h"
> >
...@@ -878,6 +883,10 @@ ...@@ -878,6 +883,10 @@
RelativePath="spandsp/power_meter.h" RelativePath="spandsp/power_meter.h"
> >
</File> </File>
<File
RelativePath="spandsp/private/ademco_contactid.h"
>
</File>
<File <File
RelativePath="spandsp/private/adsi.h" RelativePath="spandsp/private/adsi.h"
> >
...@@ -950,6 +959,10 @@ ...@@ -950,6 +959,10 @@
RelativePath="spandsp/private/ima_adpcm.h" RelativePath="spandsp/private/ima_adpcm.h"
> >
</File> </File>
<File
RelativePath="spandsp/private/image_translate.h"
>
</File>
<File <File
RelativePath="spandsp/private/logging.h" RelativePath="spandsp/private/logging.h"
> >
......
...@@ -39,6 +39,8 @@ struct async_tx_state_s ...@@ -39,6 +39,8 @@ struct async_tx_state_s
int parity; int parity;
/*! \brief The number of stop bits per character. */ /*! \brief The number of stop bits per character. */
int stop_bits; int stop_bits;
/*! \brief Total number of bits per character, including the parity and stop bits. */
int total_bits;
/*! \brief A pointer to the callback routine used to get characters to be transmitted. */ /*! \brief A pointer to the callback routine used to get characters to be transmitted. */
get_byte_func_t get_byte; get_byte_func_t get_byte;
/*! \brief An opaque pointer passed when calling get_byte. */ /*! \brief An opaque pointer passed when calling get_byte. */
......
...@@ -1538,7 +1538,7 @@ static int build_dcs(t30_state_t *s) ...@@ -1538,7 +1538,7 @@ static int build_dcs(t30_state_t *s)
|| ||
((s->image_width == T4_WIDTH_1200_A4) && (s->x_resolution == T4_X_RESOLUTION_1200))) ((s->image_width == T4_WIDTH_1200_A4) && (s->x_resolution == T4_X_RESOLUTION_1200)))
{ {
span_log(&s->logging, SPAN_LOG_FLOW, "Image width is A4 0x%x 0x%x\n", s->image_width, s->x_resolution); span_log(&s->logging, SPAN_LOG_FLOW, "Image width is A4\n");
/* No width related bits need to be set. */ /* No width related bits need to be set. */
} }
else if (((s->image_width == T4_WIDTH_R8_B4) && (s->x_resolution == T4_X_RESOLUTION_R8)) else if (((s->image_width == T4_WIDTH_R8_B4) && (s->x_resolution == T4_X_RESOLUTION_R8))
......
...@@ -653,6 +653,8 @@ SPAN_DECLARE(int) t30_set_rx_encoding(t30_state_t *s, int encoding) ...@@ -653,6 +653,8 @@ SPAN_DECLARE(int) t30_set_rx_encoding(t30_state_t *s, int encoding)
case T4_COMPRESSION_ITU_T4_1D: case T4_COMPRESSION_ITU_T4_1D:
case T4_COMPRESSION_ITU_T4_2D: case T4_COMPRESSION_ITU_T4_2D:
case T4_COMPRESSION_ITU_T6: case T4_COMPRESSION_ITU_T6:
//case T4_COMPRESSION_ITU_T85:
//case T4_COMPRESSION_ITU_T85_L0:
s->output_encoding = encoding; s->output_encoding = encoding;
return 0; return 0;
} }
......
...@@ -146,9 +146,16 @@ static int set_tiff_directory_info(t4_rx_state_t *s) ...@@ -146,9 +146,16 @@ static int set_tiff_directory_info(t4_rx_state_t *s)
t4_rx_tiff_state_t *t; t4_rx_tiff_state_t *t;
int32_t output_compression; int32_t output_compression;
int32_t output_t4_options; int32_t output_t4_options;
int bits_per_sample;
int samples_per_pixel;
int photometric;
int image_length;
t = &s->tiff; t = &s->tiff;
/* Prepare the directory entry fully before writing the image, or libtiff complains */ /* Prepare the directory entry fully before writing the image, or libtiff complains */
bits_per_sample = 1;
samples_per_pixel = 1;
photometric = PHOTOMETRIC_MINISWHITE;
switch (t->output_encoding) switch (t->output_encoding)
{ {
case T4_COMPRESSION_ITU_T4_1D: case T4_COMPRESSION_ITU_T4_1D:
...@@ -163,7 +170,24 @@ static int set_tiff_directory_info(t4_rx_state_t *s) ...@@ -163,7 +170,24 @@ static int set_tiff_directory_info(t4_rx_state_t *s)
case T4_COMPRESSION_ITU_T6: case T4_COMPRESSION_ITU_T6:
output_compression = COMPRESSION_CCITT_T6; output_compression = COMPRESSION_CCITT_T6;
break; break;
#if defined(SPANDSP_SUPPORT_T42)
case T4_COMPRESSION_ITU_T42:
output_compression = COMPRESSION_JPEG;
bits_per_sample = 8;
samples_per_pixel = 3;
photometric = PHOTOMETRIC_ITULAB;
break;
#endif
#if defined(SPANDSP_SUPPORT_T43)
case T4_COMPRESSION_ITU_T43:
output_compression = COMPRESSION_T43;
bits_per_sample = 8;
samples_per_pixel = 3;
photometric = PHOTOMETRIC_ITULAB;
break;
#endif
case T4_COMPRESSION_ITU_T85: case T4_COMPRESSION_ITU_T85:
case T4_COMPRESSION_ITU_T85_L0:
output_compression = COMPRESSION_T85; output_compression = COMPRESSION_T85;
break; break;
} }
...@@ -179,28 +203,23 @@ static int set_tiff_directory_info(t4_rx_state_t *s) ...@@ -179,28 +203,23 @@ static int set_tiff_directory_info(t4_rx_state_t *s)
TIFFSetField(t->tiff_file, TIFFTAG_T6OPTIONS, 0); TIFFSetField(t->tiff_file, TIFFTAG_T6OPTIONS, 0);
TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
break; break;
case COMPRESSION_T85: case COMPRESSION_JPEG:
TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
TIFFSetField(t->tiff_file, TIFFTAG_ROWSPERSTRIP, -1L);
break; break;
default: #if defined(SPANDSP_SUPPORT_T43)
TIFFSetField(t->tiff_file, case COMPRESSION_T43:
TIFFTAG_ROWSPERSTRIP, TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
TIFFDefaultStripSize(t->tiff_file, 0));
break; break;
}
#if defined(SPANDSP_SUPPORT_TIFF_FX)
TIFFSetField(t->tiff_file, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX);
TIFFSetField(t->tiff_file, TIFFTAG_FAXPROFILE, FAXPROFILE_F);
TIFFSetField(t->tiff_file, TIFFTAG_CODINGMETHODS, CODINGMETHODS_T4_1D | CODINGMETHODS_T4_2D | CODINGMETHODS_T6);
TIFFSetField(t->tiff_file, TIFFTAG_VERSIONYEAR, "1998");
/* TIFFSetField(t->tiff_file, TIFFTAG_MODENUMBER, 0); */
#endif #endif
TIFFSetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, 1); case COMPRESSION_T85:
TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
break;
}
TIFFSetField(t->tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); TIFFSetField(t->tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1); TIFFSetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, bits_per_sample);
TIFFSetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, samples_per_pixel);
TIFFSetField(t->tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); TIFFSetField(t->tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); TIFFSetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, photometric);
TIFFSetField(t->tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB); TIFFSetField(t->tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
/* TIFFTAG_STRIPBYTECOUNTS and TIFFTAG_STRIPOFFSETS are added automatically */ /* TIFFTAG_STRIPBYTECOUNTS and TIFFTAG_STRIPOFFSETS are added automatically */
...@@ -257,6 +276,7 @@ static int set_tiff_directory_info(t4_rx_state_t *s) ...@@ -257,6 +276,7 @@ static int set_tiff_directory_info(t4_rx_state_t *s)
/* TIFF page numbers start from zero, so the number of pages in the file /* TIFF page numbers start from zero, so the number of pages in the file
is always one greater than the highest page number in the file. */ is always one greater than the highest page number in the file. */
s->tiff.pages_in_file = s->current_page + 1; s->tiff.pages_in_file = s->current_page + 1;
image_length = 0;
switch (s->line_encoding) switch (s->line_encoding)
{ {
case T4_COMPRESSION_ITU_T4_1D: case T4_COMPRESSION_ITU_T4_1D:
...@@ -277,22 +297,28 @@ static int set_tiff_directory_info(t4_rx_state_t *s) ...@@ -277,22 +297,28 @@ static int set_tiff_directory_info(t4_rx_state_t *s)
} }
/* Fall through */ /* Fall through */
case T4_COMPRESSION_ITU_T6: case T4_COMPRESSION_ITU_T6:
TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, t4_t6_decode_get_image_length(&s->decoder.t4_t6)); image_length = t4_t6_decode_get_image_length(&s->decoder.t4_t6);
break; break;
case T4_COMPRESSION_ITU_T42: case T4_COMPRESSION_ITU_T42:
TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, t42_decode_get_image_length(&s->decoder.t42)); image_length = t42_decode_get_image_length(&s->decoder.t42);
break; break;
#if defined(SPANDSP_SUPPORT_T43) #if defined(SPANDSP_SUPPORT_T43)
case T4_COMPRESSION_ITU_T43: case T4_COMPRESSION_ITU_T43:
TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, t43_decode_get_image_length(&s->decoder.t43)); image_length = t43_decode_get_image_length(&s->decoder.t43);
break; break;
#endif #endif
case T4_COMPRESSION_ITU_T85: case T4_COMPRESSION_ITU_T85:
case T4_COMPRESSION_ITU_T85_L0: case T4_COMPRESSION_ITU_T85_L0:
TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, t85_decode_get_image_length(&s->decoder.t85)); image_length = t85_decode_get_image_length(&s->decoder.t85);
break; break;
} }
TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, image_length);
TIFFSetField(t->tiff_file, TIFFTAG_ROWSPERSTRIP, image_length);
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX)
TIFFSetField(t->tiff_file, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX);
TIFFSetField(t->tiff_file, TIFFTAG_FAXPROFILE, FAXPROFILE_S);
TIFFSetField(t->tiff_file, TIFFTAG_CODINGMETHODS, CODINGMETHODS_T4_1D | CODINGMETHODS_T4_2D | CODINGMETHODS_T6);
TIFFSetField(t->tiff_file, TIFFTAG_VERSIONYEAR, "1998");
if (s->current_page == 0) if (s->current_page == 0)
{ {
/* Create a placeholder for the global parameters IFD, to be filled in later */ /* Create a placeholder for the global parameters IFD, to be filled in later */
......
...@@ -69,11 +69,14 @@ ...@@ -69,11 +69,14 @@
#define FP_SCALE(x) FP_Q_6_10(x) #define FP_SCALE(x) FP_Q_6_10(x)
#define FP_FACTOR 1024 #define FP_FACTOR 1024
#define FP_SHIFT_FACTOR 12 #define FP_SHIFT_FACTOR 12
#include "v17_v32bis_rx_fixed_rrc.h"
#else #else
#define FP_SCALE(x) (x) #define FP_SCALE(x) (x)
#include "v17_v32bis_rx_floating_rrc.h"
#endif #endif
#include "v17_v32bis_rx_rrc.h"
#define FP_CONSTELLATION_SCALE(x) FP_SCALE(x)
#include "v17_v32bis_tx_constellation_maps.h" #include "v17_v32bis_tx_constellation_maps.h"
#include "v17_v32bis_rx_constellation_maps.h" #include "v17_v32bis_rx_constellation_maps.h"
......
...@@ -63,44 +63,42 @@ ...@@ -63,44 +63,42 @@
#include "spandsp/private/v17tx.h" #include "spandsp/private/v17tx.h"
#if defined(SPANDSP_USE_FIXED_POINT) #if defined(SPANDSP_USE_FIXED_POINT)
#define FP_SCALE(x) ((int16_t) x) #define FP_SCALE(x) ((int16_t) x)
#else #else
#define FP_SCALE(x) (x) #define FP_SCALE(x) (x)
#endif #endif
#define FP_CONSTELLATION_SCALE(x) FP_SCALE(x)
#include "v17_v32bis_tx_constellation_maps.h" #include "v17_v32bis_tx_constellation_maps.h"
#if defined(SPANDSP_USE_FIXED_POINT) #include "v17_v32bis_tx_rrc.h"
#include "v17_v32bis_tx_fixed_rrc.h"
#else
#include "v17_v32bis_tx_floating_rrc.h"
#endif
/*! The nominal frequency of the carrier, in Hertz */ /*! The nominal frequency of the carrier, in Hertz */
#define CARRIER_NOMINAL_FREQ 1800.0f #define CARRIER_NOMINAL_FREQ 1800.0f
/* Segments of the training sequence */ /* Segments of the training sequence */
/*! The start of the optional TEP, that may preceed the actual training, in symbols */ /*! The start of the optional TEP, that may preceed the actual training, in symbols */
#define V17_TRAINING_SEG_TEP_A 0 #define V17_TRAINING_SEG_TEP_A 0
/*! The mid point of the optional TEP, that may preceed the actual training, in symbols */ /*! The mid point of the optional TEP, that may preceed the actual training, in symbols */
#define V17_TRAINING_SEG_TEP_B (V17_TRAINING_SEG_TEP_A + 480) #define V17_TRAINING_SEG_TEP_B (V17_TRAINING_SEG_TEP_A + 480)
/*! The start of training segment 1, in symbols */ /*! The start of training segment 1, in symbols */
#define V17_TRAINING_SEG_1 (V17_TRAINING_SEG_TEP_B + 48) #define V17_TRAINING_SEG_1 (V17_TRAINING_SEG_TEP_B + 48)
/*! The start of training segment 2, in symbols */ /*! The start of training segment 2, in symbols */
#define V17_TRAINING_SEG_2 (V17_TRAINING_SEG_1 + 256) #define V17_TRAINING_SEG_2 (V17_TRAINING_SEG_1 + 256)
/*! The start of training segment 3, in symbols */ /*! The start of training segment 3, in symbols */
#define V17_TRAINING_SEG_3 (V17_TRAINING_SEG_2 + 2976) #define V17_TRAINING_SEG_3 (V17_TRAINING_SEG_2 + 2976)
/*! The start of training segment 4, in symbols */ /*! The start of training segment 4, in symbols */
#define V17_TRAINING_SEG_4 (V17_TRAINING_SEG_3 + 64) #define V17_TRAINING_SEG_4 (V17_TRAINING_SEG_3 + 64)
/*! The start of training segment 4 in short training mode, in symbols */ /*! The start of training segment 4 in short training mode, in symbols */
#define V17_TRAINING_SHORT_SEG_4 (V17_TRAINING_SEG_2 + 38) #define V17_TRAINING_SHORT_SEG_4 (V17_TRAINING_SEG_2 + 38)
/*! The end of the training, in symbols */ /*! The end of the training, in symbols */
#define V17_TRAINING_END (V17_TRAINING_SEG_4 + 48) #define V17_TRAINING_END (V17_TRAINING_SEG_4 + 48)
#define V17_TRAINING_SHUTDOWN_A (V17_TRAINING_END + 32) #define V17_TRAINING_SHUTDOWN_A (V17_TRAINING_END + 32)
/*! The end of the shutdown sequence, in symbols */ /*! The end of the shutdown sequence, in symbols */
#define V17_TRAINING_SHUTDOWN_END (V17_TRAINING_SHUTDOWN_A + 48) #define V17_TRAINING_SHUTDOWN_END (V17_TRAINING_SHUTDOWN_A + 48)
/*! The 16 bit pattern used in the bridge section of the training sequence */ /*! The 16 bit pattern used in the bridge section of the training sequence */
#define V17_BRIDGE_WORD 0x8880 #define V17_BRIDGE_WORD 0x8880
static __inline__ int scramble(v17_tx_state_t *s, int in_bit) static __inline__ int scramble(v17_tx_state_t *s, int in_bit)
{ {
......
...@@ -75,14 +75,13 @@ ...@@ -75,14 +75,13 @@
#if defined(SPANDSP_USE_FIXED_POINT) #if defined(SPANDSP_USE_FIXED_POINT)
#define FP_SHIFT_FACTOR 10 #define FP_SHIFT_FACTOR 10
#define FP_SCALE FP_Q_6_10 #define FP_SCALE FP_Q_6_10
#include "v22bis_rx_1200_fixed_rrc.h"
#include "v22bis_rx_2400_fixed_rrc.h"
#else #else
#define FP_SCALE(x) (x) #define FP_SCALE(x) (x)
#include "v22bis_rx_1200_floating_rrc.h"
#include "v22bis_rx_2400_floating_rrc.h"
#endif #endif
#include "v22bis_rx_1200_rrc.h"
#include "v22bis_rx_2400_rrc.h"
#define ms_to_symbols(t) (((t)*600)/1000) #define ms_to_symbols(t) (((t)*600)/1000)
/*! The adaption rate coefficient for the equalizer */ /*! The adaption rate coefficient for the equalizer */
......
...@@ -64,12 +64,12 @@ ...@@ -64,12 +64,12 @@
#if defined(SPANDSP_USE_FIXED_POINT) #if defined(SPANDSP_USE_FIXED_POINT)
#define FP_SCALE FP_Q_6_10 #define FP_SCALE FP_Q_6_10
#include "v22bis_tx_fixed_rrc.h"
#else #else
#define FP_SCALE(x) (x) #define FP_SCALE(x) (x)
#include "v22bis_tx_floating_rrc.h"
#endif #endif
#include "v22bis_tx_rrc.h"
/* Quoting from the V.22bis spec. /* Quoting from the V.22bis spec.
6.3.1.1 Interworking at 2400 bit/s 6.3.1.1 Interworking at 2400 bit/s
......
...@@ -68,14 +68,13 @@ ...@@ -68,14 +68,13 @@
#define FP_SCALE FP_Q_6_10 #define FP_SCALE FP_Q_6_10
#define FP_FACTOR 4096 #define FP_FACTOR 4096
#define FP_SHIFT_FACTOR 12 #define FP_SHIFT_FACTOR 12
#include "v27ter_rx_4800_fixed_rrc.h"
#include "v27ter_rx_2400_fixed_rrc.h"
#else #else
#define FP_SCALE(x) (x) #define FP_SCALE(x) (x)
#include "v27ter_rx_4800_floating_rrc.h"
#include "v27ter_rx_2400_floating_rrc.h"
#endif #endif
#include "v27ter_rx_4800_rrc.h"
#include "v27ter_rx_2400_rrc.h"
/* V.27ter is a DPSK modem, but this code treats it like QAM. It nails down the /* V.27ter is a DPSK modem, but this code treats it like QAM. It nails down the
signal to a static constellation, even though dealing with differences is all signal to a static constellation, even though dealing with differences is all
that is necessary. */ that is necessary. */
...@@ -272,6 +271,34 @@ static void tune_equalizer(v27ter_rx_state_t *s, const complexf_t *z, const comp ...@@ -272,6 +271,34 @@ static void tune_equalizer(v27ter_rx_state_t *s, const complexf_t *z, const comp
#endif #endif
/*- End of function --------------------------------------------------------*/ /*- End of function --------------------------------------------------------*/
#if defined(SPANDSP_USE_FIXED_POINT)
static __inline__ void track_carrier(v27ter_rx_state_t *s, const complexi16_t *z, const complexi16_t *target)
#else
static __inline__ void track_carrier(v27ter_rx_state_t *s, const complexf_t *z, const complexf_t *target)
#endif
{
#if defined(SPANDSP_USE_FIXED_POINT)
int32_t error;
#else
float error;
#endif
/* For small errors the imaginary part of the difference between the actual and the target
positions is proportional to the phase error, for any particular target. However, the
different amplitudes of the various target positions scale things. */
#if defined(SPANDSP_USE_FIXED_POINT)
error = ((int32_t) z->im*target->re - (int32_t) z->re*target->im) >> 10;
s->carrier_phase_rate += ((s->carrier_track_i*error) >> FP_SHIFT_FACTOR);
s->carrier_phase += ((s->carrier_track_p*error) >> FP_SHIFT_FACTOR);
#else
error = z->im*target->re - z->re*target->im;
s->carrier_phase_rate += (int32_t) (s->carrier_track_i*error);
s->carrier_phase += (int32_t) (s->carrier_track_p*error);
//span_log(&s->logging, SPAN_LOG_FLOW, "Im = %15.5f f = %15.5f\n", error, dds_frequencyf(s->carrier_phase_rate));
#endif
}
/*- End of function --------------------------------------------------------*/
#if defined(SPANDSP_USE_FIXED_POINT) #if defined(SPANDSP_USE_FIXED_POINT)
static __inline__ int find_quadrant(const complexi16_t *z) static __inline__ int find_quadrant(const complexi16_t *z)
#else #else
...@@ -337,38 +364,11 @@ static __inline__ int find_octant(complexf_t *z) ...@@ -337,38 +364,11 @@ static __inline__ int find_octant(complexf_t *z)
} }
/*- End of function --------------------------------------------------------*/ /*- End of function --------------------------------------------------------*/
#if defined(SPANDSP_USE_FIXED_POINT)
static __inline__ void track_carrier(v27ter_rx_state_t *s, const complexi16_t *z, const complexi16_t *target)
#else
static __inline__ void track_carrier(v27ter_rx_state_t *s, const complexf_t *z, const complexf_t *target)
#endif
{
#if defined(SPANDSP_USE_FIXED_POINT)
int32_t error;
#else
float error;
#endif
/* For small errors the imaginary part of the difference between the actual and the target
positions is proportional to the phase error, for any particular target. However, the
different amplitudes of the various target positions scale things. */
#if defined(SPANDSP_USE_FIXED_POINT)
error = ((int32_t) z->im*target->re - (int32_t) z->re*target->im) >> 10;
s->carrier_phase_rate += ((s->carrier_track_i*error) >> FP_SHIFT_FACTOR);
s->carrier_phase += ((s->carrier_track_p*error) >> FP_SHIFT_FACTOR);
#else
error = z->im*target->re - z->re*target->im;
s->carrier_phase_rate += (int32_t) (s->carrier_track_i*error);
s->carrier_phase += (int32_t) (s->carrier_track_p*error);
//span_log(&s->logging, SPAN_LOG_FLOW, "Im = %15.5f f = %15.5f\n", error, dds_frequencyf(s->carrier_phase_rate));
#endif
}
/*- End of function --------------------------------------------------------*/
static __inline__ int descramble(v27ter_rx_state_t *s, int in_bit) static __inline__ int descramble(v27ter_rx_state_t *s, int in_bit)
{ {
int out_bit; int out_bit;
in_bit &= 1;
out_bit = (in_bit ^ (s->scramble_reg >> 5) ^ (s->scramble_reg >> 6)) & 1; out_bit = (in_bit ^ (s->scramble_reg >> 5) ^ (s->scramble_reg >> 6)) & 1;
if (s->scrambler_pattern_count >= 33) if (s->scrambler_pattern_count >= 33)
{ {
......
...@@ -60,14 +60,13 @@ ...@@ -60,14 +60,13 @@
#if defined(SPANDSP_USE_FIXED_POINT) #if defined(SPANDSP_USE_FIXED_POINT)
#define FP_SCALE FP_Q_6_10 #define FP_SCALE FP_Q_6_10
#include "v27ter_tx_4800_fixed_rrc.h"
#include "v27ter_tx_2400_fixed_rrc.h"
#else #else
#define FP_SCALE(x) (x) #define FP_SCALE(x) (x)
#include "v27ter_tx_4800_floating_rrc.h"
#include "v27ter_tx_2400_floating_rrc.h"
#endif #endif
#include "v27ter_tx_4800_rrc.h"
#include "v27ter_tx_2400_rrc.h"
/*! The nominal frequency of the carrier, in Hertz */ /*! The nominal frequency of the carrier, in Hertz */
#define CARRIER_NOMINAL_FREQ 1800.0f #define CARRIER_NOMINAL_FREQ 1800.0f
......
...@@ -67,14 +67,16 @@ ...@@ -67,14 +67,16 @@
#define FP_SCALE FP_Q_4_12 #define FP_SCALE FP_Q_4_12
#define FP_FACTOR 4096 #define FP_FACTOR 4096
#define FP_SHIFT_FACTOR 12 #define FP_SHIFT_FACTOR 12
#include "v29tx_constellation_maps.h"
#include "v29rx_fixed_rrc.h"
#else #else
#define FP_SCALE(x) (x) #define FP_SCALE(x) (x)
#include "v29tx_constellation_maps.h"
#include "v29rx_floating_rrc.h"
#endif #endif
#include "v29rx_rrc.h"
#define FP_CONSTELLATION_SCALE(x) FP_SCALE(x)
#include "v29tx_constellation_maps.h"
/*! The nominal frequency of the carrier, in Hertz */ /*! The nominal frequency of the carrier, in Hertz */
#define CARRIER_NOMINAL_FREQ 1700.0f #define CARRIER_NOMINAL_FREQ 1700.0f
/*! The nominal baud or symbol rate */ /*! The nominal baud or symbol rate */
...@@ -104,6 +106,7 @@ enum ...@@ -104,6 +106,7 @@ enum
static const uint8_t space_map_9600[20][20] = static const uint8_t space_map_9600[20][20] =
{ {
/* Middle V Middle */
{13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11}, {13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11},
{13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11}, {13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11},
{13, 13, 13, 13, 13, 13, 13, 4, 4, 4, 4, 4, 4, 11, 11, 11, 11, 11, 11, 11}, {13, 13, 13, 13, 13, 13, 13, 4, 4, 4, 4, 4, 4, 11, 11, 11, 11, 11, 11, 11},
...@@ -113,8 +116,8 @@ static const uint8_t space_map_9600[20][20] = ...@@ -113,8 +116,8 @@ static const uint8_t space_map_9600[20][20] =
{14, 13, 13, 13, 13, 13, 5, 5, 5, 5, 3, 3, 3, 3, 11, 11, 11, 11, 11, 10}, {14, 13, 13, 13, 13, 13, 5, 5, 5, 5, 3, 3, 3, 3, 11, 11, 11, 11, 11, 10},
{14, 14, 6, 6, 6, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 2, 2, 2, 10, 10}, {14, 14, 6, 6, 6, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 2, 2, 2, 10, 10},
{14, 14, 6, 6, 6, 6, 5, 5, 5, 5, 3, 3, 3, 3, 2, 2, 2, 2, 10, 10}, {14, 14, 6, 6, 6, 6, 5, 5, 5, 5, 3, 3, 3, 3, 2, 2, 2, 2, 10, 10},
{14, 14, 6, 6, 6, 6, 5, 5, 5, 5, 3, 3, 3, 3, 2, 2, 2, 2, 10, 10}, {14, 14, 6, 6, 6, 6, 5, 5, 5, 5, 3, 3, 3, 3, 2, 2, 2, 2, 10, 10}, /* << Middle */
{14, 14, 6, 6, 6, 6, 7, 7, 7, 7, 1, 1, 1, 1, 2, 2, 2, 2, 10, 10}, {14, 14, 6, 6, 6, 6, 7, 7, 7, 7, 1, 1, 1, 1, 2, 2, 2, 2, 10, 10}, /* << Middle */
{14, 14, 6, 6, 6, 6, 7, 7, 7, 7, 1, 1, 1, 1, 2, 2, 2, 2, 10, 10}, {14, 14, 6, 6, 6, 6, 7, 7, 7, 7, 1, 1, 1, 1, 2, 2, 2, 2, 10, 10},
{14, 14, 6, 6, 6, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 2, 2, 2, 10, 10}, {14, 14, 6, 6, 6, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 2, 2, 2, 10, 10},
{14, 15, 15, 15, 15, 15, 7, 7, 7, 7, 1, 1, 1, 1, 9, 9, 9, 9, 9, 10}, {14, 15, 15, 15, 15, 15, 7, 7, 7, 7, 1, 1, 1, 1, 9, 9, 9, 9, 9, 10},
...@@ -124,6 +127,7 @@ static const uint8_t space_map_9600[20][20] = ...@@ -124,6 +127,7 @@ static const uint8_t space_map_9600[20][20] =
{15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9}, {15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9},
{15, 15, 15, 15, 15, 15, 15, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9}, {15, 15, 15, 15, 15, 15, 15, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9},
{15, 15, 15, 15, 15, 15, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9} {15, 15, 15, 15, 15, 15, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9}
/* Middle ^ Middle */
}; };
/* Coefficients for the band edge symbol timing synchroniser (alpha = 0.99) */ /* Coefficients for the band edge symbol timing synchroniser (alpha = 0.99) */
......
...@@ -58,13 +58,18 @@ ...@@ -58,13 +58,18 @@
#include "spandsp/private/logging.h" #include "spandsp/private/logging.h"
#include "spandsp/private/v29tx.h" #include "spandsp/private/v29tx.h"
#include "v29tx_constellation_maps.h"
#if defined(SPANDSP_USE_FIXED_POINT) #if defined(SPANDSP_USE_FIXED_POINT)
#include "v29tx_fixed_rrc.h" #define FP_SCALE(x) ((int16_t) x)
#else #else
#include "v29tx_floating_rrc.h" #define FP_SCALE(x) (x)
#endif #endif
#define FP_CONSTELLATION_SCALE(x) FP_SCALE(x)
#include "v29tx_constellation_maps.h"
#include "v29tx_rrc.h"
/*! The nominal frequency of the carrier, in Hertz */ /*! The nominal frequency of the carrier, in Hertz */
#define CARRIER_NOMINAL_FREQ 1700.0f #define CARRIER_NOMINAL_FREQ 1700.0f
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Written by Steve Underwood <steveu@coppice.org> * Written by Steve Underwood <steveu@coppice.org>
* *
* Copyright (C) 2008 Steve Underwood * Copyright (C) 2008, 2012 Steve Underwood
* *
* All rights reserved. * All rights reserved.
* *
...@@ -24,26 +24,18 @@ ...@@ -24,26 +24,18 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#if !defined(FP_SCALE)
#if defined(SPANDSP_USE_FIXED_POINT)
#define FP_SCALE(x) ((int16_t) x)
#else
#define FP_SCALE(x) (x)
#endif
#endif
#if defined(SPANDSP_USE_FIXED_POINT) #if defined(SPANDSP_USE_FIXED_POINT)
static const complexi16_t v29_abab_constellation[6] = static const complexi16_t v29_abab_constellation[6] =
#else #else
static const complexf_t v29_abab_constellation[6] = static const complexf_t v29_abab_constellation[6] =
#endif #endif
{ {
{FP_SCALE( 3.0f), FP_SCALE(-3.0f)}, /* 315deg high 9600 */ {FP_CONSTELLATION_SCALE( 3.0f), FP_CONSTELLATION_SCALE(-3.0f)}, /* 315deg high 9600 */
{FP_SCALE(-3.0f), FP_SCALE( 0.0f)}, /* 180deg low */ {FP_CONSTELLATION_SCALE(-3.0f), FP_CONSTELLATION_SCALE( 0.0f)}, /* 180deg low */
{FP_SCALE( 1.0f), FP_SCALE(-1.0f)}, /* 315deg low 7200 */ {FP_CONSTELLATION_SCALE( 1.0f), FP_CONSTELLATION_SCALE(-1.0f)}, /* 315deg low 7200 */
{FP_SCALE(-3.0f), FP_SCALE( 0.0f)}, /* 180deg low */ {FP_CONSTELLATION_SCALE(-3.0f), FP_CONSTELLATION_SCALE( 0.0f)}, /* 180deg low */
{FP_SCALE( 0.0f), FP_SCALE(-3.0f)}, /* 270deg low 4800 */ {FP_CONSTELLATION_SCALE( 0.0f), FP_CONSTELLATION_SCALE(-3.0f)}, /* 270deg low 4800 */
{FP_SCALE(-3.0f), FP_SCALE( 0.0f)} /* 180deg low */ {FP_CONSTELLATION_SCALE(-3.0f), FP_CONSTELLATION_SCALE( 0.0f)} /* 180deg low */
}; };
#if defined(SPANDSP_USE_FIXED_POINT) #if defined(SPANDSP_USE_FIXED_POINT)
...@@ -52,12 +44,12 @@ static const complexi16_t v29_cdcd_constellation[6] = ...@@ -52,12 +44,12 @@ static const complexi16_t v29_cdcd_constellation[6] =
static const complexf_t v29_cdcd_constellation[6] = static const complexf_t v29_cdcd_constellation[6] =
#endif #endif
{ {
{FP_SCALE( 3.0f), FP_SCALE( 0.0f)}, /* 0deg low 9600 */ {FP_CONSTELLATION_SCALE( 3.0f), FP_CONSTELLATION_SCALE( 0.0f)}, /* 0deg low 9600 */
{FP_SCALE(-3.0f), FP_SCALE( 3.0f)}, /* 135deg high */ {FP_CONSTELLATION_SCALE(-3.0f), FP_CONSTELLATION_SCALE( 3.0f)}, /* 135deg high */
{FP_SCALE( 3.0f), FP_SCALE( 0.0f)}, /* 0deg low 7200 */ {FP_CONSTELLATION_SCALE( 3.0f), FP_CONSTELLATION_SCALE( 0.0f)}, /* 0deg low 7200 */
{FP_SCALE(-1.0f), FP_SCALE( 1.0f)}, /* 135deg low */ {FP_CONSTELLATION_SCALE(-1.0f), FP_CONSTELLATION_SCALE( 1.0f)}, /* 135deg low */
{FP_SCALE( 3.0f), FP_SCALE( 0.0f)}, /* 0deg low 4800 */ {FP_CONSTELLATION_SCALE( 3.0f), FP_CONSTELLATION_SCALE( 0.0f)}, /* 0deg low 4800 */
{FP_SCALE( 0.0f), FP_SCALE( 3.0f)} /* 90deg low */ {FP_CONSTELLATION_SCALE( 0.0f), FP_CONSTELLATION_SCALE( 3.0f)} /* 90deg low */
}; };
#if defined(SPANDSP_USE_FIXED_POINT) #if defined(SPANDSP_USE_FIXED_POINT)
...@@ -66,22 +58,22 @@ static const complexi16_t v29_9600_constellation[16] = ...@@ -66,22 +58,22 @@ static const complexi16_t v29_9600_constellation[16] =
static const complexf_t v29_9600_constellation[16] = static const complexf_t v29_9600_constellation[16] =
#endif #endif
{ {
{FP_SCALE( 3.0f), FP_SCALE( 0.0f)}, /* 0deg low */ {FP_CONSTELLATION_SCALE( 3.0f), FP_CONSTELLATION_SCALE( 0.0f)}, /* 0deg low */
{FP_SCALE( 1.0f), FP_SCALE( 1.0f)}, /* 45deg low */ {FP_CONSTELLATION_SCALE( 1.0f), FP_CONSTELLATION_SCALE( 1.0f)}, /* 45deg low */
{FP_SCALE( 0.0f), FP_SCALE( 3.0f)}, /* 90deg low */ {FP_CONSTELLATION_SCALE( 0.0f), FP_CONSTELLATION_SCALE( 3.0f)}, /* 90deg low */
{FP_SCALE(-1.0f), FP_SCALE( 1.0f)}, /* 135deg low */ {FP_CONSTELLATION_SCALE(-1.0f), FP_CONSTELLATION_SCALE( 1.0f)}, /* 135deg low */
{FP_SCALE(-3.0f), FP_SCALE( 0.0f)}, /* 180deg low */ {FP_CONSTELLATION_SCALE(-3.0f), FP_CONSTELLATION_SCALE( 0.0f)}, /* 180deg low */
{FP_SCALE(-1.0f), FP_SCALE(-1.0f)}, /* 225deg low */ {FP_CONSTELLATION_SCALE(-1.0f), FP_CONSTELLATION_SCALE(-1.0f)}, /* 225deg low */
{FP_SCALE( 0.0f), FP_SCALE(-3.0f)}, /* 270deg low */ {FP_CONSTELLATION_SCALE( 0.0f), FP_CONSTELLATION_SCALE(-3.0f)}, /* 270deg low */
{FP_SCALE( 1.0f), FP_SCALE(-1.0f)}, /* 315deg low */ {FP_CONSTELLATION_SCALE( 1.0f), FP_CONSTELLATION_SCALE(-1.0f)}, /* 315deg low */
{FP_SCALE( 5.0f), FP_SCALE( 0.0f)}, /* 0deg high */ {FP_CONSTELLATION_SCALE( 5.0f), FP_CONSTELLATION_SCALE( 0.0f)}, /* 0deg high */
{FP_SCALE( 3.0f), FP_SCALE( 3.0f)}, /* 45deg high */ {FP_CONSTELLATION_SCALE( 3.0f), FP_CONSTELLATION_SCALE( 3.0f)}, /* 45deg high */
{FP_SCALE( 0.0f), FP_SCALE( 5.0f)}, /* 90deg high */ {FP_CONSTELLATION_SCALE( 0.0f), FP_CONSTELLATION_SCALE( 5.0f)}, /* 90deg high */
{FP_SCALE(-3.0f), FP_SCALE( 3.0f)}, /* 135deg high */ {FP_CONSTELLATION_SCALE(-3.0f), FP_CONSTELLATION_SCALE( 3.0f)}, /* 135deg high */
{FP_SCALE(-5.0f), FP_SCALE( 0.0f)}, /* 180deg high */ {FP_CONSTELLATION_SCALE(-5.0f), FP_CONSTELLATION_SCALE( 0.0f)}, /* 180deg high */
{FP_SCALE(-3.0f), FP_SCALE(-3.0f)}, /* 225deg high */ {FP_CONSTELLATION_SCALE(-3.0f), FP_CONSTELLATION_SCALE(-3.0f)}, /* 225deg high */
{FP_SCALE( 0.0f), FP_SCALE(-5.0f)}, /* 270deg high */ {FP_CONSTELLATION_SCALE( 0.0f), FP_CONSTELLATION_SCALE(-5.0f)}, /* 270deg high */
{FP_SCALE( 3.0f), FP_SCALE(-3.0f)} /* 315deg high */ {FP_CONSTELLATION_SCALE( 3.0f), FP_CONSTELLATION_SCALE(-3.0f)} /* 315deg high */
}; };
/*- End of file ------------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/
...@@ -25,6 +25,15 @@ STDERR_DEST=xyzzy2 ...@@ -25,6 +25,15 @@ STDERR_DEST=xyzzy2
echo Performing basic spandsp regression tests echo Performing basic spandsp regression tests
echo echo
./ademco_contactid_tests >$STDOUT_DEST 2>$STDERR_DEST
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo ademco_contactid_tests failed!
exit $RETVAL
fi
echo ademco_contactid_tests completed OK
./adsi_tests >$STDOUT_DEST 2>$STDERR_DEST ./adsi_tests >$STDOUT_DEST 2>$STDERR_DEST
RETVAL=$? RETVAL=$?
if [ $RETVAL != 0 ] if [ $RETVAL != 0 ]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论