summaryrefslogtreecommitdiffstats
path: root/hl/tools/gif2h5
diff options
context:
space:
mode:
Diffstat (limited to 'hl/tools/gif2h5')
-rw-r--r--hl/tools/gif2h5/gif.h2
-rw-r--r--hl/tools/gif2h5/gif2hdf.c2
-rw-r--r--hl/tools/gif2h5/h52giftest.sh24
-rw-r--r--hl/tools/gif2h5/writehdf.c26
4 files changed, 44 insertions, 10 deletions
diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h
index eee31fa..031c141 100644
--- a/hl/tools/gif2h5/gif.h
+++ b/hl/tools/gif2h5/gif.h
@@ -162,7 +162,7 @@ int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, BYTE *rmap,
int colorstyle, int BitsPerPixel);
/* WRITEHDF.C */
-int WriteHDF(GIFTOMEM , CHAR *);
+int WriteHDF(GIFTOMEM , CHAR * , CHAR *);
/* Function: ReadHDF
** Return: 0 on completion without error, -1 on error
diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c
index cf5cf9f..34aad1d 100644
--- a/hl/tools/gif2h5/gif2hdf.c
+++ b/hl/tools/gif2h5/gif2hdf.c
@@ -102,7 +102,7 @@ main(int argv , char *argc[])
* Call WriteHDF from here. Go ahead and change WriteHDF to write whatever
* format you want
*/
- if (WriteHDF(GifMemoryStruct , argc[2]))
+ if (WriteHDF(GifMemoryStruct , argc[2] , argc[1]))
printf("HDF Write Error\n\n");
/* Free all buffers */
diff --git a/hl/tools/gif2h5/h52giftest.sh b/hl/tools/gif2h5/h52giftest.sh
index fa439aa..1300f03 100644
--- a/hl/tools/gif2h5/h52giftest.sh
+++ b/hl/tools/gif2h5/h52giftest.sh
@@ -15,7 +15,8 @@
#
# HDF Utilities Test script
-TESTFILE="$srcdir/../testfiles/h52giftst.h5"
+TESTFILE1="$srcdir/../testfiles/h52giftst.h5"
+TESTFILE2="$srcdir/../testfiles/image1.gif"
# initialize errors variable
errors=0
@@ -25,7 +26,7 @@ TESTING() {
echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
}
-TOOLTEST()
+TOOLTEST1()
{
err=0
$RUNSERIAL ./h52gif $*
@@ -38,10 +39,25 @@ else
fi
}
+TOOLTEST2()
+{
+err=0
+$RUNSERIAL ./gif2h5 $*
+
+if [ $err -eq 1 ]; then
+errors="` expr $errors + 1 `";
+ echo "*FAILED*"
+else
+ echo " PASSED"
+fi
+}
+
-TESTING "h52giftst.h5 image1.gif -i 12345678 -p palette" ;
-TOOLTEST $TESTFILE image1.gif -i 12345678 -p palette
+TESTING "./h52gif h52giftst.h5 image1.gif -i 12345678 -p palette"
+TOOLTEST1 $TESTFILE1 image1.gif -i 12345678 -p palette
+TESTING "./gif2h5 image1.gif image1.h5"
+TOOLTEST2 $TESTFILE2 image1.h5
exit $errors
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c
index c0c4742..7c2b063 100644
--- a/hl/tools/gif2h5/writehdf.c
+++ b/hl/tools/gif2h5/writehdf.c
@@ -19,6 +19,8 @@
#include "gif.h"
#include "H5IMpublic.h"
+#define PAL_NAME "global"
+
/*-------------------------------------------------------------------------
* Function: WriteHDF
*
@@ -35,12 +37,18 @@
*/
int
-WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
+WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
{
GIFHEAD gifHead; /* GIF Header structure */
GIFIMAGEDESC *gifImageDesc; /* Logical Image Descriptor struct */
+ int has_pal=0;
long ImageCount; /* number of images */
+#ifdef UNUSED
+ long CommentCount, /* number of comments */
+ ApplicationCount, /* number of application extensions */
+ PlainTextCount; /* number of plain text extensions */
+#endif /* UNUSED */
char ImageName[256]; /* Image name for the Image */
@@ -55,6 +63,11 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
/* get some data from gifHead */
ImageCount = gifHead.ImageCount;
+#ifdef UNUSED
+ CommentCount = (WORD)gifHead.CommentCount;
+ ApplicationCount = (WORD)gifHead.ApplicationCount;
+ PlainTextCount = (WORD)gifHead.PlainTextCount;
+#endif /* UNUSED */
if ((file_id = H5Fcreate(HDFName , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT)) < 0) {
/* error occured opening the HDF File for write */
@@ -72,8 +85,10 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
dims[1] = 3;
/* make a palette */
- if (H5IMmake_palette(file_id,"Global Palette",dims,(unsigned char *)gifHead.HDFPalette)<0)
+ if (H5IMmake_palette(file_id,PAL_NAME,dims,(unsigned char *)gifHead.HDFPalette)<0)
return -1;
+
+ has_pal=1;
}
for(i = 0; i < ImageCount; i++) {
@@ -93,8 +108,11 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
return -1;
/* attach the palette to the image dataset */
- if (H5IMlink_palette(file_id,ImageName,"Global Palette")<0)
- return -1;
+ if (has_pal)
+ {
+ if (H5IMlink_palette(file_id,ImageName,PAL_NAME)<0)
+ return -1;
+ }
}
/* close the H5 file */