From 3519e0f4c3222365204f3bf03e7aa9123d723e7d Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 29 May 2013 10:07:08 +0800 Subject: [PATCH] More tweaks towards colour FAXing --- libs/spandsp/src/spandsp/t4_rx.h | 6 +++--- libs/spandsp/src/t30.c | 10 +++++----- libs/spandsp/src/t4_rx.c | 8 ++++---- libs/spandsp/src/t4_tx.c | 4 ++-- libs/spandsp/tests/fax_utils.c | 2 +- libs/spandsp/tests/t4_tests.c | 2 +- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/libs/spandsp/src/spandsp/t4_rx.h b/libs/spandsp/src/spandsp/t4_rx.h index b3f114dc5f..7ebe5b92ce 100644 --- a/libs/spandsp/src/spandsp/t4_rx.h +++ b/libs/spandsp/src/spandsp/t4_rx.h @@ -444,7 +444,7 @@ typedef struct /*! \brief The number of vertical pixels in the exchanged page. */ int length; /*! \brief The type of compression used between the FAX machines */ - int encoding; + int compression; /*! \brief The size of the image on the line, in bytes */ int line_image_size; } t4_stats_t; @@ -535,11 +535,11 @@ SPAN_DECLARE(void) t4_rx_set_model(t4_rx_state_t *s, const char *model); \param t A pointer to a statistics structure. */ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t); -/*! Get the short text name of an encoding format. +/*! Get the short text name of a compression format. \brief Get the short text name of an encoding format. \param encoding The encoding type. \return A pointer to the string. */ -SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding); +SPAN_DECLARE(const char *) t4_compression_to_str(int compression); /*! Get the short text name of an image format. \brief Get the short text name of an image format. diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index 2761d05669..a70db393c9 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -563,7 +563,7 @@ static void report_rx_ecm_page_result(t30_state_t *s) span_log(&s->logging, SPAN_LOG_FLOW, "Page no = %d\n", stats.pages_transferred); span_log(&s->logging, SPAN_LOG_FLOW, "Image size = %d x %d pixels\n", stats.width, stats.length); span_log(&s->logging, SPAN_LOG_FLOW, "Image resolution = %d/m x %d/m\n", stats.x_resolution, stats.y_resolution); - span_log(&s->logging, SPAN_LOG_FLOW, "Compression = %s (%d)\n", t4_encoding_to_str(stats.encoding), stats.encoding); + span_log(&s->logging, SPAN_LOG_FLOW, "Compression = %s (%d)\n", t4_compression_to_str(stats.compression), stats.compression); span_log(&s->logging, SPAN_LOG_FLOW, "Compressed image size = %d bytes\n", stats.line_image_size); } /*- End of function --------------------------------------------------------*/ @@ -587,7 +587,7 @@ static int copy_quality(t30_state_t *s) span_log(&s->logging, SPAN_LOG_FLOW, "Page no = %d\n", stats.pages_transferred + 1); span_log(&s->logging, SPAN_LOG_FLOW, "Image size = %d x %d pixels\n", stats.width, stats.length); span_log(&s->logging, SPAN_LOG_FLOW, "Image resolution = %d/m x %d/m\n", stats.x_resolution, stats.y_resolution); - span_log(&s->logging, SPAN_LOG_FLOW, "Compression = %s (%d)\n", t4_encoding_to_str(stats.encoding), stats.encoding); + span_log(&s->logging, SPAN_LOG_FLOW, "Compression = %s (%d)\n", t4_compression_to_str(stats.compression), stats.compression); span_log(&s->logging, SPAN_LOG_FLOW, "Compressed image size = %d bytes\n", stats.line_image_size); span_log(&s->logging, SPAN_LOG_FLOW, "Bad rows = %d\n", stats.bad_rows); span_log(&s->logging, SPAN_LOG_FLOW, "Longest bad row run = %d\n", stats.longest_bad_row_run); @@ -2367,7 +2367,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) t30_set_status(s, T30_ERR_INCOMPATIBLE); return -1; } - span_log(&s->logging, SPAN_LOG_FLOW, "Far end selected compression %s (%d)\n", t4_encoding_to_str(s->line_compression), s->line_compression); + span_log(&s->logging, SPAN_LOG_FLOW, "Far end selected compression %s (%d)\n", t4_compression_to_str(s->line_compression), s->line_compression); if (x < 0) { @@ -2788,7 +2788,7 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) else s->line_compression = T4_COMPRESSION_T4_1D; - span_log(&s->logging, SPAN_LOG_FLOW, "Choose compression %s (%d)\n", t4_encoding_to_str(s->line_compression), s->line_compression); + span_log(&s->logging, SPAN_LOG_FLOW, "Choose compression %s (%d)\n", t4_compression_to_str(s->line_compression), s->line_compression); if (s->phase_b_handler) { @@ -6704,7 +6704,7 @@ SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t) t->width = stats.width; t->length = stats.length; - t->compression = stats.encoding; + t->compression = stats.compression; t->image_size = stats.line_image_size; t->current_status = s->current_status; t->rtn_events = s->rtn_events; diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 055da91c12..765f427cea 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -91,9 +91,9 @@ typedef struct extern TIFFFieldArray tiff_fx_field_array; #endif -SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding) +SPAN_DECLARE(const char *) t4_compression_to_str(int compression) { - switch (encoding) + switch (compression) { case T4_COMPRESSION_NONE: return "None"; @@ -905,7 +905,7 @@ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t t->image_y_resolution = s->metadata.y_resolution; t->x_resolution = s->metadata.x_resolution; t->y_resolution = s->metadata.y_resolution; - t->encoding = s->metadata.compression; + t->compression = s->metadata.compression; switch (s->metadata.compression) { case T4_COMPRESSION_T4_1D: @@ -965,7 +965,7 @@ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s) { - span_log(&s->logging, SPAN_LOG_FLOW, "Start rx page %d - compression %s\n", s->current_page, t4_encoding_to_str(s->metadata.compression)); + span_log(&s->logging, SPAN_LOG_FLOW, "Start rx page %d - compression %s\n", s->current_page, t4_compression_to_str(s->metadata.compression)); switch (s->metadata.compression) { diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index 0891486c11..02fa125dc6 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -1358,7 +1358,7 @@ SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_tx_state_t *s, t4_stats_t *t t->x_resolution = s->metadata.x_resolution; t->y_resolution = s->metadata.y_resolution/s->row_squashing_ratio; - t->encoding = s->metadata.compression; + t->compression = s->metadata.compression; switch (s->metadata.compression) { case T4_COMPRESSION_T4_1D: @@ -1474,7 +1474,7 @@ SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len) SPAN_DECLARE(int) t4_tx_start_page(t4_tx_state_t *s) { - span_log(&s->logging, SPAN_LOG_FLOW, "Start tx page %d - compression %s\n", s->current_page, t4_encoding_to_str(s->metadata.compression)); + span_log(&s->logging, SPAN_LOG_FLOW, "Start tx page %d - compression %s\n", s->current_page, t4_compression_to_str(s->metadata.compression)); if (s->current_page > s->stop_page) return -1; if (s->tiff.file) diff --git a/libs/spandsp/tests/fax_utils.c b/libs/spandsp/tests/fax_utils.c index 5c94e899ce..7491d862f3 100644 --- a/libs/spandsp/tests/fax_utils.c +++ b/libs/spandsp/tests/fax_utils.c @@ -103,7 +103,7 @@ void fax_log_page_transfer_statistics(t30_state_t *s, const char *tag) printf("%s: Pages in the file %d\n", tag, t.pages_in_file); printf("%s: Bad rows %d, longest bad row run %d\n", tag, t.bad_rows, t.longest_bad_row_run); printf("%s: Bad ECM frames %d\n", tag, t.error_correcting_mode_retries); - printf("%s: Compression type %s (%d)\n", tag, t4_encoding_to_str(t.compression), t.compression); + printf("%s: Compression type %s (%d)\n", tag, t4_compression_to_str(t.compression), t.compression); printf("%s: Compressed image size %d bytes\n", tag, t.image_size); printf("%s: Image type %s (%s in the file)\n", tag, t4_image_type_to_str(t.type), t4_image_type_to_str(t.image_type)); printf("%s: Image size %d pels x %d pels (%d pels x %d pels in the file)\n", tag, t.width, t.length, t.image_width, t.image_length); diff --git a/libs/spandsp/tests/t4_tests.c b/libs/spandsp/tests/t4_tests.c index d31fc4d631..75d953cfa5 100644 --- a/libs/spandsp/tests/t4_tests.c +++ b/libs/spandsp/tests/t4_tests.c @@ -128,7 +128,7 @@ static void display_page_stats(t4_rx_state_t *s) t4_rx_get_transfer_statistics(s, &stats); printf("Pages = %d\n", stats.pages_transferred); - printf("Compression = %s\n", t4_encoding_to_str(stats.encoding)); + printf("Compression = %s\n", t4_compression_to_str(stats.compression)); printf("Compressed size = %d\n", stats.line_image_size); printf("Raw image size = %d pels x %d pels\n", stats.image_width, stats.image_length); printf("Image size = %d pels x %d pels\n", stats.width, stats.length); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 560ef04fde..b897717e1a 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -432,7 +432,7 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int msg) switch_channel_set_variable(channel, "fax_encoding", fax_encoding); } - switch_channel_set_variable(channel, "fax_encoding_name", t4_encoding_to_str(t30_stats.compression)); + switch_channel_set_variable(channel, "fax_encoding_name", t4_compression_to_str(t30_stats.compression)); fax_document_transferred_pages = switch_core_session_sprintf(session, "%d", (pvt->app_mode == FUNCTION_TX) ? t30_stats.pages_tx : t30_stats.pages_rx); if (fax_document_transferred_pages) { @@ -445,7 +445,7 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int msg) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Image type = %s (%s in the file)\n", t4_image_type_to_str(t30_stats.type), t4_image_type_to_str(t30_stats.image_type)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Image size = %d x %d pixels (%d x %d pixels in the file)\n", t30_stats.width, t30_stats.length, t30_stats.image_width, t30_stats.image_length); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Image resolution = %d/m x %d/m (%d/m x %d/m in the file)\n", t30_stats.x_resolution, t30_stats.y_resolution, t30_stats.image_x_resolution, t30_stats.image_y_resolution); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Compression = %s (%d)\n", t4_encoding_to_str(t30_stats.compression), t30_stats.compression); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Compression = %s (%d)\n", t4_compression_to_str(t30_stats.compression), t30_stats.compression); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Compressed image size = %d bytes\n", t30_stats.image_size); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Bad rows = %d\n", t30_stats.bad_rows); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Longest bad row run = %d\n", t30_stats.longest_bad_row_run); @@ -466,7 +466,7 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int msg) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-bad-rows", fax_bad_rows); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-longest-bad-row-run", fax_longest_bad_row_run); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-encoding", fax_encoding); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-encoding-name", t4_encoding_to_str(t30_stats.compression)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-encoding-name", t4_compression_to_str(t30_stats.compression)); switch_event_fire(&event); }