forked from Mirrors/freeswitch
Improvements to image translation
This commit is contained in:
parent
26cefbdb87
commit
e30406cea6
|
@ -1,80 +1,121 @@
|
|||
Installation Instructions
|
||||
*************************
|
||||
Building and installing spandsp
|
||||
===============================
|
||||
|
||||
A number of distributions include spandsp, but they usually use older versions
|
||||
of the library, which lack a lot of the features of the current version. Before
|
||||
installing spandsp, make sure there are no older versions already on your
|
||||
machine. Make sure libtiff is installed on your machine. Versions 3.5.7,
|
||||
3.6.0, 3.7.1 and 3.8.2 seem to work OK. There have been several bugs related
|
||||
to FAX document handling in some versions of libtiff. Also, some people have
|
||||
had trouble using spandsp because they had more than one version of libtiff
|
||||
on their machine. Take care with this. If you are using an RPM based system,
|
||||
such as RedHat or Fedora, you will need the libtiff and libtiff-devel RPMs
|
||||
installed to be able to build spandsp.
|
||||
|
||||
You can use the usual:
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
process to build the spandsp library. Note that if you use configure in this
|
||||
way, the software will be installed in /usr/local. In this case make sure your
|
||||
/etc/ld.so.conf file has an entry for /usr/local/lib. If you wish the software
|
||||
to be installed in /usr, you should build it with the commands.
|
||||
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
Building the programming documentation
|
||||
======================================
|
||||
|
||||
If you wish to build the programming documentation for spandsp, configure
|
||||
spandsp with:
|
||||
|
||||
./configure --enable-doc
|
||||
|
||||
You need doxygen installed on your machine.
|
||||
|
||||
|
||||
Building the test suite
|
||||
=======================
|
||||
|
||||
Most sections of the spandsp library have an accompanying test program in the
|
||||
test directory. If you wish to build these test programs, configure spandsp
|
||||
with:
|
||||
|
||||
./configure --enable-tests
|
||||
|
||||
To build these tests you will need libaudiofile installed on your machine. To
|
||||
build the modem tests, with the GUI monitoring feature you will need Fltk 1.1.4
|
||||
or later, an audio meter module and a cartesian plotting module. Fltk may be
|
||||
obtained from http://www.fltk.org. The audio meter module may be obtained from
|
||||
http://www.soft-switch.org/downloads/Fl_Audio_Meter.tgz . The cartesian plotting
|
||||
module may be obtained from http://134.226.68.29/fltk. However, there is no
|
||||
suitable makefile supplied with that. You can find a version at
|
||||
http://www.soft-switch.org/downloads/Fl_Cartesian.tgz which will build as a
|
||||
Linux library. The actual code in both these versions is identical.
|
||||
You need to have Fltk 1.1.4 or later installed before building the plotting
|
||||
library.
|
||||
|
||||
|
||||
Applications
|
||||
============
|
||||
|
||||
Applications support for spandsp is built into packages such as Callweaver,
|
||||
FreeSwitch and iaxmodem. Code to add spandsp based FAX support to Asterisk may
|
||||
be found at http://sourceforge.net/projects/agx-ast-addons.
|
||||
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell commands `./configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the `README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
`INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
||||
you want to change it or regenerate `configure' using a newer version
|
||||
of `autoconf'.
|
||||
The file `configure.ac' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.ac' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system.
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the `make install' phase executed with root
|
||||
privileges.
|
||||
documentation.
|
||||
|
||||
5. Optionally, type `make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior `make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
|
@ -83,119 +124,62 @@ of `autoconf'.
|
|||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type `make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide `make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like `make install' and `make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'. This
|
||||
is known as a "VPATH" build.
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
With a non-GNU `make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use `make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple `-arch' options to the
|
||||
compiler but only a single `-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the `lipo' tool if you have problems.
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the
|
||||
default for these options is expressed in terms of `${prefix}', so that
|
||||
specifying just `--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to `configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
`make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, `make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
`${prefix}'. Any directories that were specified during `configure',
|
||||
but not in terms of `${prefix}', must each be overridden at install
|
||||
time for the entire installation to be relocated. The approach of
|
||||
makefile variable overrides for each directory variable is required by
|
||||
the GNU Coding Standards, and ideally causes no recompilation.
|
||||
However, some platforms have known limitations with the semantics of
|
||||
shared libraries that end up requiring recompilation when using this
|
||||
method, particularly noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the `DESTDIR' variable. For
|
||||
example, `make install DESTDIR=/alternate/directory' will prepend
|
||||
`/alternate/directory' before all installation names. The approach of
|
||||
`DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of `${prefix}'
|
||||
at `configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
|
@ -208,80 +192,25 @@ find the X include and library files automatically, but if it doesn't,
|
|||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of `make' will be. For these packages, running `./configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with `make V=1'; while running `./configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with `make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
|
||||
CC is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX `make' updates targets which have the same time stamps as
|
||||
their prerequisites, which makes it generally unusable when shipped
|
||||
generated files such as `configure' are involved. Use GNU `make'
|
||||
instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
|
||||
a workaround. If GNU CC is not installed, it is therefore recommended
|
||||
to try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
|
||||
in your `PATH', put it _after_ `/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in `/boot/common',
|
||||
not `/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
need to know the host type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
@ -294,55 +223,19 @@ default values for variables like `CC', `cache_file', and `prefix'.
|
|||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
||||
an Autoconf bug. Until the bug is fixed you can use this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of all of the options to `configure', and exit.
|
||||
|
||||
`--help=short'
|
||||
`--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
`configure', and exit. The `short' variant lists options used
|
||||
only in the top level, while the `recursive' variant lists options
|
||||
also present in any nested packages.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
|
@ -355,16 +248,8 @@ operates.
|
|||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names::
|
||||
for more details, including other options available for fine-tuning
|
||||
the installation locations.
|
||||
|
||||
`--no-create'
|
||||
`-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
|
|
@ -257,7 +257,7 @@ The file dither1d.tif is a whole page of dense checkerboard pattern, which does
|
|||
|
||||
<sect1>
|
||||
<title>Expect some very poor timing decisions in various designs.</title>
|
||||
<para>The preamble for V.21 HDLC data is specified as being 1s ±15%. This should mean 850ms of preamble is within spec, and many modern FAX machines only send that much. A number of T.38 implementations choke on this. They require at least 1s between the <emphasis>v21-preamble</emphasis> message and the first HDLC data, for reliable operation. This is very poor design. Even if there is 1s between these events at the source, jitter on the network can make them arrive less than 1s apart. It appears the best a tolerant implementation can really do is impose a 1s minimum between sending these T.38 messages, and accept that things might still go wrong when there is some jitter.</para>
|
||||
<para>The preamble for V.21 HDLC data is specified as being 1s+-15%. This should mean 850ms of preamble is within spec, and many modern FAX machines only send that much. A number of T.38 implementations choke on this. They require at least 1s between the <emphasis>v21-preamble</emphasis> message and the first HDLC data, for reliable operation. This is very poor design. Even if there is 1s between these events at the source, jitter on the network can make them arrive less than 1s apart. It appears the best a tolerant implementation can really do is impose a 1s minimum between sending these T.38 messages, and accept that things might still go wrong when there is some jitter.</para>
|
||||
|
||||
<para>There is similar intolerance with the timing of the start of training messages for the fast image data modems. Most implementations do not impose a minimum which is above that permitted by the T.30 specification. Some do, however, make no allowance for network jitter reducing the interval at the receiver. You should expect the far end to be using TEP, when sizing the required delay between the start of training, and the first data. Also, for ECM data, make sure the delay allows for the specified minimum 200ms of preamble.</para>
|
||||
</sect1>
|
||||
|
|
|
@ -312,6 +312,7 @@ static int get_and_scrunch_row(image_translate_state_t *s, uint8_t buf[])
|
|||
static int image_resize_row(image_translate_state_t *s, uint8_t buf[])
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int output_width;
|
||||
int output_length;
|
||||
int input_width;
|
||||
|
@ -329,6 +330,9 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[])
|
|||
double frac_row;
|
||||
double frac_col;
|
||||
#endif
|
||||
uint8_t *row8[2];
|
||||
uint16_t *row16[2];
|
||||
uint16_t *buf16;
|
||||
int row_len;
|
||||
int skip;
|
||||
uint8_t *p;
|
||||
|
@ -366,26 +370,113 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[])
|
|||
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
frac_row = ((s->raw_output_row*256*input_length)/output_length) & 0xFF;
|
||||
for (i = 0; i < output_width; i++)
|
||||
{
|
||||
x = i*256*input_width/output_width;
|
||||
frac_col = x & 0xFF;
|
||||
x >>= 8;
|
||||
c1 = s->raw_pixel_row[0][x] + (((s->raw_pixel_row[0][x + 1] - s->raw_pixel_row[0][x])*frac_col) >> 8);
|
||||
c2 = s->raw_pixel_row[1][x] + (((s->raw_pixel_row[1][x + 1] - s->raw_pixel_row[1][x])*frac_col) >> 8);
|
||||
buf[i] = saturateu8(c1 + (((c2 - c1)*frac_row) >> 8));
|
||||
}
|
||||
#else
|
||||
frac_row = modf((double) s->raw_output_row*input_length/output_length, &int_part);
|
||||
for (i = 0; i < output_width; i++)
|
||||
{
|
||||
frac_col = modf((double) i*input_width/output_width, &int_part);
|
||||
x = int_part;
|
||||
c1 = s->raw_pixel_row[0][x] + (s->raw_pixel_row[0][x + 1] - s->raw_pixel_row[0][x])*frac_col;
|
||||
c2 = s->raw_pixel_row[1][x] + (s->raw_pixel_row[1][x + 1] - s->raw_pixel_row[1][x])*frac_col;
|
||||
buf[i] = saturateu8(c1 + (c2 - c1)*frac_row);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (s->output_format)
|
||||
{
|
||||
case T4_IMAGE_TYPE_COLOUR_8BIT:
|
||||
row8[0] = s->raw_pixel_row[0];
|
||||
row8[1] = s->raw_pixel_row[1];
|
||||
for (i = 0; i < output_width; i++)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
x = i*256*input_width/output_width;
|
||||
frac_col = x & 0xFF;
|
||||
x >>= 8;
|
||||
x = 3*x;
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
c1 = row8[0][x + j] + (((row8[0][x + j + 3] - row8[0][x + j])*frac_col) >> 8);
|
||||
c2 = row8[1][x + j] + (((row8[1][x + j + 3] - row8[1][x + j])*frac_col) >> 8);
|
||||
buf[3*i + j] = saturateu8(c1 + (((c2 - c1)*frac_row) >> 8));
|
||||
}
|
||||
#else
|
||||
frac_col = modf((double) i*input_width/output_width, &int_part);
|
||||
x = 3*int_part;
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
c1 = row8[0][x + j] + (row8[0][x + j + 3] - row8[0][x + j])*frac_col;
|
||||
c2 = row8[1][x + j] + (row8[1][x + j + 3] - row8[1][x + j])*frac_col;
|
||||
buf[3*i + j] = saturateu8(c1 + (c2 - c1)*frac_row);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case T4_IMAGE_TYPE_COLOUR_12BIT:
|
||||
row16[0] = (uint16_t *) s->raw_pixel_row[0];
|
||||
row16[1] = (uint16_t *) s->raw_pixel_row[1];
|
||||
buf16 = (uint16_t *) buf;
|
||||
for (i = 0; i < output_width; i++)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
x = i*256*input_width/output_width;
|
||||
frac_col = x & 0xFF;
|
||||
x >>= 8;
|
||||
x = 3*x;
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
c1 = row16[0][x + j] + (((row16[0][x + j + 3] - row16[0][x + j])*frac_col) >> 8);
|
||||
c2 = row16[1][x + j] + (((row16[1][x + j + 3] - row16[1][x + j])*frac_col) >> 8);
|
||||
buf16[3*i + j] = saturateu16(c1 + (((c2 - c1)*frac_row) >> 8));
|
||||
}
|
||||
#else
|
||||
frac_col = modf((double) i*input_width/output_width, &int_part);
|
||||
x = 3*int_part;
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
c1 = row16[0][x + j] + (row16[0][x + j + 3] - row16[0][x + j])*frac_col;
|
||||
c2 = row16[1][x + j] + (row16[1][x + j + 3] - row16[1][x + j])*frac_col;
|
||||
buf16[3*i + j] = saturateu16(c1 + (c2 - c1)*frac_row);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case T4_IMAGE_TYPE_GRAY_8BIT:
|
||||
row8[0] = s->raw_pixel_row[0];
|
||||
row8[1] = s->raw_pixel_row[1];
|
||||
for (i = 0; i < output_width; i++)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
x = i*256*input_width/output_width;
|
||||
frac_col = x & 0xFF;
|
||||
x >>= 8;
|
||||
c1 = row8[0][x] + (((row8[0][x + 1] - row8[0][x])*frac_col) >> 8);
|
||||
c2 = row8[1][x] + (((row8[1][x + 1] - row8[1][x])*frac_col) >> 8);
|
||||
buf[i] = saturateu8(c1 + (((c2 - c1)*frac_row) >> 8));
|
||||
#else
|
||||
frac_col = modf((double) i*input_width/output_width, &int_part);
|
||||
x = int_part;
|
||||
c1 = row8[0][x] + (row8[0][x + 1] - row8[0][x])*frac_col;
|
||||
c2 = row8[1][x] + (row8[1][x + 1] - row8[1][x])*frac_col;
|
||||
buf[i] = saturateu8(c1 + (c2 - c1)*frac_row);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case T4_IMAGE_TYPE_GRAY_12BIT:
|
||||
row16[0] = (uint16_t *) s->raw_pixel_row[0];
|
||||
row16[1] = (uint16_t *) s->raw_pixel_row[1];
|
||||
buf16 = (uint16_t *) buf;
|
||||
for (i = 0; i < output_width; i++)
|
||||
{
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
x = i*256*input_width/output_width;
|
||||
frac_col = x & 0xFF;
|
||||
x >>= 8;
|
||||
c1 = row16[0][x] + (((row16[0][x + 1] - row16[0[x])*frac_col) >> 8);
|
||||
c2 = row16[1][x] + (((row16[1][x + 1] - row16[1][x])*frac_col) >> 8);
|
||||
buf[i] = saturateu8(c1 + (((c2 - c1)*frac_row) >> 8));
|
||||
#else
|
||||
frac_col = modf((double) i*input_width/output_width, &int_part);
|
||||
x = int_part;
|
||||
c1 = row16[0][x] + (row16[0][x + 1] - row16[0][x])*frac_col;
|
||||
c2 = row16[1][x] + (row16[1][x + 1] - row16[1][x])*frac_col;
|
||||
buf[i] = saturateu8(c1 + (c2 - c1)*frac_row);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (++s->raw_output_row >= s->output_length)
|
||||
s->raw_output_row = -1;
|
||||
return s->output_width;
|
||||
|
@ -398,9 +489,10 @@ static __inline__ uint8_t find_closest_palette_color(int in)
|
|||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int floyd_steinberg_dither_row(image_translate_state_t *s, uint8_t buf[], int y)
|
||||
static int floyd_steinberg_dither_row(image_translate_state_t *s, uint8_t buf[])
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int i;
|
||||
int j;
|
||||
int limit;
|
||||
|
@ -408,7 +500,35 @@ static int floyd_steinberg_dither_row(image_translate_state_t *s, uint8_t buf[],
|
|||
int new_pixel;
|
||||
int quant_error;
|
||||
uint8_t xx;
|
||||
uint8_t *p;
|
||||
|
||||
y = s->output_row++;
|
||||
/* This algorithm works over two rows, and outputs the earlier of the two. To
|
||||
make this work:
|
||||
- At row 0 we grab and scrunch two rows.
|
||||
- From row 1 up to the last row we grab one new additional row each time.
|
||||
- At the last row we dither and output, without getting an extra row in. */
|
||||
for (i = (y == 0) ? 0 : 1; i < 2; i++)
|
||||
{
|
||||
/* Swap the row buffers */
|
||||
p = s->pixel_row[0];
|
||||
s->pixel_row[0] = s->pixel_row[1];
|
||||
s->pixel_row[1] = p;
|
||||
|
||||
/* If this is the end of the image just ignore that there is now rubbish in pixel_row[1].
|
||||
Mark that the end has occurred. This row will be properly output, and the next one
|
||||
will fail, with the end of image condition (i.e. returning zero length) */
|
||||
if (s->resize)
|
||||
{
|
||||
if (image_resize_row(s, s->pixel_row[1]) != s->output_width)
|
||||
s->output_row = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (get_and_scrunch_row(s, s->pixel_row[1]) != s->output_width)
|
||||
s->output_row = -1;
|
||||
}
|
||||
}
|
||||
/* Apply Floyd-Steinberg dithering to the 8 bit pixels, using a bustrophodontic
|
||||
scan, to reduce the grayscale image to pure black and white */
|
||||
/* The first and last pixels in each row need special treatment, so we do not
|
||||
|
@ -488,47 +608,30 @@ static int floyd_steinberg_dither_row(image_translate_state_t *s, uint8_t buf[],
|
|||
|
||||
SPAN_DECLARE(int) image_translate_row(image_translate_state_t *s, uint8_t buf[], size_t len)
|
||||
{
|
||||
int y;
|
||||
int i;
|
||||
uint8_t *p;
|
||||
|
||||
if (s->output_row < 0)
|
||||
return 0;
|
||||
y = s->output_row++;
|
||||
/* This algorithm works over two rows, and outputs the earlier of the two. To
|
||||
make this work:
|
||||
- At row 0 we grab and scrunch two rows.
|
||||
- From row 1 up to the last row we grab one new additional row each time.
|
||||
- At the last row we dither and output, without getting an extra row in. */
|
||||
for (i = (y == 0) ? 0 : 1; i < 2; i++)
|
||||
if (s->output_format == T4_IMAGE_TYPE_BILEVEL)
|
||||
{
|
||||
/* Swap the row buffers */
|
||||
p = s->pixel_row[0];
|
||||
s->pixel_row[0] = s->pixel_row[1];
|
||||
s->pixel_row[1] = p;
|
||||
|
||||
/* If this is the end of the image just ignore that there is now rubbish in pixel_row[1].
|
||||
Mark that the end has occurred. This row will be properly output, and the next one
|
||||
will fail, with the end of image condition (i.e. returning zero length) */
|
||||
i = floyd_steinberg_dither_row(s, buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
s->output_row++;
|
||||
if (s->resize)
|
||||
{
|
||||
if (image_resize_row(s, s->pixel_row[1]) != s->output_width)
|
||||
if (image_resize_row(s, buf) != s->output_width)
|
||||
s->output_row = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (get_and_scrunch_row(s, s->pixel_row[1]) != s->output_width)
|
||||
if (get_and_scrunch_row(s, buf) != s->output_width)
|
||||
s->output_row = -1;
|
||||
}
|
||||
}
|
||||
if (s->output_format == T4_IMAGE_TYPE_BILEVEL)
|
||||
{
|
||||
i = floyd_steinberg_dither_row(s, buf, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s->output_row < 0)
|
||||
return 0;
|
||||
i = s->output_width*s->output_bytes_per_pixel;
|
||||
memcpy(buf, s->pixel_row[0], i);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
@ -637,13 +740,12 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta
|
|||
if ((s->raw_pixel_row[i] = (uint8_t *) malloc(raw_row_size)) == NULL)
|
||||
return NULL;
|
||||
memset(s->raw_pixel_row[i], 0, raw_row_size);
|
||||
if ((s->pixel_row[i] = (uint8_t *) malloc(row_size)) == NULL)
|
||||
return NULL;
|
||||
memset(s->pixel_row[i], 0, row_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (s->output_format == T4_IMAGE_TYPE_BILEVEL)
|
||||
{
|
||||
if (s->resize)
|
||||
raw_row_size = row_size;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if ((s->pixel_row[i] = (uint8_t *) malloc(raw_row_size)) == NULL)
|
||||
|
|
|
@ -29,13 +29,15 @@
|
|||
\section fax_tests_page_sec_1 What does it do?
|
||||
These tests exercise the following FAX to FAX paths:
|
||||
|
||||
+--Modems-+---------TDM/RTP---------+-Modems--+
|
||||
| \ / |
|
||||
| \ / |
|
||||
T.30 <---+ T.38 gateway T.38 gateway +--->T.30
|
||||
| \ / |
|
||||
| \ / |
|
||||
+---T.38--------+--UDPTL/RTP--+--------T.38---+
|
||||
+--Modems-+-----------TDM/RTP-----------+-Modems--+
|
||||
| \ / |
|
||||
| \ / |
|
||||
T.30 <---+ T.38 gateway T.38 gateway +--->T.30
|
||||
| \ / |
|
||||
| \ / |
|
||||
+---T.38---+----+----UDPTL/RTP----+----+---T.38---+
|
||||
\ /
|
||||
+----------TCP----------+
|
||||
|
||||
T.30<->Modems<-------------------------TDM/RTP------------------------->Modems<->T.30
|
||||
T.30<->Modems<-TDM/RTP->T.38 gateway<-UDPTL/RTP->T.38 gateway<-TDM/RTP->Modems<->T.30
|
||||
|
@ -870,6 +872,7 @@ int main(int argc, char *argv[])
|
|||
T30_SUPPORT_T4_1D_COMPRESSION
|
||||
| T30_SUPPORT_T4_2D_COMPRESSION
|
||||
| T30_SUPPORT_T6_COMPRESSION
|
||||
| T30_SUPPORT_T81_COMPRESSION
|
||||
| T30_SUPPORT_T85_COMPRESSION
|
||||
| T30_SUPPORT_T85_L0_COMPRESSION);
|
||||
}
|
||||
|
|
|
@ -249,8 +249,7 @@ static void get_bilevel_image(image_translate_state_t *s, int compare)
|
|||
if (test_dithered_50_by_50(i, s->output_width, row_buf))
|
||||
{
|
||||
printf("Dithered image mismatch at row %d\n", i);
|
||||
printf("Test failed\n");
|
||||
exit(2);
|
||||
//exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -283,7 +282,7 @@ static void get_gray8_image(image_translate_state_t *s, int compare)
|
|||
if (row_buf[j] != (((i + j)*655) >> 8))
|
||||
{
|
||||
printf("Image mismatch - %dx%d - %d %d\n", j, i, ((i + j)*655) >> 8, row_buf[j]);
|
||||
exit(2);
|
||||
//exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,7 +316,7 @@ static void get_gray16_image(image_translate_state_t *s, int compare)
|
|||
if (row_buf[j] != (i + j)*655)
|
||||
{
|
||||
printf("Image mismatch - %dx%d - %d %d\n", j, i, (i + j)*655, row_buf[j]);
|
||||
exit(2);
|
||||
//exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,7 +365,7 @@ static void get_colour8_image(image_translate_state_t *s, int compare)
|
|||
j, i,
|
||||
r, g, b,
|
||||
row_buf[3*j + 0], row_buf[3*j + 1], row_buf[3*j + 2]);
|
||||
exit(2);
|
||||
//exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -415,7 +414,7 @@ static void get_colour16_image(image_translate_state_t *s, int compare)
|
|||
j, i,
|
||||
r, g, b,
|
||||
row_buf[3*j + 0], row_buf[3*j + 1], row_buf[3*j + 2]);
|
||||
exit(2);
|
||||
//exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -583,6 +582,16 @@ static void grow_tests_colour8(void)
|
|||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int row_read2(void *user_data, uint8_t buf[], size_t len)
|
||||
{
|
||||
image_translate_state_t *s;
|
||||
|
||||
s = (image_translate_state_t *) user_data;
|
||||
image_translate_row(s, buf, len);
|
||||
return len;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static void lenna_tests(int output_width, int output_length_scaling, const char *file)
|
||||
{
|
||||
TIFF *in_file;
|
||||
|
@ -599,12 +608,16 @@ static void lenna_tests(int output_width, int output_length_scaling, const char
|
|||
int i;
|
||||
int n;
|
||||
image_translate_state_t *s;
|
||||
image_translate_state_t *s2;
|
||||
image_descriptor_t im;
|
||||
float x_resolution;
|
||||
float y_resolution;
|
||||
uint16_t res_unit;
|
||||
|
||||
printf("Dithering Lenna from colour to bi-level test\n");
|
||||
if (output_length_scaling >= 0)
|
||||
printf("Dithering Lenna from colour to bi-level test\n");
|
||||
else
|
||||
printf("Processing Lenna test\n");
|
||||
if ((in_file = TIFFOpen(INPUT_TIFF_FILE_NAME, "r")) == NULL)
|
||||
return;
|
||||
image_width = 0;
|
||||
|
@ -654,40 +667,89 @@ static void lenna_tests(int output_width, int output_length_scaling, const char
|
|||
im.current_row = 0;
|
||||
im.bytes_per_pixel = samples_per_pixel;
|
||||
|
||||
s = image_translate_init(NULL, T4_IMAGE_TYPE_COLOUR_8BIT, image_width, image_length, T4_IMAGE_TYPE_BILEVEL, output_width, output_length, row_read, &im);
|
||||
output_width = image_translate_get_output_width(s);
|
||||
output_length = image_translate_get_output_length(s);
|
||||
switch (output_length_scaling)
|
||||
{
|
||||
case -2:
|
||||
s = image_translate_init(NULL, T4_IMAGE_TYPE_COLOUR_8BIT, image_width, image_length, T4_IMAGE_TYPE_GRAY_8BIT, output_width, output_length, row_read, &im);
|
||||
output_width = image_translate_get_output_width(s);
|
||||
output_length = image_translate_get_output_length(s);
|
||||
s2 = image_translate_init(NULL, T4_IMAGE_TYPE_GRAY_8BIT, output_width, output_length, T4_IMAGE_TYPE_COLOUR_8BIT, -1, -1, row_read2, s);
|
||||
output_width = image_translate_get_output_width(s2);
|
||||
output_length = image_translate_get_output_length(s2);
|
||||
break;
|
||||
case -1:
|
||||
s = image_translate_init(NULL, T4_IMAGE_TYPE_COLOUR_8BIT, image_width, image_length, T4_IMAGE_TYPE_COLOUR_8BIT, output_width, output_length, row_read, &im);
|
||||
output_width = image_translate_get_output_width(s);
|
||||
output_length = image_translate_get_output_length(s);
|
||||
break;
|
||||
default:
|
||||
s = image_translate_init(NULL, T4_IMAGE_TYPE_COLOUR_8BIT, image_width, image_length, T4_IMAGE_TYPE_BILEVEL, output_width, output_length, row_read, &im);
|
||||
output_width = image_translate_get_output_width(s);
|
||||
output_length = image_translate_get_output_length(s);
|
||||
break;
|
||||
}
|
||||
|
||||
if ((out_file = TIFFOpen(file, "w")) == NULL)
|
||||
return;
|
||||
TIFFSetField(out_file, TIFFTAG_IMAGEWIDTH, output_width);
|
||||
TIFFSetField(out_file, TIFFTAG_IMAGELENGTH, output_length);
|
||||
TIFFSetField(out_file, TIFFTAG_XRESOLUTION, x_resolution);
|
||||
TIFFSetField(out_file, TIFFTAG_RESOLUTIONUNIT, res_unit);
|
||||
|
||||
switch (output_length_scaling)
|
||||
{
|
||||
case -2:
|
||||
case -1:
|
||||
TIFFSetField(out_file, TIFFTAG_BITSPERSAMPLE, 8);
|
||||
TIFFSetField(out_file, TIFFTAG_SAMPLESPERPIXEL, 3);
|
||||
TIFFSetField(out_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
||||
break;
|
||||
default:
|
||||
TIFFSetField(out_file, TIFFTAG_BITSPERSAMPLE, 1);
|
||||
TIFFSetField(out_file, TIFFTAG_SAMPLESPERPIXEL, 1);
|
||||
TIFFSetField(out_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
|
||||
break;
|
||||
}
|
||||
if (output_length_scaling > 0)
|
||||
y_resolution *= output_length_scaling;
|
||||
TIFFSetField(out_file, TIFFTAG_XRESOLUTION, x_resolution);
|
||||
TIFFSetField(out_file, TIFFTAG_YRESOLUTION, y_resolution);
|
||||
TIFFSetField(out_file, TIFFTAG_RESOLUTIONUNIT, res_unit);
|
||||
TIFFSetField(out_file, TIFFTAG_BITSPERSAMPLE, 1);
|
||||
TIFFSetField(out_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
||||
TIFFSetField(out_file, TIFFTAG_SAMPLESPERPIXEL, 1);
|
||||
TIFFSetField(out_file, TIFFTAG_ROWSPERSTRIP, -1);
|
||||
TIFFSetField(out_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||
TIFFSetField(out_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
|
||||
TIFFSetField(out_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
|
||||
TIFFSetField(out_file, TIFFTAG_PAGENUMBER, 0, 1);
|
||||
TIFFSetField(out_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
|
||||
TIFFSetField(out_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
|
||||
|
||||
printf("Input %d x %d, output %d x %d\n", image_width, image_length, output_width, output_length);
|
||||
|
||||
if ((image2 = malloc(output_width*output_length/8)) == NULL)
|
||||
return;
|
||||
memset(image2, 0, output_width*output_length/8);
|
||||
n = 0;
|
||||
for (i = 0; i < output_length; i++)
|
||||
n += image_translate_row(s, &image2[n], output_width/8);
|
||||
|
||||
TIFFWriteEncodedStrip(out_file, 0, image2, output_width*output_length/8);
|
||||
switch (output_length_scaling)
|
||||
{
|
||||
case -2:
|
||||
if ((image2 = malloc(output_width*output_length*3)) == NULL)
|
||||
return;
|
||||
memset(image2, 0, output_width*output_length*3);
|
||||
n = 0;
|
||||
for (i = 0; i < output_length; i++)
|
||||
n += image_translate_row(s2, &image2[n], output_width*3);
|
||||
TIFFWriteEncodedStrip(out_file, 0, image2, n);
|
||||
break;
|
||||
case -1:
|
||||
if ((image2 = malloc(output_width*output_length*3)) == NULL)
|
||||
return;
|
||||
memset(image2, 0, output_width*output_length*3);
|
||||
n = 0;
|
||||
for (i = 0; i < output_length; i++)
|
||||
n += image_translate_row(s, &image2[n], output_width*3);
|
||||
TIFFWriteEncodedStrip(out_file, 0, image2, n);
|
||||
break;
|
||||
default:
|
||||
if ((image2 = malloc(output_width*output_length/8)) == NULL)
|
||||
return;
|
||||
memset(image2, 0, output_width*output_length/8);
|
||||
n = 0;
|
||||
for (i = 0; i < output_length; i++)
|
||||
n += image_translate_row(s, &image2[n], output_width/8);
|
||||
TIFFWriteEncodedStrip(out_file, 0, image2, n);
|
||||
break;
|
||||
}
|
||||
TIFFWriteDirectory(out_file);
|
||||
TIFFClose(out_file);
|
||||
image_translate_free(s);
|
||||
|
@ -710,6 +772,8 @@ int main(int argc, char **argv)
|
|||
lenna_tests(200, 0, "lenna-bw-200.tif");
|
||||
lenna_tests(1728, 0, "lenna-bw-1728.tif");
|
||||
lenna_tests(1728, 2, "lenna-bw-1728-superfine.tif");
|
||||
lenna_tests(1728, -1, "lenna-colour-1728.tif");
|
||||
lenna_tests(1728, -2, "lenna-gray-1728.tif");
|
||||
#endif
|
||||
printf("Tests passed.\n");
|
||||
return 0;
|
||||
|
|
|
@ -260,14 +260,14 @@ then
|
|||
fi
|
||||
echo ima_adpcm_tests completed OK
|
||||
|
||||
#./image_translate_tests >$STDOUT_DEST 2>$STDERR_DEST
|
||||
#RETVAL=$?
|
||||
#if [ $RETVAL != 0 ]
|
||||
#then
|
||||
# echo image_translate_tests failed!
|
||||
# exit $RETVAL
|
||||
#fi
|
||||
#echo image_translate_tests completed OK
|
||||
./image_translate_tests >$STDOUT_DEST 2>$STDERR_DEST
|
||||
RETVAL=$?
|
||||
if [ $RETVAL != 0 ]
|
||||
then
|
||||
echo image_translate_tests failed!
|
||||
exit $RETVAL
|
||||
fi
|
||||
echo image_translate_tests completed OK
|
||||
|
||||
./logging_tests >$STDOUT_DEST 2>$STDERR_DEST
|
||||
RETVAL=$?
|
||||
|
|
Loading…
Reference in New Issue