From 3b4aafe945add9ec83f4b01b0d2a839baa0eba51 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sun, 26 Aug 2012 20:24:20 +0800 Subject: [PATCH] More tweaks --- .../tests/msvc/t38_terminal_tests.vcproj | 202 ------------------ libs/spandsp/tests/t42_tests.c | 23 +- 2 files changed, 22 insertions(+), 203 deletions(-) delete mode 100644 libs/spandsp/tests/msvc/t38_terminal_tests.vcproj diff --git a/libs/spandsp/tests/msvc/t38_terminal_tests.vcproj b/libs/spandsp/tests/msvc/t38_terminal_tests.vcproj deleted file mode 100644 index 20977a3abd..0000000000 --- a/libs/spandsp/tests/msvc/t38_terminal_tests.vcproj +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/t42_tests.c b/libs/spandsp/tests/t42_tests.c index b9dda77668..588bfdd3fe 100644 --- a/libs/spandsp/tests/t42_tests.c +++ b/libs/spandsp/tests/t42_tests.c @@ -45,6 +45,10 @@ #include "spandsp.h" +#if defined(SPANDSP_SUPPORT_TIFF_FX) +//#include +#endif + //#define IN_FILE_NAME "../test-data/itu/t24/F21_200.TIF" #define IN_FILE_NAME "../test-data/itu/t24/F21B400.TIF" #define OUT_FILE_NAME "t42_tests_receive.tif" @@ -145,6 +149,7 @@ int main(int argc, char *argv[]) uint16_t *map_a; uint16_t *map_b; uint16_t *map_z; + uint32_t jpeg_table_len; logging_state_t *logging; printf("Demo of ITU/Lab library.\n"); @@ -187,6 +192,7 @@ int main(int argc, char *argv[]) planar_config = 0; TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &planar_config); off = 0; + map_L = NULL; map_a = NULL; map_b = NULL; @@ -260,7 +266,19 @@ int main(int argc, char *argv[]) if (process_raw) { + uint8_t *jpeg_table; + nstrips = TIFFNumberOfStrips(tif); + + total_image_len = 0; + jpeg_table_len = 0; + if (TIFFGetField(tif, TIFFTAG_JPEGTABLES, &jpeg_table_len, &jpeg_table)) + { + total_image_len += (jpeg_table_len - 4); + printf("JPEG tables %u\n", jpeg_table_len); + printf("YYY %d - %x %x %x %x\n", jpeg_table_len, jpeg_table[0], jpeg_table[1], jpeg_table[2], jpeg_table[3]); + } + for (i = 0, total_image_len = 0; i < nstrips; i++) total_image_len += TIFFRawStripSize(tif, i); data = malloc(total_image_len); @@ -272,6 +290,9 @@ int main(int argc, char *argv[]) return -1; } } + if (jpeg_table_len > 0) + memcpy(data, jpeg_table, jpeg_table_len - 2); + if (total_len != total_image_len) printf("Size mismatch %ld %ld\n", total_len, total_image_len); off = total_len; @@ -420,7 +441,7 @@ int main(int argc, char *argv[]) return 1; off += bytes_per_row; } - printf("total %d, off %ld\n", totdata, off); + printf("total %u, off %ld\n", totdata, off); /* We now have the image in memory in RGB form */