mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
Lots of little cosmetic cleanups
This commit is contained in:
@@ -98,9 +98,13 @@
|
||||
#include <spandsp/v29tx.h>
|
||||
#include <spandsp/v17rx.h>
|
||||
#include <spandsp/v17tx.h>
|
||||
#include <spandsp/v32bis.h>
|
||||
#include <spandsp/v22bis.h>
|
||||
#include <spandsp/v27ter_rx.h>
|
||||
#include <spandsp/v27ter_tx.h>
|
||||
#if defined(SPANDSP_SUPPORT_V34)
|
||||
#include <spandsp/v34.h>
|
||||
#endif
|
||||
#include <spandsp/v18.h>
|
||||
#include <spandsp/timezone.h>
|
||||
#include <spandsp/t4_rx.h>
|
||||
|
@@ -274,7 +274,8 @@ extern "C"
|
||||
__inline float rintf(float flt)
|
||||
{
|
||||
_asm
|
||||
{ fld flt
|
||||
{
|
||||
fld flt
|
||||
frndint
|
||||
}
|
||||
}
|
||||
|
@@ -63,7 +63,6 @@ SPAN_DECLARE(void) t81_t82_arith_encode(t81_t82_arith_encode_state_t *s, int cx,
|
||||
|
||||
SPAN_DECLARE(void) t81_t82_arith_encode_flush(t81_t82_arith_encode_state_t *s);
|
||||
|
||||
|
||||
SPAN_DECLARE(t81_t82_arith_decode_state_t *) t81_t82_arith_decode_init(t81_t82_arith_decode_state_t *s);
|
||||
|
||||
SPAN_DECLARE(int) t81_t82_arith_decode_restart(t81_t82_arith_decode_state_t *s, int reuse_st);
|
||||
|
@@ -278,7 +278,6 @@ SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max
|
||||
tree = s->levels[--s->level];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return samples;
|
||||
}
|
||||
|
@@ -1105,6 +1105,7 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
|
||||
span_log(logging, SPAN_LOG_FLOW, "%s\n", escape.error_message);
|
||||
else
|
||||
span_log(logging, SPAN_LOG_FLOW, "Unspecified libjpeg error.\n");
|
||||
printf("Error %s.\n", escape.error_message);
|
||||
if (scan_line_out)
|
||||
free(scan_line_out);
|
||||
fclose(in);
|
||||
@@ -1134,14 +1135,17 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
|
||||
if (!is_itu_fax(logging, s, decompressor.marker_list))
|
||||
{
|
||||
span_log(logging, SPAN_LOG_FLOW, "Is not an ITU FAX.\n");
|
||||
return FALSE;
|
||||
printf("Is not an ITU FAX 1.\n");
|
||||
//return FALSE;
|
||||
}
|
||||
/* Copy size, resolution, etc */
|
||||
*width = decompressor.image_width;
|
||||
*height = decompressor.image_height;
|
||||
printf("Is %d x %d\n", decompressor.image_width, decompressor.image_height);
|
||||
|
||||
jpeg_start_decompress(&decompressor);
|
||||
|
||||
printf("Is %d x %d x %d.\n", decompressor.output_width, decompressor.output_height, decompressor.num_components);
|
||||
if ((scan_line_in = (JSAMPROW) malloc(decompressor.output_width*decompressor.num_components)) == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -1151,6 +1155,7 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
|
||||
jpeg_read_scanlines(&decompressor, &scan_line_in, 1);
|
||||
lab_to_srgb(s, scan_line_out, scan_line_in, decompressor.output_width);
|
||||
}
|
||||
printf("Next %d\n", decompressor.output_scanline);
|
||||
|
||||
free(scan_line_in);
|
||||
jpeg_finish_decompress(&decompressor);
|
||||
@@ -1159,6 +1164,7 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
|
||||
|
||||
*dstlen = pos;
|
||||
|
||||
printf("Next2 %d\n", decompressor.output_scanline);
|
||||
return TRUE;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
@@ -75,7 +75,6 @@ static __inline__ int flag_is_changeable_p(uint32_t flag)
|
||||
" popfl\n"
|
||||
: "=&r" (f1), "=&r" (f2)
|
||||
: "ir" (flag));
|
||||
|
||||
return ((f1^f2) & flag) != 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
@@ -23,10 +23,6 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED.
|
||||
Currently it performs the core compression and decompression functions OK.
|
||||
However, a number of the bells and whistles in V.42bis are incomplete. */
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
|
@@ -83,189 +83,189 @@ struct
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_FINE,
|
||||
T4_WIDTH_R8_A4,
|
||||
2200
|
||||
1100*2
|
||||
},
|
||||
{
|
||||
"R8_77_B4.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_FINE,
|
||||
T4_WIDTH_R8_B4,
|
||||
2400
|
||||
1200*2
|
||||
},
|
||||
{
|
||||
"R8_77_A3.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_FINE,
|
||||
T4_WIDTH_R8_A3,
|
||||
3111
|
||||
1556*2
|
||||
},
|
||||
{
|
||||
"R8_154_A4.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R8_A4,
|
||||
4400
|
||||
1100*4
|
||||
},
|
||||
{
|
||||
"R8_154_B4.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R8_B4,
|
||||
4800
|
||||
1200*4
|
||||
},
|
||||
{
|
||||
"R8_154_A3.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R8_A3,
|
||||
6222
|
||||
1556*4
|
||||
},
|
||||
{
|
||||
"R300_300_A4.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_300,
|
||||
T4_WIDTH_300_A4,
|
||||
4400
|
||||
1100*3
|
||||
},
|
||||
{
|
||||
"R300_300_B4.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_300,
|
||||
T4_WIDTH_300_B4,
|
||||
4800
|
||||
1200*3
|
||||
},
|
||||
{
|
||||
"R300_300_A3.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_300,
|
||||
T4_WIDTH_300_A3,
|
||||
6222
|
||||
1556*3
|
||||
},
|
||||
{
|
||||
"R300_600_A4.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_300_A4,
|
||||
4400
|
||||
1100*6
|
||||
},
|
||||
{
|
||||
"R300_600_B4.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_300_B4,
|
||||
4800
|
||||
1200*6
|
||||
},
|
||||
{
|
||||
"R300_600_A3.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_300_A3,
|
||||
6222
|
||||
1556*6
|
||||
},
|
||||
{
|
||||
"R16_154_A4.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R16_A4,
|
||||
4400
|
||||
1100*4
|
||||
},
|
||||
{
|
||||
"R16_154_B4.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R16_B4,
|
||||
4800
|
||||
1200*4
|
||||
},
|
||||
{
|
||||
"R16_154_A3.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R16_A3,
|
||||
6222
|
||||
1556*4
|
||||
},
|
||||
{
|
||||
"R16_800_A4.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_800,
|
||||
T4_WIDTH_R16_A4,
|
||||
4400
|
||||
1100*8
|
||||
},
|
||||
{
|
||||
"R16_800_B4.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_800,
|
||||
T4_WIDTH_R16_B4,
|
||||
4800
|
||||
1200*8
|
||||
},
|
||||
{
|
||||
"R16_800_A3.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_800,
|
||||
T4_WIDTH_R16_A3,
|
||||
6222
|
||||
1556*8
|
||||
},
|
||||
{
|
||||
"R600_600_A4.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_600_A4,
|
||||
4400
|
||||
1100*6
|
||||
},
|
||||
{
|
||||
"R600_600_B4.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_600_B4,
|
||||
4800
|
||||
1200*6
|
||||
},
|
||||
{
|
||||
"R600_600_A3.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_600_A3,
|
||||
6222
|
||||
1556*6
|
||||
},
|
||||
{
|
||||
"R600_1200_A4.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_600_A4,
|
||||
4400
|
||||
1100*12
|
||||
},
|
||||
{
|
||||
"R600_1200_B4.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_600_B4,
|
||||
4800
|
||||
1200*12
|
||||
},
|
||||
{
|
||||
"R600_1200_A3.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_600_A3,
|
||||
6222
|
||||
1556*12
|
||||
},
|
||||
{
|
||||
"R1200_1200_A4.tif",
|
||||
T4_X_RESOLUTION_1200,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_1200_A4,
|
||||
4400
|
||||
1100*12
|
||||
},
|
||||
{
|
||||
"R1200_1200_B4.tif",
|
||||
T4_X_RESOLUTION_1200,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_1200_B4,
|
||||
4800
|
||||
1200*12
|
||||
},
|
||||
{
|
||||
"R1200_1200_A3.tif",
|
||||
T4_X_RESOLUTION_1200,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_1200_A3,
|
||||
6222
|
||||
1556*12
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
|
@@ -236,14 +236,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Test 1: Mitel's test 1 isn't really a test. Its a calibration step,
|
||||
which has no meaning here. */
|
||||
printf ("Test 1: Calibration\n");
|
||||
printf (" Passed\n");
|
||||
printf("Test 1: Calibration\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 2: Decode check
|
||||
This is a sanity check, that all digits are reliably detected
|
||||
under ideal conditions. Each possible digit is repeated 10 times,
|
||||
with 68ms bursts. The level of each tone is about 6dB down from clip */
|
||||
printf ("Test 2: Decode check\n");
|
||||
printf("Test 2: Decode check\n");
|
||||
my_mf_gen_init(0.0, -3, 0.0, -3, 68, 68);
|
||||
s = ALL_POSSIBLE_DIGITS;
|
||||
digit[1] = '\0';
|
||||
@@ -258,14 +258,14 @@ int main(int argc, char *argv[])
|
||||
actual = bell_mf_rx_get(mf_state, buf, 128);
|
||||
if (actual != 1 || buf[0] != digit[0])
|
||||
{
|
||||
printf (" Sent '%s'\n", digit);
|
||||
printf (" Received '%s' [%d]\n", buf, actual);
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Sent '%s'\n", digit);
|
||||
printf(" Received '%s' [%d]\n", buf, actual);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 3: Recognition bandwidth and channel centre frequency check.
|
||||
Use all digits. Each digit types requires four tests to complete
|
||||
@@ -295,7 +295,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
The spec calls for +-1.5% +-10Hz of bandwidth.
|
||||
*/
|
||||
printf ("Test 3: Recognition bandwidth and channel centre frequency check\n");
|
||||
printf("Test 3: Recognition bandwidth and channel centre frequency check\n");
|
||||
s = ALL_POSSIBLE_DIGITS;
|
||||
digit[1] = '\0';
|
||||
j = 0;
|
||||
@@ -320,7 +320,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
rrb = (float) (nplus + nminus)/10.0;
|
||||
rcfo = (float) (nplus - nminus)/10.0;
|
||||
printf (" %c (low) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
printf(" %c (low) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit[0],
|
||||
rrb,
|
||||
rcfo,
|
||||
@@ -329,8 +329,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (rrb < 3.0 + rcfo + (2.0*100.0*10.0/bell_mf_tones[j].f1) || rrb >= 15.0 + rcfo)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
for (nplus = 0, i = 1; i <= 60; i++)
|
||||
@@ -351,7 +351,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
rrb = (float) (nplus + nminus)/10.0;
|
||||
rcfo = (float) (nplus - nminus)/10.0;
|
||||
printf (" %c (high) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
printf(" %c (high) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit[0],
|
||||
rrb,
|
||||
rcfo,
|
||||
@@ -359,19 +359,19 @@ int main(int argc, char *argv[])
|
||||
(float) nplus/10.0);
|
||||
if (rrb < 3.0 + rcfo + (2.0*100.0*10.0/bell_mf_tones[j].f2) || rrb >= 15.0 + rcfo)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 4: Acceptable amplitude ratio (twist).
|
||||
Twist all digits in both directions, and check the maximum twist
|
||||
we can accept. The way this is done is styled after the Mitel DTMF
|
||||
test, and has good and bad points. */
|
||||
|
||||
printf ("Test 4: Acceptable amplitude ratio (twist)\n");
|
||||
printf("Test 4: Acceptable amplitude ratio (twist)\n");
|
||||
s = ALL_POSSIBLE_DIGITS;
|
||||
digit[1] = '\0';
|
||||
while (*s)
|
||||
@@ -538,12 +538,12 @@ int main(int argc, char *argv[])
|
||||
if (!callback_ok)
|
||||
{
|
||||
printf(" Failed\n");
|
||||
exit (2);
|
||||
exit(2);
|
||||
}
|
||||
printf(" Passed\n");
|
||||
|
||||
duration = time (NULL) - now;
|
||||
printf ("Tests passed in %ds\n", duration);
|
||||
printf("Tests passed in %ds\n", duration);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
@@ -858,6 +858,7 @@ int main(int argc, char *argv[])
|
||||
| T30_SUPPORT_300_600_RESOLUTION
|
||||
| T30_SUPPORT_400_800_RESOLUTION
|
||||
| T30_SUPPORT_600_1200_RESOLUTION);
|
||||
//t30_set_rx_encoding(t30_state[i], T4_COMPRESSION_ITU_T85);
|
||||
t30_set_ecm_capability(t30_state[i], use_ecm);
|
||||
if (use_ecm)
|
||||
{
|
||||
|
@@ -287,6 +287,9 @@ int pcap_scan_pkts(const char *file,
|
||||
fprintf(stderr, "Truncated packet - total len = %d, captured len = %d\n", pkthdr->len, pkthdr->caplen);
|
||||
exit(2);
|
||||
}
|
||||
#if 0
|
||||
printf("%d:%d -> %d:%d\n", ntohl(iphdr->saddr), ntohs(udphdr->source), ntohl(iphdr->daddr), ntohs(udphdr->dest));
|
||||
#endif
|
||||
body = (const uint8_t *) udphdr;
|
||||
body += sizeof(struct udphdr);
|
||||
body_len = pktlen - sizeof(struct udphdr);
|
||||
|
@@ -245,15 +245,15 @@ static int test_a_tone_set(int fwd)
|
||||
/* Test 1: Mitel's test 1 isn't really a test. Its a calibration step,
|
||||
which has no meaning here. */
|
||||
|
||||
printf ("Test 1: Calibration\n");
|
||||
printf (" Passed\n");
|
||||
printf("Test 1: Calibration\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 2: Decode check
|
||||
This is a sanity check, that all digits are reliably detected
|
||||
under ideal conditions. Each possible digit is repeated 10 times,
|
||||
with 68ms bursts. The level of each tone is about 6dB down from clip */
|
||||
|
||||
printf ("Test 2: Decode check\n");
|
||||
printf("Test 2: Decode check\n");
|
||||
my_mf_gen_init(0.0, -3, 0.0, -3, 68, fwd);
|
||||
s = r2_mf_tone_codes;
|
||||
while (*s)
|
||||
@@ -267,14 +267,14 @@ static int test_a_tone_set(int fwd)
|
||||
actual = r2_mf_rx_get(mf_state);
|
||||
if (actual != digit)
|
||||
{
|
||||
printf (" Sent '%c'\n", digit);
|
||||
printf (" Received 0x%X\n", actual);
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Sent '%c'\n", digit);
|
||||
printf(" Received 0x%X\n", actual);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 3: Recognition bandwidth and channel centre frequency check.
|
||||
Use all digits. Each digit types requires four tests to complete
|
||||
@@ -304,7 +304,7 @@ static int test_a_tone_set(int fwd)
|
||||
|
||||
The spec calls for +-4 +-10Hz (ie +-14Hz) of bandwidth. */
|
||||
|
||||
printf ("Test 3: Recognition bandwidth and channel centre frequency check\n");
|
||||
printf("Test 3: Recognition bandwidth and channel centre frequency check\n");
|
||||
s = r2_mf_tone_codes;
|
||||
j = 0;
|
||||
while (*s)
|
||||
@@ -330,7 +330,7 @@ static int test_a_tone_set(int fwd)
|
||||
}
|
||||
rrb = (float) (nplus + nminus)/10.0;
|
||||
rcfo = (float) (nplus - nminus)/10.0;
|
||||
printf (" %c (low) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
printf(" %c (low) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit,
|
||||
rrb,
|
||||
rcfo,
|
||||
@@ -339,8 +339,8 @@ static int test_a_tone_set(int fwd)
|
||||
|
||||
if (rrb < rcfo + (2.0*100.0*14.0/r2_mf_fwd_tones[j].f1) || rrb >= 15.0 + rcfo)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
for (nplus = 0, i = 1; i <= 60; i++)
|
||||
@@ -363,7 +363,7 @@ static int test_a_tone_set(int fwd)
|
||||
}
|
||||
rrb = (float) (nplus + nminus)/10.0;
|
||||
rcfo = (float) (nplus - nminus)/10.0;
|
||||
printf (" %c (high) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
printf(" %c (high) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit,
|
||||
rrb,
|
||||
rcfo,
|
||||
@@ -371,19 +371,19 @@ static int test_a_tone_set(int fwd)
|
||||
(float) nplus/10.0);
|
||||
if (rrb < rcfo + (2.0*100.0*14.0/r2_mf_fwd_tones[j].f2) || rrb >= 15.0 + rcfo)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 4: Acceptable amplitude ratio (twist).
|
||||
Twist all digits in both directions, and check the maximum twist
|
||||
we can accept. The way this is done is styled after the Mitel DTMF
|
||||
test, and has good and bad points. */
|
||||
|
||||
printf ("Test 4: Acceptable amplitude ratio (twist)\n");
|
||||
printf("Test 4: Acceptable amplitude ratio (twist)\n");
|
||||
s = r2_mf_tone_codes;
|
||||
while (*s)
|
||||
{
|
||||
@@ -398,11 +398,11 @@ static int test_a_tone_set(int fwd)
|
||||
if (r2_mf_rx_get(mf_state) == digit)
|
||||
nplus++;
|
||||
}
|
||||
printf (" %c normal twist = %.2fdB\n", digit, (float) nplus/10.0);
|
||||
printf(" %c normal twist = %.2fdB\n", digit, (float) nplus/10.0);
|
||||
if (nplus < 70)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
for (nminus = 0, i = -50; i >= -250; i--)
|
||||
{
|
||||
@@ -414,21 +414,21 @@ static int test_a_tone_set(int fwd)
|
||||
if (r2_mf_rx_get(mf_state) == digit)
|
||||
nminus++;
|
||||
}
|
||||
printf (" %c reverse twist = %.2fdB\n", digit, (float) nminus/10.0);
|
||||
printf(" %c reverse twist = %.2fdB\n", digit, (float) nminus/10.0);
|
||||
if (nminus < 70)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 5: Dynamic range
|
||||
This test sends all possible digits, with gradually increasing
|
||||
amplitude. We determine the span over which we achieve reliable
|
||||
detection. */
|
||||
|
||||
printf ("Test 5: Dynamic range\n");
|
||||
printf("Test 5: Dynamic range\n");
|
||||
for (nplus = nminus = -1000, i = -50; i <= 3; i++)
|
||||
{
|
||||
s = r2_mf_tone_codes;
|
||||
@@ -458,19 +458,19 @@ static int test_a_tone_set(int fwd)
|
||||
nminus = i;
|
||||
}
|
||||
}
|
||||
printf (" Dynamic range = %ddB to %ddB\n", nplus, nminus - 1);
|
||||
printf(" Dynamic range = %ddB to %ddB\n", nplus, nminus - 1);
|
||||
if (nplus > -35 || nminus <= -5)
|
||||
{
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 6: Guard time
|
||||
This test sends all possible digits, with a gradually reducing
|
||||
duration. */
|
||||
|
||||
printf ("Test 6: Guard time\n");
|
||||
printf("Test 6: Guard time\n");
|
||||
for (i = 30; i < 62; i++)
|
||||
{
|
||||
s = r2_mf_tone_codes;
|
||||
@@ -493,19 +493,19 @@ static int test_a_tone_set(int fwd)
|
||||
if (j == 500)
|
||||
break;
|
||||
}
|
||||
printf (" Guard time = %dms\n", i);
|
||||
printf(" Guard time = %dms\n", i);
|
||||
if (i > 61)
|
||||
{
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 7: Acceptable signal to noise ratio
|
||||
We send all possible digits at -6dBm from clip, mixed with AWGN.
|
||||
We gradually reduce the noise until we get clean detection. */
|
||||
|
||||
printf ("Test 7: Acceptable signal to noise ratio\n");
|
||||
printf("Test 7: Acceptable signal to noise ratio\n");
|
||||
my_mf_gen_init(0.0, -3, 0.0, -3, 68, fwd);
|
||||
for (i = -3; i > -50; i--)
|
||||
{
|
||||
@@ -563,7 +563,7 @@ static int test_a_tone_set(int fwd)
|
||||
if (!callback_ok)
|
||||
{
|
||||
printf(" Failed\n");
|
||||
exit (2);
|
||||
exit(2);
|
||||
}
|
||||
printf(" Passed\n");
|
||||
|
||||
@@ -587,7 +587,7 @@ int main(int argc, char *argv[])
|
||||
printf("R2 backward tones\n");
|
||||
test_a_tone_set(FALSE);
|
||||
duration = time(NULL) - now;
|
||||
printf ("Tests passed in %lds\n", duration);
|
||||
printf("Tests passed in %lds\n", duration);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
@@ -287,7 +287,7 @@ int main(int argc, char *argv[])
|
||||
||
|
||||
saturated_mul16_32(32767, 32767) != 2147352578
|
||||
||
|
||||
saturated_mul16_32(-32768, -32768) != -2147483648)
|
||||
saturated_mul16_32(-32768, -32768) != INT32_MAX)
|
||||
{
|
||||
printf("Test failed.\n");
|
||||
exit(2);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2005 Steve Underwood
|
||||
* Copyright (C) 2005, 2009, 2012 Steve Underwood
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -381,6 +381,8 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
|
||||
int len;
|
||||
int limit;
|
||||
int high_tide;
|
||||
int len_before_entries;
|
||||
int previous_len;
|
||||
|
||||
/* UDPTL cannot cope with zero length messages, and our buffering for redundancy limits their
|
||||
maximum length. */
|
||||
@@ -425,16 +427,28 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
|
||||
entries = s->error_correction_entries;
|
||||
else
|
||||
entries = s->tx_seq_no;
|
||||
len_before_entries = len;
|
||||
/* The number of entries will always be small, so it is pointless allowing
|
||||
for the fragmented case here. */
|
||||
if (encode_length(buf, &len, entries) < 0)
|
||||
return -1;
|
||||
/* Encode the elements */
|
||||
for (i = 0; i < entries; i++)
|
||||
for (m = 0; m < entries; m++)
|
||||
{
|
||||
j = (entry - i - 1) & UDPTL_BUF_MASK;
|
||||
previous_len = len;
|
||||
j = (entry - m - 1) & UDPTL_BUF_MASK;
|
||||
if (encode_open_type(buf, &len, s->tx[j].buf, s->tx[j].buf_len) < 0)
|
||||
return -1;
|
||||
|
||||
/* If we have exceeded the far end's max datagram size, don't include this last chunk,
|
||||
and stop trying to add more. */
|
||||
if (len > s->far_max_datagram_size)
|
||||
{
|
||||
len = previous_len;
|
||||
if (encode_length(buf, &len_before_entries, m) < 0)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UDPTL_ERROR_CORRECTION_FEC:
|
||||
@@ -455,9 +469,11 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
|
||||
buf[len++] = span;
|
||||
/* The number of entries is defined as a length, but will only ever be a small
|
||||
value. Treat it as such. */
|
||||
len_before_entries = len;
|
||||
buf[len++] = entries;
|
||||
for (m = 0; m < entries; m++)
|
||||
{
|
||||
previous_len = len;
|
||||
/* Make an XOR'ed entry the maximum length */
|
||||
limit = (entry + m) & UDPTL_BUF_MASK;
|
||||
high_tide = 0;
|
||||
@@ -479,6 +495,15 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
|
||||
}
|
||||
if (encode_open_type(buf, &len, fec, high_tide) < 0)
|
||||
return -1;
|
||||
|
||||
/* If we have exceeded the far end's max datagram size, don't include this last chunk,
|
||||
and stop trying to add more. */
|
||||
if (len > s->far_max_datagram_size)
|
||||
{
|
||||
len = previous_len;
|
||||
buf[len_before_entries] = (uint8_t) m;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -373,7 +373,6 @@ int main(int argc, char *argv[])
|
||||
bert_set_report(&endpoint[i].bert_rx, 10000, reporter, &endpoint[i]);
|
||||
}
|
||||
|
||||
|
||||
#if defined(ENABLE_GUI)
|
||||
if (use_gui)
|
||||
{
|
||||
|
Reference in New Issue
Block a user