mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-20 19:21:53 +00:00
Another round of tweaks for spandsp. There should be no functional changes,
although quite a few things have changed in the test suite
This commit is contained in:
@@ -5311,7 +5311,7 @@ static const char *at_cmd_plus_WSTL(at_state_t *s, const char *t)
|
||||
|
||||
#include "at_interpreter_dictionary.h"
|
||||
|
||||
static int command_search(const char *u, int len, int *matched)
|
||||
static int command_search(const char *u, int *matched)
|
||||
{
|
||||
int i;
|
||||
int index;
|
||||
@@ -5445,7 +5445,7 @@ SPAN_DECLARE(void) at_interpreter(at_state_t *s, const char *cmd, int len)
|
||||
t = s->line + 2;
|
||||
while (t && *t)
|
||||
{
|
||||
if ((entry = command_search(t, 15, &matched)) <= 0)
|
||||
if ((entry = command_search(t, &matched)) <= 0)
|
||||
break;
|
||||
if ((t = at_commands[entry - 1](s, t)) == NULL)
|
||||
break;
|
||||
|
||||
@@ -144,9 +144,9 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[], size_t le
|
||||
int output_length;
|
||||
int input_width;
|
||||
int input_length;
|
||||
int x;
|
||||
double c1;
|
||||
double c2;
|
||||
int x;
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
int frac_row;
|
||||
int frac_col;
|
||||
@@ -198,7 +198,7 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[], size_t le
|
||||
x = i*input_width/output_width;
|
||||
frac_col = x - x*output_width;
|
||||
c1 = s->raw_pixel_row[0][x] + (s->raw_pixel_row[0][x + 1] - s->raw_pixel_row[0][x])*frac_col;
|
||||
c1 = s->raw_pixel_row[1][x] + (s->raw_pixel_row[1][x + 1] - s->raw_pixel_row[1][x])*frac_col;
|
||||
c2 = s->raw_pixel_row[1][x] + (s->raw_pixel_row[1][x + 1] - s->raw_pixel_row[1][x])*frac_col;
|
||||
buf[i] = saturateu8(c1 + (c2 - c1)*frac_row);
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -61,7 +61,7 @@ static __inline__ int32_t arctan2(float y, float x)
|
||||
return 0xc0000000;
|
||||
return 0x40000000;
|
||||
}
|
||||
|
||||
|
||||
abs_y = fabsf(y);
|
||||
|
||||
/* If we are in quadrant II or III, flip things around */
|
||||
|
||||
@@ -77,6 +77,8 @@
|
||||
#include <spandsp/private/t4_t6_encode.h>
|
||||
/*#include <spandsp/private/t81_t82_arith_coding.h>*/
|
||||
/*#include <spandsp/private/t85.h>*/
|
||||
/*#include <spandsp/private/t42.h>*/
|
||||
/*#include <spandsp/private/t43.h>*/
|
||||
#include <spandsp/private/t4_rx.h>
|
||||
#include <spandsp/private/t4_tx.h>
|
||||
#include <spandsp/private/t30.h>
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
#define T30_DCS_BIT_200_200 15
|
||||
|
||||
#define T30_DIS_BIT_2D_CAPABLE 16
|
||||
#define T30_DCS_BIT_2D_CODING 16
|
||||
#define T30_DCS_BIT_2D_MODE 16
|
||||
|
||||
/* Standard facsimile terminals conforming to ITU-T Rec. T.4 must have the following capability:
|
||||
Paper length = 297 mm. */
|
||||
@@ -101,7 +101,7 @@
|
||||
#define T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE 35
|
||||
|
||||
#define T30_DIS_BIT_T43_CAPABLE 36
|
||||
#define T30_DCS_BIT_T43_CODING 36
|
||||
#define T30_DCS_BIT_T43_MODE 36
|
||||
|
||||
#define T30_DIS_BIT_PLANE_INTERLEAVE_CAPABLE 37
|
||||
#define T30_DCS_BIT_PLANE_INTERLEAVE 37
|
||||
@@ -270,11 +270,11 @@
|
||||
bits 49, 102 and 50 in DCS or bits 47, 101, 50 and 35 in DTC shall be set to "1" with the following
|
||||
meaning:
|
||||
Bit DIS DTC DCS
|
||||
35 Polled SubAddress capability Polled SubAddress transmission Not allowed – set to "0"
|
||||
47 Selective polling capability Selective polling transmission Not allowed – set to "0"
|
||||
35 Polled SubAddress capability Polled SubAddress transmission Not allowed - set to "0"
|
||||
47 Selective polling capability Selective polling transmission Not allowed - set to "0"
|
||||
49 Subaddressing capability Not allowed (Set to "0") Subaddressing transmission
|
||||
50 Password Password transmission Sender Identification transmission
|
||||
101 Internet Selective Polling Address capability Internet Selective Polling Address transmission Not allowed – set to "0"
|
||||
101 Internet Selective Polling Address capability Internet Selective Polling Address transmission Not allowed - set to "0"
|
||||
102 Internet Routing Address capability Not allowed (Set to "0") Internet Routing Address transmission
|
||||
|
||||
Terminals conforming to the 1993 version of T.30 may set the above bits to "0" even though PWD/SEP/SUB
|
||||
|
||||
@@ -42,6 +42,10 @@ struct t4_state_s
|
||||
/*! \brief The time at which handling of the current page began. */
|
||||
time_t page_start_time;
|
||||
|
||||
/*! \brief TRUE for FAX page headers to overlay (i.e. replace) the beginning of the
|
||||
page image. FALSE for FAX page headers to add to the overall length of
|
||||
the page. */
|
||||
int header_overlays_image;
|
||||
/*! \brief The text which will be used in FAX page header. No text results
|
||||
in no header line. */
|
||||
const char *header_info;
|
||||
|
||||
@@ -86,7 +86,7 @@ struct v17_rx_state_s
|
||||
/*! \brief The register for the data scrambler. */
|
||||
uint32_t scramble_reg;
|
||||
/*! \brief Scrambler tap */
|
||||
//int scrambler_tap;
|
||||
int scrambler_tap;
|
||||
|
||||
/*! \brief TRUE if the short training sequence is to be used. */
|
||||
int short_train;
|
||||
|
||||
@@ -58,9 +58,13 @@ struct v17_tx_state_s
|
||||
|
||||
/*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
complexi16_t rrc_filter[2*V17_TX_FILTER_STEPS];
|
||||
/*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
|
||||
int16_t rrc_filter_re[V17_TX_FILTER_STEPS];
|
||||
int16_t rrc_filter_im[V17_TX_FILTER_STEPS];
|
||||
#else
|
||||
complexf_t rrc_filter[2*V17_TX_FILTER_STEPS];
|
||||
/*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
|
||||
float rrc_filter_re[V17_TX_FILTER_STEPS];
|
||||
float rrc_filter_im[V17_TX_FILTER_STEPS];
|
||||
#endif
|
||||
/*! \brief Current offset into the RRC pulse shaping filter buffer. */
|
||||
int rrc_filter_step;
|
||||
@@ -75,7 +79,7 @@ struct v17_tx_state_s
|
||||
/*! \brief The register for the data scrambler. */
|
||||
uint32_t scramble_reg;
|
||||
/*! \brief Scrambler tap */
|
||||
//int scrambler_tap;
|
||||
int scrambler_tap;
|
||||
/*! \brief TRUE if transmitting the training sequence. FALSE if transmitting user data. */
|
||||
int in_training;
|
||||
/*! \brief TRUE if the short training sequence is to be used. */
|
||||
|
||||
@@ -547,12 +547,10 @@ typedef struct
|
||||
int error_correcting_mode_retries;
|
||||
/*! \brief Current status. */
|
||||
int current_status;
|
||||
#if 0
|
||||
/*! \brief The number of RTP events in this call. */
|
||||
int rtp_events;
|
||||
/*! \brief The number of RTN events in this call. */
|
||||
int rtn_events;
|
||||
#endif
|
||||
} t30_stats_t;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
@@ -144,6 +144,12 @@ SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info);
|
||||
\param info A POSIX timezone description string. */
|
||||
SPAN_DECLARE(void) t4_tx_set_header_tz(t4_state_t *s, const char *tzstring);
|
||||
|
||||
/*! Set page header extends or overlays the image mode.
|
||||
\brief Set page header overlay mode.
|
||||
\param s The T.4 context.
|
||||
\param header_overlays_image TRUE for overlay, or FALSE for extend the page. */
|
||||
SPAN_DECLARE(void) t4_tx_set_header_overlays_image(t4_state_t *s, int header_overlays_image);
|
||||
|
||||
/*! \brief Set the row read handler for a T.4 transmit context.
|
||||
\param s The T.4 transmit context.
|
||||
\param handler A pointer to the handler routine.
|
||||
|
||||
+106
-8
@@ -60,10 +60,18 @@
|
||||
#include "spandsp/v27ter_tx.h"
|
||||
#include "spandsp/t4_rx.h"
|
||||
#include "spandsp/t4_tx.h"
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#if defined(SPANDSP_SUPPORT_T42) || defined(SPANDSP_SUPPORT_T43) | defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/t81_t82_arith_coding.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/t85.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T42)
|
||||
#include "spandsp/t42.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T43)
|
||||
#include "spandsp/t43.h"
|
||||
#endif
|
||||
#include "spandsp/t4_t6_decode.h"
|
||||
#include "spandsp/t4_t6_encode.h"
|
||||
#include "spandsp/t30_fcf.h"
|
||||
@@ -73,10 +81,18 @@
|
||||
#include "spandsp/t30_logging.h"
|
||||
|
||||
#include "spandsp/private/logging.h"
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#if defined(SPANDSP_SUPPORT_T42) || defined(SPANDSP_SUPPORT_T43) | defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/private/t85.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T42)
|
||||
#include "spandsp/private/t42.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T43)
|
||||
#include "spandsp/private/t43.h"
|
||||
#endif
|
||||
#include "spandsp/private/t4_t6_decode.h"
|
||||
#include "spandsp/private/t4_t6_encode.h"
|
||||
#include "spandsp/private/t4_rx.h"
|
||||
@@ -387,6 +403,7 @@ static void repeat_last_command(t30_state_t *s);
|
||||
static void disconnect(t30_state_t *s);
|
||||
static void decode_20digit_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int len);
|
||||
static void decode_url_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int len);
|
||||
static int decode_nsf_nss_nsc(t30_state_t *s, uint8_t *msg[], const uint8_t *pkt, int len);
|
||||
static int set_min_scan_time_code(t30_state_t *s);
|
||||
static int send_cfr_sequence(t30_state_t *s, int start);
|
||||
static void timer_t2_start(t30_state_t *s);
|
||||
@@ -1312,6 +1329,19 @@ static int build_dcs(t30_state_t *s)
|
||||
/* Select the compression to use. */
|
||||
switch (s->line_encoding)
|
||||
{
|
||||
#if defined(SPANDSP_SUPPORT_T42)
|
||||
case T4_COMPRESSION_ITU_T42:
|
||||
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE);
|
||||
set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21);
|
||||
break;
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T43)
|
||||
case T4_COMPRESSION_ITU_T43:
|
||||
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T43_MODE);
|
||||
set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21);
|
||||
break;
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
case T4_COMPRESSION_ITU_T85:
|
||||
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_MODE);
|
||||
clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE);
|
||||
@@ -1322,12 +1352,13 @@ static int build_dcs(t30_state_t *s)
|
||||
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE);
|
||||
set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21);
|
||||
break;
|
||||
#endif
|
||||
case T4_COMPRESSION_ITU_T6:
|
||||
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T6_MODE);
|
||||
set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21);
|
||||
break;
|
||||
case T4_COMPRESSION_ITU_T4_2D:
|
||||
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_2D_CODING);
|
||||
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_2D_MODE);
|
||||
set_ctrl_bits(s->dcs_frame, s->min_scan_time_code, 21);
|
||||
break;
|
||||
case T4_COMPRESSION_ITU_T4_1D:
|
||||
@@ -1515,7 +1546,7 @@ static int build_dcs(t30_state_t *s)
|
||||
if (bad != T30_ERR_OK)
|
||||
{
|
||||
s->current_status = bad;
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Image width (%d pixels) not an acceptable FAX image width\n", s->image_width);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Image width (%d pixels) is not an acceptable FAX image width\n", s->image_width);
|
||||
return -1;
|
||||
}
|
||||
switch (s->image_width)
|
||||
@@ -1557,7 +1588,7 @@ static int build_dcs(t30_state_t *s)
|
||||
if (bad != T30_ERR_OK)
|
||||
{
|
||||
s->current_status = bad;
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Image width (%d pixels) not an acceptable FAX image width\n", s->image_width);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Image width (%d pixels) is not an acceptable FAX image width\n", s->image_width);
|
||||
return -1;
|
||||
}
|
||||
/* Deal with the image length */
|
||||
@@ -2132,6 +2163,60 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
/* T.4 1D is always available */
|
||||
bi_level_support = T30_SUPPORT_T4_1D_COMPRESSION;
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE))
|
||||
bi_level_support |= T30_SUPPORT_T4_2D_COMPRESSION;
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE))
|
||||
bi_level_support |= T30_SUPPORT_T6_COMPRESSION;
|
||||
/* Bit 79 set with bit 78 clear is invalid, so let's completely ignore 79
|
||||
if 78 is clear. */
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE))
|
||||
{
|
||||
bi_level_support |= T30_SUPPORT_T85_COMPRESSION;
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE)
|
||||
bi_level_support |= T30_SUPPORT_T85_L0_COMPRESSION;
|
||||
}
|
||||
|
||||
gray_support = 0;
|
||||
colour_support = 0;
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE))
|
||||
{
|
||||
/* Multi-level coding available */
|
||||
gray_support |= T30_SUPPORT_T81_COMPRESSION;
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE))
|
||||
gray_support |= T30_SUPPORT_T81_12BIT_COMPRESSION;
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE))
|
||||
{
|
||||
gray_support |= T30_SUPPORT_T43_COMPRESSION;
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE))
|
||||
gray_support |= T30_SUPPORT_T43_COMPRESSION_12BIT;
|
||||
}
|
||||
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, bit69))
|
||||
{
|
||||
/* Colour coding available */
|
||||
colour_support |= T30_SUPPORT_T81_COMPRESSION;
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE))
|
||||
colour_support |= T30_SUPPORT_T81_12BIT_COMPRESSION;
|
||||
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING))
|
||||
{
|
||||
colour_support |= T30_SUPPORT_T81_SUBSAMPLING_COMPRESSION;
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE))
|
||||
colour_support |= T30_SUPPORT_T81_SUBSAMPLING_COMPRESSION_12BIT;
|
||||
}
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE))
|
||||
{
|
||||
colour_support |= T30_SUPPORT_T43_COMPRESSION;
|
||||
if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE))
|
||||
colour_support |= T30_SUPPORT_T43_12BIT_COMPRESSION;
|
||||
}
|
||||
}
|
||||
/* bit74 custom illuminant */
|
||||
/* bit75 custom gamut range */
|
||||
}
|
||||
#endif
|
||||
queue_phase(s, T30_PHASE_B_TX);
|
||||
/* Try to send something */
|
||||
if (s->tx_file[0])
|
||||
@@ -2289,7 +2374,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
|
||||
{
|
||||
s->line_encoding = T4_COMPRESSION_ITU_T6;
|
||||
}
|
||||
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_2D_CODING))
|
||||
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_2D_MODE))
|
||||
{
|
||||
s->line_encoding = T4_COMPRESSION_ITU_T4_2D;
|
||||
}
|
||||
@@ -4415,11 +4500,13 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "The remote was made by '%s'\n", s->vendor);
|
||||
if (s->model)
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "The remote is a '%s'\n", s->model);
|
||||
s->rx_info.nsf_len = decode_nsf_nss_nsc(s, &s->rx_info.nsf, &msg[2], len - 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* NSC - Non-standard facilities command */
|
||||
/* OK in (NSC) (CIG) DTC */
|
||||
s->rx_info.nsc_len = decode_nsf_nss_nsc(s, &s->rx_info.nsc, &msg[2], len - 2);
|
||||
}
|
||||
break;
|
||||
case (T30_PWD & 0xFE):
|
||||
@@ -4487,6 +4574,7 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
|
||||
break;
|
||||
case (T30_NSS & 0xFE):
|
||||
/* Non-standard facilities set-up */
|
||||
s->rx_info.nss_len = decode_nsf_nss_nsc(s, &s->rx_info.nss, &msg[2], len - 2);
|
||||
break;
|
||||
case (T30_SUB & 0xFE):
|
||||
/* Sub-address */
|
||||
@@ -5209,6 +5297,18 @@ static void decode_url_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int le
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int decode_nsf_nss_nsc(t30_state_t *s, uint8_t *msg[], const uint8_t *pkt, int len)
|
||||
{
|
||||
uint8_t *t;
|
||||
|
||||
if ((t = malloc(len - 1)) == NULL)
|
||||
return 0;
|
||||
memcpy(t, pkt + 1, len - 1);
|
||||
*msg = t;
|
||||
return len - 1;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static void t30_non_ecm_rx_status(void *user_data, int status)
|
||||
{
|
||||
t30_state_t *s;
|
||||
@@ -6175,10 +6275,8 @@ SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t)
|
||||
t->encoding = stats.encoding;
|
||||
t->image_size = stats.line_image_size;
|
||||
t->current_status = s->current_status;
|
||||
#if 0
|
||||
t->rtn_events = s->rtn_events;
|
||||
t->rtp_events = s->rtp_events;
|
||||
#endif
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -60,10 +60,18 @@
|
||||
#include "spandsp/v27ter_tx.h"
|
||||
#include "spandsp/t4_rx.h"
|
||||
#include "spandsp/t4_tx.h"
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#if defined(SPANDSP_SUPPORT_T42) || defined(SPANDSP_SUPPORT_T43) | defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/t81_t82_arith_coding.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/t85.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T42)
|
||||
#include "spandsp/t42.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T43)
|
||||
#include "spandsp/t43.h"
|
||||
#endif
|
||||
#include "spandsp/t4_t6_decode.h"
|
||||
#include "spandsp/t4_t6_encode.h"
|
||||
#include "spandsp/t30_fcf.h"
|
||||
@@ -73,10 +81,18 @@
|
||||
#include "spandsp/t30_logging.h"
|
||||
|
||||
#include "spandsp/private/logging.h"
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#if defined(SPANDSP_SUPPORT_T42) || defined(SPANDSP_SUPPORT_T43) | defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/private/t85.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T42)
|
||||
#include "spandsp/private/t42.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T43)
|
||||
#include "spandsp/private/t43.h"
|
||||
#endif
|
||||
#include "spandsp/private/t4_t6_decode.h"
|
||||
#include "spandsp/private/t4_t6_encode.h"
|
||||
#include "spandsp/private/t4_rx.h"
|
||||
@@ -548,10 +564,8 @@ SPAN_DECLARE(size_t) t30_get_rx_csa(t30_state_t *s, int *type, const char *addre
|
||||
|
||||
SPAN_DECLARE(int) t30_set_tx_page_header_overlays_image(t30_state_t *s, int header_overlays_image)
|
||||
{
|
||||
#if 0
|
||||
s->header_overlays_image = header_overlays_image;
|
||||
t4_tx_set_header_overlays_image(&s->t4.tx, s->header_overlays_image);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@@ -686,12 +700,17 @@ SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_c
|
||||
mask = T30_SUPPORT_T4_1D_COMPRESSION
|
||||
| T30_SUPPORT_T4_2D_COMPRESSION
|
||||
| T30_SUPPORT_T6_COMPRESSION
|
||||
#if defined(SPANDSP_SUPPORT_T42)
|
||||
| T30_SUPPORT_T42_COMPRESSION
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T43)
|
||||
| T30_SUPPORT_T43_COMPRESSION
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
| T30_SUPPORT_T85_COMPRESSION
|
||||
| T30_SUPPORT_T85_L0_COMPRESSION;
|
||||
#else
|
||||
| 0;
|
||||
| T30_SUPPORT_T85_L0_COMPRESSION
|
||||
#endif
|
||||
| 0;
|
||||
s->supported_compressions = supported_compressions & mask;
|
||||
t30_build_dis_or_dtc(s);
|
||||
return 0;
|
||||
|
||||
@@ -60,10 +60,18 @@
|
||||
#include "spandsp/v27ter_tx.h"
|
||||
#include "spandsp/t4_rx.h"
|
||||
#include "spandsp/t4_tx.h"
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#if defined(SPANDSP_SUPPORT_T42) || defined(SPANDSP_SUPPORT_T43) | defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/t81_t82_arith_coding.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/t85.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T42)
|
||||
#include "spandsp/t42.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T43)
|
||||
#include "spandsp/t43.h"
|
||||
#endif
|
||||
#include "spandsp/t4_t6_decode.h"
|
||||
#include "spandsp/t4_t6_encode.h"
|
||||
#include "spandsp/t30_fcf.h"
|
||||
@@ -72,10 +80,18 @@
|
||||
#include "spandsp/t30_logging.h"
|
||||
|
||||
#include "spandsp/private/logging.h"
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#if defined(SPANDSP_SUPPORT_T42) || defined(SPANDSP_SUPPORT_T43) | defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/private/t85.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T42)
|
||||
#include "spandsp/private/t42.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T43)
|
||||
#include "spandsp/private/t43.h"
|
||||
#endif
|
||||
#include "spandsp/private/t4_t6_decode.h"
|
||||
#include "spandsp/private/t4_t6_encode.h"
|
||||
#include "spandsp/private/t4_rx.h"
|
||||
|
||||
@@ -2167,6 +2167,9 @@ SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len)
|
||||
}
|
||||
dle_unstuff(s, t, len);
|
||||
break;
|
||||
case AT_MODE_CONNECTED:
|
||||
/* TODO: Implement for data modem operation */
|
||||
break;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -73,10 +73,18 @@
|
||||
#include "spandsp/modem_connect_tones.h"
|
||||
#include "spandsp/t4_rx.h"
|
||||
#include "spandsp/t4_tx.h"
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#if defined(SPANDSP_SUPPORT_T42) || defined(SPANDSP_SUPPORT_T43) | defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/t81_t82_arith_coding.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/t85.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T42)
|
||||
#include "spandsp/t42.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T43)
|
||||
#include "spandsp/t43.h"
|
||||
#endif
|
||||
#include "spandsp/t4_t6_decode.h"
|
||||
#include "spandsp/t4_t6_encode.h"
|
||||
#include "spandsp/t30_fcf.h"
|
||||
@@ -100,10 +108,18 @@
|
||||
#include "spandsp/private/modem_connect_tones.h"
|
||||
#include "spandsp/private/hdlc.h"
|
||||
#include "spandsp/private/fax_modems.h"
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#if defined(SPANDSP_SUPPORT_T42) || defined(SPANDSP_SUPPORT_T43) | defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T85)
|
||||
#include "spandsp/private/t85.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T42)
|
||||
#include "spandsp/private/t42.h"
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T43)
|
||||
#include "spandsp/private/t43.h"
|
||||
#endif
|
||||
#include "spandsp/private/t4_t6_decode.h"
|
||||
#include "spandsp/private/t4_t6_encode.h"
|
||||
#include "spandsp/private/t4_rx.h"
|
||||
@@ -930,7 +946,7 @@ static void monitor_control_messages(t38_gateway_state_t *s,
|
||||
case T30_EOS | 1:
|
||||
#if 0
|
||||
/* If we are hitting one of these conditions, it will take another DCS/DTC to select
|
||||
the fast modem again, so abandon our idea of t. */
|
||||
the fast modem again, so abandon our idea of it. */
|
||||
s->core.fast_bit_rate = 0;
|
||||
s->core.fast_rx_modem = T38_NONE;
|
||||
s->core.image_data_mode = FALSE;
|
||||
|
||||
@@ -399,7 +399,7 @@ static void make_header(t4_state_t *s, char *header)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int t4_tx_put_fax_header(t4_state_t *s)
|
||||
static int t4_tx_put_fax_header(t4_state_t *s, int *rows)
|
||||
{
|
||||
int row;
|
||||
int i;
|
||||
@@ -435,6 +435,7 @@ static int t4_tx_put_fax_header(t4_state_t *s)
|
||||
repeats = 1;
|
||||
break;
|
||||
}
|
||||
*rows = 16*repeats;
|
||||
for (row = 0; row < 16; row++)
|
||||
{
|
||||
t = header;
|
||||
@@ -1285,6 +1286,7 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s)
|
||||
int run_space;
|
||||
int len;
|
||||
int old_image_width;
|
||||
int header_rows;
|
||||
uint8_t *bufptr8;
|
||||
uint32_t *bufptr;
|
||||
|
||||
@@ -1336,7 +1338,7 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s)
|
||||
|
||||
if (s->header_info && s->header_info[0])
|
||||
{
|
||||
if (t4_tx_put_fax_header(s))
|
||||
if (t4_tx_put_fax_header(s, &header_rows))
|
||||
return -1;
|
||||
}
|
||||
if (s->t4_t6_tx.row_read_handler)
|
||||
@@ -1501,6 +1503,12 @@ SPAN_DECLARE(void) t4_tx_set_min_bits_per_row(t4_state_t *s, int bits)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(void) t4_tx_set_header_overlays_image(t4_state_t *s, int header_overlays_image)
|
||||
{
|
||||
s->header_overlays_image = header_overlays_image;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident)
|
||||
{
|
||||
s->tiff.local_ident = (ident && ident[0]) ? ident : NULL;
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/logging.h"
|
||||
#include "spandsp/fast_convert.h"
|
||||
#include "spandsp/math_fixed.h"
|
||||
#include "spandsp/saturated.h"
|
||||
#include "spandsp/complex.h"
|
||||
#include "spandsp/vector_float.h"
|
||||
#include "spandsp/complex_vector_float.h"
|
||||
@@ -62,13 +65,13 @@
|
||||
#include "spandsp/private/logging.h"
|
||||
#include "spandsp/private/v17rx.h"
|
||||
|
||||
#include "v17_v32bis_tx_constellation_maps.h"
|
||||
#include "v17_v32bis_rx_constellation_maps.h"
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
#include "v17_v32bis_rx_fixed_rrc.h"
|
||||
#else
|
||||
#include "v17_v32bis_rx_floating_rrc.h"
|
||||
#endif
|
||||
#include "v17_v32bis_tx_constellation_maps.h"
|
||||
#include "v17_v32bis_rx_constellation_maps.h"
|
||||
|
||||
/*! The nominal frequency of the carrier, in Hertz */
|
||||
#define CARRIER_NOMINAL_FREQ 1800.0f
|
||||
@@ -295,8 +298,7 @@ static int descramble(v17_rx_state_t *s, int in_bit)
|
||||
{
|
||||
int out_bit;
|
||||
|
||||
//out_bit = (in_bit ^ (s->scramble_reg >> s->scrambler_tap) ^ (s->scramble_reg >> (23 - 1))) & 1;
|
||||
out_bit = (in_bit ^ (s->scramble_reg >> (18 - 1)) ^ (s->scramble_reg >> (23 - 1))) & 1;
|
||||
out_bit = (in_bit ^ (s->scramble_reg >> s->scrambler_tap) ^ (s->scramble_reg >> (23 - 1))) & 1;
|
||||
s->scramble_reg <<= 1;
|
||||
if (s->training_stage > TRAINING_STAGE_NORMAL_OPERATION && s->training_stage < TRAINING_STAGE_TCM_WINDUP)
|
||||
s->scramble_reg |= out_bit;
|
||||
@@ -1425,7 +1427,7 @@ SPAN_DECLARE(v17_rx_state_t *) v17_rx_init(v17_rx_state_t *s, int bit_rate, put_
|
||||
s->put_bit = put_bit;
|
||||
s->put_bit_user_data = user_data;
|
||||
s->short_train = FALSE;
|
||||
//s->scrambler_tap = 18 - 1;
|
||||
s->scrambler_tap = 18 - 1;
|
||||
v17_rx_signal_cutoff(s, -45.5f);
|
||||
s->carrier_phase_rate_save = dds_phase_ratef(CARRIER_NOMINAL_FREQ);
|
||||
v17_rx_restart(s, bit_rate, s->short_train);
|
||||
|
||||
+32
-32
@@ -100,8 +100,7 @@ static __inline__ int scramble(v17_tx_state_t *s, int in_bit)
|
||||
{
|
||||
int out_bit;
|
||||
|
||||
//out_bit = (in_bit ^ (s->scramble_reg >> s->scrambler_tap) ^ (s->scramble_reg >> (23 - 1))) & 1;
|
||||
out_bit = (in_bit ^ (s->scramble_reg >> (18 - 1)) ^ (s->scramble_reg >> (23 - 1))) & 1;
|
||||
out_bit = (in_bit ^ (s->scramble_reg >> s->scrambler_tap) ^ (s->scramble_reg >> (23 - 1))) & 1;
|
||||
s->scramble_reg = (s->scramble_reg << 1) | out_bit;
|
||||
return out_bit;
|
||||
}
|
||||
@@ -287,13 +286,16 @@ static __inline__ complexf_t getbaud(v17_tx_state_t *s)
|
||||
SPAN_DECLARE_NONSTD(int) v17_tx(v17_tx_state_t *s, int16_t amp[], int len)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
complexi_t x;
|
||||
complexi_t z;
|
||||
complexi16_t v;
|
||||
complexi32_t x;
|
||||
complexi32_t z;
|
||||
int16_t iamp;
|
||||
#else
|
||||
complexf_t v;
|
||||
complexf_t x;
|
||||
complexf_t z;
|
||||
float famp;
|
||||
#endif
|
||||
int i;
|
||||
int sample;
|
||||
|
||||
if (s->training_step >= V17_TRAINING_SHUTDOWN_END)
|
||||
@@ -306,37 +308,30 @@ SPAN_DECLARE_NONSTD(int) v17_tx(v17_tx_state_t *s, int16_t amp[], int len)
|
||||
if ((s->baud_phase += 3) >= 10)
|
||||
{
|
||||
s->baud_phase -= 10;
|
||||
s->rrc_filter[s->rrc_filter_step] =
|
||||
s->rrc_filter[s->rrc_filter_step + V17_TX_FILTER_STEPS] = getbaud(s);
|
||||
v = getbaud(s);
|
||||
s->rrc_filter_re[s->rrc_filter_step] = v.re;
|
||||
s->rrc_filter_im[s->rrc_filter_step] = v.im;
|
||||
if (++s->rrc_filter_step >= V17_TX_FILTER_STEPS)
|
||||
s->rrc_filter_step = 0;
|
||||
}
|
||||
/* Root raised cosine pulse shaping at baseband */
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
x = complex_seti(0, 0);
|
||||
for (i = 0; i < V17_TX_FILTER_STEPS; i++)
|
||||
{
|
||||
x.re += (int32_t) tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].re;
|
||||
x.im += (int32_t) tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].im;
|
||||
}
|
||||
/* Root raised cosine pulse shaping at baseband */
|
||||
x.re = vec_circular_dot_prodi16(s->rrc_filter_re, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase], V17_TX_FILTER_STEPS, s->rrc_filter_step) >> 4;
|
||||
x.im = vec_circular_dot_prodi16(s->rrc_filter_im, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase], V17_TX_FILTER_STEPS, s->rrc_filter_step) >> 4;
|
||||
/* Now create and modulate the carrier */
|
||||
x.re >>= 4;
|
||||
x.im >>= 4;
|
||||
z = dds_complexi(&(s->carrier_phase), s->carrier_phase_rate);
|
||||
z = dds_complexi32(&s->carrier_phase, s->carrier_phase_rate);
|
||||
iamp = ((int32_t) x.re*z.re - x.im*z.im) >> 15;
|
||||
/* Don't bother saturating. We should never clip. */
|
||||
i = (x.re*z.re - x.im*z.im) >> 15;
|
||||
amp[sample] = (int16_t) ((i*s->gain) >> 15);
|
||||
amp[sample] = (int16_t) (((int32_t) iamp*s->gain) >> 11);
|
||||
#else
|
||||
x = complex_setf(0.0f, 0.0f);
|
||||
for (i = 0; i < V17_TX_FILTER_STEPS; i++)
|
||||
{
|
||||
x.re += tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].re;
|
||||
x.im += tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].im;
|
||||
}
|
||||
/* Root raised cosine pulse shaping at baseband */
|
||||
x.re = vec_circular_dot_prodf(s->rrc_filter_re, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase], V17_TX_FILTER_STEPS, s->rrc_filter_step);
|
||||
x.im = vec_circular_dot_prodf(s->rrc_filter_im, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase], V17_TX_FILTER_STEPS, s->rrc_filter_step);
|
||||
/* Now create and modulate the carrier */
|
||||
z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate);
|
||||
z = dds_complexf(&s->carrier_phase, s->carrier_phase_rate);
|
||||
famp = x.re*z.re - x.im*z.im;
|
||||
/* Don't bother saturating. We should never clip. */
|
||||
amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain);
|
||||
amp[sample] = (int16_t) lfastrintf(famp*s->gain);
|
||||
#endif
|
||||
}
|
||||
return sample;
|
||||
@@ -345,12 +340,15 @@ SPAN_DECLARE_NONSTD(int) v17_tx(v17_tx_state_t *s, int16_t amp[], int len)
|
||||
|
||||
SPAN_DECLARE(void) v17_tx_power(v17_tx_state_t *s, float power)
|
||||
{
|
||||
float gain;
|
||||
|
||||
/* The constellation design seems to keep the average power the same, regardless
|
||||
of which bit rate is in use. */
|
||||
gain = 0.223f*powf(10.0f, (power - DBM0_MAX_POWER)/20.0f)*32768.0f/TX_PULSESHAPER_GAIN;
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
s->gain = 0.223f*powf(10.0f, (power - DBM0_MAX_POWER)/20.0f)*16.0f*(32767.0f/30672.52f)*32768.0f/TX_PULSESHAPER_GAIN;
|
||||
s->gain = (int16_t) gain;
|
||||
#else
|
||||
s->gain = 0.223f*powf(10.0f, (power - DBM0_MAX_POWER)/20.0f)*32768.0f/TX_PULSESHAPER_GAIN;
|
||||
s->gain = gain;
|
||||
#endif
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@@ -410,9 +408,11 @@ SPAN_DECLARE(int) v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int s
|
||||
/* NB: some modems seem to use 3 instead of 1 for long training */
|
||||
s->diff = (short_train) ? 0 : 1;
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
cvec_zeroi16(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0]));
|
||||
vec_zeroi16(s->rrc_filter_re, sizeof(s->rrc_filter_re)/sizeof(s->rrc_filter_re[0]));
|
||||
vec_zeroi16(s->rrc_filter_im, sizeof(s->rrc_filter_im)/sizeof(s->rrc_filter_im[0]));
|
||||
#else
|
||||
cvec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0]));
|
||||
vec_zerof(s->rrc_filter_re, sizeof(s->rrc_filter_re)/sizeof(s->rrc_filter_re[0]));
|
||||
vec_zerof(s->rrc_filter_im, sizeof(s->rrc_filter_im)/sizeof(s->rrc_filter_im[0]));
|
||||
#endif
|
||||
s->rrc_filter_step = 0;
|
||||
s->convolution = 0;
|
||||
@@ -452,7 +452,7 @@ SPAN_DECLARE(v17_tx_state_t *) v17_tx_init(v17_tx_state_t *s, int bit_rate, int
|
||||
span_log_set_protocol(&s->logging, "V.17 TX");
|
||||
s->get_bit = get_bit;
|
||||
s->get_bit_user_data = user_data;
|
||||
//s->scrambler_tap = 18 - 1;
|
||||
s->scrambler_tap = 18 - 1;
|
||||
s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ);
|
||||
v17_tx_power(s, -14.0f);
|
||||
v17_tx_restart(s, bit_rate, tep, FALSE);
|
||||
|
||||
Reference in New Issue
Block a user