SmartPDF - lightweight pdf viewer app for rosapps
authorKlemens Friedl <frik85@gmail.com>
Sat, 29 Sep 2007 08:39:35 +0000 (08:39 +0000)
committerKlemens Friedl <frik85@gmail.com>
Sat, 29 Sep 2007 08:39:35 +0000 (08:39 +0000)
* sumatrapdf - vendor import
* everything compiles (libjpeg, poppler, fitz, sumatrapdf)
* does NOT link

(remove the comment tags in the parent directory.rbuild file (rosapps dir) to build it)

svn path=/trunk/; revision=29295

651 files changed:
rosapps/directory.rbuild
rosapps/lib/directory.rbuild
rosapps/lib/libjpeg/LibJPEG.dsp [new file with mode: 0644]
rosapps/lib/libjpeg/LibJPEG.vcproj [new file with mode: 0644]
rosapps/lib/libjpeg/ansi2knr.c [new file with mode: 0644]
rosapps/lib/libjpeg/cderror.h [new file with mode: 0644]
rosapps/lib/libjpeg/cdjpeg.c [new file with mode: 0644]
rosapps/lib/libjpeg/cdjpeg.h [new file with mode: 0644]
rosapps/lib/libjpeg/change.log [new file with mode: 0644]
rosapps/lib/libjpeg/cjpeg.c [new file with mode: 0644]
rosapps/lib/libjpeg/ckconfig.c [new file with mode: 0644]
rosapps/lib/libjpeg/djpeg.c [new file with mode: 0644]
rosapps/lib/libjpeg/example.c [new file with mode: 0644]
rosapps/lib/libjpeg/jcapimin.c [new file with mode: 0644]
rosapps/lib/libjpeg/jcapistd.c [new file with mode: 0644]
rosapps/lib/libjpeg/jccoefct.c [new file with mode: 0644]
rosapps/lib/libjpeg/jccolor.c [new file with mode: 0644]
rosapps/lib/libjpeg/jcdctmgr.c [new file with mode: 0644]
rosapps/lib/libjpeg/jchuff.c [new file with mode: 0644]
rosapps/lib/libjpeg/jchuff.h [new file with mode: 0644]
rosapps/lib/libjpeg/jcinit.c [new file with mode: 0644]
rosapps/lib/libjpeg/jcmainct.c [new file with mode: 0644]
rosapps/lib/libjpeg/jcmarker.c [new file with mode: 0644]
rosapps/lib/libjpeg/jcmaster.c [new file with mode: 0644]
rosapps/lib/libjpeg/jcomapi.c [new file with mode: 0644]
rosapps/lib/libjpeg/jconfig.h [new file with mode: 0644]
rosapps/lib/libjpeg/jcparam.c [new file with mode: 0644]
rosapps/lib/libjpeg/jcphuff.c [new file with mode: 0644]
rosapps/lib/libjpeg/jcprepct.c [new file with mode: 0644]
rosapps/lib/libjpeg/jcsample.c [new file with mode: 0644]
rosapps/lib/libjpeg/jctrans.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdapimin.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdapistd.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdatadst.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdatasrc.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdcoefct.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdcolor.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdct.h [new file with mode: 0644]
rosapps/lib/libjpeg/jddctmgr.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdhuff.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdhuff.h [new file with mode: 0644]
rosapps/lib/libjpeg/jdinput.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdmainct.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdmarker.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdmaster.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdmerge.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdphuff.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdpostct.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdsample.c [new file with mode: 0644]
rosapps/lib/libjpeg/jdtrans.c [new file with mode: 0644]
rosapps/lib/libjpeg/jerror.c [new file with mode: 0644]
rosapps/lib/libjpeg/jerror.h [new file with mode: 0644]
rosapps/lib/libjpeg/jfdctflt.c [new file with mode: 0644]
rosapps/lib/libjpeg/jfdctfst.c [new file with mode: 0644]
rosapps/lib/libjpeg/jfdctint.c [new file with mode: 0644]
rosapps/lib/libjpeg/jidctflt.c [new file with mode: 0644]
rosapps/lib/libjpeg/jidctfst.c [new file with mode: 0644]
rosapps/lib/libjpeg/jidctint.c [new file with mode: 0644]
rosapps/lib/libjpeg/jidctred.c [new file with mode: 0644]
rosapps/lib/libjpeg/jinclude.h [new file with mode: 0644]
rosapps/lib/libjpeg/jmemansi.c [new file with mode: 0644]
rosapps/lib/libjpeg/jmemdos.c [new file with mode: 0644]
rosapps/lib/libjpeg/jmemdosa.asm [new file with mode: 0644]
rosapps/lib/libjpeg/jmemmac.c [new file with mode: 0644]
rosapps/lib/libjpeg/jmemmgr.c [new file with mode: 0644]
rosapps/lib/libjpeg/jmemname.c [new file with mode: 0644]
rosapps/lib/libjpeg/jmemnobs.c [new file with mode: 0644]
rosapps/lib/libjpeg/jmemsys.h [new file with mode: 0644]
rosapps/lib/libjpeg/jmorecfg.h [new file with mode: 0644]
rosapps/lib/libjpeg/jpegint.h [new file with mode: 0644]
rosapps/lib/libjpeg/jpeglib.h [new file with mode: 0644]
rosapps/lib/libjpeg/jpegtran.c [new file with mode: 0644]
rosapps/lib/libjpeg/jquant1.c [new file with mode: 0644]
rosapps/lib/libjpeg/jquant2.c [new file with mode: 0644]
rosapps/lib/libjpeg/jutils.c [new file with mode: 0644]
rosapps/lib/libjpeg/jversion.h [new file with mode: 0644]
rosapps/lib/libjpeg/libjpeg.rbuild [new file with mode: 0644]
rosapps/lib/libjpeg/rdbmp.c [new file with mode: 0644]
rosapps/lib/libjpeg/rdcolmap.c [new file with mode: 0644]
rosapps/lib/libjpeg/rdgif.c [new file with mode: 0644]
rosapps/lib/libjpeg/rdjpgcom.c [new file with mode: 0644]
rosapps/lib/libjpeg/rdppm.c [new file with mode: 0644]
rosapps/lib/libjpeg/rdrle.c [new file with mode: 0644]
rosapps/lib/libjpeg/rdswitch.c [new file with mode: 0644]
rosapps/lib/libjpeg/rdtarga.c [new file with mode: 0644]
rosapps/lib/libjpeg/transupp.c [new file with mode: 0644]
rosapps/lib/libjpeg/transupp.h [new file with mode: 0644]
rosapps/lib/libjpeg/wrbmp.c [new file with mode: 0644]
rosapps/lib/libjpeg/wrgif.c [new file with mode: 0644]
rosapps/lib/libjpeg/wrjpgcom.c [new file with mode: 0644]
rosapps/lib/libjpeg/wrppm.c [new file with mode: 0644]
rosapps/lib/libjpeg/wrrle.c [new file with mode: 0644]
rosapps/lib/libjpeg/wrtarga.c [new file with mode: 0644]
rosapps/smartpdf/COPYING [new file with mode: 0644]
rosapps/smartpdf/baseutils/WinUtil.cpp [new file with mode: 0644]
rosapps/smartpdf/baseutils/WinUtil.hpp [new file with mode: 0644]
rosapps/smartpdf/baseutils/base_util.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/base_util.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/common_unit_tests.sln [new file with mode: 0644]
rosapps/smartpdf/baseutils/common_unit_tests.vcproj [new file with mode: 0644]
rosapps/smartpdf/baseutils/dstring.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/dstring.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/file_util.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/file_util.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/geom_util.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/geom_util.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/log_util.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/log_util.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/makefile.msvc [new file with mode: 0644]
rosapps/smartpdf/baseutils/ms_ui_helper.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/ms_ui_helper.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/ms_ui_shguim.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/netstr.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/netstr.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/netstr_ut.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/pdiff.cc [new file with mode: 0644]
rosapps/smartpdf/baseutils/pdiff.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/prefs_util.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/prefs_util.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/str_strsafe.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/str_util.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/str_util.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/str_util_test.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/strlist_util.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/strlist_util.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/test_file_util.cpp [new file with mode: 0644]
rosapps/smartpdf/baseutils/test_win.bat [new file with mode: 0644]
rosapps/smartpdf/baseutils/todo.txt [new file with mode: 0644]
rosapps/smartpdf/baseutils/tstr_util.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/unit_tests_all.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/win-build.bat [new file with mode: 0644]
rosapps/smartpdf/baseutils/win-rebuild.bat [new file with mode: 0644]
rosapps/smartpdf/baseutils/win_dib.cpp [new file with mode: 0644]
rosapps/smartpdf/baseutils/win_dib.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/win_image.cpp [new file with mode: 0644]
rosapps/smartpdf/baseutils/win_image.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/win_util.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/win_util.h [new file with mode: 0644]
rosapps/smartpdf/baseutils/wstr_util.c [new file with mode: 0644]
rosapps/smartpdf/baseutils/wstr_util.h [new file with mode: 0644]
rosapps/smartpdf/fitz.rbuild [new file with mode: 0644]
rosapps/smartpdf/fitz/COPYING [new file with mode: 0644]
rosapps/smartpdf/fitz/DESIGN [new file with mode: 0644]
rosapps/smartpdf/fitz/Makefile.vc [new file with mode: 0644]
rosapps/smartpdf/fitz/README [new file with mode: 0644]
rosapps/smartpdf/fitz/TODO [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/common/pdfapp.c [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/macosx/FzView.app/Contents/Info.plist [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/macosx/FzView.app/Contents/MacOS/.gitignore [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/macosx/FzView.app/Contents/PkgInfo [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/macosx/FzView.app/Contents/Resources/English.lproj/InfoPlist.strings [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/macosx/FzView.app/Contents/Resources/English.lproj/main.nib/classes.nib [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/macosx/FzView.app/Contents/Resources/English.lproj/main.nib/info.nib [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/macosx/FzView.app/Contents/Resources/English.lproj/main.nib/objects.xib [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/macosx/FzView.app/Contents/Resources/macpdf.icns [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/macosx/macpdf.c [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/mozilla/jri.h [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/mozilla/moz_main.c [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/mozilla/moz_winres.rc [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/mozilla/npapi.h [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/mozilla/npunix.c [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/mozilla/npupp.h [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/mozilla/npwin.c [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/pdftool.c [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/samshow.c [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/unix/gs_l.xbm [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/unix/x11pdf.c [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/unix/ximage.c [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/windows/gsapp.ico [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/windows/gsdoc.ico [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/windows/winmain.c [new file with mode: 0644]
rosapps/smartpdf/fitz/apps/windows/winres.rc [new file with mode: 0644]
rosapps/smartpdf/fitz/base/base_cleanname.c [new file with mode: 0644]
rosapps/smartpdf/fitz/base/base_cpudep.c [new file with mode: 0644]
rosapps/smartpdf/fitz/base/base_error.c [new file with mode: 0644]
rosapps/smartpdf/fitz/base/base_hash.c [new file with mode: 0644]
rosapps/smartpdf/fitz/base/base_matrix.c [new file with mode: 0644]
rosapps/smartpdf/fitz/base/base_memory.c [new file with mode: 0644]
rosapps/smartpdf/fitz/base/base_rect.c [new file with mode: 0644]
rosapps/smartpdf/fitz/base/base_rune.c [new file with mode: 0644]
rosapps/smartpdf/fitz/base/util_getopt.c [new file with mode: 0644]
rosapps/smartpdf/fitz/base/util_strlcat.c [new file with mode: 0644]
rosapps/smartpdf/fitz/base/util_strlcpy.c [new file with mode: 0644]
rosapps/smartpdf/fitz/base/util_strsep.c [new file with mode: 0644]
rosapps/smartpdf/fitz/build-debug.bat [new file with mode: 0644]
rosapps/smartpdf/fitz/build.bat [new file with mode: 0644]
rosapps/smartpdf/fitz/clean.bat [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/Dingbats.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusMonL-Bold.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusMonL-BoldObli.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusMonL-Regu.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusMonL-ReguObli.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusRomNo9L-Medi.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusRomNo9L-MediItal.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusRomNo9L-Regu.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusRomNo9L-ReguItal.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusSanL-Bold.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusSanL-BoldItal.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusSanL-Regu.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/NimbusSanL-ReguItal.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/StandardSymL.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/fonts/URWChanceryL-MediItal.cff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz-base.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz-draw.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz-stream.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz-world.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/base_cpudep.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/base_geom.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/base_hash.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/base_math.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/base_pixmap.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/base_runtime.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/base_sysdep.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/draw_misc.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/draw_path.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/stm_buffer.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/stm_crypt.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/stm_filter.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/stm_object.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/stm_stream.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/wld_color.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/wld_font.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/wld_image.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/wld_path.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/wld_shade.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/wld_text.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/fitz/wld_tree.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/mupdf.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/mupdf/annot.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/mupdf/base14.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/mupdf/content.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/mupdf/page.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/mupdf/rsrc.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/mupdf/syntax.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/mupdf/xref.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/pdfapp.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/samus.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/samus/fixdoc.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/samus/misc.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/samus/names.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/samus/pack.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/samus/xml.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/samus/zip.h [new file with mode: 0644]
rosapps/smartpdf/fitz/include/win_os.h [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/glyphlist.txt [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_annot.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_build.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_cmap.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_colorspace1.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_colorspace2.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_crypt.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_debug.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_doctor.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_font.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_fontagl.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_fontenc.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_fontfile.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_fontfilefc.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_fontfilems.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_function.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_image.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_interpret.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_lex.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_nametree.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_open.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_outline.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_page.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_pagetree.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_parse.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_pattern.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_repair.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_resources.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_save.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_shade.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_shade1.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_shade4.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_store.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_stream.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_type3.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_unicode.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_xobject.c [new file with mode: 0644]
rosapps/smartpdf/fitz/mupdf/pdf_xref.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/archppc.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/archsparc.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/archx86.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/glyphcache.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/imagedraw.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/imagescale.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/imageunpack.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/meshdraw.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/pathfill.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/pathscan.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/pathstroke.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/pixmap.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/porterduff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/raster/render.c [new file with mode: 0644]
rosapps/smartpdf/fitz/samus/sa_fixdoc.c [new file with mode: 0644]
rosapps/smartpdf/fitz/samus/sa_misc.c [new file with mode: 0644]
rosapps/smartpdf/fitz/samus/sa_pack.c [new file with mode: 0644]
rosapps/smartpdf/fitz/samus/sa_tiff.c [new file with mode: 0644]
rosapps/smartpdf/fitz/samus/sa_xml.c [new file with mode: 0644]
rosapps/smartpdf/fitz/samus/sa_zip.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/crypt_arc4.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/crypt_crc32.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/crypt_md5.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_a85d.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_a85e.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_ahxd.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_ahxe.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_arc4.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_dctc.h [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_dctd.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_dcte.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_faxc.h [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_faxd.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_faxd.h [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_faxdtab.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_faxe.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_faxe.h [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_faxetab.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_flate.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_jbig2d.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_jpxd.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_lzwd.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_lzwe.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_null.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_pipeline.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_predict.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_rld.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/filt_rle.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/obj_array.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/obj_dict.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/obj_parse.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/obj_print.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/obj_simple.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/stm_buffer.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/stm_filter.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/stm_misc.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/stm_open.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/stm_read.c [new file with mode: 0644]
rosapps/smartpdf/fitz/stream/stm_write.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/node_misc1.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/node_misc2.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/node_optimize.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/node_path.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/node_text.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/node_tolisp.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/node_toxml.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/node_tree.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/res_colorspace.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/res_font.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/res_image.c [new file with mode: 0644]
rosapps/smartpdf/fitz/world/res_shade.c [new file with mode: 0644]
rosapps/smartpdf/fitzheadlib.vcproj [new file with mode: 0644]
rosapps/smartpdf/fitzlib.cbp [new file with mode: 0644]
rosapps/smartpdf/fitzlib.vcproj [new file with mode: 0644]
rosapps/smartpdf/pdfbench.vcproj [new file with mode: 0644]
rosapps/smartpdf/pdfbenchbase.vcproj [new file with mode: 0644]
rosapps/smartpdf/poppler.rbuild [new file with mode: 0644]
rosapps/smartpdf/poppler/AUTHORS [new file with mode: 0644]
rosapps/smartpdf/poppler/COPYING [new file with mode: 0644]
rosapps/smartpdf/poppler/ChangeLog [new file with mode: 0644]
rosapps/smartpdf/poppler/INSTALL [new file with mode: 0644]
rosapps/smartpdf/poppler/NEWS [new file with mode: 0644]
rosapps/smartpdf/poppler/README [new file with mode: 0644]
rosapps/smartpdf/poppler/README-XPDF [new file with mode: 0644]
rosapps/smartpdf/poppler/TODO [new file with mode: 0644]
rosapps/smartpdf/poppler/fofi/FoFiBase.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/fofi/FoFiBase.h [new file with mode: 0644]
rosapps/smartpdf/poppler/fofi/FoFiEncodings.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/fofi/FoFiEncodings.h [new file with mode: 0644]
rosapps/smartpdf/poppler/fofi/FoFiTrueType.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/fofi/FoFiTrueType.h [new file with mode: 0644]
rosapps/smartpdf/poppler/fofi/FoFiType1.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/fofi/FoFiType1.h [new file with mode: 0644]
rosapps/smartpdf/poppler/fofi/FoFiType1C.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/fofi/FoFiType1C.h [new file with mode: 0644]
rosapps/smartpdf/poppler/fofi/Makefile.am [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/FastAlloc.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/FastAlloc.h [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/FastFixedAllocator.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/FastFixedAllocator.h [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/FixedPoint.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/FixedPoint.h [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/GooHash.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/GooHash.h [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/GooList.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/GooList.h [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/GooMutex.h [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/GooString.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/GooString.h [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/GooTimer.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/GooTimer.h [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/GooVector.h [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/Makefile.am [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/gfile.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/gfile.h [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/gmem.c [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/gmem.h [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/gmempp.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/goo/gtypes.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Annot.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Annot.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Array.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Array.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/ArthurOutputDev.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/ArthurOutputDev.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/BaseFile.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/BuiltinFont.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/BuiltinFont.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/BuiltinFontTables.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/BuiltinFontTables.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/CMap.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/CMap.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/CairoFontEngine.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/CairoFontEngine.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/CairoOutputDev.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/CairoOutputDev.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Catalog.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Catalog.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/CharCodeToUnicode.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/CharCodeToUnicode.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/CharTypes.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/CompactFontTables.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/DCTStream.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/DCTStream.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Decrypt.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Decrypt.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Dict.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Dict.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Error.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Error.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/ErrorCodes.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/FlateStream.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/FlateStream.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/FontEncodingTables.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/FontEncodingTables.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/FontInfo.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/FontInfo.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Function.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Function.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Gfx.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Gfx.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/GfxFont.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/GfxFont.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/GfxState.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/GfxState.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/GlobalParams.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/GlobalParams.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/GlobalParamsWin.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/JArithmeticDecoder.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/JArithmeticDecoder.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/JBIG2Stream.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/JBIG2Stream.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/JPXStream.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/JPXStream.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Lexer.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Lexer.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Link.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Link.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Makefile.am [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/NameToCharCode.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/NameToCharCode.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/NameToUnicodeTable.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Object.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Object.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Outline.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Outline.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/OutputDev.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/OutputDev.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/PDFDoc.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/PDFDoc.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/PDFDocEncoding.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/PDFDocEncoding.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/PSOutputDev.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/PSOutputDev.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/PSTokenizer.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/PSTokenizer.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Page.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Page.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/PageLabelInfo.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/PageLabelInfo.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/PageTransition.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Parser.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Parser.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/ProfileData.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/ProfileData.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/SecurityHandler.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/SecurityHandler.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Sound.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Sound.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/SplashOutputDev.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/SplashOutputDev.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Stream-CCITT.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Stream.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/Stream.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/TextOutputDev.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/TextOutputDev.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/UGooString.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/UGooString.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/UTF8.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/UnicodeCClassTables.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/UnicodeCompTables.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/UnicodeDecompTables.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/UnicodeMap.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/UnicodeMap.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/UnicodeMapTables.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/UnicodeTypeTable.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/UnicodeTypeTable.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/XRef.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/XRef.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/XpdfPluginAPI.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/XpdfPluginAPI.h [new file with mode: 0644]
rosapps/smartpdf/poppler/poppler/poppler-config.h.in [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/Makefile.am [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/Splash.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/Splash.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashBitmap.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashBitmap.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashClip.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashClip.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashErrorCodes.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFTFont.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFTFont.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFTFontEngine.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFTFontEngine.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFTFontFile.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFTFontFile.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFont.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFont.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFontEngine.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFontEngine.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFontFile.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFontFile.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFontFileID.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashFontFileID.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashGlyphBitmap.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashMath.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashPath.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashPath.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashPattern.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashPattern.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashScreen.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashScreen.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashState.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashState.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashT1Font.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashT1Font.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashT1FontEngine.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashT1FontEngine.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashT1FontFile.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashT1FontFile.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashTypes.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashXPath.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashXPath.h [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashXPathScanner.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/splash/SplashXPathScanner.h [new file with mode: 0644]
rosapps/smartpdf/poppler/test/Makefile.am [new file with mode: 0644]
rosapps/smartpdf/poppler/test/gtk-cairo-test.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/test/gtk-splash-test.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/test/pdf-inspector.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/test/pdf-inspector.glade [new file with mode: 0644]
rosapps/smartpdf/poppler/test/pdf-operators.c [new file with mode: 0644]
rosapps/smartpdf/poppler/test/pdfbench.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/HtmlFonts.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/HtmlFonts.h [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/HtmlLinks.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/HtmlLinks.h [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/HtmlOutputDev.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/HtmlOutputDev.h [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/ImageOutputDev.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/ImageOutputDev.h [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/Makefile.am [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/parseargs.c [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/parseargs.h [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdf2xml.dtd [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdffonts.1 [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdffonts.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdfimages.1 [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdfimages.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdfinfo.1 [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdfinfo.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdftohtml.1 [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdftohtml.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdftoppm.1 [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdftoppm.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdftops.1 [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdftops.cc [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdftotext.1 [new file with mode: 0644]
rosapps/smartpdf/poppler/utils/pdftotext.cc [new file with mode: 0644]
rosapps/smartpdf/popplerlib.cbp [new file with mode: 0644]
rosapps/smartpdf/popplerlib.vcproj [new file with mode: 0644]
rosapps/smartpdf/smartpdf.def [new file with mode: 0644]
rosapps/smartpdf/smartpdf.rbuild [new file with mode: 0644]
rosapps/smartpdf/src/AppPrefs.cc [new file with mode: 0644]
rosapps/smartpdf/src/AppPrefs.h [new file with mode: 0644]
rosapps/smartpdf/src/DisplayModel.cc [new file with mode: 0644]
rosapps/smartpdf/src/DisplayModel.h [new file with mode: 0644]
rosapps/smartpdf/src/DisplayModelFitz.cc [new file with mode: 0644]
rosapps/smartpdf/src/DisplayModelFitz.h [new file with mode: 0644]
rosapps/smartpdf/src/DisplayModelSplash.cc [new file with mode: 0644]
rosapps/smartpdf/src/DisplayModelSplash.h [new file with mode: 0644]
rosapps/smartpdf/src/DisplayState.cc [new file with mode: 0644]
rosapps/smartpdf/src/DisplayState.h [new file with mode: 0644]
rosapps/smartpdf/src/FileHistory.cc [new file with mode: 0644]
rosapps/smartpdf/src/FileHistory.h [new file with mode: 0644]
rosapps/smartpdf/src/Kopie von SumatraPDF.cpp [new file with mode: 0644]
rosapps/smartpdf/src/PdfEngine.cc [new file with mode: 0644]
rosapps/smartpdf/src/PdfEngine.h [new file with mode: 0644]
rosapps/smartpdf/src/PdftestWinPreview.cc [new file with mode: 0644]
rosapps/smartpdf/src/Resource.h [new file with mode: 0644]
rosapps/smartpdf/src/SumatraDialogs.cc [new file with mode: 0644]
rosapps/smartpdf/src/SumatraDialogs.h [new file with mode: 0644]
rosapps/smartpdf/src/SumatraPDF.aps [new file with mode: 0644]
rosapps/smartpdf/src/SumatraPDF.cpp [new file with mode: 0644]
rosapps/smartpdf/src/SumatraPDF.h [new file with mode: 0644]
rosapps/smartpdf/src/SumatraPDF.ico [new file with mode: 0644]
rosapps/smartpdf/src/SumatraPDF.rc [new file with mode: 0644]
rosapps/smartpdf/src/build-release.bat [new file with mode: 0644]
rosapps/smartpdf/src/config.h [new file with mode: 0644]
rosapps/smartpdf/src/dragcursor.cur [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/Thumbs.db [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/folder.bmp [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/folder.png [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/next.bmp [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/next.png [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/previous.bmp [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/previous.png [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/printer.png [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/rotate_anticlock.png [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/rotate_cloc.png [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/zoom_in.bmp [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/zoom_in.png [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/zoom_out.bmp [new file with mode: 0644]
rosapps/smartpdf/src/icons-silk/zoom_out.png [new file with mode: 0644]
rosapps/smartpdf/src/pdfbench.cc [new file with mode: 0644]
rosapps/smartpdf/src/poppler-config.h [new file with mode: 0644]
rosapps/smartpdf/src/strings.txt [new file with mode: 0644]
rosapps/smartpdf/src/todo.txt [new file with mode: 0644]
rosapps/smartpdf/src/toolbar-disabled.bmp [new file with mode: 0644]
rosapps/smartpdf/src/toolbar.bmp [new file with mode: 0644]
rosapps/smartpdf/src/translations.cpp [new file with mode: 0644]
rosapps/smartpdf/src/translations.h [new file with mode: 0644]
rosapps/smartpdf/src/translations_txt.c [new file with mode: 0644]
rosapps/smartpdf/src/translations_txt.h [new file with mode: 0644]
rosapps/smartpdf/sumatrapdf.cbp [new file with mode: 0644]
rosapps/smartpdf/sumatrapdf.sln [new file with mode: 0644]
rosapps/smartpdf/sumatrapdf.vcproj [new file with mode: 0644]
rosapps/smartpdf/sumatrapdfdll.sln [new file with mode: 0644]
rosapps/smartpdf/sumatrapdfdll.vcproj [new file with mode: 0644]

index ba7b0e2..f4dd9e6 100644 (file)
        <directory name="imagesoft">
                <xi:include href="imagesoft/imagesoft.rbuild" />
        </directory>
-
-       <!--
+       
        <directory name="lib">
                <xi:include href="lib/directory.rbuild" />
        </directory>
-       -->
 
        <directory name="logevent">
                <xi:include href="logevent/logevent.rbuild" />
        <directory name="winver">
                <xi:include href="winver/winver.rbuild" />
        </directory>
+
+<!--
+       <directory name="smartpdf">
+               <xi:include href="smartpdf/fitz.rbuild" />
+               <xi:include href="smartpdf/poppler.rbuild" />   
+               <xi:include href="smartpdf/smartpdf.rbuild" /> 
+       </directory>
+-->
+
 </group>
index e812638..67aa534 100644 (file)
@@ -1,6 +1,14 @@
 <?xml version="1.0"?>
+<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
 <group xmlns:xi="http://www.w3.org/2001/XInclude">
+       <!--
        <directory name="dflat32">
                <xi:include href="dflat32/dflat32.rbuild" />
        </directory>
+       -->
+       <directory name="libjpeg">
+               <xi:include href="libjpeg/libjpeg.rbuild" />
+       </directory>
+
 </group>
+
diff --git a/rosapps/lib/libjpeg/LibJPEG.dsp b/rosapps/lib/libjpeg/LibJPEG.dsp
new file mode 100644 (file)
index 0000000..a73f58b
--- /dev/null
@@ -0,0 +1,328 @@
+# Microsoft Developer Studio Project File - Name="LibJPEG" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=LibJPEG - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "LibJPEG.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "LibJPEG.mak" CFG="LibJPEG - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "LibJPEG - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "LibJPEG - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""$/FreeImage/LibJPEG", IHAAAAAA"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "LibJPEG - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /I "..\zlib" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "LibJPEG - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF 
+
+# Begin Target
+
+# Name "LibJPEG - Win32 Release"
+# Name "LibJPEG - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\jcapimin.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jcapistd.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jccoefct.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jccolor.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jcdctmgr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jchuff.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jcinit.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jcmainct.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jcmarker.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jcmaster.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jcomapi.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jcparam.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jcphuff.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jcprepct.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jcsample.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jctrans.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdapimin.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdapistd.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdatadst.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdatasrc.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdcoefct.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdcolor.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jddctmgr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdhuff.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdinput.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdmainct.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdmarker.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdmaster.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdmerge.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdphuff.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdpostct.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdsample.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdtrans.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jerror.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jfdctflt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jfdctfst.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jfdctint.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jidctflt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jidctfst.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jidctint.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jidctred.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jmemmgr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jmemnobs.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jquant1.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jquant2.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\jutils.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\transupp.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\jchuff.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jconfig.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdct.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jdhuff.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jerror.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jinclude.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jmemsys.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jmorecfg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jpegint.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jpeglib.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jversion.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\transupp.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/rosapps/lib/libjpeg/LibJPEG.vcproj b/rosapps/lib/libjpeg/LibJPEG.vcproj
new file mode 100644 (file)
index 0000000..d1fd219
--- /dev/null
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="7.10"
+       Name="LibJPEG"
+       SccProjectName="&quot;$/FreeImage/LibJPEG&quot;, IHAAAAAA"
+       SccLocalPath=".">
+       <Platforms>
+               <Platform
+                       Name="Win32"/>
+       </Platforms>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory=".\Debug"
+                       IntermediateDirectory=".\Debug"
+                       ConfigurationType="4"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+                               StringPooling="TRUE"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="1"
+                               UsePrecompiledHeader="2"
+                               PrecompiledHeaderFile=".\Debug/LibJPEG.pch"
+                               AssemblerListingLocation=".\Debug/"
+                               ObjectFile=".\Debug/"
+                               ProgramDataBaseFileName=".\Debug/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="TRUE"
+                               DebugInformationFormat="4"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile=".\Debug\LibJPEG.lib"
+                               SuppressStartupBanner="TRUE"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="_DEBUG"
+                               Culture="1033"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory=".\Release"
+                       IntermediateDirectory=".\Release"
+                       ConfigurationType="4"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               GlobalOptimizations="TRUE"
+                               InlineFunctionExpansion="2"
+                               EnableIntrinsicFunctions="TRUE"
+                               FavorSizeOrSpeed="1"
+                               OmitFramePointers="TRUE"
+                               OptimizeForProcessor="3"
+                               AdditionalIncludeDirectories="..\zlib"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+                               StringPooling="TRUE"
+                               RuntimeLibrary="0"
+                               BufferSecurityCheck="FALSE"
+                               UsePrecompiledHeader="2"
+                               PrecompiledHeaderFile=".\Release/LibJPEG.pch"
+                               AssemblerListingLocation=".\Release/"
+                               ObjectFile=".\Release/"
+                               ProgramDataBaseFileName=".\Release/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="TRUE"
+                               CompileAs="0"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile=".\Release\LibJPEG.lib"
+                               SuppressStartupBanner="TRUE"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="NDEBUG"
+                               Culture="1033"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+                       <File
+                               RelativePath="jcapimin.c">
+                       </File>
+                       <File
+                               RelativePath="jcapistd.c">
+                       </File>
+                       <File
+                               RelativePath="jccoefct.c">
+                       </File>
+                       <File
+                               RelativePath="jccolor.c">
+                       </File>
+                       <File
+                               RelativePath="jcdctmgr.c">
+                       </File>
+                       <File
+                               RelativePath="jchuff.c">
+                       </File>
+                       <File
+                               RelativePath="jcinit.c">
+                       </File>
+                       <File
+                               RelativePath="jcmainct.c">
+                       </File>
+                       <File
+                               RelativePath="jcmarker.c">
+                       </File>
+                       <File
+                               RelativePath="jcmaster.c">
+                       </File>
+                       <File
+                               RelativePath="jcomapi.c">
+                       </File>
+                       <File
+                               RelativePath="jcparam.c">
+                       </File>
+                       <File
+                               RelativePath="jcphuff.c">
+                       </File>
+                       <File
+                               RelativePath="jcprepct.c">
+                       </File>
+                       <File
+                               RelativePath="jcsample.c">
+                       </File>
+                       <File
+                               RelativePath="jctrans.c">
+                       </File>
+                       <File
+                               RelativePath="jdapimin.c">
+                       </File>
+                       <File
+                               RelativePath="jdapistd.c">
+                       </File>
+                       <File
+                               RelativePath="jdatadst.c">
+                       </File>
+                       <File
+                               RelativePath="jdatasrc.c">
+                       </File>
+                       <File
+                               RelativePath="jdcoefct.c">
+                       </File>
+                       <File
+                               RelativePath="jdcolor.c">
+                       </File>
+                       <File
+                               RelativePath="jddctmgr.c">
+                       </File>
+                       <File
+                               RelativePath="jdhuff.c">
+                       </File>
+                       <File
+                               RelativePath="jdinput.c">
+                       </File>
+                       <File
+                               RelativePath="jdmainct.c">
+                       </File>
+                       <File
+                               RelativePath="jdmarker.c">
+                       </File>
+                       <File
+                               RelativePath="jdmaster.c">
+                       </File>
+                       <File
+                               RelativePath="jdmerge.c">
+                       </File>
+                       <File
+                               RelativePath="jdphuff.c">
+                       </File>
+                       <File
+                               RelativePath="jdpostct.c">
+                       </File>
+                       <File
+                               RelativePath="jdsample.c">
+                       </File>
+                       <File
+                               RelativePath="jdtrans.c">
+                       </File>
+                       <File
+                               RelativePath="jerror.c">
+                       </File>
+                       <File
+                               RelativePath="jfdctflt.c">
+                       </File>
+                       <File
+                               RelativePath="jfdctfst.c">
+                       </File>
+                       <File
+                               RelativePath="jfdctint.c">
+                       </File>
+                       <File
+                               RelativePath="jidctflt.c">
+                       </File>
+                       <File
+                               RelativePath="jidctfst.c">
+                       </File>
+                       <File
+                               RelativePath="jidctint.c">
+                       </File>
+                       <File
+                               RelativePath="jidctred.c">
+                       </File>
+                       <File
+                               RelativePath="jmemmgr.c">
+                       </File>
+                       <File
+                               RelativePath="jmemnobs.c">
+                       </File>
+                       <File
+                               RelativePath=".\jpegtran.c">
+                       </File>
+                       <File
+                               RelativePath="jquant1.c">
+                       </File>
+                       <File
+                               RelativePath="jquant2.c">
+                       </File>
+                       <File
+                               RelativePath="jutils.c">
+                       </File>
+                       <File
+                               RelativePath=".\transupp.c">
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Header Files"
+                       Filter="h;hpp;hxx;hm;inl">
+                       <File
+                               RelativePath="jchuff.h">
+                       </File>
+                       <File
+                               RelativePath="jconfig.h">
+                       </File>
+                       <File
+                               RelativePath="jdct.h">
+                       </File>
+                       <File
+                               RelativePath="jdhuff.h">
+                       </File>
+                       <File
+                               RelativePath="jerror.h">
+                       </File>
+                       <File
+                               RelativePath="jinclude.h">
+                       </File>
+                       <File
+                               RelativePath="jmemsys.h">
+                       </File>
+                       <File
+                               RelativePath="jmorecfg.h">
+                       </File>
+                       <File
+                               RelativePath="jpegint.h">
+                       </File>
+                       <File
+                               RelativePath="jpeglib.h">
+                       </File>
+                       <File
+                               RelativePath="jversion.h">
+                       </File>
+                       <File
+                               RelativePath=".\transupp.h">
+                       </File>
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
diff --git a/rosapps/lib/libjpeg/ansi2knr.c b/rosapps/lib/libjpeg/ansi2knr.c
new file mode 100644 (file)
index 0000000..4e05fc2
--- /dev/null
@@ -0,0 +1,693 @@
+/* ansi2knr.c */
+/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
+
+/*
+ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY.  No author or distributor accepts responsibility to anyone for the
+consequences of using it or for whether it serves any particular purpose or
+works at all, unless he says so in writing.  Refer to the GNU General Public
+License (the "GPL") for full details.
+
+Everyone is granted permission to copy, modify and redistribute ansi2knr,
+but only under the conditions described in the GPL.  A copy of this license
+is supposed to have been given to you along with ansi2knr so you can know
+your rights and responsibilities.  It should be in a file named COPYLEFT.
+[In the IJG distribution, the GPL appears below, not in a separate file.]
+Among other things, the copyright notice and this notice must be preserved
+on all copies.
+
+We explicitly state here what we believe is already implied by the GPL: if
+the ansi2knr program is distributed as a separate set of sources and a
+separate executable file which are aggregated on a storage medium together
+with another program, this in itself does not bring the other program under
+the GPL, nor does the mere fact that such a program or the procedures for
+constructing it invoke the ansi2knr executable bring any other part of the
+program under the GPL.
+*/
+
+/*
+---------- Here is the GNU GPL file COPYLEFT, referred to above ----------
+----- These terms do NOT apply to the JPEG software itself; see README ------
+
+                   GHOSTSCRIPT GENERAL PUBLIC LICENSE
+                   (Clarified 11 Feb 1988)
+
+ Copyright (C) 1988 Richard M. Stallman
+ Everyone is permitted to copy and distribute verbatim copies of this
+ license, but changing it is not allowed.  You can also use this wording
+ to make the terms for other programs.
+
+  The license agreements of most software companies keep you at the
+mercy of those companies.  By contrast, our general public license is
+intended to give everyone the right to share Ghostscript.  To make sure
+that you get the rights we want you to have, we need to make
+restrictions that forbid anyone to deny you these rights or to ask you
+to surrender the rights.  Hence this license agreement.
+
+  Specifically, we want to make sure that you have the right to give
+away copies of Ghostscript, that you receive source code or else can get
+it if you want it, that you can change Ghostscript or use pieces of it
+in new free programs, and that you know you can do these things.
+
+  To make sure that everyone has such rights, we have to forbid you to
+deprive anyone else of these rights.  For example, if you distribute
+copies of Ghostscript, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must tell them their rights.
+
+  Also, for our own protection, we must make certain that everyone finds
+out that there is no warranty for Ghostscript.  If Ghostscript is
+modified by someone else and passed on, we want its recipients to know
+that what they have is not what we distributed, so that any problems
+introduced by others will not reflect on our reputation.
+
+  Therefore we (Richard M. Stallman and the Free Software Foundation,
+Inc.) make the following terms which say what you must do to be allowed
+to distribute or change Ghostscript.
+
+
+                       COPYING POLICIES
+
+  1. You may copy and distribute verbatim copies of Ghostscript source
+code as you receive it, in any medium, provided that you conspicuously
+and appropriately publish on each copy a valid copyright and license
+notice "Copyright (C) 1989 Aladdin Enterprises.  All rights reserved.
+Distributed by Free Software Foundation, Inc." (or with whatever year is
+appropriate); keep intact the notices on all files that refer to this
+License Agreement and to the absence of any warranty; and give any other
+recipients of the Ghostscript program a copy of this License Agreement
+along with the program.  You may charge a distribution fee for the
+physical act of transferring a copy.
+
+  2. You may modify your copy or copies of Ghostscript or any portion of
+it, and copy and distribute such modifications under the terms of
+Paragraph 1 above, provided that you also do the following:
+
+    a) cause the modified files to carry prominent notices stating
+    that you changed the files and the date of any change; and
+
+    b) cause the whole of any work that you distribute or publish,
+    that in whole or in part contains or is a derivative of Ghostscript
+    or any part thereof, to be licensed at no charge to all third
+    parties on terms identical to those contained in this License
+    Agreement (except that you may choose to grant more extensive
+    warranty protection to some or all third parties, at your option).
+
+    c) You may charge a distribution fee for the physical act of
+    transferring a copy, and you may at your option offer warranty
+    protection in exchange for a fee.
+
+Mere aggregation of another unrelated program with this program (or its
+derivative) on a volume of a storage or distribution medium does not bring
+the other program under the scope of these terms.
+
+  3. You may copy and distribute Ghostscript (or a portion or derivative
+of it, under Paragraph 2) in object code or executable form under the
+terms of Paragraphs 1 and 2 above provided that you also do one of the
+following:
+
+    a) accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of
+    Paragraphs 1 and 2 above; or,
+
+    b) accompany it with a written offer, valid for at least three
+    years, to give any third party free (except for a nominal
+    shipping charge) a complete machine-readable copy of the
+    corresponding source code, to be distributed under the terms of
+    Paragraphs 1 and 2 above; or,
+
+    c) accompany it with the information you received as to where the
+    corresponding source code may be obtained.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form alone.)
+
+For an executable file, complete source code means all the source code for
+all modules it contains; but, as a special exception, it need not include
+source code for modules which are standard libraries that accompany the
+operating system on which the executable file runs.
+
+  4. You may not copy, sublicense, distribute or transfer Ghostscript
+except as expressly provided under this License Agreement.  Any attempt
+otherwise to copy, sublicense, distribute or transfer Ghostscript is
+void and your rights to use the program under this License agreement
+shall be automatically terminated.  However, parties who have received
+computer software programs from you with this License Agreement will not
+have their licenses terminated so long as such parties remain in full
+compliance.
+
+  5. If you wish to incorporate parts of Ghostscript into other free
+programs whose distribution conditions are different, write to the Free
+Software Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not
+yet worked out a simple rule that can be stated here, but we will often
+permit this.  We will be guided by the two goals of preserving the free
+status of all derivatives of our free software and of promoting the
+sharing and reuse of software.
+
+Your comments and suggestions about our licensing policies and our
+software are welcome!  Please contact the Free Software Foundation,
+Inc., 675 Mass Ave, Cambridge, MA 02139, or call (617) 876-3296.
+
+                      NO WARRANTY
+
+  BECAUSE GHOSTSCRIPT IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
+NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
+WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, RICHARD
+M. STALLMAN, ALADDIN ENTERPRISES, L. PETER DEUTSCH, AND/OR OTHER PARTIES
+PROVIDE GHOSTSCRIPT "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF GHOSTSCRIPT IS WITH
+YOU.  SHOULD GHOSTSCRIPT PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
+STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., L. PETER DEUTSCH, ALADDIN
+ENTERPRISES, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE
+GHOSTSCRIPT AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING
+ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
+(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
+INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE
+PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) GHOSTSCRIPT, EVEN IF YOU
+HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM
+BY ANY OTHER PARTY.
+
+-------------------- End of file COPYLEFT ------------------------------
+*/
+
+/*
+ * Usage:
+       ansi2knr input_file [output_file]
+ * If no output_file is supplied, output goes to stdout.
+ * There are no error messages.
+ *
+ * ansi2knr recognizes function definitions by seeing a non-keyword
+ * identifier at the left margin, followed by a left parenthesis,
+ * with a right parenthesis as the last character on the line,
+ * and with a left brace as the first token on the following line
+ * (ignoring possible intervening comments).
+ * It will recognize a multi-line header provided that no intervening
+ * line ends with a left or right brace or a semicolon.
+ * These algorithms ignore whitespace and comments, except that
+ * the function name must be the first thing on the line.
+ * The following constructs will confuse it:
+ *     - Any other construct that starts at the left margin and
+ *         follows the above syntax (such as a macro or function call).
+ *     - Some macros that tinker with the syntax of the function header.
+ */
+
+/*
+ * The original and principal author of ansi2knr is L. Peter Deutsch
+ * <ghost@aladdin.com>.  Other authors are noted in the change history
+ * that follows (in reverse chronological order):
+       lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with
+               compilers that don't understand void, as suggested by
+               Tom Lane
+       lpd 96-01-15 changed to require that the first non-comment token
+               on the line following a function header be a left brace,
+               to reduce sensitivity to macros, as suggested by Tom Lane
+               <tgl@sss.pgh.pa.us>
+       lpd 95-06-22 removed #ifndefs whose sole purpose was to define
+               undefined preprocessor symbols as 0; changed all #ifdefs
+               for configuration symbols to #ifs
+       lpd 95-04-05 changed copyright notice to make it clear that
+               including ansi2knr in a program does not bring the entire
+               program under the GPL
+       lpd 94-12-18 added conditionals for systems where ctype macros
+               don't handle 8-bit characters properly, suggested by
+               Francois Pinard <pinard@iro.umontreal.ca>;
+               removed --varargs switch (this is now the default)
+       lpd 94-10-10 removed CONFIG_BROKETS conditional
+       lpd 94-07-16 added some conditionals to help GNU `configure',
+               suggested by Francois Pinard <pinard@iro.umontreal.ca>;
+               properly erase prototype args in function parameters,
+               contributed by Jim Avera <jima@netcom.com>;
+               correct error in writeblanks (it shouldn't erase EOLs)
+       lpd 89-xx-xx original version
+ */
+
+/* Most of the conditionals here are to make ansi2knr work with */
+/* or without the GNU configure machinery. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+
+#if HAVE_CONFIG_H
+
+/*
+   For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
+   This will define HAVE_CONFIG_H and so, activate the following lines.
+ */
+
+# if STDC_HEADERS || HAVE_STRING_H
+#  include <string.h>
+# else
+#  include <strings.h>
+# endif
+
+#else /* not HAVE_CONFIG_H */
+
+/* Otherwise do it the hard way */
+
+# ifdef BSD
+#  include <strings.h>
+# else
+#  ifdef VMS
+    extern int strlen(), strncmp();
+#  else
+#   include <string.h>
+#  endif
+# endif
+
+#endif /* not HAVE_CONFIG_H */
+
+#if STDC_HEADERS
+# include <stdlib.h>
+#else
+/*
+   malloc and free should be declared in stdlib.h,
+   but if you've got a K&R compiler, they probably aren't.
+ */
+# ifdef MSDOS
+#  include <malloc.h>
+# else
+#  ifdef VMS
+     extern char *malloc();
+     extern void free();
+#  else
+     extern char *malloc();
+     extern int free();
+#  endif
+# endif
+
+#endif
+
+/*
+ * The ctype macros don't always handle 8-bit characters correctly.
+ * Compensate for this here.
+ */
+#ifdef isascii
+#  undef HAVE_ISASCII          /* just in case */
+#  define HAVE_ISASCII 1
+#else
+#endif
+#if STDC_HEADERS || !HAVE_ISASCII
+#  define is_ascii(c) 1
+#else
+#  define is_ascii(c) isascii(c)
+#endif
+
+#define is_space(c) (is_ascii(c) && isspace(c))
+#define is_alpha(c) (is_ascii(c) && isalpha(c))
+#define is_alnum(c) (is_ascii(c) && isalnum(c))
+
+/* Scanning macros */
+#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
+#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
+
+/* Forward references */
+char *skipspace();
+int writeblanks();
+int test1();
+int convert1();
+
+/* The main program */
+int
+main(argc, argv)
+    int argc;
+    char *argv[];
+{      FILE *in, *out;
+#define bufsize 5000                   /* arbitrary size */
+       char *buf;
+       char *line;
+       char *more;
+       /*
+        * In previous versions, ansi2knr recognized a --varargs switch.
+        * If this switch was supplied, ansi2knr would attempt to convert
+        * a ... argument to va_alist and va_dcl; if this switch was not
+        * supplied, ansi2knr would simply drop any such arguments.
+        * Now, ansi2knr always does this conversion, and we only
+        * check for this switch for backward compatibility.
+        */
+       int convert_varargs = 1;
+
+       if ( argc > 1 && argv[1][0] == '-' )
+         {     if ( !strcmp(argv[1], "--varargs") )
+                 {     convert_varargs = 1;
+                       argc--;
+                       argv++;
+                 }
+               else
+                 {     fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);
+                       exit(1);
+                 }
+         }
+       switch ( argc )
+          {
+       default:
+               printf("Usage: ansi2knr input_file [output_file]\n");
+               exit(0);
+       case 2:
+               out = stdout;
+               break;
+       case 3:
+               out = fopen(argv[2], "w");
+               if ( out == NULL )
+                  {    fprintf(stderr, "Cannot open output file %s\n", argv[2]);
+                       exit(1);
+                  }
+          }
+       in = fopen(argv[1], "r");
+       if ( in == NULL )
+          {    fprintf(stderr, "Cannot open input file %s\n", argv[1]);
+               exit(1);
+          }
+       fprintf(out, "#line 1 \"%s\"\n", argv[1]);
+       buf = malloc(bufsize);
+       line = buf;
+       while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
+          {
+test:          line += strlen(line);
+               switch ( test1(buf) )
+                  {
+               case 2:                 /* a function header */
+                       convert1(buf, out, 1, convert_varargs);
+                       break;
+               case 1:                 /* a function */
+                       /* Check for a { at the start of the next line. */
+                       more = ++line;
+f:                     if ( line >= buf + (bufsize - 1) ) /* overflow check */
+                         goto wl;
+                       if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
+                         goto wl;
+                       switch ( *skipspace(more, 1) )
+                         {
+                         case '{':
+                           /* Definitely a function header. */
+                           convert1(buf, out, 0, convert_varargs);
+                           fputs(more, out);
+                           break;
+                         case 0:
+                           /* The next line was blank or a comment: */
+                           /* keep scanning for a non-comment. */
+                           line += strlen(line);
+                           goto f;
+                         default:
+                           /* buf isn't a function header, but */
+                           /* more might be. */
+                           fputs(buf, out);
+                           strcpy(buf, more);
+                           line = buf;
+                           goto test;
+                         }
+                       break;
+               case -1:                /* maybe the start of a function */
+                       if ( line != buf + (bufsize - 1) ) /* overflow check */
+                         continue;
+                       /* falls through */
+               default:                /* not a function */
+wl:                    fputs(buf, out);
+                       break;
+                  }
+               line = buf;
+          }
+       if ( line != buf )
+         fputs(buf, out);
+       free(buf);
+       fclose(out);
+       fclose(in);
+       return 0;
+}
+
+/* Skip over space and comments, in either direction. */
+char *
+skipspace(p, dir)
+    register char *p;
+    register int dir;                  /* 1 for forward, -1 for backward */
+{      for ( ; ; )
+          {    while ( is_space(*p) )
+                 p += dir;
+               if ( !(*p == '/' && p[dir] == '*') )
+                 break;
+               p += dir;  p += dir;
+               while ( !(*p == '*' && p[dir] == '/') )
+                  {    if ( *p == 0 )
+                         return p;     /* multi-line comment?? */
+                       p += dir;
+                  }
+               p += dir;  p += dir;
+          }
+       return p;
+}
+
+/*
+ * Write blanks over part of a string.
+ * Don't overwrite end-of-line characters.
+ */
+int
+writeblanks(start, end)
+    char *start;
+    char *end;
+{      char *p;
+       for ( p = start; p < end; p++ )
+         if ( *p != '\r' && *p != '\n' )
+           *p = ' ';
+       return 0;
+}
+
+/*
+ * Test whether the string in buf is a function definition.
+ * The string may contain and/or end with a newline.
+ * Return as follows:
+ *     0 - definitely not a function definition;
+ *     1 - definitely a function definition;
+ *     2 - definitely a function prototype (NOT USED);
+ *     -1 - may be the beginning of a function definition,
+ *             append another line and look again.
+ * The reason we don't attempt to convert function prototypes is that
+ * Ghostscript's declaration-generating macros look too much like
+ * prototypes, and confuse the algorithms.
+ */
+int
+test1(buf)
+    char *buf;
+{      register char *p = buf;
+       char *bend;
+       char *endfn;
+       int contin;
+
+       if ( !isidfirstchar(*p) )
+         return 0;             /* no name at left margin */
+       bend = skipspace(buf + strlen(buf) - 1, -1);
+       switch ( *bend )
+          {
+          case ';': contin = 0 /*2*/; break;
+          case ')': contin = 1; break;
+          case '{': return 0;          /* not a function */
+          case '}': return 0;          /* not a function */
+          default: contin = -1;
+          }
+       while ( isidchar(*p) )
+         p++;
+       endfn = p;
+       p = skipspace(p, 1);
+       if ( *p++ != '(' )
+         return 0;             /* not a function */
+       p = skipspace(p, 1);
+       if ( *p == ')' )
+         return 0;             /* no parameters */
+       /* Check that the apparent function name isn't a keyword. */
+       /* We only need to check for keywords that could be followed */
+       /* by a left parenthesis (which, unfortunately, is most of them). */
+          {    static char *words[] =
+                  {    "asm", "auto", "case", "char", "const", "double",
+                       "extern", "float", "for", "if", "int", "long",
+                       "register", "return", "short", "signed", "sizeof",
+                       "static", "switch", "typedef", "unsigned",
+                       "void", "volatile", "while", 0
+                  };
+               char **key = words;
+               char *kp;
+               int len = endfn - buf;
+
+               while ( (kp = *key) != 0 )
+                  {    if ( strlen(kp) == len && !strncmp(kp, buf, len) )
+                         return 0;     /* name is a keyword */
+                       key++;
+                  }
+          }
+       return contin;
+}
+
+/* Convert a recognized function definition or header to K&R syntax. */
+int
+convert1(buf, out, header, convert_varargs)
+    char *buf;
+    FILE *out;
+    int header;                        /* Boolean */
+    int convert_varargs;       /* Boolean */
+{      char *endfn;
+       register char *p;
+       char **breaks;
+       unsigned num_breaks = 2;        /* for testing */
+       char **btop;
+       char **bp;
+       char **ap;
+       char *vararg = 0;
+
+       /* Pre-ANSI implementations don't agree on whether strchr */
+       /* is called strchr or index, so we open-code it here. */
+       for ( endfn = buf; *(endfn++) != '('; )
+         ;
+top:   p = endfn;
+       breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
+       if ( breaks == 0 )
+          {    /* Couldn't allocate break table, give up */
+               fprintf(stderr, "Unable to allocate break table!\n");
+               fputs(buf, out);
+               return -1;
+          }
+       btop = breaks + num_breaks * 2 - 2;
+       bp = breaks;
+       /* Parse the argument list */
+       do
+          {    int level = 0;
+               char *lp = NULL;
+               char *rp;
+               char *end = NULL;
+
+               if ( bp >= btop )
+                  {    /* Filled up break table. */
+                       /* Allocate a bigger one and start over. */
+                       free((char *)breaks);
+                       num_breaks <<= 1;
+                       goto top;
+                  }
+               *bp++ = p;
+               /* Find the end of the argument */
+               for ( ; end == NULL; p++ )
+                  {    switch(*p)
+                          {
+                          case ',':
+                               if ( !level ) end = p;
+                               break;
+                          case '(':
+                               if ( !level ) lp = p;
+                               level++;
+                               break;
+                          case ')':
+                               if ( --level < 0 ) end = p;
+                               else rp = p;
+                               break;
+                          case '/':
+                               p = skipspace(p, 1) - 1;
+                               break;
+                          default:
+                               ;
+                          }
+                  }
+               /* Erase any embedded prototype parameters. */
+               if ( lp )
+                 writeblanks(lp + 1, rp);
+               p--;                    /* back up over terminator */
+               /* Find the name being declared. */
+               /* This is complicated because of procedure and */
+               /* array modifiers. */
+               for ( ; ; )
+                  {    p = skipspace(p - 1, -1);
+                       switch ( *p )
+                          {
+                          case ']':    /* skip array dimension(s) */
+                          case ')':    /* skip procedure args OR name */
+                          {    int level = 1;
+                               while ( level )
+                                switch ( *--p )
+                                  {
+                                  case ']': case ')': level++; break;
+                                  case '[': case '(': level--; break;
+                                  case '/': p = skipspace(p, -1) + 1; break;
+                                  default: ;
+                                  }
+                          }
+                               if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
+                                  {    /* We found the name being declared */
+                                       while ( !isidfirstchar(*p) )
+                                         p = skipspace(p, 1) + 1;
+                                       goto found;
+                                  }
+                               break;
+                          default:
+                               goto found;
+                          }
+                  }
+found:         if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
+                 {     if ( convert_varargs )
+                         {     *bp++ = "va_alist";
+                               vararg = p-2;
+                         }
+                       else
+                         {     p++;
+                               if ( bp == breaks + 1 ) /* sole argument */
+                                 writeblanks(breaks[0], p);
+                               else
+                                 writeblanks(bp[-1] - 1, p);
+                               bp--;
+                         }
+                  }
+               else
+                  {    while ( isidchar(*p) ) p--;
+                       *bp++ = p+1;
+                  }
+               p = end;
+          }
+       while ( *p++ == ',' );
+       *bp = p;
+       /* Make a special check for 'void' arglist */
+       if ( bp == breaks+2 )
+          {    p = skipspace(breaks[0], 1);
+               if ( !strncmp(p, "void", 4) )
+                  {    p = skipspace(p+4, 1);
+                       if ( p == breaks[2] - 1 )
+                          {    bp = breaks;    /* yup, pretend arglist is empty */
+                               writeblanks(breaks[0], p + 1);
+                          }
+                  }
+          }
+       /* Put out the function name and left parenthesis. */
+       p = buf;
+       while ( p != endfn ) putc(*p, out), p++;
+       /* Put out the declaration. */
+       if ( header )
+         {     fputs(");", out);
+               for ( p = breaks[0]; *p; p++ )
+                 if ( *p == '\r' || *p == '\n' )
+                   putc(*p, out);
+         }
+       else
+         {     for ( ap = breaks+1; ap < bp; ap += 2 )
+                 {     p = *ap;
+                       while ( isidchar(*p) )
+                         putc(*p, out), p++;
+                       if ( ap < bp - 1 )
+                         fputs(", ", out);
+                 }
+               fputs(")  ", out);
+               /* Put out the argument declarations */
+               for ( ap = breaks+2; ap <= bp; ap += 2 )
+                 (*ap)[-1] = ';';
+               if ( vararg != 0 )
+                 {     *vararg = 0;
+                       fputs(breaks[0], out);          /* any prior args */
+                       fputs("va_dcl", out);           /* the final arg */
+                       fputs(bp[0], out);
+                 }
+               else
+                 fputs(breaks[0], out);
+         }
+       free((char *)breaks);
+       return 0;
+}
diff --git a/rosapps/lib/libjpeg/cderror.h b/rosapps/lib/libjpeg/cderror.h
new file mode 100644 (file)
index 0000000..70435e1
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * cderror.h
+ *
+ * Copyright (C) 1994-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file defines the error and message codes for the cjpeg/djpeg
+ * applications.  These strings are not needed as part of the JPEG library
+ * proper.
+ * Edit this file to add new codes, or to translate the message strings to
+ * some other language.
+ */
+
+/*
+ * To define the enum list of message codes, include this file without
+ * defining macro JMESSAGE.  To create a message string table, include it
+ * again with a suitable JMESSAGE definition (see jerror.c for an example).
+ */
+#ifndef JMESSAGE
+#ifndef CDERROR_H
+#define CDERROR_H
+/* First time through, define the enum list */
+#define JMAKE_ENUM_LIST
+#else
+/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
+#define JMESSAGE(code,string)
+#endif /* CDERROR_H */
+#endif /* JMESSAGE */
+
+#ifdef JMAKE_ENUM_LIST
+
+typedef enum {
+
+#define JMESSAGE(code,string)  code ,
+
+#endif /* JMAKE_ENUM_LIST */
+
+JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */
+
+#ifdef BMP_SUPPORTED
+JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
+JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported")
+JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length")
+JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1")
+JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
+JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
+JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
+JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
+JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
+JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image")
+JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image")
+#endif /* BMP_SUPPORTED */
+
+#ifdef GIF_SUPPORTED
+JMESSAGE(JERR_GIF_BUG, "GIF output got confused")
+JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d")
+JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB")
+JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file")
+JMESSAGE(JERR_GIF_NOT, "Not a GIF file")
+JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image")
+JMESSAGE(JTRC_GIF_BADVERSION,
+        "Warning: unexpected GIF version number '%c%c%c'")
+JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x")
+JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input")
+JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file")
+JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring")
+JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image")
+JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits")
+#endif /* GIF_SUPPORTED */
+
+#ifdef PPM_SUPPORTED
+JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
+JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
+JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
+JMESSAGE(JTRC_PGM, "%ux%u PGM image")
+JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
+JMESSAGE(JTRC_PPM, "%ux%u PPM image")
+JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image")
+#endif /* PPM_SUPPORTED */
+
+#ifdef RLE_SUPPORTED
+JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library")
+JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB")
+JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE")
+JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file")
+JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header")
+JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header")
+JMESSAGE(JERR_RLE_NOT, "Not an RLE file")
+JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE")
+JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup")
+JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file")
+JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d")
+JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file")
+JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d")
+JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d")
+#endif /* RLE_SUPPORTED */
+
+#ifdef TARGA_SUPPORTED
+JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format")
+JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
+JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB")
+JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
+JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image")
+JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image")
+#else
+JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
+#endif /* TARGA_SUPPORTED */
+
+JMESSAGE(JERR_BAD_CMAP_FILE,
+        "Color map file is invalid or of unsupported format")
+JMESSAGE(JERR_TOO_MANY_COLORS,
+        "Output file format cannot handle %d colormap entries")
+JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed")
+#ifdef TARGA_SUPPORTED
+JMESSAGE(JERR_UNKNOWN_FORMAT,
+        "Unrecognized input file format --- perhaps you need -targa")
+#else
+JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format")
+#endif
+JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format")
+
+#ifdef JMAKE_ENUM_LIST
+
+  JMSG_LASTADDONCODE
+} ADDON_MESSAGE_CODE;
+
+#undef JMAKE_ENUM_LIST
+#endif /* JMAKE_ENUM_LIST */
+
+/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
+#undef JMESSAGE
diff --git a/rosapps/lib/libjpeg/cdjpeg.c b/rosapps/lib/libjpeg/cdjpeg.c
new file mode 100644 (file)
index 0000000..b6250ff
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * cdjpeg.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains common support routines used by the IJG application
+ * programs (cjpeg, djpeg, jpegtran).
+ */
+
+#include "cdjpeg.h"            /* Common decls for cjpeg/djpeg applications */
+#include <ctype.h>             /* to declare isupper(), tolower() */
+#ifdef NEED_SIGNAL_CATCHER
+#include <signal.h>            /* to declare signal() */
+#endif
+#ifdef USE_SETMODE
+#include <fcntl.h>             /* to declare setmode()'s parameter macros */
+/* If you have setmode() but not <io.h>, just delete this line: */
+#include <io.h>                        /* to declare setmode() */
+#endif
+
+
+/*
+ * Signal catcher to ensure that temporary files are removed before aborting.
+ * NB: for Amiga Manx C this is actually a global routine named _abort();
+ * we put "#define signal_catcher _abort" in jconfig.h.  Talk about bogus...
+ */
+
+#ifdef NEED_SIGNAL_CATCHER
+
+static j_common_ptr sig_cinfo;
+
+void                           /* must be global for Manx C */
+signal_catcher (int signum)
+{
+  if (sig_cinfo != NULL) {
+    if (sig_cinfo->err != NULL) /* turn off trace output */
+      sig_cinfo->err->trace_level = 0;
+    jpeg_destroy(sig_cinfo);   /* clean up memory allocation & temp files */
+  }
+  exit(EXIT_FAILURE);
+}
+
+
+GLOBAL(void)
+enable_signal_catcher (j_common_ptr cinfo)
+{
+  sig_cinfo = cinfo;
+#ifdef SIGINT                  /* not all systems have SIGINT */
+  signal(SIGINT, signal_catcher);
+#endif
+#ifdef SIGTERM                 /* not all systems have SIGTERM */
+  signal(SIGTERM, signal_catcher);
+#endif
+}
+
+#endif
+
+
+/*
+ * Optional progress monitor: display a percent-done figure on stderr.
+ */
+
+#ifdef PROGRESS_REPORT
+
+METHODDEF(void)
+progress_monitor (j_common_ptr cinfo)
+{
+  cd_progress_ptr prog = (cd_progress_ptr) cinfo->progress;
+  int total_passes = prog->pub.total_passes + prog->total_extra_passes;
+  int percent_done = (int) (prog->pub.pass_counter*100L/prog->pub.pass_limit);
+
+  if (percent_done != prog->percent_done) {
+    prog->percent_done = percent_done;
+    if (total_passes > 1) {
+      fprintf(stderr, "\rPass %d/%d: %3d%% ",
+             prog->pub.completed_passes + prog->completed_extra_passes + 1,
+             total_passes, percent_done);
+    } else {
+      fprintf(stderr, "\r %3d%% ", percent_done);
+    }
+    fflush(stderr);
+  }
+}
+
+
+GLOBAL(void)
+start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress)
+{
+  /* Enable progress display, unless trace output is on */
+  if (cinfo->err->trace_level == 0) {
+    progress->pub.progress_monitor = progress_monitor;
+    progress->completed_extra_passes = 0;
+    progress->total_extra_passes = 0;
+    progress->percent_done = -1;
+    cinfo->progress = &progress->pub;
+  }
+}
+
+
+GLOBAL(void)
+end_progress_monitor (j_common_ptr cinfo)
+{
+  /* Clear away progress display */
+  if (cinfo->err->trace_level == 0) {
+    fprintf(stderr, "\r                \r");
+    fflush(stderr);
+  }
+}
+
+#endif
+
+
+/*
+ * Case-insensitive matching of possibly-abbreviated keyword switches.
+ * keyword is the constant keyword (must be lower case already),
+ * minchars is length of minimum legal abbreviation.
+ */
+
+GLOBAL(boolean)
+keymatch (char * arg, const char * keyword, int minchars)
+{
+  register int ca, ck;
+  register int nmatched = 0;
+
+  while ((ca = *arg++) != '\0') {
+    if ((ck = *keyword++) == '\0')
+      return FALSE;            /* arg longer than keyword, no good */
+    if (isupper(ca))           /* force arg to lcase (assume ck is already) */
+      ca = tolower(ca);
+    if (ca != ck)
+      return FALSE;            /* no good */
+    nmatched++;                        /* count matched characters */
+  }
+  /* reached end of argument; fail if it's too short for unique abbrev */
+  if (nmatched < minchars)
+    return FALSE;
+  return TRUE;                 /* A-OK */
+}
+
+
+/*
+ * Routines to establish binary I/O mode for stdin and stdout.
+ * Non-Unix systems often require some hacking to get out of text mode.
+ */
+
+GLOBAL(FILE *)
+read_stdin (void)
+{
+  FILE * input_file = stdin;
+
+#ifdef USE_SETMODE             /* need to hack file mode? */
+  setmode(fileno(stdin), O_BINARY);
+#endif
+#ifdef USE_FDOPEN              /* need to re-open in binary mode? */
+  if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) {
+    fprintf(stderr, "Cannot reopen stdin\n");
+    exit(EXIT_FAILURE);
+  }
+#endif
+  return input_file;
+}
+
+
+GLOBAL(FILE *)
+write_stdout (void)
+{
+  FILE * output_file = stdout;
+
+#ifdef USE_SETMODE             /* need to hack file mode? */
+  setmode(fileno(stdout), O_BINARY);
+#endif
+#ifdef USE_FDOPEN              /* need to re-open in binary mode? */
+  if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) {
+    fprintf(stderr, "Cannot reopen stdout\n");
+    exit(EXIT_FAILURE);
+  }
+#endif
+  return output_file;
+}
diff --git a/rosapps/lib/libjpeg/cdjpeg.h b/rosapps/lib/libjpeg/cdjpeg.h
new file mode 100644 (file)
index 0000000..2b387b6
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ * cdjpeg.h
+ *
+ * Copyright (C) 1994-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains common declarations for the sample applications
+ * cjpeg and djpeg.  It is NOT used by the core JPEG library.
+ */
+
+#define JPEG_CJPEG_DJPEG       /* define proper options in jconfig.h */
+#define JPEG_INTERNAL_OPTIONS  /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jerror.h"            /* get library error codes too */
+#include "cderror.h"           /* get application-specific error codes */
+
+
+/*
+ * Object interface for cjpeg's source file decoding modules
+ */
+
+typedef struct cjpeg_source_struct * cjpeg_source_ptr;
+
+struct cjpeg_source_struct {
+  JMETHOD(void, start_input, (j_compress_ptr cinfo,
+                             cjpeg_source_ptr sinfo));
+  JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
+                                      cjpeg_source_ptr sinfo));
+  JMETHOD(void, finish_input, (j_compress_ptr cinfo,
+                              cjpeg_source_ptr sinfo));
+
+  FILE *input_file;
+
+  JSAMPARRAY buffer;
+  JDIMENSION buffer_height;
+};
+
+
+/*
+ * Object interface for djpeg's output file encoding modules
+ */
+
+typedef struct djpeg_dest_struct * djpeg_dest_ptr;
+
+struct djpeg_dest_struct {
+  /* start_output is called after jpeg_start_decompress finishes.
+   * The color map will be ready at this time, if one is needed.
+   */
+  JMETHOD(void, start_output, (j_decompress_ptr cinfo,
+                              djpeg_dest_ptr dinfo));
+  /* Emit the specified number of pixel rows from the buffer. */
+  JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo,
+                                djpeg_dest_ptr dinfo,
+                                JDIMENSION rows_supplied));
+  /* Finish up at the end of the image. */
+  JMETHOD(void, finish_output, (j_decompress_ptr cinfo,
+                               djpeg_dest_ptr dinfo));
+
+  /* Target file spec; filled in by djpeg.c after object is created. */
+  FILE * output_file;
+
+  /* Output pixel-row buffer.  Created by module init or start_output.
+   * Width is cinfo->output_width * cinfo->output_components;
+   * height is buffer_height.
+   */
+  JSAMPARRAY buffer;
+  JDIMENSION buffer_height;
+};
+
+
+/*
+ * cjpeg/djpeg may need to perform extra passes to convert to or from
+ * the source/destination file format.  The JPEG library does not know
+ * about these passes, but we'd like them to be counted by the progress
+ * monitor.  We use an expanded progress monitor object to hold the
+ * additional pass count.
+ */
+
+struct cdjpeg_progress_mgr {
+  struct jpeg_progress_mgr pub;        /* fields known to JPEG library */
+  int completed_extra_passes;  /* extra passes completed */
+  int total_extra_passes;      /* total extra */
+  /* last printed percentage stored here to avoid multiple printouts */
+  int percent_done;
+};
+
+typedef struct cdjpeg_progress_mgr * cd_progress_ptr;
+
+
+/* Short forms of external names for systems with brain-damaged linkers. */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jinit_read_bmp         jIRdBMP
+#define jinit_write_bmp                jIWrBMP
+#define jinit_read_gif         jIRdGIF
+#define jinit_write_gif                jIWrGIF
+#define jinit_read_ppm         jIRdPPM
+#define jinit_write_ppm                jIWrPPM
+#define jinit_read_rle         jIRdRLE
+#define jinit_write_rle                jIWrRLE
+#define jinit_read_targa       jIRdTarga
+#define jinit_write_targa      jIWrTarga
+#define read_quant_tables      RdQTables
+#define read_scan_script       RdScnScript
+#define set_quant_slots                SetQSlots
+#define set_sample_factors     SetSFacts
+#define read_color_map         RdCMap
+#define enable_signal_catcher  EnSigCatcher
+#define start_progress_monitor StProgMon
+#define end_progress_monitor   EnProgMon
+#define read_stdin             RdStdin
+#define write_stdout           WrStdout
+#endif /* NEED_SHORT_EXTERNAL_NAMES */
+
+/* Module selection routines for I/O modules. */
+
+EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo));
+EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo,
+                                           boolean is_os2));
+EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo));
+EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo));
+EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo));
+EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo));
+EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo));
+EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo));
+EXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo));
+EXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo));
+
+/* cjpeg support routines (in rdswitch.c) */
+
+EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename,
+                                   int scale_factor, boolean force_baseline));
+EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename));
+EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg));
+EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg));
+
+/* djpeg support routines (in rdcolmap.c) */
+
+EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile));
+
+/* common support routines (in cdjpeg.c) */
+
+EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo));
+EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo,
+                                        cd_progress_ptr progress));
+EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo));
+EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars));
+EXTERN(FILE *) read_stdin JPP((void));
+EXTERN(FILE *) write_stdout JPP((void));
+
+/* miscellaneous useful macros */
+
+#ifdef DONT_USE_B_MODE         /* define mode parameters for fopen() */
+#define READ_BINARY    "r"
+#define WRITE_BINARY   "w"
+#else
+#ifdef VMS                     /* VMS is very nonstandard */
+#define READ_BINARY    "rb", "ctx=stm"
+#define WRITE_BINARY   "wb", "ctx=stm"
+#else                          /* standard ANSI-compliant case */
+#define READ_BINARY    "rb"
+#define WRITE_BINARY   "wb"
+#endif
+#endif
+
+#ifndef EXIT_FAILURE           /* define exit() codes if not provided */
+#define EXIT_FAILURE  1
+#endif
+#ifndef EXIT_SUCCESS
+#ifdef VMS
+#define EXIT_SUCCESS  1                /* VMS is very nonstandard */
+#else
+#define EXIT_SUCCESS  0
+#endif
+#endif
+#ifndef EXIT_WARNING
+#ifdef VMS
+#define EXIT_WARNING  1                /* VMS is very nonstandard */
+#else
+#define EXIT_WARNING  2
+#endif
+#endif
diff --git a/rosapps/lib/libjpeg/change.log b/rosapps/lib/libjpeg/change.log
new file mode 100644 (file)
index 0000000..74102c0
--- /dev/null
@@ -0,0 +1,217 @@
+CHANGE LOG for Independent JPEG Group's JPEG software
+
+
+Version 6b  27-Mar-1998
+-----------------------
+
+jpegtran has new features for lossless image transformations (rotation
+and flipping) as well as "lossless" reduction to grayscale.
+
+jpegtran now copies comments by default; it has a -copy switch to enable
+copying all APPn blocks as well, or to suppress comments.  (Formerly it
+always suppressed comments and APPn blocks.)  jpegtran now also preserves
+JFIF version and resolution information.
+
+New decompressor library feature: COM and APPn markers found in the input
+file can be saved in memory for later use by the application.  (Before,
+you had to code this up yourself with a custom marker processor.)
+
+There is an unused field "void * client_data" now in compress and decompress
+parameter structs; this may be useful in some applications.
+
+JFIF version number information is now saved by the decoder and accepted by
+the encoder.  jpegtran uses this to copy the source file's version number,
+to ensure "jpegtran -copy all" won't create bogus files that contain JFXX
+extensions but claim to be version 1.01.  Applications that generate their
+own JFXX extension markers also (finally) have a supported way to cause the
+encoder to emit JFIF version number 1.02.
+
+djpeg's trace mode reports JFIF 1.02 thumbnail images as such, rather
+than as unknown APP0 markers.
+
+In -verbose mode, djpeg and rdjpgcom will try to print the contents of
+APP12 markers as text.  Some digital cameras store useful text information
+in APP12 markers.
+
+Handling of truncated data streams is more robust: blocks beyond the one in
+which the error occurs will be output as uniform gray, or left unchanged
+if decoding a progressive JPEG.  The appearance no longer depends on the
+Huffman tables being used.
+
+Huffman tables are checked for validity much more carefully than before.
+
+To avoid the Unisys LZW patent, djpeg's GIF output capability has been
+changed to produce "uncompressed GIFs", and cjpeg's GIF input capability
+has been removed altogether.  We're not happy about it either, but there
+seems to be no good alternative.
+
+The configure script now supports building libjpeg as a shared library
+on many flavors of Unix (all the ones that GNU libtool knows how to
+build shared libraries for).  Use "./configure --enable-shared" to
+try this out.
+
+New jconfig file and makefiles for Microsoft Visual C++ and Developer Studio.
+Also, a jconfig file and a build script for Metrowerks CodeWarrior
+on Apple Macintosh.  makefile.dj has been updated for DJGPP v2, and there
+are miscellaneous other minor improvements in the makefiles.
+
+jmemmac.c now knows how to create temporary files following Mac System 7
+conventions.
+
+djpeg's -map switch is now able to read raw-format PPM files reliably.
+
+cjpeg -progressive -restart no longer generates any unnecessary DRI markers.
+
+Multiple calls to jpeg_simple_progression for a single JPEG object
+no longer leak memory.
+
+
+Version 6a  7-Feb-96
+--------------------
+
+Library initialization sequence modified to detect version mismatches
+and struct field packing mismatches between library and calling application.
+This change requires applications to be recompiled, but does not require
+any application source code change.
+
+All routine declarations changed to the style "GLOBAL(type) name ...",
+that is, GLOBAL, LOCAL, METHODDEF, EXTERN are now macros taking the
+routine's return type as an argument.  This makes it possible to add
+Microsoft-style linkage keywords to all the routines by changing just
+these macros.  Note that any application code that was using these macros
+will have to be changed.
+
+DCT coefficient quantization tables are now stored in normal array order
+rather than zigzag order.  Application code that calls jpeg_add_quant_table,
+or otherwise manipulates quantization tables directly, will need to be
+changed.  If you need to make such code work with either older or newer
+versions of the library, a test like "#if JPEG_LIB_VERSION >= 61" is
+recommended.
+
+djpeg's trace capability now dumps DQT tables in natural order, not zigzag
+order.  This allows the trace output to be made into a "-qtables" file
+more easily.
+
+New system-dependent memory manager module for use on Apple Macintosh.
+
+Fix bug in cjpeg's -smooth option: last one or two scanlines would be
+duplicates of the prior line unless the image height mod 16 was 1 or 2.
+
+Repair minor problems in VMS, BCC, MC6 makefiles.
+
+New configure script based on latest GNU Autoconf.
+
+Correct the list of include files needed by MetroWerks C for ccommand().
+
+Numerous small documentation updates.
+
+
+Version 6  2-Aug-95
+-------------------
+
+Progressive JPEG support: library can read and write full progressive JPEG
+files.  A "buffered image" mode supports incremental decoding for on-the-fly
+display of progressive images.  Simply recompiling an existing IJG-v5-based
+decoder with v6 should allow it to read progressive files, though of course
+without any special progressive display.
+
+New "jpegtran" application performs lossless transcoding between different
+JPEG formats; primarily, it can be used to convert baseline to progressive
+JPEG and vice versa.  In support of jpegtran, the library now allows lossless
+reading and writing of JPEG files as DCT coefficient arrays.  This ability
+may be of use in other applications.
+
+Notes for programmers:
+* We changed jpeg_start_decompress() to be able to suspend; this makes all
+decoding modes available to suspending-input applications.  However,
+existing applications that use suspending input will need to be changed
+to check the return value from jpeg_start_decompress().  You don't need to
+do anything if you don't use a suspending data source.
+* We changed the interface to the virtual array routines: access_virt_array
+routines now take a count of the number of rows to access this time.  The
+last parameter to request_virt_array routines is now interpreted as the
+maximum number of rows that may be accessed at once, but not necessarily
+the height of every access.
+
+
+Version 5b  15-Mar-95
+---------------------
+
+Correct bugs with grayscale images having v_samp_factor > 1.
+
+jpeg_write_raw_data() now supports output suspension.
+
+Correct bugs in "configure" script for case of compiling in
+a directory other than the one containing the source files.
+
+Repair bug in jquant1.c: sometimes didn't use as many colors as it could.
+
+Borland C makefile and jconfig file work under either MS-DOS or OS/2.
+
+Miscellaneous improvements to documentation.
+
+
+Version 5a  7-Dec-94
+--------------------
+
+Changed color conversion roundoff behavior so that grayscale values are
+represented exactly.  (This causes test image files to change.)
+
+Make ordered dither use 16x16 instead of 4x4 pattern for a small quality
+improvement.
+
+New configure script based on latest GNU Autoconf.
+Fix configure script to handle CFLAGS correctly.
+Rename *.auto files to *.cfg, so that configure script still works if
+file names have been truncated for DOS.
+
+Fix bug in rdbmp.c: didn't allow for extra data between header and image.
+
+Modify rdppm.c/wrppm.c to handle 2-byte raw PPM/PGM formats for 12-bit data.
+
+Fix several bugs in rdrle.c.
+
+NEED_SHORT_EXTERNAL_NAMES option was broken.
+
+Revise jerror.h/jerror.c for more flexibility in message table.
+
+Repair oversight in jmemname.c NO_MKTEMP case: file could be there
+but unreadable.
+
+
+Version 5  24-Sep-94
+--------------------
+
+Version 5 represents a nearly complete redesign and rewrite of the IJG
+software.  Major user-visible changes include:
+  * Automatic configuration simplifies installation for most Unix systems.
+  * A range of speed vs. image quality tradeoffs are supported.
+    This includes resizing of an image during decompression: scaling down
+    by a factor of 1/2, 1/4, or 1/8 is handled very efficiently.
+  * New programs rdjpgcom and wrjpgcom allow insertion and extraction
+    of text comments in a JPEG file.
+
+The application programmer's interface to the library has changed completely.
+Notable improvements include:
+  * We have eliminated the use of callback routines for handling the
+    uncompressed image data.  The application now sees the library as a
+    set of routines that it calls to read or write image data on a
+    scanline-by-scanline basis.
+  * The application image data is represented in a conventional interleaved-
+    pixel format, rather than as a separate array for each color channel.
+    This can save a copying step in many programs.
+  * The handling of compressed data has been cleaned up: the application can
+    supply routines to source or sink the compressed data.  It is possible to
+    suspend processing on source/sink buffer overrun, although this is not
+    supported in all operating modes.
+  * All static state has been eliminated from the library, so that multiple
+    instances of compression or decompression can be active concurrently.
+  * JPEG abbreviated datastream formats are supported, ie, quantization and
+    Huffman tables can be stored separately from the image data.
+  * And not only that, but the documentation of the library has improved
+    considerably!
+
+
+The last widely used release before the version 5 rewrite was version 4A of
+18-Feb-93.  Change logs before that point have been discarded, since they
+are not of much interest after the rewrite.
diff --git a/rosapps/lib/libjpeg/cjpeg.c b/rosapps/lib/libjpeg/cjpeg.c
new file mode 100644 (file)
index 0000000..f2a929f
--- /dev/null
@@ -0,0 +1,606 @@
+/*
+ * cjpeg.c
+ *
+ * Copyright (C) 1991-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a command-line user interface for the JPEG compressor.
+ * It should work on any system with Unix- or MS-DOS-style command lines.
+ *
+ * Two different command line styles are permitted, depending on the
+ * compile-time switch TWO_FILE_COMMANDLINE:
+ *     cjpeg [options]  inputfile outputfile
+ *     cjpeg [options]  [inputfile]
+ * In the second style, output is always to standard output, which you'd
+ * normally redirect to a file or pipe to some other program.  Input is
+ * either from a named file or from standard input (typically redirected).
+ * The second style is convenient on Unix but is unhelpful on systems that
+ * don't support pipes.  Also, you MUST use the first style if your system
+ * doesn't do binary I/O to stdin/stdout.
+ * To simplify script writing, the "-outfile" switch is provided.  The syntax
+ *     cjpeg [options]  -outfile outputfile  inputfile
+ * works regardless of which command line style is used.
+ */
+
+#include "cdjpeg.h"            /* Common decls for cjpeg/djpeg applications */
+#include "jversion.h"          /* for version message */
+
+#ifdef USE_CCOMMAND            /* command-line reader for Macintosh */
+#ifdef __MWERKS__
+#include <SIOUX.h>              /* Metrowerks needs this */
+#include <console.h>           /* ... and this */
+#endif
+#ifdef THINK_C
+#include <console.h>           /* Think declares it here */
+#endif
+#endif
+
+
+/* Create the add-on message string table. */
+
+#define JMESSAGE(code,string)  string ,
+
+static const char * const cdjpeg_message_table[] = {
+#include "cderror.h"
+  NULL
+};
+
+
+/*
+ * This routine determines what format the input file is,
+ * and selects the appropriate input-reading module.
+ *
+ * To determine which family of input formats the file belongs to,
+ * we may look only at the first byte of the file, since C does not
+ * guarantee that more than one character can be pushed back with ungetc.
+ * Looking at additional bytes would require one of these approaches:
+ *     1) assume we can fseek() the input file (fails for piped input);
+ *     2) assume we can push back more than one character (works in
+ *        some C implementations, but unportable);
+ *     3) provide our own buffering (breaks input readers that want to use
+ *        stdio directly, such as the RLE library);
+ * or  4) don't put back the data, and modify the input_init methods to assume
+ *        they start reading after the start of file (also breaks RLE library).
+ * #1 is attractive for MS-DOS but is untenable on Unix.
+ *
+ * The most portable solution for file types that can't be identified by their
+ * first byte is to make the user tell us what they are.  This is also the
+ * only approach for "raw" file types that contain only arbitrary values.
+ * We presently apply this method for Targa files.  Most of the time Targa
+ * files start with 0x00, so we recognize that case.  Potentially, however,
+ * a Targa file could start with any byte value (byte 0 is the length of the
+ * seldom-used ID field), so we provide a switch to force Targa input mode.
+ */
+
+static boolean is_targa;       /* records user -targa switch */
+
+
+LOCAL(cjpeg_source_ptr)
+select_file_type (j_compress_ptr cinfo, FILE * infile)
+{
+  int c;
+
+  if (is_targa) {
+#ifdef TARGA_SUPPORTED
+    return jinit_read_targa(cinfo);
+#else
+    ERREXIT(cinfo, JERR_TGA_NOTCOMP);
+#endif
+  }
+
+  if ((c = getc(infile)) == EOF)
+    ERREXIT(cinfo, JERR_INPUT_EMPTY);
+  if (ungetc(c, infile) == EOF)
+    ERREXIT(cinfo, JERR_UNGETC_FAILED);
+
+  switch (c) {
+#ifdef BMP_SUPPORTED
+  case 'B':
+    return jinit_read_bmp(cinfo);
+#endif
+#ifdef GIF_SUPPORTED
+  case 'G':
+    return jinit_read_gif(cinfo);
+#endif
+#ifdef PPM_SUPPORTED
+  case 'P':
+    return jinit_read_ppm(cinfo);
+#endif
+#ifdef RLE_SUPPORTED
+  case 'R':
+    return jinit_read_rle(cinfo);
+#endif
+#ifdef TARGA_SUPPORTED
+  case 0x00:
+    return jinit_read_targa(cinfo);
+#endif
+  default:
+    ERREXIT(cinfo, JERR_UNKNOWN_FORMAT);
+    break;
+  }
+
+  return NULL;                 /* suppress compiler warnings */
+}
+
+
+/*
+ * Argument-parsing code.
+ * The switch parser is designed to be useful with DOS-style command line
+ * syntax, ie, intermixed switches and file names, where only the switches
+ * to the left of a given file name affect processing of that file.
+ * The main program in this file doesn't actually use this capability...
+ */
+
+
+static const char * progname;  /* program name for error messages */
+static char * outfilename;     /* for -outfile switch */
+
+
+LOCAL(void)
+usage (void)
+/* complain about bad command line */
+{
+  fprintf(stderr, "usage: %s [switches] ", progname);
+#ifdef TWO_FILE_COMMANDLINE
+  fprintf(stderr, "inputfile outputfile\n");
+#else
+  fprintf(stderr, "[inputfile]\n");
+#endif
+
+  fprintf(stderr, "Switches (names may be abbreviated):\n");
+  fprintf(stderr, "  -quality N     Compression quality (0..100; 5-95 is useful range)\n");
+  fprintf(stderr, "  -grayscale     Create monochrome JPEG file\n");
+#ifdef ENTROPY_OPT_SUPPORTED
+  fprintf(stderr, "  -optimize      Optimize Huffman table (smaller file, but slow compression)\n");
+#endif
+#ifdef C_PROGRESSIVE_SUPPORTED
+  fprintf(stderr, "  -progressive   Create progressive JPEG file\n");
+#endif
+#ifdef TARGA_SUPPORTED
+  fprintf(stderr, "  -targa         Input file is Targa format (usually not needed)\n");
+#endif
+  fprintf(stderr, "Switches for advanced users:\n");
+#ifdef DCT_ISLOW_SUPPORTED
+  fprintf(stderr, "  -dct int       Use integer DCT method%s\n",
+         (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
+#endif
+#ifdef DCT_IFAST_SUPPORTED
+  fprintf(stderr, "  -dct fast      Use fast integer DCT (less accurate)%s\n",
+         (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : ""));
+#endif
+#ifdef DCT_FLOAT_SUPPORTED
+  fprintf(stderr, "  -dct float     Use floating-point DCT method%s\n",
+         (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
+#endif
+  fprintf(stderr, "  -restart N     Set restart interval in rows, or in blocks with B\n");
+#ifdef INPUT_SMOOTHING_SUPPORTED
+  fprintf(stderr, "  -smooth N      Smooth dithered input (N=1..100 is strength)\n");
+#endif
+  fprintf(stderr, "  -maxmemory N   Maximum memory to use (in kbytes)\n");
+  fprintf(stderr, "  -outfile name  Specify name for output file\n");
+  fprintf(stderr, "  -verbose  or  -debug   Emit debug output\n");
+  fprintf(stderr, "Switches for wizards:\n");
+#ifdef C_ARITH_CODING_SUPPORTED
+  fprintf(stderr, "  -arithmetic    Use arithmetic coding\n");
+#endif
+  fprintf(stderr, "  -baseline      Force baseline quantization tables\n");
+  fprintf(stderr, "  -qtables file  Use quantization tables given in file\n");
+  fprintf(stderr, "  -qslots N[,...]    Set component quantization tables\n");
+  fprintf(stderr, "  -sample HxV[,...]  Set component sampling factors\n");
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+  fprintf(stderr, "  -scans file    Create multi-scan JPEG per script file\n");
+#endif
+  exit(EXIT_FAILURE);
+}
+
+
+LOCAL(int)
+parse_switches (j_compress_ptr cinfo, int argc, char **argv,
+               int last_file_arg_seen, boolean for_real)
+/* Parse optional switches.
+ * Returns argv[] index of first file-name argument (== argc if none).
+ * Any file names with indexes <= last_file_arg_seen are ignored;
+ * they have presumably been processed in a previous iteration.
+ * (Pass 0 for last_file_arg_seen on the first or only iteration.)
+ * for_real is FALSE on the first (dummy) pass; we may skip any expensive
+ * processing.
+ */
+{
+  int argn;
+  char * arg;
+  int quality;                 /* -quality parameter */
+  int q_scale_factor;          /* scaling percentage for -qtables */
+  boolean force_baseline;
+  boolean simple_progressive;
+  char * qtablefile = NULL;    /* saves -qtables filename if any */
+  char * qslotsarg = NULL;     /* saves -qslots parm if any */
+  char * samplearg = NULL;     /* saves -sample parm if any */
+  char * scansarg = NULL;      /* saves -scans parm if any */
+
+  /* Set up default JPEG parameters. */
+  /* Note that default -quality level need not, and does not,
+   * match the default scaling for an explicit -qtables argument.
+   */
+  quality = 75;                        /* default -quality value */
+  q_scale_factor = 100;                /* default to no scaling for -qtables */
+  force_baseline = FALSE;      /* by default, allow 16-bit quantizers */
+  simple_progressive = FALSE;
+  is_targa = FALSE;
+  outfilename = NULL;
+  cinfo->err->trace_level = 0;
+
+  /* Scan command line options, adjust parameters */
+
+  for (argn = 1; argn < argc; argn++) {
+    arg = argv[argn];
+    if (*arg != '-') {
+      /* Not a switch, must be a file name argument */
+      if (argn <= last_file_arg_seen) {
+       outfilename = NULL;     /* -outfile applies to just one input file */
+       continue;               /* ignore this name if previously processed */
+      }
+      break;                   /* else done parsing switches */
+    }
+    arg++;                     /* advance past switch marker character */
+
+    if (keymatch(arg, "arithmetic", 1)) {
+      /* Use arithmetic coding. */
+#ifdef C_ARITH_CODING_SUPPORTED
+      cinfo->arith_code = TRUE;
+#else
+      fprintf(stderr, "%s: sorry, arithmetic coding not supported\n",
+             progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "baseline", 1)) {
+      /* Force baseline-compatible output (8-bit quantizer values). */
+      force_baseline = TRUE;
+
+    } else if (keymatch(arg, "dct", 2)) {
+      /* Select DCT algorithm. */
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      if (keymatch(argv[argn], "int", 1)) {
+       cinfo->dct_method = JDCT_ISLOW;
+      } else if (keymatch(argv[argn], "fast", 2)) {
+       cinfo->dct_method = JDCT_IFAST;
+      } else if (keymatch(argv[argn], "float", 2)) {
+       cinfo->dct_method = JDCT_FLOAT;
+      } else
+       usage();
+
+    } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
+      /* Enable debug printouts. */
+      /* On first -d, print version identification */
+      static boolean printed_version = FALSE;
+
+      if (! printed_version) {
+       fprintf(stderr, "Independent JPEG Group's CJPEG, version %s\n%s\n",
+               JVERSION, JCOPYRIGHT);
+       printed_version = TRUE;
+      }
+      cinfo->err->trace_level++;
+
+    } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) {
+      /* Force a monochrome JPEG file to be generated. */
+      jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
+
+    } else if (keymatch(arg, "maxmemory", 3)) {
+      /* Maximum memory in Kb (or Mb with 'm'). */
+      long lval;
+      char ch = 'x';
+
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
+       usage();
+      if (ch == 'm' || ch == 'M')
+       lval *= 1000L;
+      cinfo->mem->max_memory_to_use = lval * 1000L;
+
+    } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
+      /* Enable entropy parm optimization. */
+#ifdef ENTROPY_OPT_SUPPORTED
+      cinfo->optimize_coding = TRUE;
+#else
+      fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n",
+             progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "outfile", 4)) {
+      /* Set output file name. */
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      outfilename = argv[argn];        /* save it away for later use */
+
+    } else if (keymatch(arg, "progressive", 1)) {
+      /* Select simple progressive mode. */
+#ifdef C_PROGRESSIVE_SUPPORTED
+      simple_progressive = TRUE;
+      /* We must postpone execution until num_components is known. */
+#else
+      fprintf(stderr, "%s: sorry, progressive output was not compiled\n",
+             progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "quality", 1)) {
+      /* Quality factor (quantization table scaling factor). */
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      if (sscanf(argv[argn], "%d", &quality) != 1)
+       usage();
+      /* Change scale factor in case -qtables is present. */
+      q_scale_factor = jpeg_quality_scaling(quality);
+
+    } else if (keymatch(arg, "qslots", 2)) {
+      /* Quantization table slot numbers. */
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      qslotsarg = argv[argn];
+      /* Must delay setting qslots until after we have processed any
+       * colorspace-determining switches, since jpeg_set_colorspace sets
+       * default quant table numbers.
+       */
+
+    } else if (keymatch(arg, "qtables", 2)) {
+      /* Quantization tables fetched from file. */
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      qtablefile = argv[argn];
+      /* We postpone actually reading the file in case -quality comes later. */
+
+    } else if (keymatch(arg, "restart", 1)) {
+      /* Restart interval in MCU rows (or in MCUs with 'b'). */
+      long lval;
+      char ch = 'x';
+
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
+       usage();
+      if (lval < 0 || lval > 65535L)
+       usage();
+      if (ch == 'b' || ch == 'B') {
+       cinfo->restart_interval = (unsigned int) lval;
+       cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
+      } else {
+       cinfo->restart_in_rows = (int) lval;
+       /* restart_interval will be computed during startup */
+      }
+
+    } else if (keymatch(arg, "sample", 2)) {
+      /* Set sampling factors. */
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      samplearg = argv[argn];
+      /* Must delay setting sample factors until after we have processed any
+       * colorspace-determining switches, since jpeg_set_colorspace sets
+       * default sampling factors.
+       */
+
+    } else if (keymatch(arg, "scans", 2)) {
+      /* Set scan script. */
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      scansarg = argv[argn];
+      /* We must postpone reading the file in case -progressive appears. */
+#else
+      fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n",
+             progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "smooth", 2)) {
+      /* Set input smoothing factor. */
+      int val;
+
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      if (sscanf(argv[argn], "%d", &val) != 1)
+       usage();
+      if (val < 0 || val > 100)
+       usage();
+      cinfo->smoothing_factor = val;
+
+    } else if (keymatch(arg, "targa", 1)) {
+      /* Input file is Targa format. */
+      is_targa = TRUE;
+
+    } else {
+      usage();                 /* bogus switch */
+    }
+  }
+
+  /* Post-switch-scanning cleanup */
+
+  if (for_real) {
+
+    /* Set quantization tables for selected quality. */
+    /* Some or all may be overridden if -qtables is present. */
+    jpeg_set_quality(cinfo, quality, force_baseline);
+
+    if (qtablefile != NULL)    /* process -qtables if it was present */
+      if (! read_quant_tables(cinfo, qtablefile,
+                             q_scale_factor, force_baseline))
+       usage();
+
+    if (qslotsarg != NULL)     /* process -qslots if it was present */
+      if (! set_quant_slots(cinfo, qslotsarg))
+       usage();
+
+    if (samplearg != NULL)     /* process -sample if it was present */
+      if (! set_sample_factors(cinfo, samplearg))
+       usage();
+
+#ifdef C_PROGRESSIVE_SUPPORTED
+    if (simple_progressive)    /* process -progressive; -scans can override */
+      jpeg_simple_progression(cinfo);
+#endif
+
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+    if (scansarg != NULL)      /* process -scans if it was present */
+      if (! read_scan_script(cinfo, scansarg))
+       usage();
+#endif
+  }
+
+  return argn;                 /* return index of next arg (file name) */
+}
+
+
+/*
+ * The main program.
+ */
+
+int
+main (int argc, char **argv)
+{
+  struct jpeg_compress_struct cinfo;
+  struct jpeg_error_mgr jerr;
+#ifdef PROGRESS_REPORT
+  struct cdjpeg_progress_mgr progress;
+#endif
+  int file_index;
+  cjpeg_source_ptr src_mgr;
+  FILE * input_file;
+  FILE * output_file;
+  JDIMENSION num_scanlines;
+
+  /* On Mac, fetch a command line. */
+#ifdef USE_CCOMMAND
+  argc = ccommand(&argv);
+#endif
+
+  progname = argv[0];
+  if (progname == NULL || progname[0] == 0)
+    progname = "cjpeg";                /* in case C library doesn't provide it */
+
+  /* Initialize the JPEG compression object with default error handling. */
+  cinfo.err = jpeg_std_error(&jerr);
+  jpeg_create_compress(&cinfo);
+  /* Add some application-specific error messages (from cderror.h) */
+  jerr.addon_message_table = cdjpeg_message_table;
+  jerr.first_addon_message = JMSG_FIRSTADDONCODE;
+  jerr.last_addon_message = JMSG_LASTADDONCODE;
+
+  /* Now safe to enable signal catcher. */
+#ifdef NEED_SIGNAL_CATCHER
+  enable_signal_catcher((j_common_ptr) &cinfo);
+#endif
+
+  /* Initialize JPEG parameters.
+   * Much of this may be overridden later.
+   * In particular, we don't yet know the input file's color space,
+   * but we need to provide some value for jpeg_set_defaults() to work.
+   */
+
+  cinfo.in_color_space = JCS_RGB; /* arbitrary guess */
+  jpeg_set_defaults(&cinfo);
+
+  /* Scan command line to find file names.
+   * It is convenient to use just one switch-parsing routine, but the switch
+   * values read here are ignored; we will rescan the switches after opening
+   * the input file.
+   */
+
+  file_index = parse_switches(&cinfo, argc, argv, 0, FALSE);
+
+#ifdef TWO_FILE_COMMANDLINE
+  /* Must have either -outfile switch or explicit output file name */
+  if (outfilename == NULL) {
+    if (file_index != argc-2) {
+      fprintf(stderr, "%s: must name one input and one output file\n",
+             progname);
+      usage();
+    }
+    outfilename = argv[file_index+1];
+  } else {
+    if (file_index != argc-1) {
+      fprintf(stderr, "%s: must name one input and one output file\n",
+             progname);
+      usage();
+    }
+  }
+#else
+  /* Unix style: expect zero or one file name */
+  if (file_index < argc-1) {
+    fprintf(stderr, "%s: only one input file\n", progname);
+    usage();
+  }
+#endif /* TWO_FILE_COMMANDLINE */
+
+  /* Open the input file. */
+  if (file_index < argc) {
+    if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default input file is stdin */
+    input_file = read_stdin();
+  }
+
+  /* Open the output file. */
+  if (outfilename != NULL) {
+    if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, outfilename);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default output file is stdout */
+    output_file = write_stdout();
+  }
+
+#ifdef PROGRESS_REPORT
+  start_progress_monitor((j_common_ptr) &cinfo, &progress);
+#endif
+
+  /* Figure out the input file format, and set up to read it. */
+  src_mgr = select_file_type(&cinfo, input_file);
+  src_mgr->input_file = input_file;
+
+  /* Read the input file header to obtain file size & colorspace. */
+  (*src_mgr->start_input) (&cinfo, src_mgr);
+
+  /* Now that we know input colorspace, fix colorspace-dependent defaults */
+  jpeg_default_colorspace(&cinfo);
+
+  /* Adjust default compression parameters by re-parsing the options */
+  file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);
+
+  /* Specify data destination for compression */
+  jpeg_stdio_dest(&cinfo, output_file);
+
+  /* Start compressor */
+  jpeg_start_compress(&cinfo, TRUE);
+
+  /* Process data */
+  while (cinfo.next_scanline < cinfo.image_height) {
+    num_scanlines = (*src_mgr->get_pixel_rows) (&cinfo, src_mgr);
+    (void) jpeg_write_scanlines(&cinfo, src_mgr->buffer, num_scanlines);
+  }
+
+  /* Finish compression and release memory */
+  (*src_mgr->finish_input) (&cinfo, src_mgr);
+  jpeg_finish_compress(&cinfo);
+  jpeg_destroy_compress(&cinfo);
+
+  /* Close files, if we opened them */
+  if (input_file != stdin)
+    fclose(input_file);
+  if (output_file != stdout)
+    fclose(output_file);
+
+#ifdef PROGRESS_REPORT
+  end_progress_monitor((j_common_ptr) &cinfo);
+#endif
+
+  /* All done. */
+  exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
+  return 0;                    /* suppress no-return-value warnings */
+}
diff --git a/rosapps/lib/libjpeg/ckconfig.c b/rosapps/lib/libjpeg/ckconfig.c
new file mode 100644 (file)
index 0000000..34baf79
--- /dev/null
@@ -0,0 +1,402 @@
+/*
+ * ckconfig.c
+ *
+ * Copyright (C) 1991-1994, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ */
+
+/*
+ * This program is intended to help you determine how to configure the JPEG
+ * software for installation on a particular system.  The idea is to try to
+ * compile and execute this program.  If your compiler fails to compile the
+ * program, make changes as indicated in the comments below.  Once you can
+ * compile the program, run it, and it will produce a "jconfig.h" file for
+ * your system.
+ *
+ * As a general rule, each time you try to compile this program,
+ * pay attention only to the *first* error message you get from the compiler.
+ * Many C compilers will issue lots of spurious error messages once they
+ * have gotten confused.  Go to the line indicated in the first error message,
+ * and read the comments preceding that line to see what to change.
+ *
+ * Almost all of the edits you may need to make to this program consist of
+ * changing a line that reads "#define SOME_SYMBOL" to "#undef SOME_SYMBOL",
+ * or vice versa.  This is called defining or undefining that symbol.
+ */
+
+
+/* First we must see if your system has the include files we need.
+ * We start out with the assumption that your system has all the ANSI-standard
+ * include files.  If you get any error trying to include one of these files,
+ * undefine the corresponding HAVE_xxx symbol.
+ */
+
+#define HAVE_STDDEF_H          /* replace 'define' by 'undef' if error here */
+#ifdef HAVE_STDDEF_H           /* next line will be skipped if you undef... */
+#include <stddef.h>
+#endif
+
+#define HAVE_STDLIB_H          /* same thing for stdlib.h */
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <stdio.h>             /* If you ain't got this, you ain't got C. */
+
+/* We have to see if your string functions are defined by
+ * strings.h (old BSD convention) or string.h (everybody else).
+ * We try the non-BSD convention first; define NEED_BSD_STRINGS
+ * if the compiler says it can't find string.h.
+ */
+
+#undef NEED_BSD_STRINGS
+
+#ifdef NEED_BSD_STRINGS
+#include <strings.h>
+#else
+#include <string.h>
+#endif
+
+/* On some systems (especially older Unix machines), type size_t is
+ * defined only in the include file <sys/types.h>.  If you get a failure
+ * on the size_t test below, try defining NEED_SYS_TYPES_H.
+ */
+
+#undef NEED_SYS_TYPES_H                /* start by assuming we don't need it */
+#ifdef NEED_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+
+/* Usually type size_t is defined in one of the include files we've included
+ * above.  If not, you'll get an error on the "typedef size_t my_size_t;" line.
+ * In that case, first try defining NEED_SYS_TYPES_H just above.
+ * If that doesn't work, you'll have to search through your system library
+ * to figure out which include file defines "size_t".  Look for a line that
+ * says "typedef something-or-other size_t;".  Then, change the line below
+ * that says "#include <someincludefile.h>" to instead include the file
+ * you found size_t in, and define NEED_SPECIAL_INCLUDE.  If you can't find
+ * type size_t anywhere, try replacing "#include <someincludefile.h>" with
+ * "typedef unsigned int size_t;".
+ */
+
+#undef NEED_SPECIAL_INCLUDE    /* assume we DON'T need it, for starters */
+
+#ifdef NEED_SPECIAL_INCLUDE
+#include <someincludefile.h>
+#endif
+
+typedef size_t my_size_t;      /* The payoff: do we have size_t now? */
+
+
+/* The next question is whether your compiler supports ANSI-style function
+ * prototypes.  You need to know this in order to choose between using
+ * makefile.ansi and using makefile.unix.
+ * The #define line below is set to assume you have ANSI function prototypes.
+ * If you get an error in this group of lines, undefine HAVE_PROTOTYPES.
+ */
+
+#define HAVE_PROTOTYPES
+
+#ifdef HAVE_PROTOTYPES
+int testfunction (int arg1, int * arg2); /* check prototypes */
+
+struct methods_struct {                /* check method-pointer declarations */
+  int (*error_exit) (char *msgtext);
+  int (*trace_message) (char *msgtext);
+  int (*another_method) (void);
+};
+
+int testfunction (int arg1, int * arg2) /* check definitions */
+{
+  return arg2[arg1];
+}
+
+int test2function (void)       /* check void arg list */
+{
+  return 0;
+}
+#endif
+
+
+/* Now we want to find out if your compiler knows what "unsigned char" means.
+ * If you get an error on the "unsigned char un_char;" line,
+ * then undefine HAVE_UNSIGNED_CHAR.
+ */
+
+#define HAVE_UNSIGNED_CHAR
+
+#ifdef HAVE_UNSIGNED_CHAR
+unsigned char un_char;
+#endif
+
+
+/* Now we want to find out if your compiler knows what "unsigned short" means.
+ * If you get an error on the "unsigned short un_short;" line,
+ * then undefine HAVE_UNSIGNED_SHORT.
+ */
+
+#define HAVE_UNSIGNED_SHORT
+
+#ifdef HAVE_UNSIGNED_SHORT
+unsigned short un_short;
+#endif
+
+
+/* Now we want to find out if your compiler understands type "void".
+ * If you get an error anywhere in here, undefine HAVE_VOID.
+ */
+
+#define HAVE_VOID
+
+#ifdef HAVE_VOID
+/* Caution: a C++ compiler will insist on complete prototypes */
+typedef void * void_ptr;       /* check void * */
+#ifdef HAVE_PROTOTYPES         /* check ptr to function returning void */
+typedef void (*void_func) (int a, int b);
+#else
+typedef void (*void_func) ();
+#endif
+
+#ifdef HAVE_PROTOTYPES         /* check void function result */
+void test3function (void_ptr arg1, void_func arg2)
+#else
+void test3function (arg1, arg2)
+     void_ptr arg1;
+     void_func arg2;
+#endif
+{
+  char * locptr = (char *) arg1; /* check casting to and from void * */
+  arg1 = (void *) locptr;
+  (*arg2) (1, 2);              /* check call of fcn returning void */
+}
+#endif
+
+
+/* Now we want to find out if your compiler knows what "const" means.
+ * If you get an error here, undefine HAVE_CONST.
+ */
+
+#define HAVE_CONST
+
+#ifdef HAVE_CONST
+static const int carray[3] = {1, 2, 3};
+
+#ifdef HAVE_PROTOTYPES
+int test4function (const int arg1)
+#else
+int test4function (arg1)
+     const int arg1;
+#endif
+{
+  return carray[arg1];
+}
+#endif
+
+
+/* If you get an error or warning about this structure definition,
+ * define INCOMPLETE_TYPES_BROKEN.
+ */
+
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifndef INCOMPLETE_TYPES_BROKEN
+typedef struct undefined_structure * undef_struct_ptr;
+#endif
+
+
+/* If you get an error about duplicate names,
+ * define NEED_SHORT_EXTERNAL_NAMES.
+ */
+
+#undef NEED_SHORT_EXTERNAL_NAMES
+
+#ifndef NEED_SHORT_EXTERNAL_NAMES
+
+int possibly_duplicate_function ()
+{
+  return 0;
+}
+
+int possibly_dupli_function ()
+{
+  return 1;
+}
+
+#endif
+
+
+
+/************************************************************************
+ *  OK, that's it.  You should not have to change anything beyond this
+ *  point in order to compile and execute this program.  (You might get
+ *  some warnings, but you can ignore them.)
+ *  When you run the program, it will make a couple more tests that it
+ *  can do automatically, and then it will create jconfig.h and print out
+ *  any additional suggestions it has.
+ ************************************************************************
+ */
+
+
+#ifdef HAVE_PROTOTYPES
+int is_char_signed (int arg)
+#else
+int is_char_signed (arg)
+     int arg;
+#endif
+{
+  if (arg == 189) {            /* expected result for unsigned char */
+    return 0;                  /* type char is unsigned */
+  }
+  else if (arg != -67) {       /* expected result for signed char */
+    printf("Hmm, it seems 'char' is not eight bits wide on your machine.\n");
+    printf("I fear the JPEG software will not work at all.\n\n");
+  }
+  return 1;                    /* assume char is signed otherwise */
+}
+
+
+#ifdef HAVE_PROTOTYPES
+int is_shifting_signed (long arg)
+#else
+int is_shifting_signed (arg)
+     long arg;
+#endif
+/* See whether right-shift on a long is signed or not. */
+{
+  long res = arg >> 4;
+
+  if (res == -0x7F7E80CL) {    /* expected result for signed shift */
+    return 1;                  /* right shift is signed */
+  }
+  /* see if unsigned-shift hack will fix it. */
+  /* we can't just test exact value since it depends on width of long... */
+  res |= (~0L) << (32-4);
+  if (res == -0x7F7E80CL) {    /* expected result now? */
+    return 0;                  /* right shift is unsigned */
+  }
+  printf("Right shift isn't acting as I expect it to.\n");
+  printf("I fear the JPEG software will not work at all.\n\n");
+  return 0;                    /* try it with unsigned anyway */
+}
+
+
+#ifdef HAVE_PROTOTYPES
+int main (int argc, char ** argv)
+#else
+int main (argc, argv)
+     int argc;
+     char ** argv;
+#endif
+{
+  char signed_char_check = (char) (-67);
+  FILE *outfile;
+
+  /* Attempt to write jconfig.h */
+  if ((outfile = fopen("jconfig.h", "w")) == NULL) {
+    printf("Failed to write jconfig.h\n");
+    return 1;
+  }
+
+  /* Write out all the info */
+  fprintf(outfile, "/* jconfig.h --- generated by ckconfig.c */\n");
+  fprintf(outfile, "/* see jconfig.doc for explanations */\n\n");
+#ifdef HAVE_PROTOTYPES
+  fprintf(outfile, "#define HAVE_PROTOTYPES\n");
+#else
+  fprintf(outfile, "#undef HAVE_PROTOTYPES\n");
+#endif
+#ifdef HAVE_UNSIGNED_CHAR
+  fprintf(outfile, "#define HAVE_UNSIGNED_CHAR\n");
+#else
+  fprintf(outfile, "#undef HAVE_UNSIGNED_CHAR\n");
+#endif
+#ifdef HAVE_UNSIGNED_SHORT
+  fprintf(outfile, "#define HAVE_UNSIGNED_SHORT\n");
+#else
+  fprintf(outfile, "#undef HAVE_UNSIGNED_SHORT\n");
+#endif
+#ifdef HAVE_VOID
+  fprintf(outfile, "/* #define void char */\n");
+#else
+  fprintf(outfile, "#define void char\n");
+#endif
+#ifdef HAVE_CONST
+  fprintf(outfile, "/* #define const */\n");
+#else
+  fprintf(outfile, "#define const\n");
+#endif
+  if (is_char_signed((int) signed_char_check))
+    fprintf(outfile, "#undef CHAR_IS_UNSIGNED\n");
+  else
+    fprintf(outfile, "#define CHAR_IS_UNSIGNED\n");
+#ifdef HAVE_STDDEF_H
+  fprintf(outfile, "#define HAVE_STDDEF_H\n");
+#else
+  fprintf(outfile, "#undef HAVE_STDDEF_H\n");
+#endif
+#ifdef HAVE_STDLIB_H
+  fprintf(outfile, "#define HAVE_STDLIB_H\n");
+#else
+  fprintf(outfile, "#undef HAVE_STDLIB_H\n");
+#endif
+#ifdef NEED_BSD_STRINGS
+  fprintf(outfile, "#define NEED_BSD_STRINGS\n");
+#else
+  fprintf(outfile, "#undef NEED_BSD_STRINGS\n");
+#endif
+#ifdef NEED_SYS_TYPES_H
+  fprintf(outfile, "#define NEED_SYS_TYPES_H\n");
+#else
+  fprintf(outfile, "#undef NEED_SYS_TYPES_H\n");
+#endif
+  fprintf(outfile, "#undef NEED_FAR_POINTERS\n");
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+  fprintf(outfile, "#define NEED_SHORT_EXTERNAL_NAMES\n");
+#else
+  fprintf(outfile, "#undef NEED_SHORT_EXTERNAL_NAMES\n");
+#endif
+#ifdef INCOMPLETE_TYPES_BROKEN
+  fprintf(outfile, "#define INCOMPLETE_TYPES_BROKEN\n");
+#else
+  fprintf(outfile, "#undef INCOMPLETE_TYPES_BROKEN\n");
+#endif
+  fprintf(outfile, "\n#ifdef JPEG_INTERNALS\n\n");
+  if (is_shifting_signed(-0x7F7E80B1L))
+    fprintf(outfile, "#undef RIGHT_SHIFT_IS_UNSIGNED\n");
+  else
+    fprintf(outfile, "#define RIGHT_SHIFT_IS_UNSIGNED\n");
+  fprintf(outfile, "\n#endif /* JPEG_INTERNALS */\n");
+  fprintf(outfile, "\n#ifdef JPEG_CJPEG_DJPEG\n\n");
+  fprintf(outfile, "#define BMP_SUPPORTED              /* BMP image file format */\n");
+  fprintf(outfile, "#define GIF_SUPPORTED              /* GIF image file format */\n");
+  fprintf(outfile, "#define PPM_SUPPORTED              /* PBMPLUS PPM/PGM image file format */\n");
+  fprintf(outfile, "#undef RLE_SUPPORTED               /* Utah RLE image file format */\n");
+  fprintf(outfile, "#define TARGA_SUPPORTED            /* Targa image file format */\n\n");
+  fprintf(outfile, "#undef TWO_FILE_COMMANDLINE        /* You may need this on non-Unix systems */\n");
+  fprintf(outfile, "#undef NEED_SIGNAL_CATCHER /* Define this if you use jmemname.c */\n");
+  fprintf(outfile, "#undef DONT_USE_B_MODE\n");
+  fprintf(outfile, "/* #define PROGRESS_REPORT */      /* optional */\n");
+  fprintf(outfile, "\n#endif /* JPEG_CJPEG_DJPEG */\n");
+
+  /* Close the jconfig.h file */
+  fclose(outfile);
+
+  /* User report */
+  printf("Configuration check for Independent JPEG Group's software done.\n");
+  printf("\nI have written the jconfig.h file for you.\n\n");
+#ifdef HAVE_PROTOTYPES
+  printf("You should use makefile.ansi as the starting point for your Makefile.\n");
+#else
+  printf("You should use makefile.unix as the starting point for your Makefile.\n");
+#endif
+
+#ifdef NEED_SPECIAL_INCLUDE
+  printf("\nYou'll need to change jconfig.h to include the system include file\n");
+  printf("that you found type size_t in, or add a direct definition of type\n");
+  printf("size_t if that's what you used.  Just add it to the end.\n");
+#endif
+
+  return 0;
+}
diff --git a/rosapps/lib/libjpeg/djpeg.c b/rosapps/lib/libjpeg/djpeg.c
new file mode 100644 (file)
index 0000000..e099e90
--- /dev/null
@@ -0,0 +1,616 @@
+/*
+ * djpeg.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a command-line user interface for the JPEG decompressor.
+ * It should work on any system with Unix- or MS-DOS-style command lines.
+ *
+ * Two different command line styles are permitted, depending on the
+ * compile-time switch TWO_FILE_COMMANDLINE:
+ *     djpeg [options]  inputfile outputfile
+ *     djpeg [options]  [inputfile]
+ * In the second style, output is always to standard output, which you'd
+ * normally redirect to a file or pipe to some other program.  Input is
+ * either from a named file or from standard input (typically redirected).
+ * The second style is convenient on Unix but is unhelpful on systems that
+ * don't support pipes.  Also, you MUST use the first style if your system
+ * doesn't do binary I/O to stdin/stdout.
+ * To simplify script writing, the "-outfile" switch is provided.  The syntax
+ *     djpeg [options]  -outfile outputfile  inputfile
+ * works regardless of which command line style is used.
+ */
+
+#include "cdjpeg.h"            /* Common decls for cjpeg/djpeg applications */
+#include "jversion.h"          /* for version message */
+
+#include <ctype.h>             /* to declare isprint() */
+
+#ifdef USE_CCOMMAND            /* command-line reader for Macintosh */
+#ifdef __MWERKS__
+#include <SIOUX.h>              /* Metrowerks needs this */
+#include <console.h>           /* ... and this */
+#endif
+#ifdef THINK_C
+#include <console.h>           /* Think declares it here */
+#endif
+#endif
+
+
+/* Create the add-on message string table. */
+
+#define JMESSAGE(code,string)  string ,
+
+static const char * const cdjpeg_message_table[] = {
+#include "cderror.h"
+  NULL
+};
+
+
+/*
+ * This list defines the known output image formats
+ * (not all of which need be supported by a given version).
+ * You can change the default output format by defining DEFAULT_FMT;
+ * indeed, you had better do so if you undefine PPM_SUPPORTED.
+ */
+
+typedef enum {
+       FMT_BMP,                /* BMP format (Windows flavor) */
+       FMT_GIF,                /* GIF format */
+       FMT_OS2,                /* BMP format (OS/2 flavor) */
+       FMT_PPM,                /* PPM/PGM (PBMPLUS formats) */
+       FMT_RLE,                /* RLE format */
+       FMT_TARGA,              /* Targa format */
+       FMT_TIFF                /* TIFF format */
+} IMAGE_FORMATS;
+
+#ifndef DEFAULT_FMT            /* so can override from CFLAGS in Makefile */
+#define DEFAULT_FMT    FMT_PPM
+#endif
+
+static IMAGE_FORMATS requested_fmt;
+
+
+/*
+ * Argument-parsing code.
+ * The switch parser is designed to be useful with DOS-style command line
+ * syntax, ie, intermixed switches and file names, where only the switches
+ * to the left of a given file name affect processing of that file.
+ * The main program in this file doesn't actually use this capability...
+ */
+
+
+static const char * progname;  /* program name for error messages */
+static char * outfilename;     /* for -outfile switch */
+
+
+LOCAL(void)
+usage (void)
+/* complain about bad command line */
+{
+  fprintf(stderr, "usage: %s [switches] ", progname);
+#ifdef TWO_FILE_COMMANDLINE
+  fprintf(stderr, "inputfile outputfile\n");
+#else
+  fprintf(stderr, "[inputfile]\n");
+#endif
+
+  fprintf(stderr, "Switches (names may be abbreviated):\n");
+  fprintf(stderr, "  -colors N      Reduce image to no more than N colors\n");
+  fprintf(stderr, "  -fast          Fast, low-quality processing\n");
+  fprintf(stderr, "  -grayscale     Force grayscale output\n");
+#ifdef IDCT_SCALING_SUPPORTED
+  fprintf(stderr, "  -scale M/N     Scale output image by fraction M/N, eg, 1/8\n");
+#endif
+#ifdef BMP_SUPPORTED
+  fprintf(stderr, "  -bmp           Select BMP output format (Windows style)%s\n",
+         (DEFAULT_FMT == FMT_BMP ? " (default)" : ""));
+#endif
+#ifdef GIF_SUPPORTED
+  fprintf(stderr, "  -gif           Select GIF output format%s\n",
+         (DEFAULT_FMT == FMT_GIF ? " (default)" : ""));
+#endif
+#ifdef BMP_SUPPORTED
+  fprintf(stderr, "  -os2           Select BMP output format (OS/2 style)%s\n",
+         (DEFAULT_FMT == FMT_OS2 ? " (default)" : ""));
+#endif
+#ifdef PPM_SUPPORTED
+  fprintf(stderr, "  -pnm           Select PBMPLUS (PPM/PGM) output format%s\n",
+         (DEFAULT_FMT == FMT_PPM ? " (default)" : ""));
+#endif
+#ifdef RLE_SUPPORTED
+  fprintf(stderr, "  -rle           Select Utah RLE output format%s\n",
+         (DEFAULT_FMT == FMT_RLE ? " (default)" : ""));
+#endif
+#ifdef TARGA_SUPPORTED
+  fprintf(stderr, "  -targa         Select Targa output format%s\n",
+         (DEFAULT_FMT == FMT_TARGA ? " (default)" : ""));
+#endif
+  fprintf(stderr, "Switches for advanced users:\n");
+#ifdef DCT_ISLOW_SUPPORTED
+  fprintf(stderr, "  -dct int       Use integer DCT method%s\n",
+         (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
+#endif
+#ifdef DCT_IFAST_SUPPORTED
+  fprintf(stderr, "  -dct fast      Use fast integer DCT (less accurate)%s\n",
+         (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : ""));
+#endif
+#ifdef DCT_FLOAT_SUPPORTED
+  fprintf(stderr, "  -dct float     Use floating-point DCT method%s\n",
+         (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
+#endif
+  fprintf(stderr, "  -dither fs     Use F-S dithering (default)\n");
+  fprintf(stderr, "  -dither none   Don't use dithering in quantization\n");
+  fprintf(stderr, "  -dither ordered  Use ordered dither (medium speed, quality)\n");
+#ifdef QUANT_2PASS_SUPPORTED
+  fprintf(stderr, "  -map FILE      Map to colors used in named image file\n");
+#endif
+  fprintf(stderr, "  -nosmooth      Don't use high-quality upsampling\n");
+#ifdef QUANT_1PASS_SUPPORTED
+  fprintf(stderr, "  -onepass       Use 1-pass quantization (fast, low quality)\n");
+#endif
+  fprintf(stderr, "  -maxmemory N   Maximum memory to use (in kbytes)\n");
+  fprintf(stderr, "  -outfile name  Specify name for output file\n");
+  fprintf(stderr, "  -verbose  or  -debug   Emit debug output\n");
+  exit(EXIT_FAILURE);
+}
+
+
+LOCAL(int)
+parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
+               int last_file_arg_seen, boolean for_real)
+/* Parse optional switches.
+ * Returns argv[] index of first file-name argument (== argc if none).
+ * Any file names with indexes <= last_file_arg_seen are ignored;
+ * they have presumably been processed in a previous iteration.
+ * (Pass 0 for last_file_arg_seen on the first or only iteration.)
+ * for_real is FALSE on the first (dummy) pass; we may skip any expensive
+ * processing.
+ */
+{
+  int argn;
+  char * arg;
+
+  /* Set up default JPEG parameters. */
+  requested_fmt = DEFAULT_FMT; /* set default output file format */
+  outfilename = NULL;
+  cinfo->err->trace_level = 0;
+
+  /* Scan command line options, adjust parameters */
+
+  for (argn = 1; argn < argc; argn++) {
+    arg = argv[argn];
+    if (*arg != '-') {
+      /* Not a switch, must be a file name argument */
+      if (argn <= last_file_arg_seen) {
+       outfilename = NULL;     /* -outfile applies to just one input file */
+       continue;               /* ignore this name if previously processed */
+      }
+      break;                   /* else done parsing switches */
+    }
+    arg++;                     /* advance past switch marker character */
+
+    if (keymatch(arg, "bmp", 1)) {
+      /* BMP output format. */
+      requested_fmt = FMT_BMP;
+
+    } else if (keymatch(arg, "colors", 1) || keymatch(arg, "colours", 1) ||
+              keymatch(arg, "quantize", 1) || keymatch(arg, "quantise", 1)) {
+      /* Do color quantization. */
+      int val;
+
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      if (sscanf(argv[argn], "%d", &val) != 1)
+       usage();
+      cinfo->desired_number_of_colors = val;
+      cinfo->quantize_colors = TRUE;
+
+    } else if (keymatch(arg, "dct", 2)) {
+      /* Select IDCT algorithm. */
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      if (keymatch(argv[argn], "int", 1)) {
+       cinfo->dct_method = JDCT_ISLOW;
+      } else if (keymatch(argv[argn], "fast", 2)) {
+       cinfo->dct_method = JDCT_IFAST;
+      } else if (keymatch(argv[argn], "float", 2)) {
+       cinfo->dct_method = JDCT_FLOAT;
+      } else
+       usage();
+
+    } else if (keymatch(arg, "dither", 2)) {
+      /* Select dithering algorithm. */
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      if (keymatch(argv[argn], "fs", 2)) {
+       cinfo->dither_mode = JDITHER_FS;
+      } else if (keymatch(argv[argn], "none", 2)) {
+       cinfo->dither_mode = JDITHER_NONE;
+      } else if (keymatch(argv[argn], "ordered", 2)) {
+       cinfo->dither_mode = JDITHER_ORDERED;
+      } else
+       usage();
+
+    } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
+      /* Enable debug printouts. */
+      /* On first -d, print version identification */
+      static boolean printed_version = FALSE;
+
+      if (! printed_version) {
+       fprintf(stderr, "Independent JPEG Group's DJPEG, version %s\n%s\n",
+               JVERSION, JCOPYRIGHT);
+       printed_version = TRUE;
+      }
+      cinfo->err->trace_level++;
+
+    } else if (keymatch(arg, "fast", 1)) {
+      /* Select recommended processing options for quick-and-dirty output. */
+      cinfo->two_pass_quantize = FALSE;
+      cinfo->dither_mode = JDITHER_ORDERED;
+      if (! cinfo->quantize_colors) /* don't override an earlier -colors */
+       cinfo->desired_number_of_colors = 216;
+      cinfo->dct_method = JDCT_FASTEST;
+      cinfo->do_fancy_upsampling = FALSE;
+
+    } else if (keymatch(arg, "gif", 1)) {
+      /* GIF output format. */
+      requested_fmt = FMT_GIF;
+
+    } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) {
+      /* Force monochrome output. */
+      cinfo->out_color_space = JCS_GRAYSCALE;
+
+    } else if (keymatch(arg, "map", 3)) {
+      /* Quantize to a color map taken from an input file. */
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      if (for_real) {          /* too expensive to do twice! */
+#ifdef QUANT_2PASS_SUPPORTED   /* otherwise can't quantize to supplied map */
+       FILE * mapfile;
+
+       if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) {
+         fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
+         exit(EXIT_FAILURE);
+       }
+       read_color_map(cinfo, mapfile);
+       fclose(mapfile);
+       cinfo->quantize_colors = TRUE;
+#else
+       ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+      }
+
+    } else if (keymatch(arg, "maxmemory", 3)) {
+      /* Maximum memory in Kb (or Mb with 'm'). */
+      long lval;
+      char ch = 'x';
+
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
+       usage();
+      if (ch == 'm' || ch == 'M')
+       lval *= 1000L;
+      cinfo->mem->max_memory_to_use = lval * 1000L;
+
+    } else if (keymatch(arg, "nosmooth", 3)) {
+      /* Suppress fancy upsampling */
+      cinfo->do_fancy_upsampling = FALSE;
+
+    } else if (keymatch(arg, "onepass", 3)) {
+      /* Use fast one-pass quantization. */
+      cinfo->two_pass_quantize = FALSE;
+
+    } else if (keymatch(arg, "os2", 3)) {
+      /* BMP output format (OS/2 flavor). */
+      requested_fmt = FMT_OS2;
+
+    } else if (keymatch(arg, "outfile", 4)) {
+      /* Set output file name. */
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      outfilename = argv[argn];        /* save it away for later use */
+
+    } else if (keymatch(arg, "pnm", 1) || keymatch(arg, "ppm", 1)) {
+      /* PPM/PGM output format. */
+      requested_fmt = FMT_PPM;
+
+    } else if (keymatch(arg, "rle", 1)) {
+      /* RLE output format. */
+      requested_fmt = FMT_RLE;
+
+    } else if (keymatch(arg, "scale", 1)) {
+      /* Scale the output image by a fraction M/N. */
+      if (++argn >= argc)      /* advance to next argument */
+       usage();
+      if (sscanf(argv[argn], "%d/%d",
+                &cinfo->scale_num, &cinfo->scale_denom) != 2)
+       usage();
+
+    } else if (keymatch(arg, "targa", 1)) {
+      /* Targa output format. */
+      requested_fmt = FMT_TARGA;
+
+    } else {
+      usage();                 /* bogus switch */
+    }
+  }
+
+  return argn;                 /* return index of next arg (file name) */
+}
+
+
+/*
+ * Marker processor for COM and interesting APPn markers.
+ * This replaces the library's built-in processor, which just skips the marker.
+ * We want to print out the marker as text, to the extent possible.
+ * Note this code relies on a non-suspending data source.
+ */
+
+LOCAL(unsigned int)
+jpeg_getc (j_decompress_ptr cinfo)
+/* Read next byte */
+{
+  struct jpeg_source_mgr * datasrc = cinfo->src;
+
+  if (datasrc->bytes_in_buffer == 0) {
+    if (! (*datasrc->fill_input_buffer) (cinfo))
+      ERREXIT(cinfo, JERR_CANT_SUSPEND);
+  }
+  datasrc->bytes_in_buffer--;
+  return GETJOCTET(*datasrc->next_input_byte++);
+}
+
+
+METHODDEF(boolean)
+print_text_marker (j_decompress_ptr cinfo)
+{
+  boolean traceit = (cinfo->err->trace_level >= 1);
+  INT32 length;
+  unsigned int ch;
+  unsigned int lastch = 0;
+
+  length = jpeg_getc(cinfo) << 8;
+  length += jpeg_getc(cinfo);
+  length -= 2;                 /* discount the length word itself */
+
+  if (traceit) {
+    if (cinfo->unread_marker == JPEG_COM)
+      fprintf(stderr, "Comment, length %ld:\n", (long) length);
+    else                       /* assume it is an APPn otherwise */
+      fprintf(stderr, "APP%d, length %ld:\n",
+             cinfo->unread_marker - JPEG_APP0, (long) length);
+  }
+
+  while (--length >= 0) {
+    ch = jpeg_getc(cinfo);
+    if (traceit) {
+      /* Emit the character in a readable form.
+       * Nonprintables are converted to \nnn form,
+       * while \ is converted to \\.
+       * Newlines in CR, CR/LF, or LF form will be printed as one newline.
+       */
+      if (ch == '\r') {
+       fprintf(stderr, "\n");
+      } else if (ch == '\n') {
+       if (lastch != '\r')
+         fprintf(stderr, "\n");
+      } else if (ch == '\\') {
+       fprintf(stderr, "\\\\");
+      } else if (isprint(ch)) {
+       putc(ch, stderr);
+      } else {
+       fprintf(stderr, "\\%03o", ch);
+      }
+      lastch = ch;
+    }
+  }
+
+  if (traceit)
+    fprintf(stderr, "\n");
+
+  return TRUE;
+}
+
+
+/*
+ * The main program.
+ */
+
+int
+main (int argc, char **argv)
+{
+  struct jpeg_decompress_struct cinfo;
+  struct jpeg_error_mgr jerr;
+#ifdef PROGRESS_REPORT
+  struct cdjpeg_progress_mgr progress;
+#endif
+  int file_index;
+  djpeg_dest_ptr dest_mgr = NULL;
+  FILE * input_file;
+  FILE * output_file;
+  JDIMENSION num_scanlines;
+
+  /* On Mac, fetch a command line. */
+#ifdef USE_CCOMMAND
+  argc = ccommand(&argv);
+#endif
+
+  progname = argv[0];
+  if (progname == NULL || progname[0] == 0)
+    progname = "djpeg";                /* in case C library doesn't provide it */
+
+  /* Initialize the JPEG decompression object with default error handling. */
+  cinfo.err = jpeg_std_error(&jerr);
+  jpeg_create_decompress(&cinfo);
+  /* Add some application-specific error messages (from cderror.h) */
+  jerr.addon_message_table = cdjpeg_message_table;
+  jerr.first_addon_message = JMSG_FIRSTADDONCODE;
+  jerr.last_addon_message = JMSG_LASTADDONCODE;
+
+  /* Insert custom marker processor for COM and APP12.
+   * APP12 is used by some digital camera makers for textual info,
+   * so we provide the ability to display it as text.
+   * If you like, additional APPn marker types can be selected for display,
+   * but don't try to override APP0 or APP14 this way (see libjpeg.doc).
+   */
+  jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker);
+  jpeg_set_marker_processor(&cinfo, JPEG_APP0+12, print_text_marker);
+
+  /* Now safe to enable signal catcher. */
+#ifdef NEED_SIGNAL_CATCHER
+  enable_signal_catcher((j_common_ptr) &cinfo);
+#endif
+
+  /* Scan command line to find file names. */
+  /* It is convenient to use just one switch-parsing routine, but the switch
+   * values read here are ignored; we will rescan the switches after opening
+   * the input file.
+   * (Exception: tracing level set here controls verbosity for COM markers
+   * found during jpeg_read_header...)
+   */
+
+  file_index = parse_switches(&cinfo, argc, argv, 0, FALSE);
+
+#ifdef TWO_FILE_COMMANDLINE
+  /* Must have either -outfile switch or explicit output file name */
+  if (outfilename == NULL) {
+    if (file_index != argc-2) {
+      fprintf(stderr, "%s: must name one input and one output file\n",
+             progname);
+      usage();
+    }
+    outfilename = argv[file_index+1];
+  } else {
+    if (file_index != argc-1) {
+      fprintf(stderr, "%s: must name one input and one output file\n",
+             progname);
+      usage();
+    }
+  }
+#else
+  /* Unix style: expect zero or one file name */
+  if (file_index < argc-1) {
+    fprintf(stderr, "%s: only one input file\n", progname);
+    usage();
+  }
+#endif /* TWO_FILE_COMMANDLINE */
+
+  /* Open the input file. */
+  if (file_index < argc) {
+    if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default input file is stdin */
+    input_file = read_stdin();
+  }
+
+  /* Open the output file. */
+  if (outfilename != NULL) {
+    if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, outfilename);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default output file is stdout */
+    output_file = write_stdout();
+  }
+
+#ifdef PROGRESS_REPORT
+  start_progress_monitor((j_common_ptr) &cinfo, &progress);
+#endif
+
+  /* Specify data source for decompression */
+  jpeg_stdio_src(&cinfo, input_file);
+
+  /* Read file header, set default decompression parameters */
+  (void) jpeg_read_header(&cinfo, TRUE);
+
+  /* Adjust default decompression parameters by re-parsing the options */
+  file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);
+
+  /* Initialize the output module now to let it override any crucial
+   * option settings (for instance, GIF wants to force color quantization).
+   */
+  switch (requested_fmt) {
+#ifdef BMP_SUPPORTED
+  case FMT_BMP:
+    dest_mgr = jinit_write_bmp(&cinfo, FALSE);
+    break;
+  case FMT_OS2:
+    dest_mgr = jinit_write_bmp(&cinfo, TRUE);
+    break;
+#endif
+#ifdef GIF_SUPPORTED
+  case FMT_GIF:
+    dest_mgr = jinit_write_gif(&cinfo);
+    break;
+#endif
+#ifdef PPM_SUPPORTED
+  case FMT_PPM:
+    dest_mgr = jinit_write_ppm(&cinfo);
+    break;
+#endif
+#ifdef RLE_SUPPORTED
+  case FMT_RLE:
+    dest_mgr = jinit_write_rle(&cinfo);
+    break;
+#endif
+#ifdef TARGA_SUPPORTED
+  case FMT_TARGA:
+    dest_mgr = jinit_write_targa(&cinfo);
+    break;
+#endif
+  default:
+    ERREXIT(&cinfo, JERR_UNSUPPORTED_FORMAT);
+    break;
+  }
+  dest_mgr->output_file = output_file;
+
+  /* Start decompressor */
+  (void) jpeg_start_decompress(&cinfo);
+
+  /* Write output file header */
+  (*dest_mgr->start_output) (&cinfo, dest_mgr);
+
+  /* Process data */
+  while (cinfo.output_scanline < cinfo.output_height) {
+    num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer,
+                                       dest_mgr->buffer_height);
+    (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines);
+  }
+
+#ifdef PROGRESS_REPORT
+  /* Hack: count final pass as done in case finish_output does an extra pass.
+   * The library won't have updated completed_passes.
+   */
+  progress.pub.completed_passes = progress.pub.total_passes;
+#endif
+
+  /* Finish decompression and release memory.
+   * I must do it in this order because output module has allocated memory
+   * of lifespan JPOOL_IMAGE; it needs to finish before releasing memory.
+   */
+  (*dest_mgr->finish_output) (&cinfo, dest_mgr);
+  (void) jpeg_finish_decompress(&cinfo);
+  jpeg_destroy_decompress(&cinfo);
+
+  /* Close files, if we opened them */
+  if (input_file != stdin)
+    fclose(input_file);
+  if (output_file != stdout)
+    fclose(output_file);
+
+#ifdef PROGRESS_REPORT
+  end_progress_monitor((j_common_ptr) &cinfo);
+#endif
+
+  /* All done. */
+  exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
+  return 0;                    /* suppress no-return-value warnings */
+}
diff --git a/rosapps/lib/libjpeg/example.c b/rosapps/lib/libjpeg/example.c
new file mode 100644 (file)
index 0000000..7fc354f
--- /dev/null
@@ -0,0 +1,433 @@
+/*
+ * example.c
+ *
+ * This file illustrates how to use the IJG code as a subroutine library
+ * to read or write JPEG image files.  You should look at this code in
+ * conjunction with the documentation file libjpeg.doc.
+ *
+ * This code will not do anything useful as-is, but it may be helpful as a
+ * skeleton for constructing routines that call the JPEG library.  
+ *
+ * We present these routines in the same coding style used in the JPEG code
+ * (ANSI function definitions, etc); but you are of course free to code your
+ * routines in a different style if you prefer.
+ */
+
+#include <stdio.h>
+
+/*
+ * Include file for users of JPEG library.
+ * You will need to have included system headers that define at least
+ * the typedefs FILE and size_t before you can include jpeglib.h.
+ * (stdio.h is sufficient on ANSI-conforming systems.)
+ * You may also wish to include "jerror.h".
+ */
+
+#include "jpeglib.h"
+
+/*
+ * <setjmp.h> is used for the optional error recovery mechanism shown in
+ * the second part of the example.
+ */
+
+#include <setjmp.h>
+
+
+
+/******************** JPEG COMPRESSION SAMPLE INTERFACE *******************/
+
+/* This half of the example shows how to feed data into the JPEG compressor.
+ * We present a minimal version that does not worry about refinements such
+ * as error recovery (the JPEG code will just exit() if it gets an error).
+ */
+
+
+/*
+ * IMAGE DATA FORMATS:
+ *
+ * The standard input image format is a rectangular array of pixels, with
+ * each pixel having the same number of "component" values (color channels).
+ * Each pixel row is an array of JSAMPLEs (which typically are unsigned chars).
+ * If you are working with color data, then the color values for each pixel
+ * must be adjacent in the row; for example, R,G,B,R,G,B,R,G,B,... for 24-bit
+ * RGB color.
+ *
+ * For this example, we'll assume that this data structure matches the way
+ * our application has stored the image in memory, so we can just pass a
+ * pointer to our image buffer.  In particular, let's say that the image is
+ * RGB color and is described by:
+ */
+
+extern JSAMPLE * image_buffer; /* Points to large array of R,G,B-order data */
+extern int image_height;       /* Number of rows in image */
+extern int image_width;                /* Number of columns in image */
+
+
+/*
+ * Sample routine for JPEG compression.  We assume that the target file name
+ * and a compression quality factor are passed in.
+ */
+
+GLOBAL(void)
+write_JPEG_file (char * filename, int quality)
+{
+  /* This struct contains the JPEG compression parameters and pointers to
+   * working space (which is allocated as needed by the JPEG library).
+   * It is possible to have several such structures, representing multiple
+   * compression/decompression processes, in existence at once.  We refer
+   * to any one struct (and its associated working data) as a "JPEG object".
+   */
+  struct jpeg_compress_struct cinfo;
+  /* This struct represents a JPEG error handler.  It is declared separately
+   * because applications often want to supply a specialized error handler
+   * (see the second half of this file for an example).  But here we just
+   * take the easy way out and use the standard error handler, which will
+   * print a message on stderr and call exit() if compression fails.
+   * Note that this struct must live as long as the main JPEG parameter
+   * struct, to avoid dangling-pointer problems.
+   */
+  struct jpeg_error_mgr jerr;
+  /* More stuff */
+  FILE * outfile;              /* target file */
+  JSAMPROW row_pointer[1];     /* pointer to JSAMPLE row[s] */
+  int row_stride;              /* physical row width in image buffer */
+
+  /* Step 1: allocate and initialize JPEG compression object */
+
+  /* We have to set up the error handler first, in case the initialization
+   * step fails.  (Unlikely, but it could happen if you are out of memory.)
+   * This routine fills in the contents of struct jerr, and returns jerr's
+   * address which we place into the link field in cinfo.
+   */
+  cinfo.err = jpeg_std_error(&jerr);
+  /* Now we can initialize the JPEG compression object. */
+  jpeg_create_compress(&cinfo);
+
+  /* Step 2: specify data destination (eg, a file) */
+  /* Note: steps 2 and 3 can be done in either order. */
+
+  /* Here we use the library-supplied code to send compressed data to a
+   * stdio stream.  You can also write your own code to do something else.
+   * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
+   * requires it in order to write binary files.
+   */
+  if ((outfile = fopen(filename, "wb")) == NULL) {
+    fprintf(stderr, "can't open %s\n", filename);
+    exit(1);
+  }
+  jpeg_stdio_dest(&cinfo, outfile);
+
+  /* Step 3: set parameters for compression */
+
+  /* First we supply a description of the input image.
+   * Four fields of the cinfo struct must be filled in:
+   */
+  cinfo.image_width = image_width;     /* image width and height, in pixels */
+  cinfo.image_height = image_height;
+  cinfo.input_components = 3;          /* # of color components per pixel */
+  cinfo.in_color_space = JCS_RGB;      /* colorspace of input image */
+  /* Now use the library's routine to set default compression parameters.
+   * (You must set at least cinfo.in_color_space before calling this,
+   * since the defaults depend on the source color space.)
+   */
+  jpeg_set_defaults(&cinfo);
+  /* Now you can set any non-default parameters you wish to.
+   * Here we just illustrate the use of quality (quantization table) scaling:
+   */
+  jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);
+
+  /* Step 4: Start compressor */
+
+  /* TRUE ensures that we will write a complete interchange-JPEG file.
+   * Pass TRUE unless you are very sure of what you're doing.
+   */
+  jpeg_start_compress(&cinfo, TRUE);
+
+  /* Step 5: while (scan lines remain to be written) */
+  /*           jpeg_write_scanlines(...); */
+
+  /* Here we use the library's state variable cinfo.next_scanline as the
+   * loop counter, so that we don't have to keep track ourselves.
+   * To keep things simple, we pass one scanline per call; you can pass
+   * more if you wish, though.
+   */
+  row_stride = image_width * 3;        /* JSAMPLEs per row in image_buffer */
+
+  while (cinfo.next_scanline < cinfo.image_height) {
+    /* jpeg_write_scanlines expects an array of pointers to scanlines.
+     * Here the array is only one element long, but you could pass
+     * more than one scanline at a time if that's more convenient.
+     */
+    row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride];
+    (void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
+  }
+
+  /* Step 6: Finish compression */
+
+  jpeg_finish_compress(&cinfo);
+  /* After finish_compress, we can close the output file. */
+  fclose(outfile);
+
+  /* Step 7: release JPEG compression object */
+
+  /* This is an important step since it will release a good deal of memory. */
+  jpeg_destroy_compress(&cinfo);
+
+  /* And we're done! */
+}
+
+
+/*
+ * SOME FINE POINTS:
+ *
+ * In the above loop, we ignored the return value of jpeg_write_scanlines,
+ * which is the number of scanlines actually written.  We could get away
+ * with this because we were only relying on the value of cinfo.next_scanline,
+ * which will be incremented correctly.  If you maintain additional loop
+ * variables then you should be careful to increment them properly.
+ * Actually, for output to a stdio stream you needn't worry, because
+ * then jpeg_write_scanlines will write all the lines passed (or else exit
+ * with a fatal error).  Partial writes can only occur if you use a data
+ * destination module that can demand suspension of the compressor.
+ * (If you don't know what that's for, you don't need it.)
+ *
+ * If the compressor requires full-image buffers (for entropy-coding
+ * optimization or a multi-scan JPEG file), it will create temporary
+ * files for anything that doesn't fit within the maximum-memory setting.
+ * (Note that temp files are NOT needed if you use the default parameters.)
+ * On some systems you may need to set up a signal handler to ensure that
+ * temporary files are deleted if the program is interrupted.  See libjpeg.doc.
+ *
+ * Scanlines MUST be supplied in top-to-bottom order if you want your JPEG
+ * files to be compatible with everyone else's.  If you cannot readily read
+ * your data in that order, you'll need an intermediate array to hold the
+ * image.  See rdtarga.c or rdbmp.c for examples of handling bottom-to-top
+ * source data using the JPEG code's internal virtual-array mechanisms.
+ */
+
+
+
+/******************** JPEG DECOMPRESSION SAMPLE INTERFACE *******************/
+
+/* This half of the example shows how to read data from the JPEG decompressor.
+ * It's a bit more refined than the above, in that we show:
+ *   (a) how to modify the JPEG library's standard error-reporting behavior;
+ *   (b) how to allocate workspace using the library's memory manager.
+ *
+ * Just to make this example a little different from the first one, we'll
+ * assume that we do not intend to put the whole image into an in-memory
+ * buffer, but to send it line-by-line someplace else.  We need a one-
+ * scanline-high JSAMPLE array as a work buffer, and we will let the JPEG
+ * memory manager allocate it for us.  This approach is actually quite useful
+ * because we don't need to remember to deallocate the buffer separately: it
+ * will go away automatically when the JPEG object is cleaned up.
+ */
+
+
+/*
+ * ERROR HANDLING:
+ *
+ * The JPEG library's standard error handler (jerror.c) is divided into
+ * several "methods" which you can override individually.  This lets you
+ * adjust the behavior without duplicating a lot of code, which you might
+ * have to update with each future release.
+ *
+ * Our example here shows how to override the "error_exit" method so that
+ * control is returned to the library's caller when a fatal error occurs,
+ * rather than calling exit() as the standard error_exit method does.
+ *
+ * We use C's setjmp/longjmp facility to return control.  This means that the
+ * routine which calls the JPEG library must first execute a setjmp() call to
+ * establish the return point.  We want the replacement error_exit to do a
+ * longjmp().  But we need to make the setjmp buffer accessible to the
+ * error_exit routine.  To do this, we make a private extension of the
+ * standard JPEG error handler object.  (If we were using C++, we'd say we
+ * were making a subclass of the regular error handler.)
+ *
+ * Here's the extended error handler struct:
+ */
+
+struct my_error_mgr {
+  struct jpeg_error_mgr pub;   /* "public" fields */
+
+  jmp_buf setjmp_buffer;       /* for return to caller */
+};
+
+typedef struct my_error_mgr * my_error_ptr;
+
+/*
+ * Here's the routine that will replace the standard error_exit method:
+ */
+
+METHODDEF(void)
+my_error_exit (j_common_ptr cinfo)
+{
+  /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
+  my_error_ptr myerr = (my_error_ptr) cinfo->err;
+
+  /* Always display the message. */
+  /* We could postpone this until after returning, if we chose. */
+  (*cinfo->err->output_message) (cinfo);
+
+  /* Return control to the setjmp point */
+  longjmp(myerr->setjmp_buffer, 1);
+}
+
+
+/*
+ * Sample routine for JPEG decompression.  We assume that the source file name
+ * is passed in.  We want to return 1 on success, 0 on error.
+ */
+
+
+GLOBAL(int)
+read_JPEG_file (char * filename)
+{
+  /* This struct contains the JPEG decompression parameters and pointers to
+   * working space (which is allocated as needed by the JPEG library).
+   */
+  struct jpeg_decompress_struct cinfo;
+  /* We use our private extension JPEG error handler.
+   * Note that this struct must live as long as the main JPEG parameter
+   * struct, to avoid dangling-pointer problems.
+   */
+  struct my_error_mgr jerr;
+  /* More stuff */
+  FILE * infile;               /* source file */
+  JSAMPARRAY buffer;           /* Output row buffer */
+  int row_stride;              /* physical row width in output buffer */
+
+  /* In this example we want to open the input file before doing anything else,
+   * so that the setjmp() error recovery below can assume the file is open.
+   * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
+   * requires it in order to read binary files.
+   */
+
+  if ((infile = fopen(filename, "rb")) == NULL) {
+    fprintf(stderr, "can't open %s\n", filename);
+    return 0;
+  }
+
+  /* Step 1: allocate and initialize JPEG decompression object */
+
+  /* We set up the normal JPEG error routines, then override error_exit. */
+  cinfo.err = jpeg_std_error(&jerr.pub);
+  jerr.pub.error_exit = my_error_exit;
+  /* Establish the setjmp return context for my_error_exit to use. */
+  if (setjmp(jerr.setjmp_buffer)) {
+    /* If we get here, the JPEG code has signaled an error.
+     * We need to clean up the JPEG object, close the input file, and return.
+     */
+    jpeg_destroy_decompress(&cinfo);
+    fclose(infile);
+    return 0;
+  }
+  /* Now we can initialize the JPEG decompression object. */
+  jpeg_create_decompress(&cinfo);
+
+  /* Step 2: specify data source (eg, a file) */
+
+  jpeg_stdio_src(&cinfo, infile);
+
+  /* Step 3: read file parameters with jpeg_read_header() */
+
+  (void) jpeg_read_header(&cinfo, TRUE);
+  /* We can ignore the return value from jpeg_read_header since
+   *   (a) suspension is not possible with the stdio data source, and
+   *   (b) we passed TRUE to reject a tables-only JPEG file as an error.
+   * See libjpeg.doc for more info.
+   */
+
+  /* Step 4: set parameters for decompression */
+
+  /* In this example, we don't need to change any of the defaults set by
+   * jpeg_read_header(), so we do nothing here.
+   */
+
+  /* Step 5: Start decompressor */
+
+  (void) jpeg_start_decompress(&cinfo);
+  /* We can ignore the return value since suspension is not possible
+   * with the stdio data source.
+   */
+
+  /* We may need to do some setup of our own at this point before reading
+   * the data.  After jpeg_start_decompress() we have the correct scaled
+   * output image dimensions available, as well as the output colormap
+   * if we asked for color quantization.
+   * In this example, we need to make an output work buffer of the right size.
+   */ 
+  /* JSAMPLEs per row in output buffer */
+  row_stride = cinfo.output_width * cinfo.output_components;
+  /* Make a one-row-high sample array that will go away when done with image */
+  buffer = (*cinfo.mem->alloc_sarray)
+               ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
+
+  /* Step 6: while (scan lines remain to be read) */
+  /*           jpeg_read_scanlines(...); */
+
+  /* Here we use the library's state variable cinfo.output_scanline as the
+   * loop counter, so that we don't have to keep track ourselves.
+   */
+  while (cinfo.output_scanline < cinfo.output_height) {
+    /* jpeg_read_scanlines expects an array of pointers to scanlines.
+     * Here the array is only one element long, but you could ask for
+     * more than one scanline at a time if that's more convenient.
+     */
+    (void) jpeg_read_scanlines(&cinfo, buffer, 1);
+    /* Assume put_scanline_someplace wants a pointer and sample count. */
+    put_scanline_someplace(buffer[0], row_stride);
+  }
+
+  /* Step 7: Finish decompression */
+
+  (void) jpeg_finish_decompress(&cinfo);
+  /* We can ignore the return value since suspension is not possible
+   * with the stdio data source.
+   */
+
+  /* Step 8: Release JPEG decompression object */
+
+  /* This is an important step since it will release a good deal of memory. */
+  jpeg_destroy_decompress(&cinfo);
+
+  /* After finish_decompress, we can close the input file.
+   * Here we postpone it until after no more JPEG errors are possible,
+   * so as to simplify the setjmp error logic above.  (Actually, I don't
+   * think that jpeg_destroy can do an error exit, but why assume anything...)
+   */
+  fclose(infile);
+
+  /* At this point you may want to check to see whether any corrupt-data
+   * warnings occurred (test whether jerr.pub.num_warnings is nonzero).
+   */
+
+  /* And we're done! */
+  return 1;
+}
+
+
+/*
+ * SOME FINE POINTS:
+ *
+ * In the above code, we ignored the return value of jpeg_read_scanlines,
+ * which is the number of scanlines actually read.  We could get away with
+ * this because we asked for only one line at a time and we weren't using
+ * a suspending data source.  See libjpeg.doc for more info.
+ *
+ * We cheated a bit by calling alloc_sarray() after jpeg_start_decompress();
+ * we should have done it beforehand to ensure that the space would be
+ * counted against the JPEG max_memory setting.  In some systems the above
+ * code would risk an out-of-memory error.  However, in general we don't
+ * know the output image dimensions before jpeg_start_decompress(), unless we
+ * call jpeg_calc_output_dimensions().  See libjpeg.doc for more about this.
+ *
+ * Scanlines are returned in the same order as they appear in the JPEG file,
+ * which is standardly top-to-bottom.  If you must emit data bottom-to-top,
+ * you can use one of the virtual arrays provided by the JPEG memory manager
+ * to invert the data.  See wrbmp.c for an example.
+ *
+ * As with compression, some operating modes may require temporary files.
+ * On some systems you may need to set up a signal handler to ensure that
+ * temporary files are deleted if the program is interrupted.  See libjpeg.doc.
+ */
diff --git a/rosapps/lib/libjpeg/jcapimin.c b/rosapps/lib/libjpeg/jcapimin.c
new file mode 100644 (file)
index 0000000..54fb8c5
--- /dev/null
@@ -0,0 +1,280 @@
+/*
+ * jcapimin.c
+ *
+ * Copyright (C) 1994-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains application interface code for the compression half
+ * of the JPEG library.  These are the "minimum" API routines that may be
+ * needed in either the normal full-compression case or the transcoding-only
+ * case.
+ *
+ * Most of the routines intended to be called directly by an application
+ * are in this file or in jcapistd.c.  But also see jcparam.c for
+ * parameter-setup helper routines, jcomapi.c for routines shared by
+ * compression and decompression, and jctrans.c for the transcoding case.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/*
+ * Initialization of a JPEG compression object.
+ * The error manager must already be set up (in case memory manager fails).
+ */
+
+GLOBAL(void)
+jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
+{
+  int i;
+
+  /* Guard against version mismatches between library and caller. */
+  cinfo->mem = NULL;           /* so jpeg_destroy knows mem mgr not called */
+  if (version != JPEG_LIB_VERSION)
+    ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
+  if (structsize != SIZEOF(struct jpeg_compress_struct))
+    ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, 
+            (int) SIZEOF(struct jpeg_compress_struct), (int) structsize);
+
+  /* For debugging purposes, we zero the whole master structure.
+   * But the application has already set the err pointer, and may have set
+   * client_data, so we have to save and restore those fields.
+   * Note: if application hasn't set client_data, tools like Purify may
+   * complain here.
+   */
+  {
+    struct jpeg_error_mgr * err = cinfo->err;
+    void * client_data = cinfo->client_data; /* ignore Purify complaint here */
+    MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct));
+    cinfo->err = err;
+    cinfo->client_data = client_data;
+  }
+  cinfo->is_decompressor = FALSE;
+
+  /* Initialize a memory manager instance for this object */
+  jinit_memory_mgr((j_common_ptr) cinfo);
+
+  /* Zero out pointers to permanent structures. */
+  cinfo->progress = NULL;
+  cinfo->dest = NULL;
+
+  cinfo->comp_info = NULL;
+
+  for (i = 0; i < NUM_QUANT_TBLS; i++)
+    cinfo->quant_tbl_ptrs[i] = NULL;
+
+  for (i = 0; i < NUM_HUFF_TBLS; i++) {
+    cinfo->dc_huff_tbl_ptrs[i] = NULL;
+    cinfo->ac_huff_tbl_ptrs[i] = NULL;
+  }
+
+  cinfo->script_space = NULL;
+
+  cinfo->input_gamma = 1.0;    /* in case application forgets */
+
+  /* OK, I'm ready */
+  cinfo->global_state = CSTATE_START;
+}
+
+
+/*
+ * Destruction of a JPEG compression object
+ */
+
+GLOBAL(void)
+jpeg_destroy_compress (j_compress_ptr cinfo)
+{
+  jpeg_destroy((j_common_ptr) cinfo); /* use common routine */
+}
+
+
+/*
+ * Abort processing of a JPEG compression operation,
+ * but don't destroy the object itself.
+ */
+
+GLOBAL(void)
+jpeg_abort_compress (j_compress_ptr cinfo)
+{
+  jpeg_abort((j_common_ptr) cinfo); /* use common routine */
+}
+
+
+/*
+ * Forcibly suppress or un-suppress all quantization and Huffman tables.
+ * Marks all currently defined tables as already written (if suppress)
+ * or not written (if !suppress).  This will control whether they get emitted
+ * by a subsequent jpeg_start_compress call.
+ *
+ * This routine is exported for use by applications that want to produce
+ * abbreviated JPEG datastreams.  It logically belongs in jcparam.c, but
+ * since it is called by jpeg_start_compress, we put it here --- otherwise
+ * jcparam.o would be linked whether the application used it or not.
+ */
+
+GLOBAL(void)
+jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress)
+{
+  int i;
+  JQUANT_TBL * qtbl;
+  JHUFF_TBL * htbl;
+
+  for (i = 0; i < NUM_QUANT_TBLS; i++) {
+    if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL)
+      qtbl->sent_table = suppress;
+  }
+
+  for (i = 0; i < NUM_HUFF_TBLS; i++) {
+    if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL)
+      htbl->sent_table = suppress;
+    if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL)
+      htbl->sent_table = suppress;
+  }
+}
+
+
+/*
+ * Finish JPEG compression.
+ *
+ * If a multipass operating mode was selected, this may do a great deal of
+ * work including most of the actual output.
+ */
+
+GLOBAL(void)
+jpeg_finish_compress (j_compress_ptr cinfo)
+{
+  JDIMENSION iMCU_row;
+
+  if (cinfo->global_state == CSTATE_SCANNING ||
+      cinfo->global_state == CSTATE_RAW_OK) {
+    /* Terminate first pass */
+    if (cinfo->next_scanline < cinfo->image_height)
+      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
+    (*cinfo->master->finish_pass) (cinfo);
+  } else if (cinfo->global_state != CSTATE_WRCOEFS)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  /* Perform any remaining passes */
+  while (! cinfo->master->is_last_pass) {
+    (*cinfo->master->prepare_for_pass) (cinfo);
+    for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
+      if (cinfo->progress != NULL) {
+       cinfo->progress->pass_counter = (long) iMCU_row;
+       cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows;
+       (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+      }
+      /* We bypass the main controller and invoke coef controller directly;
+       * all work is being done from the coefficient buffer.
+       */
+      if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL))
+       ERREXIT(cinfo, JERR_CANT_SUSPEND);
+    }
+    (*cinfo->master->finish_pass) (cinfo);
+  }
+  /* Write EOI, do final cleanup */
+  (*cinfo->marker->write_file_trailer) (cinfo);
+  (*cinfo->dest->term_destination) (cinfo);
+  /* We can use jpeg_abort to release memory and reset global_state */
+  jpeg_abort((j_common_ptr) cinfo);
+}
+
+
+/*
+ * Write a special marker.
+ * This is only recommended for writing COM or APPn markers.
+ * Must be called after jpeg_start_compress() and before
+ * first call to jpeg_write_scanlines() or jpeg_write_raw_data().
+ */
+
+GLOBAL(void)
+jpeg_write_marker (j_compress_ptr cinfo, int marker,
+                  const JOCTET *dataptr, unsigned int datalen)
+{
+  JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val));
+
+  if (cinfo->next_scanline != 0 ||
+      (cinfo->global_state != CSTATE_SCANNING &&
+       cinfo->global_state != CSTATE_RAW_OK &&
+       cinfo->global_state != CSTATE_WRCOEFS))
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  (*cinfo->marker->write_marker_header) (cinfo, marker, datalen);
+  write_marker_byte = cinfo->marker->write_marker_byte;        /* copy for speed */
+  while (datalen--) {
+    (*write_marker_byte) (cinfo, *dataptr);
+    dataptr++;
+  }
+}
+
+/* Same, but piecemeal. */
+
+GLOBAL(void)
+jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
+{
+  if (cinfo->next_scanline != 0 ||
+      (cinfo->global_state != CSTATE_SCANNING &&
+       cinfo->global_state != CSTATE_RAW_OK &&
+       cinfo->global_state != CSTATE_WRCOEFS))
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  (*cinfo->marker->write_marker_header) (cinfo, marker, datalen);
+}
+
+GLOBAL(void)
+jpeg_write_m_byte (j_compress_ptr cinfo, int val)
+{
+  (*cinfo->marker->write_marker_byte) (cinfo, val);
+}
+
+
+/*
+ * Alternate compression function: just write an abbreviated table file.
+ * Before calling this, all parameters and a data destination must be set up.
+ *
+ * To produce a pair of files containing abbreviated tables and abbreviated
+ * image data, one would proceed as follows:
+ *
+ *             initialize JPEG object
+ *             set JPEG parameters
+ *             set destination to table file
+ *             jpeg_write_tables(cinfo);
+ *             set destination to image file
+ *             jpeg_start_compress(cinfo, FALSE);
+ *             write data...
+ *             jpeg_finish_compress(cinfo);
+ *
+ * jpeg_write_tables has the side effect of marking all tables written
+ * (same as jpeg_suppress_tables(..., TRUE)).  Thus a subsequent start_compress
+ * will not re-emit the tables unless it is passed write_all_tables=TRUE.
+ */
+
+GLOBAL(void)
+jpeg_write_tables (j_compress_ptr cinfo)
+{
+  if (cinfo->global_state != CSTATE_START)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  /* (Re)initialize error mgr and destination modules */
+  (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
+  (*cinfo->dest->init_destination) (cinfo);
+  /* Initialize the marker writer ... bit of a crock to do it here. */
+  jinit_marker_writer(cinfo);
+  /* Write them tables! */
+  (*cinfo->marker->write_tables_only) (cinfo);
+  /* And clean up. */
+  (*cinfo->dest->term_destination) (cinfo);
+  /*
+   * In library releases up through v6a, we called jpeg_abort() here to free
+   * any working memory allocated by the destination manager and marker
+   * writer.  Some applications had a problem with that: they allocated space
+   * of their own from the library memory manager, and didn't want it to go
+   * away during write_tables.  So now we do nothing.  This will cause a
+   * memory leak if an app calls write_tables repeatedly without doing a full
+   * compression cycle or otherwise resetting the JPEG object.  However, that
+   * seems less bad than unexpectedly freeing memory in the normal case.
+   * An app that prefers the old behavior can call jpeg_abort for itself after
+   * each call to jpeg_write_tables().
+   */
+}
diff --git a/rosapps/lib/libjpeg/jcapistd.c b/rosapps/lib/libjpeg/jcapistd.c
new file mode 100644 (file)
index 0000000..c0320b1
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * jcapistd.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains application interface code for the compression half
+ * of the JPEG library.  These are the "standard" API routines that are
+ * used in the normal full-compression case.  They are not used by a
+ * transcoding-only application.  Note that if an application links in
+ * jpeg_start_compress, it will end up linking in the entire compressor.
+ * We thus must separate this file from jcapimin.c to avoid linking the
+ * whole compression library into a transcoder.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/*
+ * Compression initialization.
+ * Before calling this, all parameters and a data destination must be set up.
+ *
+ * We require a write_all_tables parameter as a failsafe check when writing
+ * multiple datastreams from the same compression object.  Since prior runs
+ * will have left all the tables marked sent_table=TRUE, a subsequent run
+ * would emit an abbreviated stream (no tables) by default.  This may be what
+ * is wanted, but for safety's sake it should not be the default behavior:
+ * programmers should have to make a deliberate choice to emit abbreviated
+ * images.  Therefore the documentation and examples should encourage people
+ * to pass write_all_tables=TRUE; then it will take active thought to do the
+ * wrong thing.
+ */
+
+GLOBAL(void)
+jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
+{
+  if (cinfo->global_state != CSTATE_START)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  if (write_all_tables)
+    jpeg_suppress_tables(cinfo, FALSE);        /* mark all tables to be written */
+
+  /* (Re)initialize error mgr and destination modules */
+  (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
+  (*cinfo->dest->init_destination) (cinfo);
+  /* Perform master selection of active modules */
+  jinit_compress_master(cinfo);
+  /* Set up for the first pass */
+  (*cinfo->master->prepare_for_pass) (cinfo);
+  /* Ready for application to drive first pass through jpeg_write_scanlines
+   * or jpeg_write_raw_data.
+   */
+  cinfo->next_scanline = 0;
+  cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
+}
+
+
+/*
+ * Write some scanlines of data to the JPEG compressor.
+ *
+ * The return value will be the number of lines actually written.
+ * This should be less than the supplied num_lines only in case that
+ * the data destination module has requested suspension of the compressor,
+ * or if more than image_height scanlines are passed in.
+ *
+ * Note: we warn about excess calls to jpeg_write_scanlines() since
+ * this likely signals an application programmer error.  However,
+ * excess scanlines passed in the last valid call are *silently* ignored,
+ * so that the application need not adjust num_lines for end-of-image
+ * when using a multiple-scanline buffer.
+ */
+
+GLOBAL(JDIMENSION)
+jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
+                     JDIMENSION num_lines)
+{
+  JDIMENSION row_ctr, rows_left;
+
+  if (cinfo->global_state != CSTATE_SCANNING)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  if (cinfo->next_scanline >= cinfo->image_height)
+    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
+
+  /* Call progress monitor hook if present */
+  if (cinfo->progress != NULL) {
+    cinfo->progress->pass_counter = (long) cinfo->next_scanline;
+    cinfo->progress->pass_limit = (long) cinfo->image_height;
+    (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+  }
+
+  /* Give master control module another chance if this is first call to
+   * jpeg_write_scanlines.  This lets output of the frame/scan headers be
+   * delayed so that application can write COM, etc, markers between
+   * jpeg_start_compress and jpeg_write_scanlines.
+   */
+  if (cinfo->master->call_pass_startup)
+    (*cinfo->master->pass_startup) (cinfo);
+
+  /* Ignore any extra scanlines at bottom of image. */
+  rows_left = cinfo->image_height - cinfo->next_scanline;
+  if (num_lines > rows_left)
+    num_lines = rows_left;
+
+  row_ctr = 0;
+  (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines);
+  cinfo->next_scanline += row_ctr;
+  return row_ctr;
+}
+
+
+/*
+ * Alternate entry point to write raw data.
+ * Processes exactly one iMCU row per call, unless suspended.
+ */
+
+GLOBAL(JDIMENSION)
+jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
+                    JDIMENSION num_lines)
+{
+  JDIMENSION lines_per_iMCU_row;
+
+  if (cinfo->global_state != CSTATE_RAW_OK)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  if (cinfo->next_scanline >= cinfo->image_height) {
+    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
+    return 0;
+  }
+
+  /* Call progress monitor hook if present */
+  if (cinfo->progress != NULL) {
+    cinfo->progress->pass_counter = (long) cinfo->next_scanline;
+    cinfo->progress->pass_limit = (long) cinfo->image_height;
+    (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+  }
+
+  /* Give master control module another chance if this is first call to
+   * jpeg_write_raw_data.  This lets output of the frame/scan headers be
+   * delayed so that application can write COM, etc, markers between
+   * jpeg_start_compress and jpeg_write_raw_data.
+   */
+  if (cinfo->master->call_pass_startup)
+    (*cinfo->master->pass_startup) (cinfo);
+
+  /* Verify that at least one iMCU row has been passed. */
+  lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE;
+  if (num_lines < lines_per_iMCU_row)
+    ERREXIT(cinfo, JERR_BUFFER_SIZE);
+
+  /* Directly compress the row. */
+  if (! (*cinfo->coef->compress_data) (cinfo, data)) {
+    /* If compressor did not consume the whole row, suspend processing. */
+    return 0;
+  }
+
+  /* OK, we processed one iMCU row. */
+  cinfo->next_scanline += lines_per_iMCU_row;
+  return lines_per_iMCU_row;
+}
diff --git a/rosapps/lib/libjpeg/jccoefct.c b/rosapps/lib/libjpeg/jccoefct.c
new file mode 100644 (file)
index 0000000..1963ddb
--- /dev/null
@@ -0,0 +1,449 @@
+/*
+ * jccoefct.c
+ *
+ * Copyright (C) 1994-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the coefficient buffer controller for compression.
+ * This controller is the top level of the JPEG compressor proper.
+ * The coefficient buffer lies between forward-DCT and entropy encoding steps.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* We use a full-image coefficient buffer when doing Huffman optimization,
+ * and also for writing multiple-scan JPEG files.  In all cases, the DCT
+ * step is run during the first pass, and subsequent passes need only read
+ * the buffered coefficients.
+ */
+#ifdef ENTROPY_OPT_SUPPORTED
+#define FULL_COEF_BUFFER_SUPPORTED
+#else
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+#define FULL_COEF_BUFFER_SUPPORTED
+#endif
+#endif
+
+
+/* Private buffer controller object */
+
+typedef struct {
+  struct jpeg_c_coef_controller pub; /* public fields */
+
+  JDIMENSION iMCU_row_num;     /* iMCU row # within image */
+  JDIMENSION mcu_ctr;          /* counts MCUs processed in current row */
+  int MCU_vert_offset;         /* counts MCU rows within iMCU row */
+  int MCU_rows_per_iMCU_row;   /* number of such rows needed */
+
+  /* For single-pass compression, it's sufficient to buffer just one MCU
+   * (although this may prove a bit slow in practice).  We allocate a
+   * workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it for each
+   * MCU constructed and sent.  (On 80x86, the workspace is FAR even though
+   * it's not really very big; this is to keep the module interfaces unchanged
+   * when a large coefficient buffer is necessary.)
+   * In multi-pass modes, this array points to the current MCU's blocks
+   * within the virtual arrays.
+   */
+  JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU];
+
+  /* In multi-pass modes, we need a virtual block array for each component. */
+  jvirt_barray_ptr whole_image[MAX_COMPONENTS];
+} my_coef_controller;
+
+typedef my_coef_controller * my_coef_ptr;
+
+
+/* Forward declarations */
+METHODDEF(boolean) compress_data
+    JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
+#ifdef FULL_COEF_BUFFER_SUPPORTED
+METHODDEF(boolean) compress_first_pass
+    JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
+METHODDEF(boolean) compress_output
+    JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
+#endif
+
+
+LOCAL(void)
+start_iMCU_row (j_compress_ptr cinfo)
+/* Reset within-iMCU-row counters for a new row */
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+
+  /* In an interleaved scan, an MCU row is the same as an iMCU row.
+   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
+   * But at the bottom of the image, process only what's left.
+   */
+  if (cinfo->comps_in_scan > 1) {
+    coef->MCU_rows_per_iMCU_row = 1;
+  } else {
+    if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1))
+      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
+    else
+      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
+  }
+
+  coef->mcu_ctr = 0;
+  coef->MCU_vert_offset = 0;
+}
+
+
+/*
+ * Initialize for a processing pass.
+ */
+
+METHODDEF(void)
+start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+
+  coef->iMCU_row_num = 0;
+  start_iMCU_row(cinfo);
+
+  switch (pass_mode) {
+  case JBUF_PASS_THRU:
+    if (coef->whole_image[0] != NULL)
+      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    coef->pub.compress_data = compress_data;
+    break;
+#ifdef FULL_COEF_BUFFER_SUPPORTED
+  case JBUF_SAVE_AND_PASS:
+    if (coef->whole_image[0] == NULL)
+      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    coef->pub.compress_data = compress_first_pass;
+    break;
+  case JBUF_CRANK_DEST:
+    if (coef->whole_image[0] == NULL)
+      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    coef->pub.compress_data = compress_output;
+    break;
+#endif
+  default:
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    break;
+  }
+}
+
+
+/*
+ * Process some data in the single-pass case.
+ * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
+ * per call, ie, v_samp_factor block rows for each component in the image.
+ * Returns TRUE if the iMCU row is completed, FALSE if suspended.
+ *
+ * NB: input_buf contains a plane for each component in image,
+ * which we index according to the component's SOF position.
+ */
+
+METHODDEF(boolean)
+compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  JDIMENSION MCU_col_num;      /* index of current MCU within row */
+  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
+  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
+  int blkn, bi, ci, yindex, yoffset, blockcnt;
+  JDIMENSION ypos, xpos;
+  jpeg_component_info *compptr;
+
+  /* Loop to write as much as one whole iMCU row */
+  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
+       yoffset++) {
+    for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col;
+        MCU_col_num++) {
+      /* Determine where data comes from in input_buf and do the DCT thing.
+       * Each call on forward_DCT processes a horizontal row of DCT blocks
+       * as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks
+       * sequentially.  Dummy blocks at the right or bottom edge are filled in
+       * specially.  The data in them does not matter for image reconstruction,
+       * so we fill them with values that will encode to the smallest amount of
+       * data, viz: all zeroes in the AC entries, DC entries equal to previous
+       * block's DC value.  (Thanks to Thomas Kinsman for this idea.)
+       */
+      blkn = 0;
+      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+       compptr = cinfo->cur_comp_info[ci];
+       blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
+                                               : compptr->last_col_width;
+       xpos = MCU_col_num * compptr->MCU_sample_width;
+       ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
+       for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
+         if (coef->iMCU_row_num < last_iMCU_row ||
+             yoffset+yindex < compptr->last_row_height) {
+           (*cinfo->fdct->forward_DCT) (cinfo, compptr,
+                                        input_buf[compptr->component_index],
+                                        coef->MCU_buffer[blkn],
+                                        ypos, xpos, (JDIMENSION) blockcnt);
+           if (blockcnt < compptr->MCU_width) {
+             /* Create some dummy blocks at the right edge of the image. */
+             jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt],
+                       (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK));
+             for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
+               coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
+             }
+           }
+         } else {
+           /* Create a row of dummy blocks at the bottom of the image. */
+           jzero_far((void FAR *) coef->MCU_buffer[blkn],
+                     compptr->MCU_width * SIZEOF(JBLOCK));
+           for (bi = 0; bi < compptr->MCU_width; bi++) {
+             coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
+           }
+         }
+         blkn += compptr->MCU_width;
+         ypos += DCTSIZE;
+       }
+      }
+      /* Try to write the MCU.  In event of a suspension failure, we will
+       * re-DCT the MCU on restart (a bit inefficient, could be fixed...)
+       */
+      if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
+       /* Suspension forced; update state counters and exit */
+       coef->MCU_vert_offset = yoffset;
+       coef->mcu_ctr = MCU_col_num;
+       return FALSE;
+      }
+    }
+    /* Completed an MCU row, but perhaps not an iMCU row */
+    coef->mcu_ctr = 0;
+  }
+  /* Completed the iMCU row, advance counters for next one */
+  coef->iMCU_row_num++;
+  start_iMCU_row(cinfo);
+  return TRUE;
+}
+
+
+#ifdef FULL_COEF_BUFFER_SUPPORTED
+
+/*
+ * Process some data in the first pass of a multi-pass case.
+ * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
+ * per call, ie, v_samp_factor block rows for each component in the image.
+ * This amount of data is read from the source buffer, DCT'd and quantized,
+ * and saved into the virtual arrays.  We also generate suitable dummy blocks
+ * as needed at the right and lower edges.  (The dummy blocks are constructed
+ * in the virtual arrays, which have been padded appropriately.)  This makes
+ * it possible for subsequent passes not to worry about real vs. dummy blocks.
+ *
+ * We must also emit the data to the entropy encoder.  This is conveniently
+ * done by calling compress_output() after we've loaded the current strip
+ * of the virtual arrays.
+ *
+ * NB: input_buf contains a plane for each component in image.  All
+ * components are DCT'd and loaded into the virtual arrays in this pass.
+ * However, it may be that only a subset of the components are emitted to
+ * the entropy encoder during this first pass; be careful about looking
+ * at the scan-dependent variables (MCU dimensions, etc).
+ */
+
+METHODDEF(boolean)
+compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
+  JDIMENSION blocks_across, MCUs_across, MCUindex;
+  int bi, ci, h_samp_factor, block_row, block_rows, ndummy;
+  JCOEF lastDC;
+  jpeg_component_info *compptr;
+  JBLOCKARRAY buffer;
+  JBLOCKROW thisblockrow, lastblockrow;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* Align the virtual buffer for this component. */
+    buffer = (*cinfo->mem->access_virt_barray)
+      ((j_common_ptr) cinfo, coef->whole_image[ci],
+       coef->iMCU_row_num * compptr->v_samp_factor,
+       (JDIMENSION) compptr->v_samp_factor, TRUE);
+    /* Count non-dummy DCT block rows in this iMCU row. */
+    if (coef->iMCU_row_num < last_iMCU_row)
+      block_rows = compptr->v_samp_factor;
+    else {
+      /* NB: can't use last_row_height here, since may not be set! */
+      block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
+      if (block_rows == 0) block_rows = compptr->v_samp_factor;
+    }
+    blocks_across = compptr->width_in_blocks;
+    h_samp_factor = compptr->h_samp_factor;
+    /* Count number of dummy blocks to be added at the right margin. */
+    ndummy = (int) (blocks_across % h_samp_factor);
+    if (ndummy > 0)
+      ndummy = h_samp_factor - ndummy;
+    /* Perform DCT for all non-dummy blocks in this iMCU row.  Each call
+     * on forward_DCT processes a complete horizontal row of DCT blocks.
+     */
+    for (block_row = 0; block_row < block_rows; block_row++) {
+      thisblockrow = buffer[block_row];
+      (*cinfo->fdct->forward_DCT) (cinfo, compptr,
+                                  input_buf[ci], thisblockrow,
+                                  (JDIMENSION) (block_row * DCTSIZE),
+                                  (JDIMENSION) 0, blocks_across);
+      if (ndummy > 0) {
+       /* Create dummy blocks at the right edge of the image. */
+       thisblockrow += blocks_across; /* => first dummy block */
+       jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK));
+       lastDC = thisblockrow[-1][0];
+       for (bi = 0; bi < ndummy; bi++) {
+         thisblockrow[bi][0] = lastDC;
+       }
+      }
+    }
+    /* If at end of image, create dummy block rows as needed.
+     * The tricky part here is that within each MCU, we want the DC values
+     * of the dummy blocks to match the last real block's DC value.
+     * This squeezes a few more bytes out of the resulting file...
+     */
+    if (coef->iMCU_row_num == last_iMCU_row) {
+      blocks_across += ndummy; /* include lower right corner */
+      MCUs_across = blocks_across / h_samp_factor;
+      for (block_row = block_rows; block_row < compptr->v_samp_factor;
+          block_row++) {
+       thisblockrow = buffer[block_row];
+       lastblockrow = buffer[block_row-1];
+       jzero_far((void FAR *) thisblockrow,
+                 (size_t) (blocks_across * SIZEOF(JBLOCK)));
+       for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
+         lastDC = lastblockrow[h_samp_factor-1][0];
+         for (bi = 0; bi < h_samp_factor; bi++) {
+           thisblockrow[bi][0] = lastDC;
+         }
+         thisblockrow += h_samp_factor; /* advance to next MCU in row */
+         lastblockrow += h_samp_factor;
+       }
+      }
+    }
+  }
+  /* NB: compress_output will increment iMCU_row_num if successful.
+   * A suspension return will result in redoing all the work above next time.
+   */
+
+  /* Emit data to the entropy encoder, sharing code with subsequent passes */
+  return compress_output(cinfo, input_buf);
+}
+
+
+/*
+ * Process some data in subsequent passes of a multi-pass case.
+ * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
+ * per call, ie, v_samp_factor block rows for each component in the scan.
+ * The data is obtained from the virtual arrays and fed to the entropy coder.
+ * Returns TRUE if the iMCU row is completed, FALSE if suspended.
+ *
+ * NB: input_buf is ignored; it is likely to be a NULL pointer.
+ */
+
+METHODDEF(boolean)
+compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  JDIMENSION MCU_col_num;      /* index of current MCU within row */
+  int blkn, ci, xindex, yindex, yoffset;
+  JDIMENSION start_col;
+  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
+  JBLOCKROW buffer_ptr;
+  jpeg_component_info *compptr;
+
+  /* Align the virtual buffers for the components used in this scan.
+   * NB: during first pass, this is safe only because the buffers will
+   * already be aligned properly, so jmemmgr.c won't need to do any I/O.
+   */
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    compptr = cinfo->cur_comp_info[ci];
+    buffer[ci] = (*cinfo->mem->access_virt_barray)
+      ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
+       coef->iMCU_row_num * compptr->v_samp_factor,
+       (JDIMENSION) compptr->v_samp_factor, FALSE);
+  }
+
+  /* Loop to process one whole iMCU row */
+  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
+       yoffset++) {
+    for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
+        MCU_col_num++) {
+      /* Construct list of pointers to DCT blocks belonging to this MCU */
+      blkn = 0;                        /* index of current DCT block within MCU */
+      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+       compptr = cinfo->cur_comp_info[ci];
+       start_col = MCU_col_num * compptr->MCU_width;
+       for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
+         buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
+         for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
+           coef->MCU_buffer[blkn++] = buffer_ptr++;
+         }
+       }
+      }
+      /* Try to write the MCU. */
+      if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
+       /* Suspension forced; update state counters and exit */
+       coef->MCU_vert_offset = yoffset;
+       coef->mcu_ctr = MCU_col_num;
+       return FALSE;
+      }
+    }
+    /* Completed an MCU row, but perhaps not an iMCU row */
+    coef->mcu_ctr = 0;
+  }
+  /* Completed the iMCU row, advance counters for next one */
+  coef->iMCU_row_num++;
+  start_iMCU_row(cinfo);
+  return TRUE;
+}
+
+#endif /* FULL_COEF_BUFFER_SUPPORTED */
+
+
+/*
+ * Initialize coefficient buffer controller.
+ */
+
+GLOBAL(void)
+jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
+{
+  my_coef_ptr coef;
+
+  coef = (my_coef_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+                               SIZEOF(my_coef_controller));
+  cinfo->coef = (struct jpeg_c_coef_controller *) coef;
+  coef->pub.start_pass = start_pass_coef;
+
+  /* Create the coefficient buffer. */
+  if (need_full_buffer) {
+#ifdef FULL_COEF_BUFFER_SUPPORTED
+    /* Allocate a full-image virtual array for each component, */
+    /* padded to a multiple of samp_factor DCT blocks in each direction. */
+    int ci;
+    jpeg_component_info *compptr;
+
+    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+        ci++, compptr++) {
+      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
+       ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
+        (JDIMENSION) jround_up((long) compptr->width_in_blocks,
+                               (long) compptr->h_samp_factor),
+        (JDIMENSION) jround_up((long) compptr->height_in_blocks,
+                               (long) compptr->v_samp_factor),
+        (JDIMENSION) compptr->v_samp_factor);
+    }
+#else
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+#endif
+  } else {
+    /* We only need a single-MCU buffer. */
+    JBLOCKROW buffer;
+    int i;
+
+    buffer = (JBLOCKROW)
+      (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+                                 C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
+    for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
+      coef->MCU_buffer[i] = buffer + i;
+    }
+    coef->whole_image[0] = NULL; /* flag for no virtual arrays */
+  }
+}
diff --git a/rosapps/lib/libjpeg/jccolor.c b/rosapps/lib/libjpeg/jccolor.c
new file mode 100644 (file)
index 0000000..0a8a4b5
--- /dev/null
@@ -0,0 +1,459 @@
+/*
+ * jccolor.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains input colorspace conversion routines.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Private subobject */
+
+typedef struct {
+  struct jpeg_color_converter pub; /* public fields */
+
+  /* Private state for RGB->YCC conversion */
+  INT32 * rgb_ycc_tab;         /* => table for RGB to YCbCr conversion */
+} my_color_converter;
+
+typedef my_color_converter * my_cconvert_ptr;
+
+
+/**************** RGB -> YCbCr conversion: most common case **************/
+
+/*
+ * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
+ * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
+ * The conversion equations to be implemented are therefore
+ *     Y  =  0.29900 * R + 0.58700 * G + 0.11400 * B
+ *     Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B  + CENTERJSAMPLE
+ *     Cr =  0.50000 * R - 0.41869 * G - 0.08131 * B  + CENTERJSAMPLE
+ * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
+ * Note: older versions of the IJG code used a zero offset of MAXJSAMPLE/2,
+ * rather than CENTERJSAMPLE, for Cb and Cr.  This gave equal positive and
+ * negative swings for Cb/Cr, but meant that grayscale values (Cb=Cr=0)
+ * were not represented exactly.  Now we sacrifice exact representation of
+ * maximum red and maximum blue in order to get exact grayscales.
+ *
+ * To avoid floating-point arithmetic, we represent the fractional constants
+ * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
+ * the products by 2^16, with appropriate rounding, to get the correct answer.
+ *
+ * For even more speed, we avoid doing any multiplications in the inner loop
+ * by precalculating the constants times R,G,B for all possible values.
+ * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
+ * for 12-bit samples it is still acceptable.  It's not very reasonable for
+ * 16-bit samples, but if you want lossless storage you shouldn't be changing
+ * colorspace anyway.
+ * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included
+ * in the tables to save adding them separately in the inner loop.
+ */
+
+#define SCALEBITS      16      /* speediest right-shift on some machines */
+#define CBCR_OFFSET    ((INT32) CENTERJSAMPLE << SCALEBITS)
+#define ONE_HALF       ((INT32) 1 << (SCALEBITS-1))
+#define FIX(x)         ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
+
+/* We allocate one big table and divide it up into eight parts, instead of
+ * doing eight alloc_small requests.  This lets us use a single table base
+ * address, which can be held in a register in the inner loops on many
+ * machines (more than can hold all eight addresses, anyway).
+ */
+
+#define R_Y_OFF                0                       /* offset to R => Y section */
+#define G_Y_OFF                (1*(MAXJSAMPLE+1))      /* offset to G => Y section */
+#define B_Y_OFF                (2*(MAXJSAMPLE+1))      /* etc. */
+#define R_CB_OFF       (3*(MAXJSAMPLE+1))
+#define G_CB_OFF       (4*(MAXJSAMPLE+1))
+#define B_CB_OFF       (5*(MAXJSAMPLE+1))
+#define R_CR_OFF       B_CB_OFF                /* B=>Cb, R=>Cr are the same */
+#define G_CR_OFF       (6*(MAXJSAMPLE+1))
+#define B_CR_OFF       (7*(MAXJSAMPLE+1))
+#define TABLE_SIZE     (8*(MAXJSAMPLE+1))
+
+
+/*
+ * Initialize for RGB->YCC colorspace conversion.
+ */
+
+METHODDEF(void)
+rgb_ycc_start (j_compress_ptr cinfo)
+{
+  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+  INT32 * rgb_ycc_tab;
+  INT32 i;
+
+  /* Allocate and fill in the conversion tables. */
+  cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+                               (TABLE_SIZE * SIZEOF(INT32)));
+
+  for (i = 0; i <= MAXJSAMPLE; i++) {
+    rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i;
+    rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i;
+    rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i     + ONE_HALF;
+    rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i;
+    rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i;
+    /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
+     * This ensures that the maximum output will round to MAXJSAMPLE
+     * not MAXJSAMPLE+1, and thus that we don't have to range-limit.
+     */
+    rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i    + CBCR_OFFSET + ONE_HALF-1;
+/*  B=>Cb and R=>Cr tables are the same
+    rgb_ycc_tab[i+R_CR_OFF] = FIX(0.50000) * i    + CBCR_OFFSET + ONE_HALF-1;
+*/
+    rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.41869)) * i;
+    rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.08131)) * i;
+  }
+}
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ *
+ * Note that we change from the application's interleaved-pixel format
+ * to our internal noninterleaved, one-plane-per-component format.
+ * The input buffer is therefore three times as wide as the output buffer.
+ *
+ * A starting row offset is provided only for the output buffer.  The caller
+ * can easily adjust the passed input_buf value to accommodate any row
+ * offset required on that side.
+ */
+
+METHODDEF(void)
+rgb_ycc_convert (j_compress_ptr cinfo,
+                JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+                JDIMENSION output_row, int num_rows)
+{
+  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+  register int r, g, b;
+  register INT32 * ctab = cconvert->rgb_ycc_tab;
+  register JSAMPROW inptr;
+  register JSAMPROW outptr0, outptr1, outptr2;
+  register JDIMENSION col;
+  JDIMENSION num_cols = cinfo->image_width;
+
+  while (--num_rows >= 0) {
+    inptr = *input_buf++;
+    outptr0 = output_buf[0][output_row];
+    outptr1 = output_buf[1][output_row];
+    outptr2 = output_buf[2][output_row];
+    output_row++;
+    for (col = 0; col < num_cols; col++) {
+      r = GETJSAMPLE(inptr[RGB_RED]);
+      g = GETJSAMPLE(inptr[RGB_GREEN]);
+      b = GETJSAMPLE(inptr[RGB_BLUE]);
+      inptr += RGB_PIXELSIZE;
+      /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
+       * must be too; we do not need an explicit range-limiting operation.
+       * Hence the value being shifted is never negative, and we don't
+       * need the general RIGHT_SHIFT macro.
+       */
+      /* Y */
+      outptr0[col] = (JSAMPLE)
+               ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
+                >> SCALEBITS);
+      /* Cb */
+      outptr1[col] = (JSAMPLE)
+               ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
+                >> SCALEBITS);
+      /* Cr */
+      outptr2[col] = (JSAMPLE)
+               ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
+                >> SCALEBITS);
+    }
+  }
+}
+
+
+/**************** Cases other than RGB -> YCbCr **************/
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ * This version handles RGB->grayscale conversion, which is the same
+ * as the RGB->Y portion of RGB->YCbCr.
+ * We assume rgb_ycc_start has been called (we only use the Y tables).
+ */
+
+METHODDEF(void)
+rgb_gray_convert (j_compress_ptr cinfo,
+                 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+                 JDIMENSION output_row, int num_rows)
+{
+  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+  register int r, g, b;
+  register INT32 * ctab = cconvert->rgb_ycc_tab;
+  register JSAMPROW inptr;
+  register JSAMPROW outptr;
+  register JDIMENSION col;
+  JDIMENSION num_cols = cinfo->image_width;
+
+  while (--num_rows >= 0) {
+    inptr = *input_buf++;
+    outptr = output_buf[0][output_row];
+    output_row++;
+    for (col = 0; col < num_cols; col++) {
+      r = GETJSAMPLE(inptr[RGB_RED]);
+      g = GETJSAMPLE(inptr[RGB_GREEN]);
+      b = GETJSAMPLE(inptr[RGB_BLUE]);
+      inptr += RGB_PIXELSIZE;
+      /* Y */
+      outptr[col] = (JSAMPLE)
+               ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
+                >> SCALEBITS);
+    }
+  }
+}
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ * This version handles Adobe-style CMYK->YCCK conversion,
+ * where we convert R=1-C, G=1-M, and B=1-Y to YCbCr using the same
+ * conversion as above, while passing K (black) unchanged.
+ * We assume rgb_ycc_start has been called.
+ */
+
+METHODDEF(void)
+cmyk_ycck_convert (j_compress_ptr cinfo,
+                  JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+                  JDIMENSION output_row, int num_rows)
+{
+  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+  register int r, g, b;
+  register INT32 * ctab = cconvert->rgb_ycc_tab;
+  register JSAMPROW inptr;
+  register JSAMPROW outptr0, outptr1, outptr2, outptr3;
+  register JDIMENSION col;
+  JDIMENSION num_cols = cinfo->image_width;
+
+  while (--num_rows >= 0) {
+    inptr = *input_buf++;
+    outptr0 = output_buf[0][output_row];
+    outptr1 = output_buf[1][output_row];
+    outptr2 = output_buf[2][output_row];
+    outptr3 = output_buf[3][output_row];
+    output_row++;
+    for (col = 0; col < num_cols; col++) {
+      r = MAXJSAMPLE - GETJSAMPLE(inptr[0]);
+      g = MAXJSAMPLE - GETJSAMPLE(inptr[1]);
+      b = MAXJSAMPLE - GETJSAMPLE(inptr[2]);
+      /* K passes through as-is */
+      outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */
+      inptr += 4;
+      /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
+       * must be too; we do not need an explicit range-limiting operation.
+       * Hence the value being shifted is never negative, and we don't
+       * need the general RIGHT_SHIFT macro.
+       */
+      /* Y */
+      outptr0[col] = (JSAMPLE)
+               ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
+                >> SCALEBITS);
+      /* Cb */
+      outptr1[col] = (JSAMPLE)
+               ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
+                >> SCALEBITS);
+      /* Cr */
+      outptr2[col] = (JSAMPLE)
+               ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
+                >> SCALEBITS);
+    }
+  }
+}
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ * This version handles grayscale output with no conversion.
+ * The source can be either plain grayscale or YCbCr (since Y == gray).
+ */
+
+METHODDEF(void)
+grayscale_convert (j_compress_ptr cinfo,
+                  JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+                  JDIMENSION output_row, int num_rows)
+{
+  register JSAMPROW inptr;
+  register JSAMPROW outptr;
+  register JDIMENSION col;
+  JDIMENSION num_cols = cinfo->image_width;
+  int instride = cinfo->input_components;
+
+  while (--num_rows >= 0) {
+    inptr = *input_buf++;
+    outptr = output_buf[0][output_row];
+    output_row++;
+    for (col = 0; col < num_cols; col++) {
+      outptr[col] = inptr[0];  /* don't need GETJSAMPLE() here */
+      inptr += instride;
+    }
+  }
+}
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ * This version handles multi-component colorspaces without conversion.
+ * We assume input_components == num_components.
+ */
+
+METHODDEF(void)
+null_convert (j_compress_ptr cinfo,
+             JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+             JDIMENSION output_row, int num_rows)
+{
+  register JSAMPROW inptr;
+  register JSAMPROW outptr;
+  register JDIMENSION col;
+  register int ci;
+  int nc = cinfo->num_components;
+  JDIMENSION num_cols = cinfo->image_width;
+
+  while (--num_rows >= 0) {
+    /* It seems fastest to make a separate pass for each component. */
+    for (ci = 0; ci < nc; ci++) {
+      inptr = *input_buf;
+      outptr = output_buf[ci][output_row];
+      for (col = 0; col < num_cols; col++) {
+       outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */
+       inptr += nc;
+      }
+    }
+    input_buf++;
+    output_row++;
+  }
+}
+
+
+/*
+ * Empty method for start_pass.
+ */
+
+METHODDEF(void)
+null_method (j_compress_ptr cinfo)
+{
+  /* no work needed */
+}
+
+
+/*
+ * Module initialization routine for input colorspace conversion.
+ */
+
+GLOBAL(void)
+jinit_color_converter (j_compress_ptr cinfo)
+{
+  my_cconvert_ptr cconvert;
+
+  cconvert = (my_cconvert_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+                               SIZEOF(my_color_converter));
+  cinfo->cconvert = (struct jpeg_color_converter *) cconvert;
+  /* set start_pass to null method until we find out differently */
+  cconvert->pub.start_pass = null_method;
+
+  /* Make sure input_components agrees with in_color_space */
+  switch (cinfo->in_color_space) {
+  case JCS_GRAYSCALE:
+    if (cinfo->input_components != 1)
+      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+    break;
+
+  case JCS_RGB:
+#if RGB_PIXELSIZE != 3
+    if (cinfo->input_components != RGB_PIXELSIZE)
+      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+    break;
+#endif /* else share code with YCbCr */
+
+  case JCS_YCbCr:
+    if (cinfo->input_components != 3)
+      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+    break;
+
+  case JCS_CMYK:
+  case JCS_YCCK:
+    if (cinfo->input_components != 4)
+      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+    break;
+
+  default:                     /* JCS_UNKNOWN can be anything */
+    if (cinfo->input_components < 1)
+      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+    break;
+  }
+
+  /* Check num_components, set conversion method based on requested space */
+  switch (cinfo->jpeg_color_space) {
+  case JCS_GRAYSCALE:
+    if (cinfo->num_components != 1)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    if (cinfo->in_color_space == JCS_GRAYSCALE)
+      cconvert->pub.color_convert = grayscale_convert;
+    else if (cinfo->in_color_space == JCS_RGB) {
+      cconvert->pub.start_pass = rgb_ycc_start;
+      cconvert->pub.color_convert = rgb_gray_convert;
+    } else if (cinfo->in_color_space == JCS_YCbCr)
+      cconvert->pub.color_convert = grayscale_convert;
+    else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  case JCS_RGB:
+    if (cinfo->num_components != 3)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    if (cinfo->in_color_space == JCS_RGB && RGB_PIXELSIZE == 3)
+      cconvert->pub.color_convert = null_convert;
+    else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  case JCS_YCbCr:
+    if (cinfo->num_components != 3)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    if (cinfo->in_color_space == JCS_RGB) {
+      cconvert->pub.start_pass = rgb_ycc_start;
+      cconvert->pub.color_convert = rgb_ycc_convert;
+    } else if (cinfo->in_color_space == JCS_YCbCr)
+      cconvert->pub.color_convert = null_convert;
+    else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  case JCS_CMYK:
+    if (cinfo->num_components != 4)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    if (cinfo->in_color_space == JCS_CMYK)
+      cconvert->pub.color_convert = null_convert;
+    else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  case JCS_YCCK:
+    if (cinfo->num_components != 4)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    if (cinfo->in_color_space == JCS_CMYK) {
+      cconvert->pub.start_pass = rgb_ycc_start;
+      cconvert->pub.color_convert = cmyk_ycck_convert;
+    } else if (cinfo->in_color_space == JCS_YCCK)
+      cconvert->pub.color_convert = null_convert;
+    else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  default:                     /* allow null conversion of JCS_UNKNOWN */
+    if (cinfo->jpeg_color_space != cinfo->in_color_space ||
+       cinfo->num_components != cinfo->input_components)
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    cconvert->pub.color_convert = null_convert;
+    break;
+  }
+}
diff --git a/rosapps/lib/libjpeg/jcdctmgr.c b/rosapps/lib/libjpeg/jcdctmgr.c
new file mode 100644 (file)
index 0000000..61fa79b
--- /dev/null
@@ -0,0 +1,387 @@
+/*
+ * jcdctmgr.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the forward-DCT management logic.
+ * This code selects a particular DCT implementation to be used,
+ * and it performs related housekeeping chores including coefficient
+ * quantization.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdct.h"              /* Private declarations for DCT subsystem */
+
+
+/* Private subobject for this module */
+
+typedef struct {
+  struct jpeg_forward_dct pub; /* public fields */
+
+  /* Pointer to the DCT routine actually in use */
+  forward_DCT_method_ptr do_dct;
+
+  /* The actual post-DCT divisors --- not identical to the quant table
+   * entries, because of scaling (especially for an unnormalized DCT).
+   * Each table is given in normal array order.
+   */
+  DCTELEM * divisors[NUM_QUANT_TBLS];
+
+#ifdef DCT_FLOAT_SUPPORTED
+  /* Same as above for the floating-point case. */
+  float_DCT_method_ptr do_float_dct;
+  FAST_FLOAT * float_divisors[NUM_QUANT_TBLS];
+#endif
+} my_fdct_controller;
+
+typedef my_fdct_controller * my_fdct_ptr;
+
+
+/*
+ * Initialize for a processing pass.
+ * Verify that all referenced Q-tables are present, and set up
+ * the divisor table for each one.
+ * In the current implementation, DCT of all components is done during
+ * the first pass, even if only some components will be output in the
+ * first scan.  Hence all components should be examined here.
+ */
+
+METHODDEF(void)
+start_pass_fdctmgr (j_compress_ptr cinfo)
+{
+  my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
+  int ci, qtblno, i;
+  jpeg_component_info *compptr;
+  JQUANT_TBL * qtbl;
+  DCTELEM * dtbl;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    qtblno = compptr->quant_tbl_no;
+    /* Make sure specified quantization table is present */
+    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
+       cinfo->quant_tbl_ptrs[qtblno] == NULL)
+      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
+    qtbl = cinfo->quant_tbl_ptrs[qtblno];
+    /* Compute divisors for this quant table */
+    /* We may do this more than once for same table, but it's not a big deal */
+    switch (cinfo->dct_method) {
+#ifdef DCT_ISLOW_SUPPORTED
+    case JDCT_ISLOW:
+      /* For LL&M IDCT method, divisors are equal to raw quantization
+       * coefficients multiplied by 8 (to counteract scaling).
+       */
+      if (fdct->divisors[qtblno] == NULL) {
+       fdct->divisors[qtblno] = (DCTELEM *)
+         (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+                                     DCTSIZE2 * SIZEOF(DCTELEM));
+      }
+      dtbl = fdct->divisors[qtblno];
+      for (i = 0; i < DCTSIZE2; i++) {
+       dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3;
+      }
+      break;
+#endif
+#ifdef DCT_IFAST_SUPPORTED
+    case JDCT_IFAST:
+      {
+       /* For AA&N IDCT method, divisors are equal to quantization
+        * coefficients scaled by scalefactor[row]*scalefactor[col], where
+        *   scalefactor[0] = 1
+        *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
+        * We apply a further scale factor of 8.
+        */
+#define CONST_BITS 14
+       static const INT16 aanscales[DCTSIZE2] = {
+         /* precomputed values scaled up by 14 bits */
+         16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
+         22725, 31521, 29692, 26722, 22725, 17855, 12299,  6270,
+         21407, 29692, 27969, 25172, 21407, 16819, 11585,  5906,
+         19266, 26722, 25172, 22654, 19266, 15137, 10426,  5315,
+         16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
+         12873, 17855, 16819, 15137, 12873, 10114,  6967,  3552,
+          8867, 12299, 11585, 10426,  8867,  6967,  4799,  2446,
+          4520,  6270,  5906,  5315,  4520,  3552,  2446,  1247
+       };
+       SHIFT_TEMPS
+
+       if (fdct->divisors[qtblno] == NULL) {
+         fdct->divisors[qtblno] = (DCTELEM *)
+           (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+                                       DCTSIZE2 * SIZEOF(DCTELEM));
+       }
+       dtbl = fdct->divisors[qtblno];
+       for (i = 0; i < DCTSIZE2; i++) {
+         dtbl[i] = (DCTELEM)
+           DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
+                                 (INT32) aanscales[i]),
+                   CONST_BITS-3);
+       }
+      }
+      break;
+#endif
+#ifdef DCT_FLOAT_SUPPORTED
+    case JDCT_FLOAT:
+      {
+       /* For float AA&N IDCT method, divisors are equal to quantization
+        * coefficients scaled by scalefactor[row]*scalefactor[col], where
+        *   scalefactor[0] = 1
+        *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
+        * We apply a further scale factor of 8.
+        * What's actually stored is 1/divisor so that the inner loop can
+        * use a multiplication rather than a division.
+        */
+       FAST_FLOAT * fdtbl;
+       int row, col;
+       static const double aanscalefactor[DCTSIZE] = {
+         1.0, 1.387039845, 1.306562965, 1.175875602,
+         1.0, 0.785694958, 0.541196100, 0.275899379
+       };
+
+       if (fdct->float_divisors[qtblno] == NULL) {
+         fdct->float_divisors[qtblno] = (FAST_FLOAT *)
+           (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+                                       DCTSIZE2 * SIZEOF(FAST_FLOAT));
+       }
+       fdtbl = fdct->float_divisors[qtblno];
+       i = 0;
+       for (row = 0; row < DCTSIZE; row++) {
+         for (col = 0; col < DCTSIZE; col++) {
+           fdtbl[i] = (FAST_FLOAT)
+             (1.0 / (((double) qtbl->quantval[i] *
+                      aanscalefactor[row] * aanscalefactor[col] * 8.0)));
+           i++;
+         }
+       }
+      }
+      break;
+#endif
+    default:
+      ERREXIT(cinfo, JERR_NOT_COMPILED);
+      break;
+    }
+  }
+}
+
+
+/*
+ * Perform forward DCT on one or more blocks of a component.
+ *
+ * The input samples are taken from the sample_data[] array starting at
+ * position start_row/start_col, and moving to the right for any additional
+ * blocks. The quantized coefficients are returned in coef_blocks[].
+ */
+
+METHODDEF(void)
+forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
+            JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
+            JDIMENSION start_row, JDIMENSION start_col,
+            JDIMENSION num_blocks)
+/* This version is used for integer DCT implementations. */
+{
+  /* This routine is heavily used, so it's worth coding it tightly. */
+  my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
+  forward_DCT_method_ptr do_dct = fdct->do_dct;
+  DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no];
+  DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */
+  JDIMENSION bi;
+
+  sample_data += start_row;    /* fold in the vertical offset once */
+
+  for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) {
+    /* Load data into workspace, applying unsigned->signed conversion */
+    { register DCTELEM *workspaceptr;
+      register JSAMPROW elemptr;
+      register int elemr;