提交 da557fd6 authored 作者: Michael Jerris's avatar Michael Jerris

update to snapshot spandsp-20090220

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12190 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 65181f78
......@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t4.h,v 1.3 2009/02/16 09:57:22 steveu Exp $
* $Id: t4.h,v 1.4 2009/02/20 12:34:20 steveu Exp $
*/
#if !defined(_SPANDSP_PRIVATE_T4_H_)
......@@ -107,7 +107,7 @@ struct t4_state_s
int stop_page;
/*! \brief The number of pages transferred to date. */
int pages_transferred;
int current_page;
/*! \brief The number of pages in the current image file. */
int pages_in_file;
/*! \brief Column-to-column (X) resolution in pixels per metre. */
......
......@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t30.h,v 1.123 2009/02/04 13:18:53 steveu Exp $
* $Id: t30.h,v 1.124 2009/02/20 12:34:20 steveu Exp $
*/
/*! \file */
......@@ -515,8 +515,10 @@ typedef struct
int bit_rate;
/*! \brief TRUE if error correcting mode is used. */
int error_correcting_mode;
/*! \brief The number of pages transferred so far. */
int pages_transferred;
/*! \brief The number of pages sent so far. */
int pages_tx;
/*! \brief The number of pages received so far. */
int pages_rx;
/*! \brief The number of pages in the file (<0 if not known). */
int pages_in_file;
/*! \brief The horizontal column-to-column resolution of the page, in pixels per metre */
......
......@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t4.h,v 1.57 2009/02/10 13:06:47 steveu Exp $
* $Id: t4.h,v 1.58 2009/02/20 12:34:20 steveu Exp $
*/
/*! \file */
......@@ -323,11 +323,14 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s);
\return zero for success, -1 for failure. */
SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s);
/*! \brief Check for the existance of the next page. This information can
be needed before it is determined that the current page is finished with.
/*! \brief Check for the existance of the next page, and whether its format is like the
current one. This information can be needed before it is determined that the current
page is finished with.
\param s The T.4 context.
\return zero for next page found, -1 for failure. */
SPAN_DECLARE(int) t4_tx_more_pages(t4_state_t *s);
\return 0 for next page found with the same format as the current page.
1 for next page found with different format from the current page.
-1 for no page found, or file failure. */
SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s);
/*! \brief Complete the sending of a page.
\param s The T.4 context.
......@@ -435,6 +438,11 @@ SPAN_DECLARE(int) t4_tx_get_image_width(t4_state_t *s);
\return The number of pages, or -1 if there is an error. */
SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s);
/*! \brief Get the currnet page number in the file.
\param s The T.4 context.
\return The page number, or -1 if there is an error. */
SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s);
/*! Get the current image transfer statistics.
\brief Get the current transfer statistics.
\param s The T.4 context.
......
......@@ -30,8 +30,8 @@
/* The date and time of the version are in UTC form. */
#define SPANDSP_RELEASE_DATE 20090216
#define SPANDSP_RELEASE_TIME 100031
#define SPANDSP_RELEASE_DATE 20090220
#define SPANDSP_RELEASE_TIME 124309
#endif
/*- End of file ------------------------------------------------------------*/
......@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t30.c,v 1.285 2009/02/10 13:06:46 steveu Exp $
* $Id: t30.c,v 1.286 2009/02/20 12:34:20 steveu Exp $
*/
/*! \file */
......@@ -469,7 +469,9 @@ static int copy_quality(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Image resolution = %d/m x %d/m\n", stats.x_resolution, stats.y_resolution);
span_log(&s->logging, SPAN_LOG_FLOW, "Bad rows = %d\n", stats.bad_rows);
span_log(&s->logging, SPAN_LOG_FLOW, "Longest bad row run = %d\n", stats.longest_bad_row_run);
if (stats.bad_rows == 0)
/* Don't treat a page as perfect because it has zero bad rows out of zero total rows. A zero row
page has got to be some kind of total page failure. */
if (stats.bad_rows == 0 && stats.length != 0)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Page quality is perfect\n");
quality = T30_COPY_QUALITY_PERFECT;
......@@ -587,10 +589,21 @@ static void release_resources(t30_state_t *s)
static uint8_t check_next_tx_step(t30_state_t *s)
{
int res;
int more;
if (t4_tx_more_pages(&(s->t4)) == 0)
res = t4_tx_next_page_has_different_format(&(s->t4));
if (res == 0)
{
span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with the same format\n");
return (s->local_interrupt_pending) ? T30_PRI_MPS : T30_MPS;
}
if (res > 0)
{
span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with a different format\n");
s->tx_start_page = t4_tx_get_current_page_in_file(&(s->t4)) + 1;
return (s->local_interrupt_pending) ? T30_PRI_EOM : T30_EOM;
}
/* Call a user handler, if one is set, to check if another document is to be sent.
If so, we send an EOM, rather than an EOP. Then we will renegotiate, and the new
document will begin. */
......@@ -5778,7 +5791,8 @@ SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t)
t->error_correcting_mode = s->error_correcting_mode;
t->error_correcting_mode_retries = s->error_correcting_mode_retries;
t4_get_transfer_statistics(&s->t4, &stats);
t->pages_transferred = stats.pages_transferred;
t->pages_tx = s->ecm_tx_page;
t->pages_rx = s->ecm_rx_page;
t->pages_in_file = stats.pages_in_file;
t->width = stats.width;
t->length = stats.length;
......@@ -5833,6 +5847,7 @@ SPAN_DECLARE(int) t30_restart(t30_state_t *s)
s->far_end_detected = FALSE;
s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T0);
release_resources(s);
/* The ECM page number is only reset at call establishment */
s->ecm_rx_page = 0;
s->ecm_tx_page = 0;
return 0;
......
差异被折叠。
......@@ -16,30 +16,33 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Id: Makefile.am,v 1.2 2008/09/10 16:55:15 steveu Exp $
## $Id: Makefile.am,v 1.3 2009/02/20 12:34:20 steveu Exp $
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
PBM2G3 = pbmtog3
FAX2TIFF = fax2tiff
TIFFCP = tiffcp
ETSI_TEST_PAGES = etsi_300_242_a4_diago1.tif \
etsi_300_242_a4_diago2.tif \
etsi_300_242_a4_duration1.tif \
etsi_300_242_a4_duration2.tif \
etsi_300_242_a4_error.tif \
etsi_300_242_a4_impress.tif \
etsi_300_242_a4_impress_white.tif \
etsi_300_242_a4_stairstep.tif \
etsi_300_242_a4_white.tif \
etsi_300_242_a4_white_2p.tif
EXTRA_DIST =
nobase_data_DATA = etsi_300_242_a4_diago1.tif \
etsi_300_242_a4_diago2.tif \
etsi_300_242_a4_duration1.tif \
etsi_300_242_a4_duration2.tif \
etsi_300_242_a4_error.tif \
etsi_300_242_a4_impress.tif \
etsi_300_242_a4_impress_white.tif \
etsi_300_242_a4_stairstep.tif \
etsi_300_242_a4_white.tif \
etsi_300_242_a4_white_2p.tif
nobase_data_DATA = ${ETSI_TEST_PAGES}
noinst_PROGRAMS = generate_etsi_300_242_pages
noinst_PROGRAMS = generate_etsi_300_242_pages
generate_etsi_300_242_pages_SOURCES = generate_etsi_300_242_pages.c
generate_etsi_300_242_pages_LDADD = -ltiff
generate_etsi_300_242_pages_LDADD = -lspandsp -ltiff
clean:
rm -f *.tif *.g3
......@@ -50,14 +53,5 @@ clean:
.pbm.g3:
${PBM2G3} $*.pbm >$*.g3
etsi_300_242_a4_diago1.tif \
etsi_300_242_a4_diago2.tif \
etsi_300_242_a4_duration1.tif \
etsi_300_242_a4_duration2.tif \
etsi_300_242_a4_error.tif \
etsi_300_242_a4_impress.tif \
etsi_300_242_a4_impress_white.tif \
etsi_300_242_a4_stairstep.tif \
etsi_300_242_a4_white.tif \
etsi_300_242_a4_white_2p.tif: generate_etsi_300_242_pages$(EXEEXT)
${ETSI_TEST_PAGES}: generate_etsi_300_242_pages$(EXEEXT)
./generate_etsi_300_242_pages$(EXEEXT)
......@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: generate_etsi_300_242_pages.c,v 1.2 2008/09/10 16:55:15 steveu Exp $
* $Id: generate_etsi_300_242_pages.c,v 1.3 2009/02/20 12:34:20 steveu Exp $
*/
/*! \file */
......@@ -177,6 +177,9 @@ struct
},
};
int reverse_photo_metric = FALSE;
int reverse_fill_order = FALSE;
static void clear_row(uint8_t buf[], int width)
{
memset(buf, 0, width/8 + 1);
......@@ -245,6 +248,7 @@ static int create_stairstep_page(TIFF *tiff_file)
uint8_t image_buffer[8192];
int row;
int start_pixel;
int i;
/* TSB-85 STAIRSTEP page. */
start_pixel = 0;
......@@ -252,6 +256,13 @@ static int create_stairstep_page(TIFF *tiff_file)
{
clear_row(image_buffer, 1728);
set_pixel_range(image_buffer, 1, start_pixel, start_pixel + 63);
if (reverse_photo_metric)
{
for (i = 0; i < 1728/8; i++)
image_buffer[i] = ~image_buffer[i];
}
if (reverse_fill_order)
bit_reverse(image_buffer, image_buffer, 1728/8);
if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
{
printf("Write error at row %d.\n", row);
......@@ -571,9 +582,14 @@ int main(int argc, char *argv[])
TIFFSetField(tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, -1L);
TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
TIFFSetField(tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
if (reverse_photo_metric)
TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
else
TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
if (reverse_fill_order)
TIFFSetField(tiff_file, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
else
TIFFSetField(tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
x_resolution = sequence[i].x_res/100.0f;
y_resolution = sequence[i].y_res/100.0f;
TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*2.54f + 0.5f));
......
......@@ -16,72 +16,93 @@
## License along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Id: Makefile.am,v 1.3 2008/05/03 13:05:04 steveu Exp $
## $Id: Makefile.am,v 1.4 2009/02/20 12:34:20 steveu Exp $
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
PBM2G3 = pbmtog3
FAX2TIFF = fax2tiff
TIFFCP = tiffcp
EXTRA_DIST = itu1.pbm \
itu2.pbm \
itu3.pbm \
itu4.pbm \
itu5.pbm \
itu6.pbm \
itu7.pbm \
itu8.pbm \
test1.pbm \
test2.pbm \
test3.pbm \
test4.pbm
ITU_TEST_PAGES_PBM = itu1.pbm \
itu2.pbm \
itu3.pbm \
itu4.pbm \
itu5.pbm \
itu6.pbm \
itu7.pbm \
itu8.pbm \
test1.pbm \
test2.pbm \
test3.pbm \
test4.pbm
ITU_TEST_PAGES_G3 = itu1.g3 \
itu2.g3 \
itu3.g3 \
itu4.g3 \
itu5.g3 \
itu6.g3 \
itu7.g3 \
itu8.g3 \
test1.g3 \
test2.g3 \
test3.g3 \
test4.g3
ITU_TEST_PAGES = itu1.tif \
itu2.tif \
itu3.tif \
itu4.tif \
itu5.tif \
itu6.tif \
itu7.tif \
itu8.tif \
test1.tif \
test2.tif \
test3.tif \
test4.tif
MIXED_SIZE_PAGES = R1200_1200_A4.tif \
R1200_1200_B4.tif \
R1200_1200_A3.tif \
R600_1200_A4.tif \
R600_1200_B4.tif \
R600_1200_A3.tif \
R600_600_A4.tif \
R600_600_B4.tif \
R600_600_A3.tif \
R16_800_A4.tif \
R16_800_B4.tif \
R16_800_A3.tif \
R16_154_A4.tif \
R16_154_B4.tif \
R16_154_A3.tif \
R300_600_A4.tif \
R300_600_B4.tif \
R300_600_A3.tif \
R300_300_A4.tif \
R300_300_B4.tif \
R300_300_A3.tif \
R8_154_A4.tif \
R8_154_B4.tif \
R8_154_A3.tif \
R8_77_A4.tif \
R8_77_B4.tif \
R8_77_A3.tif \
R8_385_A4.tif \
R8_385_B4.tif \
R8_385_A3.tif
EXTRA_DIST = ${ITU_TEST_PAGES_PBM}
nobase_data_DATA = itutests.tif \
itu1.tif \
itu2.tif \
itu3.tif \
itu4.tif \
itu5.tif \
itu6.tif \
itu7.tif \
itu8.tif \
test1.tif \
test2.tif \
test3.tif \
test4.tif \
${ITU_TEST_PAGES} \
dithered.tif \
100pages.tif \
R1200_1200_A4.tif \
R1200_1200_B4.tif \
R1200_1200_A3.tif \
R600_1200_A4.tif \
R600_1200_B4.tif \
R600_1200_A3.tif \
R600_600_A4.tif \
R600_600_B4.tif \
R600_600_A3.tif \
R16_800_A4.tif \
R16_800_B4.tif \
R16_800_A3.tif \
R16_154_A3.tif \
R16_154_A4.tif \
R16_154_B4.tif \
R300_600_A4.tif \
R300_600_B4.tif \
R300_600_A3.tif \
R300_300_A4.tif \
R300_300_B4.tif \
R300_300_A3.tif \
R8_154_A3.tif \
R8_154_A4.tif \
R8_154_B4.tif \
R8_77_A3.tif \
R8_77_A4.tif \
R8_77_B4.tif \
R8_385_A3.tif \
R8_385_A4.tif \
R8_385_B4.tif
${MIXED_SIZE_PAGES} \
mixed_size_pages.tif
noinst_PROGRAMS = generate_dithered_tif \
generate_sized_pages
......@@ -95,22 +116,19 @@ generate_sized_pages_LDADD = -ltiff
clean:
rm -f *.tif *.g3
itutests.tif: itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 \
test1.g3 test2.g3 test3.g3 test4.g3
$(FAX2TIFF) -M -o $@ itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 \
test1.g3 test2.g3 test3.g3 test4.g3
itutests.tif: ${ITU_TEST_PAGES_G3}
$(FAX2TIFF) -M -o $@ ${ITU_TEST_PAGES_G3}
100pages.tif: itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 \
test1.g3 test2.g3 test3.g3 test4.g3
100pages.tif: ${ITU_TEST_PAGES_G3}
$(FAX2TIFF) -M -o $@ \
itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 test1.g3 test2.g3 test3.g3 test4.g3 \
${ITU_TEST_PAGES_G3} \
${ITU_TEST_PAGES_G3} \
${ITU_TEST_PAGES_G3} \
${ITU_TEST_PAGES_G3} \
${ITU_TEST_PAGES_G3} \
${ITU_TEST_PAGES_G3} \
${ITU_TEST_PAGES_G3} \
${ITU_TEST_PAGES_G3} \
itu1.g3 itu2.g3 itu3.g3 itu4.g3
.g3.tif:
......@@ -122,34 +140,8 @@ itutests.tif: itu1.g3 itu2.g3 itu3.g3 itu4.g3 itu5.g3 itu6.g3 itu7.g3 itu8.g3 \
dithered.tif: generate_dithered_tif$(EXEEXT)
./generate_dithered_tif$(EXEEXT)
R1200_1200_A4.tif \
R1200_1200_B4.tif \
R1200_1200_A3.tif \
R600_1200_A4.tif \
R600_1200_B4.tif \
R600_1200_A3.tif \
R600_600_A4.tif \
R600_600_B4.tif \
R600_600_A3.tif \
R16_800_A4.tif \
R16_800_B4.tif \
R16_800_A3.tif \
R16_154_A3.tif \
R16_154_A4.tif \
R16_154_B4.tif \
R300_600_A4.tif \
R300_600_B4.tif \
R300_600_A3.tif \
R300_300_A4.tif \
R300_300_B4.tif \
R300_300_A3.tif \
R8_154_A3.tif \
R8_154_A4.tif \
R8_154_B4.tif \
R8_77_A3.tif \
R8_77_A4.tif \
R8_77_B4.tif \
R8_385_A3.tif \
R8_385_A4.tif \
R8_385_B4.tif: generate_sized_pages$(EXEEXT)
${MIXED_SIZE_PAGES}: generate_sized_pages$(EXEEXT)
./generate_sized_pages$(EXEEXT)
mixed_size_pages.tif: ${MIXED_SIZE_PAGES}
$(TIFFCP) ${MIXED_SIZE_PAGES} $@
......@@ -16,7 +16,7 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Id: Makefile.am,v 1.109 2009/01/30 05:35:18 steveu Exp $
## $Id: Makefile.am,v 1.110 2009/02/20 12:34:20 steveu Exp $
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
......@@ -165,7 +165,7 @@ echo_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspand
fax_decode_SOURCES = fax_decode.c
fax_decode_LDADD = $(LIBDIR) -lspandsp
fax_tests_SOURCES = fax_tests.c
fax_tests_SOURCES = fax_tests.c fax_utils.c
fax_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
fsk_tests_SOURCES = fsk_tests.c
......@@ -255,25 +255,25 @@ super_tone_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR
t4_tests_SOURCES = t4_tests.c
t4_tests_LDADD = $(LIBDIR) -lspandsp
t31_tests_SOURCES = t31_tests.c media_monitor.cpp
t31_tests_SOURCES = t31_tests.c fax_utils.c media_monitor.cpp
t31_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
t38_core_tests_SOURCES = t38_core_tests.c
t38_core_tests_LDADD = $(LIBDIR) -lspandsp
t38_gateway_tests_SOURCES = t38_gateway_tests.c media_monitor.cpp
t38_gateway_tests_SOURCES = t38_gateway_tests.c fax_utils.c media_monitor.cpp
t38_gateway_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
t38_gateway_to_terminal_tests_SOURCES = t38_gateway_to_terminal_tests.c media_monitor.cpp
t38_gateway_to_terminal_tests_SOURCES = t38_gateway_to_terminal_tests.c fax_utils.c media_monitor.cpp
t38_gateway_to_terminal_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
t38_non_ecm_buffer_tests_SOURCES = t38_non_ecm_buffer_tests.c
t38_non_ecm_buffer_tests_LDADD = $(LIBDIR) -lspandsp
t38_terminal_tests_SOURCES = t38_terminal_tests.c media_monitor.cpp
t38_terminal_tests_SOURCES = t38_terminal_tests.c fax_utils.c media_monitor.cpp
t38_terminal_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
t38_terminal_to_gateway_tests_SOURCES = t38_terminal_to_gateway_tests.c media_monitor.cpp
t38_terminal_to_gateway_tests_SOURCES = t38_terminal_to_gateway_tests.c fax_utils.c media_monitor.cpp
t38_terminal_to_gateway_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
time_scale_tests_SOURCES = time_scale_tests.c
......@@ -285,7 +285,7 @@ tone_detect_tests_LDADD = $(LIBDIR) -lspandsp
tone_generate_tests_SOURCES = tone_generate_tests.c
tone_generate_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
tsb85_tests_SOURCES = tsb85_tests.c fax_tester.c
tsb85_tests_SOURCES = tsb85_tests.c fax_utils.c fax_tester.c
tsb85_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
v17_tests_SOURCES = v17_tests.c line_model_monitor.cpp modem_monitor.cpp
......
......@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: fax_tests.c,v 1.100 2009/01/03 14:44:15 steveu Exp $
* $Id: fax_tests.c,v 1.101 2009/02/20 12:34:20 steveu Exp $
*/
/*! \page fax_tests_page FAX tests
......@@ -48,6 +48,8 @@
#include "spandsp.h"
#include "spandsp-sim.h"
#include "fax_utils.h"
#define SAMPLES_PER_CHUNK 160
#define INPUT_TIFF_FILE_NAME "../test-data/itu/fax/itutests.tif"
......@@ -77,22 +79,12 @@ int t30_state_to_wreck = -1;
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
{
int i;
const char *u;
i = (intptr_t) user_data;
if ((u = t30_get_rx_ident(s)))
printf("%d: Phase B: remote ident '%s'\n", i, u);
if ((u = t30_get_rx_sub_address(s)))
printf("%d: Phase B: remote sub-address '%s'\n", i, u);
if ((u = t30_get_rx_polled_sub_address(s)))
printf("%d: Phase B: remote polled sub-address '%s'\n", i, u);
if ((u = t30_get_rx_selective_polling_address(s)))
printf("%d: Phase B: remote selective polling address '%s'\n", i, u);
if ((u = t30_get_rx_sender_ident(s)))
printf("%d: Phase B: remote sender ident '%s'\n", i, u);
if ((u = t30_get_rx_password(s)))
printf("%d: Phase B: remote password '%s'\n", i, u);
printf("%d: Phase B handler on channel %d - (0x%X) %s\n", i, i, result, t30_frametype(result));
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase B:", i);
printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
......@@ -100,31 +92,14 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result)
static int phase_d_handler(t30_state_t *s, void *user_data, int result)
{
int i;
t30_stats_t t;
const char *u;
i = (intptr_t) user_data;
t30_get_transfer_statistics(s, &t);
char tag[20];
printf("%d: Phase D handler on channel %d - (0x%X) %s\n", i, i, result, t30_frametype(result));
printf("%d: Phase D: bit rate %d\n", i, t.bit_rate);
printf("%d: Phase D: ECM %s\n", i, (t.error_correcting_mode) ? "on" : "off");
printf("%d: Phase D: pages transferred %d\n", i, t.pages_transferred);
printf("%d: Phase D: pages in the file %d\n", i, t.pages_in_file);
printf("%d: Phase D: image size %d x %d\n", i, t.width, t.length);
printf("%d: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
printf("%d: Phase D: bad rows %d\n", i, t.bad_rows);
printf("%d: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
printf("%d: Phase D: bad ECM frames %d\n", i, t.error_correcting_mode_retries);
printf("%d: Phase D: compression type %d\n", i, t.encoding);
printf("%d: Phase D: image size %d bytes\n", i, t.image_size);
if ((u = t30_get_tx_ident(s)))
printf("%d: Phase D: local ident '%s'\n", i, u);
if ((u = t30_get_rx_ident(s)))
printf("%d: Phase D: remote ident '%s'\n", i, u);
#if defined(WITH_SPANDSP_INTERNALS)
printf("%d: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
#endif
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D:", i);
printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
log_transfer_statistics(s, tag);
log_tx_parameters(s, tag);
log_rx_parameters(s, tag);
if (use_receiver_not_ready)
t30_set_receiver_not_ready(s, 3);
......@@ -160,34 +135,17 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
{
int i;
t30_stats_t t;
const char *u;
char tag[20];
i = (intptr_t) user_data;
printf("%d: Phase E handler on channel %d - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
snprintf(tag, sizeof(tag), "%c: Phase E:", i);
printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
log_transfer_statistics(s, tag);
log_tx_parameters(s, tag);
log_rx_parameters(s, tag);
t30_get_transfer_statistics(s, &t);
printf("%d: Phase E: bit rate %d\n", i, t.bit_rate);
printf("%d: Phase E: ECM %s\n", i, (t.error_correcting_mode) ? "on" : "off");
printf("%d: Phase E: pages transferred %d\n", i, t.pages_transferred);
printf("%d: Phase E: pages in the file %d\n", i, t.pages_in_file);
printf("%d: Phase E: image size %d x %d\n", i, t.width, t.length);
printf("%d: Phase E: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
printf("%d: Phase E: bad rows %d\n", i, t.bad_rows);
printf("%d: Phase E: longest bad row run %d\n", i, t.longest_bad_row_run);
printf("%d: Phase E: bad ECM frames %d\n", i, t.error_correcting_mode_retries);
printf("%d: Phase E: coding method %s\n", i, t4_encoding_to_str(t.encoding));
printf("%d: Phase E: image size %d bytes\n", i, t.image_size);
if ((u = t30_get_tx_ident(s)))
printf("%d: Phase E: local ident '%s'\n", i, u);
if ((u = t30_get_rx_ident(s)))
printf("%d: Phase E: remote ident '%s'\n", i, u);
if ((u = t30_get_rx_country(s)))
printf("%d: Phase E: Remote was made in '%s'\n", i, u);
if ((u = t30_get_rx_vendor(s)))
printf("%d: Phase E: Remote was made by '%s'\n", i, u);
if ((u = t30_get_rx_model(s)))
printf("%d: Phase E: Remote is model '%s'\n", i, u);
machines[i].succeeded = (result == T30_ERR_OK) && (t.pages_transferred == 12);
machines[i].done = TRUE;
machines[i - 'A'].succeeded = (result == T30_ERR_OK) && (t.pages_tx == 12 || t.pages_rx == 12);
machines[i - 'A'].done = TRUE;
}
/*- End of function --------------------------------------------------------*/
......@@ -200,7 +158,7 @@ static void real_time_frame_handler(t30_state_t *s,
int i;
i = (intptr_t) user_data;
printf("%d: Real time frame handler on channel %d - %s, %s, length = %d\n",
printf("%c: Real time frame handler on channel %c - %s, %s, length = %d\n",
i,
i,
(direction) ? "line->T.30" : "T.30->line",
......@@ -214,7 +172,7 @@ static int document_handler(t30_state_t *s, void *user_data, int event)
int i;
i = (intptr_t) user_data;
printf("%d: Document handler on channel %d - event %d\n", i, i, event);
printf("%c: Document handler on channel %c - event %d\n", i, i, event);
return FALSE;
}
/*- End of function --------------------------------------------------------*/
......@@ -419,6 +377,7 @@ int main(int argc, char *argv[])
{
sprintf(buf, "fax_tests_%d.tif", (mc->chan + 1)/2);
t30_set_rx_file(t30, buf, -1);
t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T6);
}
}
else
......@@ -427,6 +386,7 @@ int main(int argc, char *argv[])
{
sprintf(buf, "fax_tests_%d.tif", (mc->chan + 1)/2);
t30_set_rx_file(t30, buf, -1);
t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T6);
}
else
{
......@@ -436,16 +396,18 @@ int main(int argc, char *argv[])
t30_set_tx_file(t30, input_tiff_file_name, -1, -1);
}
}
t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) mc->chan);
t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) mc->chan);
t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) mc->chan);
t30_set_real_time_frame_handler(t30, real_time_frame_handler, (void *) (intptr_t) mc->chan);
t30_set_document_handler(t30, document_handler, (void *) (intptr_t) mc->chan);
t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) mc->chan + 'A');
t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) mc->chan + 'A');
t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) mc->chan + 'A');
t30_set_real_time_frame_handler(t30, real_time_frame_handler, (void *) (intptr_t) mc->chan + 'A');
t30_set_document_handler(t30, document_handler, (void *) (intptr_t) mc->chan + 'A');
sprintf(mc->tag, "FAX-%d", j + 1);
logging = t30_get_logging_state(t30);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
span_log_set_tag(logging, mc->tag);
span_log_set_level(&t30->t4.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
span_log_set_tag(&t30->t4.logging, mc->tag);
logging = fax_get_logging_state(mc->fax);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
......
/*
* SpanDSP - a series of DSP components for telephony
*
* fax_utils.c
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2009 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: fax_utils.c,v 1.1 2009/02/20 12:34:20 steveu Exp $
*/
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <audiofile.h>
//#if defined(WITH_SPANDSP_INTERNALS)
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
//#endif
#include "spandsp.h"
#include "spandsp-sim.h"
#include "fax_utils.h"
void log_tx_parameters(t30_state_t *s, const char *tag)
{
const char *u;
if ((u = t30_get_tx_ident(s)))
printf("%s: Local ident '%s'\n", tag, u);
if ((u = t30_get_tx_sub_address(s)))
printf("%s: Local sub-address '%s'\n", tag, u);
if ((u = t30_get_tx_polled_sub_address(s)))
printf("%s: Local polled sub-address '%s'\n", tag, u);
if ((u = t30_get_tx_selective_polling_address(s)))
printf("%s: Local selective polling address '%s'\n", tag, u);
if ((u = t30_get_tx_sender_ident(s)))
printf("%s: Local sender ident '%s'\n", tag, u);
if ((u = t30_get_tx_password(s)))
printf("%s: Local password '%s'\n", tag, u);
}
/*- End of function --------------------------------------------------------*/
void log_rx_parameters(t30_state_t *s, const char *tag)
{
const char *u;
if ((u = t30_get_rx_ident(s)))
printf("%s: Remote ident '%s'\n", tag, u);
if ((u = t30_get_rx_sub_address(s)))
printf("%s: Remote sub-address '%s'\n", tag, u);
if ((u = t30_get_rx_polled_sub_address(s)))
printf("%s: Remote polled sub-address '%s'\n", tag, u);
if ((u = t30_get_rx_selective_polling_address(s)))
printf("%s: Remote selective polling address '%s'\n", tag, u);
if ((u = t30_get_rx_sender_ident(s)))
printf("%s: Remote sender ident '%s'\n", tag, u);
if ((u = t30_get_rx_password(s)))
printf("%s: Remote password '%s'\n", tag, u);
if ((u = t30_get_rx_country(s)))
printf("%s: Remote was made in '%s'\n", tag, u);
if ((u = t30_get_rx_vendor(s)))
printf("%s: Remote was made by '%s'\n", tag, u);
if ((u = t30_get_rx_model(s)))
printf("%s: Remote is model '%s'\n", tag, u);
}
/*- End of function --------------------------------------------------------*/
void log_transfer_statistics(t30_state_t *s, const char *tag)
{
t30_stats_t t;
t30_get_transfer_statistics(s, &t);
printf("%s: bit rate %d\n", tag, t.bit_rate);
printf("%s: ECM %s\n", tag, (t.error_correcting_mode) ? "on" : "off");
printf("%s: pages tx %d, pages rx %d\n", tag, t.pages_tx, t.pages_rx);
printf("%s: pages in the file %d\n", tag, t.pages_in_file);
printf("%s: image size %d x %d\n", tag, t.width, t.length);
printf("%s: image resolution %d x %d\n", tag, t.x_resolution, t.y_resolution);
printf("%s: bad rows %d, longest bad row run %d\n", tag, t.bad_rows, t.longest_bad_row_run);
printf("%s: bad ECM frames %d\n", tag, t.error_correcting_mode_retries);
printf("%s: compression type %d\n", tag, t.encoding);
printf("%s: image size %d bytes\n", tag, t.image_size);
#if defined(WITH_SPANDSP_INTERNALS)
printf("%s: bits per row - min %d, max %d\n", tag, s->t4.min_row_bits, s->t4.max_row_bits);
#endif
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
......@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t38_gateway_tests.c,v 1.79 2009/01/07 12:50:53 steveu Exp $
* $Id: t38_gateway_tests.c,v 1.80 2009/02/20 12:34:20 steveu Exp $
*/
/*! \file */
......@@ -73,6 +73,7 @@ These tests exercise the path
#if defined(ENABLE_GUI)
#include "media_monitor.h"
#endif
#include "fax_utils.h"
#define SAMPLES_PER_CHUNK 160
......@@ -102,9 +103,12 @@ int simulate_incrementing_repeats = FALSE;
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
{
int i;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase B:", i);
printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
......@@ -112,28 +116,14 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result)
static int phase_d_handler(t30_state_t *s, void *user_data, int result)
{
int i;
t30_stats_t t;
const char *u;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D:", i);
printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
t30_get_transfer_statistics(s, &t);
printf("%c: Phase D: bit rate %d\n", i, t.bit_rate);
printf("%c: Phase D: ECM %s\n", i, (t.error_correcting_mode) ? "on" : "off");
printf("%c: Phase D: pages transferred %d\n", i, t.pages_transferred);
printf("%c: Phase D: image size %d x %d\n", i, t.width, t.length);
printf("%c: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
printf("%c: Phase D: bad rows %d\n", i, t.bad_rows);
printf("%c: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
printf("%c: Phase D: coding method %s\n", i, t4_encoding_to_str(t.encoding));
printf("%c: Phase D: image size %d bytes\n", i, t.image_size);
if ((u = t30_get_tx_ident(s)))
printf("%c: Phase D: local ident '%s'\n", i, u);
if ((u = t30_get_rx_ident(s)))
printf("%c: Phase D: remote ident '%s'\n", i, u);
#if defined(WITH_SPANDSP_INTERNALS)
printf("%c: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
#endif
log_transfer_statistics(s, tag);
log_tx_parameters(s, tag);
log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
......@@ -142,25 +132,16 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
{
int i;
t30_stats_t t;
const char *u;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase E:", i);
printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
log_transfer_statistics(s, tag);
log_tx_parameters(s, tag);
log_rx_parameters(s, tag);
t30_get_transfer_statistics(s, &t);
printf("%c: Phase E: bit rate %d\n", i, t.bit_rate);
printf("%c: Phase E: ECM %s\n", i, (t.error_correcting_mode) ? "on" : "off");
printf("%c: Phase E: pages transferred %d\n", i, t.pages_transferred);
printf("%c: Phase E: image size %d x %d\n", i, t.width, t.length);
printf("%c: Phase E: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
printf("%c: Phase E: bad rows %d\n", i, t.bad_rows);
printf("%c: Phase E: longest bad row run %d\n", i, t.longest_bad_row_run);
printf("%c: Phase E: coding method %s\n", i, t4_encoding_to_str(t.encoding));
printf("%c: Phase E: image size %d bytes\n", i, t.image_size);
if ((u = t30_get_tx_ident(s)))
printf("%c: Phase E: local ident '%s'\n", i, u);
if ((u = t30_get_rx_ident(s)))
printf("%c: Phase E: remote ident '%s'\n", i, u);
succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_transferred == 12);
succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_tx == 12 || t.pages_rx == 12);
done[i - 'A'] = TRUE;
}
/*- End of function --------------------------------------------------------*/
......
......@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t38_gateway_to_terminal_tests.c,v 1.63 2009/01/07 12:50:53 steveu Exp $
* $Id: t38_gateway_to_terminal_tests.c,v 1.64 2009/02/20 12:34:20 steveu Exp $
*/
/*! \file */
......@@ -73,6 +73,7 @@ These tests exercise the path
#if defined(ENABLE_GUI)
#include "media_monitor.h"
#endif
#include "fax_utils.h"
#define SAMPLES_PER_CHUNK 160
......@@ -97,9 +98,12 @@ int simulate_incrementing_repeats = FALSE;
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
{
int i;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase B:", i);
printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
......@@ -107,28 +111,14 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result)
static int phase_d_handler(t30_state_t *s, void *user_data, int result)
{
int i;
t30_stats_t t;
const char *u;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D:", i);
printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
t30_get_transfer_statistics(s, &t);
printf("%c: Phase D: bit rate %d\n", i, t.bit_rate);
printf("%c: Phase D: ECM %s\n", i, (t.error_correcting_mode) ? "on" : "off");
printf("%c: Phase D: pages transferred %d\n", i, t.pages_transferred);
printf("%c: Phase D: image size %d x %d\n", i, t.width, t.length);
printf("%c: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
printf("%c: Phase D: bad rows %d\n", i, t.bad_rows);
printf("%c: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
printf("%c: Phase D: coding method %s\n", i, t4_encoding_to_str(t.encoding));
printf("%c: Phase D: image size %d bytes\n", i, t.image_size);
if ((u = t30_get_tx_ident(s)))
printf("%c: Phase D: local ident '%s'\n", i, u);
if ((u = t30_get_rx_ident(s)))
printf("%c: Phase D: remote ident '%s'\n", i, u);
#if defined(WITH_SPANDSP_INTERNALS)
printf("%c: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
#endif
log_transfer_statistics(s, tag);
log_tx_parameters(s, tag);
log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
......@@ -137,25 +127,16 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
{
int i;
t30_stats_t t;
const char *u;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase E:", i);
printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
log_transfer_statistics(s, tag);
log_tx_parameters(s, tag);
log_rx_parameters(s, tag);
t30_get_transfer_statistics(s, &t);
printf("%c: Phase E: bit rate %d\n", i, t.bit_rate);
printf("%c: Phase E: ECM %s\n", i, (t.error_correcting_mode) ? "on" : "off");
printf("%c: Phase E: pages transferred %d\n", i, t.pages_transferred);
printf("%c: Phase E: image size %d x %d\n", i, t.width, t.length);
printf("%c: Phase E: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
printf("%c: Phase E: bad rows %d\n", i, t.bad_rows);
printf("%c: Phase E: longest bad row run %d\n", i, t.longest_bad_row_run);
printf("%c: Phase E: coding method %s\n", i, t4_encoding_to_str(t.encoding));
printf("%c: Phase E: image size %d bytes\n", i, t.image_size);
if ((u = t30_get_tx_ident(s)))
printf("%c: Phase E: local ident '%s'\n", i, u);
if ((u = t30_get_rx_ident(s)))
printf("%c: Phase E: remote ident '%s'\n", i, u);
succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_transferred == 12);
succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_tx == 12 || t.pages_rx == 12);
done[i - 'A'] = TRUE;
}
/*- End of function --------------------------------------------------------*/
......
......@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t38_terminal_tests.c,v 1.64 2009/01/07 12:50:53 steveu Exp $
* $Id: t38_terminal_tests.c,v 1.65 2009/02/20 12:34:20 steveu Exp $
*/
/*! \file */
......@@ -73,6 +73,7 @@ These tests exercise the path
#if defined(ENABLE_GUI)
#include "media_monitor.h"
#endif
#include "fax_utils.h"
#define SAMPLES_PER_CHUNK 160
......@@ -95,9 +96,12 @@ int simulate_incrementing_repeats = FALSE;
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
{
int i;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase B:", i);
printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
......@@ -105,28 +109,14 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result)
static int phase_d_handler(t30_state_t *s, void *user_data, int result)
{
int i;
t30_stats_t t;
const char *u;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D:", i);
printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
t30_get_transfer_statistics(s, &t);
printf("%c: Phase D: bit rate %d\n", i, t.bit_rate);
printf("%c: Phase D: ECM %s\n", i, (t.error_correcting_mode) ? "on" : "off");
printf("%c: Phase D: pages transferred %d\n", i, t.pages_transferred);
printf("%c: Phase D: image size %d x %d\n", i, t.width, t.length);
printf("%c: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
printf("%c: Phase D: bad rows %d\n", i, t.bad_rows);
printf("%c: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
printf("%c: Phase D: coding method %s\n", i, t4_encoding_to_str(t.encoding));
printf("%c: Phase D: image size %d bytes\n", i, t.image_size);
if ((u = t30_get_tx_ident(s)))
printf("%c: Phase D: local ident '%s'\n", i, u);
if ((u = t30_get_rx_ident(s)))
printf("%c: Phase D: remote ident '%s'\n", i, u);
#if defined(WITH_SPANDSP_INTERNALS)
printf("%c: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
#endif
log_transfer_statistics(s, tag);
log_tx_parameters(s, tag);
log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
......@@ -135,25 +125,16 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
{
int i;
t30_stats_t t;
const char *u;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase E:", i);
printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
log_transfer_statistics(s, tag);
log_tx_parameters(s, tag);
log_rx_parameters(s, tag);
t30_get_transfer_statistics(s, &t);
printf("%c: Phase E: bit rate %d\n", i, t.bit_rate);
printf("%c: Phase E: ECM %s\n", i, (t.error_correcting_mode) ? "on" : "off");
printf("%c: Phase E: pages transferred %d\n", i, t.pages_transferred);
printf("%c: Phase E: image size %d x %d\n", i, t.width, t.length);
printf("%c: Phase E: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
printf("%c: Phase E: bad rows %d\n", i, t.bad_rows);
printf("%c: Phase E: longest bad row run %d\n", i, t.longest_bad_row_run);
printf("%c: Phase E: coding method %s\n", i, t4_encoding_to_str(t.encoding));
printf("%c: Phase E: image size %d bytes\n", i, t.image_size);
if ((u = t30_get_tx_ident(s)))
printf("%c: Phase E: local ident '%s'\n", i, u);
if ((u = t30_get_rx_ident(s)))
printf("%c: Phase E: remote ident '%s'\n", i, u);
succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_transferred == 12);
succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_tx == 12 || t.pages_rx == 12);
//done[i - 'A'] = TRUE;
}
/*- End of function --------------------------------------------------------*/
......
......@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t38_terminal_to_gateway_tests.c,v 1.62 2009/01/07 12:50:53 steveu Exp $
* $Id: t38_terminal_to_gateway_tests.c,v 1.63 2009/02/20 12:34:20 steveu Exp $
*/
/*! \file */
......@@ -73,6 +73,7 @@ These tests exercise the path
#if defined(ENABLE_GUI)
#include "media_monitor.h"
#endif
#include "fax_utils.h"
#define SAMPLES_PER_CHUNK 160
......@@ -97,9 +98,12 @@ int simulate_incrementing_repeats = FALSE;
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
{
int i;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase B:", i);
printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
......@@ -107,28 +111,14 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result)
static int phase_d_handler(t30_state_t *s, void *user_data, int result)
{
int i;
t30_stats_t t;
const char *u;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D:", i);
printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
t30_get_transfer_statistics(s, &t);
printf("%c: Phase D: bit rate %d\n", i, t.bit_rate);
printf("%c: Phase D: ECM %s\n", i, (t.error_correcting_mode) ? "on" : "off");
printf("%c: Phase D: pages transferred %d\n", i, t.pages_transferred);
printf("%c: Phase D: image size %d x %d\n", i, t.width, t.length);
printf("%c: Phase D: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
printf("%c: Phase D: bad rows %d\n", i, t.bad_rows);
printf("%c: Phase D: longest bad row run %d\n", i, t.longest_bad_row_run);
printf("%c: Phase D: coding method %s\n", i, t4_encoding_to_str(t.encoding));
printf("%c: Phase D: image size %d bytes\n", i, t.image_size);
if ((u = t30_get_tx_ident(s)))
printf("%c: Phase D: local ident '%s'\n", i, u);
if ((u = t30_get_rx_ident(s)))
printf("%c: Phase D: remote ident '%s'\n", i, u);
#if defined(WITH_SPANDSP_INTERNALS)
printf("%c: Phase D: bits per row - min %d, max %d\n", i, s->t4.min_row_bits, s->t4.max_row_bits);
#endif
log_transfer_statistics(s, tag);
log_tx_parameters(s, tag);
log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
......@@ -137,25 +127,16 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
{
int i;
t30_stats_t t;
const char *u;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase E:", i);
printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
log_transfer_statistics(s, tag);
log_tx_parameters(s, tag);
log_rx_parameters(s, tag);
t30_get_transfer_statistics(s, &t);
printf("%c: Phase E: bit rate %d\n", i, t.bit_rate);
printf("%c: Phase E: ECM %s\n", i, (t.error_correcting_mode) ? "on" : "off");
printf("%c: Phase E: pages transferred %d\n", i, t.pages_transferred);
printf("%c: Phase E: image size %d x %d\n", i, t.width, t.length);
printf("%c: Phase E: image resolution %d x %d\n", i, t.x_resolution, t.y_resolution);
printf("%c: Phase E: bad rows %d\n", i, t.bad_rows);
printf("%c: Phase E: longest bad row run %d\n", i, t.longest_bad_row_run);
printf("%c: Phase E: coding method %s\n", i, t4_encoding_to_str(t.encoding));
printf("%c: Phase E: image size %d bytes\n", i, t.image_size);
if ((u = t30_get_tx_ident(s)))
printf("%c: Phase E: local ident '%s'\n", i, u);
if ((u = t30_get_rx_ident(s)))
printf("%c: Phase E: remote ident '%s'\n", i, u);
succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_transferred == 12);
succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_tx == 12 || t.pages_rx == 12);
done[i - 'A'] = TRUE;
}
/*- End of function --------------------------------------------------------*/
......
......@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t4_tests.c,v 1.66 2009/02/10 13:06:47 steveu Exp $
* $Id: t4_tests.c,v 1.67 2009/02/20 12:34:20 steveu Exp $
*/
/*! \file */
......@@ -292,7 +292,7 @@ int main(int argc, char *argv[])
printf("Failed to init T.4 rx\n");
exit(2);
}
span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
t4_rx_set_rx_encoding(&receive_state, compression);
t4_rx_set_x_resolution(&receive_state, T4_X_RESOLUTION_R8);
//t4_rx_set_y_resolution(&receive_state, T4_Y_RESOLUTION_FINE);
......@@ -365,6 +365,7 @@ int main(int argc, char *argv[])
printf("Failed to init T.4 send\n");
exit(2);
}
span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
t4_tx_set_min_row_bits(&send_state, min_row_bits);
t4_tx_set_local_ident(&send_state, "111 2222 3333");
......@@ -374,6 +375,7 @@ int main(int argc, char *argv[])
printf("Failed to init T.4 rx\n");
exit(2);
}
span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state));
t4_rx_set_y_resolution(&receive_state, t4_tx_get_y_resolution(&send_state));
t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state));
......@@ -521,6 +523,7 @@ int main(int argc, char *argv[])
printf("Failed to init T.4 tx\n");
exit(2);
}
span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
t4_tx_set_row_read_handler(&send_state, row_read_handler, NULL);
t4_tx_set_min_row_bits(&send_state, min_row_bits);
t4_tx_set_local_ident(&send_state, "111 2222 3333");
......@@ -531,6 +534,7 @@ int main(int argc, char *argv[])
printf("Failed to init T.4 rx\n");
exit(2);
}
span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
t4_rx_set_row_write_handler(&receive_state, row_write_handler, NULL);
t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state));
t4_rx_set_y_resolution(&receive_state, t4_tx_get_y_resolution(&send_state));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论