update to snapshot spandsp-20090301

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12352 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris committed 2009-03-02 16:24:30 +00:00
1 parent 6d632fdf8d
commit 13b84df5d8
9 files changed
+109 -29

No files matched your search

@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: generate_etsi_300_242_pages.c,v 1.3 2009/02/20 12:34:20 steveu Exp $
* $Id: generate_etsi_300_242_pages.c,v 1.4 2009/03/01 12:39:02 steveu Exp $
*/
/*! \file */
@@ -177,8 +177,8 @@ struct
},
};
int reverse_photo_metric = FALSE;
int reverse_fill_order = FALSE;
int photo_metric = PHOTOMETRIC_MINISWHITE;
int fill_order = FILLORDER_LSB2MSB;
static void clear_row(uint8_t buf[], int width)
{
@@ -256,13 +256,15 @@ static int create_stairstep_page(TIFF *tiff_file)
{
clear_row(image_buffer, 1728);
set_pixel_range(image_buffer, 1, start_pixel, start_pixel + 63);
if (reverse_photo_metric)
if (photo_metric != PHOTOMETRIC_MINISWHITE)
{
for (i = 0; i < 1728/8; i++)
image_buffer[i] = ~image_buffer[i];
}
if (reverse_fill_order)
#if 0
if (fill_order != FILLORDER_LSB2MSB)
bit_reverse(image_buffer, image_buffer, 1728/8);
#endif
if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0)
{
printf("Write error at row %d.\n", row);
@@ -558,6 +560,37 @@ int main(int argc, char *argv[])
float y_resolution;
int i;
int image_length;
int opt;
int compression;
compression = T4_COMPRESSION_ITU_T6;
photo_metric = PHOTOMETRIC_MINISWHITE;
fill_order = FILLORDER_LSB2MSB;
while ((opt = getopt(argc, argv, "126ir")) != -1)
{
switch (opt)
{
case '1':
compression = T4_COMPRESSION_ITU_T4_1D;
break;
case '2':
compression = T4_COMPRESSION_ITU_T4_2D;
break;
case '6':
compression = T4_COMPRESSION_ITU_T6;
break;
case 'i':
photo_metric = PHOTOMETRIC_MINISBLACK;
break;
case 'r':
fill_order = FILLORDER_MSB2LSB;
break;
default:
//usage();
exit(2);
break;
}
}
tiff_file = NULL;
for (i = 0; sequence[i].name; i++)
@@ -582,14 +615,8 @@ int main(int argc, char *argv[])
TIFFSetField(tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, -1L);
TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
if (reverse_photo_metric)
TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
else
TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
if (reverse_fill_order)
TIFFSetField(tiff_file, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
else
TIFFSetField(tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, photo_metric);
TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order);
x_resolution = sequence[i].x_res/100.0f;
y_resolution = sequence[i].y_res/100.0f;
TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*2.54f + 0.5f));
@@ -23,7 +23,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: generate_sized_pages.c,v 1.2 2008/07/10 13:34:01 steveu Exp $
* $Id: generate_sized_pages.c,v 1.3 2009/03/01 12:39:02 steveu Exp $
*/
/*! \file */
@@ -289,6 +289,39 @@ int main(int argc, char *argv[])
float x_resolution;
float y_resolution;
int i;
int opt;
int compression;
int photo_metric;
int fill_order;
compression = T4_COMPRESSION_ITU_T6;
photo_metric = PHOTOMETRIC_MINISWHITE;
fill_order = FILLORDER_LSB2MSB;
while ((opt = getopt(argc, argv, "126ir")) != -1)
{
switch (opt)
{
case '1':
compression = T4_COMPRESSION_ITU_T4_1D;
break;
case '2':
compression = T4_COMPRESSION_ITU_T4_2D;
break;
case '6':
compression = T4_COMPRESSION_ITU_T6;
break;
case 'i':
photo_metric = PHOTOMETRIC_MINISBLACK;
break;
case 'r':
fill_order = FILLORDER_MSB2LSB;
break;
default:
//usage();
exit(2);
break;
}
}
for (i = 0; sequence[i].name; i++)
{
@@ -296,15 +329,15 @@ int main(int argc, char *argv[])
exit(2);
/* Prepare the directory entry fully before writing the image, or libtiff complains */
TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, COMPRESSION_CCITT_T6);
TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, compression);
TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, sequence[i].width);
TIFFSetField(tiff_file, TIFFTAG_BITSPERSAMPLE, 1);
TIFFSetField(tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, -1L);
TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
TIFFSetField(tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, photo_metric);
TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order);
x_resolution = sequence[i].x_res/100.0f;
y_resolution = sequence[i].y_res/100.0f;