From 1757331eafd8d9708a815cf3aa94740c44988651 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Tue, 2 Apr 2013 00:18:21 +0800 Subject: [PATCH] Some cleanup of naming to prepare for the next step with spandsp --- .../spandsp/private/t30_dis_dtc_dcs_bits.h | 165 ++++++++++-- libs/spandsp/src/spandsp/t30.h | 22 +- libs/spandsp/src/spandsp/t30_api.h | 4 +- libs/spandsp/src/spandsp/t4_rx.h | 186 +++++++++---- libs/spandsp/src/t30.c | 114 ++++---- libs/spandsp/src/t30_api.c | 24 +- libs/spandsp/src/t4_rx.c | 158 ++++++------ libs/spandsp/src/t4_t6_decode.c | 18 +- libs/spandsp/src/t4_t6_encode.c | 20 +- libs/spandsp/src/t4_tx.c | 146 +++++------ libs/spandsp/test-data/itu/fax/Makefile.am | 72 +++--- .../test-data/itu/fax/generate_dithered_tif.c | 4 +- .../test-data/itu/fax/generate_sized_pages.c | 244 ++++++++++++------ libs/spandsp/tests/fax_decode.c | 10 +- libs/spandsp/tests/fax_tests.c | 18 +- libs/spandsp/tests/fax_tests.sh | 100 ++++--- libs/spandsp/tests/t38_decode.c | 4 +- libs/spandsp/tests/t4_t6_tests.c | 16 +- libs/spandsp/tests/t4_tests.c | 42 +-- libs/spandsp/tests/tsb85_tests.c | 18 +- .../mod_spandsp/mod_spandsp_fax.c | 4 +- 21 files changed, 867 insertions(+), 522 deletions(-) diff --git a/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h b/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h index 9ec15f5f27..8402d09470 100644 --- a/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h +++ b/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h @@ -34,6 +34,8 @@ #define T30_DIS_BIT_T37 1 #define T30_DCS_BIT_T37 1 +/* Bit 2 in a DIS, DTC, or DCS is "reserved", so it should be set to zero */ + /* Indicates that the terminal has the capability to communicate using ITU-T Rec. T.38. Internet address signals CIA, TSA or CSA can be sent and received. The recipient terminal may process or ignore this signal. */ @@ -45,15 +47,22 @@ #define T30_DIS_BIT_3G_MOBILE 4 #define T30_DCS_BIT_3G_MOBILE 4 +/* Bit 5 in a DIS, DTC, or DCS is "reserved", so it should be set to zero */ + /* When ISDN mode is used, in DIS/DTC bit 6 shall be set to "0". */ #define T30_DIS_BIT_V8_CAPABILITY 6 +/* Bit 6 in a DCS is "invalid", and should be set to zero */ /* When ISDN mode is used, in DIS/DTC bit 7 shall be set to "0". */ #define T30_DIS_BIT_64_OCTET_ECM_FRAMES_PREFERRED 7 +/* Bit 7 in a DCS is "invalid", and should be set to zero */ + +/* Bit 8 in a DIS, DTC, or DCS is "reserved", so it should be set to zero */ /* Bit 9 indicates that there is a facsimile document ready to be polled from the answering terrminal. It is not an indication of a capability. */ #define T30_DIS_BIT_READY_TO_TRANSMIT_FAX_DOCUMENT 9 +/* Bit 9 in a DCS should be set to zero */ /* In DIS/DTC bit 10 indicates that the answering terminal has receiving capabilities. In DCS it is a command to the receiving terminal to set itself in the receive mode. */ @@ -79,26 +88,39 @@ /* When ISDN mode is used, in DIS/DTC bits 21 to 23 shall be set to "1". */ +/* Bit 24 is an extension bit */ + +/* Bit 25 in a DIS, DTC, or DCS is "reserved", so it should be set to zero */ + #define T30_DIS_BIT_UNCOMPRESSED_CAPABLE 26 #define T30_DCS_BIT_UNCOMPRESSED_MODE 26 /* When ISDN mode is used, in DIS/DTC bit 27 shall be set to "1". */ #define T30_DIS_BIT_ECM_CAPABLE 27 -#define T30_DCS_BIT_ECM 27 +#define T30_DCS_BIT_ECM_MODE 27 -/* The value of bit 28 in the DCS command is only valid when ECM is selected. */ +/* Bit 28 in a DIS or DTC should be set to zero */ +/* (T.30 note 7) The value of bit 28 in the DCS command is only valid when ECM is selected. */ #define T30_DCS_BIT_64_OCTET_ECM_FRAMES 28 -/* The value of bit 31 in the DCS command is only valid when ECM is selected. */ +/* Bit 29 in a DIS, DTC, or DCS is "reserved", so it should be set to zero */ + +/* Bit 30 in a DIS, DTC, or DCS is "reserved", so it should be set to zero */ + +/* (T.30 note 9) The value of bit 31 in the DCS command is only valid when ECM is selected. */ #define T30_DIS_BIT_T6_CAPABLE 31 #define T30_DCS_BIT_T6_MODE 31 +/* Bit 32 is an extension bit */ + #define T30_DIS_BIT_FNV_CAPABLE 33 #define T30_DCS_BIT_FNV_CAPABLE 33 #define T30_DIS_BIT_MULTIPLE_SELECTIVE_POLLING_CAPABLE 34 +/* Bit 34 in a DCS should be set to zero */ #define T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE 35 +/* Bit 35 in a DCS should be set to zero */ #define T30_DIS_BIT_T43_CAPABLE 36 #define T30_DCS_BIT_T43_MODE 36 @@ -109,33 +131,44 @@ #define T30_DIS_BIT_G726_CAPABLE 38 #define T30_DCS_BIT_G726 38 +/* Bit 39 in a DIS, DTC, or DCS is "reserved for extended voice coding", so it should be set to zero */ + +/* Bit 40 is an extension bit */ + +/* This also enables R8 x 15.4/mm mode */ #define T30_DIS_BIT_200_400_CAPABLE 41 #define T30_DCS_BIT_200_400 41 #define T30_DIS_BIT_300_300_CAPABLE 42 #define T30_DCS_BIT_300_300 42 +/* This also enables R16 x 15.4/mm mode */ #define T30_DIS_BIT_400_400_CAPABLE 43 #define T30_DCS_BIT_400_400 43 -/* Bits 44 and 45 are used only in conjunction with bits 15 and 43. Bit 44 in DCS, when used, - shall correctly indicate the resolution of the transmitted document, which means that bit 44 in DCS may - not always match the indication of bits 44 and 45 in DIS/DTC. Cross selection will cause the distortion - and reduction of reproducible area. +/* Bits 44 and 45 are used only in conjunction with bits 15 and 43. Bit 44 in DCS, when used, shall correctly + indicate the resolution of the transmitted document, which means that bit 44 in DCS may not always match the + indication of bits 44 and 45 in DIS/DTC. Cross selection will cause the distortion and reduction of reproducible + area. If a receiver indicates in DIS that it prefers to receive metric-based information, but the transmitter has only the equivalent inch-based information (or vice versa), then communication shall still take place. - Bits 44 and 45 do not require the provision of any additional features on the terminal to - indicate to the sending or receiving user whether the information was transmitted or received on a metric-metric, - inch-inch, metric-inch, inch-metric basis. */ + Bits 44 and 45 do not require the provision of any additional features on the terminal to indicate to the + sending or receiving user whether the information was transmitted or received on a metric-metric, inch-inch, + metric-inch, inch-metric basis. */ #define T30_DIS_BIT_INCH_RESOLUTION_PREFERRED 44 #define T30_DCS_BIT_INCH_RESOLUTION 44 #define T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED 45 +/* Bit 45 in a DCS is "don't care", so it should be set to zero */ #define T30_DIS_BIT_MIN_SCAN_TIME_HALVES 46 +/* Bit 46 in a DCS is "don't care", so it should be set to zero */ #define T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE 47 +/* Bit 47 in a DCS should be set to zero */ + +/* Bit 48 is an extension bit */ #define T30_DIS_BIT_SUBADDRESSING_CAPABLE 49 #define T30_DCS_BIT_SUBADDRESS_TRANSMISSION 49 @@ -146,6 +179,9 @@ /* Bit 51 indicates that there is a data file ready to be polled from the answering terminal. It is not an indication of a capability. This bit is used in conjunction with bits 53, 54, 55 and 57. */ #define T30_DIS_BIT_READY_TO_TRANSMIT_DATA_FILE 51 +/* Bit 51 in a DCS should be set to zero */ + +/* Bit 52 in a DIS, DTC, or DCS is "reserved", so it should be set to zero */ /* The binary file transfer protocol is described in ITU-T Rec. T.434. */ #define T30_DIS_BIT_BFT_CAPABLE 53 @@ -157,21 +193,33 @@ #define T30_DIS_BIT_EDI_CAPABLE 55 #define T30_DCS_BIT_EDI 55 +/* Bit 56 is an extension bit */ + #define T30_DIS_BIT_BTM_CAPABLE 57 #define T30_DCS_BIT_BTM 57 +/* Bit 58 in a DIS, DTC, or DCS is "reserved", so it should be set to zero */ + /* Bit 59 indicates that there is a character-coded or mixed-mode document ready to be polled from the answering terminal. It is not an indication of a capability. This bit is used in conjunction with bits 60, 62 and 65. */ #define T30_DIS_BIT_READY_TO_TRANSMIT_MIXED_MODE_DOCUMENT 59 +/* Bit 59 in a DCS should be set to zero */ -#define T30_DIS_BIT_CHARACTER_MODE 60 +#define T30_DIS_BIT_CHARACTER_MODE_CAPABLE 60 #define T30_DCS_BIT_CHARACTER_MODE 60 +/* Bit 61 in a DIS, DTC, or DCS is "reserved", so it should be set to zero */ + #define T30_DIS_BIT_MIXED_MODE 62 #define T30_DCS_BIT_MIXED_MODE 62 +/* Bit 63 in a DIS, DTC, or DCS is "reserved", so it should be set to zero */ + +/* Bit 64 is an extension bit */ + #define T30_DIS_BIT_PROCESSABLE_MODE_26 65 +/* Bit 65 in a DCS should be set to zero */ #define T30_DIS_BIT_DIGITAL_NETWORK_CAPABLE 66 #define T30_DCS_BIT_DIGITAL_NETWORK_CAPABLE 66 @@ -185,6 +233,9 @@ #define T30_DIS_BIT_FULL_COLOUR_CAPABLE 69 #define T30_DCS_BIT_FULL_COLOUR_MODE 69 +/* Bit 70 in a DCS should be set to zero */ +#define T30_DCS_BIT_PREFERRED_HUFFMAN_TABLES 70 + /* In a DIS/DTC frame, setting bit 71 to "0" indicates that the called terminal can only accept image data which has been digitized to 8 bits/pel/component for JPEG mode. This is also true for T.43 mode if bit 36 is also set to "1". Setting bit 71 to "1" indicates that the called terminal can also accept @@ -197,6 +248,8 @@ #define T30_DIS_BIT_12BIT_CAPABLE 71 #define T30_DCS_BIT_12BIT_COMPONENT 71 +/* Bit 72 is an extension bit */ + #define T30_DIS_BIT_NO_SUBSAMPLING 73 #define T30_DCS_BIT_NO_SUBSAMPLING 73 @@ -215,9 +268,50 @@ #define T30_DIS_BIT_T85_CAPABLE 78 #define T30_DCS_BIT_T85_MODE 78 +/* (T.30 note 30) This capability should only be set if T30_DIS_BIT_T85_CAPABLE is also set */ #define T30_DIS_BIT_T85_L0_CAPABLE 79 #define T30_DCS_BIT_T85_L0_MODE 79 +/* Bit 80 is an extension bit */ + +#define T30_DIS_BIT_HKM_KEY_MANAGEMENT_CAPABLE 81 +#define T30_DCS_BIT_HKM_KEY_MANAGEMENT_MODE 81 + +#define T30_DIS_BIT_RSA_KEY_MANAGEMENT_CAPABLE 82 +#define T30_DCS_BIT_RSA_KEY_MANAGEMENT_MODE 82 + +#define T30_DIS_BIT_OVERRIDE_CAPABLE 83 +#define T30_DCS_BIT_OVERRIDE_MODE 83 + +#define T30_DIS_BIT_HFX40_CIPHER_CAPABLE 84 +#define T30_DCS_BIT_HFX40_CIPHER_MODE 84 + +#define T30_DIS_BIT_ALTERNATIVE_CIPHER_2_CAPABLE 85 +#define T30_DCS_BIT_ALTERNATIVE_CIPHER_2_MODE 85 + +#define T30_DIS_BIT_ALTERNATIVE_CIPHER_3_CAPABLE 86 +#define T30_DCS_BIT_ALTERNATIVE_CIPHER_3_MODE 86 + +#define T30_DIS_BIT_HFX40_I_HASHING_CAPABLE 87 +#define T30_DCS_BIT_HFX40_I_HASHING_MODE 87 + +/* Bit 88 is an extension bit */ + +#define T30_DIS_BIT_ALTERNATIVE_HASHING_2_CAPABLE 89 +#define T30_DCS_BIT_ALTERNATIVE_HASHING_2_MODE 89 + +#define T30_DIS_BIT_ALTERNATIVE_HASHING_3_CAPABLE 90 +#define T30_DCS_BIT_ALTERNATIVE_HASHING_3_MODE 90 + +/* Bit 91 in a DIS, DTC, or DCS is "reserved for suture security features", so it should be set to zero */ + +/* Bits 92 to 94 specify the mixed raster content mode. */ + +#define T30_DIS_BIT_T44_PAGE_LENGTH 95 +#define T30_DCS_BIT_T44_PAGE_LENGTH 95 + +/* Bit 96 is an extension bit */ + /* In a DIS/DTC frame, setting bit 97 to "0" indicates that the called terminal does not have the capability to accept 300 pels/25.4 mm x 300 lines/25.4 mm or 400 pels/25.4 mm x 400 lines/25.4 mm resolutions for colour/gray-scale images or T.44 Mixed Raster Content (MRC) mask layer. @@ -252,8 +346,8 @@ 1 1 1 yes yes yes yes "yes" means that the called terminal has the corresponding capability. "no" means that the called terminal does not have the corresponding capability. */ -#define T30_DIS_BIT_COLOUR_GREY_300_300_400_400_CAPABLE 97 -#define T30_DCS_BIT_COLOUR_GREY_300_300_400_400 97 +#define T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE 97 +#define T30_DCS_BIT_COLOUR_GRAY_300_300_400_400 97 /* In a DIS/DTC frame, setting bit 98 to "0" indicates that the called terminal does not have the capability to accept 100 pels/25.4 mm x 100 lines/25.4 mm spatial resolution for colour or gray-scale @@ -263,27 +357,39 @@ not use 100 pels/25.4 mm x 100 lines/25.4 mm spatial resolution for colour or gray-scale images. Setting bit 98 to "1" indicates that the calling terminal uses 100 pels/25.4 mm x 100 lines/25.4 mm spatial resolution for colour or gray-scale images. */ -#define T30_DIS_BIT_COLOUR_GREY_100_100_CAPABLE 98 -#define T30_DCS_BIT_COLOUR_GREY_100_100 98 +#define T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE 98 +#define T30_DCS_BIT_COLOUR_GRAY_100_100 98 + +#define T30_DIS_BIT_SIMPLE_PHASE_C_BFT_NEGOTIATIONS_CAPABLE 99 +#define T30_DCS_BIT_SIMPLE_PHASE_C_BFT_NEGOTIATIONS_CAPABLE 99 + +#define T30_DIS_BIT_EXTENDED_BFT_NEGOTIATIONS_CAPABLE 100 +/* Bit 100 in a DCS should be set to zero */ /* To provide an error recovery mechanism, when PWD/SEP/SUB/SID/PSA/IRA/ISP frames are sent with DCS or DTC, bits 49, 102 and 50 in DCS or bits 47, 101, 50 and 35 in DTC shall be set to "1" with the following meaning: + Bit DIS DTC DCS - 35 Polled SubAddress capability Polled SubAddress transmission Not allowed - set to "0" + 35 Polled sub-address capability Polled sub-address transmission Not allowed - set to "0" 47 Selective polling capability Selective polling transmission Not allowed - set to "0" - 49 Subaddressing capability Not allowed (Set to "0") Subaddressing transmission - 50 Password Password transmission Sender Identification transmission - 101 Internet Selective Polling Address capability Internet Selective Polling Address transmission Not allowed - set to "0" - 102 Internet Routing Address capability Not allowed (Set to "0") Internet Routing Address transmission + 49 Sub-addressing capability Not allowed (Set to "0") Sub-addressing transmission + 50 Password Password transmission Sender identification transmission + 101 Internet selective polling address capability Internet selective polling address transmission Not allowed - set to "0" + 102 Internet routing address capability Not allowed (Set to "0") Internet routing address transmission Terminals conforming to the 1993 version of T.30 may set the above bits to "0" even though PWD/SEP/SUB frames are transmitted. */ #define T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS 101 +/* Bit 101 in a DCS should be set to zero */ #define T30_DIS_BIT_INTERNET_ROUTING_ADDRESS 102 #define T30_DCS_BIT_INTERNET_ROUTING_ADDRESS_TRANSMISSION 102 +/* Bit 103 in a DIS, DTC, or DCS is "reserved", so it should be set to zero */ + +/* Bit 104 is an extension bit */ + #define T30_DIS_BIT_600_600_CAPABLE 105 #define T30_DCS_BIT_600_600 105 @@ -299,11 +405,15 @@ #define T30_DIS_BIT_600_1200_CAPABLE 109 #define T30_DCS_BIT_600_1200 109 -#define T30_DIS_BIT_COLOUR_GREY_600_600_CAPABLE 110 -#define T30_DCS_BIT_COLOUR_GREY_600_600 110 +/* This requires that bit 105 is also set */ +#define T30_DIS_BIT_COLOUR_GRAY_600_600_CAPABLE 110 +#define T30_DCS_BIT_COLOUR_GRAY_600_600 110 -#define T30_DIS_BIT_COLOUR_GREY_1200_1200_CAPABLE 111 -#define T30_DCS_BIT_COLOUR_GREY_1200_1200 111 +/* This requires that bit 106 is also set */ +#define T30_DIS_BIT_COLOUR_GRAY_1200_1200_CAPABLE 111 +#define T30_DCS_BIT_COLOUR_GRAY_1200_1200 111 + +/* Bit 112 is an extension bit */ #define T30_DIS_BIT_ALTERNATE_DOUBLE_SIDED_CAPABLE 113 #define T30_DCS_BIT_ALTERNATE_DOUBLE_SIDED_CAPABLE 113 @@ -312,10 +422,13 @@ #define T30_DCS_BIT_CONTINUOUS_DOUBLE_SIDED_CAPABLE 114 #define T30_DIS_BIT_BLACK_AND_WHITE_MRC 115 +/* Bit 115 in a DCS should be set to zero */ #define T30_DIS_BIT_T45_CAPABLE 116 #define T30_DCS_BIT_T45_MODE 116 +/* Bits 117 to 118 specify the shared memory capability */ + /* This bit defines the available colour space, when bit 92, 93 or 94 is set to "1". Available colour space for all combinations of bits 92, 93, 94 and 119 are shown in the following table. It should be noted that terminals which conform to the 2003 and earlier versions of this Recommendation @@ -345,6 +458,8 @@ #define T30_DIS_BIT_T44_COLOUR_SPACE 119 #define T30_DCS_BIT_T44_COLOUR_SPACE 119 +/* Bit 120 is an extension bit */ + /* Can only be set in the communication through the T.38 gateway, to cope with delay of network. T.x timer (12+-1s) should be used after emitting RNR or TNR. However, after receiving PPS signal in ECM mode, T.5 timer should be used. */ @@ -366,6 +481,8 @@ When this bit is set to "1", the data signal rate of the modem (bits 11-14) should be set to "0". */ #define T30_DCS_BIT_T38_FAX_MODE 123 +/* Bits 124 to 126 specify the T.89 applications profile. */ + /* When either bit of 31, 36, 38, 51, 53, 54, 55, 57, 59, 60, 62, 65, 68, 78, 79, 115, 116 and 127 is set to "1", ECM must be used. If the value of bit field 92 to 94 is non-zero, then ECM must be used. diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h index 241df11d9e..813ca28a67 100644 --- a/libs/spandsp/src/spandsp/t30.h +++ b/libs/spandsp/src/spandsp/t30.h @@ -353,27 +353,27 @@ enum enum { /*! No compression */ - T30_SUPPORT_NO_COMPRESSION = 0x01, + T30_SUPPORT_COMPRESSION_NONE = 0x01, /*! T.1 1D compression */ - T30_SUPPORT_T4_1D_COMPRESSION = 0x02, + T30_SUPPORT_COMPRESSION_T4_1D = 0x02, /*! T.4 2D compression */ - T30_SUPPORT_T4_2D_COMPRESSION = 0x04, + T30_SUPPORT_COMPRESSION_T4_2D = 0x04, /*! T.6 2D compression */ - T30_SUPPORT_T6_COMPRESSION = 0x08, + T30_SUPPORT_COMPRESSION_T6 = 0x08, /*! T.85 monochrome JBIG compression, with fixed L0 */ - T30_SUPPORT_T85_COMPRESSION = 0x10, + T30_SUPPORT_COMPRESSION_T85 = 0x10, /*! T.85 monochrome JBIG compression, with variable L0 */ - T30_SUPPORT_T85_L0_COMPRESSION = 0x20, + T30_SUPPORT_COMPRESSION_T85_L0 = 0x20, /*! T.43 colour JBIG compression */ - T30_SUPPORT_T43_COMPRESSION = 0x40, + T30_SUPPORT_COMPRESSION_T43 = 0x40, /*! T.45 run length colour compression */ - T30_SUPPORT_T45_COMPRESSION = 0x80, + T30_SUPPORT_COMPRESSION_T45 = 0x80, /*! T.81 + T.30 Annex E colour JPEG compression */ - T30_SUPPORT_T81_COMPRESSION = 0x100, + T30_SUPPORT_COMPRESSION_T81 = 0x100, /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */ - T30_SUPPORT_SYCC_T81_COMPRESSION = 0x200, + T30_SUPPORT_COMPRESSION_SYCC_T81 = 0x200, /*! T.88 monochrome JBIG2 compression */ - T30_SUPPORT_T88_COMPRESSION = 0x400, + T30_SUPPORT_COMPRESSION_T88 = 0x400, /*! Dither a gray scale image down a simple bilevel image, with rescaling to fit a FAX page */ T30_SUPPORT_GRAY_TO_BILEVEL = 0x10000000, /*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */ diff --git a/libs/spandsp/src/spandsp/t30_api.h b/libs/spandsp/src/spandsp/t30_api.h index 08a0383634..137e871803 100644 --- a/libs/spandsp/src/spandsp/t30_api.h +++ b/libs/spandsp/src/spandsp/t30_api.h @@ -439,8 +439,8 @@ SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, int enabled); /*! Specify the output encoding for TIFF files created during FAX reception. \brief Specify the output encoding for TIFF files created during FAX reception. \param s The T.30 context. - \param encoding The coding required. The options are T4_COMPRESSION_ITU_T4_1D, - T4_COMPRESSION_ITU_T4_2D, T4_COMPRESSION_ITU_T6. T6 is usually the + \param encoding The coding required. The options are T4_COMPRESSION_T4_1D, + T4_COMPRESSION_T4_2D, T4_COMPRESSION_T6. T6 is usually the densest option, but support for it is broken in a number of software packages. \return 0 if OK, else -1. */ diff --git a/libs/spandsp/src/spandsp/t4_rx.h b/libs/spandsp/src/spandsp/t4_rx.h index 3b359c7d79..3002578cfc 100644 --- a/libs/spandsp/src/spandsp/t4_rx.h +++ b/libs/spandsp/src/spandsp/t4_rx.h @@ -51,23 +51,23 @@ typedef enum /*! No compression */ T4_COMPRESSION_NONE = 0, /*! T.1 1D compression */ - T4_COMPRESSION_ITU_T4_1D = 1, + T4_COMPRESSION_T4_1D = 1, /*! T.4 2D compression */ - T4_COMPRESSION_ITU_T4_2D = 2, + T4_COMPRESSION_T4_2D = 2, /*! T.6 2D compression */ - T4_COMPRESSION_ITU_T6 = 3, + T4_COMPRESSION_T6 = 3, /*! T.85 monochrome JBIG coding with L0 fixed. */ - T4_COMPRESSION_ITU_T85 = 4, + T4_COMPRESSION_T85 = 4, /*! T.85 monochrome JBIG coding with L0 variable. */ - T4_COMPRESSION_ITU_T85_L0 = 5, + T4_COMPRESSION_T85_L0 = 5, /*! T.43 colour JBIG coding */ - T4_COMPRESSION_ITU_T43 = 6, + T4_COMPRESSION_T43 = 6, /*! T.45 run length colour compression */ - T4_COMPRESSION_ITU_T45 = 7, + T4_COMPRESSION_T45 = 7, /*! T.42 + T.81 + T.30 Annex E colour JPEG coding */ - T4_COMPRESSION_ITU_T42 = 8, + T4_COMPRESSION_T42 = 8, /*! T.42 + T.81 + T.30 Annex K colour sYCC-JPEG coding */ - T4_COMPRESSION_ITU_SYCC_T42 = 9 + T4_COMPRESSION_SYCC_T42 = 9 } t4_image_compression_t; /*! Image type */ @@ -84,9 +84,12 @@ typedef enum /*! Supported X resolutions, in pixels per metre. */ typedef enum { + T4_X_RESOLUTION_100 = 3937, T4_X_RESOLUTION_R4 = 4016, + T4_X_RESOLUTION_200 = 7874, T4_X_RESOLUTION_R8 = 8031, T4_X_RESOLUTION_300 = 11811, + T4_X_RESOLUTION_400 = 15784, T4_X_RESOLUTION_R16 = 16063, T4_X_RESOLUTION_600 = 23622, T4_X_RESOLUTION_800 = 31496, @@ -97,14 +100,54 @@ typedef enum typedef enum { T4_Y_RESOLUTION_STANDARD = 3850, + T4_Y_RESOLUTION_100 = 3937, T4_Y_RESOLUTION_FINE = 7700, + T4_Y_RESOLUTION_200 = 7874, T4_Y_RESOLUTION_300 = 11811, - T4_Y_RESOLUTION_SUPERFINE = 15400, /* 400 is 15748 */ + T4_Y_RESOLUTION_SUPERFINE = 15400, + T4_Y_RESOLUTION_400 = 15748, T4_Y_RESOLUTION_600 = 23622, T4_Y_RESOLUTION_800 = 31496, T4_Y_RESOLUTION_1200 = 47244 } t4_image_y_resolution_t; +/* Only the symmetric resolutions are valid for gray-scale and colour use. The asymmetric + ones are bi-level only. */ +enum +{ + /*! Support standard FAX resolution 204dpi x 98dpi - bi-level only */ + T4_RESOLUTION_R8_STANDARD = 0x1, + /*! Support fine FAX resolution 204dpi x 196dpi - bi-level only */ + T4_RESOLUTION_R8_FINE = 0x2, + /*! Support superfine FAX resolution 204dpi x 392dpi - bi-level only */ + T4_RESOLUTION_R8_SUPERFINE = 0x4, + /*! Support double FAX resolution 408dpi x 392dpi - bi-level only */ + T4_RESOLUTION_R16_SUPERFINE = 0x8, + + /*! Support 100dpi x 100 dpi */ + T4_RESOLUTION_100_100 = 0x10, + /*! Support 200dpi x 100 dpi - bi-level only */ + T4_RESOLUTION_200_100 = 0x20, + /*! Support 200dpi x 200 dpi */ + T4_RESOLUTION_200_200 = 0x40, + /*! Support 200dpi x 400 dpi - bi-level only */ + T4_RESOLUTION_200_400 = 0x80, + /*! Support 300dpi x 300 dpi */ + T4_RESOLUTION_300_300 = 0x100, + /*! Support 300dpi x 600 dpi - bi-level only */ + T4_RESOLUTION_300_600 = 0x200, + /*! Support 400dpi x 400 dpi */ + T4_RESOLUTION_400_400 = 0x400, + /*! Support 400dpi x 800 dpi - bi-level only */ + T4_RESOLUTION_400_800 = 0x800, + /*! Support 600dpi x 600 dpi */ + T4_RESOLUTION_600_600 = 0x1000, + /*! Support 600dpi x 1200 dpi - bi-level only */ + T4_RESOLUTION_600_1200 = 0x2000, + /*! Support 1200dpi x 1200 dpi */ + T4_RESOLUTION_1200_1200 = 0x4000 +}; + /*! Exact widths in PELs for the difference resolutions, and page widths. Note: @@ -112,30 +155,53 @@ typedef enum The R4 resolution widths are not supported in recent versions of T.30 Only images of exactly these widths are acceptable for FAX transmisson. - R4 864 pels/215mm for ISO A4, North American Letter and Legal - R4 1024 pels/255mm for ISO B4 - R4 1216 pels/303mm for ISO A3 - R8 1728 pels/215mm for ISO A4, North American Letter and Legal - R8 2048 pels/255mm for ISO B4 - R8 2432 pels/303mm for ISO A3 - R16 3456 pels/215mm for ISO A4, North American Letter and Legal - R16 4096 pels/255mm for ISO B4 - R16 4864 pels/303mm for ISO A3 + R4 864 pels/215mm for ISO A4, North American Letter and Legal + R4 1024 pels/255mm for ISO B4 + R4 1216 pels/303mm for ISO A3 + R8 1728 pels/215mm for ISO A4, North American Letter and Legal + R8 2048 pels/255mm for ISO B4 + R8 2432 pels/303mm for ISO A3 + R16 3456 pels/215mm for ISO A4, North American Letter and Legal + R16 4096 pels/255mm for ISO B4 + R16 4864 pels/303mm for ISO A3 + + 100 864 pels/219.46mm for ISO A4, North American Letter and Legal + 100 1024 pels/260.10mm for ISO B4 + 100 1216 pels/308.86mm for ISO A3 + 200 1728 pels/219.46mm for ISO A4, North American Letter and Legal + 200 2048 pels/260.10mm for ISO B4 + 200 2432 pels/308.86mm for ISO A3 + 300 2592 pels/219.46mm for ISO A4, North American Letter and Legal + 300 3072 pels/260.10mm for ISO B4 + 300 3648 pels/308.86mm for ISO A3 + 400 3456 pels/219.46mm for ISO A4, North American Letter and Legal + 400 4096 pels/260.10mm for ISO B4 + 400 4864 pels/308.86mm for ISO A3 + 600 5184 pels/219.46mm for ISO A4, North American Letter and Legal + 600 6144 pels/260.10mm for ISO B4 + 600 7296 pels/308.86mm for ISO A3 + 1200 10368 pels/219.46mm for ISO A4, North American Letter and Legal + 1200 12288 pels/260.10mm for ISO B4 + 1200 14592 pels/308.86mm for ISO A3 + + Note that R4, R8 and R16 widths are 5mm wider than the actual paper sizes. + The 100, 200, 300, 400, 600, and 1200 widths are 9.46mm, 10.1mm and 11.86mm + wider than the paper sizes. */ typedef enum { - T4_WIDTH_R4_A4 = 864, - T4_WIDTH_R4_B4 = 1024, - T4_WIDTH_R4_A3 = 1216, - T4_WIDTH_R8_A4 = 1728, - T4_WIDTH_R8_B4 = 2048, - T4_WIDTH_R8_A3 = 2432, + T4_WIDTH_100_A4 = 864, + T4_WIDTH_100_B4 = 1024, + T4_WIDTH_100_A3 = 1216, + T4_WIDTH_200_A4 = 1728, + T4_WIDTH_200_B4 = 2048, + T4_WIDTH_200_A3 = 2432, T4_WIDTH_300_A4 = 2592, T4_WIDTH_300_B4 = 3072, T4_WIDTH_300_A3 = 3648, - T4_WIDTH_R16_A4 = 3456, - T4_WIDTH_R16_B4 = 4096, - T4_WIDTH_R16_A3 = 4864, + T4_WIDTH_400_A4 = 3456, + T4_WIDTH_400_B4 = 4096, + T4_WIDTH_400_A3 = 4864, T4_WIDTH_600_A4 = 5184, T4_WIDTH_600_B4 = 6144, T4_WIDTH_600_A3 = 7296, @@ -144,14 +210,26 @@ typedef enum T4_WIDTH_1200_A3 = 14592 } t4_image_width_t; +#define T4_WIDTH_R4_A4 T4_WIDTH_100_A4 +#define T4_WIDTH_R4_B4 T4_WIDTH_100_B4 +#define T4_WIDTH_R4_A3 T4_WIDTH_100_A3 + +#define T4_WIDTH_R8_A4 T4_WIDTH_200_A4 +#define T4_WIDTH_R8_B4 T4_WIDTH_200_B4 +#define T4_WIDTH_R8_A3 T4_WIDTH_200_A3 + +#define T4_WIDTH_R16_A4 T4_WIDTH_400_A4 +#define T4_WIDTH_R16_B4 T4_WIDTH_400_B4 +#define T4_WIDTH_R16_A3 T4_WIDTH_400_A3 + /*! Length of the various supported paper sizes, in pixels at the various Y resolutions. Paper sizes are - A4 (215mm x 297mm) - B4 (255mm x 364mm) - A3 (303mm x 418.56mm) - North American Letter (215.9mm x 279.4mm) - North American Legal (215.9mm x 355.6mm) + A4 (210mm x 297mm) + B4 (250mm x 353mm) + A3 (297mm x 420mm) + North American Letter (215.9mm x 279.4mm or 8.5"x11") + North American Legal (215.9mm x 355.6mm or 8.4"x14") Unlimited T.4 does not accurately define the maximum number of scan lines in a page. A wide @@ -162,7 +240,7 @@ typedef enum Values seen for standard resolution A4 pages include 1037, 1045, 1109, 1126 and 1143. 1109 seems the most-popular. At fine res 2150, 2196, 2200, 2237, 2252-2262, 2264, 2286, and 2394 are used. 2255 seems the most popular. We try to use balanced choices - here. + here. 1143 pixels at 3.85/mm is 296.9mm, and an A4 page is 297mm long. */ typedef enum { @@ -174,30 +252,38 @@ typedef enum T4_LENGTH_600_A4 = 6998, T4_LENGTH_800_A4 = 9330, T4_LENGTH_1200_A4 = 13996, - /* B4 is 364mm long */ - T4_LENGTH_STANDARD_B4 = 1401, - T4_LENGTH_FINE_B4 = 2802, - T4_LENGTH_300_B4 = 0, - T4_LENGTH_SUPERFINE_B4 = 5605, - T4_LENGTH_600_B4 = 0, - T4_LENGTH_800_B4 = 0, - T4_LENGTH_1200_B4 = 0, + /* B4 is 353mm long */ + T4_LENGTH_STANDARD_B4 = 1359, + T4_LENGTH_FINE_B4 = 2718, + T4_LENGTH_300_B4 = 4169, + T4_LENGTH_SUPERFINE_B4 = 5436, + T4_LENGTH_600_B4 = 8338, + T4_LENGTH_800_B4 = 11118, + T4_LENGTH_1200_B4 = 16677, + /* A3 is 420mm long */ + T4_LENGTH_STANDARD_A3 = 1617, + T4_LENGTH_FINE_A3 = 3234, + T4_LENGTH_300_A3 = 4960, + T4_LENGTH_SUPERFINE_A3 = 6468, + T4_LENGTH_600_A3 = 9921, + T4_LENGTH_800_A3 = 13228, + T4_LENGTH_1200_A3 = 19842, /* North American letter is 279.4mm long */ T4_LENGTH_STANDARD_US_LETTER = 1075, T4_LENGTH_FINE_US_LETTER = 2151, - T4_LENGTH_300_US_LETTER = 0, + T4_LENGTH_300_US_LETTER = 3300, T4_LENGTH_SUPERFINE_US_LETTER = 4302, - T4_LENGTH_600_US_LETTER = 0, - T4_LENGTH_800_US_LETTER = 0, - T4_LENGTH_1200_US_LETTER = 0, + T4_LENGTH_600_US_LETTER = 6700, + T4_LENGTH_800_US_LETTER = 8800, + T4_LENGTH_1200_US_LETTER = 13200, /* North American legal is 355.6mm long */ T4_LENGTH_STANDARD_US_LEGAL = 1369, T4_LENGTH_FINE_US_LEGAL = 2738, - T4_LENGTH_300_US_LEGAL = 0, + T4_LENGTH_300_US_LEGAL = 4200, T4_LENGTH_SUPERFINE_US_LEGAL = 5476, - T4_LENGTH_600_US_LEGAL = 0, - T4_LENGTH_800_US_LEGAL = 0, - T4_LENGTH_1200_US_LEGAL = 0 + T4_LENGTH_600_US_LEGAL = 8400, + T4_LENGTH_800_US_LEGAL = 11200, + T4_LENGTH_1200_US_LEGAL = 16800 } t4_image_length_t; /*! Return values from the T.85 decoder */ diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index a8ed266f94..9d29d5aebe 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -1180,7 +1180,7 @@ int t30_build_dis_or_dtc(t30_state_t *s) s->local_dis_dtc_frame[4] |= (DISBIT6 | DISBIT4 | DISBIT3); if ((s->supported_resolutions & T30_SUPPORT_FINE_RESOLUTION)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE); - if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION)) + if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T4_2D)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE); /* 215mm wide is always supported */ if ((s->supported_image_sizes & T30_SUPPORT_303MM_WIDTH)) @@ -1194,7 +1194,7 @@ int t30_build_dis_or_dtc(t30_state_t *s) set_ctrl_bit(s->local_dis_dtc_frame, 19); /* 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, 21); - if ((s->supported_compressions & T30_SUPPORT_NO_COMPRESSION)) + if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_NONE)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_UNCOMPRESSED_CAPABLE); if (s->ecm_allowed) { @@ -1202,25 +1202,25 @@ int t30_build_dis_or_dtc(t30_state_t *s) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_ECM_CAPABLE); /* Only offer the option of fancy compression schemes, if we are also offering the ECM option needed to support them. */ - if ((s->supported_compressions & T30_SUPPORT_T6_COMPRESSION)) + if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T6)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE); - if ((s->supported_compressions & T30_SUPPORT_T43_COMPRESSION)) + if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T43)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE); - if ((s->supported_compressions & T30_SUPPORT_T45_COMPRESSION)) + if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T45)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE); - if ((s->supported_compressions & T30_SUPPORT_T81_COMPRESSION)) + if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T81)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); - if ((s->supported_compressions & T30_SUPPORT_SYCC_T81_COMPRESSION)) + if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_SYCC_T81)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE); - if ((s->supported_compressions & T30_SUPPORT_T85_COMPRESSION)) + if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T85)) { /* Bit 79 set with bit 78 clear is invalid, so only check for L0 support here. */ - if ((s->supported_compressions & T30_SUPPORT_T85_L0_COMPRESSION)) + if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T85_L0)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE); set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE); } - //if ((s->supported_compressions & T30_SUPPORT_T89_COMPRESSION)) + //if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T89)) // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T89_CAPABLE); } if ((s->supported_t30_features & T30_SUPPORT_FIELD_NOT_VALID)) @@ -1370,33 +1370,33 @@ static int build_dcs(t30_state_t *s) /* Select the compression to use. */ switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE); set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); break; #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T43_MODE); set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); break; #endif - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85_L0: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE); set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); break; - case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_T85: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_MODE); set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); break; - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T6: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T6_MODE); set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); break; - case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_T4_2D: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_2D_MODE); set_ctrl_bits(s->dcs_frame, s->min_scan_time_code, 21); break; - case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_T4_1D: set_ctrl_bits(s->dcs_frame, s->min_scan_time_code, 21); break; default: @@ -1614,7 +1614,7 @@ static int build_dcs(t30_state_t *s) set_ctrl_bit(s->dcs_frame, 19); if (s->error_correcting_mode) - set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_ECM); + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_ECM_MODE); if ((s->iaf & T30_IAF_MODE_FLOW_CONTROL) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38_FLOW_CONTROL_CAPABLE)) set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T38_FLOW_CONTROL_CAPABLE); @@ -2086,55 +2086,55 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) if (!s->error_correcting_mode) { /* Without error correction our choices are very limited */ - if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION) + if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T4_2D) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) { - s->line_encoding = T4_COMPRESSION_ITU_T4_2D; + s->line_encoding = T4_COMPRESSION_T4_2D; } else { - s->line_encoding = T4_COMPRESSION_ITU_T4_1D; + s->line_encoding = T4_COMPRESSION_T4_1D; } } else { #if defined(SPANDSP_SUPPORT_T42x) || defined(SPANDSP_SUPPORT_T43) /* With error correction colour may be possible/required */ - if ((0 & (T30_SUPPORT_T43_COMPRESSION | T30_SUPPORT_T45_COMPRESSION | T30_SUPPORT_T81_COMPRESSION | T30_SUPPORT_SYCC_T81_COMPRESSION))) + if ((0 & (T30_SUPPORT_COMPRESSION_T43 | T30_SUPPORT_COMPRESSION_T45 | T30_SUPPORT_COMPRESSION_T81 | T30_SUPPORT_COMPRESSION_SYCC_T81))) { - s->line_encoding = T4_COMPRESSION_ITU_T85_L0; + s->line_encoding = T4_COMPRESSION_T85_L0; } else #endif { - if ((s->supported_compressions & T30_SUPPORT_T85_L0_COMPRESSION) + if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T85_L0) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE)) { - s->line_encoding = T4_COMPRESSION_ITU_T85_L0; + s->line_encoding = T4_COMPRESSION_T85_L0; } - else if ((s->supported_compressions & T30_SUPPORT_T85_COMPRESSION) + else if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T85) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE)) { - s->line_encoding = T4_COMPRESSION_ITU_T85; + s->line_encoding = T4_COMPRESSION_T85; } - else if ((s->supported_compressions & T30_SUPPORT_T6_COMPRESSION) + else if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T6) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE)) { - s->line_encoding = T4_COMPRESSION_ITU_T6; + s->line_encoding = T4_COMPRESSION_T6; } - else if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION) + else if ((s->supported_compressions & T30_SUPPORT_COMPRESSION_T4_2D) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) { - s->line_encoding = T4_COMPRESSION_ITU_T4_2D; + s->line_encoding = T4_COMPRESSION_T4_2D; } else { - s->line_encoding = T4_COMPRESSION_ITU_T4_1D; + s->line_encoding = T4_COMPRESSION_T4_1D; } } } @@ -2194,18 +2194,18 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) } #if 0 /* T.4 1D is always available */ - bi_level_support = T30_SUPPORT_T4_1D_COMPRESSION; + bi_level_support = T30_SUPPORT_COMPRESSION_T4_1D; if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) - bi_level_support |= T30_SUPPORT_T4_2D_COMPRESSION; + bi_level_support |= T30_SUPPORT_COMPRESSION_T4_2D; if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE)) - bi_level_support |= T30_SUPPORT_T6_COMPRESSION; + bi_level_support |= T30_SUPPORT_COMPRESSION_T6; /* Bit 79 set with bit 78 clear is invalid, so let's completely ignore 79 if 78 is clear. */ if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE)) { - bi_level_support |= T30_SUPPORT_T85_COMPRESSION; + bi_level_support |= T30_SUPPORT_COMPRESSION_T85; if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE) - bi_level_support |= T30_SUPPORT_T85_L0_COMPRESSION; + bi_level_support |= T30_SUPPORT_COMPRESSION_T85_L0; } gray_support = 0; @@ -2213,33 +2213,33 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE)) { /* Multi-level coding available */ - gray_support |= T30_SUPPORT_T81_COMPRESSION; + gray_support |= T30_SUPPORT_COMPRESSION_T81; if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE)) - gray_support |= T30_SUPPORT_T81_12BIT_COMPRESSION; + gray_support |= T30_SUPPORT_COMPRESSION_T81_12BIT; if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE)) { - gray_support |= T30_SUPPORT_T43_COMPRESSION; + gray_support |= T30_SUPPORT_COMPRESSION_T43; if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE)) - gray_support |= T30_SUPPORT_T43_COMPRESSION_12BIT; + gray_support |= T30_SUPPORT_COMPRESSION_T43_12BIT; } if (test_ctrl_bit(s->far_dis_dtc_frame, bit69)) { /* Colour coding available */ - colour_support |= T30_SUPPORT_T81_COMPRESSION; + colour_support |= T30_SUPPORT_COMPRESSION_T81; if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE)) - colour_support |= T30_SUPPORT_T81_12BIT_COMPRESSION; + colour_support |= T30_SUPPORT_COMPRESSION_T81_12BIT; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING)) { - colour_support |= T30_SUPPORT_T81_SUBSAMPLING_COMPRESSION; + colour_support |= T30_SUPPORT_COMPRESSION_T81_SUBSAMPLING; if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE)) - colour_support |= T30_SUPPORT_T81_SUBSAMPLING_COMPRESSION_12BIT; + colour_support |= T30_SUPPORT_COMPRESSION_T81_SUBSAMPLING_12BIT; } if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE)) { - colour_support |= T30_SUPPORT_T43_COMPRESSION; + colour_support |= T30_SUPPORT_COMPRESSION_T43; if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE)) - colour_support |= T30_SUPPORT_T43_12BIT_COMPRESSION; + colour_support |= T30_SUPPORT_COMPRESSION_T43_12BIT; } } /* bit74 custom illuminant */ @@ -2454,36 +2454,36 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) #if defined(SPANDSP_SUPPORT_T42) if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE)) { - s->line_encoding = T4_COMPRESSION_ITU_T42; + s->line_encoding = T4_COMPRESSION_T42; } else #endif #if defined(SPANDSP_SUPPORT_T43) if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T43_MODE)) { - s->line_encoding = T4_COMPRESSION_ITU_T43; + s->line_encoding = T4_COMPRESSION_T43; } else #endif if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_L0_MODE)) { - s->line_encoding = T4_COMPRESSION_ITU_T85_L0; + s->line_encoding = T4_COMPRESSION_T85_L0; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_MODE)) { - s->line_encoding = T4_COMPRESSION_ITU_T85; + s->line_encoding = T4_COMPRESSION_T85; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE)) { - s->line_encoding = T4_COMPRESSION_ITU_T6; + s->line_encoding = T4_COMPRESSION_T6; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_2D_MODE)) { - s->line_encoding = T4_COMPRESSION_ITU_T4_2D; + s->line_encoding = T4_COMPRESSION_T4_2D; } else { - s->line_encoding = T4_COMPRESSION_ITU_T4_1D; + s->line_encoding = T4_COMPRESSION_T4_1D; } span_log(&s->logging, SPAN_LOG_FLOW, "Far end selected compression %s (%d)\n", t4_encoding_to_str(s->line_encoding), s->line_encoding); if (!test_ctrl_bit(dcs_frame, T30_DCS_BIT_RECEIVE_FAX_DOCUMENT)) @@ -2494,7 +2494,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) span_log(&s->logging, SPAN_LOG_FLOW, "Remote asked for a modem standard we do not support\n"); return -1; } - s->error_correcting_mode = (test_ctrl_bit(dcs_frame, T30_DCS_BIT_ECM) != 0); + s->error_correcting_mode = (test_ctrl_bit(dcs_frame, T30_DCS_BIT_ECM_MODE) != 0); if (s->phase_b_handler) { @@ -6419,7 +6419,7 @@ 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 = T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION; + s->supported_compressions = T30_SUPPORT_COMPRESSION_T4_1D | T30_SUPPORT_COMPRESSION_T4_2D; s->supported_resolutions = T30_SUPPORT_STANDARD_RESOLUTION | T30_SUPPORT_FINE_RESOLUTION | T30_SUPPORT_SUPERFINE_RESOLUTION @@ -6430,7 +6430,7 @@ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s, | T30_SUPPORT_215MM_WIDTH; /* Set the output encoding to something safe. Most things get 1D and 2D encoding right. Quite a lot get other things wrong. */ - s->output_encoding = T4_COMPRESSION_ITU_T4_2D; + s->output_encoding = T4_COMPRESSION_T4_2D; s->local_min_scan_time_code = T30_MIN_SCAN_0MS; span_log_init(&s->logging, SPAN_LOG_NONE, NULL); span_log_set_protocol(&s->logging, "T.30"); diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c index e6d157c21e..ea429fe6e7 100644 --- a/libs/spandsp/src/t30_api.c +++ b/libs/spandsp/src/t30_api.c @@ -650,11 +650,11 @@ SPAN_DECLARE(int) t30_set_rx_encoding(t30_state_t *s, int encoding) { switch (encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: - //case T4_COMPRESSION_ITU_T85: - //case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: + //case T4_COMPRESSION_T85: + //case T4_COMPRESSION_T85_L0: s->output_encoding = encoding; return 0; } @@ -696,15 +696,15 @@ SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_c int mask; /* Mask out the ones we actually support today. */ - mask = T30_SUPPORT_T4_1D_COMPRESSION - | T30_SUPPORT_T4_2D_COMPRESSION - | T30_SUPPORT_T6_COMPRESSION - //| T30_SUPPORT_T81_COMPRESSION + mask = T30_SUPPORT_COMPRESSION_T4_1D + | T30_SUPPORT_COMPRESSION_T4_2D + | T30_SUPPORT_COMPRESSION_T6 + //| T30_SUPPORT_COMPRESSION_T81 #if defined(SPANDSP_SUPPORT_T43) - | T30_SUPPORT_T43_COMPRESSION + | T30_SUPPORT_COMPRESSION_T43 #endif - | T30_SUPPORT_T85_COMPRESSION - | T30_SUPPORT_T85_L0_COMPRESSION + | T30_SUPPORT_COMPRESSION_T85 + | T30_SUPPORT_COMPRESSION_T85_L0 | 0; s->supported_compressions = supported_compressions & mask; t30_build_dis_or_dtc(s); diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 0d6950e278..e026517d32 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -91,23 +91,23 @@ SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding) { case T4_COMPRESSION_NONE: return "None"; - case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_T4_1D: return "T.4 1-D"; - case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_T4_2D: return "T.4 2-D"; - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T6: return "T.6"; - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: return "T.42"; - case T4_COMPRESSION_ITU_SYCC_T42: + case T4_COMPRESSION_SYCC_T42: return "sYCC T.42"; - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: return "T.43"; - case T4_COMPRESSION_ITU_T45: + case T4_COMPRESSION_T45: return "T.45"; - case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_T85: return "T.85"; - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85_L0: return "T.85(L0)"; } return "???"; @@ -158,20 +158,20 @@ static int set_tiff_directory_info(t4_rx_state_t *s) photometric = PHOTOMETRIC_MINISWHITE; switch (t->output_encoding) { - case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_T4_1D: default: output_compression = COMPRESSION_CCITT_T4; output_t4_options = GROUP3OPT_FILLBITS; break; - case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_T4_2D: output_compression = COMPRESSION_CCITT_T4; output_t4_options = GROUP3OPT_FILLBITS | GROUP3OPT_2DENCODING; break; - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T6: output_compression = COMPRESSION_CCITT_T6; break; #if defined(SPANDSP_SUPPORT_T42) - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: output_compression = COMPRESSION_JPEG; bits_per_sample = 8; samples_per_pixel = 3; @@ -179,15 +179,15 @@ static int set_tiff_directory_info(t4_rx_state_t *s) break; #endif #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: output_compression = COMPRESSION_T43; bits_per_sample = 8; samples_per_pixel = 3; photometric = PHOTOMETRIC_ITULAB; break; #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: output_compression = COMPRESSION_T85; break; } @@ -279,8 +279,8 @@ static int set_tiff_directory_info(t4_rx_state_t *s) image_length = 0; switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: /* We only get bad row info from pages received in non-ECM mode. */ if (output_compression == COMPRESSION_CCITT_T4) { @@ -296,19 +296,19 @@ static int set_tiff_directory_info(t4_rx_state_t *s) } } /* Fall through */ - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T6: image_length = t4_t6_decode_get_image_length(&s->decoder.t4_t6); break; - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: image_length = t42_decode_get_image_length(&s->decoder.t42); break; #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: image_length = t43_decode_get_image_length(&s->decoder.t43); break; #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: image_length = t85_decode_get_image_length(&s->decoder.t85); break; } @@ -450,18 +450,18 @@ SPAN_DECLARE(int) t4_rx_put(t4_rx_state_t *s, const uint8_t buf[], size_t len) s->line_image_size += 8*len; switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: return t4_t6_decode_put(&s->decoder.t4_t6, buf, len); - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: return t42_decode_put(&s->decoder.t42, buf, len); #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: return t43_decode_put(&s->decoder.t43, buf, len); #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: return t85_decode_put(&s->decoder.t85, buf, len); } return T4_DECODE_OK; @@ -514,14 +514,14 @@ SPAN_DECLARE(int) t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding) { switch (encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: break; default: t4_t6_decode_init(&s->decoder.t4_t6, encoding, s->image_width, s->row_handler, s->row_handler_user_data); @@ -529,10 +529,10 @@ SPAN_DECLARE(int) t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding) } s->line_encoding = encoding; return t4_t6_decode_set_encoding(&s->decoder.t4_t6, encoding); - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: break; default: t42_decode_init(&s->decoder.t42, s->row_handler, s->row_handler_user_data); @@ -545,10 +545,10 @@ SPAN_DECLARE(int) t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding) s->line_encoding = encoding; return 0; #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: break; default: t43_decode_init(&s->decoder.t43, s->row_handler, s->row_handler_user_data); @@ -561,12 +561,12 @@ SPAN_DECLARE(int) t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding) s->line_encoding = encoding; return 0; #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: break; default: t85_decode_init(&s->decoder.t85, s->row_handler, s->row_handler_user_data); @@ -595,18 +595,18 @@ SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_rx_state_t *s, t4_row_write_han s->row_handler_user_data = user_data; switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: return t4_t6_decode_set_row_write_handler(&s->decoder.t4_t6, handler, user_data); - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: return t42_decode_set_row_write_handler(&s->decoder.t42, handler, user_data); #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: return t43_decode_set_row_write_handler(&s->decoder.t43, handler, user_data); #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: return t85_decode_set_row_write_handler(&s->decoder.t85, handler, user_data); } return -1; @@ -625,9 +625,9 @@ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t t->encoding = s->line_encoding; switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: t->type = T4_IMAGE_TYPE_BILEVEL; t->width = t4_t6_decode_get_image_width(&s->decoder.t4_t6); t->length = t4_t6_decode_get_image_length(&s->decoder.t4_t6); @@ -638,7 +638,7 @@ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t t->bad_rows = s->decoder.t4_t6.bad_rows; t->longest_bad_row_run = s->decoder.t4_t6.longest_bad_row_run; break; - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: t->type = 0; t->width = t42_decode_get_image_width(&s->decoder.t42); t->length = t42_decode_get_image_length(&s->decoder.t42); @@ -648,7 +648,7 @@ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t t->line_image_size = t42_decode_get_compressed_image_size(&s->decoder.t42)/8; break; #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: t->type = 0; t->width = t43_decode_get_image_width(&s->decoder.t43); t->length = t43_decode_get_image_length(&s->decoder.t43); @@ -658,8 +658,8 @@ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t t->line_image_size = t43_decode_get_compressed_image_size(&s->decoder.t43)/8; break; #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: t->type = T4_IMAGE_TYPE_BILEVEL; t->width = t85_decode_get_image_width(&s->decoder.t85); t->length = t85_decode_get_image_length(&s->decoder.t85); @@ -678,21 +678,21 @@ SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s) switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: t4_t6_decode_restart(&s->decoder.t4_t6, s->image_width); break; - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: t42_decode_restart(&s->decoder.t42); break; #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: t43_decode_restart(&s->decoder.t43); break; #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: t85_decode_restart(&s->decoder.t85); break; } @@ -734,24 +734,24 @@ SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s) length = 0; switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: t4_t6_decode_put(&s->decoder.t4_t6, NULL, 0); length = t4_t6_decode_get_image_length(&s->decoder.t4_t6); break; - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: t42_decode_put(&s->decoder.t42, NULL, 0); length = t42_decode_get_image_length(&s->decoder.t42); break; #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: t43_decode_put(&s->decoder.t43, NULL, 0); length = t43_decode_get_image_length(&s->decoder.t43); break; #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: t85_decode_put(&s->decoder.t85, NULL, 0); length = t85_decode_get_image_length(&s->decoder.t85); break; @@ -836,18 +836,18 @@ SPAN_DECLARE(int) t4_rx_release(t4_rx_state_t *s) tiff_rx_release(s); switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: return t4_t6_decode_release(&s->decoder.t4_t6); - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: return t42_decode_release(&s->decoder.t42); #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: return t43_decode_release(&s->decoder.t43); #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: return t85_decode_release(&s->decoder.t85); } return -1; diff --git a/libs/spandsp/src/t4_t6_decode.c b/libs/spandsp/src/t4_t6_decode.c index 03b24ae4f3..761bb934b7 100644 --- a/libs/spandsp/src/t4_t6_decode.c +++ b/libs/spandsp/src/t4_t6_decode.c @@ -401,7 +401,7 @@ static int put_bits(t4_t6_decode_state_t *s, uint32_t bit_string, int quantity) /* We have an EOL, so now the page begins and we can proceed to process the bit stream as image data. */ s->consecutive_eols = 0; - if (s->encoding == T4_COMPRESSION_ITU_T4_1D) + if (s->encoding == T4_COMPRESSION_T4_1D) { s->row_is_2d = FALSE; force_drop_rx_bits(s, 12); @@ -439,7 +439,7 @@ static int put_bits(t4_t6_decode_state_t *s, uint32_t bit_string, int quantity) we should count up both EOLs, unless there is some bogus partial row ahead of them. */ s->consecutive_eols++; - if (s->encoding == T4_COMPRESSION_ITU_T6) + if (s->encoding == T4_COMPRESSION_T6) { if (s->consecutive_eols >= EOLS_TO_END_T6_RX_PAGE) { @@ -466,7 +466,7 @@ static int put_bits(t4_t6_decode_state_t *s, uint32_t bit_string, int quantity) if (put_decoded_row(s)) return TRUE; } - if (s->encoding == T4_COMPRESSION_ITU_T4_2D) + if (s->encoding == T4_COMPRESSION_T4_2D) { s->row_is_2d = !(s->rx_bitstream & 0x1000); force_drop_rx_bits(s, 13); @@ -663,7 +663,7 @@ static int put_bits(t4_t6_decode_state_t *s, uint32_t bit_string, int quantity) if (s->a0 >= s->image_width) s->a0 = s->image_width - 1; - if (s->encoding == T4_COMPRESSION_ITU_T6) + if (s->encoding == T4_COMPRESSION_T6) { /* T.6 has no EOL markers. We sense the end of a line by its length alone. */ /* The last test here is a backstop protection, so a corrupt image cannot @@ -778,9 +778,9 @@ SPAN_DECLARE(int) t4_t6_decode_set_encoding(t4_t6_decode_state_t *s, int encodin { switch (encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: s->encoding = encoding; return 0; } @@ -864,10 +864,10 @@ SPAN_DECLARE(int) t4_t6_decode_restart(t4_t6_decode_state_t *s, int image_width) s->b1 = s->image_width; s->a0 = 0; s->run_length = 0; - s->row_is_2d = (s->encoding == T4_COMPRESSION_ITU_T6); + s->row_is_2d = (s->encoding == T4_COMPRESSION_T6); /* We start at -1 EOLs for 1D and 2D decoding, as an indication we are waiting for the first EOL. T.6 coding starts without any preamble. */ - s->consecutive_eols = (s->encoding == T4_COMPRESSION_ITU_T6) ? 0 : -1; + s->consecutive_eols = (s->encoding == T4_COMPRESSION_T6) ? 0 : -1; if (s->cur_runs) memset(s->cur_runs, 0, run_space); diff --git a/libs/spandsp/src/t4_t6_encode.c b/libs/spandsp/src/t4_t6_encode.c index 22885f4ac1..00d3ce1d93 100644 --- a/libs/spandsp/src/t4_t6_encode.c +++ b/libs/spandsp/src/t4_t6_encode.c @@ -573,7 +573,7 @@ static void encode_eol(t4_t6_encode_state_t *s) uint32_t code; int length; - if (s->encoding == T4_COMPRESSION_ITU_T4_2D) + if (s->encoding == T4_COMPRESSION_T4_2D) { code = 0x0800 | ((!s->row_is_2d) << 12); length = 13; @@ -589,7 +589,7 @@ static void encode_eol(t4_t6_encode_state_t *s) /* We may need to pad the row to a minimum length, unless we are in T.6 mode. In T.6 we only come here at the end of the page to add the EOFB marker, which is like two 1D EOLs. */ - if (s->encoding != T4_COMPRESSION_ITU_T6) + if (s->encoding != T4_COMPRESSION_T6) { if (s->row_bits + length < s->min_bits_per_row) put_encoded_bits(s, 0, s->min_bits_per_row - (s->row_bits + length)); @@ -823,14 +823,14 @@ static int encode_row(t4_t6_encode_state_t *s, const uint8_t *row_buf, size_t le { switch (s->encoding) { - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T6: /* T.6 compression is a trivial step up from T.4 2D, so we just throw it in here. T.6 is only used with error correction, so it does not need independantly compressed (i.e. 1D) lines to recover from data errors. It doesn't need EOLs, either. */ encode_2d_row(s, row_buf); break; - case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_T4_2D: encode_eol(s); if (s->row_is_2d) { @@ -850,7 +850,7 @@ static int encode_row(t4_t6_encode_state_t *s, const uint8_t *row_buf, size_t le } break; default: - case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_T4_1D: encode_eol(s); encode_1d_row(s, row_buf); break; @@ -864,7 +864,7 @@ static int finalise_page(t4_t6_encode_state_t *s) { int i; - if (s->encoding == T4_COMPRESSION_ITU_T6) + if (s->encoding == T4_COMPRESSION_T6) { /* Attach an EOFB (end of facsimile block == 2 x EOLs) to the end of the page */ for (i = 0; i < EOLS_TO_END_T6_TX_PAGE; i++) @@ -982,9 +982,9 @@ SPAN_DECLARE(int) t4_t6_encode_set_encoding(t4_t6_encode_state_t *s, int encodin { switch (encoding) { - case T4_COMPRESSION_ITU_T6: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_T6: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T4_1D: s->encoding = encoding; /* Set this to the default value for the lowest resolution in the T.4 spec. */ s->max_rows_to_next_1d_row = 2; @@ -1098,7 +1098,7 @@ SPAN_DECLARE(int) t4_t6_encode_restart(t4_t6_encode_state_t *s, int image_width) { /* Allow for pages being of different width. */ t4_t6_encode_set_image_width(s, image_width); - s->row_is_2d = (s->encoding == T4_COMPRESSION_ITU_T6); + s->row_is_2d = (s->encoding == T4_COMPRESSION_T6); s->rows_to_next_1d_row = s->max_rows_to_next_1d_row - 1; s->tx_bitstream = 0; diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index 5a964f6f7f..40166b8858 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -638,18 +638,18 @@ static int set_row_read_handler(t4_tx_state_t *s, t4_row_read_handler_t handler, { switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: return t4_t6_encode_set_row_read_handler(&s->encoder.t4_t6, handler, user_data); - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: return t42_encode_set_row_read_handler(&s->encoder.t42, handler, user_data); #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: return t43_encode_set_row_read_handler(&s->encoder.t43, handler, user_data); #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: return t85_encode_set_row_read_handler(&s->encoder.t85, handler, user_data); } return -1; @@ -796,14 +796,14 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) { switch (encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: break; default: t4_t6_encode_init(&s->encoder.t4_t6, encoding, s->image_width, s->row_handler, s->row_handler_user_data); @@ -812,10 +812,10 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) } s->line_encoding = encoding; return t4_t6_encode_set_encoding(&s->encoder.t4_t6, encoding); - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: break; default: t42_encode_init(&s->encoder.t42, s->image_width, s->image_length, s->row_handler, s->row_handler_user_data); @@ -824,10 +824,10 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) s->line_encoding = encoding; return 0; #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: break; default: t43_encode_init(&s->encoder.t43, s->image_width, s->image_length, s->row_handler, s->row_handler_user_data); @@ -836,12 +836,12 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) s->line_encoding = encoding; return 0; #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: break; default: t85_encode_init(&s->encoder.t85, s->image_width, s->image_length, s->row_handler, s->row_handler_user_data); @@ -858,9 +858,9 @@ SPAN_DECLARE(void) t4_tx_set_min_bits_per_row(t4_tx_state_t *s, int bits) { switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: t4_t6_encode_set_min_bits_per_row(&s->encoder.t4_t6, bits); break; } @@ -872,21 +872,21 @@ SPAN_DECLARE(void) t4_tx_set_image_width(t4_tx_state_t *s, int image_width) s->image_width = image_width; switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: t4_t6_encode_set_image_width(&s->encoder.t4_t6, image_width); break; - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: t42_encode_set_image_width(&s->encoder.t42, image_width); break; #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: t43_encode_set_image_width(&s->encoder.t43, image_width); break; #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: t85_encode_set_image_width(&s->encoder.t85, image_width); break; } @@ -898,16 +898,16 @@ static void t4_tx_set_image_length(t4_tx_state_t *s, int image_length) s->image_length = image_length; switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: t42_encode_set_image_length(&s->encoder.t42, image_length); break; #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: t43_encode_set_image_length(&s->encoder.t43, image_length); break; #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: t85_encode_set_image_length(&s->encoder.t85, image_length); break; } @@ -918,9 +918,9 @@ SPAN_DECLARE(void) t4_tx_set_max_2d_rows_per_1d_row(t4_tx_state_t *s, int max) { switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: t4_t6_encode_set_max_2d_rows_per_1d_row(&s->encoder.t4_t6, max); break; } @@ -1006,30 +1006,30 @@ SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_tx_state_t *s, t4_stats_t *t t->encoding = s->line_encoding; switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: t->type = T4_IMAGE_TYPE_BILEVEL; t->width = t4_t6_encode_get_image_width(&s->encoder.t4_t6); t->length = t4_t6_encode_get_image_length(&s->encoder.t4_t6)/s->row_squashing_ratio; t->line_image_size = t4_t6_encode_get_compressed_image_size(&s->encoder.t4_t6)/8; break; - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: t->type = 0; t->width = t42_encode_get_image_width(&s->encoder.t42); t->length = t42_encode_get_image_length(&s->encoder.t42)/s->row_squashing_ratio; t->line_image_size = t42_encode_get_compressed_image_size(&s->encoder.t42)/8; break; #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: t->type = 0; t->width = t43_encode_get_image_width(&s->encoder.t43); t->length = t43_encode_get_image_length(&s->encoder.t43)/s->row_squashing_ratio; t->line_image_size = t43_encode_get_compressed_image_size(&s->encoder.t43)/8; break; #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: t->type = T4_IMAGE_TYPE_BILEVEL; t->width = t85_encode_get_image_width(&s->encoder.t85); t->length = t85_encode_get_image_length(&s->encoder.t85)/s->row_squashing_ratio; @@ -1043,18 +1043,18 @@ SPAN_DECLARE(int) t4_tx_image_complete(t4_tx_state_t *s) { switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: return t4_t6_encode_image_complete(&s->encoder.t4_t6); - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: return t42_encode_image_complete(&s->encoder.t42); #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: return t43_encode_image_complete(&s->encoder.t43); #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: return t85_encode_image_complete(&s->encoder.t85); } return SIG_STATUS_END_OF_DATA; @@ -1072,18 +1072,18 @@ SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len) { switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: return t4_t6_encode_get(&s->encoder.t4_t6, buf, max_len); - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: return t42_encode_get(&s->encoder.t42, buf, max_len); #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: return t43_encode_get(&s->encoder.t43, buf, max_len); #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: return t85_encode_get(&s->encoder.t85, buf, max_len); } return 0; @@ -1110,21 +1110,21 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_tx_state_t *s) switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: t4_t6_encode_restart(&s->encoder.t4_t6, s->image_width); break; - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: t42_encode_restart(&s->encoder.t42, s->image_width, s->image_length); break; #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: t43_encode_restart(&s->encoder.t43, s->image_width, s->image_length); break; #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: t85_encode_restart(&s->encoder.t85, s->image_width, s->image_length); break; } @@ -1233,18 +1233,18 @@ SPAN_DECLARE(int) t4_tx_release(t4_tx_state_t *s) } switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T4_1D: - case T4_COMPRESSION_ITU_T4_2D: - case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_T4_1D: + case T4_COMPRESSION_T4_2D: + case T4_COMPRESSION_T6: return t4_t6_encode_release(&s->encoder.t4_t6); - case T4_COMPRESSION_ITU_T42: + case T4_COMPRESSION_T42: return t42_encode_release(&s->encoder.t42); #if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: + case T4_COMPRESSION_T43: return t43_encode_release(&s->encoder.t43); #endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_T85: + case T4_COMPRESSION_T85_L0: return t85_encode_release(&s->encoder.t85); } return -1; diff --git a/libs/spandsp/test-data/itu/fax/Makefile.am b/libs/spandsp/test-data/itu/fax/Makefile.am index 595b5f7e93..bc8234f66b 100644 --- a/libs/spandsp/test-data/itu/fax/Makefile.am +++ b/libs/spandsp/test-data/itu/fax/Makefile.am @@ -62,36 +62,48 @@ ITU_TEST_PAGES = itu1.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 +MIXED_SIZE_PAGES = bilevel_1200_1200_A4.tif \ + bilevel_1200_1200_B4.tif \ + bilevel_1200_1200_A3.tif \ + bilevel_600_1200_A4.tif \ + bilevel_600_1200_B4.tif \ + bilevel_600_1200_A3.tif \ + bilevel_600_600_A4.tif \ + bilevel_600_600_B4.tif \ + bilevel_600_600_A3.tif \ + bilevel_400_800_A4.tif \ + bilevel_400_800_B4.tif \ + bilevel_400_800_A3.tif \ + bilevel_400_400_A4.tif \ + bilevel_400_400_B4.tif \ + bilevel_400_400_A3.tif \ + bilevel_300_600_A4.tif \ + bilevel_300_600_B4.tif \ + bilevel_300_600_A3.tif \ + bilevel_300_300_A4.tif \ + bilevel_300_300_B4.tif \ + bilevel_300_300_A3.tif \ + bilevel_200_400_A4.tif \ + bilevel_200_400_B4.tif \ + bilevel_200_400_A3.tif \ + bilevel_200_200_A4.tif \ + bilevel_200_200_B4.tif \ + bilevel_200_200_A3.tif \ + bilevel_200_100_A4.tif \ + bilevel_200_100_B4.tif \ + bilevel_200_100_A3.tif \ + bilevel_R16_154_A4.tif \ + bilevel_R16_154_B4.tif \ + bilevel_R16_154_A3.tif \ + bilevel_R8_154_A4.tif \ + bilevel_R8_154_B4.tif \ + bilevel_R8_154_A3.tif \ + bilevel_R8_77_A4.tif \ + bilevel_R8_77_B4.tif \ + bilevel_R8_77_A3.tif \ + bilevel_R8_385_A4.tif \ + bilevel_R8_385_B4.tif \ + bilevel_R8_385_A3.tif EXTRA_DIST = ${ITU_TEST_PAGES_PBM} 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 4276b8c835..550d4e1e21 100644 --- a/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c +++ b/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c @@ -93,10 +93,8 @@ int main(int argc, char *argv[]) /* Prepare the directory entry fully before writing the image, or libtiff complains */ TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, output_compression); if (output_compression == COMPRESSION_CCITT_T4) - { TIFFSetField(tiff_file, TIFFTAG_T4OPTIONS, output_t4_options); - TIFFSetField(tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); - } + TIFFSetField(tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, image_width); TIFFSetField(tiff_file, TIFFTAG_BITSPERSAMPLE, 1); TIFFSetField(tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); 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 983e5e49b9..66932c6e82 100644 --- a/libs/spandsp/test-data/itu/fax/generate_sized_pages.c +++ b/libs/spandsp/test-data/itu/fax/generate_sized_pages.c @@ -58,210 +58,294 @@ struct } sequence[] = { { - "R8_385_A4.tif", + "bilevel_R8_385_A4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, 1100 }, { - "R8_385_B4.tif", + "bilevel_R8_385_B4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_B4, 1200 }, { - "R8_385_A3.tif", + "bilevel_R8_385_A3.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A3, 1556 }, { - "R8_77_A4.tif", + "bilevel_R8_77_A4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_FINE, T4_WIDTH_R8_A4, 1100*2 }, { - "R8_77_B4.tif", + "bilevel_R8_77_B4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_FINE, T4_WIDTH_R8_B4, 1200*2 }, { - "R8_77_A3.tif", + "bilevel_R8_77_A3.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_FINE, T4_WIDTH_R8_A3, 1556*2 }, { - "R8_154_A4.tif", + "bilevel_R8_154_A4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R8_A4, 1100*4 }, { - "R8_154_B4.tif", + "bilevel_R8_154_B4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R8_B4, 1200*4 }, { - "R8_154_A3.tif", + "bilevel_R8_154_A3.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R8_A3, 1556*4 }, { - "R300_300_A4.tif", - T4_X_RESOLUTION_300, - T4_Y_RESOLUTION_300, - T4_WIDTH_300_A4, - 1100*3 - }, - { - "R300_300_B4.tif", - T4_X_RESOLUTION_300, - T4_Y_RESOLUTION_300, - T4_WIDTH_300_B4, - 1200*3 - }, - { - "R300_300_A3.tif", - T4_X_RESOLUTION_300, - T4_Y_RESOLUTION_300, - T4_WIDTH_300_A3, - 1556*3 - }, - { - "R300_600_A4.tif", - T4_X_RESOLUTION_300, - T4_Y_RESOLUTION_600, - T4_WIDTH_300_A4, - 1100*6 - }, - { - "R300_600_B4.tif", - T4_X_RESOLUTION_300, - T4_Y_RESOLUTION_600, - T4_WIDTH_300_B4, - 1200*6 - }, - { - "R300_600_A3.tif", - T4_X_RESOLUTION_300, - T4_Y_RESOLUTION_600, - T4_WIDTH_300_A3, - 1556*6 - }, - { - "R16_154_A4.tif", + "bilevel_R16_154_A4.tif", T4_X_RESOLUTION_R16, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R16_A4, 1100*4 }, { - "R16_154_B4.tif", + "bilevel_R16_154_B4.tif", T4_X_RESOLUTION_R16, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R16_B4, 1200*4 }, { - "R16_154_A3.tif", + "bilevel_R16_154_A3.tif", T4_X_RESOLUTION_R16, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R16_A3, 1556*4 }, { - "R16_800_A4.tif", - T4_X_RESOLUTION_R16, + "bilevel_200_100_A4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_A4, + 1100 + }, + { + "bilevel_200_100_B4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_B4, + 1200 + }, + { + "bilevel_200_100_A3.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_A3, + 1556 + }, + { + "bilevel_200_200_A4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_200, + T4_WIDTH_200_A4, + 1100*2 + }, + { + "bilevel_200_200_B4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_200, + T4_WIDTH_200_B4, + 1200*2 + }, + { + "bilevel_200_200_A3.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_200, + T4_WIDTH_200_A3, + 1556*2 + }, + { + "bilevel_200_400_A4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_400, + T4_WIDTH_200_A4, + 1100*4 + }, + { + "bilevel_200_400_B4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_400, + T4_WIDTH_200_B4, + 1200*4 + }, + { + "bilevel_200_400_A3.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_400, + T4_WIDTH_200_A3, + 1556*4 + }, + { + "bilevel_300_300_A4.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_300, + T4_WIDTH_300_A4, + 1100*3 + }, + { + "bilevel_300_300_B4.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_300, + T4_WIDTH_300_B4, + 1200*3 + }, + { + "bilevel_300_300_A3.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_300, + T4_WIDTH_300_A3, + 1556*3 + }, + { + "bilevel_300_600_A4.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_600, + T4_WIDTH_300_A4, + 1100*6 + }, + { + "bilevel_300_600_B4.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_600, + T4_WIDTH_300_B4, + 1200*6 + }, + { + "bilevel_300_600_A3.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_600, + T4_WIDTH_300_A3, + 1556*6 + }, + { + "bilevel_400_400_A4.tif", + T4_X_RESOLUTION_400, + T4_Y_RESOLUTION_400, + T4_WIDTH_400_A4, + 1100*4 + }, + { + "bilevel_400_400_B4.tif", + T4_X_RESOLUTION_400, + T4_Y_RESOLUTION_400, + T4_WIDTH_400_B4, + 1200*4 + }, + { + "bilevel_400_400_A3.tif", + T4_X_RESOLUTION_400, + T4_Y_RESOLUTION_400, + T4_WIDTH_400_A3, + 1556*4 + }, + { + "bilevel_400_800_A4.tif", + T4_X_RESOLUTION_400, T4_Y_RESOLUTION_800, - T4_WIDTH_R16_A4, + T4_WIDTH_400_A4, 1100*8 }, { - "R16_800_B4.tif", - T4_X_RESOLUTION_R16, + "bilevel_400_800_B4.tif", + T4_X_RESOLUTION_400, T4_Y_RESOLUTION_800, - T4_WIDTH_R16_B4, + T4_WIDTH_400_B4, 1200*8 }, { - "R16_800_A3.tif", - T4_X_RESOLUTION_R16, + "bilevel_400_800_A3.tif", + T4_X_RESOLUTION_400, T4_Y_RESOLUTION_800, - T4_WIDTH_R16_A3, + T4_WIDTH_400_A3, 1556*8 }, { - "R600_600_A4.tif", + "bilevel_600_600_A4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_600, T4_WIDTH_600_A4, 1100*6 }, { - "R600_600_B4.tif", + "bilevel_600_600_B4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_600, T4_WIDTH_600_B4, 1200*6 }, { - "R600_600_A3.tif", + "bilevel_600_600_A3.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_600, T4_WIDTH_600_A3, 1556*6 }, { - "R600_1200_A4.tif", + "bilevel_600_1200_A4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_1200, T4_WIDTH_600_A4, 1100*12 }, { - "R600_1200_B4.tif", + "bilevel_600_1200_B4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_1200, T4_WIDTH_600_B4, 1200*12 }, { - "R600_1200_A3.tif", + "bilevel_600_1200_A3.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_1200, T4_WIDTH_600_A3, 1556*12 }, { - "R1200_1200_A4.tif", + "bilevel_1200_1200_A4.tif", T4_X_RESOLUTION_1200, T4_Y_RESOLUTION_1200, T4_WIDTH_1200_A4, 1100*12 }, { - "R1200_1200_B4.tif", + "bilevel_1200_1200_B4.tif", T4_X_RESOLUTION_1200, T4_Y_RESOLUTION_1200, T4_WIDTH_1200_B4, 1200*12 }, { - "R1200_1200_A3.tif", + "bilevel_1200_1200_A3.tif", T4_X_RESOLUTION_1200, T4_Y_RESOLUTION_1200, T4_WIDTH_1200_A3, @@ -291,8 +375,10 @@ int main(int argc, char *argv[]) int compression; int photo_metric; int fill_order; + int output_t4_options; - compression = T4_COMPRESSION_ITU_T6; + compression = COMPRESSION_CCITT_T6; + output_t4_options = 0; photo_metric = PHOTOMETRIC_MINISWHITE; fill_order = FILLORDER_LSB2MSB; while ((opt = getopt(argc, argv, "126ir")) != -1) @@ -300,13 +386,16 @@ int main(int argc, char *argv[]) switch (opt) { case '1': - compression = T4_COMPRESSION_ITU_T4_1D; + compression = COMPRESSION_CCITT_T4; + output_t4_options = GROUP3OPT_FILLBITS; break; case '2': - compression = T4_COMPRESSION_ITU_T4_2D; + compression = COMPRESSION_CCITT_T4; + output_t4_options = GROUP3OPT_FILLBITS | GROUP3OPT_2DENCODING; break; case '6': - compression = T4_COMPRESSION_ITU_T6; + compression = COMPRESSION_CCITT_T6; + output_t4_options = 0; break; case 'i': photo_metric = PHOTOMETRIC_MINISBLACK; @@ -328,6 +417,9 @@ int main(int argc, char *argv[]) /* Prepare the directory entry fully before writing the image, or libtiff complains */ TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, compression); + if (output_t4_options) + TIFFSetField(tiff_file, TIFFTAG_T4OPTIONS, output_t4_options); + TIFFSetField(tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, sequence[i].width); TIFFSetField(tiff_file, TIFFTAG_BITSPERSAMPLE, 1); TIFFSetField(tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); diff --git a/libs/spandsp/tests/fax_decode.c b/libs/spandsp/tests/fax_decode.c index 37792a9f2b..6bfc14d37a 100644 --- a/libs/spandsp/tests/fax_decode.c +++ b/libs/spandsp/tests/fax_decode.c @@ -97,7 +97,7 @@ int fast_trained = FAX_NONE; uint8_t ecm_data[256][260]; int16_t ecm_len[256]; -int line_encoding = T4_COMPRESSION_ITU_T4_1D; +int line_encoding = T4_COMPRESSION_T4_1D; int x_resolution = T4_X_RESOLUTION_R8; int y_resolution = T4_Y_RESOLUTION_STANDARD; int image_width = 1728; @@ -221,11 +221,11 @@ static int check_rx_dcs(const uint8_t *msg, int len) /* Check which compression we will use. */ if ((dcs_frame[6] & DISBIT7)) - line_encoding = T4_COMPRESSION_ITU_T6; + line_encoding = T4_COMPRESSION_T6; else if ((dcs_frame[4] & DISBIT8)) - line_encoding = T4_COMPRESSION_ITU_T4_2D; + line_encoding = T4_COMPRESSION_T4_2D; else - line_encoding = T4_COMPRESSION_ITU_T4_1D; + line_encoding = T4_COMPRESSION_T4_1D; fprintf(stderr, "Selected compression %d\n", line_encoding); if ((current_fallback = find_fallback_entry(dcs_frame[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3))) < 0) @@ -540,7 +540,7 @@ int main(int argc, char *argv[]) span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); #endif - if (t4_rx_init(&t4_rx_state, "fax_decode.tif", T4_COMPRESSION_ITU_T4_2D) == NULL) + if (t4_rx_init(&t4_rx_state, "fax_decode.tif", T4_COMPRESSION_T4_2D) == NULL) { fprintf(stderr, "Failed to init\n"); exit(0); diff --git a/libs/spandsp/tests/fax_tests.c b/libs/spandsp/tests/fax_tests.c index 02c840974a..4e98c3beff 100644 --- a/libs/spandsp/tests/fax_tests.c +++ b/libs/spandsp/tests/fax_tests.c @@ -858,23 +858,23 @@ int main(int argc, char *argv[]) | T30_SUPPORT_300_600_RESOLUTION | T30_SUPPORT_400_800_RESOLUTION | T30_SUPPORT_600_1200_RESOLUTION); - //t30_set_rx_encoding(t30_state[i], T4_COMPRESSION_ITU_T85); + //t30_set_rx_encoding(t30_state[i], T4_COMPRESSION_T85); t30_set_ecm_capability(t30_state[i], use_ecm); if (use_ecm) { t30_set_supported_compressions(t30_state[i], - T30_SUPPORT_T4_1D_COMPRESSION - | T30_SUPPORT_T4_2D_COMPRESSION - | T30_SUPPORT_T6_COMPRESSION - //| T30_SUPPORT_T81_COMPRESSION - | T30_SUPPORT_T85_COMPRESSION - | T30_SUPPORT_T85_L0_COMPRESSION); + T30_SUPPORT_COMPRESSION_T4_1D + | T30_SUPPORT_COMPRESSION_T4_2D + | T30_SUPPORT_COMPRESSION_T6 + //| T30_SUPPORT_COMPRESSION_T81 + | T30_SUPPORT_COMPRESSION_T85 + | T30_SUPPORT_COMPRESSION_T85_L0); } else { t30_set_supported_compressions(t30_state[i], - T30_SUPPORT_T4_1D_COMPRESSION - | T30_SUPPORT_T4_2D_COMPRESSION); + T30_SUPPORT_COMPRESSION_T4_1D + | T30_SUPPORT_COMPRESSION_T4_2D); } t30_set_minimum_scan_line_time(t30_state[i], scan_line_time); diff --git a/libs/spandsp/tests/fax_tests.sh b/libs/spandsp/tests/fax_tests.sh index e273968630..a6f762c020 100755 --- a/libs/spandsp/tests/fax_tests.sh +++ b/libs/spandsp/tests/fax_tests.sh @@ -43,103 +43,143 @@ ITUTESTS_DIR=../test-data/itu/fax 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 - FILE="${ITUTESTS_DIR}/R8_385_A4.tif" + FILE="${ITUTESTS_DIR}/bilevel_R8_385_A4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R8_385_B4.tif" + FILE="${ITUTESTS_DIR}/bilevel_R8_385_B4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R8_385_A3.tif" + FILE="${ITUTESTS_DIR}/bilevel_R8_385_A3.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R8_77_A4.tif" + FILE="${ITUTESTS_DIR}/bilevel_R8_77_A4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R8_77_B4.tif" + FILE="${ITUTESTS_DIR}/bilevel_R8_77_B4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R8_77_A3.tif" + FILE="${ITUTESTS_DIR}/bilevel_R8_77_A3.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R8_154_A4.tif" + FILE="${ITUTESTS_DIR}/bilevel_R8_154_A4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R8_154_B4.tif" + FILE="${ITUTESTS_DIR}/bilevel_R8_154_B4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R8_154_A3.tif" + FILE="${ITUTESTS_DIR}/bilevel_R8_154_A3.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R300_300_A4.tif" + FILE="${ITUTESTS_DIR}/bilevel_R16_154_A4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R300_300_B4.tif" + FILE="${ITUTESTS_DIR}/bilevel_R16_154_B4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R300_300_A3.tif" + FILE="${ITUTESTS_DIR}/bilevel_R16_154_A3.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R300_600_A4.tif" + FILE="${ITUTESTS_DIR}/bilevel_200_100_A4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R300_600_B4.tif" + FILE="${ITUTESTS_DIR}/bilevel_200_100_B4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R300_600_A3.tif" + FILE="${ITUTESTS_DIR}/bilevel_200_100_A3.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R16_154_A4.tif" + FILE="${ITUTESTS_DIR}/bilevel_200_200_A4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R16_154_B4.tif" + FILE="${ITUTESTS_DIR}/bilevel_200_200_B4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R16_154_A3.tif" + FILE="${ITUTESTS_DIR}/bilevel_200_200_A3.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R16_800_A4.tif" + FILE="${ITUTESTS_DIR}/bilevel_200_400_A4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R16_800_B4.tif" + FILE="${ITUTESTS_DIR}/bilevel_200_400_B4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R16_800_A3.tif" + FILE="${ITUTESTS_DIR}/bilevel_200_400_A3.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R600_600_A4.tif" + FILE="${ITUTESTS_DIR}/bilevel_300_300_A4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R600_600_B4.tif" + FILE="${ITUTESTS_DIR}/bilevel_300_300_B4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R600_600_A3.tif" + FILE="${ITUTESTS_DIR}/bilevel_300_300_A3.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R600_1200_A4.tif" + FILE="${ITUTESTS_DIR}/bilevel_300_600_A4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R600_1200_B4.tif" + FILE="${ITUTESTS_DIR}/bilevel_300_600_B4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R600_1200_A3.tif" + FILE="${ITUTESTS_DIR}/bilevel_300_600_A3.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R1200_1200_A4.tif" + FILE="${ITUTESTS_DIR}/bilevel_400_400_A4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R1200_1200_B4.tif" + FILE="${ITUTESTS_DIR}/bilevel_400_400_B4.tif" run_fax_test - FILE="${ITUTESTS_DIR}/R1200_1200_A3.tif" + FILE="${ITUTESTS_DIR}/bilevel_400_400_A3.tif" + run_fax_test + + + FILE="${ITUTESTS_DIR}/bilevel_400_800_A4.tif" + run_fax_test + + FILE="${ITUTESTS_DIR}/bilevel_400_800_B4.tif" + run_fax_test + + FILE="${ITUTESTS_DIR}/bilevel_400_800_A3.tif" + run_fax_test + + + FILE="${ITUTESTS_DIR}/bilevel_600_600_A4.tif" + run_fax_test + + FILE="${ITUTESTS_DIR}/bilevel_600_600_B4.tif" + run_fax_test + + FILE="${ITUTESTS_DIR}/bilevel_600_600_A3.tif" + run_fax_test + + + FILE="${ITUTESTS_DIR}/bilevel_600_1200_A4.tif" + run_fax_test + + FILE="${ITUTESTS_DIR}/bilevel_600_1200_B4.tif" + run_fax_test + + FILE="${ITUTESTS_DIR}/bilevel_600_1200_A3.tif" + run_fax_test + + + FILE="${ITUTESTS_DIR}/bilevel_1200_1200_A4.tif" + run_fax_test + + FILE="${ITUTESTS_DIR}/bilevel_1200_1200_B4.tif" + run_fax_test + + FILE="${ITUTESTS_DIR}/bilevel_1200_1200_A3.tif" run_fax_test done diff --git a/libs/spandsp/tests/t38_decode.c b/libs/spandsp/tests/t38_decode.c index 67660fe937..8e7d10d253 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, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION | T30_SUPPORT_T85_COMPRESSION); + t30_set_supported_compressions(t30, T30_SUPPORT_COMPRESSION_T4_1D | T30_SUPPORT_COMPRESSION_T4_2D | T30_SUPPORT_COMPRESSION_T6 | T30_SUPPORT_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, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + t30_set_supported_compressions(t30, T30_SUPPORT_COMPRESSION_T4_1D | T30_SUPPORT_COMPRESSION_T4_2D | T30_SUPPORT_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/t4_t6_tests.c b/libs/spandsp/tests/t4_t6_tests.c index 418e24b655..bb67643422 100644 --- a/libs/spandsp/tests/t4_t6_tests.c +++ b/libs/spandsp/tests/t4_t6_tests.c @@ -205,8 +205,8 @@ static int detect_page_end(int bit, int page_ended) end_marks = 0; eol_zeros = 11; - eol_ones = (page_ended == T4_COMPRESSION_ITU_T4_2D) ? 2 : 1; - expected_eols = (page_ended == T4_COMPRESSION_ITU_T6) ? 2 : 6; + eol_ones = (page_ended == T4_COMPRESSION_T4_2D) ? 2 : 1; + expected_eols = (page_ended == T4_COMPRESSION_T6) ? 2 : 6; return 0; } @@ -266,9 +266,9 @@ int main(int argc, char *argv[]) { static const int compression_sequence[] = { - T4_COMPRESSION_ITU_T4_1D, - T4_COMPRESSION_ITU_T4_2D, - T4_COMPRESSION_ITU_T6, + T4_COMPRESSION_T4_1D, + T4_COMPRESSION_T4_2D, + T4_COMPRESSION_T6, -1 }; int bit; @@ -303,17 +303,17 @@ int main(int argc, char *argv[]) case 'c': if (strcmp(optarg, "T41D") == 0) { - compression = T4_COMPRESSION_ITU_T4_1D; + compression = T4_COMPRESSION_T4_1D; compression_step = -1; } else if (strcmp(optarg, "T42D") == 0) { - compression = T4_COMPRESSION_ITU_T4_2D; + compression = T4_COMPRESSION_T4_2D; compression_step = -1; } else if (strcmp(optarg, "T6") == 0) { - compression = T4_COMPRESSION_ITU_T6; + compression = T4_COMPRESSION_T6; compression_step = -1; } break; diff --git a/libs/spandsp/tests/t4_tests.c b/libs/spandsp/tests/t4_tests.c index afded4ec2b..2c867e6d16 100644 --- a/libs/spandsp/tests/t4_tests.c +++ b/libs/spandsp/tests/t4_tests.c @@ -220,8 +220,8 @@ static int detect_page_end(int bit, int page_ended) end_marks = 0; eol_zeros = 11; - eol_ones = (page_ended == T4_COMPRESSION_ITU_T4_2D) ? 2 : 1; - expected_eols = (page_ended == T4_COMPRESSION_ITU_T6) ? 2 : 6; + eol_ones = (page_ended == T4_COMPRESSION_T4_2D) ? 2 : 1; + expected_eols = (page_ended == T4_COMPRESSION_T6) ? 2 : 6; return 0; } @@ -282,19 +282,19 @@ int main(int argc, char *argv[]) static const int compression_sequence[] = { //T4_COMPRESSION_NONE, - T4_COMPRESSION_ITU_T4_1D, - T4_COMPRESSION_ITU_T4_2D, - T4_COMPRESSION_ITU_T6, + T4_COMPRESSION_T4_1D, + T4_COMPRESSION_T4_2D, + T4_COMPRESSION_T6, #if defined(SPANDSP_SUPPORT_T42x) - T4_COMPRESSION_ITU_T42, - T4_COMPRESSION_ITU_SYCC_T42, + T4_COMPRESSION_T42, + T4_COMPRESSION_SYCC_T42, #endif #if defined(SPANDSP_SUPPORT_T43x) - T4_COMPRESSION_ITU_T43, + T4_COMPRESSION_T43, #endif - T4_COMPRESSION_ITU_T85, - T4_COMPRESSION_ITU_T85_L0, - //T4_COMPRESSION_ITU_T45, + T4_COMPRESSION_T85, + T4_COMPRESSION_T85_L0, + //T4_COMPRESSION_T45, -1 }; int sends; @@ -353,36 +353,36 @@ int main(int argc, char *argv[]) case 'c': if (strcmp(optarg, "T41D") == 0) { - compression = T4_COMPRESSION_ITU_T4_1D; + compression = T4_COMPRESSION_T4_1D; compression_step = -1; } else if (strcmp(optarg, "T42D") == 0) { - compression = T4_COMPRESSION_ITU_T4_2D; + compression = T4_COMPRESSION_T4_2D; compression_step = -1; } else if (strcmp(optarg, "T6") == 0) { - compression = T4_COMPRESSION_ITU_T6; + compression = T4_COMPRESSION_T6; compression_step = -1; } #if defined(SPANDSP_SUPPORT_T42) else if (strcmp(optarg, "T42") == 0) { - compression = T4_COMPRESSION_ITU_T42; + compression = T4_COMPRESSION_T42; compression_step = -1; } #endif #if defined(SPANDSP_SUPPORT_T43) else if (strcmp(optarg, "T43") == 0) { - compression = T4_COMPRESSION_ITU_T43; + compression = T4_COMPRESSION_T43; compression_step = -1; } #endif else if (strcmp(optarg, "T85") == 0) { - compression = T4_COMPRESSION_ITU_T85; + compression = T4_COMPRESSION_T85; compression_step = -1; } break; @@ -426,9 +426,9 @@ int main(int argc, char *argv[]) if (decode_file_name) { if (compression < 0) - compression = T4_COMPRESSION_ITU_T4_1D; + compression = T4_COMPRESSION_T4_1D; /* Receive end puts TIFF to a new file. We assume the receive width here. */ - if ((receive_state = t4_rx_init(NULL, OUT_FILE_NAME, T4_COMPRESSION_ITU_T4_2D)) == NULL) + if ((receive_state = t4_rx_init(NULL, OUT_FILE_NAME, T4_COMPRESSION_T4_2D)) == NULL) { printf("Failed to init T.4 rx\n"); exit(2); @@ -548,7 +548,7 @@ int main(int argc, char *argv[]) t4_tx_set_max_2d_rows_per_1d_row(send_state, 2); /* Receive end puts TIFF to a function. */ - if ((receive_state = t4_rx_init(NULL, NULL, T4_COMPRESSION_ITU_T4_2D)) == NULL) + if ((receive_state = t4_rx_init(NULL, NULL, T4_COMPRESSION_T4_2D)) == NULL) { printf("Failed to init T.4 rx\n"); exit(2); @@ -670,7 +670,7 @@ int main(int argc, char *argv[]) t4_tx_set_local_ident(send_state, "111 2222 3333"); /* Receive end puts TIFF to a new file. */ - if ((receive_state = t4_rx_init(NULL, OUT_FILE_NAME, T4_COMPRESSION_ITU_T4_2D)) == NULL) + if ((receive_state = t4_rx_init(NULL, OUT_FILE_NAME, T4_COMPRESSION_T4_2D)) == NULL) { printf("Failed to init T.4 rx for '%s'\n", OUT_FILE_NAME); exit(2); diff --git a/libs/spandsp/tests/tsb85_tests.c b/libs/spandsp/tests/tsb85_tests.c index 9d431f4f3f..a4293eafed 100644 --- a/libs/spandsp/tests/tsb85_tests.c +++ b/libs/spandsp/tests/tsb85_tests.c @@ -406,7 +406,7 @@ static void fax_prepare(void) | T30_SUPPORT_400_800_RESOLUTION | T30_SUPPORT_600_1200_RESOLUTION); t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17); - t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + t30_set_supported_compressions(t30, T30_SUPPORT_COMPRESSION_T4_1D | T30_SUPPORT_COMPRESSION_T4_2D | T30_SUPPORT_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'); @@ -879,7 +879,7 @@ static int next_step(faxtester_state_t *s) t30 = fax_get_t30_state(fax); t30_set_rx_file(t30, output_tiff_file_name, -1); /* Avoid libtiff 3.8.2 and earlier bug on complex 2D lines. */ - t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T4_1D); + t30_set_rx_encoding(t30, T4_COMPRESSION_T4_1D); if (value) { sprintf(path, "%s/%s", image_path, (const char *) value); @@ -894,7 +894,7 @@ static int next_step(faxtester_state_t *s) next_tx_file[0] = '\0'; t30 = fax_get_t30_state(fax); /* Avoid libtiff 3.8.2 and earlier bug on complex 2D lines. */ - t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T4_1D); + t30_set_rx_encoding(t30, T4_COMPRESSION_T4_1D); if (value) { sprintf(path, "%s/%s", image_path, (const char *) value); @@ -969,13 +969,13 @@ static int next_step(faxtester_state_t *s) exit(2); } t4_tx_set_header_info(&t4_tx_state, NULL); - compression_type = T4_COMPRESSION_ITU_T4_1D; + compression_type = T4_COMPRESSION_T4_1D; if (compression) { if (strcasecmp((const char *) compression, "T.4 2D") == 0) - compression_type = T4_COMPRESSION_ITU_T4_2D; + compression_type = T4_COMPRESSION_T4_2D; else if (strcasecmp((const char *) compression, "T.6") == 0) - compression_type = T4_COMPRESSION_ITU_T6; + compression_type = T4_COMPRESSION_T6; } t4_tx_set_tx_encoding(&t4_tx_state, compression_type); t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits); @@ -1009,13 +1009,13 @@ static int next_step(faxtester_state_t *s) exit(2); } t4_tx_set_header_info(&t4_tx_state, NULL); - compression_type = T4_COMPRESSION_ITU_T4_1D; + compression_type = T4_COMPRESSION_T4_1D; if (compression) { if (strcasecmp((const char *) compression, "T.4 2D") == 0) - compression_type = T4_COMPRESSION_ITU_T4_2D; + compression_type = T4_COMPRESSION_T4_2D; else if (strcasecmp((const char *) compression, "T.6") == 0) - compression_type = T4_COMPRESSION_ITU_T6; + compression_type = T4_COMPRESSION_T6; } t4_tx_set_tx_encoding(&t4_tx_state, compression_type); t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 8504fda1d5..10da2ab642 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -888,11 +888,11 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) } if (pvt->use_ecm) { - t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION | T30_SUPPORT_T85_COMPRESSION | T30_SUPPORT_T85_L0_COMPRESSION); + t30_set_supported_compressions(t30, T30_SUPPORT_COMPRESSION_T4_1D | T30_SUPPORT_COMPRESSION_T4_2D | T30_SUPPORT_COMPRESSION_T6 | T30_SUPPORT_COMPRESSION_T85 | T30_SUPPORT_COMPRESSION_T85_L0); t30_set_ecm_capability(t30, TRUE); switch_channel_set_variable(channel, "fax_ecm_requested", "1"); } else { - t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION); + t30_set_supported_compressions(t30, T30_SUPPORT_COMPRESSION_T4_1D | T30_SUPPORT_COMPRESSION_T4_2D); switch_channel_set_variable(channel, "fax_ecm_requested", "0"); }