Improvements to T.4 end of image handling, and the related tests.
A lot of tiny tidy up edits
This commit is contained in:
parent
08eb4d72d5
commit
790c4d6eaa
|
@ -625,19 +625,13 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status);
|
||||||
\return The next bit to transmit. */
|
\return The next bit to transmit. */
|
||||||
SPAN_DECLARE_NONSTD(int) t30_non_ecm_get_bit(void *user_data);
|
SPAN_DECLARE_NONSTD(int) t30_non_ecm_get_bit(void *user_data);
|
||||||
|
|
||||||
/*! Get a byte of received non-ECM image data.
|
|
||||||
\brief Get a byte of received non-ECM image data.
|
|
||||||
\param user_data An opaque pointer, which must point to the T.30 context.
|
|
||||||
\return The next byte to transmit. */
|
|
||||||
SPAN_DECLARE(int) t30_non_ecm_get_byte(void *user_data);
|
|
||||||
|
|
||||||
/*! Get a chunk of received non-ECM image data.
|
/*! Get a chunk of received non-ECM image data.
|
||||||
\brief Get a bit of received non-ECM image data.
|
\brief Get a bit of received non-ECM image data.
|
||||||
\param user_data An opaque pointer, which must point to the T.30 context.
|
\param user_data An opaque pointer, which must point to the T.30 context.
|
||||||
\param buf The buffer to contain the data.
|
\param buf The buffer to contain the data.
|
||||||
\param max_len The maximum length of the chunk.
|
\param max_len The maximum length of the chunk.
|
||||||
\return The actual length of the chunk. */
|
\return The actual length of the chunk. */
|
||||||
SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_len);
|
SPAN_DECLARE(int) t30_non_ecm_get(void *user_data, uint8_t buf[], int max_len);
|
||||||
|
|
||||||
/*! Process a bit of received non-ECM image data.
|
/*! Process a bit of received non-ECM image data.
|
||||||
\brief Process a bit of received non-ECM image data
|
\brief Process a bit of received non-ECM image data
|
||||||
|
@ -645,18 +639,12 @@ SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_
|
||||||
\param bit The received bit. */
|
\param bit The received bit. */
|
||||||
SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit);
|
SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit);
|
||||||
|
|
||||||
/*! Process a byte of received non-ECM image data.
|
|
||||||
\brief Process a byte of received non-ECM image data
|
|
||||||
\param user_data An opaque pointer, which must point to the T.30 context.
|
|
||||||
\param byte The received byte. */
|
|
||||||
SPAN_DECLARE(void) t30_non_ecm_put_byte(void *user_data, int byte);
|
|
||||||
|
|
||||||
/*! Process a chunk of received non-ECM image data.
|
/*! Process a chunk of received non-ECM image data.
|
||||||
\brief Process a chunk of received non-ECM image data
|
\brief Process a chunk of received non-ECM image data
|
||||||
\param user_data An opaque pointer, which must point to the T.30 context.
|
\param user_data An opaque pointer, which must point to the T.30 context.
|
||||||
\param buf The buffer containing the received data.
|
\param buf The buffer containing the received data.
|
||||||
\param len The length of the data in buf. */
|
\param len The length of the data in buf. */
|
||||||
SPAN_DECLARE(void) t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len);
|
SPAN_DECLARE(void) t30_non_ecm_put(void *user_data, const uint8_t buf[], int len);
|
||||||
|
|
||||||
/*! Process a received HDLC frame.
|
/*! Process a received HDLC frame.
|
||||||
\brief Process a received HDLC frame.
|
\brief Process a received HDLC frame.
|
||||||
|
|
|
@ -84,11 +84,9 @@ SPAN_DECLARE(void) t42_encode_comment(t42_encode_state_t *s, const uint8_t comme
|
||||||
/*! \brief Check if we are at the end of the current document page.
|
/*! \brief Check if we are at the end of the current document page.
|
||||||
\param s The T.42 context.
|
\param s The T.42 context.
|
||||||
\return 0 for more data to come. SIG_STATUS_END_OF_DATA for no more data. */
|
\return 0 for more data to come. SIG_STATUS_END_OF_DATA for no more data. */
|
||||||
SPAN_DECLARE(int) t42_encode_check_if_complete(t42_encode_state_t *s);
|
SPAN_DECLARE(int) t42_encode_image_complete(t42_encode_state_t *s);
|
||||||
|
|
||||||
SPAN_DECLARE(int) t42_encode_get_byte(t42_encode_state_t *s);
|
SPAN_DECLARE(int) t42_encode_get(t42_encode_state_t *s, uint8_t buf[], size_t max_len);
|
||||||
|
|
||||||
SPAN_DECLARE(int) t42_encode_get_chunk(t42_encode_state_t *s, uint8_t buf[], int max_len);
|
|
||||||
|
|
||||||
SPAN_DECLARE(uint32_t) t42_encode_get_image_width(t42_encode_state_t *s);
|
SPAN_DECLARE(uint32_t) t42_encode_get_image_width(t42_encode_state_t *s);
|
||||||
|
|
||||||
|
@ -114,11 +112,7 @@ SPAN_DECLARE(int) t42_encode_free(t42_encode_state_t *s);
|
||||||
|
|
||||||
SPAN_DECLARE(void) t42_decode_rx_status(t42_decode_state_t *s, int status);
|
SPAN_DECLARE(void) t42_decode_rx_status(t42_decode_state_t *s, int status);
|
||||||
|
|
||||||
SPAN_DECLARE(int) t42_decode_put_byte(t42_decode_state_t *s, int byte);
|
SPAN_DECLARE(int) t42_decode_put(t42_decode_state_t *s, const uint8_t data[], size_t len);
|
||||||
|
|
||||||
SPAN_DECLARE(int) t42_decode_put_chunk(t42_decode_state_t *s,
|
|
||||||
const uint8_t data[],
|
|
||||||
size_t len);
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t42_decode_set_row_write_handler(t42_decode_state_t *s,
|
SPAN_DECLARE(int) t42_decode_set_row_write_handler(t42_decode_state_t *s,
|
||||||
t4_row_write_handler_t handler,
|
t4_row_write_handler_t handler,
|
||||||
|
|
|
@ -271,18 +271,12 @@ SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s);
|
||||||
\return TRUE when the bit ends the document page, otherwise FALSE. */
|
\return TRUE when the bit ends the document page, otherwise FALSE. */
|
||||||
SPAN_DECLARE(int) t4_rx_put_bit(t4_rx_state_t *s, int bit);
|
SPAN_DECLARE(int) t4_rx_put_bit(t4_rx_state_t *s, int bit);
|
||||||
|
|
||||||
/*! \brief Put a byte of the current document page.
|
|
||||||
\param s The T.4 context.
|
|
||||||
\param byte The data byte.
|
|
||||||
\return TRUE when the byte ends the document page, otherwise FALSE. */
|
|
||||||
SPAN_DECLARE(int) t4_rx_put_byte(t4_rx_state_t *s, uint8_t byte);
|
|
||||||
|
|
||||||
/*! \brief Put a byte of the current document page.
|
/*! \brief Put a byte of the current document page.
|
||||||
\param s The T.4 context.
|
\param s The T.4 context.
|
||||||
\param buf The buffer containing the chunk.
|
\param buf The buffer containing the chunk.
|
||||||
\param len The length of the chunk.
|
\param len The length of the chunk.
|
||||||
\return TRUE when the byte ends the document page, otherwise FALSE. */
|
\return TRUE when the byte ends the document page, otherwise FALSE. */
|
||||||
SPAN_DECLARE(int) t4_rx_put_chunk(t4_rx_state_t *s, const uint8_t buf[], int len);
|
SPAN_DECLARE(int) t4_rx_put(t4_rx_state_t *s, const uint8_t buf[], size_t len);
|
||||||
|
|
||||||
/*! \brief Complete the reception of a page.
|
/*! \brief Complete the reception of a page.
|
||||||
\param s The T.4 receive context.
|
\param s The T.4 receive context.
|
||||||
|
|
|
@ -51,18 +51,12 @@ extern "C" {
|
||||||
\return TRUE when the bit ends the document page, otherwise FALSE. */
|
\return TRUE when the bit ends the document page, otherwise FALSE. */
|
||||||
SPAN_DECLARE(int) t4_t6_decode_put_bit(t4_t6_decode_state_t *s, int bit);
|
SPAN_DECLARE(int) t4_t6_decode_put_bit(t4_t6_decode_state_t *s, int bit);
|
||||||
|
|
||||||
/*! \brief Put a byte of the current document page.
|
|
||||||
\param s The T.4/T.6 context.
|
|
||||||
\param byte The data byte.
|
|
||||||
\return TRUE when the byte ends the document page, otherwise FALSE. */
|
|
||||||
SPAN_DECLARE(int) t4_t6_decode_put_byte(t4_t6_decode_state_t *s, int byte);
|
|
||||||
|
|
||||||
/*! \brief Put a byte of the current document page.
|
/*! \brief Put a byte of the current document page.
|
||||||
\param s The T.4/T.6 context.
|
\param s The T.4/T.6 context.
|
||||||
\param buf The buffer containing the chunk.
|
\param buf The buffer containing the chunk.
|
||||||
\param len The length of the chunk.
|
\param len The length of the chunk.
|
||||||
\return TRUE when the byte ends the document page, otherwise FALSE. */
|
\return T4_DECODE_MORE_DATA when the image is still in progress. T4_DECODE_OK when the image is complete. */
|
||||||
SPAN_DECLARE(int) t4_t6_decode_put_chunk(t4_t6_decode_state_t *s, const uint8_t buf[], int len);
|
SPAN_DECLARE(int) t4_t6_decode_put(t4_t6_decode_state_t *s, const uint8_t buf[], size_t len);
|
||||||
|
|
||||||
/*! \brief Set the row write handler for a T.4/T.6 decode context.
|
/*! \brief Set the row write handler for a T.4/T.6 decode context.
|
||||||
\param s The T.4/T.6 context.
|
\param s The T.4/T.6 context.
|
||||||
|
|
|
@ -38,8 +38,8 @@ extern "C" {
|
||||||
moving forward in the buffer. The document will be padded for the
|
moving forward in the buffer. The document will be padded for the
|
||||||
current minimum scan line time.
|
current minimum scan line time.
|
||||||
\param s The T.4/T.6 context.
|
\param s The T.4/T.6 context.
|
||||||
\return The next bit (i.e. 0 or 1). SIG_STATUS_END_OF_DATA for no more data. */
|
\return 0 for more data to come. SIG_STATUS_END_OF_DATA for no more data. */
|
||||||
SPAN_DECLARE(int) t4_t6_encode_check_bit(t4_t6_encode_state_t *s);
|
SPAN_DECLARE(int) t4_t6_encode_image_complete(t4_t6_encode_state_t *s);
|
||||||
|
|
||||||
/*! \brief Get the next bit of the current image. The image will
|
/*! \brief Get the next bit of the current image. The image will
|
||||||
be padded for the current minimum scan line time.
|
be padded for the current minimum scan line time.
|
||||||
|
@ -47,14 +47,6 @@ SPAN_DECLARE(int) t4_t6_encode_check_bit(t4_t6_encode_state_t *s);
|
||||||
\return The next bit (i.e. 0 or 1). SIG_STATUS_END_OF_DATA for no more data. */
|
\return The next bit (i.e. 0 or 1). SIG_STATUS_END_OF_DATA for no more data. */
|
||||||
SPAN_DECLARE(int) t4_t6_encode_get_bit(t4_t6_encode_state_t *s);
|
SPAN_DECLARE(int) t4_t6_encode_get_bit(t4_t6_encode_state_t *s);
|
||||||
|
|
||||||
/*! \brief Get the next byte of the current document page. The document will
|
|
||||||
be padded for the current minimum scan line time.
|
|
||||||
\param s The T.4/T.6 context.
|
|
||||||
\return The next byte. For the last byte of data, bit 8 is
|
|
||||||
set. In this case, one or more bits of the byte may be padded with
|
|
||||||
zeros, to complete the byte. */
|
|
||||||
SPAN_DECLARE(int) t4_t6_encode_get_byte(t4_t6_encode_state_t *s);
|
|
||||||
|
|
||||||
/*! \brief Get the next chunk of the current document page. The document will
|
/*! \brief Get the next chunk of the current document page. The document will
|
||||||
be padded for the current minimum scan line time.
|
be padded for the current minimum scan line time.
|
||||||
\param s The T.4/T.6 context.
|
\param s The T.4/T.6 context.
|
||||||
|
@ -62,7 +54,7 @@ SPAN_DECLARE(int) t4_t6_encode_get_byte(t4_t6_encode_state_t *s);
|
||||||
\param max_len The maximum length of the chunk.
|
\param max_len The maximum length of the chunk.
|
||||||
\return The actual length of the chunk. If this is less than max_len it
|
\return The actual length of the chunk. If this is less than max_len it
|
||||||
indicates that the end of the document has been reached. */
|
indicates that the end of the document has been reached. */
|
||||||
SPAN_DECLARE(int) t4_t6_encode_get_chunk(t4_t6_encode_state_t *s, uint8_t buf[], int max_len);
|
SPAN_DECLARE(int) t4_t6_encode_get(t4_t6_encode_state_t *s, uint8_t buf[], int max_len);
|
||||||
|
|
||||||
/*! \brief Set the row read handler for a T.4/T.6 encode context.
|
/*! \brief Set the row read handler for a T.4/T.6 encode context.
|
||||||
\param s The T.4/T.6 context.
|
\param s The T.4/T.6 context.
|
||||||
|
|
|
@ -253,8 +253,8 @@ SPAN_DECLARE(int) t4_tx_end_page(t4_tx_state_t *s);
|
||||||
moving forward in the buffer. The document will be padded for the
|
moving forward in the buffer. The document will be padded for the
|
||||||
current minimum scan line time.
|
current minimum scan line time.
|
||||||
\param s The T.4 context.
|
\param s The T.4 context.
|
||||||
\return The next bit (i.e. 0 or 1). SIG_STATUS_END_OF_DATA for no more data. */
|
\return 0 for more data to come. SIG_STATUS_END_OF_DATA for no more data. */
|
||||||
SPAN_DECLARE(int) t4_tx_check_if_complete(t4_tx_state_t *s);
|
SPAN_DECLARE(int) t4_tx_image_complete(t4_tx_state_t *s);
|
||||||
|
|
||||||
/*! \brief Get the next bit of the current document page. The document will
|
/*! \brief Get the next bit of the current document page. The document will
|
||||||
be padded for the current minimum scan line time.
|
be padded for the current minimum scan line time.
|
||||||
|
@ -262,14 +262,6 @@ SPAN_DECLARE(int) t4_tx_check_if_complete(t4_tx_state_t *s);
|
||||||
\return The next bit (i.e. 0 or 1). SIG_STATUS_END_OF_DATA for no more data. */
|
\return The next bit (i.e. 0 or 1). SIG_STATUS_END_OF_DATA for no more data. */
|
||||||
SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s);
|
SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s);
|
||||||
|
|
||||||
/*! \brief Get the next byte of the current document page. The document will
|
|
||||||
be padded for the current minimum scan line time.
|
|
||||||
\param s The T.4 context.
|
|
||||||
\return The next byte. For the last byte of data, bit 8 is
|
|
||||||
set. In this case, one or more bits of the byte may be padded with
|
|
||||||
zeros, to complete the byte. */
|
|
||||||
SPAN_DECLARE(int) t4_tx_get_byte(t4_tx_state_t *s);
|
|
||||||
|
|
||||||
/*! \brief Get the next chunk of the current document page. The document will
|
/*! \brief Get the next chunk of the current document page. The document will
|
||||||
be padded for the current minimum scan line time.
|
be padded for the current minimum scan line time.
|
||||||
\param s The T.4 context.
|
\param s The T.4 context.
|
||||||
|
@ -277,7 +269,7 @@ SPAN_DECLARE(int) t4_tx_get_byte(t4_tx_state_t *s);
|
||||||
\param max_len The maximum length of the chunk.
|
\param max_len The maximum length of the chunk.
|
||||||
\return The actual length of the chunk. If this is less than max_len it
|
\return The actual length of the chunk. If this is less than max_len it
|
||||||
indicates that the end of the document has been reached. */
|
indicates that the end of the document has been reached. */
|
||||||
SPAN_DECLARE(int) t4_tx_get_chunk(t4_tx_state_t *s, uint8_t buf[], int max_len);
|
SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len);
|
||||||
|
|
||||||
/*! \brief End the transmission of a document. Tidy up and close the file.
|
/*! \brief End the transmission of a document. Tidy up and close the file.
|
||||||
This should be used to end T.4 transmission started with t4_tx_init.
|
This should be used to end T.4 transmission started with t4_tx_init.
|
||||||
|
|
|
@ -67,14 +67,7 @@ extern "C"
|
||||||
/*! \brief Check if we are at the end of the current document page.
|
/*! \brief Check if we are at the end of the current document page.
|
||||||
\param s The T.85 context.
|
\param s The T.85 context.
|
||||||
\return 0 for more data to come. SIG_STATUS_END_OF_DATA for no more data. */
|
\return 0 for more data to come. SIG_STATUS_END_OF_DATA for no more data. */
|
||||||
SPAN_DECLARE(int) t85_encode_check_if_complete(t85_encode_state_t *s);
|
SPAN_DECLARE(int) t85_encode_image_complete(t85_encode_state_t *s);
|
||||||
|
|
||||||
/*! \brief Get the next byte of the current document page.
|
|
||||||
\param s The T.85 context.
|
|
||||||
\return The next byte. For the last byte of data, bit 8 is
|
|
||||||
set. In this case, one or more bits of the byte may be padded with
|
|
||||||
zeros, to complete the byte. */
|
|
||||||
SPAN_DECLARE(int) t85_encode_get_byte(t85_encode_state_t *s);
|
|
||||||
|
|
||||||
/*! \brief Get the next chunk of the current document page. The document will
|
/*! \brief Get the next chunk of the current document page. The document will
|
||||||
be padded for the current minimum scan line time.
|
be padded for the current minimum scan line time.
|
||||||
|
@ -83,7 +76,7 @@ SPAN_DECLARE(int) t85_encode_get_byte(t85_encode_state_t *s);
|
||||||
\param max_len The maximum length of the chunk.
|
\param max_len The maximum length of the chunk.
|
||||||
\return The actual length of the chunk. If this is less than max_len it
|
\return The actual length of the chunk. If this is less than max_len it
|
||||||
indicates that the end of the document has been reached. */
|
indicates that the end of the document has been reached. */
|
||||||
SPAN_DECLARE(int) t85_encode_get_chunk(t85_encode_state_t *s, uint8_t buf[], int max_len);
|
SPAN_DECLARE(int) t85_encode_get(t85_encode_state_t *s, uint8_t buf[], size_t max_len);
|
||||||
|
|
||||||
/*! \brief Set the row read handler for a T.85 encode context.
|
/*! \brief Set the row read handler for a T.85 encode context.
|
||||||
\param s The T.85 context.
|
\param s The T.85 context.
|
||||||
|
@ -251,20 +244,12 @@ SPAN_DECLARE(int) t85_decode_set_image_size_constraints(t85_decode_state_t *s,
|
||||||
\param status The type of status change which occured. */
|
\param status The type of status change which occured. */
|
||||||
SPAN_DECLARE(void) t85_decode_rx_status(t85_decode_state_t *s, int status);
|
SPAN_DECLARE(void) t85_decode_rx_status(t85_decode_state_t *s, int status);
|
||||||
|
|
||||||
/*! \brief Decode a byte of T.85 data.
|
|
||||||
\param s The T.85 context.
|
|
||||||
\param byte The data to be decoded.
|
|
||||||
\return 0 for OK. */
|
|
||||||
SPAN_DECLARE(int) t85_decode_put_byte(t85_decode_state_t *s, int byte);
|
|
||||||
|
|
||||||
/*! \brief Decode a chunk of T.85 data.
|
/*! \brief Decode a chunk of T.85 data.
|
||||||
\param s The T.85 context.
|
\param s The T.85 context.
|
||||||
\param data The data to be decoded.
|
\param data The data to be decoded.
|
||||||
\param len The length of the data to be decoded.
|
\param len The length of the data to be decoded.
|
||||||
\return 0 for OK. */
|
\return 0 for OK. */
|
||||||
SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s,
|
SPAN_DECLARE(int) t85_decode_put(t85_decode_state_t *s, const uint8_t data[], size_t len);
|
||||||
const uint8_t data[],
|
|
||||||
size_t len);
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -729,7 +729,7 @@ static int get_partial_ecm_page(t30_state_t *s)
|
||||||
/* These frames contain a frame sequence number within the partial page (one octet) followed
|
/* These frames contain a frame sequence number within the partial page (one octet) followed
|
||||||
by some image data. */
|
by some image data. */
|
||||||
s->ecm_data[i][3] = (uint8_t) i;
|
s->ecm_data[i][3] = (uint8_t) i;
|
||||||
if ((len = t4_tx_get_chunk(&s->t4.tx, &s->ecm_data[i][4], s->octets_per_ecm_frame)) < s->octets_per_ecm_frame)
|
if ((len = t4_tx_get(&s->t4.tx, &s->ecm_data[i][4], s->octets_per_ecm_frame)) < s->octets_per_ecm_frame)
|
||||||
{
|
{
|
||||||
/* The image is not big enough to fill the entire buffer */
|
/* The image is not big enough to fill the entire buffer */
|
||||||
/* We need to pad to a full frame, as most receivers expect that. */
|
/* We need to pad to a full frame, as most receivers expect that. */
|
||||||
|
@ -748,7 +748,7 @@ static int get_partial_ecm_page(t30_state_t *s)
|
||||||
/* We filled the entire buffer */
|
/* We filled the entire buffer */
|
||||||
s->ecm_frames = 256;
|
s->ecm_frames = 256;
|
||||||
span_log(&s->logging, SPAN_LOG_FLOW, "Partial page buffer full (%d per frame)\n", s->octets_per_ecm_frame);
|
span_log(&s->logging, SPAN_LOG_FLOW, "Partial page buffer full (%d per frame)\n", s->octets_per_ecm_frame);
|
||||||
s->ecm_at_page_end = (t4_tx_check_if_complete(&s->t4.tx) == SIG_STATUS_END_OF_DATA);
|
s->ecm_at_page_end = (t4_tx_image_complete(&s->t4.tx) == SIG_STATUS_END_OF_DATA);
|
||||||
return 256;
|
return 256;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
@ -2636,7 +2636,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
|
||||||
span_log(&s->logging, SPAN_LOG_FLOW, "Partial page OK - committing block %d, %d frames\n", s->ecm_block, s->ecm_frames);
|
span_log(&s->logging, SPAN_LOG_FLOW, "Partial page OK - committing block %d, %d frames\n", s->ecm_block, s->ecm_frames);
|
||||||
for (i = 0; i < s->ecm_frames; i++)
|
for (i = 0; i < s->ecm_frames; i++)
|
||||||
{
|
{
|
||||||
if (t4_rx_put_chunk(&s->t4.rx, s->ecm_data[i], s->ecm_len[i]))
|
if (t4_rx_put(&s->t4.rx, s->ecm_data[i], s->ecm_len[i]))
|
||||||
{
|
{
|
||||||
/* This is the end of the document */
|
/* This is the end of the document */
|
||||||
break;
|
break;
|
||||||
|
@ -5473,7 +5473,7 @@ SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit)
|
||||||
break;
|
break;
|
||||||
case T30_STATE_F_DOC_NON_ECM:
|
case T30_STATE_F_DOC_NON_ECM:
|
||||||
/* Document transfer */
|
/* Document transfer */
|
||||||
if (t4_rx_put_bit(&s->t4.rx, bit))
|
if (t4_rx_put_bit(&s->t4.rx, bit) == T4_DECODE_OK)
|
||||||
{
|
{
|
||||||
/* That is the end of the document */
|
/* That is the end of the document */
|
||||||
set_state(s, T30_STATE_F_POST_DOC_NON_ECM);
|
set_state(s, T30_STATE_F_POST_DOC_NON_ECM);
|
||||||
|
@ -5485,48 +5485,7 @@ SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit)
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(void) t30_non_ecm_put_byte(void *user_data, int byte)
|
SPAN_DECLARE(void) t30_non_ecm_put(void *user_data, const uint8_t buf[], int len)
|
||||||
{
|
|
||||||
t30_state_t *s;
|
|
||||||
|
|
||||||
if (byte < 0)
|
|
||||||
{
|
|
||||||
t30_non_ecm_rx_status(user_data, byte);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
s = (t30_state_t *) user_data;
|
|
||||||
switch (s->state)
|
|
||||||
{
|
|
||||||
case T30_STATE_F_TCF:
|
|
||||||
/* Trainability test */
|
|
||||||
/* This makes counting zeros fast, but approximate. That really doesn't matter */
|
|
||||||
s->tcf_test_bits += 8;
|
|
||||||
if (byte)
|
|
||||||
{
|
|
||||||
if (s->tcf_current_zeros > s->tcf_most_zeros)
|
|
||||||
s->tcf_most_zeros = s->tcf_current_zeros;
|
|
||||||
s->tcf_current_zeros = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s->tcf_current_zeros += 8;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case T30_STATE_F_DOC_NON_ECM:
|
|
||||||
/* Document transfer */
|
|
||||||
if (t4_rx_put_byte(&s->t4.rx, (uint8_t) byte))
|
|
||||||
{
|
|
||||||
/* That is the end of the document */
|
|
||||||
set_state(s, T30_STATE_F_POST_DOC_NON_ECM);
|
|
||||||
queue_phase(s, T30_PHASE_D_RX);
|
|
||||||
timer_t2_start(s);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(void) t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len)
|
|
||||||
{
|
{
|
||||||
t30_state_t *s;
|
t30_state_t *s;
|
||||||
int i;
|
int i;
|
||||||
|
@ -5554,7 +5513,7 @@ SPAN_DECLARE(void) t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], i
|
||||||
break;
|
break;
|
||||||
case T30_STATE_F_DOC_NON_ECM:
|
case T30_STATE_F_DOC_NON_ECM:
|
||||||
/* Document transfer */
|
/* Document transfer */
|
||||||
if (t4_rx_put_chunk(&s->t4.rx, buf, len))
|
if (t4_rx_put(&s->t4.rx, buf, len))
|
||||||
{
|
{
|
||||||
/* That is the end of the document */
|
/* That is the end of the document */
|
||||||
set_state(s, T30_STATE_F_POST_DOC_NON_ECM);
|
set_state(s, T30_STATE_F_POST_DOC_NON_ECM);
|
||||||
|
@ -5601,42 +5560,7 @@ SPAN_DECLARE_NONSTD(int) t30_non_ecm_get_bit(void *user_data)
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t30_non_ecm_get_byte(void *user_data)
|
SPAN_DECLARE(int) t30_non_ecm_get(void *user_data, uint8_t buf[], int max_len)
|
||||||
{
|
|
||||||
int byte;
|
|
||||||
t30_state_t *s;
|
|
||||||
|
|
||||||
s = (t30_state_t *) user_data;
|
|
||||||
switch (s->state)
|
|
||||||
{
|
|
||||||
case T30_STATE_D_TCF:
|
|
||||||
/* Trainability test. */
|
|
||||||
byte = 0;
|
|
||||||
if ((s->tcf_test_bits -= 8) < 0)
|
|
||||||
{
|
|
||||||
/* Finished sending training test. */
|
|
||||||
byte = 0x100;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case T30_STATE_I:
|
|
||||||
/* Transferring real data. */
|
|
||||||
byte = t4_tx_get_byte(&s->t4.tx);
|
|
||||||
break;
|
|
||||||
case T30_STATE_D_POST_TCF:
|
|
||||||
case T30_STATE_II_Q:
|
|
||||||
/* We should be padding out a block of samples if we are here */
|
|
||||||
byte = 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
span_log(&s->logging, SPAN_LOG_WARNING, "t30_non_ecm_get_byte in bad state %d\n", s->state);
|
|
||||||
byte = 0x100;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return byte;
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_len)
|
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
t30_state_t *s;
|
t30_state_t *s;
|
||||||
|
@ -5655,7 +5579,7 @@ SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_
|
||||||
break;
|
break;
|
||||||
case T30_STATE_I:
|
case T30_STATE_I:
|
||||||
/* Transferring real data. */
|
/* Transferring real data. */
|
||||||
len = t4_tx_get_chunk(&s->t4.tx, buf, max_len);
|
len = t4_tx_get(&s->t4.tx, buf, max_len);
|
||||||
break;
|
break;
|
||||||
case T30_STATE_D_POST_TCF:
|
case T30_STATE_D_POST_TCF:
|
||||||
case T30_STATE_II_Q:
|
case T30_STATE_II_Q:
|
||||||
|
@ -5663,7 +5587,7 @@ SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_
|
||||||
len = 0;
|
len = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
span_log(&s->logging, SPAN_LOG_WARNING, "t30_non_ecm_get_chunk in bad state %d\n", s->state);
|
span_log(&s->logging, SPAN_LOG_WARNING, "t30_non_ecm_get in bad state %d\n", s->state);
|
||||||
len = -1;
|
len = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,8 +198,8 @@ static int v29_v21_rx_fillin(void *user_data, int len);
|
||||||
static int silence_rx(void *user_data, const int16_t amp[], int len);
|
static int silence_rx(void *user_data, const int16_t amp[], int len);
|
||||||
static int cng_rx(void *user_data, const int16_t amp[], int len);
|
static int cng_rx(void *user_data, const int16_t amp[], int len);
|
||||||
static void non_ecm_put_bit(void *user_data, int bit);
|
static void non_ecm_put_bit(void *user_data, int bit);
|
||||||
static void non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len);
|
static void non_ecm_put(void *user_data, const uint8_t buf[], int len);
|
||||||
static int non_ecm_get_chunk(void *user_data, uint8_t buf[], int len);
|
static int non_ecm_get(void *user_data, uint8_t buf[], int len);
|
||||||
static void non_ecm_rx_status(void *user_data, int status);
|
static void non_ecm_rx_status(void *user_data, int status);
|
||||||
static void hdlc_rx_status(void *user_data, int status);
|
static void hdlc_rx_status(void *user_data, int status);
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
bit_reverse(buf2, buf, len);
|
bit_reverse(buf2, buf, len);
|
||||||
non_ecm_put_chunk(s, buf, len);
|
non_ecm_put(s, buf, len);
|
||||||
}
|
}
|
||||||
fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
|
fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
|
||||||
break;
|
break;
|
||||||
|
@ -618,7 +618,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
|
||||||
s->at_state.rx_signal_present = TRUE;
|
s->at_state.rx_signal_present = TRUE;
|
||||||
}
|
}
|
||||||
bit_reverse(buf2, buf, len);
|
bit_reverse(buf2, buf, len);
|
||||||
non_ecm_put_chunk(s, buf, len);
|
non_ecm_put(s, buf, len);
|
||||||
}
|
}
|
||||||
/* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send HDLC signal end where
|
/* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send HDLC signal end where
|
||||||
they should send non-ECM signal end. It is possible they also do the opposite.
|
they should send non-ECM signal end. It is possible they also do the opposite.
|
||||||
|
@ -747,7 +747,7 @@ static int stream_non_ecm(t31_state_t *s)
|
||||||
However, I think the early versions of T.38 said the signal end message should not
|
However, I think the early versions of T.38 said the signal end message should not
|
||||||
contain data. Hopefully, following the current spec will not cause compatibility
|
contain data. Hopefully, following the current spec will not cause compatibility
|
||||||
issues. */
|
issues. */
|
||||||
len = non_ecm_get_chunk(s, buf, fe->octets_per_data_packet);
|
len = non_ecm_get(s, buf, fe->octets_per_data_packet);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
bit_reverse(buf, buf, len);
|
bit_reverse(buf, buf, len);
|
||||||
if (len < fe->octets_per_data_packet)
|
if (len < fe->octets_per_data_packet)
|
||||||
|
@ -1257,7 +1257,7 @@ static void non_ecm_put_bit(void *user_data, int bit)
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
static void non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len)
|
static void non_ecm_put(void *user_data, const uint8_t buf[], int len)
|
||||||
{
|
{
|
||||||
t31_state_t *s;
|
t31_state_t *s;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1335,7 +1335,7 @@ static int non_ecm_get_bit(void *user_data)
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
static int non_ecm_get_chunk(void *user_data, uint8_t buf[], int len)
|
static int non_ecm_get(void *user_data, uint8_t buf[], int len)
|
||||||
{
|
{
|
||||||
t31_state_t *s;
|
t31_state_t *s;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -553,7 +553,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
bit_reverse(buf2, buf, len);
|
bit_reverse(buf2, buf, len);
|
||||||
t30_non_ecm_put_chunk(&s->t30, buf2, len);
|
t30_non_ecm_put(&s->t30, buf2, len);
|
||||||
}
|
}
|
||||||
/*endif*/
|
/*endif*/
|
||||||
fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
|
fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
|
||||||
|
@ -573,7 +573,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
|
||||||
}
|
}
|
||||||
/*endif*/
|
/*endif*/
|
||||||
bit_reverse(buf2, buf, len);
|
bit_reverse(buf2, buf, len);
|
||||||
t30_non_ecm_put_chunk(&s->t30, buf2, len);
|
t30_non_ecm_put(&s->t30, buf2, len);
|
||||||
}
|
}
|
||||||
/*endif*/
|
/*endif*/
|
||||||
/* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send HDLC signal end where
|
/* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send HDLC signal end where
|
||||||
|
@ -741,7 +741,7 @@ static int stream_non_ecm(t38_terminal_state_t *s)
|
||||||
However, I think the early versions of T.38 said the signal end message should not
|
However, I think the early versions of T.38 said the signal end message should not
|
||||||
contain data. Hopefully, following the current spec will not cause compatibility
|
contain data. Hopefully, following the current spec will not cause compatibility
|
||||||
issues. */
|
issues. */
|
||||||
len = t30_non_ecm_get_chunk(&s->t30, buf, fe->octets_per_data_packet);
|
len = t30_non_ecm_get(&s->t30, buf, fe->octets_per_data_packet);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
return -1;
|
return -1;
|
||||||
/*endif*/
|
/*endif*/
|
||||||
|
|
|
@ -1195,19 +1195,13 @@ SPAN_DECLARE(void) t42_encode_comment(t42_encode_state_t *s, const uint8_t comme
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t42_encode_check_if_complete(t42_encode_state_t *s)
|
SPAN_DECLARE(int) t42_encode_image_complete(t42_encode_state_t *s)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t42_encode_get_byte(t42_encode_state_t *s)
|
SPAN_DECLARE(int) t42_encode_get(t42_encode_state_t *s, uint8_t buf[], size_t max_len)
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t42_encode_get_chunk(t42_encode_state_t *s, uint8_t buf[], int max_len)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1292,15 +1286,7 @@ SPAN_DECLARE(void) t42_decode_rx_status(t42_decode_state_t *s, int status)
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t42_decode_put_byte(t42_decode_state_t *s, int byte)
|
SPAN_DECLARE(int) t42_decode_put(t42_decode_state_t *s, const uint8_t data[], size_t len)
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t42_decode_put_chunk(t42_decode_state_t *s,
|
|
||||||
const uint8_t data[],
|
|
||||||
size_t len)
|
|
||||||
{
|
{
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
|
|
||||||
|
|
|
@ -344,35 +344,13 @@ static void tiff_rx_release(t4_rx_state_t *s)
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_rx_put_bit(t4_rx_state_t *s, int bit)
|
SPAN_DECLARE(int) t4_rx_put_bit(t4_rx_state_t *s, int bit)
|
||||||
{
|
{
|
||||||
|
/* We only put bit by bit for T.4-1D and T.4-2D */
|
||||||
s->line_image_size += 1;
|
s->line_image_size += 1;
|
||||||
return t4_t6_decode_put_bit(&s->decoder.t4_t6, bit);
|
return t4_t6_decode_put_bit(&s->decoder.t4_t6, bit);
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_rx_put_byte(t4_rx_state_t *s, uint8_t byte)
|
SPAN_DECLARE(int) t4_rx_put(t4_rx_state_t *s, const uint8_t buf[], size_t len)
|
||||||
{
|
|
||||||
s->line_image_size += 8;
|
|
||||||
switch (s->line_encoding)
|
|
||||||
{
|
|
||||||
case T4_COMPRESSION_ITU_T4_1D:
|
|
||||||
case T4_COMPRESSION_ITU_T4_2D:
|
|
||||||
case T4_COMPRESSION_ITU_T6:
|
|
||||||
return t4_t6_decode_put_byte(&s->decoder.t4_t6, byte);
|
|
||||||
case T4_COMPRESSION_ITU_T42:
|
|
||||||
return t42_decode_put_byte(&s->decoder.t42, byte);
|
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_ITU_T43:
|
|
||||||
return t43_decode_put_byte(&s->decoder.t43, byte);
|
|
||||||
#endif
|
|
||||||
case T4_COMPRESSION_ITU_T85:
|
|
||||||
case T4_COMPRESSION_ITU_T85_L0:
|
|
||||||
return t85_decode_put_byte(&s->decoder.t85, byte);
|
|
||||||
}
|
|
||||||
return T4_DECODE_OK;
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_rx_put_chunk(t4_rx_state_t *s, const uint8_t buf[], int len)
|
|
||||||
{
|
{
|
||||||
s->line_image_size += 8*len;
|
s->line_image_size += 8*len;
|
||||||
switch (s->line_encoding)
|
switch (s->line_encoding)
|
||||||
|
@ -380,16 +358,16 @@ SPAN_DECLARE(int) t4_rx_put_chunk(t4_rx_state_t *s, const uint8_t buf[], int len
|
||||||
case T4_COMPRESSION_ITU_T4_1D:
|
case T4_COMPRESSION_ITU_T4_1D:
|
||||||
case T4_COMPRESSION_ITU_T4_2D:
|
case T4_COMPRESSION_ITU_T4_2D:
|
||||||
case T4_COMPRESSION_ITU_T6:
|
case T4_COMPRESSION_ITU_T6:
|
||||||
return t4_t6_decode_put_chunk(&s->decoder.t4_t6, buf, len);
|
return t4_t6_decode_put(&s->decoder.t4_t6, buf, len);
|
||||||
case T4_COMPRESSION_ITU_T42:
|
case T4_COMPRESSION_ITU_T42:
|
||||||
return t42_decode_put_chunk(&s->decoder.t42, buf, len);
|
return t42_decode_put(&s->decoder.t42, buf, len);
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
#if defined(SPANDSP_SUPPORT_T43)
|
||||||
case T4_COMPRESSION_ITU_T43:
|
case T4_COMPRESSION_ITU_T43:
|
||||||
return t43_decode_put_chunk(&s->decoder.t43, buf, len);
|
return t43_decode_put(&s->decoder.t43, buf, len);
|
||||||
#endif
|
#endif
|
||||||
case T4_COMPRESSION_ITU_T85:
|
case T4_COMPRESSION_ITU_T85:
|
||||||
case T4_COMPRESSION_ITU_T85_L0:
|
case T4_COMPRESSION_ITU_T85_L0:
|
||||||
return t85_decode_put_chunk(&s->decoder.t85, buf, len);
|
return t85_decode_put(&s->decoder.t85, buf, len);
|
||||||
}
|
}
|
||||||
return T4_DECODE_OK;
|
return T4_DECODE_OK;
|
||||||
}
|
}
|
||||||
|
@ -646,22 +624,22 @@ SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s)
|
||||||
case T4_COMPRESSION_ITU_T4_1D:
|
case T4_COMPRESSION_ITU_T4_1D:
|
||||||
case T4_COMPRESSION_ITU_T4_2D:
|
case T4_COMPRESSION_ITU_T4_2D:
|
||||||
case T4_COMPRESSION_ITU_T6:
|
case T4_COMPRESSION_ITU_T6:
|
||||||
t4_t6_decode_put_byte(&s->decoder.t4_t6, SIG_STATUS_END_OF_DATA);
|
t4_t6_decode_put(&s->decoder.t4_t6, NULL, 0);
|
||||||
length = t4_t6_decode_get_image_length(&s->decoder.t4_t6);
|
length = t4_t6_decode_get_image_length(&s->decoder.t4_t6);
|
||||||
break;
|
break;
|
||||||
case T4_COMPRESSION_ITU_T42:
|
case T4_COMPRESSION_ITU_T42:
|
||||||
t42_decode_put_byte(&s->decoder.t42, SIG_STATUS_END_OF_DATA);
|
t42_decode_put(&s->decoder.t42, NULL, 0);
|
||||||
length = t42_decode_get_image_length(&s->decoder.t42);
|
length = t42_decode_get_image_length(&s->decoder.t42);
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
#if defined(SPANDSP_SUPPORT_T43)
|
||||||
case T4_COMPRESSION_ITU_T43:
|
case T4_COMPRESSION_ITU_T43:
|
||||||
t43_decode_put_byte(&s->decoder.t43, SIG_STATUS_END_OF_DATA);
|
t43_decode_put(&s->decoder.t43, NULL, 0);
|
||||||
length = t43_decode_get_image_length(&s->decoder.t43);
|
length = t43_decode_get_image_length(&s->decoder.t43);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case T4_COMPRESSION_ITU_T85:
|
case T4_COMPRESSION_ITU_T85:
|
||||||
case T4_COMPRESSION_ITU_T85_L0:
|
case T4_COMPRESSION_ITU_T85_L0:
|
||||||
t85_decode_put_byte(&s->decoder.t85, SIG_STATUS_END_OF_DATA);
|
t85_decode_put(&s->decoder.t85, NULL, 0);
|
||||||
length = t85_decode_get_image_length(&s->decoder.t85);
|
length = t85_decode_get_image_length(&s->decoder.t85);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -700,6 +700,36 @@ static void t4_t6_decode_rx_status(t4_t6_decode_state_t *s, int status)
|
||||||
break;
|
break;
|
||||||
case SIG_STATUS_CARRIER_DOWN:
|
case SIG_STATUS_CARRIER_DOWN:
|
||||||
case SIG_STATUS_END_OF_DATA:
|
case SIG_STATUS_END_OF_DATA:
|
||||||
|
t4_t6_decode_put(s, NULL, 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected rx status - %d!\n", status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
SPAN_DECLARE(int) t4_t6_decode_put_bit(t4_t6_decode_state_t *s, int bit)
|
||||||
|
{
|
||||||
|
if (bit < 0)
|
||||||
|
{
|
||||||
|
t4_t6_decode_rx_status(s, bit);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
s->compressed_image_size++;
|
||||||
|
if (put_bits(s, bit & 1, 1))
|
||||||
|
return T4_DECODE_OK;
|
||||||
|
return T4_DECODE_MORE_DATA;
|
||||||
|
}
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
SPAN_DECLARE(int) t4_t6_decode_put(t4_t6_decode_state_t *s, const uint8_t buf[], size_t len)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
uint8_t byte;
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
{
|
||||||
/* Finalise the image */
|
/* Finalise the image */
|
||||||
if (s->consecutive_eols != EOLS_TO_END_ANY_RX_PAGE)
|
if (s->consecutive_eols != EOLS_TO_END_ANY_RX_PAGE)
|
||||||
{
|
{
|
||||||
|
@ -720,42 +750,8 @@ static void t4_t6_decode_rx_status(t4_t6_decode_state_t *s, int status)
|
||||||
s->rx_skip_bits = 0;
|
s->rx_skip_bits = 0;
|
||||||
s->rx_bitstream = 0;
|
s->rx_bitstream = 0;
|
||||||
s->consecutive_eols = EOLS_TO_END_ANY_RX_PAGE;
|
s->consecutive_eols = EOLS_TO_END_ANY_RX_PAGE;
|
||||||
break;
|
return T4_DECODE_OK;
|
||||||
default:
|
|
||||||
span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected rx status - %d!\n", status);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_t6_decode_put_bit(t4_t6_decode_state_t *s, int bit)
|
|
||||||
{
|
|
||||||
if (bit < 0)
|
|
||||||
{
|
|
||||||
t4_t6_decode_rx_status(s, bit);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
s->compressed_image_size++;
|
|
||||||
return put_bits(s, bit & 1, 1);
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_t6_decode_put_byte(t4_t6_decode_state_t *s, int byte)
|
|
||||||
{
|
|
||||||
if (byte < 0)
|
|
||||||
{
|
|
||||||
t4_t6_decode_rx_status(s, byte);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
s->compressed_image_size += 8;
|
|
||||||
return put_bits(s, byte & 0xFF, 8);
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_t6_decode_put_chunk(t4_t6_decode_state_t *s, const uint8_t buf[], int len)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
uint8_t byte;
|
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -918,14 +918,14 @@ static int get_next_row(t4_t6_encode_state_t *s)
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_t6_encode_check_bit(t4_t6_encode_state_t *s)
|
SPAN_DECLARE(int) t4_t6_encode_image_complete(t4_t6_encode_state_t *s)
|
||||||
{
|
{
|
||||||
if (s->bitstream_optr >= s->bitstream_iptr)
|
if (s->bitstream_optr >= s->bitstream_iptr)
|
||||||
{
|
{
|
||||||
if (get_next_row(s) < 0)
|
if (get_next_row(s) < 0)
|
||||||
return SIG_STATUS_END_OF_DATA;
|
return SIG_STATUS_END_OF_DATA;
|
||||||
}
|
}
|
||||||
return (s->bitstream[s->bitstream_optr] >> (7 - s->bit_pos)) & 1;
|
return 0;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -933,8 +933,12 @@ SPAN_DECLARE(int) t4_t6_encode_get_bit(t4_t6_encode_state_t *s)
|
||||||
{
|
{
|
||||||
int bit;
|
int bit;
|
||||||
|
|
||||||
if ((bit = t4_t6_encode_check_bit(s)) < 0)
|
if (s->bitstream_optr >= s->bitstream_iptr)
|
||||||
return bit;
|
{
|
||||||
|
if (get_next_row(s) < 0)
|
||||||
|
return SIG_STATUS_END_OF_DATA;
|
||||||
|
}
|
||||||
|
bit = (s->bitstream[s->bitstream_optr] >> (7 - s->bit_pos)) & 1;
|
||||||
if (--s->bit_pos < 0)
|
if (--s->bit_pos < 0)
|
||||||
{
|
{
|
||||||
s->bitstream_optr++;
|
s->bitstream_optr++;
|
||||||
|
@ -944,18 +948,7 @@ SPAN_DECLARE(int) t4_t6_encode_get_bit(t4_t6_encode_state_t *s)
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_t6_encode_get_byte(t4_t6_encode_state_t *s)
|
SPAN_DECLARE(int) t4_t6_encode_get(t4_t6_encode_state_t *s, uint8_t buf[], int max_len)
|
||||||
{
|
|
||||||
if (s->bitstream_optr >= s->bitstream_iptr)
|
|
||||||
{
|
|
||||||
if (get_next_row(s) < 0)
|
|
||||||
return 0x100;
|
|
||||||
}
|
|
||||||
return s->bitstream[s->bitstream_optr++];
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_t6_encode_get_chunk(t4_t6_encode_state_t *s, uint8_t buf[], int max_len)
|
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int n;
|
int n;
|
||||||
|
|
|
@ -900,23 +900,23 @@ SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_tx_state_t *s, t4_stats_t *t
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_tx_check_if_complete(t4_tx_state_t *s)
|
SPAN_DECLARE(int) t4_tx_image_complete(t4_tx_state_t *s)
|
||||||
{
|
{
|
||||||
switch (s->line_encoding)
|
switch (s->line_encoding)
|
||||||
{
|
{
|
||||||
case T4_COMPRESSION_ITU_T4_1D:
|
case T4_COMPRESSION_ITU_T4_1D:
|
||||||
case T4_COMPRESSION_ITU_T4_2D:
|
case T4_COMPRESSION_ITU_T4_2D:
|
||||||
case T4_COMPRESSION_ITU_T6:
|
case T4_COMPRESSION_ITU_T6:
|
||||||
return t4_t6_encode_check_bit(&s->encoder.t4_t6);
|
return t4_t6_encode_image_complete(&s->encoder.t4_t6);
|
||||||
case T4_COMPRESSION_ITU_T42:
|
case T4_COMPRESSION_ITU_T42:
|
||||||
return t42_encode_check_if_complete(&s->encoder.t42);
|
return t42_encode_image_complete(&s->encoder.t42);
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
#if defined(SPANDSP_SUPPORT_T43)
|
||||||
case T4_COMPRESSION_ITU_T43:
|
case T4_COMPRESSION_ITU_T43:
|
||||||
return t43_encode_check_if_complete(&s->encoder.t43);
|
return t43_encode_image_complete(&s->encoder.t43);
|
||||||
#endif
|
#endif
|
||||||
case T4_COMPRESSION_ITU_T85:
|
case T4_COMPRESSION_ITU_T85:
|
||||||
case T4_COMPRESSION_ITU_T85_L0:
|
case T4_COMPRESSION_ITU_T85_L0:
|
||||||
return t85_encode_check_if_complete(&s->encoder.t85);
|
return t85_encode_image_complete(&s->encoder.t85);
|
||||||
}
|
}
|
||||||
return SIG_STATUS_END_OF_DATA;
|
return SIG_STATUS_END_OF_DATA;
|
||||||
}
|
}
|
||||||
|
@ -924,49 +924,28 @@ SPAN_DECLARE(int) t4_tx_check_if_complete(t4_tx_state_t *s)
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s)
|
SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s)
|
||||||
{
|
{
|
||||||
|
/* We only get bit by bit for T.4 1D and T.4 2-D. */
|
||||||
return t4_t6_encode_get_bit(&s->encoder.t4_t6);
|
return t4_t6_encode_get_bit(&s->encoder.t4_t6);
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_tx_get_byte(t4_tx_state_t *s)
|
SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len)
|
||||||
{
|
{
|
||||||
switch (s->line_encoding)
|
switch (s->line_encoding)
|
||||||
{
|
{
|
||||||
case T4_COMPRESSION_ITU_T4_1D:
|
case T4_COMPRESSION_ITU_T4_1D:
|
||||||
case T4_COMPRESSION_ITU_T4_2D:
|
case T4_COMPRESSION_ITU_T4_2D:
|
||||||
case T4_COMPRESSION_ITU_T6:
|
case T4_COMPRESSION_ITU_T6:
|
||||||
return t4_t6_encode_get_byte(&s->encoder.t4_t6);
|
return t4_t6_encode_get(&s->encoder.t4_t6, buf, max_len);
|
||||||
case T4_COMPRESSION_ITU_T42:
|
case T4_COMPRESSION_ITU_T42:
|
||||||
return t42_encode_get_byte(&s->encoder.t42);
|
return t42_encode_get(&s->encoder.t42, buf, max_len);
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
#if defined(SPANDSP_SUPPORT_T43)
|
||||||
case T4_COMPRESSION_ITU_T43:
|
case T4_COMPRESSION_ITU_T43:
|
||||||
return t43_encode_get_byte(&s->encoder.t43);
|
return t43_encode_get(&s->encoder.t43, buf, max_len);
|
||||||
#endif
|
#endif
|
||||||
case T4_COMPRESSION_ITU_T85:
|
case T4_COMPRESSION_ITU_T85:
|
||||||
case T4_COMPRESSION_ITU_T85_L0:
|
case T4_COMPRESSION_ITU_T85_L0:
|
||||||
return t85_encode_get_byte(&s->encoder.t85);
|
return t85_encode_get(&s->encoder.t85, buf, max_len);
|
||||||
}
|
|
||||||
return SIG_STATUS_END_OF_DATA;
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t4_tx_get_chunk(t4_tx_state_t *s, uint8_t buf[], int max_len)
|
|
||||||
{
|
|
||||||
switch (s->line_encoding)
|
|
||||||
{
|
|
||||||
case T4_COMPRESSION_ITU_T4_1D:
|
|
||||||
case T4_COMPRESSION_ITU_T4_2D:
|
|
||||||
case T4_COMPRESSION_ITU_T6:
|
|
||||||
return t4_t6_encode_get_chunk(&s->encoder.t4_t6, buf, max_len);
|
|
||||||
case T4_COMPRESSION_ITU_T42:
|
|
||||||
return t42_encode_get_chunk(&s->encoder.t42, buf, max_len);
|
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_ITU_T43:
|
|
||||||
return t43_encode_get_chunk(&s->encoder.t43, buf, max_len);
|
|
||||||
#endif
|
|
||||||
case T4_COMPRESSION_ITU_T85:
|
|
||||||
case T4_COMPRESSION_ITU_T85_L0:
|
|
||||||
return t85_encode_get_chunk(&s->encoder.t85, buf, max_len);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,8 +351,7 @@ SPAN_DECLARE(void) t85_decode_rx_status(t85_decode_state_t *s, int status)
|
||||||
case SIG_STATUS_CARRIER_DOWN:
|
case SIG_STATUS_CARRIER_DOWN:
|
||||||
case SIG_STATUS_END_OF_DATA:
|
case SIG_STATUS_END_OF_DATA:
|
||||||
/* Finalise the image */
|
/* Finalise the image */
|
||||||
s->end_of_data = 1;
|
t85_decode_put(s, NULL, 0);
|
||||||
t85_decode_put_chunk(s, NULL, 0);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected rx status - %d!\n", status);
|
span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected rx status - %d!\n", status);
|
||||||
|
@ -361,23 +360,7 @@ SPAN_DECLARE(void) t85_decode_rx_status(t85_decode_state_t *s, int status)
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t85_decode_put_byte(t85_decode_state_t *s, int byte)
|
SPAN_DECLARE(int) t85_decode_put(t85_decode_state_t *s, const uint8_t data[], size_t len)
|
||||||
{
|
|
||||||
uint8_t data[1];
|
|
||||||
|
|
||||||
if (byte < 0)
|
|
||||||
{
|
|
||||||
t85_decode_rx_status(s, byte);
|
|
||||||
return (s->y >= s->yd) ? T4_DECODE_OK : T4_DECODE_MORE_DATA;
|
|
||||||
}
|
|
||||||
data[0] = byte;
|
|
||||||
return t85_decode_put_chunk(s, data, 1);
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s,
|
|
||||||
const uint8_t data[],
|
|
||||||
size_t len)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
uint32_t y;
|
uint32_t y;
|
||||||
|
@ -388,6 +371,14 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s,
|
||||||
size_t cnt;
|
size_t cnt;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
{
|
||||||
|
if (s->y >= s->yd)
|
||||||
|
return T4_DECODE_OK;
|
||||||
|
/* This is the end of image condition */
|
||||||
|
s->end_of_data = 1;
|
||||||
|
}
|
||||||
|
|
||||||
s->compressed_image_size += len;
|
s->compressed_image_size += len;
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
|
|
||||||
|
|
|
@ -581,7 +581,7 @@ SPAN_DECLARE(void) t85_encode_comment(t85_encode_state_t *s, const uint8_t comme
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t85_encode_check_if_complete(t85_encode_state_t *s)
|
SPAN_DECLARE(int) t85_encode_image_complete(t85_encode_state_t *s)
|
||||||
{
|
{
|
||||||
if (s->y >= s->yd)
|
if (s->y >= s->yd)
|
||||||
return SIG_STATUS_END_OF_DATA;
|
return SIG_STATUS_END_OF_DATA;
|
||||||
|
@ -589,22 +589,7 @@ SPAN_DECLARE(int) t85_encode_check_if_complete(t85_encode_state_t *s)
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) t85_encode_get_byte(t85_encode_state_t *s)
|
SPAN_DECLARE(int) t85_encode_get(t85_encode_state_t *s, uint8_t buf[], size_t max_len)
|
||||||
{
|
|
||||||
if (s->bitstream_optr >= s->bitstream_iptr)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (get_next_row(s) < 0)
|
|
||||||
return 0x100;
|
|
||||||
}
|
|
||||||
while (s->bitstream_iptr == 0);
|
|
||||||
}
|
|
||||||
return s->bitstream[s->bitstream_optr++];
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
SPAN_DECLARE(int) t85_encode_get_chunk(t85_encode_state_t *s, uint8_t buf[], int max_len)
|
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int n;
|
int n;
|
||||||
|
|
|
@ -316,7 +316,7 @@ static void t4_end(void)
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
if (ecm_len[i] > 0)
|
if (ecm_len[i] > 0)
|
||||||
t4_rx_put_chunk(&t4_rx_state, ecm_data[i], ecm_len[i]);
|
t4_rx_put(&t4_rx_state, ecm_data[i], ecm_len[i]);
|
||||||
fprintf(stderr, "%d", (ecm_len[i] <= 0) ? 0 : 1);
|
fprintf(stderr, "%d", (ecm_len[i] <= 0) ? 0 : 1);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
|
@ -260,14 +260,14 @@ then
|
||||||
fi
|
fi
|
||||||
echo ima_adpcm_tests completed OK
|
echo ima_adpcm_tests completed OK
|
||||||
|
|
||||||
./image_translate_tests >$STDOUT_DEST 2>$STDERR_DEST
|
#./image_translate_tests >$STDOUT_DEST 2>$STDERR_DEST
|
||||||
RETVAL=$?
|
#RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
#if [ $RETVAL != 0 ]
|
||||||
then
|
#then
|
||||||
echo image_translate_tests failed!
|
# echo image_translate_tests failed!
|
||||||
exit $RETVAL
|
# exit $RETVAL
|
||||||
fi
|
#fi
|
||||||
echo image_translate_tests completed OK
|
#echo image_translate_tests completed OK
|
||||||
|
|
||||||
./logging_tests >$STDOUT_DEST 2>$STDERR_DEST
|
./logging_tests >$STDOUT_DEST 2>$STDERR_DEST
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
|
@ -499,7 +499,23 @@ fi
|
||||||
echo t38_non_ecm_buffer_tests completed OK
|
echo t38_non_ecm_buffer_tests completed OK
|
||||||
|
|
||||||
rm -f t4_tests_receive.tif
|
rm -f t4_tests_receive.tif
|
||||||
./t4_tests >$STDOUT_DEST 2>$STDERR_DEST
|
./t4_tests -b 0 >$STDOUT_DEST 2>$STDERR_DEST
|
||||||
|
RETVAL=$?
|
||||||
|
if [ $RETVAL != 0 ]
|
||||||
|
then
|
||||||
|
echo t4_tests failed!
|
||||||
|
exit $RETVAL
|
||||||
|
fi
|
||||||
|
rm -f t4_tests_receive.tif
|
||||||
|
./t4_tests -b 1 >$STDOUT_DEST 2>$STDERR_DEST
|
||||||
|
RETVAL=$?
|
||||||
|
if [ $RETVAL != 0 ]
|
||||||
|
then
|
||||||
|
echo t4_tests failed!
|
||||||
|
exit $RETVAL
|
||||||
|
fi
|
||||||
|
rm -f t4_tests_receive.tif
|
||||||
|
./t4_tests -b 10 >$STDOUT_DEST 2>$STDERR_DEST
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -287,9 +287,9 @@ int main(int argc, char *argv[])
|
||||||
printf("0x%02x\n", data[i]);
|
printf("0x%02x\n", data[i]);
|
||||||
t85_decode_init(&t85_dec, t85_row_write_handler, NULL);
|
t85_decode_init(&t85_dec, t85_row_write_handler, NULL);
|
||||||
t85_decode_set_comment_handler(&t85_dec, 1000, t85_comment_handler, NULL);
|
t85_decode_set_comment_handler(&t85_dec, 1000, t85_comment_handler, NULL);
|
||||||
result = t85_decode_put_chunk(&t85_dec, data, total_len);
|
result = t85_decode_put(&t85_dec, data, total_len);
|
||||||
if (result == T4_DECODE_MORE_DATA)
|
if (result == T4_DECODE_MORE_DATA)
|
||||||
result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA);
|
result = t85_decode_put(&t85_dec, NULL, 0);
|
||||||
len = t85_decode_get_compressed_image_size(&t85_dec);
|
len = t85_decode_get_compressed_image_size(&t85_dec);
|
||||||
printf("Compressed image is %d bytes, %d rows\n", len/8, write_row);
|
printf("Compressed image is %d bytes, %d rows\n", len/8, write_row);
|
||||||
t85_decode_release(&t85_dec);
|
t85_decode_release(&t85_dec);
|
||||||
|
@ -331,7 +331,7 @@ int main(int argc, char *argv[])
|
||||||
t85_dec.min_bit_planes = 1;
|
t85_dec.min_bit_planes = 1;
|
||||||
t85_dec.max_bit_planes = 8;
|
t85_dec.max_bit_planes = 8;
|
||||||
data5_ptr = 0;
|
data5_ptr = 0;
|
||||||
result = t85_decode_put_chunk(&t85_dec, data, total_len);
|
result = t85_decode_put(&t85_dec, data, total_len);
|
||||||
len = t85_decode_get_compressed_image_size(&t85_dec);
|
len = t85_decode_get_compressed_image_size(&t85_dec);
|
||||||
printf("Compressed image is %d bytes, %d rows\n", len/8, write_row);
|
printf("Compressed image is %d bytes, %d rows\n", len/8, write_row);
|
||||||
|
|
||||||
|
@ -343,14 +343,14 @@ int main(int argc, char *argv[])
|
||||||
t85_decode_new_plane(&t85_dec);
|
t85_decode_new_plane(&t85_dec);
|
||||||
data5_ptr = 0;
|
data5_ptr = 0;
|
||||||
t85_decode_set_comment_handler(&t85_dec, 1000, t85_comment_handler, NULL);
|
t85_decode_set_comment_handler(&t85_dec, 1000, t85_comment_handler, NULL);
|
||||||
result = t85_decode_put_chunk(&t85_dec, data, total_len);
|
result = t85_decode_put(&t85_dec, data, total_len);
|
||||||
len = t85_decode_get_compressed_image_size(&t85_dec);
|
len = t85_decode_get_compressed_image_size(&t85_dec);
|
||||||
printf("Compressed image is %d bytes, %d rows\n", len/8, write_row);
|
printf("Compressed image is %d bytes, %d rows\n", len/8, write_row);
|
||||||
}
|
}
|
||||||
if (result == T4_DECODE_MORE_DATA)
|
if (result == T4_DECODE_MORE_DATA)
|
||||||
{
|
{
|
||||||
printf("More\n");
|
printf("More\n");
|
||||||
result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA);
|
result = t85_decode_put(&t85_dec, NULL, 0);
|
||||||
}
|
}
|
||||||
len = t85_decode_get_compressed_image_size(&t85_dec);
|
len = t85_decode_get_compressed_image_size(&t85_dec);
|
||||||
printf("Compressed image is %d bytes, %d rows\n", len/8, write_row);
|
printf("Compressed image is %d bytes, %d rows\n", len/8, write_row);
|
||||||
|
|
|
@ -394,27 +394,10 @@ int main(int argc, char *argv[])
|
||||||
end_of_page = t4_t6_decode_put_bit(&receive_state, bit & 1);
|
end_of_page = t4_t6_decode_put_bit(&receive_state, bit & 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
|
||||||
do
|
|
||||||
{
|
|
||||||
bit = t4_t6_encode_get_byte(&send_state);
|
|
||||||
if ((bit & 0x100))
|
|
||||||
{
|
|
||||||
if (++end_marks > 50)
|
|
||||||
{
|
|
||||||
printf("Receiver missed the end of page mark\n");
|
|
||||||
tests_failed++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end_of_page = t4_t6_decode_put_byte(&receive_state, bit & 0xFF);
|
|
||||||
}
|
|
||||||
while (!end_of_page);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
len = t4_t6_encode_get_chunk(&send_state, chunk_buf, block_size);
|
len = t4_t6_encode_get(&send_state, chunk_buf, block_size);
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
{
|
{
|
||||||
if (++end_marks > 50)
|
if (++end_marks > 50)
|
||||||
|
@ -426,7 +409,7 @@ int main(int argc, char *argv[])
|
||||||
chunk_buf[0] = 0xFF;
|
chunk_buf[0] = 0xFF;
|
||||||
len = 1;
|
len = 1;
|
||||||
}
|
}
|
||||||
end_of_page = t4_t6_decode_put_chunk(&receive_state, chunk_buf, len);
|
end_of_page = t4_t6_decode_put(&receive_state, chunk_buf, len);
|
||||||
}
|
}
|
||||||
while (!end_of_page);
|
while (!end_of_page);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -316,6 +316,7 @@ int main(int argc, char *argv[])
|
||||||
const char *page_header_tz;
|
const char *page_header_tz;
|
||||||
tz_t tz;
|
tz_t tz;
|
||||||
int opt;
|
int opt;
|
||||||
|
int len;
|
||||||
int i;
|
int i;
|
||||||
int bit_error_rate;
|
int bit_error_rate;
|
||||||
int dump_as_xxx;
|
int dump_as_xxx;
|
||||||
|
@ -424,7 +425,7 @@ int main(int argc, char *argv[])
|
||||||
memset(&send_state, 0, sizeof(send_state));
|
memset(&send_state, 0, sizeof(send_state));
|
||||||
memset(&receive_state, 0, sizeof(receive_state));
|
memset(&receive_state, 0, sizeof(receive_state));
|
||||||
|
|
||||||
end_of_page = FALSE;
|
end_of_page = T4_DECODE_MORE_DATA;
|
||||||
if (decode_file_name)
|
if (decode_file_name)
|
||||||
{
|
{
|
||||||
if (compression < 0)
|
if (compression < 0)
|
||||||
|
@ -454,9 +455,9 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (sscanf(&buf[18 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
if (sscanf(&buf[18 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
||||||
break;
|
break;
|
||||||
if ((end_of_page = t4_rx_put_byte(&receive_state, bit)))
|
block[i] = bit;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
end_of_page = t4_rx_put(&receive_state, block, i);
|
||||||
}
|
}
|
||||||
else if (sscanf(buf, "HDLC: %x", &pkt_no) == 1)
|
else if (sscanf(buf, "HDLC: %x", &pkt_no) == 1)
|
||||||
{
|
{
|
||||||
|
@ -465,9 +466,9 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (sscanf(&buf[19 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
if (sscanf(&buf[19 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
||||||
break;
|
break;
|
||||||
if ((end_of_page = t4_rx_put_byte(&receive_state, bit)))
|
block[i] = bit;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
end_of_page = t4_rx_put(&receive_state, block, i);
|
||||||
}
|
}
|
||||||
else if (sscanf(buf, "%*d:%*d:%*d.%*d T.38 Rx %d: IFP %x %x", &pkt_no, (unsigned int *) &bit, (unsigned int *) &bit) == 3)
|
else if (sscanf(buf, "%*d:%*d:%*d.%*d T.38 Rx %d: IFP %x %x", &pkt_no, (unsigned int *) &bit, (unsigned int *) &bit) == 3)
|
||||||
{
|
{
|
||||||
|
@ -479,10 +480,9 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (sscanf(&buf[47 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
if (sscanf(&buf[47 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
||||||
break;
|
break;
|
||||||
bit = bit_reverse8(bit);
|
block[i] = bit_reverse8(bit);
|
||||||
if ((end_of_page = t4_rx_put_byte(&receive_state, bit)))
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
end_of_page = t4_rx_put(&receive_state, block, i);
|
||||||
}
|
}
|
||||||
else if (strlen(buf) > 2 && sscanf(buf, "T.30 Rx: %x %x", (unsigned int *) &bit, (unsigned int *) &bit) == 2)
|
else if (strlen(buf) > 2 && sscanf(buf, "T.30 Rx: %x %x", (unsigned int *) &bit, (unsigned int *) &bit) == 2)
|
||||||
{
|
{
|
||||||
|
@ -494,10 +494,9 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (sscanf(&buf[22 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
if (sscanf(&buf[22 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
||||||
break;
|
break;
|
||||||
bit = bit_reverse8(bit);
|
block[i] = bit_reverse8(bit);
|
||||||
if ((end_of_page = t4_rx_put_byte(&receive_state, bit)))
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
end_of_page = t4_rx_put(&receive_state, block, i);
|
||||||
}
|
}
|
||||||
else if (sscanf(buf, "%04x %02x %02x %02x", (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit) == 4)
|
else if (sscanf(buf, "%04x %02x %02x %02x", (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit) == 4)
|
||||||
{
|
{
|
||||||
|
@ -505,10 +504,9 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (sscanf(&buf[6 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
if (sscanf(&buf[6 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
||||||
break;
|
break;
|
||||||
bit = bit_reverse8(bit);
|
block[i] = bit_reverse8(bit);
|
||||||
if ((end_of_page = t4_rx_put_byte(&receive_state, bit)))
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
end_of_page = t4_rx_put(&receive_state, block, i);
|
||||||
}
|
}
|
||||||
else if (sscanf(buf, "%08x %02x %02x %02x", (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit) == 4)
|
else if (sscanf(buf, "%08x %02x %02x %02x", (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit) == 4)
|
||||||
{
|
{
|
||||||
|
@ -516,10 +514,9 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (sscanf(&buf[10 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
if (sscanf(&buf[10 + 3*i], "%x", (unsigned int *) &bit) != 1)
|
||||||
break;
|
break;
|
||||||
bit = bit_reverse8(bit);
|
block[i] = bit_reverse8(bit);
|
||||||
if ((end_of_page = t4_rx_put_byte(&receive_state, bit)))
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
end_of_page = t4_rx_put(&receive_state, block, i);
|
||||||
}
|
}
|
||||||
else if (sscanf(buf, "Rx bit %*d - %d", &bit) == 1)
|
else if (sscanf(buf, "Rx bit %*d - %d", &bit) == 1)
|
||||||
{
|
{
|
||||||
|
@ -575,7 +572,7 @@ int main(int argc, char *argv[])
|
||||||
if (compression_step >= 0)
|
if (compression_step >= 0)
|
||||||
{
|
{
|
||||||
compression = compression_sequence[compression_step++];
|
compression = compression_sequence[compression_step++];
|
||||||
if (compression < 0)
|
if (compression < 0 || (block_size == 0 && compression_step >= 3))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
t4_tx_set_tx_encoding(&send_state, compression);
|
t4_tx_set_tx_encoding(&send_state, compression);
|
||||||
|
@ -587,14 +584,33 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
if (t4_rx_start_page(&receive_state))
|
if (t4_rx_start_page(&receive_state))
|
||||||
break;
|
break;
|
||||||
|
detect_page_end(-1000000, compression);
|
||||||
|
page_ended = FALSE;
|
||||||
switch (block_size)
|
switch (block_size)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
do
|
while ((bit = t4_tx_get_bit(&send_state)) >= 0)
|
||||||
{
|
{
|
||||||
bit = t4_tx_get_bit(&send_state);
|
/* Monitor whether the EOLs are there in the correct amount */
|
||||||
if (bit == SIG_STATUS_END_OF_DATA)
|
if ((res = detect_page_end(bit, page_ended)))
|
||||||
{
|
{
|
||||||
|
printf("Incorrect EOLs - %d\n", res);
|
||||||
|
tests_failed += (res - 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (bit >= 0)
|
||||||
|
{
|
||||||
|
if (bit_error_rate)
|
||||||
|
{
|
||||||
|
if ((rand() % bit_error_rate) == 0)
|
||||||
|
bit ^= 1;
|
||||||
|
}
|
||||||
|
end_of_page = t4_rx_put_bit(&receive_state, bit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (end_of_page != T4_DECODE_OK)
|
||||||
|
{
|
||||||
|
end_of_page = t4_rx_put_bit(&receive_state, 0);
|
||||||
if (++end_marks > 50)
|
if (++end_marks > 50)
|
||||||
{
|
{
|
||||||
printf("Receiver missed the end of page mark\n");
|
printf("Receiver missed the end of page mark\n");
|
||||||
|
@ -602,49 +618,32 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end_of_page = t4_rx_put_bit(&receive_state, bit & 1);
|
/* Now throw junk at the receive context, to ensure stuff occuring
|
||||||
}
|
after the end of page condition has no bad effect. */
|
||||||
while (!end_of_page);
|
for (i = 0; i < 1000; i++)
|
||||||
break;
|
t4_rx_put_bit(&receive_state, (rand() >> 10) & 1);
|
||||||
case 1:
|
|
||||||
do
|
|
||||||
{
|
|
||||||
bit = t4_tx_get_byte(&send_state);
|
|
||||||
if ((bit & 0x100))
|
|
||||||
{
|
|
||||||
if (++end_marks > 50)
|
|
||||||
{
|
|
||||||
printf("Receiver missed the end of page mark\n");
|
|
||||||
tests_failed++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end_of_page = t4_rx_put_byte(&receive_state, bit & 0xFF);
|
|
||||||
}
|
|
||||||
while (!end_of_page);
|
|
||||||
if ((t4_tx_get_byte(&send_state) & 0x100) == 0)
|
|
||||||
{
|
|
||||||
printf("Page ended, but source is not reporting end of data\n");
|
|
||||||
tests_failed++;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
/* Some decoders require a few extra bits before the recognise the end
|
||||||
|
of an image, so be prepared to offer it a few. */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
bit = t4_tx_get_chunk(&send_state, block, block_size);
|
len = t4_tx_get(&send_state, block, block_size);
|
||||||
if (bit > 0)
|
if (len > 0)
|
||||||
end_of_page = t4_rx_put_chunk(&receive_state, block, bit);
|
end_of_page = t4_rx_put(&receive_state, block, len);
|
||||||
if (bit < block_size)
|
}
|
||||||
|
while (len > 0);
|
||||||
|
while (end_of_page != T4_DECODE_OK)
|
||||||
{
|
{
|
||||||
if (++end_marks > 50)
|
block[0] = 0;
|
||||||
|
end_of_page = t4_rx_put(&receive_state, block, 1);
|
||||||
|
if (++end_marks > 5)
|
||||||
{
|
{
|
||||||
printf("Receiver missed the end of page mark\n");
|
printf("Receiver missed the end of page mark\n");
|
||||||
tests_failed++;
|
tests_failed++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
while (!end_of_page);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
display_page_stats(&receive_state);
|
display_page_stats(&receive_state);
|
||||||
|
@ -711,7 +710,7 @@ int main(int argc, char *argv[])
|
||||||
if (compression_step >= 0)
|
if (compression_step >= 0)
|
||||||
{
|
{
|
||||||
compression = compression_sequence[compression_step++];
|
compression = compression_sequence[compression_step++];
|
||||||
if (compression < 0)
|
if (compression < 0 || (block_size == 0 && compression_step >= 3))
|
||||||
{
|
{
|
||||||
compression_step = 0;
|
compression_step = 0;
|
||||||
compression = compression_sequence[compression_step++];
|
compression = compression_sequence[compression_step++];
|
||||||
|
@ -732,72 +731,58 @@ int main(int argc, char *argv[])
|
||||||
switch (block_size)
|
switch (block_size)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
for (;;)
|
while ((bit = t4_tx_get_bit(&send_state)) >= 0)
|
||||||
{
|
{
|
||||||
bit = t4_tx_get_bit(&send_state);
|
|
||||||
/* Monitor whether the EOLs are there in the correct amount */
|
/* Monitor whether the EOLs are there in the correct amount */
|
||||||
if ((res = detect_page_end(bit, page_ended)))
|
if ((res = detect_page_end(bit, page_ended)))
|
||||||
{
|
{
|
||||||
|
printf("Incorrect EOLs - %d\n", res);
|
||||||
tests_failed += (res - 1);
|
tests_failed += (res - 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!page_ended)
|
|
||||||
{
|
|
||||||
if (bit_error_rate)
|
if (bit_error_rate)
|
||||||
{
|
{
|
||||||
if ((rand() % bit_error_rate) == 0)
|
if ((rand() % bit_error_rate) == 0)
|
||||||
bit ^= 1;
|
bit ^= 1;
|
||||||
}
|
}
|
||||||
if (t4_rx_put_bit(&receive_state, bit & 1))
|
end_of_page = t4_rx_put_bit(&receive_state, bit);
|
||||||
page_ended = TRUE;
|
}
|
||||||
|
while (end_of_page != T4_DECODE_OK)
|
||||||
|
{
|
||||||
|
end_of_page = t4_rx_put_bit(&receive_state, 0);
|
||||||
|
if (++end_marks > 50)
|
||||||
|
{
|
||||||
|
printf("Receiver missed the end of page mark\n");
|
||||||
|
tests_failed++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Now throw junk at the receive context, to ensure stuff occuring
|
/* Now throw junk at the receive context, to ensure stuff occuring
|
||||||
after the end of page condition has no bad effect. */
|
after the end of page condition has no bad effect. */
|
||||||
for (i = 0; i < 1000; i++)
|
for (i = 0; i < 1000; i++)
|
||||||
{
|
|
||||||
t4_rx_put_bit(&receive_state, (rand() >> 10) & 1);
|
t4_rx_put_bit(&receive_state, (rand() >> 10) & 1);
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
do
|
|
||||||
{
|
|
||||||
bit = t4_tx_get_byte(&send_state);
|
|
||||||
if ((bit & 0x100))
|
|
||||||
{
|
|
||||||
if (++end_marks > 50)
|
|
||||||
{
|
|
||||||
printf("Receiver missed the end of page mark\n");
|
|
||||||
tests_failed++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end_of_page = t4_rx_put_byte(&receive_state, bit & 0xFF);
|
|
||||||
}
|
|
||||||
while (!end_of_page);
|
|
||||||
if ((t4_tx_get_byte(&send_state) & 0x100) == 0)
|
|
||||||
{
|
|
||||||
printf("Page ended, but source is not reporting end of data\n");
|
|
||||||
tests_failed++;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
bit = t4_tx_get_chunk(&send_state, block, block_size);
|
len = t4_tx_get(&send_state, block, block_size);
|
||||||
if (bit > 0)
|
if (len > 0)
|
||||||
end_of_page = t4_rx_put_chunk(&receive_state, block, bit);
|
end_of_page = t4_rx_put(&receive_state, block, len);
|
||||||
if (bit < block_size)
|
}
|
||||||
|
while (len > 0);
|
||||||
|
/* Some decoders require a few extra bits before the recognise the end
|
||||||
|
of an image, so be prepared to offer it a few. */
|
||||||
|
while (end_of_page != T4_DECODE_OK)
|
||||||
{
|
{
|
||||||
if (++end_marks > 50)
|
block[0] = 0;
|
||||||
|
end_of_page = t4_rx_put(&receive_state, block, 1);
|
||||||
|
if (++end_marks > 5)
|
||||||
{
|
{
|
||||||
printf("Receiver missed the end of page mark\n");
|
printf("Receiver missed the end of page mark\n");
|
||||||
tests_failed++;
|
tests_failed++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
while (!end_of_page);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (dump_as_xxx)
|
if (dump_as_xxx)
|
||||||
|
|
|
@ -229,7 +229,7 @@ static int test_cycle(const char *test_id,
|
||||||
|
|
||||||
testbuf_len = 0;
|
testbuf_len = 0;
|
||||||
max_len = 100;
|
max_len = 100;
|
||||||
while ((len = t85_encode_get_chunk(&t85_enc, &testbuf[testbuf_len], max_len)) > 0)
|
while ((len = t85_encode_get(&t85_enc, &testbuf[testbuf_len], max_len)) > 0)
|
||||||
{
|
{
|
||||||
testbuf_len += len;
|
testbuf_len += len;
|
||||||
max_len = 100;
|
max_len = 100;
|
||||||
|
@ -261,9 +261,9 @@ static int test_cycle(const char *test_id,
|
||||||
if (comment && comment[0] != 'X')
|
if (comment && comment[0] != 'X')
|
||||||
t85_decode_set_comment_handler(&t85_dec, 1000, comment_handler, NULL);
|
t85_decode_set_comment_handler(&t85_dec, 1000, comment_handler, NULL);
|
||||||
write_row = 0;
|
write_row = 0;
|
||||||
result = t85_decode_put_chunk(&t85_dec, testbuf, testbuf_len);
|
result = t85_decode_put(&t85_dec, testbuf, testbuf_len);
|
||||||
if (result == T4_DECODE_MORE_DATA)
|
if (result == T4_DECODE_MORE_DATA)
|
||||||
result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA);
|
result = t85_decode_put(&t85_dec, NULL, 0);
|
||||||
cnt_a = t85_encode_get_compressed_image_size(&t85_enc);
|
cnt_a = t85_encode_get_compressed_image_size(&t85_enc);
|
||||||
cnt_b = t85_decode_get_compressed_image_size(&t85_dec);
|
cnt_b = t85_decode_get_compressed_image_size(&t85_dec);
|
||||||
if (cnt_a != cnt_b || cnt_a != testbuf_len*8 || result != T4_DECODE_OK)
|
if (cnt_a != cnt_b || cnt_a != testbuf_len*8 || result != T4_DECODE_OK)
|
||||||
|
@ -300,7 +300,7 @@ static int test_cycle(const char *test_id,
|
||||||
result = T4_DECODE_MORE_DATA;
|
result = T4_DECODE_MORE_DATA;
|
||||||
for (l = 0; l < testbuf_len; l++)
|
for (l = 0; l < testbuf_len; l++)
|
||||||
{
|
{
|
||||||
result = t85_decode_put_chunk(&t85_dec, &testbuf[l], 1);
|
result = t85_decode_put(&t85_dec, &testbuf[l], 1);
|
||||||
if (result != T4_DECODE_MORE_DATA)
|
if (result != T4_DECODE_MORE_DATA)
|
||||||
{
|
{
|
||||||
l++;
|
l++;
|
||||||
|
@ -308,7 +308,7 @@ static int test_cycle(const char *test_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result == T4_DECODE_MORE_DATA)
|
if (result == T4_DECODE_MORE_DATA)
|
||||||
result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA);
|
result = t85_decode_put(&t85_dec, NULL, 0);
|
||||||
if (l != testbuf_len || result != T4_DECODE_OK)
|
if (l != testbuf_len || result != T4_DECODE_OK)
|
||||||
{
|
{
|
||||||
printf("Decode result %d\n", result);
|
printf("Decode result %d\n", result);
|
||||||
|
|
|
@ -989,7 +989,7 @@ static int next_step(faxtester_state_t *s)
|
||||||
printf("Test failed\n");
|
printf("Test failed\n");
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
len = t4_tx_get_chunk(&t4_tx_state, image, sizeof(image));
|
len = t4_tx_get(&t4_tx_state, image, sizeof(image));
|
||||||
if (bad_rows)
|
if (bad_rows)
|
||||||
{
|
{
|
||||||
span_log(&s->logging, SPAN_LOG_FLOW, "We need to corrupt the image\n");
|
span_log(&s->logging, SPAN_LOG_FLOW, "We need to corrupt the image\n");
|
||||||
|
@ -1030,7 +1030,7 @@ static int next_step(faxtester_state_t *s)
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
/*endif*/
|
/*endif*/
|
||||||
len = t4_tx_get_chunk(&t4_tx_state, image, sizeof(image));
|
len = t4_tx_get(&t4_tx_state, image, sizeof(image));
|
||||||
if (bad_rows)
|
if (bad_rows)
|
||||||
{
|
{
|
||||||
span_log(&s->logging, SPAN_LOG_FLOW, "We need to corrupt the image\n");
|
span_log(&s->logging, SPAN_LOG_FLOW, "We need to corrupt the image\n");
|
||||||
|
|
Loading…
Reference in New Issue