diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h index dabedaa6e8..3b514b48da 100644 --- a/libs/spandsp/src/spandsp/t30.h +++ b/libs/spandsp/src/spandsp/t30.h @@ -323,19 +323,6 @@ enum T30_MODEM_DONE }; -enum -{ - T30_FRONT_END_SEND_STEP_COMPLETE = 0, - /*! The current receive has completed. This is only needed to report an - unexpected end of the receive operation, as might happen with T.38 - dying. */ - T30_FRONT_END_RECEIVE_COMPLETE, - T30_FRONT_END_SIGNAL_PRESENT, - T30_FRONT_END_SIGNAL_ABSENT, - T30_FRONT_END_CED_PRESENT, - T30_FRONT_END_CNG_PRESENT -}; - enum { /*! Support the V.27ter modem (2400, and 4800bps) for image transfer. */ @@ -352,90 +339,15 @@ enum enum { - /*! No compression */ - T30_SUPPORT_COMPRESSION_NONE = 0x01, - /*! T.1 1D compression */ - T30_SUPPORT_COMPRESSION_T4_1D = 0x02, - /*! T.4 2D compression */ - T30_SUPPORT_COMPRESSION_T4_2D = 0x04, - /*! T.6 2D compression */ - T30_SUPPORT_COMPRESSION_T6 = 0x08, - /*! T.85 monochrome JBIG compression, with fixed L0 */ - T30_SUPPORT_COMPRESSION_T85 = 0x10, - /*! T.85 monochrome JBIG compression, with variable L0 */ - T30_SUPPORT_COMPRESSION_T85_L0 = 0x20, - /*! T.43 colour JBIG compression */ - T30_SUPPORT_COMPRESSION_T43 = 0x40, - /*! T.45 run length colour compression */ - T30_SUPPORT_COMPRESSION_T45 = 0x80, - /*! T.81 + T.30 Annex E colour JPEG compression */ - T30_SUPPORT_COMPRESSION_T42_T81 = 0x100, - /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */ - T30_SUPPORT_COMPRESSION_SYCC_T81 = 0x200, - /*! T.88 monochrome JBIG2 compression */ - T30_SUPPORT_COMPRESSION_T88 = 0x400, - /*! Gray-scale support by multi-level codecs */ - T30_SUPPORT_COMPRESSION_GRAYSCALE = 0x1000000, - /*! Colour support by multi-level codecs */ - T30_SUPPORT_COMPRESSION_COLOUR = 0x2000000, - /*! 12 bit mode for gray scale and colour */ - T30_SUPPORT_COMPRESSION_12BIT = 0x4000000, - /*! Convert a colour image to a gray-scale one */ - T30_SUPPORT_COMPRESSION_COLOUR_TO_GRAY = 0x8000000, - /*! Dither a gray scale image down a simple bilevel image, with rescaling to fit a FAX page */ - T30_SUPPORT_GRAY_TO_BILEVEL = 0x10000000, - /*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */ - T30_SUPPORT_COLOUR_TO_BILEVEL = 0x20000000, - /*! Rescale an image (except a bi-level image) to fit a permitted FAX width when necessary */ - T30_SUPPORT_COMPRESSION_RESCALING = 0x40000000 -}; - -enum -{ - /*! Standard FAX resolution 204dpi x 98dpi - bi-level only */ - T30_SUPPORT_RESOLUTION_R8_STANDARD = 0x1, - /*! Fine FAX resolution 204dpi x 196dpi - bi-level only */ - T30_SUPPORT_RESOLUTION_R8_FINE = 0x2, - /*! Super-fine FAX resolution 204dpi x 391dpi - bi-level only */ - T30_SUPPORT_RESOLUTION_R8_SUPERFINE = 0x4, - /*! Double FAX resolution 408dpi x 391dpi - bi-level only */ - T30_SUPPORT_RESOLUTION_R16_SUPERFINE = 0x8, - - /*! 100dpi x 100 dpi - gray scale and colour only */ - T30_SUPPORT_RESOLUTION_100_100 = 0x10, - /*! 200dpi x 100 dpi - bi-level only */ - T30_SUPPORT_RESOLUTION_200_100 = 0x20, - /*! 200dpi x 200 dpi */ - T30_SUPPORT_RESOLUTION_200_200 = 0x40, - /*! 200dpi x 400 dpi - bi-level only */ - T30_SUPPORT_RESOLUTION_200_400 = 0x80, - /*! 300dpi x 300 dpi */ - T30_SUPPORT_RESOLUTION_300_300 = 0x100, - /*! 300dpi x 600 dpi - bi-level only */ - T30_SUPPORT_RESOLUTION_300_600 = 0x200, - /*! 400dpi x 400 dpi */ - T30_SUPPORT_RESOLUTION_400_400 = 0x400, - /*! 400dpi x 800 dpi - bi-level only */ - T30_SUPPORT_RESOLUTION_400_800 = 0x800, - /*! 600dpi x 600 dpi */ - T30_SUPPORT_RESOLUTION_600_600 = 0x1000, - /*! 600dpi x 1200 dpi - bi-level only */ - T30_SUPPORT_RESOLUTION_600_1200 = 0x2000, - /*! 1200dpi x 1200 dpi */ - T30_SUPPORT_RESOLUTION_1200_1200 = 0x4000 -}; - -enum -{ - T30_SUPPORT_215MM_WIDTH = 0x01, - T30_SUPPORT_255MM_WIDTH = 0x02, - T30_SUPPORT_303MM_WIDTH = 0x04, - - T30_SUPPORT_UNLIMITED_LENGTH = 0x10000, - T30_SUPPORT_A4_LENGTH = 0x20000, - T30_SUPPORT_B4_LENGTH = 0x40000, - T30_SUPPORT_US_LETTER_LENGTH = 0x80000, - T30_SUPPORT_US_LEGAL_LENGTH = 0x100000 + T30_FRONT_END_SEND_STEP_COMPLETE = 0, + /*! The current receive has completed. This is only needed to report an + unexpected end of the receive operation, as might happen with T.38 + dying. */ + T30_FRONT_END_RECEIVE_COMPLETE, + T30_FRONT_END_SIGNAL_PRESENT, + T30_FRONT_END_SIGNAL_ABSENT, + T30_FRONT_END_CED_PRESENT, + T30_FRONT_END_CNG_PRESENT }; enum diff --git a/libs/spandsp/src/spandsp/t4_rx.h b/libs/spandsp/src/spandsp/t4_rx.h index 803a928a31..4e2e57d14e 100644 --- a/libs/spandsp/src/spandsp/t4_rx.h +++ b/libs/spandsp/src/spandsp/t4_rx.h @@ -60,7 +60,7 @@ typedef enum T4_COMPRESSION_T85 = 4, /*! T.85 monochrome JBIG coding with L0 variable. */ T4_COMPRESSION_T85_L0 = 5, - /*! T.43 colour JBIG coding */ + /*! T.43 gray-scale/colour JBIG coding */ T4_COMPRESSION_T43 = 6, /*! T.45 run length colour compression */ T4_COMPRESSION_T45 = 7, @@ -70,15 +70,67 @@ typedef enum T4_COMPRESSION_SYCC_T81 = 9 } t4_image_compression_t; +enum +{ + /*! No compression */ + T30_SUPPORT_COMPRESSION_NONE = 0x01, + /*! T.1 1D compression */ + T30_SUPPORT_COMPRESSION_T4_1D = 0x02, + /*! T.4 2D compression */ + T30_SUPPORT_COMPRESSION_T4_2D = 0x04, + /*! T.6 2D compression */ + T30_SUPPORT_COMPRESSION_T6 = 0x08, + /*! T.85 monochrome JBIG compression, with fixed L0 */ + T30_SUPPORT_COMPRESSION_T85 = 0x10, + /*! T.85 monochrome JBIG compression, with variable L0 */ + T30_SUPPORT_COMPRESSION_T85_L0 = 0x20, + /*! T.43 colour JBIG compression */ + T30_SUPPORT_COMPRESSION_T43 = 0x40, + /*! T.45 run length colour compression */ + T30_SUPPORT_COMPRESSION_T45 = 0x80, + /*! T.81 + T.30 Annex E colour JPEG compression */ + T30_SUPPORT_COMPRESSION_T42_T81 = 0x100, + /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */ + T30_SUPPORT_COMPRESSION_SYCC_T81 = 0x200, + /*! T.88 monochrome JBIG2 compression */ + T30_SUPPORT_COMPRESSION_T88 = 0x400, + /*! Gray-scale support by multi-level codecs */ + T30_SUPPORT_COMPRESSION_GRAYSCALE = 0x1000000, + /*! Colour support by multi-level codecs */ + T30_SUPPORT_COMPRESSION_COLOUR = 0x2000000, + /*! 12 bit mode for gray scale and colour */ + T30_SUPPORT_COMPRESSION_12BIT = 0x4000000, + /*! Convert a colour image to a gray-scale one */ + T30_SUPPORT_COMPRESSION_COLOUR_TO_GRAY = 0x8000000, + /*! Dither a gray scale image down a simple bilevel image, with rescaling to fit a FAX page */ + T30_SUPPORT_GRAY_TO_BILEVEL = 0x10000000, + /*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */ + T30_SUPPORT_COLOUR_TO_BILEVEL = 0x20000000, + /*! Rescale an image (except a bi-level image) to fit a permitted FAX width when necessary */ + T30_SUPPORT_COMPRESSION_RESCALING = 0x40000000 +}; + /*! Image type */ typedef enum { + /* Traditional black and white FAX */ T4_IMAGE_TYPE_BILEVEL = 0, + /* RGB or CMY image */ T4_IMAGE_TYPE_COLOUR_BILEVEL = 1, - T4_IMAGE_TYPE_GRAY_8BIT = 2, - T4_IMAGE_TYPE_GRAY_12BIT = 3, - T4_IMAGE_TYPE_COLOUR_8BIT = 4, - T4_IMAGE_TYPE_COLOUR_12BIT = 5 + /* CMYK image */ + T4_IMAGE_TYPE_4COLOUR_BILEVEL = 2, + /* 2 to 8 bits per pixel gray-scale image */ + T4_IMAGE_TYPE_GRAY_8BIT = 3, + /* 9 to 12 bits per pixel gray-scale image */ + T4_IMAGE_TYPE_GRAY_12BIT = 4, + /* 2 to 8 bits per pixel RGB or CMY colour image */ + T4_IMAGE_TYPE_COLOUR_8BIT = 5, + /* 2 to 8 bits per pixel CMYK colour image */ + T4_IMAGE_TYPE_4COLOUR_8BIT = 6, + /* 9 to 12 bits per pixel RGB or CMY colour image */ + T4_IMAGE_TYPE_COLOUR_12BIT = 7, + /* 9 to 12 bits per pixel CMYK colour image */ + T4_IMAGE_TYPE_4COLOUR_12BIT = 8 } t4_image_types_t; /*! Supported X resolutions, in pixels per metre. */ @@ -115,37 +167,72 @@ typedef enum 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, + /*! Standard FAX resolution 204dpi x 98dpi - bi-level only */ + T4_RESOLUTION_R8_STANDARD = 1, + /*! Fine FAX resolution 204dpi x 196dpi - bi-level only */ + T4_RESOLUTION_R8_FINE = 2, + /*! Super-fine FAX resolution 204dpi x 391dpi - bi-level only */ + T4_RESOLUTION_R8_SUPERFINE = 3, + /*! Double FAX resolution 408dpi x 391dpi - bi-level only */ + T4_RESOLUTION_R16_SUPERFINE = 4, - /*! Support 100dpi x 100 dpi */ - T4_RESOLUTION_100_100 = 0x10, + /*! 100dpi x 100 dpi - gray-scale and colour only */ + T4_RESOLUTION_100_100 = 5, + /*! 200dpi x 100 dpi - bi-level only */ + T4_RESOLUTION_200_100 = 6, + /*! 200dpi x 200 dpi */ + T4_RESOLUTION_200_200 = 7, + /*! 200dpi x 400 dpi - bi-level only */ + T4_RESOLUTION_200_400 = 8, + /*! 300dpi x 300 dpi */ + T4_RESOLUTION_300_300 = 9, + /*! 300dpi x 600 dpi - bi-level only */ + T4_RESOLUTION_300_600 = 10, + /*! 400dpi x 400 dpi */ + T4_RESOLUTION_400_400 = 11, + /*! 400dpi x 800 dpi - bi-level only */ + T4_RESOLUTION_400_800 = 12, + /*! 600dpi x 600 dpi */ + T4_RESOLUTION_600_600 = 13, + /*! 600dpi x 1200 dpi - bi-level only */ + T4_RESOLUTION_600_1200 = 14, + /*! 1200dpi x 1200 dpi */ + T4_RESOLUTION_1200_1200 = 15 +}; + +enum +{ + /*! Support standard FAX resolution 204dpi x 98dpi - bi-level only */ + T4_SUPPORT_RESOLUTION_R8_STANDARD = 0x1, + /*! Support fine FAX resolution 204dpi x 196dpi - bi-level only */ + T4_SUPPORT_RESOLUTION_R8_FINE = 0x2, + /*! Support super-fine FAX resolution 204dpi x 391dpi - bi-level only */ + T4_SUPPORT_RESOLUTION_R8_SUPERFINE = 0x4, + /*! Support double FAX resolution 408dpi x 391dpi - bi-level only */ + T4_SUPPORT_RESOLUTION_R16_SUPERFINE = 0x8, + + /*! Support 100dpi x 100 dpi - gray scale and colour only */ + T4_SUPPORT_RESOLUTION_100_100 = 0x10, /*! Support 200dpi x 100 dpi - bi-level only */ - T4_RESOLUTION_200_100 = 0x20, + T4_SUPPORT_RESOLUTION_200_100 = 0x20, /*! Support 200dpi x 200 dpi */ - T4_RESOLUTION_200_200 = 0x40, + T4_SUPPORT_RESOLUTION_200_200 = 0x40, /*! Support 200dpi x 400 dpi - bi-level only */ - T4_RESOLUTION_200_400 = 0x80, + T4_SUPPORT_RESOLUTION_200_400 = 0x80, /*! Support 300dpi x 300 dpi */ - T4_RESOLUTION_300_300 = 0x100, + T4_SUPPORT_RESOLUTION_300_300 = 0x100, /*! Support 300dpi x 600 dpi - bi-level only */ - T4_RESOLUTION_300_600 = 0x200, + T4_SUPPORT_RESOLUTION_300_600 = 0x200, /*! Support 400dpi x 400 dpi */ - T4_RESOLUTION_400_400 = 0x400, + T4_SUPPORT_RESOLUTION_400_400 = 0x400, /*! Support 400dpi x 800 dpi - bi-level only */ - T4_RESOLUTION_400_800 = 0x800, + T4_SUPPORT_RESOLUTION_400_800 = 0x800, /*! Support 600dpi x 600 dpi */ - T4_RESOLUTION_600_600 = 0x1000, + T4_SUPPORT_RESOLUTION_600_600 = 0x1000, /*! Support 600dpi x 1200 dpi - bi-level only */ - T4_RESOLUTION_600_1200 = 0x2000, + T4_SUPPORT_RESOLUTION_600_1200 = 0x2000, /*! Support 1200dpi x 1200 dpi */ - T4_RESOLUTION_1200_1200 = 0x4000 + T4_SUPPORT_RESOLUTION_1200_1200 = 0x4000 }; /*! @@ -286,6 +373,19 @@ typedef enum T4_LENGTH_1200_US_LEGAL = 16800 } t4_image_length_t; +enum +{ + T4_SUPPORT_WIDTH_215MM = 0x01, + T4_SUPPORT_WIDTH_255MM = 0x02, + T4_SUPPORT_WIDTH_303MM = 0x04, + + T4_SUPPORT_LENGTH_UNLIMITED = 0x10000, + T4_SUPPORT_LENGTH_A4 = 0x20000, + T4_SUPPORT_LENGTH_B4 = 0x40000, + T4_SUPPORT_LENGTH_US_LETTER = 0x80000, + T4_SUPPORT_LENGTH_US_LEGAL = 0x100000 +}; + /*! Return values from the T.85 decoder */ typedef enum { diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index 19b8868cce..7e235e0104 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -1180,15 +1180,15 @@ int t30_build_dis_or_dtc(t30_state_t *s) s->local_dis_dtc_frame[4] |= (DISBIT6 | DISBIT4 | DISBIT3); /* 215mm wide is always supported */ - if ((s->supported_image_sizes & T30_SUPPORT_303MM_WIDTH)) + if ((s->supported_image_sizes & T4_SUPPORT_WIDTH_303MM)) set_ctrl_bit(s->local_dis_dtc_frame, 18); - else if ((s->supported_image_sizes & T30_SUPPORT_255MM_WIDTH)) + else if ((s->supported_image_sizes & T4_SUPPORT_WIDTH_255MM)) set_ctrl_bit(s->local_dis_dtc_frame, 17); /* A4 is always supported. */ - if ((s->supported_image_sizes & T30_SUPPORT_UNLIMITED_LENGTH)) + if ((s->supported_image_sizes & T4_SUPPORT_LENGTH_UNLIMITED)) set_ctrl_bit(s->local_dis_dtc_frame, 20); - else if ((s->supported_image_sizes & T30_SUPPORT_B4_LENGTH)) + else if ((s->supported_image_sizes & T4_SUPPORT_LENGTH_B4)) set_ctrl_bit(s->local_dis_dtc_frame, 19); /* No scan-line padding required, but some may be specified by the application. */ @@ -1275,9 +1275,9 @@ int t30_build_dis_or_dtc(t30_state_t *s) /* No mode 26 (T.505) */ /* No digital network capability */ /* No duplex operation */ - if ((s->supported_image_sizes & T30_SUPPORT_US_LETTER_LENGTH)) + if ((s->supported_image_sizes & T4_SUPPORT_LENGTH_US_LETTER)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NORTH_AMERICAN_LETTER_CAPABLE); - if ((s->supported_image_sizes & T30_SUPPORT_US_LEGAL_LENGTH)) + if ((s->supported_image_sizes & T4_SUPPORT_LENGTH_US_LEGAL)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NORTH_AMERICAN_LEGAL_CAPABLE); /* No HKM key management */ /* No RSA key management */ @@ -1297,55 +1297,55 @@ int t30_build_dis_or_dtc(t30_state_t *s) if ((s->supported_t30_features & T30_SUPPORT_INTERNET_ROUTING_ADDRESS)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_ROUTING_ADDRESS); - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE); - if ((s->supported_colour_resolutions & T30_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_1200_1200_CAPABLE); } - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_600_1200)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_1200)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE); - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_600)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE); - if ((s->supported_colour_resolutions & T30_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_600_600)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_600_600_CAPABLE); } - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_400_800)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_800)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE); - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_R16_SUPERFINE)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R16_SUPERFINE)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE); - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_400)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE); - if ((s->supported_colour_resolutions & T30_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_400_400)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE); } - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_300_600)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_600)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE); - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_300_300)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_300)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE); - if ((s->supported_colour_resolutions & T4_RESOLUTION_300_300)) + if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_300_300)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE); } - if ((s->supported_bilevel_resolutions & (T30_SUPPORT_RESOLUTION_200_400 | T30_SUPPORT_RESOLUTION_R8_SUPERFINE))) + if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_200_400 | T4_SUPPORT_RESOLUTION_R8_SUPERFINE))) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE); - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_R8_FINE)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_FINE)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE); - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_200_200)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_200)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE); - //if ((s->supported_colour_resolutions & T30_SUPPORT_RESOLUTION_200_200)) + //if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_200_200)) // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_???_CAPABLE); } /* Standard FAX resolution bi-level image support goes without saying */ - if ((s->supported_colour_resolutions & T30_SUPPORT_RESOLUTION_100_100)) + if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_100_100)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE); - if ((s->supported_bilevel_resolutions & (T30_SUPPORT_RESOLUTION_R8_STANDARD | T30_SUPPORT_RESOLUTION_R8_FINE | T30_SUPPORT_RESOLUTION_R8_SUPERFINE | T30_SUPPORT_RESOLUTION_R16_SUPERFINE))) + if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_R8_STANDARD | T4_SUPPORT_RESOLUTION_R8_FINE | T4_SUPPORT_RESOLUTION_R8_SUPERFINE | T4_SUPPORT_RESOLUTION_R16_SUPERFINE))) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED); - if ((s->supported_bilevel_resolutions & (T30_SUPPORT_RESOLUTION_200_100 | T30_SUPPORT_RESOLUTION_200_200 | T30_SUPPORT_RESOLUTION_200_400 | T30_SUPPORT_RESOLUTION_300_300 | T30_SUPPORT_RESOLUTION_300_600 | T30_SUPPORT_RESOLUTION_400_400 | T30_SUPPORT_RESOLUTION_400_800 | T30_SUPPORT_RESOLUTION_600_600 | T30_SUPPORT_RESOLUTION_600_1200 | T30_SUPPORT_RESOLUTION_1200_1200))) + if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_200_100 | T4_SUPPORT_RESOLUTION_200_200 | T4_SUPPORT_RESOLUTION_200_400 | T4_SUPPORT_RESOLUTION_300_300 | T4_SUPPORT_RESOLUTION_300_600 | T4_SUPPORT_RESOLUTION_400_400 | T4_SUPPORT_RESOLUTION_400_800 | T4_SUPPORT_RESOLUTION_600_600 | T4_SUPPORT_RESOLUTION_600_1200 | T4_SUPPORT_RESOLUTION_1200_1200))) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED); /* No double sided printing (alternate mode) */ @@ -1461,14 +1461,14 @@ static int build_dcs(t30_state_t *s) switch (s->x_resolution) { case T4_X_RESOLUTION_1200: - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_1200_1200)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_1200_1200); bad = T30_ERR_OK; } break; case T4_X_RESOLUTION_600: - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_600_1200)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_1200)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_600_1200); bad = T30_ERR_OK; @@ -1480,7 +1480,7 @@ static int build_dcs(t30_state_t *s) switch (s->x_resolution) { case T4_X_RESOLUTION_R16: - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_400_800)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_800)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_800); bad = T30_ERR_OK; @@ -1492,14 +1492,14 @@ static int build_dcs(t30_state_t *s) switch (s->x_resolution) { case T4_X_RESOLUTION_600: - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_600_600)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_600)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_600_600); bad = T30_ERR_OK; } break; case T4_X_RESOLUTION_300: - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_300_600)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_600)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_300_600); bad = T30_ERR_OK; @@ -1511,7 +1511,7 @@ static int build_dcs(t30_state_t *s) switch (s->x_resolution) { case T4_X_RESOLUTION_300: - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_300_300)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_300)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_300_300); bad = T30_ERR_OK; @@ -1523,7 +1523,7 @@ static int build_dcs(t30_state_t *s) case T4_Y_RESOLUTION_400: if (s->x_resolution == T4_X_RESOLUTION_400 && s->y_resolution == T4_Y_RESOLUTION_400) { - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_400_400)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_400)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_400); bad = T30_ERR_OK; @@ -1532,7 +1532,7 @@ static int build_dcs(t30_state_t *s) } else if (s->x_resolution == T4_X_RESOLUTION_R16 && s->y_resolution == T4_Y_RESOLUTION_SUPERFINE) { - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_R16_SUPERFINE)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R16_SUPERFINE)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_400); bad = T30_ERR_OK; @@ -1541,7 +1541,7 @@ static int build_dcs(t30_state_t *s) } else if (s->x_resolution == T4_X_RESOLUTION_200 && s->y_resolution == T4_Y_RESOLUTION_400) { - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_200_400)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_400)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_400); bad = T30_ERR_OK; @@ -1550,7 +1550,7 @@ static int build_dcs(t30_state_t *s) } else if (s->x_resolution == T4_X_RESOLUTION_R8 && s->y_resolution == T4_Y_RESOLUTION_SUPERFINE) { - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_R8_SUPERFINE)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_SUPERFINE)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_400); bad = T30_ERR_OK; @@ -1563,7 +1563,7 @@ static int build_dcs(t30_state_t *s) case T4_Y_RESOLUTION_200: if (s->x_resolution == T4_X_RESOLUTION_200 && s->y_resolution == T4_Y_RESOLUTION_200) { - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_200_200)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_200)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_200); bad = T30_ERR_OK; @@ -1572,7 +1572,7 @@ static int build_dcs(t30_state_t *s) } else if (s->x_resolution == T4_X_RESOLUTION_R8 && s->y_resolution == T4_Y_RESOLUTION_FINE) { - if ((s->mutual_bilevel_resolutions & T30_SUPPORT_RESOLUTION_R8_FINE)) + if ((s->mutual_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_FINE)) { set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_200); bad = T30_ERR_OK; @@ -1636,7 +1636,7 @@ static int build_dcs(t30_state_t *s) { if (((s->far_dis_dtc_frame[5] & (DISBIT2 | DISBIT1)) >= 1) && - (s->supported_image_sizes & T30_SUPPORT_255MM_WIDTH)) + (s->supported_image_sizes & T4_SUPPORT_WIDTH_255MM)) { span_log(&s->logging, SPAN_LOG_FLOW, "Image width is B4\n"); set_ctrl_bit(s->dcs_frame, 17); @@ -1659,7 +1659,7 @@ static int build_dcs(t30_state_t *s) { if (((s->far_dis_dtc_frame[5] & (DISBIT2 | DISBIT1)) >= 2) && - (s->supported_image_sizes & T30_SUPPORT_303MM_WIDTH)) + (s->supported_image_sizes & T4_SUPPORT_WIDTH_303MM)) { span_log(&s->logging, SPAN_LOG_FLOW, "Image width is A3\n"); set_ctrl_bit(s->dcs_frame, 18); @@ -2213,75 +2213,75 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) s->mutual_colour_resolutions = s->supported_colour_resolutions; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~T30_SUPPORT_RESOLUTION_1200_1200; - s->mutual_colour_resolutions &= ~T30_SUPPORT_RESOLUTION_1200_1200; + s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200; + s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_1200_1200_CAPABLE)) - s->mutual_colour_resolutions &= ~T30_SUPPORT_RESOLUTION_1200_1200; + s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE)) - s->mutual_bilevel_resolutions &= ~T30_SUPPORT_RESOLUTION_600_1200; + s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_600_1200; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~T30_SUPPORT_RESOLUTION_600_600; - s->mutual_colour_resolutions &= ~T30_SUPPORT_RESOLUTION_600_600; + s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600; + s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_600_600_CAPABLE)) - s->mutual_colour_resolutions &= ~T30_SUPPORT_RESOLUTION_600_600; + s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE)) - s->mutual_bilevel_resolutions &= ~T30_SUPPORT_RESOLUTION_400_800; + s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_400_800; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~(T30_SUPPORT_RESOLUTION_400_400 | T30_SUPPORT_RESOLUTION_R16_SUPERFINE); - s->mutual_colour_resolutions &= ~T30_SUPPORT_RESOLUTION_400_400; + s->mutual_bilevel_resolutions &= ~(T4_SUPPORT_RESOLUTION_400_400 | T4_SUPPORT_RESOLUTION_R16_SUPERFINE); + s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_400_400; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE)) - s->mutual_colour_resolutions &= ~T30_SUPPORT_RESOLUTION_400_400; + s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_400_400; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE)) - s->mutual_bilevel_resolutions &= ~T30_SUPPORT_RESOLUTION_300_600; + s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_300_600; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~T30_SUPPORT_RESOLUTION_300_300; - s->mutual_colour_resolutions &= ~T30_SUPPORT_RESOLUTION_300_300; + s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300; + s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE)) - s->mutual_colour_resolutions &= ~T30_SUPPORT_RESOLUTION_300_300; + s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE)) { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T30_SUPPORT_RESOLUTION_200_400; + s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_400; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T30_SUPPORT_RESOLUTION_R8_SUPERFINE; + s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_R8_SUPERFINE; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE)) { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T30_SUPPORT_RESOLUTION_200_200; + s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T30_SUPPORT_RESOLUTION_R8_FINE; - s->mutual_colour_resolutions &= ~T30_SUPPORT_RESOLUTION_200_200; + s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_R8_FINE; + s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_colour_resolutions &= ~T30_SUPPORT_RESOLUTION_200_200; + s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T30_SUPPORT_RESOLUTION_200_100; - /* Never suppress T30_SUPPORT_RESOLUTION_R8_STANDARD */ + s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_100; + /* Never suppress T4_SUPPORT_RESOLUTION_R8_STANDARD */ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE)) - s->mutual_colour_resolutions &= ~T30_SUPPORT_RESOLUTION_100_100; + s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_100_100; switch (s->far_dis_dtc_frame[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3)) { @@ -2467,7 +2467,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_1200_1200)) { - if ((s->supported_colour_resolutions & T30_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) { s->x_resolution = T4_X_RESOLUTION_1200; s->y_resolution = T4_Y_RESOLUTION_1200; @@ -2477,7 +2477,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_600_600)) { - if ((s->supported_colour_resolutions & T30_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_600_600)) { s->x_resolution = T4_X_RESOLUTION_600; s->y_resolution = T4_Y_RESOLUTION_600; @@ -2487,7 +2487,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_400)) { - if ((s->supported_colour_resolutions & T30_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_400_400)) { s->x_resolution = T4_X_RESOLUTION_400; s->y_resolution = T4_Y_RESOLUTION_400; @@ -2497,7 +2497,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300)) { - if ((s->supported_colour_resolutions & T30_SUPPORT_RESOLUTION_300_300)) + if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_300_300)) { s->x_resolution = T4_X_RESOLUTION_300; s->y_resolution = T4_Y_RESOLUTION_300; @@ -2507,7 +2507,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_200_200)) { - if ((s->supported_colour_resolutions & T30_SUPPORT_RESOLUTION_200_200)) + if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_200_200)) { s->x_resolution = T4_X_RESOLUTION_200; s->y_resolution = T4_Y_RESOLUTION_200; @@ -2517,7 +2517,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_100_100)) { - if ((s->supported_colour_resolutions & T30_SUPPORT_RESOLUTION_100_100)) + if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_100_100)) { s->x_resolution = T4_X_RESOLUTION_100; s->y_resolution = T4_Y_RESOLUTION_100; @@ -2531,7 +2531,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) /* Bi-level image */ if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_1200_1200)) { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) { s->x_resolution = T4_X_RESOLUTION_1200; s->y_resolution = T4_Y_RESOLUTION_1200; @@ -2541,7 +2541,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_1200)) { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_600_1200)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_1200)) { s->x_resolution = T4_X_RESOLUTION_600; s->y_resolution = T4_Y_RESOLUTION_1200; @@ -2551,7 +2551,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_600)) { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_600)) { s->x_resolution = T4_X_RESOLUTION_600; s->y_resolution = T4_Y_RESOLUTION_600; @@ -2561,7 +2561,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_800)) { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_400_800)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_800)) { s->x_resolution = T4_X_RESOLUTION_400; s->y_resolution = T4_Y_RESOLUTION_800; @@ -2573,7 +2573,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) { if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION)) { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_400)) { s->x_resolution = T4_X_RESOLUTION_400; s->y_resolution = T4_Y_RESOLUTION_400; @@ -2583,7 +2583,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_R16_SUPERFINE)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R16_SUPERFINE)) { s->x_resolution = T4_X_RESOLUTION_R16; s->y_resolution = T4_Y_RESOLUTION_SUPERFINE; @@ -2594,7 +2594,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_600)) { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_300_600)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_600)) { s->x_resolution = T4_X_RESOLUTION_300; s->y_resolution = T4_Y_RESOLUTION_600; @@ -2604,7 +2604,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300)) { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_300_300)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_300)) { s->x_resolution = T4_X_RESOLUTION_300; s->y_resolution = T4_Y_RESOLUTION_300; @@ -2616,7 +2616,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) { if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION)) { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_200_400)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_400)) { s->x_resolution = T4_X_RESOLUTION_200; s->y_resolution = T4_Y_RESOLUTION_400; @@ -2626,7 +2626,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_R8_SUPERFINE)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_SUPERFINE)) { s->x_resolution = T4_X_RESOLUTION_R8; s->y_resolution = T4_Y_RESOLUTION_SUPERFINE; @@ -2639,7 +2639,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) { if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION)) { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_200_200)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_200)) { s->x_resolution = T4_X_RESOLUTION_200; s->y_resolution = T4_Y_RESOLUTION_200; @@ -2649,7 +2649,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else { - if ((s->supported_bilevel_resolutions & T30_SUPPORT_RESOLUTION_R8_FINE)) + if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_FINE)) { s->x_resolution = T4_X_RESOLUTION_R8; s->y_resolution = T4_Y_RESOLUTION_FINE; @@ -6655,13 +6655,13 @@ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s, /* Default to the basic modems. */ s->supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; s->supported_compressions = T30_SUPPORT_COMPRESSION_T4_1D | T30_SUPPORT_COMPRESSION_T4_2D; - s->supported_bilevel_resolutions = T30_SUPPORT_RESOLUTION_R8_STANDARD - | T30_SUPPORT_RESOLUTION_R8_FINE - | T30_SUPPORT_RESOLUTION_R8_SUPERFINE; - s->supported_image_sizes = T30_SUPPORT_US_LETTER_LENGTH - | T30_SUPPORT_US_LEGAL_LENGTH - | T30_SUPPORT_UNLIMITED_LENGTH - | T30_SUPPORT_215MM_WIDTH; + s->supported_bilevel_resolutions = T4_SUPPORT_RESOLUTION_R8_STANDARD + | T4_SUPPORT_RESOLUTION_R8_FINE + | T4_SUPPORT_RESOLUTION_R8_SUPERFINE; + s->supported_image_sizes = T4_SUPPORT_WIDTH_215MM + | T4_SUPPORT_LENGTH_US_LETTER + | T4_SUPPORT_LENGTH_US_LEGAL + | T4_SUPPORT_LENGTH_UNLIMITED; /* 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_T4_2D; diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c index 3a60ac80dc..138d3f4deb 100644 --- a/libs/spandsp/src/t30_api.c +++ b/libs/spandsp/src/t30_api.c @@ -712,23 +712,23 @@ SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_c SPAN_DECLARE(int) t30_set_supported_bilevel_resolutions(t30_state_t *s, int supported_resolutions) { - supported_resolutions &= T4_RESOLUTION_R8_STANDARD - | T4_RESOLUTION_R8_FINE - | T4_RESOLUTION_R8_SUPERFINE - | T4_RESOLUTION_R16_SUPERFINE - | T4_RESOLUTION_200_100 - | T4_RESOLUTION_200_200 - | T4_RESOLUTION_200_400 - | T4_RESOLUTION_300_300 - | T4_RESOLUTION_300_600 - | T4_RESOLUTION_400_400 - | T4_RESOLUTION_400_800 - | T4_RESOLUTION_600_600 - | T4_RESOLUTION_600_1200 - | T4_RESOLUTION_1200_1200; + supported_resolutions &= T4_SUPPORT_RESOLUTION_R8_STANDARD + | T4_SUPPORT_RESOLUTION_R8_FINE + | T4_SUPPORT_RESOLUTION_R8_SUPERFINE + | T4_SUPPORT_RESOLUTION_R16_SUPERFINE + | T4_SUPPORT_RESOLUTION_200_100 + | T4_SUPPORT_RESOLUTION_200_200 + | T4_SUPPORT_RESOLUTION_200_400 + | T4_SUPPORT_RESOLUTION_300_300 + | T4_SUPPORT_RESOLUTION_300_600 + | T4_SUPPORT_RESOLUTION_400_400 + | T4_SUPPORT_RESOLUTION_400_800 + | T4_SUPPORT_RESOLUTION_600_600 + | T4_SUPPORT_RESOLUTION_600_1200 + | T4_SUPPORT_RESOLUTION_1200_1200; /* Make sure anything needed for colour is enabled as a bi-level image, as that is a rule from T.30. 100x100 is an exception, as it doesn't exist as a bi-level resolution. */ - supported_resolutions |= (s->supported_colour_resolutions & ~T4_RESOLUTION_100_100); + supported_resolutions |= (s->supported_colour_resolutions & ~T4_SUPPORT_RESOLUTION_100_100); s->supported_bilevel_resolutions = supported_resolutions; t30_build_dis_or_dtc(s); return 0; @@ -737,16 +737,16 @@ SPAN_DECLARE(int) t30_set_supported_bilevel_resolutions(t30_state_t *s, int supp SPAN_DECLARE(int) t30_set_supported_colour_resolutions(t30_state_t *s, int supported_resolutions) { - supported_resolutions &= T4_RESOLUTION_100_100 - | T4_RESOLUTION_200_200 - | T4_RESOLUTION_300_300 - | T4_RESOLUTION_400_400 - | T4_RESOLUTION_600_600 - | T4_RESOLUTION_1200_1200; + supported_resolutions &= T4_SUPPORT_RESOLUTION_100_100 + | T4_SUPPORT_RESOLUTION_200_200 + | T4_SUPPORT_RESOLUTION_300_300 + | T4_SUPPORT_RESOLUTION_400_400 + | T4_SUPPORT_RESOLUTION_600_600 + | T4_SUPPORT_RESOLUTION_1200_1200; s->supported_colour_resolutions = supported_resolutions; /* Make sure anything needed for colour is enabled as a bi-level image, as that is a rule from T.30. 100x100 is an exception, as it doesn't exist as a bi-level resolution. */ - s->supported_bilevel_resolutions |= (s->supported_colour_resolutions & ~T4_RESOLUTION_100_100); + s->supported_bilevel_resolutions |= (s->supported_colour_resolutions & ~T4_SUPPORT_RESOLUTION_100_100); t30_build_dis_or_dtc(s); return 0; } diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index a308f53435..bb3f229647 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -263,6 +263,7 @@ static int get_tiff_directory_info(t4_tx_state_t *s) }; char *u; char uu[10]; + uint64_t diroff; uint8_t parm8; uint16_t parm16; #endif @@ -372,6 +373,38 @@ static int get_tiff_directory_info(t4_tx_state_t *s) } if (TIFFGetField(t->tiff_file, TIFFTAG_MODENUMBER, &parm8)) span_log(&s->logging, SPAN_LOG_FLOW, "Mode number %u\n", parm8); + + /* If global parameters are present they should only be on the first page of the file. + However, as we scan the file we might as well look for them on any page. */ + if (TIFFGetField(t->tiff_file, TIFFTAG_GLOBALPARAMETERSIFD, &diroff)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Global parameters IFD at %" PRIu64 "\n", diroff); + if (!TIFFReadCustomDirectory(t->tiff_file, diroff, &tiff_fx_field_array)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Global parameter read failed\n"); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Global parameters\n"); + if (TIFFGetField(t->tiff_file, TIFFTAG_PROFILETYPE, &parm32)) + span_log(&s->logging, SPAN_LOG_FLOW, " Profile type %u\n", parm32); + if (TIFFGetField(t->tiff_file, TIFFTAG_FAXPROFILE, &parm8)) + span_log(&s->logging, SPAN_LOG_FLOW, " FAX profile %s (%u)\n", tiff_fx_fax_profiles[parm8], parm8); + if (TIFFGetField(t->tiff_file, TIFFTAG_CODINGMETHODS, &parm32)) + span_log(&s->logging, SPAN_LOG_FLOW, " Coding methods 0x%x\n", parm32); + if (TIFFGetField(t->tiff_file, TIFFTAG_VERSIONYEAR, &u)) + { + memcpy(uu, u, 4); + uu[4] = '\0'; + span_log(&s->logging, SPAN_LOG_FLOW, " Version year \"%s\"\n", uu); + } + if (TIFFGetField(t->tiff_file, TIFFTAG_MODENUMBER, &parm8)) + span_log(&s->logging, SPAN_LOG_FLOW, " Mode number %u\n", parm8); + + if (!TIFFSetDirectory(t->tiff_file, (tdir_t) s->current_page)) + span_log(&s->logging, SPAN_LOG_FLOW, "Failed to set directory to page %d\n", s->current_page); + } + } #endif return 0; } diff --git a/libs/spandsp/tests/fax_tests.c b/libs/spandsp/tests/fax_tests.c index adbe41a847..67807bcc85 100644 --- a/libs/spandsp/tests/fax_tests.c +++ b/libs/spandsp/tests/fax_tests.c @@ -839,27 +839,27 @@ int main(int argc, char *argv[]) | T30_SUPPORT_SELECTIVE_POLLING | T30_SUPPORT_SUB_ADDRESSING); t30_set_supported_image_sizes(t30_state[i], - T30_SUPPORT_US_LETTER_LENGTH - | T30_SUPPORT_US_LEGAL_LENGTH - | T30_SUPPORT_UNLIMITED_LENGTH - | T30_SUPPORT_215MM_WIDTH - | T30_SUPPORT_255MM_WIDTH - | T30_SUPPORT_303MM_WIDTH); + T4_SUPPORT_WIDTH_215MM + | T4_SUPPORT_WIDTH_255MM + | T4_SUPPORT_WIDTH_303MM + | T4_SUPPORT_LENGTH_US_LETTER + | T4_SUPPORT_LENGTH_US_LEGAL + | T4_SUPPORT_LENGTH_UNLIMITED); t30_set_supported_bilevel_resolutions(t30_state[i], - T30_SUPPORT_RESOLUTION_R8_STANDARD - | T30_SUPPORT_RESOLUTION_R8_FINE - | T30_SUPPORT_RESOLUTION_R8_SUPERFINE - | T30_SUPPORT_RESOLUTION_R16_SUPERFINE - | T30_SUPPORT_RESOLUTION_200_100 - | T30_SUPPORT_RESOLUTION_200_200 - | T30_SUPPORT_RESOLUTION_200_400 - | T30_SUPPORT_RESOLUTION_300_300 - | T30_SUPPORT_RESOLUTION_300_600 - | T30_SUPPORT_RESOLUTION_400_400 - | T30_SUPPORT_RESOLUTION_400_800 - | T30_SUPPORT_RESOLUTION_600_600 - | T30_SUPPORT_RESOLUTION_600_1200 - | T30_SUPPORT_RESOLUTION_1200_1200); + T4_SUPPORT_RESOLUTION_R8_STANDARD + | T4_SUPPORT_RESOLUTION_R8_FINE + | T4_SUPPORT_RESOLUTION_R8_SUPERFINE + | T4_SUPPORT_RESOLUTION_R16_SUPERFINE + | T4_SUPPORT_RESOLUTION_200_100 + | T4_SUPPORT_RESOLUTION_200_200 + | T4_SUPPORT_RESOLUTION_200_400 + | T4_SUPPORT_RESOLUTION_300_300 + | T4_SUPPORT_RESOLUTION_300_600 + | T4_SUPPORT_RESOLUTION_400_400 + | T4_SUPPORT_RESOLUTION_400_800 + | T4_SUPPORT_RESOLUTION_600_600 + | T4_SUPPORT_RESOLUTION_600_1200 + | T4_SUPPORT_RESOLUTION_1200_1200); t30_set_supported_colour_resolutions(t30_state[i], 0); //t30_set_rx_encoding(t30_state[i], T4_COMPRESSION_T85); t30_set_ecm_capability(t30_state[i], use_ecm); diff --git a/libs/spandsp/tests/tsb85_tests.c b/libs/spandsp/tests/tsb85_tests.c index 28c3734fc5..37425ec715 100644 --- a/libs/spandsp/tests/tsb85_tests.c +++ b/libs/spandsp/tests/tsb85_tests.c @@ -386,27 +386,27 @@ static void fax_prepare(void) | T30_SUPPORT_SELECTIVE_POLLING | T30_SUPPORT_SUB_ADDRESSING); t30_set_supported_image_sizes(t30, - T30_SUPPORT_US_LETTER_LENGTH - | T30_SUPPORT_US_LEGAL_LENGTH - | T30_SUPPORT_UNLIMITED_LENGTH - | T30_SUPPORT_215MM_WIDTH - | T30_SUPPORT_255MM_WIDTH - | T30_SUPPORT_303MM_WIDTH); + T4_SUPPORT_WIDTH_215MM + | T4_SUPPORT_WIDTH_255MM + | T4_SUPPORT_WIDTH_303MM + | T4_SUPPORT_LENGTH_US_LETTER + | T4_SUPPORT_LENGTH_US_LEGAL + | T4_SUPPORT_LENGTH_UNLIMITED); t30_set_supported_bilevel_resolutions(t30, - T30_SUPPORT_RESOLUTION_R8_STANDARD - | T30_SUPPORT_RESOLUTION_R8_FINE - | T30_SUPPORT_RESOLUTION_R8_SUPERFINE - | T30_SUPPORT_RESOLUTION_R16_SUPERFINE - | T30_SUPPORT_RESOLUTION_200_100 - | T30_SUPPORT_RESOLUTION_200_200 - | T30_SUPPORT_RESOLUTION_200_400 - | T30_SUPPORT_RESOLUTION_300_300 - | T30_SUPPORT_RESOLUTION_300_600 - | T30_SUPPORT_RESOLUTION_400_400 - | T30_SUPPORT_RESOLUTION_400_800 - | T30_SUPPORT_RESOLUTION_600_600 - | T30_SUPPORT_RESOLUTION_600_1200 - | T30_SUPPORT_RESOLUTION_1200_1200); + T4_SUPPORT_RESOLUTION_R8_STANDARD + | T4_SUPPORT_RESOLUTION_R8_FINE + | T4_SUPPORT_RESOLUTION_R8_SUPERFINE + | T4_SUPPORT_RESOLUTION_R16_SUPERFINE + | T4_SUPPORT_RESOLUTION_200_100 + | T4_SUPPORT_RESOLUTION_200_200 + | T4_SUPPORT_RESOLUTION_200_400 + | T4_SUPPORT_RESOLUTION_300_300 + | T4_SUPPORT_RESOLUTION_300_600 + | T4_SUPPORT_RESOLUTION_400_400 + | T4_SUPPORT_RESOLUTION_400_800 + | T4_SUPPORT_RESOLUTION_600_600 + | T4_SUPPORT_RESOLUTION_600_1200 + | T4_SUPPORT_RESOLUTION_1200_1200); t30_set_supported_colour_resolutions(t30, 0); t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17); t30_set_supported_compressions(t30, T30_SUPPORT_COMPRESSION_T4_1D | T30_SUPPORT_COMPRESSION_T4_2D | T30_SUPPORT_COMPRESSION_T6); diff --git a/libs/tiff-4.0.2/libtiff/tif_dirinfo.c b/libs/tiff-4.0.2/libtiff/tif_dirinfo.c index d4c441c8fa..bebdcb082f 100644 --- a/libs/tiff-4.0.2/libtiff/tif_dirinfo.c +++ b/libs/tiff-4.0.2/libtiff/tif_dirinfo.c @@ -193,7 +193,7 @@ tiffFields[] = { /* end DNG tags */ /* begin TIFF/FX tags */ { TIFFTAG_INDEXED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "Indexed" }, - { TIFFTAG_GLOBALPARAMETERSIFD, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "GlobalParametersIFD", NULL }, + { TIFFTAG_GLOBALPARAMETERSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "GlobalParametersIFD", NULL }, { TIFFTAG_PROFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ProfileType", NULL }, { TIFFTAG_FAXPROFILE, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "FaxProfile", NULL }, { TIFFTAG_CODINGMETHODS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "CodingMethods", NULL }, diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index af932da2cd..c302a02fdb 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -839,7 +839,6 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) t38_gateway_set_ecm_capability(pvt->t38_gateway_state, TRUE); } - span_log_set_message_handler(t38_gateway_get_logging_state(pvt->t38_gateway_state), spanfax_log_message, pvt); span_log_set_message_handler(t38_core_get_logging_state(pvt->t38_core), spanfax_log_message, pvt); @@ -873,13 +872,13 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) t30_set_phase_b_handler(t30, phase_b_handler, pvt); t30_set_supported_image_sizes(t30, - T30_SUPPORT_US_LETTER_LENGTH | T30_SUPPORT_US_LEGAL_LENGTH | T30_SUPPORT_UNLIMITED_LENGTH - | T30_SUPPORT_215MM_WIDTH | T30_SUPPORT_255MM_WIDTH | T30_SUPPORT_303MM_WIDTH); + T4_SUPPORT_LENGTH_US_LETTER | T4_SUPPORT_LENGTH_US_LEGAL | T4_SUPPORT_LENGTH_UNLIMITED + | T4_SUPPORT_WIDTH_215MM | T4_SUPPORT_WIDTH_255MM | T4_SUPPORT_WIDTH_303MM); t30_set_supported_bilevel_resolutions(t30, - T30_SUPPORT_RESOLUTION_R8_STANDARD - | T30_SUPPORT_RESOLUTION_R8_FINE - | T30_SUPPORT_RESOLUTION_R8_SUPERFINE - | T30_SUPPORT_RESOLUTION_R16_SUPERFINE); + T4_SUPPORT_RESOLUTION_R8_STANDARD + | T4_SUPPORT_RESOLUTION_R8_FINE + | T4_SUPPORT_RESOLUTION_R8_SUPERFINE + | T4_SUPPORT_RESOLUTION_R16_SUPERFINE); t30_set_supported_colour_resolutions(t30, 0); if (pvt->disable_v17) {