From 3ae87091e1c6aabcfd8a3854f52adba9561748db Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 24 Jul 2013 11:58:36 +0800 Subject: [PATCH] Reworked some of the definition names and values in preparation for colour FAX --- libs/spandsp/src/spandsp/t4_rx.h | 133 ++----- libs/spandsp/src/t30.c | 224 ++++++------ libs/spandsp/src/t30_api.c | 79 +++-- libs/spandsp/src/t4_rx.c | 12 +- .../etsi/fax/generate_etsi_300_242_pages.c | 50 +-- .../test-data/itu/fax/generate_dithered_tif.c | 10 +- .../test-data/itu/fax/generate_sized_pages.c | 335 +++++++++++++++--- .../itu/fax/generate_striped_pages.c | 9 +- libs/spandsp/tests/fax_tests.c | 108 +++--- libs/spandsp/tests/fax_tests.sh | 132 ++++++- libs/spandsp/tests/t38_decode.c | 4 +- libs/spandsp/tests/tsb85_tests.c | 30 +- .../mod_spandsp/mod_spandsp_fax.c | 20 +- 13 files changed, 736 insertions(+), 410 deletions(-) diff --git a/libs/spandsp/src/spandsp/t4_rx.h b/libs/spandsp/src/spandsp/t4_rx.h index ed56cbcf8f..bef9b3196a 100644 --- a/libs/spandsp/src/spandsp/t4_rx.h +++ b/libs/spandsp/src/spandsp/t4_rx.h @@ -49,68 +49,44 @@ typedef int (*t4_row_write_handler_t)(void *user_data, const uint8_t buf[], size typedef enum { /*! No compression */ - T4_COMPRESSION_NONE = 0, - /*! T.1 1D compression */ - T4_COMPRESSION_T4_1D = 1, + T4_COMPRESSION_NONE = 0x01, + /*! T.4 1D compression */ + T4_COMPRESSION_T4_1D = 0x02, /*! T.4 2D compression */ - T4_COMPRESSION_T4_2D = 2, + T4_COMPRESSION_T4_2D = 0x04, /*! T.6 2D compression */ - T4_COMPRESSION_T6 = 3, + T4_COMPRESSION_T6 = 0x08, /*! T.85 monochrome JBIG coding with L0 fixed. */ - T4_COMPRESSION_T85 = 4, + T4_COMPRESSION_T85 = 0x10, /*! T.85 monochrome JBIG coding with L0 variable. */ - T4_COMPRESSION_T85_L0 = 5, + T4_COMPRESSION_T85_L0 = 0x20, /*! T.43 gray-scale/colour JBIG coding */ - T4_COMPRESSION_T43 = 6, + T4_COMPRESSION_T43 = 0x40, /*! T.45 run length colour compression */ - T4_COMPRESSION_T45 = 7, + T4_COMPRESSION_T45 = 0x80, /*! T.42 + T.81 + T.30 Annex E colour JPEG coding */ - T4_COMPRESSION_T42_T81 = 8, + T4_COMPRESSION_T42_T81 = 0x100, /*! T.42 + T.81 + T.30 Annex K colour sYCC-JPEG coding */ - T4_COMPRESSION_SYCC_T81 = 9, + T4_COMPRESSION_SYCC_T81 = 0x200, /*! T.88 monochrome JBIG2 compression */ - T4_COMPRESSION_T88 = 10 -} t4_image_compression_t; - -enum -{ - /*! No compression */ - T4_SUPPORT_COMPRESSION_NONE = 0x01, - /*! T.1 1D compression */ - T4_SUPPORT_COMPRESSION_T4_1D = 0x02, - /*! T.4 2D compression */ - T4_SUPPORT_COMPRESSION_T4_2D = 0x04, - /*! T.6 2D compression */ - T4_SUPPORT_COMPRESSION_T6 = 0x08, - /*! T.85 monochrome JBIG compression, with fixed L0 */ - T4_SUPPORT_COMPRESSION_T85 = 0x10, - /*! T.85 monochrome JBIG compression, with variable L0 */ - T4_SUPPORT_COMPRESSION_T85_L0 = 0x20, - /*! T.43 colour JBIG compression */ - T4_SUPPORT_COMPRESSION_T43 = 0x40, - /*! T.45 run length colour compression */ - T4_SUPPORT_COMPRESSION_T45 = 0x80, - /*! T.81 + T.30 Annex E colour JPEG compression */ - T4_SUPPORT_COMPRESSION_T42_T81 = 0x100, - /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */ - T4_SUPPORT_COMPRESSION_SYCC_T81 = 0x200, - /*! T.88 monochrome JBIG2 compression */ - T4_SUPPORT_COMPRESSION_T88 = 0x400, + T4_COMPRESSION_T88 = 0x400, + /*! Support solour compression without sub-sampling */ + T4_COMPRESSION_NO_SUBSAMPLING = 0x800000, /*! Gray-scale support by multi-level codecs */ - T4_SUPPORT_COMPRESSION_GRAYSCALE = 0x1000000, + T4_COMPRESSION_GRAYSCALE = 0x1000000, /*! Colour support by multi-level codecs */ - T4_SUPPORT_COMPRESSION_COLOUR = 0x2000000, + T4_COMPRESSION_COLOUR = 0x2000000, /*! 12 bit mode for gray-scale and colour */ - T4_SUPPORT_COMPRESSION_12BIT = 0x4000000, + T4_COMPRESSION_12BIT = 0x4000000, /*! Convert a colour image to a gray-scale one */ - T4_SUPPORT_COMPRESSION_COLOUR_TO_GRAY = 0x8000000, + T4_COMPRESSION_COLOUR_TO_GRAY = 0x8000000, /*! Dither a gray-scale image down a simple bilevel image, with rescaling to fit a FAX page */ - T30_SUPPORT_GRAY_TO_BILEVEL = 0x10000000, + T4_COMPRESSION_GRAY_TO_BILEVEL = 0x10000000, /*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */ - T30_SUPPORT_COLOUR_TO_BILEVEL = 0x20000000, + T4_COMPRESSION_COLOUR_TO_BILEVEL = 0x20000000, /*! Rescale an image (except a bi-level image) to fit a permitted FAX width when necessary */ - T4_SUPPORT_COMPRESSION_RESCALING = 0x40000000 -}; + T4_COMPRESSION_RESCALING = 0x40000000 +} t4_image_compression_t; /*! Image type */ typedef enum @@ -169,71 +145,36 @@ typedef enum enum { /*! Standard FAX resolution 204dpi x 98dpi - bi-level only */ - T4_RESOLUTION_R8_STANDARD = 1, + T4_RESOLUTION_R8_STANDARD = 0x1, /*! Fine FAX resolution 204dpi x 196dpi - bi-level only */ - T4_RESOLUTION_R8_FINE = 2, + T4_RESOLUTION_R8_FINE = 0x2, /*! Super-fine FAX resolution 204dpi x 391dpi - bi-level only */ - T4_RESOLUTION_R8_SUPERFINE = 3, + T4_RESOLUTION_R8_SUPERFINE = 0x4, /*! Double FAX resolution 408dpi x 391dpi - bi-level only */ - T4_RESOLUTION_R16_SUPERFINE = 4, + T4_RESOLUTION_R16_SUPERFINE = 0x8, /*! 100dpi x 100dpi - gray-scale and colour only */ - T4_RESOLUTION_100_100 = 5, + T4_RESOLUTION_100_100 = 0x10, /*! 200dpi x 100dpi - bi-level only */ - T4_RESOLUTION_200_100 = 6, + T4_RESOLUTION_200_100 = 0x20, /*! 200dpi x 200dpi */ - T4_RESOLUTION_200_200 = 7, + T4_RESOLUTION_200_200 = 0x40, /*! 200dpi x 400dpi - bi-level only */ - T4_RESOLUTION_200_400 = 8, + T4_RESOLUTION_200_400 = 0x80, /*! 300dpi x 300dpi */ - T4_RESOLUTION_300_300 = 9, + T4_RESOLUTION_300_300 = 0x100, /*! 300dpi x 600dpi - bi-level only */ - T4_RESOLUTION_300_600 = 10, + T4_RESOLUTION_300_600 = 0x200, /*! 400dpi x 400dpi */ - T4_RESOLUTION_400_400 = 11, + T4_RESOLUTION_400_400 = 0x400, /*! 400dpi x 800dpi - bi-level only */ - T4_RESOLUTION_400_800 = 12, + T4_RESOLUTION_400_800 = 0x800, /*! 600dpi x 600dpi */ - T4_RESOLUTION_600_600 = 13, + T4_RESOLUTION_600_600 = 0x1000, /*! 600dpi x 1200dpi - bi-level only */ - T4_RESOLUTION_600_1200 = 14, + T4_RESOLUTION_600_1200 = 0x2000, /*! 1200dpi x 1200dpi */ - T4_RESOLUTION_1200_1200 = 15 -}; - -enum -{ - /*! Support standard FAX resolution 204dpi x 98dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_R8_STANDARD = 0x1, - /*! Support fine FAX resolution 204dpi x 196dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_R8_FINE = 0x2, - /*! Support super-fine FAX resolution 204dpi x 391dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_R8_SUPERFINE = 0x4, - /*! Support double FAX resolution 408dpi x 391dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_R16_SUPERFINE = 0x8, - - /*! Support 100dpi x 100dpi - gray-scale and colour only */ - T4_SUPPORT_RESOLUTION_100_100 = 0x10, - /*! Support 200dpi x 100dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_200_100 = 0x20, - /*! Support 200dpi x 200dpi */ - T4_SUPPORT_RESOLUTION_200_200 = 0x40, - /*! Support 200dpi x 400dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_200_400 = 0x80, - /*! Support 300dpi x 300dpi */ - T4_SUPPORT_RESOLUTION_300_300 = 0x100, - /*! Support 300dpi x 600dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_300_600 = 0x200, - /*! Support 400dpi x 400dpi */ - T4_SUPPORT_RESOLUTION_400_400 = 0x400, - /*! Support 400dpi x 800dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_400_800 = 0x800, - /*! Support 600dpi x 600dpi */ - T4_SUPPORT_RESOLUTION_600_600 = 0x1000, - /*! Support 600dpi x 1200dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_600_1200 = 0x2000, - /*! Support 1200dpi x 1200dpi */ - T4_SUPPORT_RESOLUTION_1200_1200 = 0x4000 + T4_RESOLUTION_1200_1200 = 0x4000 }; /*! diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index c93636a265..1e3107b0b2 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -1194,9 +1194,9 @@ int t30_build_dis_or_dtc(t30_state_t *s) /* No scan-line padding required, but some may be specified by the application. */ set_ctrl_bits(s->local_dis_dtc_frame, s->local_min_scan_time_code, T30_DIS_BIT_MIN_SCAN_LINE_TIME_CAPABILITY_1); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T4_2D)) + if ((s->supported_compressions & T4_COMPRESSION_T4_2D)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_NONE)) + if ((s->supported_compressions & T4_COMPRESSION_NONE)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_UNCOMPRESSED_CAPABLE); if (s->ecm_allowed) { @@ -1205,50 +1205,50 @@ int t30_build_dis_or_dtc(t30_state_t *s) /* Only offer the option of fancy compression schemes, if we are also offering the ECM option needed to support them. */ - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T6)) + if ((s->supported_compressions & T4_COMPRESSION_T6)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85)) + if ((s->supported_compressions & T4_COMPRESSION_T85)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE); /* Bit 79 set with bit 78 clear is invalid, so only check for L0 support here. */ - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85_L0)) + if ((s->supported_compressions & T4_COMPRESSION_T85_L0)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE); } - //if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T88)) + //if ((s->supported_compressions & T4_COMPRESSION_T88)) //{ // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_1); // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_2); // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_3); //} - //if ((s->supported_compressions & (T4_SUPPORT_COMPRESSION_COLOUR | T4_SUPPORT_COMPRESSION_GRAYSCALE))) + //if ((s->supported_compressions & (T4_COMPRESSION_COLOUR | T4_COMPRESSION_GRAYSCALE))) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_COLOUR)) + if ((s->supported_compressions & T4_COMPRESSION_COLOUR)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T42_T81)) + if ((s->supported_compressions & T4_COMPRESSION_T42_T81)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T43)) + if ((s->supported_compressions & T4_COMPRESSION_T43)) { /* Note 25 of table 2/T.30 */ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE); /* No plane interleave */ } - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T45)) + if ((s->supported_compressions & T4_COMPRESSION_T45)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_SYCC_T81)) + if ((s->supported_compressions & T4_COMPRESSION_SYCC_T81)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE); } - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_12BIT)) + if ((s->supported_compressions & T4_COMPRESSION_12BIT)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE); - //if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_NO_SUBSAMPLING)) + //if ((s->supported_compressions & T4_COMPRESSION_NO_SUBSAMPLING)) // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING); /* No custom illuminant */ @@ -1308,55 +1308,55 @@ int t30_build_dis_or_dtc(t30_state_t *s) if ((s->supported_t30_features & T30_SUPPORT_INTERNET_ROUTING_ADDRESS)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_ROUTING_ADDRESS); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_1200_1200)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE); - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_1200_1200)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_1200_1200_CAPABLE); } - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_1200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_1200)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_600)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE); - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_600_600)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_600_600_CAPABLE); } - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_800)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_800)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R16_SUPERFINE)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R16_SUPERFINE)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_400)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE); - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_400_400)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE); } - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_600)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_600)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_300)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_300)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE); - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_300_300)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_300_300)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE); } - if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_200_400 | T4_SUPPORT_RESOLUTION_R8_SUPERFINE))) + if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_200_400 | T4_RESOLUTION_R8_SUPERFINE))) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_FINE)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R8_FINE)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_200_200)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE); - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_200_200)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_200_200)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE); } /* Standard FAX resolution bi-level image support goes without saying */ - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_100_100)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_100_100)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE); - if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_R8_STANDARD | T4_SUPPORT_RESOLUTION_R8_FINE | T4_SUPPORT_RESOLUTION_R8_SUPERFINE | T4_SUPPORT_RESOLUTION_R16_SUPERFINE))) + if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_R8_STANDARD | T4_RESOLUTION_R8_FINE | T4_RESOLUTION_R8_SUPERFINE | T4_RESOLUTION_R16_SUPERFINE))) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED); - if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_200_100 | T4_SUPPORT_RESOLUTION_200_200 | T4_SUPPORT_RESOLUTION_200_400 | T4_SUPPORT_RESOLUTION_300_300 | T4_SUPPORT_RESOLUTION_300_600 | T4_SUPPORT_RESOLUTION_400_400 | T4_SUPPORT_RESOLUTION_400_800 | T4_SUPPORT_RESOLUTION_600_600 | T4_SUPPORT_RESOLUTION_600_1200 | T4_SUPPORT_RESOLUTION_1200_1200))) + if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_200_100 | T4_RESOLUTION_200_200 | T4_RESOLUTION_200_400 | T4_RESOLUTION_300_300 | T4_RESOLUTION_300_600 | T4_RESOLUTION_400_400 | T4_RESOLUTION_400_800 | T4_RESOLUTION_600_600 | T4_RESOLUTION_600_1200 | T4_RESOLUTION_1200_1200))) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED); /* No double sided printing (alternate mode) */ @@ -1831,40 +1831,40 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) if (!s->error_correcting_mode) { /* Remove any compression schemes which need error correction to work. */ - s->mutual_compressions &= (0xF0000000 | T4_SUPPORT_COMPRESSION_NONE | T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D); + s->mutual_compressions &= (0xF0000000 | T4_COMPRESSION_NONE | T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D); if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T4_2D; + s->mutual_compressions &= ~T4_COMPRESSION_T4_2D; } else { /* Check the bi-level capabilities */ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T4_2D; + s->mutual_compressions &= ~T4_COMPRESSION_T4_2D; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T6; + s->mutual_compressions &= ~T4_COMPRESSION_T6; /* T.85 L0 capable without T.85 capable is an invalid combination, so let just zap both capabilities if the far end is not T.85 capable. */ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE)) - s->mutual_compressions &= ~(T4_SUPPORT_COMPRESSION_T85 | T4_SUPPORT_COMPRESSION_T85_L0); + s->mutual_compressions &= ~(T4_COMPRESSION_T85 | T4_COMPRESSION_T85_L0); if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T85_L0; + s->mutual_compressions &= ~T4_COMPRESSION_T85_L0; /* Check for full colour or only gray-scale from the multi-level codecs */ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_COLOUR; + s->mutual_compressions &= ~T4_COMPRESSION_COLOUR; /* Check the colour capabilities */ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T42_T81; + s->mutual_compressions &= ~T4_COMPRESSION_T42_T81; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_SYCC_T81; + s->mutual_compressions &= ~T4_COMPRESSION_SYCC_T81; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T43; + s->mutual_compressions &= ~T4_COMPRESSION_T43; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T45; + s->mutual_compressions &= ~T4_COMPRESSION_T45; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_12BIT; + s->mutual_compressions &= ~T4_COMPRESSION_12BIT; //if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING)) // ???? = T4_COMPRESSION_T42_T81_SUBSAMPLING; @@ -1876,75 +1876,75 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) s->mutual_colour_resolutions = s->supported_colour_resolutions; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200; - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_1200_1200; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_1200_1200; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_1200_1200_CAPABLE)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_1200_1200; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_600_1200; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_600_1200; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600; - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_600_600; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_600_600; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_600_600_CAPABLE)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_600_600; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_400_800; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_400_800; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~(T4_SUPPORT_RESOLUTION_400_400 | T4_SUPPORT_RESOLUTION_R16_SUPERFINE); - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_400_400; + s->mutual_bilevel_resolutions &= ~(T4_RESOLUTION_400_400 | T4_RESOLUTION_R16_SUPERFINE); + s->mutual_colour_resolutions &= ~T4_RESOLUTION_400_400; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_400_400; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_400_400; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_300_600; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_300_600; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300; - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_300_300; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_300_300; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_300_300; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE)) { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_400; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_400; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_R8_SUPERFINE; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_R8_SUPERFINE; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE)) { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_200; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_R8_FINE; - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_R8_FINE; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_200_200; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_200_200; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_100; - /* Never suppress T4_SUPPORT_RESOLUTION_R8_STANDARD */ + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_100; + /* Never suppress T4_RESOLUTION_R8_STANDARD */ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_100_100; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_100_100; s->mutual_image_sizes = s->supported_image_sizes; /* 215mm wide is always supported */ @@ -2070,7 +2070,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) /* Note 35 of Table 2/T.30 */ if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_COMPRESSION_COLOUR)) + if ((s->supported_colour_resolutions & T4_COMPRESSION_COLOUR)) { /* We are going to work in full colour mode */ } @@ -2078,7 +2078,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_12BIT_COMPONENT)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_COMPRESSION_12BIT)) + if ((s->supported_colour_resolutions & T4_COMPRESSION_12BIT)) { /* We are going to work in 12 bit mode */ } @@ -2086,17 +2086,17 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_NO_SUBSAMPLING)) { - //???? = T4_SUPPORT_COMPRESSION_T42_T81_SUBSAMPLING; + //???? = T4_COMPRESSION_T42_T81_SUBSAMPLING; } if (!test_ctrl_bit(dcs_frame, T30_DCS_BIT_PREFERRED_HUFFMAN_TABLES)) { - //???? = T4_SUPPORT_COMPRESSION_T42_T81_HUFFMAN; + //???? = T4_COMPRESSION_T42_T81_HUFFMAN; } if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_1200_1200)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_1200_1200)) { s->x_resolution = T4_X_RESOLUTION_1200; s->y_resolution = T4_Y_RESOLUTION_1200; @@ -2106,7 +2106,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_600_600)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_600_600)) { s->x_resolution = T4_X_RESOLUTION_600; s->y_resolution = T4_Y_RESOLUTION_600; @@ -2116,7 +2116,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_400)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_400_400)) { s->x_resolution = T4_X_RESOLUTION_400; s->y_resolution = T4_Y_RESOLUTION_400; @@ -2126,7 +2126,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_300_300)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_300_300)) { s->x_resolution = T4_X_RESOLUTION_300; s->y_resolution = T4_Y_RESOLUTION_300; @@ -2136,7 +2136,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_200_200)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_200_200)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_200_200)) { s->x_resolution = T4_X_RESOLUTION_200; s->y_resolution = T4_Y_RESOLUTION_200; @@ -2146,7 +2146,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_100_100)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_100_100)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_100_100)) { s->x_resolution = T4_X_RESOLUTION_100; s->y_resolution = T4_Y_RESOLUTION_100; @@ -2158,22 +2158,22 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) /* Check which compression the far end has decided to use. */ if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T81_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T42_T81)) + if ((s->supported_compressions & T4_COMPRESSION_T42_T81)) s->line_compression = T4_COMPRESSION_T42_T81; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T43_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T43)) + if ((s->supported_compressions & T4_COMPRESSION_T43)) s->line_compression = T4_COMPRESSION_T43; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T45_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T45)) + if ((s->supported_compressions & T4_COMPRESSION_T45)) s->line_compression = T4_COMPRESSION_T45; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_SYCC_T81_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_SYCC_T81)) + if ((s->supported_compressions & T4_COMPRESSION_SYCC_T81)) s->line_compression = T4_COMPRESSION_SYCC_T81; } } @@ -2182,7 +2182,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) /* Bi-level image */ if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_1200_1200)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_1200_1200)) { s->x_resolution = T4_X_RESOLUTION_1200; s->y_resolution = T4_Y_RESOLUTION_1200; @@ -2192,7 +2192,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_1200)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_1200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_1200)) { s->x_resolution = T4_X_RESOLUTION_600; s->y_resolution = T4_Y_RESOLUTION_1200; @@ -2202,7 +2202,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_600)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_600)) { s->x_resolution = T4_X_RESOLUTION_600; s->y_resolution = T4_Y_RESOLUTION_600; @@ -2212,7 +2212,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_800)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_800)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_800)) { s->x_resolution = T4_X_RESOLUTION_400; s->y_resolution = T4_Y_RESOLUTION_800; @@ -2224,7 +2224,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) { if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_400)) { s->x_resolution = T4_X_RESOLUTION_400; s->y_resolution = T4_Y_RESOLUTION_400; @@ -2234,7 +2234,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R16_SUPERFINE)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R16_SUPERFINE)) { s->x_resolution = T4_X_RESOLUTION_R16; s->y_resolution = T4_Y_RESOLUTION_SUPERFINE; @@ -2245,7 +2245,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_600)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_600)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_600)) { s->x_resolution = T4_X_RESOLUTION_300; s->y_resolution = T4_Y_RESOLUTION_600; @@ -2255,7 +2255,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_300)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_300)) { s->x_resolution = T4_X_RESOLUTION_300; s->y_resolution = T4_Y_RESOLUTION_300; @@ -2267,7 +2267,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) { if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_400)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_200_400)) { s->x_resolution = T4_X_RESOLUTION_200; s->y_resolution = T4_Y_RESOLUTION_400; @@ -2277,7 +2277,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_SUPERFINE)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R8_SUPERFINE)) { s->x_resolution = T4_X_RESOLUTION_R8; s->y_resolution = T4_Y_RESOLUTION_SUPERFINE; @@ -2290,7 +2290,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) { if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_200_200)) { s->x_resolution = T4_X_RESOLUTION_200; s->y_resolution = T4_Y_RESOLUTION_200; @@ -2300,7 +2300,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_FINE)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R8_FINE)) { s->x_resolution = T4_X_RESOLUTION_R8; s->y_resolution = T4_Y_RESOLUTION_FINE; @@ -2334,32 +2334,32 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) || test_ctrl_bit(dcs_frame, T30_DCS_BIT_T88_MODE_3)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T88)) + if ((s->supported_compressions & T4_COMPRESSION_T88)) s->line_compression = T4_COMPRESSION_T88; } if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_L0_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85_L0)) + if ((s->supported_compressions & T4_COMPRESSION_T85_L0)) s->line_compression = T4_COMPRESSION_T85_L0; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85)) + if ((s->supported_compressions & T4_COMPRESSION_T85)) s->line_compression = T4_COMPRESSION_T85; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T6)) + if ((s->supported_compressions & T4_COMPRESSION_T6)) s->line_compression = T4_COMPRESSION_T6; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_2D_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T4_2D)) + if ((s->supported_compressions & T4_COMPRESSION_T4_2D)) s->line_compression = T4_COMPRESSION_T4_2D; } else { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T4_1D)) + if ((s->supported_compressions & T4_COMPRESSION_T4_1D)) s->line_compression = T4_COMPRESSION_T4_1D; } } @@ -2796,13 +2796,13 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) } /* Choose a compression scheme from amongst those mutually available */ - if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T85_L0)) + if ((s->mutual_compressions & T4_COMPRESSION_T85_L0)) s->line_compression = T4_COMPRESSION_T85_L0; - else if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T85)) + else if ((s->mutual_compressions & T4_COMPRESSION_T85)) s->line_compression = T4_COMPRESSION_T85; - else if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T6)) + else if ((s->mutual_compressions & T4_COMPRESSION_T6)) s->line_compression = T4_COMPRESSION_T6; - else if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T4_2D)) + else if ((s->mutual_compressions & T4_COMPRESSION_T4_2D)) s->line_compression = T4_COMPRESSION_T4_2D; else s->line_compression = T4_COMPRESSION_T4_1D; @@ -6809,13 +6809,13 @@ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s, /* Default to the basic modems. */ s->supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; - s->supported_compressions = T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D; - s->supported_bilevel_resolutions = T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400; + s->supported_compressions = T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D; + s->supported_bilevel_resolutions = T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400; s->supported_image_sizes = T4_SUPPORT_WIDTH_215MM | T4_SUPPORT_LENGTH_US_LETTER | T4_SUPPORT_LENGTH_US_LEGAL diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c index af90452d91..7ab68677c3 100644 --- a/libs/spandsp/src/t30_api.c +++ b/libs/spandsp/src/t30_api.c @@ -685,29 +685,32 @@ SPAN_DECLARE(int) t30_set_supported_modems(t30_state_t *s, int supported_modems) SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_compressions) { /* Mask out the ones we actually support today. */ - supported_compressions &= T4_SUPPORT_COMPRESSION_T4_1D - | T4_SUPPORT_COMPRESSION_T4_2D - | T4_SUPPORT_COMPRESSION_T6 - | T4_SUPPORT_COMPRESSION_T85 - | T4_SUPPORT_COMPRESSION_T85_L0 + supported_compressions &= T4_COMPRESSION_T4_1D + | T4_COMPRESSION_T4_2D + | T4_COMPRESSION_T6 + | T4_COMPRESSION_T85 + | T4_COMPRESSION_T85_L0 #if defined(SPANDSP_SUPPORT_T88) - | T4_SUPPORT_COMPRESSION_T88 + | T4_COMPRESSION_T88 +#endif + //| T4_COMPRESSION_T42_T81 +#if defined(SPANDSP_SUPPORT_SYCC_T81) + | T4_COMPRESSION_SYCC_T81 #endif - //| T4_SUPPORT_COMPRESSION_T81 #if defined(SPANDSP_SUPPORT_T43) - | T4_SUPPORT_COMPRESSION_T43 + | T4_COMPRESSION_T43 #endif #if defined(SPANDSP_SUPPORT_T45) - | T4_SUPPORT_COMPRESSION_T45 + | T4_COMPRESSION_T45 #endif #if 0 - | T4_SUPPORT_COMPRESSION_GRAYSCALE - | T4_SUPPORT_COMPRESSION_COLOUR - | T4_SUPPORT_COMPRESSION_12BIT - | T4_SUPPORT_COMPRESSION_COLOUR_TO_GRAY - | T4_SUPPORT_COMPRESSION_GRAY_TO_BILEVEL - | T4_SUPPORT_COMPRESSION_COLOUR_TO_BILEVEL - | T4_SUPPORT_COMPRESSION_RESCALING + | T4_COMPRESSION_GRAYSCALE + | T4_COMPRESSION_COLOUR + | T4_COMPRESSION_12BIT + | T4_COMPRESSION_COLOUR_TO_GRAY + | T4_COMPRESSION_GRAY_TO_BILEVEL + | T4_COMPRESSION_COLOUR_TO_BILEVEL + | T4_COMPRESSION_RESCALING #endif | 0; s->supported_compressions = supported_compressions; @@ -718,23 +721,23 @@ SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_c SPAN_DECLARE(int) t30_set_supported_bilevel_resolutions(t30_state_t *s, int supported_resolutions) { - supported_resolutions &= T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_R16_SUPERFINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_300_600 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_400_800 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_600_1200 - | T4_SUPPORT_RESOLUTION_1200_1200; + supported_resolutions &= T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_300_600 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_400_800 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_600_1200 + | T4_RESOLUTION_1200_1200; /* Make sure anything needed for colour is enabled as a bi-level image, as that is a rule from T.30. 100x100 is an exception, as it doesn't exist as a bi-level resolution. */ - supported_resolutions |= (s->supported_colour_resolutions & ~T4_SUPPORT_RESOLUTION_100_100); + supported_resolutions |= (s->supported_colour_resolutions & ~T4_RESOLUTION_100_100); s->supported_bilevel_resolutions = supported_resolutions; t30_build_dis_or_dtc(s); return 0; @@ -743,16 +746,16 @@ SPAN_DECLARE(int) t30_set_supported_bilevel_resolutions(t30_state_t *s, int supp SPAN_DECLARE(int) t30_set_supported_colour_resolutions(t30_state_t *s, int supported_resolutions) { - supported_resolutions &= T4_SUPPORT_RESOLUTION_100_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_1200_1200; + supported_resolutions &= T4_RESOLUTION_100_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_1200_1200; s->supported_colour_resolutions = supported_resolutions; /* Make sure anything needed for colour is enabled as a bi-level image, as that is a rule from T.30. 100x100 is an exception, as it doesn't exist as a bi-level resolution. */ - s->supported_bilevel_resolutions |= (s->supported_colour_resolutions & ~T4_SUPPORT_RESOLUTION_100_100); + s->supported_bilevel_resolutions |= (s->supported_colour_resolutions & ~T4_RESOLUTION_100_100); t30_build_dis_or_dtc(s); return 0; } diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 14910dfd98..616452a406 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -740,20 +740,20 @@ static void select_tiff_compression(t4_rx_state_t *s, int output_image_type) { /* Only provide for one form of coding throughout the file, even though the coding on the wire could change between pages. */ - if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T85)) + if ((s->supported_tiff_compressions & T4_COMPRESSION_T85)) s->tiff.compression = T4_COMPRESSION_T85; - else if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T6)) + else if ((s->supported_tiff_compressions & T4_COMPRESSION_T6)) s->tiff.compression = T4_COMPRESSION_T6; - else if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T4_2D)) + else if ((s->supported_tiff_compressions & T4_COMPRESSION_T4_2D)) s->tiff.compression = T4_COMPRESSION_T4_2D; - else if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T4_1D)) + else if ((s->supported_tiff_compressions & T4_COMPRESSION_T4_1D)) s->tiff.compression = T4_COMPRESSION_T4_1D; } else { - if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T42_T81)) + if ((s->supported_tiff_compressions & T4_COMPRESSION_T42_T81)) s->tiff.compression = T4_COMPRESSION_T42_T81; - else if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T43)) + else if ((s->supported_tiff_compressions & T4_COMPRESSION_T43)) s->tiff.compression = T4_COMPRESSION_T43; } } 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 c862a2ba80..be425bb765 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 @@ -63,7 +63,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 1002, COMPRESSION_CCITT_T4, 0 }, @@ -72,7 +72,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 1002, COMPRESSION_CCITT_T4, 1 }, @@ -81,7 +81,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 237, COMPRESSION_CCITT_T4, 2 }, @@ -90,7 +90,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 237, COMPRESSION_CCITT_T4, 3 }, @@ -99,7 +99,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 400, COMPRESSION_CCITT_T4, 4 }, @@ -108,7 +108,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 1079, COMPRESSION_CCITT_T4, 5 }, @@ -117,7 +117,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 1728, COMPRESSION_CCITT_T4, 6 }, @@ -153,7 +153,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 1079, COMPRESSION_CCITT_T4, 5 }, @@ -178,12 +178,6 @@ struct int photo_metric = PHOTOMETRIC_MINISWHITE; int fill_order = FILLORDER_LSB2MSB; -static void clear_row(uint8_t buf[], int width) -{ - memset(buf, 0, width/8 + 1); -} -/*- End of function --------------------------------------------------------*/ - static void set_pixel(uint8_t buf[], int row, int pixel) { row--; @@ -191,13 +185,6 @@ static void set_pixel(uint8_t buf[], int row, int pixel) } /*- End of function --------------------------------------------------------*/ -static void clear_pixel(uint8_t buf[], int row, int pixel) -{ - row--; - buf[row*1728/8 + pixel/8] &= ~(0x80 >> (pixel & 0x07)); -} -/*- End of function --------------------------------------------------------*/ - static void set_pixel_range(uint8_t buf[], int row, int start, int end) { int i; @@ -207,6 +194,13 @@ static void set_pixel_range(uint8_t buf[], int row, int start, int end) } /*- End of function --------------------------------------------------------*/ +static void clear_pixel(uint8_t buf[], int row, int pixel) +{ + row--; + buf[row*1728/8 + pixel/8] &= ~(0x80 >> (pixel & 0x07)); +} +/*- End of function --------------------------------------------------------*/ + static void clear_pixel_range(uint8_t buf[], int row, int start, int end) { int i; @@ -216,6 +210,12 @@ static void clear_pixel_range(uint8_t buf[], int row, int start, int end) } /*- End of function --------------------------------------------------------*/ +static void clear_row(uint8_t buf[], int width) +{ + memset(buf, 0, width/8 + 1); +} +/*- End of function --------------------------------------------------------*/ + static int create_white_page(TIFF *tiff_file) { uint8_t image_buffer[8192]; @@ -593,7 +593,6 @@ int main(int argc, char *argv[]) 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, photo_metric); TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order); @@ -625,6 +624,7 @@ int main(int argc, char *argv[]) image_length = sequence[i].length; TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1); TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); + TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, 128); TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, image_length); TIFFCheckpointDirectory(tiff_file); @@ -665,7 +665,11 @@ int main(int argc, char *argv[]) break; } /* ....then the directory entry, and libtiff is happy. */ - TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, image_length); + if (image_length != sequence[i].length) + { + printf("Length mismatch - %d: %d vs %d\n", i, image_length, sequence[i].length); + exit(2); + } TIFFWriteDirectory(tiff_file); } diff --git a/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c b/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c index 550d4e1e21..857ccbee72 100644 --- a/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c +++ b/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c @@ -63,7 +63,6 @@ int main(int argc, char *argv[]) { int image_width; int row; - int resunit; int output_compression; int output_t4_options; uint8_t image_buffer[1024]; @@ -99,7 +98,6 @@ int main(int argc, char *argv[]) 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); @@ -108,16 +106,15 @@ int main(int argc, char *argv[]) y_resolution = y_res/100.0f; TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*2.54f + 0.5f)); TIFFSetField(tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*2.54f + 0.5f)); - resunit = RESUNIT_INCH; - TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit); + TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); - TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "spandsp"); if (gethostname(buf, sizeof(buf)) == 0) TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, buf); + TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "Spandsp"); TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Checkerboard or dithered ones"); TIFFSetField(tiff_file, TIFFTAG_MAKE, "soft-switch.org"); - TIFFSetField(tiff_file, TIFFTAG_MODEL, "test data"); + TIFFSetField(tiff_file, TIFFTAG_MODEL, "testy"); time(&now); tm = localtime(&now); @@ -131,6 +128,7 @@ int main(int argc, char *argv[]) tm->tm_sec); TIFFSetField(tiff_file, TIFFTAG_DATETIME, buf); + TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, image_length); TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, image_length); TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1); TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); 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 66932c6e82..dcede55457 100644 --- a/libs/spandsp/test-data/itu/fax/generate_sized_pages.c +++ b/libs/spandsp/test-data/itu/fax/generate_sized_pages.c @@ -2,7 +2,7 @@ * SpanDSP - a series of DSP components for telephony * * generate_sized_pages.c - Create a series of TIFF files in the various page sizes - * and resolutions. + * and resolutions. * * Written by Steve Underwood * @@ -55,6 +55,7 @@ struct int y_res; int width; int length; + int squashing_factor; } sequence[] = { { @@ -62,304 +63,531 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100 + 1100, + 1 }, { "bilevel_R8_385_B4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_B4, - 1200 + 1200, + 1 }, { "bilevel_R8_385_A3.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A3, - 1556 + 1556, + 1 }, { "bilevel_R8_77_A4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_FINE, T4_WIDTH_R8_A4, - 1100*2 + 1100*2, + 1 }, { "bilevel_R8_77_B4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_FINE, T4_WIDTH_R8_B4, - 1200*2 + 1200*2, + 1 }, { "bilevel_R8_77_A3.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_FINE, T4_WIDTH_R8_A3, - 1556*2 + 1556*2, + 1 }, { "bilevel_R8_154_A4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R8_A4, - 1100*4 + 1100*4, + 1 }, { "bilevel_R8_154_B4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R8_B4, - 1200*4 + 1200*4, + 1 }, { "bilevel_R8_154_A3.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R8_A3, - 1556*4 + 1556*4, + 1 }, { "bilevel_R16_154_A4.tif", T4_X_RESOLUTION_R16, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R16_A4, - 1100*4 + 1100*4, + 1 }, { "bilevel_R16_154_B4.tif", T4_X_RESOLUTION_R16, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R16_B4, - 1200*4 + 1200*4, + 1 }, { "bilevel_R16_154_A3.tif", T4_X_RESOLUTION_R16, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R16_A3, - 1556*4 + 1556*4, + 1 }, { "bilevel_200_100_A4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_100, T4_WIDTH_200_A4, - 1100 + 1100, + 1 }, { "bilevel_200_100_B4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_100, T4_WIDTH_200_B4, - 1200 + 1200, + 1 }, { "bilevel_200_100_A3.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_100, T4_WIDTH_200_A3, - 1556 + 1556, + 1 }, { "bilevel_200_200_A4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_200, T4_WIDTH_200_A4, - 1100*2 + 1100*2, + 1 }, { "bilevel_200_200_B4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_200, T4_WIDTH_200_B4, - 1200*2 + 1200*2, + 1 }, { "bilevel_200_200_A3.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_200, T4_WIDTH_200_A3, - 1556*2 + 1556*2, + 1 }, { "bilevel_200_400_A4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_400, T4_WIDTH_200_A4, - 1100*4 + 1100*4, + 1 }, { "bilevel_200_400_B4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_400, T4_WIDTH_200_B4, - 1200*4 + 1200*4, + 1 }, { "bilevel_200_400_A3.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_400, T4_WIDTH_200_A3, - 1556*4 + 1556*4, + 1 }, { "bilevel_300_300_A4.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_300, T4_WIDTH_300_A4, - 1100*3 + 1100*3, + 1 }, { "bilevel_300_300_B4.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_300, T4_WIDTH_300_B4, - 1200*3 + 1200*3, + 1 }, { "bilevel_300_300_A3.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_300, T4_WIDTH_300_A3, - 1556*3 + 1556*3, + 1 }, { "bilevel_300_600_A4.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_600, T4_WIDTH_300_A4, - 1100*6 + 1100*6, + 1 }, { "bilevel_300_600_B4.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_600, T4_WIDTH_300_B4, - 1200*6 + 1200*6, + 1 }, { "bilevel_300_600_A3.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_600, T4_WIDTH_300_A3, - 1556*6 + 1556*6, + 1 }, { "bilevel_400_400_A4.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_400, T4_WIDTH_400_A4, - 1100*4 + 1100*4, + 1 }, { "bilevel_400_400_B4.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_400, T4_WIDTH_400_B4, - 1200*4 + 1200*4, + 1 }, { "bilevel_400_400_A3.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_400, T4_WIDTH_400_A3, - 1556*4 + 1556*4, + 1 }, { "bilevel_400_800_A4.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_800, T4_WIDTH_400_A4, - 1100*8 + 1100*8, + 1 }, { "bilevel_400_800_B4.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_800, T4_WIDTH_400_B4, - 1200*8 + 1200*8, + 1 }, { "bilevel_400_800_A3.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_800, T4_WIDTH_400_A3, - 1556*8 + 1556*8, + 1 }, { "bilevel_600_600_A4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_600, T4_WIDTH_600_A4, - 1100*6 + 1100*6, + 1 }, { "bilevel_600_600_B4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_600, T4_WIDTH_600_B4, - 1200*6 + 1200*6, + 1 }, { "bilevel_600_600_A3.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_600, T4_WIDTH_600_A3, - 1556*6 + 1556*6, + 1 }, { "bilevel_600_1200_A4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_1200, T4_WIDTH_600_A4, - 1100*12 + 1100*12, + 1 }, { "bilevel_600_1200_B4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_1200, T4_WIDTH_600_B4, - 1200*12 + 1200*12, + 1 }, { "bilevel_600_1200_A3.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_1200, T4_WIDTH_600_A3, - 1556*12 + 1556*12, + 1 }, { "bilevel_1200_1200_A4.tif", T4_X_RESOLUTION_1200, T4_Y_RESOLUTION_1200, T4_WIDTH_1200_A4, - 1100*12 + 1100*12, + 1 }, { "bilevel_1200_1200_B4.tif", T4_X_RESOLUTION_1200, T4_Y_RESOLUTION_1200, T4_WIDTH_1200_B4, - 1200*12 + 1200*12, + 1 }, { "bilevel_1200_1200_A3.tif", T4_X_RESOLUTION_1200, T4_Y_RESOLUTION_1200, T4_WIDTH_1200_A3, - 1556*12 + 1556*12, + 1 + }, + { + "bilevel_R8_77SQ_A4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + 2 + }, + { + "bilevel_R8_77SQ_B4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_B4, + 1200, + 2 + }, + { + "bilevel_R8_77SQ_A3.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A3, + 1556, + 2 + }, + { + "bilevel_R8_154SQSQ_A4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + 4 + }, + { + "bilevel_R8_154SQSQ_B4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_B4, + 1200, + 4 + }, + { + "bilevel_R8_154SQSQ_A3.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A3, + 1556, + 4 + }, + { + "bilevel_R8_154SQ_A4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_FINE, + T4_WIDTH_R8_A4, + 1100*2, + 2 + }, + { + "bilevel_R8_154SQ_B4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_FINE, + T4_WIDTH_R8_B4, + 1200*2, + 2 + }, + { + "bilevel_R8_154SQ_A3.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_FINE, + T4_WIDTH_R8_A3, + 1556*2, + 2 + }, + { + "bilevel_200_200SQ_A4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_A4, + 1100, + 2 + }, + { + "bilevel_200_200SQ_B4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_B4, + 1200, + 2 + }, + { + "bilevel_200_200SQ_A3.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_A3, + 1556, + 2 + }, + { + "bilevel_200_400SQSQ_A4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_A4, + 1100, + 4 + }, + { + "bilevel_200_400SQSQ_B4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_B4, + 1200, + 4 + }, + { + "bilevel_200_400SQSQ_A3.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_A3, + 1556, + 4 + }, + { + "bilevel_200_400SQ_A4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_200, + T4_WIDTH_200_A4, + 1100*2, + 2 + }, + { + "bilevel_200_400SQ_B4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_200, + T4_WIDTH_200_B4, + 1200*2, + 2 + }, + { + "bilevel_200_400SQ_A3.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_200, + T4_WIDTH_200_A3, + 1556*2, + 2 }, { NULL, 0, 0, 0, + 0, 0 }, }; +static void set_pixel(uint8_t buf[], int row, int pixel) +{ + row--; + buf[row*1728/8 + pixel/8] |= (0x80 >> (pixel & 0x07)); +} +/*- End of function --------------------------------------------------------*/ + +static void set_pixel_range(uint8_t buf[], int row, int start, int end) +{ + int i; + + for (i = start; i <= end; i++) + set_pixel(buf, row, i); +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +static void clear_pixel(uint8_t buf[], int row, int pixel) +{ + row--; + buf[row*1728/8 + pixel/8] &= ~(0x80 >> (pixel & 0x07)); +} +/*- End of function --------------------------------------------------------*/ + +static void clear_pixel_range(uint8_t buf[], int row, int start, int end) +{ + int i; + + for (i = start; i <= end; i++) + clear_pixel(buf, row, i); +} +/*- End of function --------------------------------------------------------*/ +#endif + +static void clear_row(uint8_t buf[], int width) +{ + memset(buf, 0, width/8 + 1); +} +/*- End of function --------------------------------------------------------*/ + int main(int argc, char *argv[]) { int row; @@ -371,6 +599,8 @@ int main(int argc, char *argv[]) float x_resolution; float y_resolution; int i; + int j; + int k; int opt; int compression; int photo_metric; @@ -424,7 +654,6 @@ int main(int argc, char *argv[]) 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, photo_metric); TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order); @@ -435,13 +664,13 @@ int main(int argc, char *argv[]) TIFFSetField(tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*2.54f + 0.5f)); TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); - TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "spandsp"); if (gethostname(buf, sizeof(buf)) == 0) TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, buf); - TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Blank test image"); + TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "Spandsp"); + TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Diagonally striped test image"); TIFFSetField(tiff_file, TIFFTAG_MAKE, "soft-switch.org"); - TIFFSetField(tiff_file, TIFFTAG_MODEL, "test data"); + TIFFSetField(tiff_file, TIFFTAG_MODEL, "testy"); time(&now); tm = localtime(&now); @@ -455,6 +684,7 @@ int main(int argc, char *argv[]) tm->tm_sec); TIFFSetField(tiff_file, TIFFTAG_DATETIME, buf); + TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, sequence[i].length); TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, sequence[i].length); TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1); TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); @@ -462,9 +692,18 @@ int main(int argc, char *argv[]) TIFFCheckpointDirectory(tiff_file); /* Write the image first.... */ + /* Produce a pattern of diagonal bands */ for (row = 0; row < sequence[i].length; row++) { - memset(image_buffer, 0, sequence[i].width/8 + 1); + clear_row(image_buffer, sequence[i].width); + for (j = 0; j < sequence[i].squashing_factor; j++) + { + k = row*sequence[i].squashing_factor + j; + if (((k/sequence[i].width) & 1) == 0) + set_pixel_range(image_buffer, 1, k%sequence[i].width, sequence[i].width - 1); + else + set_pixel_range(image_buffer, 1, 0, k%sequence[i].width); + } if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) { printf("Write error at row %d.\n", row); diff --git a/libs/spandsp/test-data/itu/fax/generate_striped_pages.c b/libs/spandsp/test-data/itu/fax/generate_striped_pages.c index 1232ca6896..8ad5098ca4 100644 --- a/libs/spandsp/test-data/itu/fax/generate_striped_pages.c +++ b/libs/spandsp/test-data/itu/fax/generate_striped_pages.c @@ -81,11 +81,14 @@ int main(int argc, char *argv[]) TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, 204.0f); TIFFSetField(tiff_file, TIFFTAG_YRESOLUTION, 196.0f); TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); - TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "Spandsp"); - TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, "host"); TIFFSetField(tiff_file, TIFFTAG_FAXSUBADDRESS, "1111"); + + if (gethostname(buf, sizeof(buf)) == 0) + TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, buf); + + TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "Spandsp"); TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Image in stripes"); - TIFFSetField(tiff_file, TIFFTAG_MAKE, "spandsp"); + TIFFSetField(tiff_file, TIFFTAG_MAKE, "soft-switch.org"); TIFFSetField(tiff_file, TIFFTAG_MODEL, "testy"); time(&now); diff --git a/libs/spandsp/tests/fax_tests.c b/libs/spandsp/tests/fax_tests.c index f89f86f98f..502da1bbbd 100644 --- a/libs/spandsp/tests/fax_tests.c +++ b/libs/spandsp/tests/fax_tests.c @@ -860,81 +860,95 @@ int main(int argc, char *argv[]) case 0: /* Allow anything */ t30_set_supported_bilevel_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_R16_SUPERFINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_300_600 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_400_800 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_600_1200 - | T4_SUPPORT_RESOLUTION_1200_1200); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_300_600 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_400_800 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_600_1200 + | T4_RESOLUTION_1200_1200); break; case 1: /* Allow anything metric */ t30_set_supported_bilevel_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_R16_SUPERFINE); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE); break; case 2: /* Allow anything inch based */ t30_set_supported_bilevel_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_300_600 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_400_800 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_600_1200 - | T4_SUPPORT_RESOLUTION_1200_1200); + T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_300_600 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_400_800 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_600_1200 + | T4_RESOLUTION_1200_1200); break; case 3: /* Allow only restricted length resolution */ t30_set_supported_bilevel_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200); break; case 4: /* Allow only more restricted length resolution */ t30_set_supported_bilevel_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_200_100); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_200_100); break; } if (colour_enabled) { t30_set_supported_colour_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_100_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_1200_1200); + T4_RESOLUTION_100_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_1200_1200); } else { t30_set_supported_colour_resolutions(t30_state[i], 0); } - t30_set_supported_output_compressions(t30_state[i], T4_SUPPORT_COMPRESSION_T4_2D); + t30_set_supported_output_compressions(t30_state[i], T4_COMPRESSION_T4_2D); t30_set_ecm_capability(t30_state[i], use_ecm); t30_set_supported_compressions(t30_state[i], - T4_SUPPORT_COMPRESSION_T4_1D - | T4_SUPPORT_COMPRESSION_T4_2D - | T4_SUPPORT_COMPRESSION_T6 - //| T4_SUPPORT_COMPRESSION_t42_T81 - | T4_SUPPORT_COMPRESSION_T85 - | T4_SUPPORT_COMPRESSION_T85_L0); + T4_COMPRESSION_T4_1D + | T4_COMPRESSION_T4_2D + | T4_COMPRESSION_T6 + | T4_COMPRESSION_T85 + | T4_COMPRESSION_T85_L0 +#if 0 + //| T4_COMPRESSION_T88 + | T4_COMPRESSION_T43 + | T4_COMPRESSION_T45 + | T4_COMPRESSION_T42_T81 + | T4_COMPRESSION_SYCC_T81 + | T4_COMPRESSION_GRAYSCALE + | T4_COMPRESSION_COLOUR + | T4_COMPRESSION_12BIT + | T4_COMPRESSION_COLOUR_TO_GRAY + | T4_COMPRESSION_GRAY_TO_BILEVEL + | T4_COMPRESSION_COLOUR_TO_BILEVEL + | T4_COMPRESSION_RESCALING +#endif + | 0); t30_set_minimum_scan_line_time(t30_state[i], scan_line_time); if (mode[i] == T38_GATEWAY_FAX) diff --git a/libs/spandsp/tests/fax_tests.sh b/libs/spandsp/tests/fax_tests.sh index 1fa6d4e19a..b09609e3f3 100755 --- a/libs/spandsp/tests/fax_tests.sh +++ b/libs/spandsp/tests/fax_tests.sh @@ -39,6 +39,31 @@ run_fax_test() echo tested ${FILE} } +run_fax_squash_test() +{ + # Test with lengthwise squashing of a bilevel image + rm -f fax_tests.tif + echo ./fax_tests -b ${SQ} ${OPTS} -i ${IN_FILE} + ./fax_tests -b ${SQ} ${OPTS} -i ${IN_FILE} >xyzzy 2>xyzzy2 + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo fax_tests failed! + exit $RETVAL + fi + # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t + # option means the normal differences in tags will be ignored. + tiffcmp -t ${OUT_FILE} fax_tests.tif >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo fax_tests failed! + exit $RETVAL + fi + rm -f fax_tests.tif + echo tested ${FILE} +} + run_colour_fax_test() { rm -f fax_tests.tif @@ -96,20 +121,20 @@ do # run_colour_fax_test done -# Colour/gray -> colour/gray by allowing ECM +# Colour/gray -> colour/gray for OPTS in "-p AA -C -e" "-p TT -C -e" "-p GG -C -e" "-p TG -C -e" "-p GT -C -e" do echo Colour to colour tests disabled # IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" -# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" +# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-out.tif" # run_colour_fax_test # IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" -# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" +# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-out.tif" # run_colour_fax_test # IN_FILE="${TIFFFX_DIR}/c03x_02x.tif" -# OUT_FILE="${TIFFFX_DIR}/c03x_02x.tif" +# OUT_FILE="${TIFFFX_DIR}/c03x_02x-out.tif" # run_colour_fax_test # IN_FILE="${TIFFFX_DIR}/l02x_02x.tif" @@ -121,6 +146,105 @@ do # run_colour_fax_test done +# Bi-level tests with image squashing +for OPTS in "-p AA" "-p AA -e" "-p TT" "-p TT -e" "-p GG" "-p GG -e" "-p TG" "-p TG -e" "-p GT" "-p GT -e" +do + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_A4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_B4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_A3.tif" + SQ=4 + run_fax_squash_test + + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_A4.tif" + SQ=3 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_B4.tif" + SQ=3 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_A3.tif" + SQ=3 + run_fax_squash_test + + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_A4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_B4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_A3.tif" + SQ=4 + run_fax_squash_test + + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_A4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_B4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_A3.tif" + SQ=4 + run_fax_squash_test + + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_A4.tif" + SQ=3 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_B4.tif" + SQ=3 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_A3.tif" + SQ=3 + run_fax_squash_test + + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_A4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_B4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_A3.tif" + SQ=4 + run_fax_squash_test +done + # Bi-level tests for OPTS in "-p AA" "-p AA -e" "-p TT" "-p TT -e" "-p GG" "-p GG -e" "-p TG" "-p TG -e" "-p GT" "-p GT -e" do diff --git a/libs/spandsp/tests/t38_decode.c b/libs/spandsp/tests/t38_decode.c index 47716ca7bf..c65cb2027d 100644 --- a/libs/spandsp/tests/t38_decode.c +++ b/libs/spandsp/tests/t38_decode.c @@ -440,7 +440,7 @@ int main(int argc, char *argv[]) t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A'); t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A'); t30_set_ecm_capability(t30, use_ecm); - t30_set_supported_compressions(t30, T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D | T4_SUPPORT_COMPRESSION_T6 | T4_SUPPORT_COMPRESSION_T85); + t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6 | T4_COMPRESSION_T85); if (pcap_scan_pkts(input_file_name, src_addr, src_port, dest_addr, dest_port, t38_terminal_timing_update, process_packet, NULL)) exit(2); @@ -497,7 +497,7 @@ int main(int argc, char *argv[]) t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'B'); t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'B'); t30_set_ecm_capability(t30, use_ecm); - t30_set_supported_compressions(t30, T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D | T4_SUPPORT_COMPRESSION_T6); + t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6); logging = fax_get_logging_state(fax_state); span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); diff --git a/libs/spandsp/tests/tsb85_tests.c b/libs/spandsp/tests/tsb85_tests.c index 74f397d819..d8f626520c 100644 --- a/libs/spandsp/tests/tsb85_tests.c +++ b/libs/spandsp/tests/tsb85_tests.c @@ -393,23 +393,23 @@ static void fax_prepare(void) | T4_SUPPORT_LENGTH_US_LEGAL | T4_SUPPORT_LENGTH_UNLIMITED); t30_set_supported_bilevel_resolutions(t30, - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_R16_SUPERFINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_300_600 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_400_800 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_600_1200 - | T4_SUPPORT_RESOLUTION_1200_1200); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_300_600 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_400_800 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_600_1200 + | T4_RESOLUTION_1200_1200); t30_set_supported_colour_resolutions(t30, 0); t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17); - t30_set_supported_compressions(t30, T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D | T4_SUPPORT_COMPRESSION_T6); + t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6); t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'A'); t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A'); t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A'); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 0dceef6a37..02623fd20e 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -879,14 +879,14 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) T4_SUPPORT_LENGTH_US_LETTER | T4_SUPPORT_LENGTH_US_LEGAL | T4_SUPPORT_LENGTH_UNLIMITED | T4_SUPPORT_WIDTH_215MM | T4_SUPPORT_WIDTH_255MM | T4_SUPPORT_WIDTH_303MM); t30_set_supported_bilevel_resolutions(t30, - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_R16_SUPERFINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400 - | T4_SUPPORT_RESOLUTION_400_400); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_400_400); t30_set_supported_colour_resolutions(t30, 0); if (pvt->disable_v17) { @@ -898,11 +898,11 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) } if (pvt->use_ecm) { - t30_set_supported_compressions(t30, T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D | T4_SUPPORT_COMPRESSION_T6 | T4_SUPPORT_COMPRESSION_T85 | T4_SUPPORT_COMPRESSION_T85_L0); + t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6 | T4_COMPRESSION_T85 | T4_COMPRESSION_T85_L0); t30_set_ecm_capability(t30, TRUE); switch_channel_set_variable(channel, "fax_ecm_requested", "1"); } else { - t30_set_supported_compressions(t30, T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D); + t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D); switch_channel_set_variable(channel, "fax_ecm_requested", "0"); }