diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am index dc3553031b..b034608d8c 100644 --- a/libs/spandsp/src/Makefile.am +++ b/libs/spandsp/src/Makefile.am @@ -16,7 +16,7 @@ ## 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.127 2009/02/25 15:30:21 steveu Exp $ +## $Id: Makefile.am,v 1.128 2009/03/01 12:49:28 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) @@ -293,6 +293,10 @@ at_interpreter.lo: at_interpreter_dictionary.h at_interpreter_dictionary.h: make_at_dictionary$(EXEEXT) ./make_at_dictionary$(EXEEXT) >at_interpreter_dictionary.h +t4.$(OBJEXT): spandsp/version.h + +t4.lo: spandsp/version.h + v17rx.$(OBJEXT): v17rx_fixed_rrc.h v17rx_floating_rrc.h v17rx.lo: v17rx_fixed_rrc.h v17rx_floating_rrc.h diff --git a/libs/spandsp/src/spandsp/bit_operations.h b/libs/spandsp/src/spandsp/bit_operations.h index 44da5ff871..a0b218f878 100644 --- a/libs/spandsp/src/spandsp/bit_operations.h +++ b/libs/spandsp/src/spandsp/bit_operations.h @@ -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: bit_operations.h,v 1.25 2009/02/24 14:14:03 steveu Exp $ + * $Id: bit_operations.h,v 1.26 2009/02/26 16:08:50 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/fast_convert.h b/libs/spandsp/src/spandsp/fast_convert.h index 4c5f8583b0..da84471f71 100644 --- a/libs/spandsp/src/spandsp/fast_convert.h +++ b/libs/spandsp/src/spandsp/fast_convert.h @@ -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: fast_convert.h,v 1.5 2009/02/24 14:14:03 steveu Exp $ + * $Id: fast_convert.h,v 1.6 2009/02/26 16:08:51 steveu Exp $ */ #if !defined(_SPANDSP_FAST_CONVERT_H_) diff --git a/libs/spandsp/src/spandsp/version.h b/libs/spandsp/src/spandsp/version.h index aa86853b43..213ee66d6c 100644 --- a/libs/spandsp/src/spandsp/version.h +++ b/libs/spandsp/src/spandsp/version.h @@ -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: version.h.in,v 1.2 2007/04/06 13:20:36 steveu Exp $ + * $Id: version.h.in,v 1.3 2009/03/01 12:39:02 steveu Exp $ */ #if !defined(_SPANDSP_VERSION_H_) @@ -30,8 +30,9 @@ /* The date and time of the version are in UTC form. */ -#define SPANDSP_RELEASE_DATE 20090226 -#define SPANDSP_RELEASE_TIME 121601 +#define SPANDSP_RELEASE_DATE 20090301 +#define SPANDSP_RELEASE_TIME 125126 +#define SPANDSP_RELEASE_DATETIME_STRING "20090301 125126" #endif /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/version.h.in b/libs/spandsp/src/spandsp/version.h.in index 9991ad2268..e83b593ef3 100644 --- a/libs/spandsp/src/spandsp/version.h.in +++ b/libs/spandsp/src/spandsp/version.h.in @@ -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: version.h.in,v 1.2 2007/04/06 13:20:36 steveu Exp $ + * $Id: version.h.in,v 1.3 2009/03/01 12:39:02 steveu Exp $ */ #if !defined(_SPANDSP_VERSION_H_) @@ -30,8 +30,9 @@ /* The date and time of the version are in UTC form. */ -#define SPANDSP_RELEASE_DATE $SPANDSP_RELEASE_DATE -#define SPANDSP_RELEASE_TIME $SPANDSP_RELEASE_TIME +#define SPANDSP_RELEASE_DATE $SPANDSP_RELEASE_DATE +#define SPANDSP_RELEASE_TIME $SPANDSP_RELEASE_TIME +#define SPANDSP_RELEASE_DATETIME_STRING "$SPANDSP_RELEASE_DATE $SPANDSP_RELEASE_TIME" #endif /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/t4.c b/libs/spandsp/src/t4.c index e69fad80e4..343696715e 100644 --- a/libs/spandsp/src/t4.c +++ b/libs/spandsp/src/t4.c @@ -24,7 +24,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: t4.c,v 1.127 2009/02/21 04:27:46 steveu Exp $ + * $Id: t4.c,v 1.128 2009/03/01 11:47:03 steveu Exp $ */ /* @@ -86,6 +86,7 @@ #include "spandsp/bit_operations.h" #include "spandsp/async.h" #include "spandsp/t4.h" +#include "spandsp/version.h" #include "spandsp/private/logging.h" #include "spandsp/private/t4.h" @@ -205,7 +206,7 @@ static int set_tiff_directory_info(t4_state_t *s) TIFFSetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit); #endif /* TODO: add the version of spandsp */ - TIFFSetField(t->tiff_file, TIFFTAG_SOFTWARE, "spandsp"); + TIFFSetField(t->tiff_file, TIFFTAG_SOFTWARE, "Spandsp " SPANDSP_RELEASE_DATETIME_STRING); if (gethostname(buf, sizeof(buf)) == 0) TIFFSetField(t->tiff_file, TIFFTAG_HOSTCOMPUTER, buf); @@ -330,9 +331,11 @@ static int get_tiff_directory_info(t4_state_t *s) if (t->photo_metric != PHOTOMETRIC_MINISWHITE) span_log(&s->logging, SPAN_LOG_FLOW, "%s: Photometric needs swapping.\n", s->file); t->fill_order = FILLORDER_LSB2MSB; +#if 0 TIFFGetField(t->tiff_file, TIFFTAG_FILLORDER, &t->fill_order); if (t->fill_order != FILLORDER_LSB2MSB) span_log(&s->logging, SPAN_LOG_FLOW, "%s: Fill order needs swapping.\n", s->file); +#endif /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the precise value. The other value should be exact. */ diff --git a/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c b/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c index 025f72286d..d3153e2a4f 100644 --- a/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c +++ b/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c @@ -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.3 2009/02/20 12:34:20 steveu Exp $ + * $Id: generate_etsi_300_242_pages.c,v 1.4 2009/03/01 12:39:02 steveu Exp $ */ /*! \file */ @@ -177,8 +177,8 @@ struct }, }; -int reverse_photo_metric = FALSE; -int reverse_fill_order = FALSE; +int photo_metric = PHOTOMETRIC_MINISWHITE; +int fill_order = FILLORDER_LSB2MSB; static void clear_row(uint8_t buf[], int width) { @@ -256,13 +256,15 @@ 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) + if (photo_metric != PHOTOMETRIC_MINISWHITE) { for (i = 0; i < 1728/8; i++) image_buffer[i] = ~image_buffer[i]; } - if (reverse_fill_order) +#if 0 + if (fill_order != FILLORDER_LSB2MSB) bit_reverse(image_buffer, image_buffer, 1728/8); +#endif if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) { printf("Write error at row %d.\n", row); @@ -558,6 +560,37 @@ int main(int argc, char *argv[]) float y_resolution; int i; int image_length; + int opt; + int compression; + + compression = T4_COMPRESSION_ITU_T6; + photo_metric = PHOTOMETRIC_MINISWHITE; + fill_order = FILLORDER_LSB2MSB; + while ((opt = getopt(argc, argv, "126ir")) != -1) + { + switch (opt) + { + case '1': + compression = T4_COMPRESSION_ITU_T4_1D; + break; + case '2': + compression = T4_COMPRESSION_ITU_T4_2D; + break; + case '6': + compression = T4_COMPRESSION_ITU_T6; + break; + case 'i': + photo_metric = PHOTOMETRIC_MINISBLACK; + break; + case 'r': + fill_order = FILLORDER_MSB2LSB; + break; + default: + //usage(); + exit(2); + break; + } + } tiff_file = NULL; for (i = 0; sequence[i].name; i++) @@ -582,14 +615,8 @@ 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); - 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); + TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, photo_metric); + TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order); 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)); diff --git a/libs/spandsp/test-data/itu/fax/generate_sized_pages.c b/libs/spandsp/test-data/itu/fax/generate_sized_pages.c index c9c0115673..fe57a2589a 100644 --- a/libs/spandsp/test-data/itu/fax/generate_sized_pages.c +++ b/libs/spandsp/test-data/itu/fax/generate_sized_pages.c @@ -23,7 +23,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: generate_sized_pages.c,v 1.2 2008/07/10 13:34:01 steveu Exp $ + * $Id: generate_sized_pages.c,v 1.3 2009/03/01 12:39:02 steveu Exp $ */ /*! \file */ @@ -289,6 +289,39 @@ int main(int argc, char *argv[]) float x_resolution; float y_resolution; int i; + int opt; + int compression; + int photo_metric; + int fill_order; + + compression = T4_COMPRESSION_ITU_T6; + photo_metric = PHOTOMETRIC_MINISWHITE; + fill_order = FILLORDER_LSB2MSB; + while ((opt = getopt(argc, argv, "126ir")) != -1) + { + switch (opt) + { + case '1': + compression = T4_COMPRESSION_ITU_T4_1D; + break; + case '2': + compression = T4_COMPRESSION_ITU_T4_2D; + break; + case '6': + compression = T4_COMPRESSION_ITU_T6; + break; + case 'i': + photo_metric = PHOTOMETRIC_MINISBLACK; + break; + case 'r': + fill_order = FILLORDER_MSB2LSB; + break; + default: + //usage(); + exit(2); + break; + } + } for (i = 0; sequence[i].name; i++) { @@ -296,15 +329,15 @@ int main(int argc, char *argv[]) exit(2); /* Prepare the directory entry fully before writing the image, or libtiff complains */ - TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, COMPRESSION_CCITT_T6); + TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, compression); TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, sequence[i].width); TIFFSetField(tiff_file, TIFFTAG_BITSPERSAMPLE, 1); TIFFSetField(tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); 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); + TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, photo_metric); + TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order); x_resolution = sequence[i].x_res/100.0f; y_resolution = sequence[i].y_res/100.0f; diff --git a/libs/spandsp/tests/t4_tests.c b/libs/spandsp/tests/t4_tests.c index 275d2d459d..4488033a8a 100644 --- a/libs/spandsp/tests/t4_tests.c +++ b/libs/spandsp/tests/t4_tests.c @@ -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.67 2009/02/20 12:34:20 steveu Exp $ + * $Id: t4_tests.c,v 1.68 2009/03/01 12:39:02 steveu Exp $ */ /*! \file */ @@ -341,6 +341,17 @@ int main(int argc, char *argv[]) break; } } + else if (sscanf(buf, "%08x %02x %02x %02x", (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit) == 4) + { + for (i = 0; i < 16; i++) + { + if (sscanf(&buf[10 + 3*i], "%x", (unsigned int *) &bit) != 1) + break; + bit = bit_reverse8(bit); + if ((end_of_page = t4_rx_put_byte(&receive_state, bit))) + break; + } + } else if (sscanf(buf, "Rx bit %*d - %d", &bit) == 1) { if ((end_of_page = t4_rx_put_bit(&receive_state, bit)))