]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
More tweaks towards colour FAXing
authorSteve Underwood <steveu@coppice.org>
Wed, 29 May 2013 02:07:08 +0000 (10:07 +0800)
committerSteve Underwood <steveu@coppice.org>
Wed, 29 May 2013 02:07:08 +0000 (10:07 +0800)
libs/spandsp/src/spandsp/t4_rx.h
libs/spandsp/src/t30.c
libs/spandsp/src/t4_rx.c
libs/spandsp/src/t4_tx.c
libs/spandsp/tests/fax_utils.c
libs/spandsp/tests/t4_tests.c
src/mod/applications/mod_spandsp/mod_spandsp_fax.c

index b3f114dc5fcf2fec20b29251b2516173c42b70af..7ebe5b92ce98aeb09617fe36e4b87b8b7694da1f 100644 (file)
@@ -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.
index 2761d0566919fc23fb68eb1e561672c303077e15..a70db393c903eee967f07bc5cbf3c536cece9e04 100644 (file)
@@ -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;
index 055da91c122de4f03ed40542f1f7b84c649ab163..765f427cea5b13e7d9225f1cdf9e170daea7fe90 100644 (file)
@@ -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)
     {
index 0891486c11d02d54ebc4e72640e653ac48f09e09..02fa125dc68bf6162f8c901bd02ad06552f0a2b7 100644 (file)
@@ -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)
index 5c94e899ce2c87c433428415c273600d9c5640c8..7491d862f3bbb7c2ef23000ee6f59d5e6dd0284b 100644 (file)
@@ -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);
index d31fc4d631b5a0e70db8666bee5b2fc582b85601..75d953cfa57daeff59daf45b98578c6f7fc6a6d1 100644 (file)
@@ -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);
index 560ef04fdeb08ae85405c0b4bd2ebe11efb531cf..b897717e1a6f5355f73754c2cc1b618878af97d4 100644 (file)
@@ -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);
        }