TIFF/FX spec says, even though no software seems to care.
}
s->at_state.transmit = TRUE;
break;
+ case FAX_MODEM_V21_RX:
+ if (s->t38_mode)
+ {
+ }
+ else
+ {
+ t31_v21_rx(s);
+ fax_modems_set_rx_handler(t, (span_rx_handler_t) &fsk_rx, &t->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &t->v21_rx);
+ }
+ break;
case FAX_MODEM_V21_TX:
if (s->t38_mode)
{
s->dled = FALSE;
s->at_state.transmit = TRUE;
break;
- case FAX_MODEM_V21_RX:
- if (s->t38_mode)
- {
- }
- else
+ case FAX_MODEM_V17_RX:
+ case FAX_MODEM_V27TER_RX:
+ case FAX_MODEM_V29_RX:
+ if (!s->t38_mode)
{
+ fax_modems_start_fast_modem(t, s->modem, s->bit_rate, s->short_train, use_hdlc);
+ /* Allow for +FCERROR/+FRH:3 */
t31_v21_rx(s);
- fax_modems_set_rx_handler(t, (span_rx_handler_t) &fsk_rx, &t->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &t->v21_rx);
}
+ s->at_state.transmit = FALSE;
break;
case FAX_MODEM_V17_TX:
if (s->t38_mode)
s->tx.data_started = FALSE;
s->at_state.transmit = TRUE;
break;
- case FAX_MODEM_V17_RX:
- case FAX_MODEM_V27TER_RX:
- case FAX_MODEM_V29_RX:
- if (!s->t38_mode)
- {
- fax_modems_start_fast_modem(t, s->modem, s->bit_rate, s->short_train, use_hdlc);
- /* Allow for +FCERROR/+FRH:3 */
- t31_v21_rx(s);
- }
- s->at_state.transmit = FALSE;
- break;
case FAX_MODEM_V27TER_TX:
if (s->t38_mode)
{
}
#if defined(SPANDSP_SUPPORT_TIFF_FX)
TIFFSetField(t->tiff_file, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX);
- TIFFSetField(t->tiff_file, TIFFTAG_FAXPROFILE, FAXPROFILE_S);
+ TIFFSetField(t->tiff_file, TIFFTAG_FAXPROFILE, FAXPROFILE_F);
TIFFSetField(t->tiff_file, TIFFTAG_CODINGMETHODS, CODINGMETHODS_T4_1D | CODINGMETHODS_T4_2D | CODINGMETHODS_T6);
TIFFSetField(t->tiff_file, TIFFTAG_VERSIONYEAR, "1998");
/* TIFFSetField(t->tiff_file, TIFFTAG_MODENUMBER, 0); */
return -1;
/* Set up the TIFF directory info... */
set_tiff_directory_info(s);
- /* ...and then write the image... */
+ /* ...Put the directory in the file before the image data, to get them in the order specified
+ for TIFF/F files... */
+ if (!TIFFCheckpointDirectory(t->tiff_file))
+ span_log(&s->logging, SPAN_LOG_WARNING, "%s: Failed to checkpoint directory for page %d.\n", t->file, s->current_page);
+ /* ...and write out the image... */
if (TIFFWriteEncodedStrip(t->tiff_file, 0, t->image_buffer, t->image_size) < 0)
span_log(&s->logging, SPAN_LOG_WARNING, "%s: Error writing TIFF strip.\n", t->file);
- /* ...then the directory entry, and libtiff is happy. */
+ /* ...then finalise the directory entry, and libtiff is happy. */
if (!TIFFWriteDirectory(t->tiff_file))
span_log(&s->logging, SPAN_LOG_WARNING, "%s: Failed to write directory for page %d.\n", t->file, s->current_page);
#if defined(SPANDSP_SUPPORT_TIFF_FX)
if (!TIFFCreateCustomDirectory(t->tiff_file, &tiff_fx_field_array))
{
TIFFSetField(t->tiff_file, TIFFTAG_FAXPROFILE, PROFILETYPE_G3_FAX);
- TIFFSetField(t->tiff_file, TIFFTAG_PROFILETYPE, FAXPROFILE_S);
+ TIFFSetField(t->tiff_file, TIFFTAG_PROFILETYPE, FAXPROFILE_F);
TIFFSetField(t->tiff_file, TIFFTAG_VERSIONYEAR, "1998");
offset = 0;
tm->tm_sec);
TIFFSetField(tiff_file, TIFFTAG_DATETIME, buf);
image_length = sequence[i].length;
+ TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1);
+ TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN);
+ TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, image_length);
+ TIFFCheckpointDirectory(tiff_file);
/* Write the image first.... */
switch (sequence[i].type)
}
/* ....then the directory entry, and libtiff is happy. */
TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, image_length);
- TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1);
- TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN);
TIFFWriteDirectory(tiff_file);
}
TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1);
TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN);
TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, image_width);
+ TIFFCheckpointDirectory(tiff_file);
/* Write the image first.... */
for (row = 0; row < image_length; row++)
TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1);
TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN);
TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, sequence[i].width);
+ TIFFCheckpointDirectory(tiff_file);
/* Write the image first.... */
for (row = 0; row < sequence[i].length; row++)
TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, IMAGE_WIDTH);
TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, IMAGE_LENGTH);
TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1);
+ TIFFCheckpointDirectory(tiff_file);
image_size = IMAGE_WIDTH*ROWS_PER_STRIPE/8;
memset(image_buffer, 0x18, image_size);
#include "spandsp.h"
#if defined(SPANDSP_SUPPORT_TIFF_FX)
-//#include <tif_dir.h>
+#include <tif_dir.h>
#endif
//#define IN_FILE_NAME "../test-data/itu/t24/F21_200.TIF"
logging = span_log_init(NULL, SPAN_LOG_FLOW, "T.42");
+#if defined(SPANDSP_SUPPORT_TIFF_FX)
TIFF_FX_init();
+#endif
set_lab_illuminant(&lab_param, 0.9638f, 1.0f, 0.8245f);
set_lab_gamut(&lab_param, 0, 100, -85, 85, -75, 125, FALSE);
YCbCrSubsampleHoriz = 0;
YCbCrSubsampleVert = 0;
TIFFGetField(tif, TIFFTAG_YCBCRSUBSAMPLING, &YCbCrSubsampleHoriz, &YCbCrSubsampleVert);
- planar_config = 0;
+ planar_config = PLANARCONFIG_CONTIG;
TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &planar_config);
off = 0;