From cb7a01f5ce8a788069d4db6a436b727a0f7015c0 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Sat, 28 Jun 2008 16:06:35 -0500 Subject: [svn-r15292] moved h52jpeg to /hl/tools/h52jpeg tested: linux --- MANIFEST | 16 +- configure | 5 +- configure.in | 1 + hl/tools/Makefile.am | 2 +- hl/tools/Makefile.in | 2 +- hl/tools/h52jpeg/Makefile.am | 46 + hl/tools/h52jpeg/Makefile.in | 882 + hl/tools/h52jpeg/h52jpeg.c | 695 + hl/tools/h52jpeg/h52jpeg.sh | 87 + hl/tools/h52jpeg/h52jpegtst.c | 323 + hl/tools/h52jpeg/image24pixel.txt | 101475 +++++++++++++++++++++++ hl/tools/h52jpeg/image8.txt | 120006 ++++++++++++++++++++++++++++ hl/tools/h52jpeg/testfiles/h52jpegtst.h5 | Bin 0 -> 947613 bytes tools/h52jpeg/Makefile.am | 46 - tools/h52jpeg/Makefile.in | 882 - tools/h52jpeg/h52jpeg.c | 695 - tools/h52jpeg/h52jpeg.sh | 87 - tools/h52jpeg/h52jpegtst.c | 323 - tools/h52jpeg/image24pixel.txt | 101475 ----------------------- tools/h52jpeg/image8.txt | 120006 ---------------------------- tools/h52jpeg/testfiles/h52jpegtst.h5 | Bin 947613 -> 0 bytes 21 files changed, 223528 insertions(+), 223526 deletions(-) create mode 100644 hl/tools/h52jpeg/Makefile.am create mode 100644 hl/tools/h52jpeg/Makefile.in create mode 100644 hl/tools/h52jpeg/h52jpeg.c create mode 100644 hl/tools/h52jpeg/h52jpeg.sh create mode 100644 hl/tools/h52jpeg/h52jpegtst.c create mode 100644 hl/tools/h52jpeg/image24pixel.txt create mode 100644 hl/tools/h52jpeg/image8.txt create mode 100644 hl/tools/h52jpeg/testfiles/h52jpegtst.h5 delete mode 100644 tools/h52jpeg/Makefile.am delete mode 100644 tools/h52jpeg/Makefile.in delete mode 100644 tools/h52jpeg/h52jpeg.c delete mode 100644 tools/h52jpeg/h52jpeg.sh delete mode 100644 tools/h52jpeg/h52jpegtst.c delete mode 100644 tools/h52jpeg/image24pixel.txt delete mode 100644 tools/h52jpeg/image8.txt delete mode 100644 tools/h52jpeg/testfiles/h52jpegtst.h5 diff --git a/MANIFEST b/MANIFEST index 5c9f897..9f34717 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1515,14 +1515,14 @@ ./tools/testfiles/h5mkgrp_version.ls #h52jpeg -./tools/h52jpeg/Makefile.in -./tools/h52jpeg/Makefile.am -./tools/h52jpeg/h52jpeg.sh -./tools/h52jpeg/h52jpeg.c -./tools/h52jpeg/h52jpegtst.c -./tools/h52jpeg/image24pixel.txt -./tools/h52jpeg/image8.txt -./tools/h52jpeg/testfiles/h52jpegtst.h5 +./hl/tools/h52jpeg/testfiles/h52jpegtst.h5 +./hl/tools/h52jpeg/h52jpegtst.c +./hl/tools/h52jpeg/Makefile.in +./hl/tools/h52jpeg/h52jpeg.c +./hl/tools/h52jpeg/image24pixel.txt +./hl/tools/h52jpeg/image8.txt +./hl/tools/h52jpeg/Makefile.am +./hl/tools/h52jpeg/h52jpeg.sh # high level libraries diff --git a/configure b/configure index b1d0c54..f9fc8cb 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 15184 2008-06-09 20:20:43Z pvn . +# From configure.in Id: configure.in 15215 2008-06-15 10:26:51Z hdftest . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for HDF5 1.9.8. # @@ -50626,7 +50626,7 @@ if test -n "$TESTPARALLEL"; then fi fi -ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testerror.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile tools/h52jpeg/Makefile examples/Makefile examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/examples/Makefile c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/libhdf5_fortran.settings fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/tools/Makefile hl/tools/gif2h5/Makefile hl/examples/Makefile hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile" +ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testerror.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile tools/h52jpeg/Makefile examples/Makefile examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/examples/Makefile c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/libhdf5_fortran.settings fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/tools/Makefile hl/tools/gif2h5/Makefile hl/tools/h52jpeg/Makefile hl/examples/Makefile hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile" cat >confcache <<\_ACEOF @@ -51763,6 +51763,7 @@ do "hl/test/Makefile") CONFIG_FILES="$CONFIG_FILES hl/test/Makefile" ;; "hl/tools/Makefile") CONFIG_FILES="$CONFIG_FILES hl/tools/Makefile" ;; "hl/tools/gif2h5/Makefile") CONFIG_FILES="$CONFIG_FILES hl/tools/gif2h5/Makefile" ;; + "hl/tools/h52jpeg/Makefile") CONFIG_FILES="$CONFIG_FILES hl/tools/h52jpeg/Makefile" ;; "hl/examples/Makefile") CONFIG_FILES="$CONFIG_FILES hl/examples/Makefile" ;; "hl/c++/Makefile") CONFIG_FILES="$CONFIG_FILES hl/c++/Makefile" ;; "hl/c++/src/Makefile") CONFIG_FILES="$CONFIG_FILES hl/c++/src/Makefile" ;; diff --git a/configure.in b/configure.in index 4842473..41a6c9d 100644 --- a/configure.in +++ b/configure.in @@ -3853,6 +3853,7 @@ AC_CONFIG_FILES([src/libhdf5.settings hl/test/Makefile hl/tools/Makefile hl/tools/gif2h5/Makefile + hl/tools/h52jpeg/Makefile hl/examples/Makefile hl/c++/Makefile hl/c++/src/Makefile diff --git a/hl/tools/Makefile.am b/hl/tools/Makefile.am index 5ef8a96..6f27fc6 100644 --- a/hl/tools/Makefile.am +++ b/hl/tools/Makefile.am @@ -22,6 +22,6 @@ include $(top_srcdir)/config/commence.am # All subdirectories -SUBDIRS=gif2h5 +SUBDIRS=gif2h5 h52jpeg include $(top_srcdir)/config/conclude.am diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in index d89e847..944e8ad 100644 --- a/hl/tools/Makefile.in +++ b/hl/tools/Makefile.in @@ -324,7 +324,7 @@ TRACE = perl $(top_srcdir)/bin/trace CHECK_CLEANFILES = *.chkexe *.chklog *.clog # All subdirectories -SUBDIRS = gif2h5 +SUBDIRS = gif2h5 h52jpeg # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., diff --git a/hl/tools/h52jpeg/Makefile.am b/hl/tools/h52jpeg/Makefile.am new file mode 100644 index 0000000..05ea153 --- /dev/null +++ b/hl/tools/h52jpeg/Makefile.am @@ -0,0 +1,46 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +# +# HDF5 Library Makefile(.in) +# + +include $(top_srcdir)/config/commence.am + +# Include src and tools/lib directories +INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src + +# These are our main targets +TEST_PROG=h52jpegtst +TEST_SCRIPT=$(srcdir)/h52jpeg.sh + +check_SCRIPTS=$(TEST_SCRIPT) +check_PROGRAMS=$(TEST_PROG) + +bin_PROGRAMS=h52jpeg +noinst_PROGRAMS=h52jpegtst + +h52jpeg_SOURCES=h52jpeg.c +h52jpegtst_SOURCES=h52jpegtst.c + +# Programs all depend on the hdf5 library, the tools library, and the HL +# library. +LDADD=$(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5) -ljpeg + +CHECK_CLEANFILES+=*.h5 +CHECK_CLEANFILES+=*.jpeg + +include $(top_srcdir)/config/conclude.am diff --git a/hl/tools/h52jpeg/Makefile.in b/hl/tools/h52jpeg/Makefile.in new file mode 100644 index 0000000..f6b2328 --- /dev/null +++ b/hl/tools/h52jpeg/Makefile.in @@ -0,0 +1,882 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# HDF5 Library Makefile(.in) +# + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/config/commence.am \ + $(top_srcdir)/config/conclude.am +check_PROGRAMS = $(am__EXEEXT_1) +bin_PROGRAMS = h52jpeg$(EXEEXT) +noinst_PROGRAMS = h52jpegtst$(EXEEXT) +TESTS = $(check_PROGRAMS) $(check_SCRIPTS) +subdir = hl/tools/h52jpeg +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/src/H5config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +am__EXEEXT_1 = h52jpegtst$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am_h52jpeg_OBJECTS = h52jpeg.$(OBJEXT) +h52jpeg_OBJECTS = $(am_h52jpeg_OBJECTS) +h52jpeg_LDADD = $(LDADD) +h52jpeg_DEPENDENCIES = $(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5) +am_h52jpegtst_OBJECTS = h52jpegtst.$(OBJEXT) +h52jpegtst_OBJECTS = $(am_h52jpegtst_OBJECTS) +h52jpegtst_LDADD = $(LDADD) +h52jpegtst_DEPENDENCIES = $(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/bin/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(h52jpeg_SOURCES) $(h52jpegtst_SOURCES) +DIST_SOURCES = $(h52jpeg_SOURCES) $(h52jpegtst_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal +ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@ +AMTAR = @AMTAR@ +AM_MAKEFLAGS = @AM_MAKEFLAGS@ +AR = @AR@ + +# Set the paths for AFS installs of autotools for Linux machines +# Ideally, these tools should never be needed during the build. +AUTOCONF = /home1/packages/autoconf/autoconf-2.60/bin/autoconf +AUTOHEADER = /home1/packages/autoconf/autoconf-2.60/bin/autoheader +AUTOMAKE = /home1/packages/automake/automake-1.9.6/bin/automake-1.9 +AWK = @AWK@ +BYTESEX = @BYTESEX@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_VERSION = @CC_VERSION@ + +# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5, +# but which shouldn't be exported to h5cc for building other programs. +CFLAGS = @CFLAGS@ @H5_CFLAGS@ +CLEARFILEBUF = @CLEARFILEBUF@ +CODESTACK = @CODESTACK@ +CONFIG_DATE = @CONFIG_DATE@ +CONFIG_MODE = @CONFIG_MODE@ +CONFIG_USER = @CONFIG_USER@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_PKG = @DEBUG_PKG@ +DEFAULT_API_VERSION = @DEFAULT_API_VERSION@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ +DIRECT_VFD = @DIRECT_VFD@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +DYNAMIC_DIRS = @DYNAMIC_DIRS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +EXTERNAL_FILTERS = @EXTERNAL_FILTERS@ + +# Make sure that these variables are exported to the Makefiles +F9XMODEXT = @F9XMODEXT@ +F9XMODFLAG = @F9XMODFLAG@ +F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ +FC = @FC@ +FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@ +FCFLAGS_f90 = @FCFLAGS_f90@ +FCLIBS = @FCLIBS@ +FGREP = @FGREP@ +FILTERS = @FILTERS@ +FSEARCH_DIRS = @FSEARCH_DIRS@ +GPFS = @GPFS@ +GREP = @GREP@ +H5_CFLAGS = @H5_CFLAGS@ +H5_CPPFLAGS = @H5_CPPFLAGS@ +H5_CXXFLAGS = @H5_CXXFLAGS@ +H5_FCFLAGS = @H5_FCFLAGS@ +H5_LONE_COLON = @H5_LONE_COLON@ +H5_VERSION = @H5_VERSION@ +HADDR_T = @HADDR_T@ +HAVE_DMALLOC = @HAVE_DMALLOC@ +HDF5_HL = @HDF5_HL@ +HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF_CXX = @HDF_CXX@ +HDF_FORTRAN = @HDF_FORTRAN@ +HID_T = @HID_T@ +HL = @HL@ +HL_FOR = @HL_FOR@ +HSIZE_T = @HSIZE_T@ +HSSIZE_T = @HSSIZE_T@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTRUMENT = @INSTRUMENT@ +INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LINUX_LFS = @LINUX_LFS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_STATIC_EXEC = @LT_STATIC_EXEC@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MPE = @MPE@ +MPI_GET_SIZE = @MPI_GET_SIZE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJECT_NAMELEN_DEFAULT_F = @OBJECT_NAMELEN_DEFAULT_F@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PARALLEL = @PARALLEL@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PTHREAD = @PTHREAD@ +RANLIB = @RANLIB@ +ROOT = @ROOT@ +RUNPARALLEL = @RUNPARALLEL@ +RUNSERIAL = @RUNSERIAL@ +R_INTEGER = @R_INTEGER@ +R_LARGE = @R_LARGE@ +SEARCH = @SEARCH@ +SED = @SED@ +SETX = @SETX@ +SET_MAKE = @SET_MAKE@ + +# Hardcode SHELL to be /bin/sh. Most machines have this shell, and +# on at least one machine configure fails to detect its existence (janus). +# Also, when HDF5 is configured on one machine but run on another, +# configure's automatic SHELL detection may not work on the build machine. +SHELL = /bin/sh +SIZE_T = @SIZE_T@ +STATIC_EXEC = @STATIC_EXEC@ +STATIC_SHARED = @STATIC_SHARED@ +STRICT_FORMAT_CHECKS = @STRICT_FORMAT_CHECKS@ +STRIP = @STRIP@ +TESTPARALLEL = @TESTPARALLEL@ +THREADSAFE = @THREADSAFE@ +TIME = @TIME@ +TR = @TR@ +TRACE_API = @TRACE_API@ +UNAME_INFO = @UNAME_INFO@ +USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@ +USE_FILTER_FLETCHER32 = @USE_FILTER_FLETCHER32@ +USE_FILTER_NBIT = @USE_FILTER_NBIT@ +USE_FILTER_SCALEOFFSET = @USE_FILTER_SCALEOFFSET@ +USE_FILTER_SHUFFLE = @USE_FILTER_SHUFFLE@ +USE_FILTER_SZIP = @USE_FILTER_SZIP@ +USINGMEMCHECKER = @USINGMEMCHECKER@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_FC = @ac_ct_FC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = $(exec_prefix)/doc +dvidir = @dvidir@ +enable_shared = @enable_shared@ +enable_static = @enable_static@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ + +# Install directories that automake doesn't know about +includedir = $(exec_prefix)/include +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# Shell commands used in Makefiles +RM = rm -f +CP = cp + +# Some machines need a command to run executables; this is that command +# so that our tests will run. +# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# some tests need to be run with a different command. Older versions +# of the makefiles used the command +# $(LIBTOOL) --mode=execute +# in some directories, for instance. +RUNTESTS = $(RUNSERIAL) + +# Libraries to link to while building +LIBHDF5 = $(top_builddir)/src/libhdf5.la +LIBH5TEST = $(top_builddir)/test/libh5test.la +LIBH5F = $(top_builddir)/fortran/src/libhdf5_fortran.la +LIBH5FTEST = $(top_builddir)/fortran/test/libh5test_fortran.la +LIBH5CPP = $(top_builddir)/c++/src/libhdf5_cpp.la +LIBH5TOOLS = $(top_builddir)/tools/lib/libh5tools.la +LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la +LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la +LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la + +# Scripts used to build examples +# If only shared libraries have been installed, have h5cc build examples with +# shared libraries instead of static libraries +H5CC = $(bindir)/h5cc +H5CC_PP = $(bindir)/h5pcc +H5FC = $(bindir)/h5fc +H5FC_PP = $(bindir)/h5pfc +H5CPP = $(bindir)/h5c++ + +# The trace script; this is used on source files from the C library to +# insert tracing macros. +TRACE = perl $(top_srcdir)/bin/trace + +# .chkexe files are used to mark tests that have run successfully. +# .chklog files are output from those tests. +# *.clog are from the MPE option. +CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 *.jpeg + +# Include src and tools/lib directories +INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src + +# These are our main targets +TEST_PROG = h52jpegtst +TEST_SCRIPT = $(srcdir)/h52jpeg.sh +check_SCRIPTS = $(TEST_SCRIPT) +h52jpeg_SOURCES = h52jpeg.c +h52jpegtst_SOURCES = h52jpegtst.c + +# Programs all depend on the hdf5 library, the tools library, and the HL +# library. +LDADD = $(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5) -ljpeg + +# Automake needs to be taught how to build lib, progs, and tests targets. +# These will be filled in automatically for the most part (e.g., +# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and +# EXTRA_TEST variables are supplied to allow the user to force targets to +# be built at certain times. +LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \ + $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB) + +PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \ + $(EXTRA_PROG) + +TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_) +TEST_PROG_PARA_CHKEXE = $(TEST_PROG_PARA:=.chkexe_) +TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_) +TEST_SCRIPT_PARA_CHKSH = $(TEST_SCRIPT_PARA:=.chkexe_) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hl/tools/h52jpeg/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hl/tools/h52jpeg/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +h52jpeg$(EXEEXT): $(h52jpeg_OBJECTS) $(h52jpeg_DEPENDENCIES) + @rm -f h52jpeg$(EXEEXT) + $(LINK) $(h52jpeg_OBJECTS) $(h52jpeg_LDADD) $(LIBS) +h52jpegtst$(EXEEXT): $(h52jpegtst_OBJECTS) $(h52jpegtst_DEPENDENCIES) + @rm -f h52jpegtst$(EXEEXT) + $(LINK) $(h52jpegtst_OBJECTS) $(h52jpegtst_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h52jpeg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h52jpegtst.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) all-local +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ + clean-libtool clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool mostlyclean-local + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ + clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \ + pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS + + +# List all build rules defined by HDF5 Makefiles as "PHONY" targets here. +# This tells the Makefiles that these targets are not files to be built but +# commands that should be executed even if a file with the same name already +# exists. +.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \ + build-tests check-clean check-install check-p check-s check-vfd \ + install-doc lib progs tests uninstall-doc _exec_check-s _test help + +help: + @$(top_srcdir)/bin/makehelp + +# lib/progs/tests targets recurse into subdirectories. build-* targets +# build files in this directory. +build-lib: $(LIB) +build-progs: $(LIB) $(PROGS) +build-tests: $(LIB) $(PROGS) $(TESTS) + +# General rule for recursive building targets. +# BUILT_SOURCES contain targets that need to be built before anything else +# in the directory (e.g., for Fortran type detection) +lib progs tests check-s check-p :: $(BUILT_SOURCES) + @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1; + @for d in X $(SUBDIRS); do \ + if test $$d != X && test $$d != .; then \ + (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ + fi; \ + done + +# General rule for recursive cleaning targets. Like the rule above, +# but doesn't require building BUILT_SOURCES. +check-clean :: + @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1; + @for d in X $(SUBDIRS); do \ + if test $$d != X && test $$d != .; then \ + (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ + fi; \ + done + +# Tell Automake to build tests when the user types `make all' (this is +# not its default behavior). Also build EXTRA_LIB and EXTRA_PROG since +# Automake won't build them automatically, either. +all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(TESTS) + +# make install-doc doesn't do anything outside of doc directory, but +# Makefiles should recognize it. +# UPDATE: docs no longer reside in this build tree, so this target +# is depreciated. +install-doc uninstall-doc: + @echo "Nothing to be done." + +# clean up files generated by tests so they can be re-run. +build-check-clean: + $(RM) -rf $(CHECK_CLEANFILES) + +# run check-clean whenever mostlyclean is run +mostlyclean-local: build-check-clean + +# check-install is just a synonym for installcheck +check-install: installcheck + +# Run each test in order, passing $(TEST_FLAGS) to the program. +# Since tests are done in a shell loop, "make -i" does apply inside it. +# Set HDF5_Make_Ignore to a non-blank string to ignore errors inside the loop. +# The timestamps give a rough idea how much time the tests use. +# +# Note that targets in TESTS (defined above) will be built when the user +# types 'make tests' or 'make check', but only programs in TEST_PROG, +# TEST_PROG_PARA, or TEST_SCRIPT will actually be executed. +check-TESTS: test + +test _test: + @$(MAKE) build-check-s + @$(MAKE) build-check-p + +# Actual execution of check-s. +build-check-s: $(LIB) $(PROGS) $(TESTS) + @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \ + echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \ + fi + @$(MAKE) $(AM_MAKEFLAGS) _exec_check-s + @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \ + echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ + fi + +_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH) + +# The dummy.chkexe here prevents the target from being +# empty if there are no tests in the current directory. +# $${log} is the log file. +# $${tname} is the name of test. +$(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: + @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \ + tname=$(@:.chkexe_=)$(EXEEXT);\ + log=$(@:.chkexe_=.chklog); \ + echo "============================"; \ + if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \ + echo "No need to test $${tname} again."; \ + else \ + echo "============================" > $${log}; \ + if test "X$(FORTRAN_API)" = "Xyes"; then \ + echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ + elif test "X$(CXX_API)" = "Xyes"; then \ + echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\ + else \ + echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ + fi; \ + echo "============================" >> $${log}; \ + srcdir="$(srcdir)" \ + $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + && touch $(@:.chkexe_=.chkexe) || \ + (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ + (cat $${log} && false) || exit 1; \ + echo "" >> $${log}; \ + echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ + echo "============================" >> $${log}; \ + echo "Finished testing $${tname} $(TEST_FLAGS)"; \ + cat $${log}; \ + fi; \ + fi + +# The dummysh.chkexe here prevents the target from being +# empty if there are no tests in the current directory. +# $${log} is the log file. +# $${tname} is the name of test. +$(TEST_SCRIPT_CHKSH) $(TEST_SCRIPT_PARA_CHKSH) dummysh.chkexe_: + @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \ + cmd=$(@:.chkexe_=);\ + tname=`basename $$cmd`;\ + chkname=`basename $(@:.chkexe_=.chkexe)`;\ + log=`basename $(@:.chkexe_=.chklog)`; \ + echo "============================"; \ + if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \ + echo "No need to test $${tname} again."; \ + else \ + echo "============================" > $${log}; \ + if test "X$(FORTRAN_API)" = "Xyes"; then \ + echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \ + echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ + elif test "X$(CXX_API)" = "Xyes"; then \ + echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \ + echo "C++ API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ + else \ + echo "Testing $${tname} $(TEST_FLAGS)"; \ + echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ + fi; \ + echo "============================" >> $${log}; \ + RUNSERIAL="$(RUNSERIAL)" RUNPARALLEL="$(RUNPARALLEL)" \ + srcdir="$(srcdir)" \ + $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \ + && touch $${chkname} || \ + (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ + (cat $${log} && false) || exit 1; \ + echo "" >> $${log}; \ + echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ + echo "============================" >> $${log}; \ + echo "Finished testing $${tname} $(TEST_FLAGS)"; \ + cat $${log}; \ + fi; \ + echo "============================"; \ + fi + +# Actual execution of check-p. +build-check-p: $(LIB) $(PROGS) $(TESTS) + @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ + echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \ + fi + @if test -n "$(TEST_PROG_PARA)"; then \ + echo "**** Hint ****"; \ + echo "Parallel test files reside in the current directory" \ + "by default."; \ + echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \ + echo " HDF5_PARAPREFIX=/PFS/user/me"; \ + echo " export HDF5_PARAPREFIX"; \ + echo " make check"; \ + echo "**** end of Hint ****"; \ + fi + @for test in $(TEST_PROG_PARA) dummy; do \ + if test $$test != dummy; then \ + $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ + RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + fi; \ + done + @for test in $(TEST_SCRIPT_PARA) dummy; do \ + if test $$test != dummy; then \ + $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ || exit 1; \ + fi; \ + done + @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ + echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ + fi + +# Run test with different Virtual File Driver +check-vfd: $(LIB) $(PROGS) $(TESTS) + @for vfd in $(VFD_LIST) dummy; do \ + if test $$vfd != dummy; then \ + echo "============================"; \ + echo "Testing Virtual File Driver $$vfd"; \ + echo "============================"; \ + $(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \ + HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ + fi; \ + done +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/hl/tools/h52jpeg/h52jpeg.c b/hl/tools/h52jpeg/h52jpeg.c new file mode 100644 index 0000000..05a3e80 --- /dev/null +++ b/hl/tools/h52jpeg/h52jpeg.c @@ -0,0 +1,695 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* From jpeg documentation + * + * 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 +#include +#include + +#include "jpeglib.h" +#include "jerror.h" + +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_utils.h" +#include "h5trav.h" +#include "H5IMpublic.h" + + +const char *progname = "h52jpeg"; +int d_status = EXIT_SUCCESS; + +/* command-line options: The user can specify short or long-named parameters */ +static const char *s_opts = "hVvi:t:"; +static struct long_options l_opts[] = { + { "help", no_arg, 'h' }, + { "version", no_arg, 'V' }, + { "verbose", no_arg, 'v' }, + { "image", require_arg, 'i' }, + { "type", require_arg, 't' }, + { NULL, 0, '\0' } +}; + + +/* a structure that contains h52jpeg options */ +typedef struct +{ + const char *file_name; + const char *template_name; + const char *image_name; + int image_type; + int verbose; +} h52jpeg_opt_t; + + +/* prototypes */ +static void usage(const char *prog); +static int h52jpeg(h52jpeg_opt_t opt); +static void make_jpeg_name( const char* template_name, const char* image_name, char* jpeg_name); +static int do_image(hid_t fid, h52jpeg_opt_t opt, const char* image_name); +static void write_JPEG_file(char *filename, JSAMPLE *image_buffer, int image_height, int image_width, int planes); + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: h52jpeg main program + * + * Programmer: Pedro Vicente, pvn@hdfgroup.org + * + * Date: May 30, 2008 + * + *------------------------------------------------------------------------- + */ +int main(int argc, const char *argv[]) +{ + h52jpeg_opt_t opt; + const char *image_type = NULL; + int op; + + /* initialze options to 0 */ + memset(&opt,0,sizeof(h52jpeg_opt_t)); + + /* parse command line options */ + while ((op = get_option(argc, argv, s_opts, l_opts)) != EOF) + { + switch ((char)op) + { + case 'h': + usage(progname); + exit(EXIT_SUCCESS); + case 'V': + print_version(progname); + exit(EXIT_SUCCESS); + case 'v': + opt.verbose = 1; + break; + case 'i': + opt.image_name = opt_arg; + break; + case 't': + image_type = opt_arg; + + + if ( HDstrcmp( image_type, "grey" ) == 0 ) + { + opt.image_type = 0; + } + else if ( HDstrcmp( image_type, "true" ) == 0 ) + { + opt.image_type = 1; + } + else + { + printf("<%s> is an invalid image type\n", image_type); + exit(EXIT_FAILURE); + } + + break; + + } /* switch */ + + + } /* while */ + + /* check for file names to be processed */ + if ( argv[ opt_ind ] != NULL && argv[ opt_ind + 1 ] != NULL ) + { + opt.file_name = argv[ opt_ind ]; + opt.template_name = argv[ opt_ind + 1 ]; + } + + else + { + usage(progname); + exit(EXIT_FAILURE); + } + + if ( h52jpeg(opt) < 0 ) + return 1; + + + return 0; +} + + + +/*------------------------------------------------------------------------- + * Function: usage + * + * Purpose: print usage + * + * Return: void + * + *------------------------------------------------------------------------- + */ +static void usage(const char *prog) +{ + printf("usage: %s [OPTIONS] file template\n", prog); + printf(" file HDF5 file name\n"); + printf(" template Name template for jpeg images\n"); + printf(" OPTIONS\n"); + printf(" -h, --help Print a usage message and exit\n"); + printf(" -v, --verbose Verbose mode, print object information\n"); + printf(" -V, --version Print HDF5 version number and exit\n"); + printf(" -i, --image Image name (full path in HDF5 file)\n"); + printf(" -t T, --type=T Type of image (graycolor or truecolor)\n"); + + printf("\n"); + + printf(" T - is a string, either or \n"); + +} + +/*------------------------------------------------------------------------- + * Function: h52jpeg + * + * Parameters: OPT, options at command line + * + * Purpose: traverse the HDF5 file, save HDF5 images to jpeg files, translate + * 2D datasets of classes H5T_INTEGER and H5T_FLOAT to image data and save them + * to jpeg files + * + * Return: 0, all is fine, -1 not all is fine + * + *------------------------------------------------------------------------- + */ +static int h52jpeg(h52jpeg_opt_t opt) +{ + hid_t fid; + trav_table_t *travt = NULL; + size_t i; + + + /* open the HDF5 file */ + if (( fid = h5tools_fopen(opt.file_name, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) + { + error_msg(progname, "cannot open file <%s>\n", opt.file_name ); + return -1; + } + + /*------------------------------------------------------------------------- + * image/dataset name was specified at command line + *------------------------------------------------------------------------- + */ + + if ( opt.image_name ) + { + + /* read HDF5 image/dataset, save jpeg image */ + do_image(fid, opt, opt.image_name); + + } + + /*------------------------------------------------------------------------- + * image name was not specified; traverse the file + *------------------------------------------------------------------------- + */ + + else + + { + + /* initialize traversal table */ + trav_table_init(&travt); + + /* get the list of objects in the file */ + if ( h5trav_gettable(fid, travt) < 0 ) + goto out; + + /* search for images/datasets in file */ + for ( i = 0; i < travt->nobjs; i++) + { + + switch ( travt->objs[i].type ) + { + default: + goto out; + + case H5TRAV_TYPE_GROUP: + case H5TRAV_TYPE_NAMED_DATATYPE: + case H5TRAV_TYPE_LINK: + case H5TRAV_TYPE_UDLINK: + + break; + + case H5TRAV_TYPE_DATASET: + + /* read HDF5 image/dataset, save jpeg image */ + do_image(fid, opt, travt->objs[i].name); + + break; /* H5TRAV_TYPE_DATASET */ + + } /* switch */ + + } /* i */ + + + /* free table */ + trav_table_free(travt); + + } /* image_name */ + + + /* close */ + if ( H5Fclose(fid) < 0 ) + return -1; + + return 0; + +out: + H5E_BEGIN_TRY + { + H5Fclose(fid); + + } H5E_END_TRY; + + + return -1; +} + + + +/*------------------------------------------------------------------------- + * Function: do_image + * + * Parameters: HDF5 file id, command line options, an image name + * + * Purpose: read HDF5 image/dataset, save jpeg image + * + * Return: int + * + *------------------------------------------------------------------------- + */ +static +int do_image(hid_t fid, h52jpeg_opt_t opt, const char* image_name) +{ + hsize_t width; + hsize_t height; + hsize_t planes; + char interlace[20]; + hssize_t npals; + unsigned char* buf=NULL; + H5T_class_t tclass; + hid_t sid; + hid_t did; + hid_t tid; + int rank; + hsize_t dims[H5S_MAX_RANK]; + hsize_t maxdim[H5S_MAX_RANK]; + size_t size; + hsize_t nelmts; + const char* name; + size_t i; + int j; + int done; + char jpeg_name[1024]; + + name = image_name; + + /* build the jpeg file name */ + make_jpeg_name( opt.template_name, image_name, jpeg_name); + + done = 0; + + if ( opt.verbose) + { + printf("%s ...", name ); + } + + /*------------------------------------------------------------------------- + * HDF5 Image + *------------------------------------------------------------------------- + */ + + if ( H5IMis_image( fid, name ) ) + { + + if ( H5IMget_image_info( fid, name, &width, &height, &planes, interlace, &npals ) < 0 ) + goto out; + + if (NULL == (buf = HDmalloc( (size_t)width * (size_t)height * (size_t)planes ))) + goto out; + + if ( H5IMread_image( fid, name, buf ) < 0 ) + goto out; + + /* write the jpeg file */ + write_JPEG_file (jpeg_name, + buf, + (int) height, + (int) width, + (int) planes); + + + free( buf ); + buf = NULL; + + done = 1; + + + + } + + /*------------------------------------------------------------------------- + * HDF5 Image palette, ignore + *------------------------------------------------------------------------- + */ + + else if ( H5IMis_palette( fid, name ) ) + { + + } + + /*------------------------------------------------------------------------- + * regular dataset + *------------------------------------------------------------------------- + */ + + else + { + + unsigned char* image_buffer = NULL; + + if (( did = H5Dopen2( fid, name, H5P_DEFAULT )) < 0) + goto out; + if (( sid = H5Dget_space( did )) < 0 ) + goto out; + if (( rank = H5Sget_simple_extent_ndims(sid)) < 0 ) + goto out; + if (( tid = H5Dget_type( did )) < 0 ) + goto out; + if (( tclass = H5Tget_class(tid)) < 0) + goto out; + + if ( ( H5T_FLOAT == tclass || H5T_INTEGER == tclass) && + ( rank == 2 ) ) + { + + if ( H5Sget_simple_extent_dims( sid, dims, maxdim ) < 0 ) + goto out; + + size = H5Tget_size( tid ); + + nelmts = 1; + for ( j = 0; j < rank; j++) + { + nelmts *= dims[j]; + } + + if ( NULL == (buf = HDmalloc( (size_t)nelmts * size ))) + goto out; + if ( H5Dread(did,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0 ) + goto out; + + height = dims[0]; + width = dims[1]; + + if ( opt.image_type == 0 ) + planes = 1; + else if ( opt.image_type == 1 ) + planes = 3; + + + if ( NULL == (image_buffer = HDmalloc( (size_t)nelmts * sizeof (unsigned char) ))) + { + goto out; + } + + /*------------------------------------------------------------------------- + * convert the data to unsigned char + * + *------------------------------------------------------------------------- + */ + + { + double min = DBL_MAX; + double max = -DBL_MAX; + double ratio; + + /* search for the minimum and maximum */ + for ( i = 0; i < nelmts; i++) + { + if ( buf[i] < min) min = buf[i]; + if ( buf[i] > max) max = buf[i]; + } + /* converts the data based on the ratio to a 0-255 range */ + ratio = (min == max) ? 1.0 : (double)(255.0/(max-min)); + for ( i = 0; i < nelmts; i++) + { + image_buffer[i] = (unsigned char)ceil( (( buf[i] - min ) / ratio) ); + } + + } + + /* write the jpeg file */ + write_JPEG_file (jpeg_name, + image_buffer, + (int) height, + (int) width, + (int) planes); + + + free( image_buffer ); + free( buf ); + buf = NULL; + image_buffer = NULL; + done = 1; + + } + + + + H5Sclose(sid); + H5Tclose(tid); + H5Dclose(did); + + + + + } /* else */ + + + if ( opt.verbose) + { + if ( done ) + { + printf("saved to %s\n", jpeg_name ); + } + else + { + printf("\n"); + } + + } + + return 0; + +out: + H5E_BEGIN_TRY + { + + H5Sclose(sid); + H5Tclose(tid); + H5Dclose(did); + + } H5E_END_TRY; + + if ( buf != NULL ) + free( buf ); + + + return -1; + +} + +/*------------------------------------------------------------------------- + * Function: make_jpeg_name + * + * Parameters: template name (IN), image name (IN), jpeg name (IN/OUT) + * + * Purpose: build a name for the jpeg image file upon a template name + * and the HDF5 image name + * + * Return: void + * + *------------------------------------------------------------------------- + */ +static +void make_jpeg_name( const char* template_name, const char* image_name, char* jpeg_name) +{ + int j; + int len; + + HDstrcpy( jpeg_name, template_name ); + HDstrcat( jpeg_name, image_name ); + HDstrcat( jpeg_name, ".jpeg" ); + len = HDstrlen( jpeg_name); + + /* HDF5 path names might contain '/', replace with '_' */ + for (j = 0; j < len; j++) + { + if (jpeg_name[j] == '/') + { + jpeg_name[j] = '_'; + } + } + +} + + + +/* + * Sample routine for JPEG compression. + * + * 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. + */ + +static +void write_JPEG_file(char *filename, + JSAMPLE *image_buffer, /* Points to large array of R,G,B-order data */ + int image_height, /* Number of rows in image */ + int image_width, /* Number of columns in image */ + int planes) /* # of color components per pixel */ +{ + /* 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 = planes; /* # of color components per pixel */ + + /* colorspace of input image */ + if (planes == 3) + cinfo.in_color_space = JCS_RGB; + else if (planes == 1) + cinfo.in_color_space = JCS_GRAYSCALE; + + /* 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, 100, 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 * planes; /* 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! */ +} + diff --git a/hl/tools/h52jpeg/h52jpeg.sh b/hl/tools/h52jpeg/h52jpeg.sh new file mode 100644 index 0000000..b1e1109 --- /dev/null +++ b/hl/tools/h52jpeg/h52jpeg.sh @@ -0,0 +1,87 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# Tests for the h52jpeg tool +# Pedro Vicente Nunes (THG), 6/16/2008 + +TOOL=h52jpeg # The tool name +TOOL_BIN=`pwd`/$TOOL # The path of the tool binary + +SRCFILE=h52jpegtst.h5 +INDIR=$srcdir/testfiles +TESTFILE="$INDIR/$SRCFILE" + +nerrors=0 + + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Just call the tool binary with the command line parameters +# and use the return value of main to print FAILED or PASSED +# +TOOLTEST() +{ + # Run test. + # Tflops interprets "$@" as "" when no parameter is given (e.g., the + # case of missing file name). Changed it to use $@ till Tflops fixes it. + + if [ "`uname -s`" = "TFLOPS O/S" ]; then + $RUNSERIAL $TOOL_BIN $@ + else + $RUNSERIAL $TOOL_BIN "$@" + fi + + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi +} + + + +############################################################################## +# The tests +# To avoid the printing of the complete full path of the test file, that hides +# all the other parameters for long paths, the printing of the command line +# is done first in +# TESTING with the name only of the test file $TOOL, not its full path $TESTFILE +############################################################################## + + +# Test for traversing the file and export all images/datasets to jpeg +TESTING $TOOL $SRCFILE myjpeg1 +TOOLTEST $TESTFILE myjpeg1 + +# Test for reading an image path +TESTING $TOOL -i image8bit $SRCFILE myjpeg2 +TOOLTEST -i image8bit $TESTFILE myjpeg2 + + + +if test $nerrors -eq 0 ; then + echo "All $TOOL tests passed." +fi + +exit $nerrors + diff --git a/hl/tools/h52jpeg/h52jpegtst.c b/hl/tools/h52jpeg/h52jpegtst.c new file mode 100644 index 0000000..b420168 --- /dev/null +++ b/hl/tools/h52jpeg/h52jpegtst.c @@ -0,0 +1,323 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "hdf5.h" +#include "hdf5_hl.h" +#include "H5private.h" +#include +#include + +#define DATA_FILE1 "image8.txt" +#define DATA_FILE2 "image24pixel.txt" +#define IMAGE1_NAME "image8bit" +#define IMAGE2_NAME "image24bitpixel" +#define PAL_NAME "palette" +#define PAL_ENTRIES 256 +#define RANK 2 +#define HEIGHT 200 +#define WIDTH 300 + + +static int make_datasets( hid_t fid ); +static int make_images( hid_t fid ); +static int read_data(const char* file_name, hsize_t *width, hsize_t *height ); +unsigned char *gbuf = 0; /* global buffer for image data */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: h52jpegtst main program. Generate images and datasets to be used + * by h52jpeg tests + * + * Programmer: Pedro Vicente, pvn@hdfgroup.org + * + * Date: May 30, 2008 + * + *------------------------------------------------------------------------- + */ +int main( void ) +{ + hid_t fid; /* HDF5 file identifier */ + + /* create a new HDF5 file using default properties. */ + if (( fid = H5Fcreate( "h52jpegtst.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT )) < 0 ) + return 1; + + /* make images */ + if ( make_images( fid ) < 0 ) + goto out; + + /* make images */ + if ( make_datasets( fid ) < 0 ) + goto out; + + /* close the file. */ + H5Fclose( fid ); + + return 0; + +out: + printf("Error on return function...Exiting\n"); + H5Fclose( fid ); + return 1; +} + +/*------------------------------------------------------------------------- + * Function: make_images + * + * Purpose: generate images + * + *------------------------------------------------------------------------- + */ + +static int make_images( hid_t fid ) +{ + hsize_t width; /* width of image */ + hsize_t height; /* height of image */ + unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */ + hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */ + int i, n; + + /* read first data file */ + if ( read_data( DATA_FILE1, &width, &height ) < 0 ) + goto out; + + /* make the image */ + if ( H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, gbuf ) < 0 ) + goto out; + + /*------------------------------------------------------------------------- + * define a palette, blue to red tones + *------------------------------------------------------------------------- + */ + for ( i=0, n=0; i $${log}; \ - if test "X$(FORTRAN_API)" = "Xyes"; then \ - echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ - echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - elif test "X$(CXX_API)" = "Xyes"; then \ - echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ - echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\ - else \ - echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ - echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - fi; \ - echo "============================" >> $${log}; \ - srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ - && touch $(@:.chkexe_=.chkexe) || \ - (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ - (cat $${log} && false) || exit 1; \ - echo "" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ - echo "============================" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)"; \ - cat $${log}; \ - fi; \ - fi - -# The dummysh.chkexe here prevents the target from being -# empty if there are no tests in the current directory. -# $${log} is the log file. -# $${tname} is the name of test. -$(TEST_SCRIPT_CHKSH) $(TEST_SCRIPT_PARA_CHKSH) dummysh.chkexe_: - @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \ - cmd=$(@:.chkexe_=);\ - tname=`basename $$cmd`;\ - chkname=`basename $(@:.chkexe_=.chkexe)`;\ - log=`basename $(@:.chkexe_=.chklog)`; \ - echo "============================"; \ - if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \ - echo "No need to test $${tname} again."; \ - else \ - echo "============================" > $${log}; \ - if test "X$(FORTRAN_API)" = "Xyes"; then \ - echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \ - echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - elif test "X$(CXX_API)" = "Xyes"; then \ - echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \ - echo "C++ API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - else \ - echo "Testing $${tname} $(TEST_FLAGS)"; \ - echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - fi; \ - echo "============================" >> $${log}; \ - RUNSERIAL="$(RUNSERIAL)" RUNPARALLEL="$(RUNPARALLEL)" \ - srcdir="$(srcdir)" \ - $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \ - && touch $${chkname} || \ - (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ - (cat $${log} && false) || exit 1; \ - echo "" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ - echo "============================" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)"; \ - cat $${log}; \ - fi; \ - echo "============================"; \ - fi - -# Actual execution of check-p. -build-check-p: $(LIB) $(PROGS) $(TESTS) - @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ - echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \ - fi - @if test -n "$(TEST_PROG_PARA)"; then \ - echo "**** Hint ****"; \ - echo "Parallel test files reside in the current directory" \ - "by default."; \ - echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \ - echo " HDF5_PARAPREFIX=/PFS/user/me"; \ - echo " export HDF5_PARAPREFIX"; \ - echo " make check"; \ - echo "**** end of Hint ****"; \ - fi - @for test in $(TEST_PROG_PARA) dummy; do \ - if test $$test != dummy; then \ - $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ - fi; \ - done - @for test in $(TEST_SCRIPT_PARA) dummy; do \ - if test $$test != dummy; then \ - $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ || exit 1; \ - fi; \ - done - @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ - echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ - fi - -# Run test with different Virtual File Driver -check-vfd: $(LIB) $(PROGS) $(TESTS) - @for vfd in $(VFD_LIST) dummy; do \ - if test $$vfd != dummy; then \ - echo "============================"; \ - echo "Testing Virtual File Driver $$vfd"; \ - echo "============================"; \ - $(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \ - HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ - fi; \ - done -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/tools/h52jpeg/h52jpeg.c b/tools/h52jpeg/h52jpeg.c deleted file mode 100644 index 05a3e80..0000000 --- a/tools/h52jpeg/h52jpeg.c +++ /dev/null @@ -1,695 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* From jpeg documentation - * - * 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 -#include -#include - -#include "jpeglib.h" -#include "jerror.h" - -#include "H5private.h" -#include "h5tools.h" -#include "h5tools_utils.h" -#include "h5trav.h" -#include "H5IMpublic.h" - - -const char *progname = "h52jpeg"; -int d_status = EXIT_SUCCESS; - -/* command-line options: The user can specify short or long-named parameters */ -static const char *s_opts = "hVvi:t:"; -static struct long_options l_opts[] = { - { "help", no_arg, 'h' }, - { "version", no_arg, 'V' }, - { "verbose", no_arg, 'v' }, - { "image", require_arg, 'i' }, - { "type", require_arg, 't' }, - { NULL, 0, '\0' } -}; - - -/* a structure that contains h52jpeg options */ -typedef struct -{ - const char *file_name; - const char *template_name; - const char *image_name; - int image_type; - int verbose; -} h52jpeg_opt_t; - - -/* prototypes */ -static void usage(const char *prog); -static int h52jpeg(h52jpeg_opt_t opt); -static void make_jpeg_name( const char* template_name, const char* image_name, char* jpeg_name); -static int do_image(hid_t fid, h52jpeg_opt_t opt, const char* image_name); -static void write_JPEG_file(char *filename, JSAMPLE *image_buffer, int image_height, int image_width, int planes); - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: h52jpeg main program - * - * Programmer: Pedro Vicente, pvn@hdfgroup.org - * - * Date: May 30, 2008 - * - *------------------------------------------------------------------------- - */ -int main(int argc, const char *argv[]) -{ - h52jpeg_opt_t opt; - const char *image_type = NULL; - int op; - - /* initialze options to 0 */ - memset(&opt,0,sizeof(h52jpeg_opt_t)); - - /* parse command line options */ - while ((op = get_option(argc, argv, s_opts, l_opts)) != EOF) - { - switch ((char)op) - { - case 'h': - usage(progname); - exit(EXIT_SUCCESS); - case 'V': - print_version(progname); - exit(EXIT_SUCCESS); - case 'v': - opt.verbose = 1; - break; - case 'i': - opt.image_name = opt_arg; - break; - case 't': - image_type = opt_arg; - - - if ( HDstrcmp( image_type, "grey" ) == 0 ) - { - opt.image_type = 0; - } - else if ( HDstrcmp( image_type, "true" ) == 0 ) - { - opt.image_type = 1; - } - else - { - printf("<%s> is an invalid image type\n", image_type); - exit(EXIT_FAILURE); - } - - break; - - } /* switch */ - - - } /* while */ - - /* check for file names to be processed */ - if ( argv[ opt_ind ] != NULL && argv[ opt_ind + 1 ] != NULL ) - { - opt.file_name = argv[ opt_ind ]; - opt.template_name = argv[ opt_ind + 1 ]; - } - - else - { - usage(progname); - exit(EXIT_FAILURE); - } - - if ( h52jpeg(opt) < 0 ) - return 1; - - - return 0; -} - - - -/*------------------------------------------------------------------------- - * Function: usage - * - * Purpose: print usage - * - * Return: void - * - *------------------------------------------------------------------------- - */ -static void usage(const char *prog) -{ - printf("usage: %s [OPTIONS] file template\n", prog); - printf(" file HDF5 file name\n"); - printf(" template Name template for jpeg images\n"); - printf(" OPTIONS\n"); - printf(" -h, --help Print a usage message and exit\n"); - printf(" -v, --verbose Verbose mode, print object information\n"); - printf(" -V, --version Print HDF5 version number and exit\n"); - printf(" -i, --image Image name (full path in HDF5 file)\n"); - printf(" -t T, --type=T Type of image (graycolor or truecolor)\n"); - - printf("\n"); - - printf(" T - is a string, either or \n"); - -} - -/*------------------------------------------------------------------------- - * Function: h52jpeg - * - * Parameters: OPT, options at command line - * - * Purpose: traverse the HDF5 file, save HDF5 images to jpeg files, translate - * 2D datasets of classes H5T_INTEGER and H5T_FLOAT to image data and save them - * to jpeg files - * - * Return: 0, all is fine, -1 not all is fine - * - *------------------------------------------------------------------------- - */ -static int h52jpeg(h52jpeg_opt_t opt) -{ - hid_t fid; - trav_table_t *travt = NULL; - size_t i; - - - /* open the HDF5 file */ - if (( fid = h5tools_fopen(opt.file_name, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) - { - error_msg(progname, "cannot open file <%s>\n", opt.file_name ); - return -1; - } - - /*------------------------------------------------------------------------- - * image/dataset name was specified at command line - *------------------------------------------------------------------------- - */ - - if ( opt.image_name ) - { - - /* read HDF5 image/dataset, save jpeg image */ - do_image(fid, opt, opt.image_name); - - } - - /*------------------------------------------------------------------------- - * image name was not specified; traverse the file - *------------------------------------------------------------------------- - */ - - else - - { - - /* initialize traversal table */ - trav_table_init(&travt); - - /* get the list of objects in the file */ - if ( h5trav_gettable(fid, travt) < 0 ) - goto out; - - /* search for images/datasets in file */ - for ( i = 0; i < travt->nobjs; i++) - { - - switch ( travt->objs[i].type ) - { - default: - goto out; - - case H5TRAV_TYPE_GROUP: - case H5TRAV_TYPE_NAMED_DATATYPE: - case H5TRAV_TYPE_LINK: - case H5TRAV_TYPE_UDLINK: - - break; - - case H5TRAV_TYPE_DATASET: - - /* read HDF5 image/dataset, save jpeg image */ - do_image(fid, opt, travt->objs[i].name); - - break; /* H5TRAV_TYPE_DATASET */ - - } /* switch */ - - } /* i */ - - - /* free table */ - trav_table_free(travt); - - } /* image_name */ - - - /* close */ - if ( H5Fclose(fid) < 0 ) - return -1; - - return 0; - -out: - H5E_BEGIN_TRY - { - H5Fclose(fid); - - } H5E_END_TRY; - - - return -1; -} - - - -/*------------------------------------------------------------------------- - * Function: do_image - * - * Parameters: HDF5 file id, command line options, an image name - * - * Purpose: read HDF5 image/dataset, save jpeg image - * - * Return: int - * - *------------------------------------------------------------------------- - */ -static -int do_image(hid_t fid, h52jpeg_opt_t opt, const char* image_name) -{ - hsize_t width; - hsize_t height; - hsize_t planes; - char interlace[20]; - hssize_t npals; - unsigned char* buf=NULL; - H5T_class_t tclass; - hid_t sid; - hid_t did; - hid_t tid; - int rank; - hsize_t dims[H5S_MAX_RANK]; - hsize_t maxdim[H5S_MAX_RANK]; - size_t size; - hsize_t nelmts; - const char* name; - size_t i; - int j; - int done; - char jpeg_name[1024]; - - name = image_name; - - /* build the jpeg file name */ - make_jpeg_name( opt.template_name, image_name, jpeg_name); - - done = 0; - - if ( opt.verbose) - { - printf("%s ...", name ); - } - - /*------------------------------------------------------------------------- - * HDF5 Image - *------------------------------------------------------------------------- - */ - - if ( H5IMis_image( fid, name ) ) - { - - if ( H5IMget_image_info( fid, name, &width, &height, &planes, interlace, &npals ) < 0 ) - goto out; - - if (NULL == (buf = HDmalloc( (size_t)width * (size_t)height * (size_t)planes ))) - goto out; - - if ( H5IMread_image( fid, name, buf ) < 0 ) - goto out; - - /* write the jpeg file */ - write_JPEG_file (jpeg_name, - buf, - (int) height, - (int) width, - (int) planes); - - - free( buf ); - buf = NULL; - - done = 1; - - - - } - - /*------------------------------------------------------------------------- - * HDF5 Image palette, ignore - *------------------------------------------------------------------------- - */ - - else if ( H5IMis_palette( fid, name ) ) - { - - } - - /*------------------------------------------------------------------------- - * regular dataset - *------------------------------------------------------------------------- - */ - - else - { - - unsigned char* image_buffer = NULL; - - if (( did = H5Dopen2( fid, name, H5P_DEFAULT )) < 0) - goto out; - if (( sid = H5Dget_space( did )) < 0 ) - goto out; - if (( rank = H5Sget_simple_extent_ndims(sid)) < 0 ) - goto out; - if (( tid = H5Dget_type( did )) < 0 ) - goto out; - if (( tclass = H5Tget_class(tid)) < 0) - goto out; - - if ( ( H5T_FLOAT == tclass || H5T_INTEGER == tclass) && - ( rank == 2 ) ) - { - - if ( H5Sget_simple_extent_dims( sid, dims, maxdim ) < 0 ) - goto out; - - size = H5Tget_size( tid ); - - nelmts = 1; - for ( j = 0; j < rank; j++) - { - nelmts *= dims[j]; - } - - if ( NULL == (buf = HDmalloc( (size_t)nelmts * size ))) - goto out; - if ( H5Dread(did,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0 ) - goto out; - - height = dims[0]; - width = dims[1]; - - if ( opt.image_type == 0 ) - planes = 1; - else if ( opt.image_type == 1 ) - planes = 3; - - - if ( NULL == (image_buffer = HDmalloc( (size_t)nelmts * sizeof (unsigned char) ))) - { - goto out; - } - - /*------------------------------------------------------------------------- - * convert the data to unsigned char - * - *------------------------------------------------------------------------- - */ - - { - double min = DBL_MAX; - double max = -DBL_MAX; - double ratio; - - /* search for the minimum and maximum */ - for ( i = 0; i < nelmts; i++) - { - if ( buf[i] < min) min = buf[i]; - if ( buf[i] > max) max = buf[i]; - } - /* converts the data based on the ratio to a 0-255 range */ - ratio = (min == max) ? 1.0 : (double)(255.0/(max-min)); - for ( i = 0; i < nelmts; i++) - { - image_buffer[i] = (unsigned char)ceil( (( buf[i] - min ) / ratio) ); - } - - } - - /* write the jpeg file */ - write_JPEG_file (jpeg_name, - image_buffer, - (int) height, - (int) width, - (int) planes); - - - free( image_buffer ); - free( buf ); - buf = NULL; - image_buffer = NULL; - done = 1; - - } - - - - H5Sclose(sid); - H5Tclose(tid); - H5Dclose(did); - - - - - } /* else */ - - - if ( opt.verbose) - { - if ( done ) - { - printf("saved to %s\n", jpeg_name ); - } - else - { - printf("\n"); - } - - } - - return 0; - -out: - H5E_BEGIN_TRY - { - - H5Sclose(sid); - H5Tclose(tid); - H5Dclose(did); - - } H5E_END_TRY; - - if ( buf != NULL ) - free( buf ); - - - return -1; - -} - -/*------------------------------------------------------------------------- - * Function: make_jpeg_name - * - * Parameters: template name (IN), image name (IN), jpeg name (IN/OUT) - * - * Purpose: build a name for the jpeg image file upon a template name - * and the HDF5 image name - * - * Return: void - * - *------------------------------------------------------------------------- - */ -static -void make_jpeg_name( const char* template_name, const char* image_name, char* jpeg_name) -{ - int j; - int len; - - HDstrcpy( jpeg_name, template_name ); - HDstrcat( jpeg_name, image_name ); - HDstrcat( jpeg_name, ".jpeg" ); - len = HDstrlen( jpeg_name); - - /* HDF5 path names might contain '/', replace with '_' */ - for (j = 0; j < len; j++) - { - if (jpeg_name[j] == '/') - { - jpeg_name[j] = '_'; - } - } - -} - - - -/* - * Sample routine for JPEG compression. - * - * 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. - */ - -static -void write_JPEG_file(char *filename, - JSAMPLE *image_buffer, /* Points to large array of R,G,B-order data */ - int image_height, /* Number of rows in image */ - int image_width, /* Number of columns in image */ - int planes) /* # of color components per pixel */ -{ - /* 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 = planes; /* # of color components per pixel */ - - /* colorspace of input image */ - if (planes == 3) - cinfo.in_color_space = JCS_RGB; - else if (planes == 1) - cinfo.in_color_space = JCS_GRAYSCALE; - - /* 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, 100, 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 * planes; /* 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! */ -} - diff --git a/tools/h52jpeg/h52jpeg.sh b/tools/h52jpeg/h52jpeg.sh deleted file mode 100644 index b1e1109..0000000 --- a/tools/h52jpeg/h52jpeg.sh +++ /dev/null @@ -1,87 +0,0 @@ -#! /bin/sh -# -# Copyright by The HDF Group. -# Copyright by the Board of Trustees of the University of Illinois. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. -# -# Tests for the h52jpeg tool -# Pedro Vicente Nunes (THG), 6/16/2008 - -TOOL=h52jpeg # The tool name -TOOL_BIN=`pwd`/$TOOL # The path of the tool binary - -SRCFILE=h52jpegtst.h5 -INDIR=$srcdir/testfiles -TESTFILE="$INDIR/$SRCFILE" - -nerrors=0 - - -# Print a line-line message left justified in a field of 70 characters -# beginning with the word "Testing". -# -TESTING() { - SPACES=" " - echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' -} - -# Just call the tool binary with the command line parameters -# and use the return value of main to print FAILED or PASSED -# -TOOLTEST() -{ - # Run test. - # Tflops interprets "$@" as "" when no parameter is given (e.g., the - # case of missing file name). Changed it to use $@ till Tflops fixes it. - - if [ "`uname -s`" = "TFLOPS O/S" ]; then - $RUNSERIAL $TOOL_BIN $@ - else - $RUNSERIAL $TOOL_BIN "$@" - fi - - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - fi -} - - - -############################################################################## -# The tests -# To avoid the printing of the complete full path of the test file, that hides -# all the other parameters for long paths, the printing of the command line -# is done first in -# TESTING with the name only of the test file $TOOL, not its full path $TESTFILE -############################################################################## - - -# Test for traversing the file and export all images/datasets to jpeg -TESTING $TOOL $SRCFILE myjpeg1 -TOOLTEST $TESTFILE myjpeg1 - -# Test for reading an image path -TESTING $TOOL -i image8bit $SRCFILE myjpeg2 -TOOLTEST -i image8bit $TESTFILE myjpeg2 - - - -if test $nerrors -eq 0 ; then - echo "All $TOOL tests passed." -fi - -exit $nerrors - diff --git a/tools/h52jpeg/h52jpegtst.c b/tools/h52jpeg/h52jpegtst.c deleted file mode 100644 index b420168..0000000 --- a/tools/h52jpeg/h52jpegtst.c +++ /dev/null @@ -1,323 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "hdf5.h" -#include "hdf5_hl.h" -#include "H5private.h" -#include -#include - -#define DATA_FILE1 "image8.txt" -#define DATA_FILE2 "image24pixel.txt" -#define IMAGE1_NAME "image8bit" -#define IMAGE2_NAME "image24bitpixel" -#define PAL_NAME "palette" -#define PAL_ENTRIES 256 -#define RANK 2 -#define HEIGHT 200 -#define WIDTH 300 - - -static int make_datasets( hid_t fid ); -static int make_images( hid_t fid ); -static int read_data(const char* file_name, hsize_t *width, hsize_t *height ); -unsigned char *gbuf = 0; /* global buffer for image data */ - - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: h52jpegtst main program. Generate images and datasets to be used - * by h52jpeg tests - * - * Programmer: Pedro Vicente, pvn@hdfgroup.org - * - * Date: May 30, 2008 - * - *------------------------------------------------------------------------- - */ -int main( void ) -{ - hid_t fid; /* HDF5 file identifier */ - - /* create a new HDF5 file using default properties. */ - if (( fid = H5Fcreate( "h52jpegtst.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT )) < 0 ) - return 1; - - /* make images */ - if ( make_images( fid ) < 0 ) - goto out; - - /* make images */ - if ( make_datasets( fid ) < 0 ) - goto out; - - /* close the file. */ - H5Fclose( fid ); - - return 0; - -out: - printf("Error on return function...Exiting\n"); - H5Fclose( fid ); - return 1; -} - -/*------------------------------------------------------------------------- - * Function: make_images - * - * Purpose: generate images - * - *------------------------------------------------------------------------- - */ - -static int make_images( hid_t fid ) -{ - hsize_t width; /* width of image */ - hsize_t height; /* height of image */ - unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */ - hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */ - int i, n; - - /* read first data file */ - if ( read_data( DATA_FILE1, &width, &height ) < 0 ) - goto out; - - /* make the image */ - if ( H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, gbuf ) < 0 ) - goto out; - - /*------------------------------------------------------------------------- - * define a palette, blue to red tones - *------------------------------------------------------------------------- - */ - for ( i=0, n=0; i