123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401 |
- #!/bin/sh
- #
- # spandsp fax tests
- #
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU Lesser General Public License version 2.1,
- # as published by the Free Software Foundation.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU Lesser General Public
- # License along with this program; if not, write to the Free Software
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- run_fax_test()
- {
- rm -f fax_tests.tif
- echo ./fax_tests ${OPTS} -i ${FILE}
- ./fax_tests ${OPTS} -i ${FILE} >xyzzy 2>xyzzy2
- RETVAL=$?
- if [ $RETVAL != 0 ]
- then
- echo fax_tests failed!
- exit $RETVAL
- fi
- # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
- # option means the normal differences in tags will be ignored.
- ${TIFFCMP} -t ${FILE} fax_tests.tif >/dev/null
- RETVAL=$?
- if [ $RETVAL != 0 ]
- then
- echo fax_tests failed!
- exit $RETVAL
- fi
- rm -f fax_tests.tif
- echo tested ${FILE}
- }
- run_fax_squash_test()
- {
- # Test with lengthwise squashing of a bilevel image
- rm -f fax_tests.tif
- echo ./fax_tests -b ${SQ} -b ${SQ} ${OPTS} -i ${IN_FILE}
- ./fax_tests -b ${SQ} ${OPTS} -i ${IN_FILE} >xyzzy 2>xyzzy2
- RETVAL=$?
- if [ $RETVAL != 0 ]
- then
- echo fax_tests failed!
- exit $RETVAL
- fi
- # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
- # option means the normal differences in tags will be ignored.
- ${TIFFCMP} -t ${OUT_FILE} fax_tests.tif >/dev/null
- RETVAL=$?
- if [ $RETVAL != 0 ]
- then
- echo fax_tests failed!
- exit $RETVAL
- fi
- rm -f fax_tests.tif
- echo tested ${FILE}
- }
- run_colour_fax_test()
- {
- rm -f fax_tests.tif
- echo ./fax_tests ${OPTS} -i ${IN_FILE}
- ./fax_tests ${OPTS} -i ${IN_FILE} >xyzzy 2>xyzzy2
- RETVAL=$?
- if [ $RETVAL != 0 ]
- then
- echo fax_tests failed!
- exit $RETVAL
- fi
- # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
- # option means the normal differences in tags will be ignored.
- ${TIFFCMP} -t ${OUT_FILE} fax_tests.tif >/dev/null
- RETVAL=$?
- if [ $RETVAL != 0 ]
- then
- echo fax_tests failed!
- exit $RETVAL
- fi
- rm -f fax_tests.tif
- echo tested ${IN_FILE} to ${OUT_FILE}
- }
- ITUTESTS_DIR=../test-data/itu/fax
- TIFFFX_DIR=../test-data/itu/tiff-fx
- LOCALTESTS_DIR=../test-data/local
- TIFFCMP=tiffcmp
- # Colour/gray -> bilevel by not allowing ECM
- #for OPTS in "-p FAX-FAX" "-p T38-T38" "-p FAX-T38gateway-T38gateway-FAX" "-p T38-T38gateway-FAX" "-p FAX-T38gateway-T38"
- #do
- # IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
- # OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-bilevel.tif"
- # run_colour_fax_test
- # IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif"
- # OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif"
- # run_colour_fax_test
- # IN_FILE="${TIFFFX_DIR}/c03x_02x.tif"
- # OUT_FILE="${TIFFFX_DIR}/c03x_02x-bilevel.tif"
- # run_colour_fax_test
- # IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
- # OUT_FILE="${TIFFFX_DIR}/l02x_02x-bilevel.tif"
- # run_colour_fax_test
- # IN_FILE="${TIFFFX_DIR}/l04x_02x.tif"
- # OUT_FILE="${TIFFFX_DIR}/l04x_02x-bilevel.tif"
- # run_colour_fax_test
- #done
- # Colour/gray -> colour/gray
- #for OPTS in "-p FAX-FAX -C -e" "-p T38-T38 -C -e" "-p FAX-T38gateway-T38gateway-FAX -C -e" "-p T38-T38gateway-FAX -C -e" "-p FAX-T38gateway-T38 -C -e"
- #do
- # IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
- # OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-out.tif"
- # run_colour_fax_test
- # IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif"
- # OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-out.tif"
- # run_colour_fax_test
- # IN_FILE="${TIFFFX_DIR}/c03x_02x.tif"
- # OUT_FILE="${TIFFFX_DIR}/c03x_02x-out.tif"
- # run_colour_fax_test
- # IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
- # OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif"
- # run_colour_fax_test
- # IN_FILE="${TIFFFX_DIR}/l04x_02x.tif"
- # OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif"
- # run_colour_fax_test
- #done
- # Bi-level tests with image squashing
- for OPTS in "-p FAX-FAX" "-p FAX-FAX -e" "-p T38-T38" "-p T38-T38 -e" "-p FAX-T38gateway-T38gateway-FAX" "-p FAX-T38gateway-T38gateway-FAX -e" "-p T38-T38gateway-FAX" "-p T38-T38gateway-FAX -e" "-p FAX-T38gateway-T38" "-p FAX-T38gateway-T38 -e"
- do
- IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_A4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_A4.tif"
- SQ=4
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_B4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_B4.tif"
- SQ=4
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_A3.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_A3.tif"
- SQ=4
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_A4.tif"
- SQ=3
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_B4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_B4.tif"
- SQ=3
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A3.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_A3.tif"
- SQ=3
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_A4.tif"
- SQ=4
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_B4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_B4.tif"
- SQ=4
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A3.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_A3.tif"
- SQ=4
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_A4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_A4.tif"
- SQ=4
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_B4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_B4.tif"
- SQ=4
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_A3.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_A3.tif"
- SQ=4
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_A4.tif"
- SQ=3
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_B4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_B4.tif"
- SQ=3
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A3.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_A3.tif"
- SQ=3
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_A4.tif"
- SQ=4
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_B4.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_B4.tif"
- SQ=4
- run_fax_squash_test
- IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A3.tif"
- OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_A3.tif"
- SQ=4
- run_fax_squash_test
- done
- # Bi-level tests
- for OPTS in "-p FAX-FAX" "-p FAX-FAX -e" "-p T38-T38" "-p T38-T38 -e" "-p FAX-T38gateway-T38gateway-FAX" "-p FAX-T38gateway-T38gateway-FAX -e" "-p T38-T38gateway-FAX" "-p T38-T38gateway-FAX -e" "-p FAX-T38gateway-T38" "-p FAX-T38gateway-T38 -e"
- do
- FILE="${ITUTESTS_DIR}/itutests.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/100pages.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/striped.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/mixed_size_pages.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R8_385_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R8_385_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R8_385_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R8_77_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R8_77_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R8_77_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R8_154_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R8_154_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R8_154_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R16_154_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R16_154_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_R16_154_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_200_100_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_200_100_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_200_100_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_200_200_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_200_200_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_200_200_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_200_400_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_200_400_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_200_400_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_300_300_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_300_300_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_300_300_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_300_600_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_300_600_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_300_600_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_400_400_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_400_400_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_400_400_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_400_800_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_400_800_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_400_800_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_600_600_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_600_600_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_600_600_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_600_1200_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_600_1200_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_600_1200_A3.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_1200_1200_A4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_1200_1200_B4.tif"
- run_fax_test
- FILE="${ITUTESTS_DIR}/bilevel_1200_1200_A3.tif"
- run_fax_test
- done
- echo
- echo All fax tests successfully completed
|