From aa9845ccd18d805924902f7651d757c750e00988 Mon Sep 17 00:00:00 2001 From: Peter Fales Date: Sat, 26 Jul 2003 17:07:36 +0000 Subject: [PATCH] Move jpeg files to sanei --- backend/Makefile.in | 20 ++-- backend/cdjpeg.h | 55 ----------- backend/dc210.c | 2 +- backend/dc240.c | 2 +- backend/djpeg.c | 229 -------------------------------------------- backend/gphoto2.c | 2 +- configure | 17 ++-- configure.in | 6 +- sanei/Makefile.in | 5 +- 9 files changed, 30 insertions(+), 308 deletions(-) delete mode 100644 backend/cdjpeg.h delete mode 100644 backend/djpeg.c diff --git a/backend/Makefile.in b/backend/Makefile.in index 4eee9f7cd..7c7a6f962 100644 --- a/backend/Makefile.in +++ b/backend/Makefile.in @@ -30,8 +30,7 @@ V_MAJOR = @V_MAJOR@ V_MINOR = @V_MINOR@ V_REV = @V_REV@ DLL_PRELOAD = @DLL_PRELOAD@ -DLL_PRELOAD_EXTRAS = $(foreach be,$(DLL_PRELOAD),$($(addprefix EXTRA_,$(be))))\ - @DJPEG@ +DLL_PRELOAD_EXTRAS = $(foreach be,$(DLL_PRELOAD),$($(addprefix EXTRA_,$(be)))) MKDIR = $(top_srcdir)/mkinstalldirs INSTALL = @INSTALL@ @@ -86,10 +85,10 @@ DISTFILES = abaton.c abaton.conf abaton.h agfafocus.c agfafocus.conf \ as6e.h avision.c avision.conf avision.h bh.c bh.conf bh.h canon.c \ canon.conf canon.h canon-sane.c canon-scsi.c canon630u.c canon630u-common.c \ canon630u.conf canon_pp.conf canon_pp.h canon_pp.c canon_pp-dev.c \ - canon_pp-dev.h canon_pp-io.c canon_pp-io.h cderror.h cdjpeg.h coolscan.c \ + canon_pp-dev.h canon_pp-io.c canon_pp-io.h coolscan.c \ coolscan.conf coolscan.h coolscan-scsidef.h coolscan2.c coolscan2.conf \ dc210.c dc210.conf dc210.h \ - dc240.c dc240.conf dc240.h dc25.c dc25.conf dc25.h djpeg.c djpeg.README \ + dc240.c dc240.conf dc240.h dc25.c dc25.conf dc25.h \ dll.aliases dll.c dll.conf dmc.c dmc.conf dmc.h \ epson.c epson_scsi.c epson_usb.c epson.conf epson.h epson_scsi.h \ epson_usb.h \ @@ -108,7 +107,6 @@ DISTFILES = abaton.c abaton.conf abaton.h agfafocus.c agfafocus.conf \ hp5400_internal.c hp5400_internal.h hp5400_xfer.h \ hp5400_sane.c hp5400_sanei.c hp5400_sanei.h \ ibm.c ibm.conf ibm.h ibm-scsi.c \ - jinclude.h \ leo.c leo.h leo.conf \ lm9830.h \ ma1509.c ma1509.conf ma1509.h \ @@ -246,8 +244,6 @@ EXTRA_canon_pp = canon_pp-io canon_pp-dev EXTRA_hp = hp-accessor hp-device hp-handle hp-hpmem hp-option hp-scl EXTRA_umax_pp = umax_pp_low umax_pp_mid EXTRA_epson = epson_scsi epson_usb -# EXTRA_dc210 = djpeg -# EXTRA_dc240 = djpeg # When preloading dll, we need to add in all preloaded objects: libsane-dll.la: $(addsuffix .lo,$(DLL_PRELOAD)) @@ -293,8 +289,8 @@ libsane-coolscan2.la: ../sanei/sanei_constrain_value.lo libsane-coolscan2.la: ../sanei/sanei_scsi.lo libsane-coolscan2.la: ../sanei/sanei_usb.lo libsane-dc25.la: ../sanei/sanei_constrain_value.lo -libsane-dc210.la: ../sanei/sanei_constrain_value.lo djpeg.lo -libsane-dc240.la: ../sanei/sanei_constrain_value.lo djpeg.lo +libsane-dc210.la: ../sanei/sanei_constrain_value.lo ../sanei/sanei_jpeg.lo +libsane-dc240.la: ../sanei/sanei_constrain_value.lo ../sanei/sanei_jpeg.lo libsane-dmc.la: ../sanei/sanei_config2.lo libsane-dmc.la: ../sanei/sanei_constrain_value.lo libsane-dmc.la: ../sanei/sanei_scsi.lo @@ -308,7 +304,7 @@ libsane-fujitsu.la: ../sanei/sanei_config2.lo libsane-fujitsu.la: ../sanei/sanei_constrain_value.lo libsane-fujitsu.la: ../sanei/sanei_scsi.lo libsane-fujitsu.la: ../sanei/sanei_usb.lo -libsane-gphoto2.la: ../sanei/sanei_constrain_value.lo djpeg.lo +libsane-gphoto2.la: ../sanei/sanei_constrain_value.lo ../sanei/sanei_jpeg.lo libsane-gt68xx.la: ../sanei/sanei_constrain_value.lo libsane-gt68xx.la: ../sanei/sanei_usb.lo libsane-hp.la: ../sanei/sanei_config2.lo @@ -423,6 +419,10 @@ libsane-dll.la libsane.la: ../sanei/sanei_pv8630.lo libsane-dll.la libsane.la: ../sanei/sanei_lm983x.lo endif +ifneq ($(@SANEI_JPEG@),) +libsane-dll.la libsane.la: ../sanei/sanei_jpeg.lo +endif + depend: makedepend $(INCLUDES) *.c diff --git a/backend/cdjpeg.h b/backend/cdjpeg.h deleted file mode 100644 index 2b9188b72..000000000 --- a/backend/cdjpeg.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * cdjpeg.h - * - * 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 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 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, - char *data)); - /* 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; -}; - -/* Module selection routines for I/O modules. */ - -EXTERN(djpeg_dest_ptr) sanei_jpeg_jinit_write_ppm JPP((j_decompress_ptr cinfo)); - -/* miscellaneous useful macros */ diff --git a/backend/dc210.c b/backend/dc210.c index 09b39147d..83e1d7568 100644 --- a/backend/dc210.c +++ b/backend/dc210.c @@ -65,7 +65,7 @@ #include #include #include -#include "cdjpeg.h" +#include "sane/sanei_jpeg.h" #include #include "sane/sane.h" diff --git a/backend/dc240.c b/backend/dc240.c index 4470ab51b..c0978dbcc 100644 --- a/backend/dc240.c +++ b/backend/dc240.c @@ -68,7 +68,7 @@ #include #include #include -#include "cdjpeg.h" +#include "sane/sanei_jpeg.h" #include #include "sane/sane.h" diff --git a/backend/djpeg.c b/backend/djpeg.c deleted file mode 100644 index 6bb59cc61..000000000 --- a/backend/djpeg.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - Code for JPEG decompression by the Independent JPEG Group. Please see - README.jpeg in the top level directory. - */ - -#include "cdjpeg.h" - -typedef struct - { - struct djpeg_dest_struct pub; /* public fields */ - - /* Usually these two pointers point to the same place: */ - char *iobuffer; /* fwrite's I/O buffer */ - JSAMPROW pixrow; /* decompressor output buffer */ - size_t buffer_width; /* width of I/O buffer */ - JDIMENSION samples_per_row; /* JSAMPLEs per output row */ - } -ppm_dest_struct; - -typedef ppm_dest_struct *ppm_dest_ptr; - -/* - * For 12-bit JPEG data, we either downscale the values to 8 bits - * (to write standard byte-per-sample PPM/PGM files), or output - * nonstandard word-per-sample PPM/PGM files. Downscaling is done - * if PPM_NORAWWORD is defined (this can be done in the Makefile - * or in jconfig.h). - * (When the core library supports data precision reduction, a cleaner - * implementation will be to ask for that instead.) - */ - -#if BITS_IN_JSAMPLE==8 -#define PUTPPMSAMPLE(ptr,v) *ptr++=(char) (v) -#define BYTESPERSAMPLE 1 -#define PPM_MAXVAL 255 -#else -#ifdef PPM_NORAWWORD -#define PUTPPMSAMPLE(ptr,v) *ptr++=(char) ((v) >> (BITS_IN_JSAMPLE-8)) -#define BYTESPERSAMPLE 1 -#define PPM_MAXVAL 255 -#else -/* The word-per-sample format always puts the LSB first. */ -#define PUTPPMSAMPLE(ptr,v) \ - { register int val_=v; \ - *ptr++=(char) (val_ & 0xFF); \ - *ptr++=(char) ((val_ >> 8) & 0xFF); \ - } -#define BYTESPERSAMPLE 2 -#define PPM_MAXVAL ((1<iobuffer, dest->buffer_width); -} - - -/* - * This code is used when we have to copy the data and apply a pixel - * format translation. Typically this only happens in 12-bit mode. - */ - -METHODDEF (void) -sanei_jpeg_copy_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied, char *data) -{ - ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; - register char *bufferptr; - register JSAMPROW ptr; - register JDIMENSION col; - - cinfo = cinfo; - dinfo = dinfo; - rows_supplied = rows_supplied; - - ptr = dest->pub.buffer[0]; - bufferptr = dest->iobuffer; - for (col = dest->samples_per_row; col > 0; col--) - { - PUTPPMSAMPLE (bufferptr, GETJSAMPLE (*ptr++)); - } - memcpy (data, dest->iobuffer, dest->buffer_width); -} - - -/* - * Write some pixel data when color quantization is in effect. - * We have to demap the color index values to straight data. - */ - -METHODDEF (void) -sanei_jpeg_put_demapped_rgb (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied, char *data) -{ - - ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; - register char *bufferptr; - register int pixval; - register JSAMPROW ptr; - register JSAMPROW color_map0 = cinfo->colormap[0]; - register JSAMPROW color_map1 = cinfo->colormap[1]; - register JSAMPROW color_map2 = cinfo->colormap[2]; - register JDIMENSION col; - - rows_supplied = rows_supplied; - - ptr = dest->pub.buffer[0]; - bufferptr = dest->iobuffer; - for (col = cinfo->output_width; col > 0; col--) - { - pixval = GETJSAMPLE (*ptr++); - PUTPPMSAMPLE (bufferptr, GETJSAMPLE (color_map0[pixval])); - PUTPPMSAMPLE (bufferptr, GETJSAMPLE (color_map1[pixval])); - PUTPPMSAMPLE (bufferptr, GETJSAMPLE (color_map2[pixval])); - } - memcpy (data, dest->iobuffer, dest->buffer_width); -} - - -METHODDEF (void) -sanei_jpeg_put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied, char *data) -{ - ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; - register char *bufferptr; - register JSAMPROW ptr; - register JSAMPROW color_map = cinfo->colormap[0]; - register JDIMENSION col; - - rows_supplied = rows_supplied; - - ptr = dest->pub.buffer[0]; - bufferptr = dest->iobuffer; - for (col = cinfo->output_width; col > 0; col--) - { - PUTPPMSAMPLE (bufferptr, - GETJSAMPLE (color_map[GETJSAMPLE (*ptr++)])); - } - memcpy (data, dest->iobuffer, dest->buffer_width); -} - -GLOBAL (djpeg_dest_ptr) -sanei_jpeg_jinit_write_ppm (j_decompress_ptr cinfo) -{ - - ppm_dest_ptr dest; - - /* Create module interface object, fill in method pointers */ - dest = (ppm_dest_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF (ppm_dest_struct)); - dest->pub.start_output = sanei_jpeg_start_output_ppm; - dest->pub.finish_output = sanei_jpeg_finish_output_ppm; - - /* Calculate output image dimensions so we can allocate space */ - jpeg_calc_output_dimensions (cinfo); - - /* Create physical I/O buffer. Note we make this near on a PC. */ - dest->samples_per_row = cinfo->output_width * cinfo->out_color_components; - dest->buffer_width = dest->samples_per_row * (BYTESPERSAMPLE * SIZEOF (char)); - dest->iobuffer = (char *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width); - - if (cinfo->quantize_colors || BITS_IN_JSAMPLE != 8 || - SIZEOF (JSAMPLE) != SIZEOF (char)) - { - /* When quantizing, we need an output buffer for clrmap indexes - * that's separate from the physical I/O buffer. We also need a - * separate buffer if pixel format translation must take place. - */ - dest->pub.buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->output_width * cinfo->output_components, - (JDIMENSION) 1); - dest->pub.buffer_height = 1; - if (!cinfo->quantize_colors) - dest->pub.put_pixel_rows = sanei_jpeg_copy_pixel_rows; - else if (cinfo->out_color_space == JCS_GRAYSCALE) - dest->pub.put_pixel_rows = sanei_jpeg_put_demapped_gray; - else - dest->pub.put_pixel_rows = sanei_jpeg_put_demapped_rgb; - } - else - { - /* We will fwrite() directly from decompressor output buffer. */ - /* Synthesize a JSAMPARRAY pointer structure */ - /* Cast here implies near->far pointer conversion on PCs */ - dest->pixrow = (JSAMPROW) dest->iobuffer; - dest->pub.buffer = &dest->pixrow; - dest->pub.buffer_height = 1; - dest->pub.put_pixel_rows = sanei_jpeg_put_pixel_rows; - } - - return (djpeg_dest_ptr) dest; -} diff --git a/backend/gphoto2.c b/backend/gphoto2.c index c46ee90eb..beae7f902 100644 --- a/backend/gphoto2.c +++ b/backend/gphoto2.c @@ -85,7 +85,7 @@ #include #include #include -#include "cdjpeg.h" +#include "sane/sanei_jpeg.h" #include #include "sane/sane.h" diff --git a/configure b/configure index 95c98bb1e..8f7d67105 100755 --- a/configure +++ b/configure @@ -463,7 +463,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS V_MAJOR V_MINOR V_REV PACKAGE VERSION NUMBER_VERSION build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE CPP EGREP SANE_CONFIG_PATH MSGFMT XGETTEXT MSGMERGE LATEX DVIPS MAKEINDEX INCLUDES LINKER_RPATH DL_LIB DYNAMIC_FLAG HAVE_GPHOTO2 ac_ct_HAVE_GPHOTO2 ALLOCA LIBOBJS LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL SANED DJPEG BACKENDS DLL_PRELOAD INSTALL_TRANSLATIONS USE_LATEX DISTCLEAN_FILES LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS V_MAJOR V_MINOR V_REV PACKAGE VERSION NUMBER_VERSION build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE CPP EGREP SANE_CONFIG_PATH MSGFMT XGETTEXT MSGMERGE LATEX DVIPS MAKEINDEX INCLUDES LINKER_RPATH DL_LIB DYNAMIC_FLAG HAVE_GPHOTO2 ac_ct_HAVE_GPHOTO2 ALLOCA LIBOBJS LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL SANED SANEI_JPEG SANEI_JPEG_LO BACKENDS DLL_PRELOAD INSTALL_TRANSLATIONS USE_LATEX DISTCLEAN_FILES LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -2394,12 +2394,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ + '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ - 'void exit (int);' \ - '#include ' + 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" @@ -9993,12 +9993,12 @@ else fi for ac_declaration in \ ''\ + '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ - 'void exit (int);' \ - '#include ' + 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" @@ -23644,10 +23644,12 @@ echo "$as_me: Manually selected backends: ${BACKENDS}" >&6;} echo "*** disabling DC240 backend (failed to find JPEG library)" else BACKENDS="${BACKENDS} dc210 dc240" - DJPEG=djpeg + SANEI_JPEG="sanei_jpeg.o" + SANEI_JPEG_LO="sanei_jpeg.lo" fi + if test "${sane_cv_use_libieee1284}" != "yes" then echo "*** disabling CANON_PP backend (failed to find libieee1284 library)" @@ -24492,7 +24494,8 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@SANED@,$SANED,;t t -s,@DJPEG@,$DJPEG,;t t +s,@SANEI_JPEG@,$SANEI_JPEG,;t t +s,@SANEI_JPEG_LO@,$SANEI_JPEG_LO,;t t s,@BACKENDS@,$BACKENDS,;t t s,@DLL_PRELOAD@,$DLL_PRELOAD,;t t s,@INSTALL_TRANSLATIONS@,$INSTALL_TRANSLATIONS,;t t diff --git a/configure.in b/configure.in index 23a5a2f92..53cc3621c 100644 --- a/configure.in +++ b/configure.in @@ -279,9 +279,11 @@ else echo "*** disabling DC240 backend (failed to find JPEG library)" else BACKENDS="${BACKENDS} dc210 dc240" - DJPEG=djpeg + SANEI_JPEG="sanei_jpeg.o" + SANEI_JPEG_LO="sanei_jpeg.lo" fi - AC_SUBST(DJPEG) + AC_SUBST(SANEI_JPEG) + AC_SUBST(SANEI_JPEG_LO) if test "${sane_cv_use_libieee1284}" != "yes" then diff --git a/sanei/Makefile.in b/sanei/Makefile.in index 10eeb730d..5b660612c 100644 --- a/sanei/Makefile.in +++ b/sanei/Makefile.in @@ -50,13 +50,14 @@ DISTCLEAN_FILES = @DISTCLEAN_FILES@ LIBSANEI_OBJS = sanei_ab306.o sanei_constrain_value.o sanei_init_debug.o \ sanei_net.o sanei_wire.o sanei_codec_ascii.o sanei_codec_bin.o \ sanei_scsi.o sanei_config.o sanei_config2.o sanei_pio.o sanei_pa4s2.o \ - sanei_auth.o sanei_usb.o sanei_thread.o sanei_pv8630.o sanei_lm983x.o + sanei_auth.o sanei_usb.o sanei_thread.o sanei_pv8630.o \ + sanei_lm983x.o @SANEI_JPEG@ LIBSANEI_LTOBJS = sanei_ab306.lo sanei_constrain_value.lo sanei_init_debug.lo \ sanei_net.lo sanei_wire.lo sanei_codec_ascii.lo sanei_codec_bin.lo \ sanei_scsi.lo sanei_config.lo sanei_config2.lo sanei_pio.lo \ sanei_pa4s2.lo sanei_auth.lo sanei_usb.lo sanei_thread.lo \ - sanei_pv8630.lo sanei_lm983x.lo + sanei_pv8630.lo sanei_lm983x.lo @SANEI_JPEG_LO@ TARGETS = libsanei.a $(LIBSANEI_LTOBJS) TESTPROGRAMS = test_wire