Lots of little cosmetic cleanups

This commit is contained in:
Steve Underwood
2013-03-14 21:22:51 +08:00
parent 16289ce9a4
commit d163c6338e
110 changed files with 7259 additions and 762 deletions

View File

@@ -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>

View File

@@ -274,7 +274,8 @@ extern "C"
__inline float rintf(float flt)
{
_asm
{ fld flt
{
fld flt
frndint
}
}

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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 --------------------------------------------------------*/

View File

@@ -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 --------------------------------------------------------*/

View File

@@ -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)

View File

@@ -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,

View File

@@ -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)
{

View File

@@ -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);

View File

@@ -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);

View File

@@ -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

View File

@@ -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)
{