summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-04-09 18:25:18 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-04-09 18:25:18 (GMT)
commit753d9839d24226368c5ebeffbab237249287ae52 (patch)
tree298da1b54537d086a6ca11031dec8ff964107041 /hl
parent493be71eb10d1d1a30702c7b82bf393a238f0a64 (diff)
downloadhdf5-753d9839d24226368c5ebeffbab237249287ae52.zip
hdf5-753d9839d24226368c5ebeffbab237249287ae52.tar.gz
hdf5-753d9839d24226368c5ebeffbab237249287ae52.tar.bz2
[svn-r13615]
bug fixes substituted hize_t array index variables for int stack corruption in the h52gif reading routine, wrote a new routine shell script for gif tests, added check of program return value enabled the gif test script tested: linux pgcc, solaris, linux 64
Diffstat (limited to 'hl')
-rw-r--r--hl/test/test_image.c1249
-rw-r--r--hl/test/test_table.c286
-rw-r--r--hl/tools/gif2h5/Makefile.am5
-rw-r--r--hl/tools/gif2h5/Makefile.in11
-rw-r--r--hl/tools/gif2h5/h52gifgentst.c3
-rw-r--r--hl/tools/gif2h5/h52giftest.sh36
-rw-r--r--hl/tools/gif2h5/hdf2gif.c256
-rw-r--r--hl/tools/gif2h5/readhdf.c255
-rw-r--r--hl/tools/testfiles/h52giftst.h5bin0 -> 82816 bytes
-rw-r--r--hl/tools/testfiles/image1.gifbin0 -> 9736 bytes
10 files changed, 932 insertions, 1169 deletions
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index c988160..9645bad 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -20,7 +20,7 @@
#include "H5IMpublic.h"
#include "pal_rgb.h"
-#define FILE1 "test_image1.h5"
+#define FILE_NAME "test_image1.h5"
#define FILE2 "test_image2.h5"
#define FILE3 "test_image3.h5"
#define DATA_FILE1 "image8.txt"
@@ -32,15 +32,16 @@
#define IMAGE1_NAME "image8bit"
#define IMAGE2_NAME "image24bitpixel"
#define IMAGE3_NAME "image24bitplane"
+#define PAL_NAME "palette"
#define PAL1_NAME "rainbow"
#define PAL2_NAME "sepia"
#define PAL3_NAME "earth"
#define PAL4_NAME "blue-red"
-#define WIDTH (hsize_t)500
-#define HEIGHT (hsize_t)200
-#define PAL_ENTRIES 9
+#define WIDTH 400
+#define HEIGHT 200
+#define PAL_ENTRIES 256
/* struct to store RGB values read from a .pal file */
typedef struct rgb_t {
@@ -66,19 +67,19 @@ unsigned char *image_data = NULL;
int main(void)
{
- int nerrors=0;
-
- nerrors += test_simple()<0 ?1:0;
- nerrors += test_data()<0 ?1:0;
- nerrors += test_generate()<0 ?1:0;
-
- if (nerrors) goto error;
- printf("All image tests passed.\n");
- return 0;
-
+ int nerrors=0;
+
+ nerrors += test_simple()<0 ?1:0;
+ nerrors += test_data()<0 ?1:0;
+ nerrors += test_generate()<0 ?1:0;
+
+ if (nerrors) goto error;
+ printf("All image tests passed.\n");
+ return 0;
+
error:
- printf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
- return 1;
+ printf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
+ return 1;
}
/*-------------------------------------------------------------------------
@@ -88,244 +89,214 @@ error:
static int test_simple(void)
{
- hid_t fid;
- hsize_t width;
- hsize_t height;
- hsize_t planes;
- hsize_t pal_dims[] = {PAL_ENTRIES,3};
- hsize_t pal_dims_out[2];
- char interlace[20];
- hssize_t npals;
- size_t i, j;
- herr_t is_image;
- herr_t is_pal;
- unsigned char image_in1 [ WIDTH*HEIGHT ];
- unsigned char image_out1[ WIDTH*HEIGHT ];
- unsigned char image_in2 [ WIDTH*HEIGHT*3 ];
- unsigned char image_out2[ WIDTH*HEIGHT*3 ];
- unsigned char pal_data_out[PAL_ENTRIES*3];
- unsigned char n;
- hsize_t space;
- /* create a PAL_ENTRIES entry palette */
- unsigned char pal_data_in[PAL_ENTRIES*3] = {
- 0,0,168, /* dark blue */
- 0,0,252, /* blue */
- 0,168,252, /* ocean blue */
- 84,252,252, /* light blue */
- 168,252,168, /* light green */
- 0,252,168, /* green */
- 252,252,84, /* yellow */
- 252,168,0, /* orange */
- 252,0,0}; /* red */
-
- /* create an image of 9 values divided evenly by the array */
- space = WIDTH*HEIGHT / PAL_ENTRIES;
- for (i=0, j=0, n=0; i < (size_t)(WIDTH*HEIGHT); i++, j++ )
- {
- image_in1[i] = n;
- if ( j > (size_t)space )
- {
- n++;
- j=0;
- }
- if (n>PAL_ENTRIES-1) n=0;
- }
- /* create an image 3 byte RGB image */
- for (i=0, j=0, n=0; i < (size_t)(WIDTH*HEIGHT*3); i++, j++)
- {
- image_in2[i] = n;
- if (j==3)
- {
- n++;
- j=0;
- }
- }
-
- /* create a file using default properties */
- if ((fid=H5Fcreate(FILE1,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
- goto out;
-
-
- printf("Testing API functions\n");
-
-/*-------------------------------------------------------------------------
- * indexed image test
- *-------------------------------------------------------------------------
- */
-
- TESTING2("indexed images");
-
- /* write image */
- if (H5IMmake_image_8bit(fid,"image1",WIDTH,HEIGHT,image_in1)<0)
- goto out;
-
- /* make a palette */
- if (H5IMmake_palette(fid,"palette",pal_dims,pal_data_in)<0)
- goto out;
-
- /* attach the palette to the image dataset */
- if (H5IMlink_palette(fid,"image1","palette")<0)
- goto out;
-
- /* get info */
- if (H5IMget_image_info(fid,"image1",&width,&height,&planes,interlace,&npals)<0)
- goto out;
-
- if (width!=WIDTH)
- goto out;
- if (height!=HEIGHT)
- goto out;
- if (planes!=1)
- goto out;
- if (npals!=1)
- goto out;
-
- /* read image */
- if (H5IMread_image(fid,"image1",image_out1)<0)
- goto out;
-
- /* check */
- for (i = 0; i < (size_t)(height*width*planes); i++)
- {
- if ( image_in1[i] != image_out1[i] )
- {
- goto out;
- }
- }
-
-
- PASSED();
-
-/*-------------------------------------------------------------------------
- * true color image test
- *-------------------------------------------------------------------------
- */
-
- TESTING2("true color image");
-
- /* write image */
- if (H5IMmake_image_24bit(fid,"image2",WIDTH,HEIGHT,"INTERLACE_PIXEL",image_in2))
- goto out;
-
- /* get info */
- if (H5IMget_image_info(fid,"image2",&width,&height,&planes,interlace,&npals)<0)
- goto out;
-
- if (width!=WIDTH)
- goto out;
- if (height!=HEIGHT)
- goto out;
- if (planes!=3)
- goto out;
-
- /* read image */
- if (H5IMread_image(fid,"image2",image_out2)<0)
- goto out;
-
- /* check */
- for (i = 0; i < (size_t)(height*width*planes); i++)
- {
- if ( image_in2[i] != image_out2[i] )
- {
- goto out;
- }
- }
-
- PASSED();
-
-/*-------------------------------------------------------------------------
- * H5IMget_npalettes test
- *-------------------------------------------------------------------------
- */
-
- TESTING2("palette functions");
-
- if (H5IMget_npalettes(fid,"image1",&npals)<0)
- goto out;
-
- if (npals!=1)
- goto out;
-
-/*-------------------------------------------------------------------------
- * H5IMget_palette_info test
- *-------------------------------------------------------------------------
- */
-
- if (H5IMget_palette_info(fid,"image1",0,pal_dims_out)<0)
- goto out;
-
- /* check */
- for (i = 0; i < 2; i++)
- {
- if ( pal_dims[i] != pal_dims_out[i] )
- {
- goto out;
- }
- }
-
-/*-------------------------------------------------------------------------
- * H5IMget_palette test
- *-------------------------------------------------------------------------
- */
-
- if (H5IMget_palette(fid,"image1",0,pal_data_out)<0)
- goto out;
-
- /* check */
- for (i = 0; i < PAL_ENTRIES*3; i++)
- {
- if ( pal_data_in[i] != pal_data_out[i] )
- {
- goto out;
- }
- }
-
-/*-------------------------------------------------------------------------
- * H5IMis_image test
- *-------------------------------------------------------------------------
- */
-
- if ((is_image=H5IMis_image(fid,"image1"))<0)
- goto out;
-
- if (is_image!=1)
- goto out;
-
- if ((is_image=H5IMis_image(fid,"image2"))<0)
- goto out;
-
- if (is_image!=1)
- goto out;
-
-/*-------------------------------------------------------------------------
- * H5IMis_palette test
- *-------------------------------------------------------------------------
- */
-
- if ((is_pal=H5IMis_palette(fid,"palette"))<0)
- goto out;
-
- if (is_pal!=1)
- goto out;
-
- PASSED();
-
-/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if (H5Fclose(fid)<0)
- goto out;
+ hsize_t width = WIDTH;
+ hsize_t height = HEIGHT;
+ hsize_t planes;
+ hid_t fid;
+ int i, j, n, space;
+ char interlace[20];
+ hssize_t npals;
+
+ /* 8-bit image */
+ unsigned char buf1 [ WIDTH*HEIGHT ];
+ unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */
+ hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */
+
+ /* 24-bit image */
+ unsigned char buf2 [ WIDTH*HEIGHT*3 ];
+
+ /* read data */
+ unsigned char buf1_out [ WIDTH*HEIGHT ];
+ unsigned char buf2_out [ WIDTH*HEIGHT*3 ];
+ unsigned char pal_out[ PAL_ENTRIES * 3 ]; /* palette array */
+ hsize_t pal_dims_out[2]; /* palette dimensions */
+
+ /* create an image */
+ space = WIDTH*HEIGHT / PAL_ENTRIES;
+ for (i=0, j=0, n=0; i < WIDTH*HEIGHT; i++, j++ )
+ {
+ buf1[i] = n;
+ if ( j > space )
+ {
+ n++;
+ j=0;
+ }
+
+ }
+
+
+ /* create an image */
+ space = WIDTH*HEIGHT / 256;
+ for (i=0, j=0, n=0; i < WIDTH*HEIGHT*3; i+=3, j++ )
+ {
+ unsigned char r, g, b;
+
+ r = n; g = 0; b = 255-n;
+ buf2[i] = r;
+ buf2[i+1] = g;
+ buf2[i+2] = b;
+ if ( j > space )
+ {
+ n++;
+ j=0;
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * define a palette, blue to red tones
+ *-------------------------------------------------------------------------
+ */
+ for ( i=0, n=0; i<PAL_ENTRIES*3; i+=3, n++)
+ {
+ pal[i] =n; /* red */
+ pal[i+1]=0; /* green */
+ pal[i+2]=255-n; /* blue */
+ }
+
+ /* Create a new HDF5 file using default properties. */
+ fid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
+
+ /*-------------------------------------------------------------------------
+ * Indexed image test
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING("indexed image");
+
+ /* Write image */
+ if ( H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, buf1 ) < 0 )
+ goto out;
+
+ /* Make a palette */
+ if ( H5IMmake_palette( fid, PAL_NAME, pal_dims, pal ) < 0 )
+ goto out;
+
+ /* Attach a palette to the image dataset */
+ if ( H5IMlink_palette( fid, IMAGE1_NAME, PAL_NAME ) < 0 )
+ goto out;
+
+ /* Read image */
+ if ( H5IMget_image_info( fid, IMAGE1_NAME, &width, &height, &planes, interlace, &npals ) < 0 )
+ goto out;
+
+ if ( H5IMread_image( fid, IMAGE1_NAME, buf1_out ) < 0 )
+ goto out;
+
+ for (i = 0; i < height*width*planes; i++)
+ {
+ if ( buf1[i] != buf1_out[i] )
+ goto out;
+
+ }
+
+
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * True color image test
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING("true color image");
+
+ /* Write image */
+ if ( H5IMmake_image_24bit( fid, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", buf2 ) )
+ goto out;
+
+ /* Read image */
+ if ( H5IMget_image_info( fid, IMAGE2_NAME, &width, &height, &planes, interlace, &npals ) < 0 )
+ goto out;
+
+ if ( H5IMread_image( fid, IMAGE2_NAME, buf2_out ) < 0 )
+ goto out;
+
+ for (i = 0; i < height*width*planes; i++)
+ {
+ if ( buf2[i] != buf2_out[i] )
+ goto out;
+ }
+
+
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * H5IMget_npalettes test
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING("pallete functions");
+
+ if ( H5IMget_npalettes( fid, IMAGE1_NAME, &npals ) < 0 )
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5IMget_palette_info test
+ *-------------------------------------------------------------------------
+ */
+
+ if ( H5IMget_palette_info( fid, IMAGE1_NAME, 0, pal_dims_out ) < 0 )
+ goto out;
+
+ for (i = 0; i < 2; i++)
+ {
+ if ( pal_dims[i] != pal_dims_out[i] )
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5IMget_palette test
+ *-------------------------------------------------------------------------
+ */
+
+ if ( H5IMget_palette( fid, IMAGE1_NAME, 0, pal_out ) < 0 )
+ goto out;
+
+ for (i = 0; i < PAL_ENTRIES * 3; i++)
+ {
+ if ( pal[i] != pal_out[i] )
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5IMis_image test
+ *-------------------------------------------------------------------------
+ */
+
+ if ( H5IMis_image( fid, IMAGE1_NAME ) < 0 )
+ goto out;
+
+ if ( H5IMis_image( fid, IMAGE2_NAME ) < 0 )
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5IMis_palette test
+ *-------------------------------------------------------------------------
+ */
+
+ if ( H5IMis_palette( fid, PAL_NAME ) < 0 )
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * end tests
+ *-------------------------------------------------------------------------
+ */
+
+ /* Close the file. */
+ if(H5Fclose( fid ) < 0)
+ goto out;
+
+
+ PASSED();
- return 0;
+ return 0;
- /* error zone, gracefully close */
+ /* error zone, gracefully close */
out:
- H5E_BEGIN_TRY {
- H5Fclose(fid);
- } H5E_END_TRY;
- H5_FAILED();
- return FAIL;
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ H5_FAILED();
+ return FAIL;
}
@@ -336,184 +307,184 @@ out:
static int test_data(void)
{
- hid_t fid;
- hsize_t pal_dims[2];
- hsize_t width;
- hsize_t height;
- unsigned char pal[256*3]; /* buffer to hold an HDF5 palette */
- rgb_t rgb[256]; /* buffer to hold a .pal file palette */
- int i, n;
-
- /* create a file using default properties */
- if ((fid=H5Fcreate(FILE2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
- goto out;
-
- printf("Testing read ascii image data and generate images\n");
-
-/*-------------------------------------------------------------------------
- * read 8bit image data
- *-------------------------------------------------------------------------
- */
-
- TESTING2("make indexed image");
-
- /* read first data file */
- if (read_data(DATA_FILE1,&width,&height)<0)
- goto out;
-
- /* make an image */
- if (H5IMmake_image_8bit(fid,IMAGE1_NAME,width,height,image_data)<0)
- goto out;
-
- PASSED();
-
-
- TESTING2("attaching palettes");
-
-/*-------------------------------------------------------------------------
- * palette #1. rainbow palette. data is contained in "pal_rgb.h"
- *-------------------------------------------------------------------------
- */
-
- /* initialize the palette data */
- pal_dims[0] = 256;
- pal_dims[1] = 3;
-
- /* make a palette */
- if (H5IMmake_palette(fid,PAL1_NAME,pal_dims,pal_rgb)<0)
- goto out;
-
- /* attach a palette to the image dataset */
- if (H5IMlink_palette(fid,IMAGE1_NAME,PAL1_NAME)<0)
- goto out;
-
-/*-------------------------------------------------------------------------
- * palette #2. sepia palette.
- * read a PAL file and attach the palette to the HDF5 file
- *-------------------------------------------------------------------------
- */
-
- /* read a PAL file */
- if (read_palette(PAL2_FILE, rgb, sizeof(rgb))<0)
- goto out;
-
- /* transfer to the HDF5 buffer */
- for ( i=0, n=0; i<256*3; i+=3, n++)
- {
- pal[i] =rgb[n].r;
- pal[i+1]=rgb[n].g;
- pal[i+2]=rgb[n].b;
- }
-
- /* make a palette */
- if (H5IMmake_palette(fid,PAL2_NAME,pal_dims,pal)<0)
- goto out;
-
- /* attach the palette to the image dataset */
- if (H5IMlink_palette(fid,IMAGE1_NAME,PAL2_NAME)<0)
- goto out;
-
-/*-------------------------------------------------------------------------
- * palette #3. earth palette.
- * read a PAL file and attach the palette to the HDF5 file
- *-------------------------------------------------------------------------
- */
-
- /* read a PAL file */
- if (read_palette(PAL3_FILE, rgb, sizeof(rgb))<0)
- goto out;
-
- /* transfer to the HDF5 buffer */
- for ( i=0, n=0; i<256*3; i+=3, n++)
- {
- pal[i] =rgb[n].r;
- pal[i+1]=rgb[n].g;
- pal[i+2]=rgb[n].b;
- }
-
- /* make a palette */
- if (H5IMmake_palette(fid,PAL3_NAME,pal_dims,pal)<0)
- goto out;
-
- /* attach the palette to the image dataset */
- if (H5IMlink_palette(fid,IMAGE1_NAME,PAL3_NAME)<0)
- goto out;
-
- PASSED();
-
-
-/*-------------------------------------------------------------------------
- * palette #4. blue-red
- * make a palette whith blue to red colors
- *-------------------------------------------------------------------------
- */
- for ( i=0, n=0; i<256*3; i+=3, n++)
- {
- pal[i] =n;
- pal[i+1]=0;
- pal[i+2]=255-n;
- }
-
- /* make a palette */
- if (H5IMmake_palette(fid,PAL4_NAME,pal_dims,pal)<0)
- goto out;
-
- /* attach the palette to the image dataset */
- if (H5IMlink_palette(fid,IMAGE1_NAME,PAL4_NAME)<0)
- goto out;
-
-
-/*-------------------------------------------------------------------------
- * true color image example with pixel interlace
- *-------------------------------------------------------------------------
- */
-
- TESTING2("make true color image with pixel interlace");
-
- /* read second data file */
- if ((read_data(DATA_FILE2,&width,&height))<0)
- goto out;
-
- /* make image */
- if ((H5IMmake_image_24bit(fid,IMAGE2_NAME,width,height,"INTERLACE_PIXEL",image_data))<0)
- goto out;
-
- PASSED();
-
-/*-------------------------------------------------------------------------
- * True color image example with plane interlace
- *-------------------------------------------------------------------------
- */
-
- TESTING2("make true color image with plane interlace");
-
- /* read third data file */
- if ((read_data(DATA_FILE3,&width,&height))<0)
- goto out;
-
- /* make image */
- if ((H5IMmake_image_24bit(fid,IMAGE3_NAME,width,height,"INTERLACE_PLANE",image_data))<0)
- goto out;
-
- PASSED();
-
-
-/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if (H5Fclose(fid)<0)
- goto out;
-
- return 0;
-
- /* error zone, gracefully close */
+ hid_t fid;
+ hsize_t pal_dims[2];
+ hsize_t width;
+ hsize_t height;
+ unsigned char pal[256*3]; /* buffer to hold an HDF5 palette */
+ rgb_t rgb[256]; /* buffer to hold a .pal file palette */
+ int i, n;
+
+ /* create a file using default properties */
+ if ((fid=H5Fcreate(FILE2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
+ goto out;
+
+ printf("Testing read ascii image data and generate images\n");
+
+ /*-------------------------------------------------------------------------
+ * read 8bit image data
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING2("make indexed image");
+
+ /* read first data file */
+ if (read_data(DATA_FILE1,&width,&height)<0)
+ goto out;
+
+ /* make an image */
+ if (H5IMmake_image_8bit(fid,IMAGE1_NAME,width,height,image_data)<0)
+ goto out;
+
+ PASSED();
+
+
+ TESTING2("attaching palettes");
+
+ /*-------------------------------------------------------------------------
+ * palette #1. rainbow palette. data is contained in "pal_rgb.h"
+ *-------------------------------------------------------------------------
+ */
+
+ /* initialize the palette data */
+ pal_dims[0] = 256;
+ pal_dims[1] = 3;
+
+ /* make a palette */
+ if (H5IMmake_palette(fid,PAL1_NAME,pal_dims,pal_rgb)<0)
+ goto out;
+
+ /* attach a palette to the image dataset */
+ if (H5IMlink_palette(fid,IMAGE1_NAME,PAL1_NAME)<0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * palette #2. sepia palette.
+ * read a PAL file and attach the palette to the HDF5 file
+ *-------------------------------------------------------------------------
+ */
+
+ /* read a PAL file */
+ if (read_palette(PAL2_FILE, rgb, sizeof(rgb))<0)
+ goto out;
+
+ /* transfer to the HDF5 buffer */
+ for ( i=0, n=0; i<256*3; i+=3, n++)
+ {
+ pal[i] =rgb[n].r;
+ pal[i+1]=rgb[n].g;
+ pal[i+2]=rgb[n].b;
+ }
+
+ /* make a palette */
+ if (H5IMmake_palette(fid,PAL2_NAME,pal_dims,pal)<0)
+ goto out;
+
+ /* attach the palette to the image dataset */
+ if (H5IMlink_palette(fid,IMAGE1_NAME,PAL2_NAME)<0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * palette #3. earth palette.
+ * read a PAL file and attach the palette to the HDF5 file
+ *-------------------------------------------------------------------------
+ */
+
+ /* read a PAL file */
+ if (read_palette(PAL3_FILE, rgb, sizeof(rgb))<0)
+ goto out;
+
+ /* transfer to the HDF5 buffer */
+ for ( i=0, n=0; i<256*3; i+=3, n++)
+ {
+ pal[i] =rgb[n].r;
+ pal[i+1]=rgb[n].g;
+ pal[i+2]=rgb[n].b;
+ }
+
+ /* make a palette */
+ if (H5IMmake_palette(fid,PAL3_NAME,pal_dims,pal)<0)
+ goto out;
+
+ /* attach the palette to the image dataset */
+ if (H5IMlink_palette(fid,IMAGE1_NAME,PAL3_NAME)<0)
+ goto out;
+
+ PASSED();
+
+
+ /*-------------------------------------------------------------------------
+ * palette #4. blue-red
+ * make a palette whith blue to red colors
+ *-------------------------------------------------------------------------
+ */
+ for ( i=0, n=0; i<256*3; i+=3, n++)
+ {
+ pal[i] =n;
+ pal[i+1]=0;
+ pal[i+2]=255-n;
+ }
+
+ /* make a palette */
+ if (H5IMmake_palette(fid,PAL4_NAME,pal_dims,pal)<0)
+ goto out;
+
+ /* attach the palette to the image dataset */
+ if (H5IMlink_palette(fid,IMAGE1_NAME,PAL4_NAME)<0)
+ goto out;
+
+
+ /*-------------------------------------------------------------------------
+ * true color image example with pixel interlace
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING2("make true color image with pixel interlace");
+
+ /* read second data file */
+ if ((read_data(DATA_FILE2,&width,&height))<0)
+ goto out;
+
+ /* make image */
+ if ((H5IMmake_image_24bit(fid,IMAGE2_NAME,width,height,"INTERLACE_PIXEL",image_data))<0)
+ goto out;
+
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * True color image example with plane interlace
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING2("make true color image with plane interlace");
+
+ /* read third data file */
+ if ((read_data(DATA_FILE3,&width,&height))<0)
+ goto out;
+
+ /* make image */
+ if ((H5IMmake_image_24bit(fid,IMAGE3_NAME,width,height,"INTERLACE_PLANE",image_data))<0)
+ goto out;
+
+ PASSED();
+
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Fclose(fid)<0)
+ goto out;
+
+ return 0;
+
+ /* error zone, gracefully close */
out:
- H5E_BEGIN_TRY {
- H5Fclose(fid);
- } H5E_END_TRY;
- H5_FAILED();
- return FAIL;
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ H5_FAILED();
+ return FAIL;
}
@@ -532,45 +503,45 @@ out:
static int test_generate(void)
{
- hid_t fid;
- hsize_t pal_dims[2] = { 256, 3 };
- float *data;
- int imax, jmax, kmax;
- float valex, xmin, xmax, value;
- FILE *f;
- char *srcdir = getenv("srcdir"); /* the source directory */
- char data_file[512]=""; /* buffer to hold name of existing data file */
- int i;
-
- /* create a file using default properties */
- if ((fid=H5Fcreate(FILE3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
- goto out;
-
- printf("Testing read and process data and make indexed images\n");
-
-/*-------------------------------------------------------------------------
- * compose the name of the file to open, using the srcdir, if appropriate
- *-------------------------------------------------------------------------
- */
- if ( srcdir )
- {
- strcpy(data_file, srcdir);
- strcat(data_file, "/");
- }
- strcat(data_file,DATA_FILE4);
-
-/*-------------------------------------------------------------------------
- * read data; the file data format is described below
- *-------------------------------------------------------------------------
- */
-
- f = fopen( data_file, "r" ) ;
- if ( f == NULL )
- {
- printf( "Could not find file %s. Try set $srcdir \n", data_file );
- H5Fclose(fid);
- return -1;
- }
+ hid_t fid;
+ hsize_t pal_dims[2] = { 256, 3 };
+ float *data;
+ int imax, jmax, kmax;
+ float valex, xmin, xmax, value;
+ FILE *f;
+ char *srcdir = getenv("srcdir"); /* the source directory */
+ char data_file[512]=""; /* buffer to hold name of existing data file */
+ int i;
+
+ /* create a file using default properties */
+ if ((fid=H5Fcreate(FILE3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
+ goto out;
+
+ printf("Testing read and process data and make indexed images\n");
+
+ /*-------------------------------------------------------------------------
+ * compose the name of the file to open, using the srcdir, if appropriate
+ *-------------------------------------------------------------------------
+ */
+ if ( srcdir )
+ {
+ strcpy(data_file, srcdir);
+ strcat(data_file, "/");
+ }
+ strcat(data_file,DATA_FILE4);
+
+ /*-------------------------------------------------------------------------
+ * read data; the file data format is described below
+ *-------------------------------------------------------------------------
+ */
+
+ f = fopen( data_file, "r" ) ;
+ if ( f == NULL )
+ {
+ printf( "Could not find file %s. Try set $srcdir \n", data_file );
+ H5Fclose(fid);
+ return -1;
+ }
/*
!The first line of the ASCII file contains the dimension of the array :
@@ -608,120 +579,120 @@ static int test_generate(void)
*/
- fscanf( f, "%d %d %d", &imax, &jmax, &kmax );
- fscanf( f, "%f %f %f", &valex, &xmin, &xmax );
-
- data = (float*) malloc ( imax * jmax * kmax * sizeof( float ));
- image_data = (unsigned char*) malloc ( imax * jmax * kmax * sizeof( unsigned char ));
-
- for ( i = 0; i < imax * jmax * kmax; i++ )
- {
- fscanf( f, "%f ", &value );
- data[i] = value;
- }
- fclose( f );
-
-/*-------------------------------------------------------------------------
- * transform the data from floating point to unsigend char
- * we are processing all the data here
- *-------------------------------------------------------------------------
- */
-
- TESTING2("make indexed image from all the data");
-
- for ( i = 0; i < imax * jmax * kmax; i++ )
- {
- image_data[i] = (unsigned char)(( 255 * (data[i] - xmin ) ) / (xmax - xmin ));
- }
-
- /* Make the image */
- if ((H5IMmake_image_8bit(fid,"All data",(hsize_t)imax,(hsize_t)jmax,image_data))<0)
- goto out;
-
- PASSED();
-
-/*-------------------------------------------------------------------------
- * transform the data from floating point to unsigend char
- * here we just process the land data
- *-------------------------------------------------------------------------
- */
-
- TESTING2("make indexed image from land data");
-
- for ( i = 0; i < imax * jmax * kmax; i++ )
- {
- if ( data[i] < 0 )
- image_data[i] = 0;
- else
- image_data[i] = (unsigned char)(( 255 * (data[i] ) ) / xmax );
- }
-
- /* make the image */
- if ((H5IMmake_image_8bit(fid,"Land data",(hsize_t)imax,(hsize_t)jmax,image_data))<0)
- goto out;
-
- PASSED();
-
-/*-------------------------------------------------------------------------
- * transform the data from floating point to unsigend char
- * here we just process the sea data
- *-------------------------------------------------------------------------
- */
-
- TESTING2("make indexed image from sea data");
-
- for ( i = 0; i < imax * jmax * kmax; i++ )
- {
- if ( data[i] > 0 )
- image_data[i] = 0;
- else
- image_data[i] = (unsigned char)(( 255 * (data[i] - xmin ) ) / xmin );
- }
-
- /* make the image */
- if ((H5IMmake_image_8bit(fid,"Sea data",(hsize_t)imax,(hsize_t)jmax,image_data))<0)
- goto out;
-
- PASSED();
-
-/*-------------------------------------------------------------------------
- * make a palette and attach it to the datasets
- *-------------------------------------------------------------------------
- */
-
- TESTING2("attaching palettes");
-
- /* make a palette */
- if ((H5IMmake_palette(fid,PAL1_NAME,pal_dims,pal_rgb))<0)
- goto out;
-
- /* attach the palette to the image datasets */
- if ((H5IMlink_palette(fid,"All data",PAL1_NAME))<0)
- goto out;
- if ((H5IMlink_palette(fid,"Land data",PAL1_NAME))<0)
- goto out;
- if ((H5IMlink_palette(fid,"Sea data",PAL1_NAME))<0)
- goto out;
-
- PASSED();
-
-
-/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if (H5Fclose(fid)<0)
- goto out;
-
- return 0;
-
- /* error zone, gracefully close */
+ fscanf( f, "%d %d %d", &imax, &jmax, &kmax );
+ fscanf( f, "%f %f %f", &valex, &xmin, &xmax );
+
+ data = (float*) malloc ( imax * jmax * kmax * sizeof( float ));
+ image_data = (unsigned char*) malloc ( imax * jmax * kmax * sizeof( unsigned char ));
+
+ for ( i = 0; i < imax * jmax * kmax; i++ )
+ {
+ fscanf( f, "%f ", &value );
+ data[i] = value;
+ }
+ fclose( f );
+
+ /*-------------------------------------------------------------------------
+ * transform the data from floating point to unsigned char
+ * we are processing all the data here
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING2("make indexed image from all the data");
+
+ for ( i = 0; i < imax * jmax * kmax; i++ )
+ {
+ image_data[i] = (unsigned char)(( 255 * (data[i] - xmin ) ) / (xmax - xmin ));
+ }
+
+ /* Make the image */
+ if ((H5IMmake_image_8bit(fid,"All data",(hsize_t)imax,(hsize_t)jmax,image_data))<0)
+ goto out;
+
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * transform the data from floating point to unsigned char
+ * here we just process the land data
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING2("make indexed image from land data");
+
+ for ( i = 0; i < imax * jmax * kmax; i++ )
+ {
+ if ( data[i] < 0 )
+ image_data[i] = 0;
+ else
+ image_data[i] = (unsigned char)(( 255 * (data[i] ) ) / xmax );
+ }
+
+ /* make the image */
+ if ((H5IMmake_image_8bit(fid,"Land data",(hsize_t)imax,(hsize_t)jmax,image_data))<0)
+ goto out;
+
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * transform the data from floating point to unsigned char
+ * here we just process the sea data
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING2("make indexed image from sea data");
+
+ for ( i = 0; i < imax * jmax * kmax; i++ )
+ {
+ if ( data[i] > 0 )
+ image_data[i] = 0;
+ else
+ image_data[i] = (unsigned char)(( 255 * (data[i] - xmin ) ) / xmin );
+ }
+
+ /* make the image */
+ if ((H5IMmake_image_8bit(fid,"Sea data",(hsize_t)imax,(hsize_t)jmax,image_data))<0)
+ goto out;
+
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * make a palette and attach it to the datasets
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING2("attaching palettes");
+
+ /* make a palette */
+ if ((H5IMmake_palette(fid,PAL1_NAME,pal_dims,pal_rgb))<0)
+ goto out;
+
+ /* attach the palette to the image datasets */
+ if ((H5IMlink_palette(fid,"All data",PAL1_NAME))<0)
+ goto out;
+ if ((H5IMlink_palette(fid,"Land data",PAL1_NAME))<0)
+ goto out;
+ if ((H5IMlink_palette(fid,"Sea data",PAL1_NAME))<0)
+ goto out;
+
+ PASSED();
+
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Fclose(fid)<0)
+ goto out;
+
+ return 0;
+
+ /* error zone, gracefully close */
out:
- H5E_BEGIN_TRY {
- H5Fclose(fid);
- } H5E_END_TRY;
- H5_FAILED();
- return FAIL;
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ H5_FAILED();
+ return FAIL;
}
@@ -746,65 +717,65 @@ static int read_data( const char* fname, /*IN*/
hsize_t *width, /*OUT*/
hsize_t *height /*OUT*/ )
{
- int i, n;
- int color_planes;
- char str[20];
- FILE *f;
- int w, h;
- char *srcdir = getenv("srcdir"); /* the source directory */
- char data_file[512]=""; /* buffer to hold name of existing data file */
-
-/*-------------------------------------------------------------------------
- * compose the name of the file to open, using "srcdir", if appropriate
- *-------------------------------------------------------------------------
- */
- strcpy(data_file, "");
- if (srcdir)
- {
- strcpy(data_file, srcdir);
- strcat(data_file, "/");
- }
- strcat(data_file,fname);
-
-/*-------------------------------------------------------------------------
- * read
- *-------------------------------------------------------------------------
- */
-
- f = fopen(data_file, "r");
- if ( f == NULL )
- {
- printf( "Could not open file %s. Try set $srcdir \n", data_file );
- return -1;
- }
-
- fscanf( f, "%s", str );
- fscanf( f, "%d", &color_planes );
- fscanf( f, "%s", str );
- fscanf( f, "%d", &h);
- fscanf( f, "%s", str );
- fscanf( f, "%d", &w);
-
- *width = (hsize_t)w;
- *height = (hsize_t)h;
-
- if ( image_data )
- {
- free( image_data );
- image_data=NULL;
- }
-
- image_data = (unsigned char*) malloc (w * h * color_planes * sizeof( unsigned char ));
-
- for (i = 0; i < h * w * color_planes ; i++)
- {
- fscanf( f, "%d",&n );
- image_data[i] = (unsigned char)n;
- }
- fclose(f);
-
- return 1;
-
+ int i, n;
+ int color_planes;
+ char str[20];
+ FILE *f;
+ int w, h;
+ char *srcdir = getenv("srcdir"); /* the source directory */
+ char data_file[512]=""; /* buffer to hold name of existing data file */
+
+ /*-------------------------------------------------------------------------
+ * compose the name of the file to open, using "srcdir", if appropriate
+ *-------------------------------------------------------------------------
+ */
+ strcpy(data_file, "");
+ if (srcdir)
+ {
+ strcpy(data_file, srcdir);
+ strcat(data_file, "/");
+ }
+ strcat(data_file,fname);
+
+ /*-------------------------------------------------------------------------
+ * read
+ *-------------------------------------------------------------------------
+ */
+
+ f = fopen(data_file, "r");
+ if ( f == NULL )
+ {
+ printf( "Could not open file %s. Try set $srcdir \n", data_file );
+ return -1;
+ }
+
+ fscanf( f, "%s", str );
+ fscanf( f, "%d", &color_planes );
+ fscanf( f, "%s", str );
+ fscanf( f, "%d", &h);
+ fscanf( f, "%s", str );
+ fscanf( f, "%d", &w);
+
+ *width = (hsize_t)w;
+ *height = (hsize_t)h;
+
+ if ( image_data )
+ {
+ free( image_data );
+ image_data=NULL;
+ }
+
+ image_data = (unsigned char*) malloc (w * h * color_planes * sizeof( unsigned char ));
+
+ for (i = 0; i < h * w * color_planes ; i++)
+ {
+ fscanf( f, "%d",&n );
+ image_data[i] = (unsigned char)n;
+ }
+ fclose(f);
+
+ return 1;
+
}
diff --git a/hl/test/test_table.c b/hl/test/test_table.c
index fcc8a7b..f5b73f9 100644
--- a/hl/test/test_table.c
+++ b/hl/test/test_table.c
@@ -48,10 +48,11 @@
*/
#define TITLE "Title"
-#define NFIELDS (hsize_t)5
-#define NRECORDS (hsize_t)8
-#define NRECORDS_ADD (hsize_t)3
+#define NFIELDS 5
+#define NRECORDS 8
+#define NRECORDS_ADD 3
+#define TESTING2(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);}
/*-------------------------------------------------------------------------
* structure used for all tests, a particle with properties
@@ -128,8 +129,7 @@ static int compare_deleted(hsize_t rrecords, hsize_t dstart, hsize_t drecords,
*-------------------------------------------------------------------------
*/
-static int
-test_table(hid_t fid, int do_write)
+int test_table(hid_t fid, int write)
{
/* identifiers */
hid_t fid1;
@@ -142,7 +142,12 @@ test_table(hid_t fid, int do_write)
hsize_t position;
char tname[20];
+ /* indices */
+ int i, j;
+
/* write, read, append, delete, insert some records and fields */
+ hsize_t FIELDS = NFIELDS;
+ hsize_t RECORDS = NRECORDS;
hsize_t start;
hsize_t wstart;
hsize_t rstart;
@@ -156,8 +161,6 @@ test_table(hid_t fid, int do_write)
hsize_t drecords;
hsize_t nfields;
hsize_t rfields;
- hsize_t i, j;
- size_t u;
hsize_t start1; /* record to start reading from 1st table */
hsize_t start2; /* record to start writing in 2nd table */
@@ -324,7 +327,7 @@ test_table(hid_t fid, int do_write)
{ "Name","Longitude","Pressure","Temperature","Latitude" };
hid_t field_type[NFIELDS];
hid_t string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, (size_t)16 );
+ H5Tset_size( string_type, 16 );
field_type[0] = string_type;
field_type[1] = H5T_NATIVE_LONG;
field_type[2] = H5T_NATIVE_FLOAT;
@@ -340,11 +343,11 @@ test_table(hid_t fid, int do_write)
*
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
TESTING2("making table");
- if (H5TBmake_table(TITLE,fid,"table1",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table1",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,wbuf)<0)
goto out;
@@ -380,12 +383,12 @@ test_table(hid_t fid, int do_write)
*
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
TESTING2("writing records");
/* create an empty table */
- if (H5TBmake_table(TITLE,fid,"table2",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table2",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,0)<0)
goto out;
@@ -438,7 +441,7 @@ test_table(hid_t fid, int do_write)
* we use the original "table1" instead
*-------------------------------------------------------------------------
*/
- if(do_write)
+ if(write)
strcpy(tname,"table2");
else
strcpy(tname,"table1");
@@ -449,7 +452,7 @@ test_table(hid_t fid, int do_write)
goto out;
/* compare */
- for( i=rstart; i<rrecords; i++)
+ for( i=(int)rstart; i<(int)rrecords; i++)
{
if (cmp_par(i,i,rbuf,wbuf)<0)
goto out;
@@ -465,7 +468,7 @@ test_table(hid_t fid, int do_write)
*
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
TESTING2("appending records");
@@ -489,12 +492,12 @@ test_table(hid_t fid, int do_write)
/* compare */
wrecords=8;
- for( i=rstart; i<wrecords; i++)
+ for( i=(int)rstart; i<(int)wrecords; i++)
{
if (cmp_par(i,i,rbuf,wbuf)<0)
goto out;
}
- for( i=wrecords, j=0; i<rrecords; i++,j++)
+ for( i=(int)wrecords, j=0; i<(int)rrecords; i++,j++)
{
if (cmp_par(i,j,rbuf,abuf)<0)
goto out;
@@ -511,7 +514,7 @@ test_table(hid_t fid, int do_write)
*
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
TESTING2("inserting records");
@@ -540,15 +543,15 @@ test_table(hid_t fid, int do_write)
if (cmp_par(i,i,rbuf,wbuf)<0)
goto out;
}
- else if (i>=istart && i<istart+irecords)
+ else if (i>=(int)istart && i<(int)istart+(int)irecords)
{
- j=i-istart;
+ j=i-(int)istart;
if (cmp_par(i,j,rbuf,ibuf)<0)
goto out;
}
- else if (i>=istart+irecords && i<10)
+ else if (i>=(int)istart+(int)irecords && i<10)
{
- j=i-irecords;
+ j=i-(int)irecords;
if (cmp_par(i,j,rbuf,wbuf)<0)
goto out;
}
@@ -571,7 +574,7 @@ test_table(hid_t fid, int do_write)
*
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
TESTING2("deleting records");
@@ -581,10 +584,19 @@ test_table(hid_t fid, int do_write)
* data= 0 1 2 3 4 5 6 7
*-------------------------------------------------------------------------
*/
- for( u=0; u<(size_t)NRECORDS; u++)
- wbufd[u] = wbuf[u];
- if (H5TBmake_table(TITLE,fid,"table3",NFIELDS,NRECORDS,type_size_mem,
+ for( i=0; i<NRECORDS; i++)
+ {
+ wbufd[i].lati = wbuf[i].lati;
+ wbufd[i].longi = wbuf[i].longi;
+ wbufd[i].pressure = wbuf[i].pressure;
+ wbufd[i].temperature = wbuf[i].temperature;
+ strcpy(wbufd[i].name, wbuf[i].name );
+
+ }
+
+
+ if (H5TBmake_table(TITLE,fid,"table3",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,wbufd)<0)
goto out;
@@ -618,8 +630,8 @@ test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
nrecords=rrecords;
- for( u=0; u<(size_t)nrecords; u++)
- wbufd[u] = rbuf[u];
+ for( i=0; i<nrecords; i++)
+ wbufd[i] = rbuf[i];
/*-------------------------------------------------------------------------
* Delete records, start at 0, delete 2
@@ -649,8 +661,8 @@ test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
nrecords=rrecords;
- for( u=0; u<(size_t)nrecords; u++)
- wbufd[u] = rbuf[u];
+ for( i=0; i<nrecords; i++)
+ wbufd[i] = rbuf[i];
/*-------------------------------------------------------------------------
* Delete records, start at 1, delete 1
@@ -680,8 +692,8 @@ test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
nrecords=rrecords;
- for( u=0; u<(size_t)nrecords; u++)
- wbufd[u] = rbuf[u];
+ for( i=0; i<nrecords; i++)
+ wbufd[i] = rbuf[i];
/*-------------------------------------------------------------------------
* Delete records, start at 0, delete 1
@@ -711,8 +723,8 @@ test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
nrecords=rrecords;
- for( u=0; u<(size_t)nrecords; u++)
- wbufd[u] = rbuf[u];
+ for( i=0; i<nrecords; i++)
+ wbufd[i] = rbuf[i];
/* Read complete table */
if (H5TBread_table(fid,"table3",type_size_mem,field_offset,field_size,rbuf)<0)
@@ -738,16 +750,16 @@ test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
TESTING2("adding records");
/* create 2 tables */
- if (H5TBmake_table(TITLE,fid,"table4",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table4",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,wbuf)<0)
goto out;
- if (H5TBmake_table(TITLE,fid,"table5",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table5",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,wbuf)<0)
goto out;
@@ -771,15 +783,15 @@ test_table(hid_t fid, int do_write)
if (cmp_par(i,i,rbuf,wbuf)<0)
goto out;
}
- else if ( i < start2+nrecords )
+ else if ( i < (int)start2+(int)nrecords )
{
- j = i-start1;
+ j = i-(int)start1;
if (cmp_par(i,j,rbuf,wbuf)<0)
goto out;
}
else
{
- j = i-nrecords;
+ j = i-(int)nrecords;
if (cmp_par(i,j,rbuf,wbuf)<0)
goto out;
}
@@ -798,16 +810,16 @@ test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
TESTING2("combining tables");
/* create 2 tables */
- if (H5TBmake_table(TITLE,fid,"table6",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table6",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,wbuf)<0)
goto out;
- if (H5TBmake_table(TITLE,fid,"table7",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table7",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,wbuf)<0)
goto out;
@@ -845,11 +857,11 @@ test_table(hid_t fid, int do_write)
fid2 = H5Fcreate("combine_tables2.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);
/* create 2 tables, one in each file */
- if (H5TBmake_table(TITLE,fid1,"table1",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid1,"table1",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,wbuf)<0)
goto out;
- if (H5TBmake_table(TITLE,fid2,"table2",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid2,"table2",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,wbuf)<0)
goto out;
@@ -893,12 +905,12 @@ test_table(hid_t fid, int do_write)
*
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
TESTING2("writing fields by name");
/* make an empty table with fill values */
- if (H5TBmake_table(TITLE,fid,"table9",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table9",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill1,compress,0)<0)
goto out;
@@ -912,7 +924,7 @@ test_table(hid_t fid, int do_write)
/* write the new longitude and latitude information starting at record 2 */
start = 2;
- nrecords = NRECORDS_ADD;
+ nrecords = 3;
if (H5TBwrite_fields_name(fid,"table9","Latitude,Longitude",start,nrecords,sizeof(position_t),
field_offset_pos,field_sizes_pos,position_in)<0)
goto out;
@@ -923,23 +935,29 @@ test_table(hid_t fid, int do_write)
if (H5TBread_table(fid,"table9",type_size_mem,field_offset,field_size,rbuf)<0)
goto out;
- /* compare the read values with the initial values */
- for( u = 0; u < (size_t)NRECORDS; u++ )
- {
- if ( u >= 2 && u <= 4 )
{
- if ( rbuf[u].lati != position_in[u-(size_t)NRECORDS_ADD+1].lati ||
- rbuf[u].longi != position_in[u-(size_t)NRECORDS_ADD+1].longi ||
- rbuf[u].pressure != pressure_in[u-(size_t)NRECORDS_ADD+1] )
+
+
+ /* compare the read values with the initial values */
+ for( i = 0; i < NRECORDS; i++ )
+ {
+ if ( i >= 2 && i <= 4 )
{
- fprintf(stderr,"%ld %f %d\n",
- rbuf[u].longi,rbuf[u].pressure,rbuf[u].lati);
- fprintf(stderr,"%ld %f %d\n",
- position_in[u].longi,pressure_in[u],position_in[u].lati);
+ if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati ||
+ rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi ||
+ rbuf[i].pressure != pressure_in[i-NRECORDS_ADD+1] )
+ {
+ fprintf(stderr,"%ld %f %d\n",
+ rbuf[i].longi,rbuf[i].pressure,rbuf[i].lati);
+ fprintf(stderr,"%ld %f %d\n",
+ position_in[i].longi,pressure_in[i],position_in[i].lati);
goto out;
+ }
}
+ }
}
- }
+
+
PASSED();
} /*write*/
@@ -958,16 +976,16 @@ test_table(hid_t fid, int do_write)
* write and read the "Pressure" field
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
- if (H5TBmake_table(TITLE,fid,"table10",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table10",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill1,compress,0)<0)
goto out;
/* write the pressure field to all the records */
start = 0;
- nrecords = NRECORDS_ADD;
+ nrecords = NRECORDS;
if ( H5TBwrite_fields_name(fid,"table10","Pressure",start,nrecords,
sizeof( float ),0,field_sizes_pre,pressure_in)<0)
goto out;
@@ -975,15 +993,16 @@ test_table(hid_t fid, int do_write)
/* read the "Pressure" field */
start = 0;
- nrecords = NRECORDS_ADD;
+ nrecords = NRECORDS;
if ( H5TBread_fields_name(fid,"table10","Pressure",start,nrecords,
sizeof(float),0,field_sizes_pre,pressure_out)<0)
goto out;
+
/* Compare the extracted table with the initial values */
- for( u = 0; u < (size_t)NRECORDS_ADD; u++ )
+ for( i = 0; i < NRECORDS; i++ )
{
- if ( pressure_out[u] != pressure_in[u] ) {
+ if ( pressure_out[i] != pressure_in[i] ) {
goto out;
}
}
@@ -992,7 +1011,7 @@ test_table(hid_t fid, int do_write)
* Write and read the "Latitude,Longitude" fields
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
/* Write the new longitude and latitude information to all the records */
start = 0;
@@ -1009,11 +1028,12 @@ test_table(hid_t fid, int do_write)
start, nrecords, sizeof(position_t), field_offset_pos, field_sizes_pos, position_out ) < 0 )
goto out;
+
/* Compare the extracted table with the initial values */
- for( u = 0; u < (size_t)NRECORDS_ADD; u++ )
+ for( i = 0; i < NRECORDS_ADD; i++ )
{
- if ( position_out[u].lati != position_in[u].lati ||
- position_out[u].longi != position_in[u].longi )
+ if ( position_out[i].lati != position_in[i].lati ||
+ position_out[i].longi != position_in[i].longi )
goto out;
}
@@ -1022,7 +1042,7 @@ test_table(hid_t fid, int do_write)
* Write and read the "Name,Pressure" fields
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
/* Write the new name and pressure information to all the records */
start = 0;
@@ -1040,19 +1060,21 @@ test_table(hid_t fid, int do_write)
namepre_out ) < 0 )
goto out;
+
/* Compare the extracted table with the initial values */
- for( u = 0; u < (size_t)NRECORDS; u++ )
+ for( i = 0; i < NRECORDS; i++ )
{
- if ( ( strcmp( namepre_out[u].name, namepre_in[u].name ) != 0 ) ||
- namepre_out[u].pressure != namepre_in[u].pressure ) {
+ if ( ( strcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) ||
+ namepre_out[i].pressure != namepre_in[i].pressure ) {
goto out;
}
}
+
/* reset buffer */
- for( u = 0; u < (size_t)NRECORDS; u++ )
+ for( i = 0; i < NRECORDS; i++ )
{
- strcpy( namepre_out[u].name, "\0" );
- namepre_out[u].pressure = -1;
+ strcpy( namepre_out[i].name, "\0" );
+ namepre_out[i].pressure = -1;
}
/*-------------------------------------------------------------------------
@@ -1066,14 +1088,19 @@ test_table(hid_t fid, int do_write)
field_sizes_namepre, namepre_out ) < 0 )
goto out;
+
/* Compare the extracted table with the initial values */
- for( u = 0; u < 3; u++ )
+ for( i = 0; i < 3; i++ )
{
- if ( ( strcmp( namepre_out[u].name, namepre_in[(size_t)start+u].name ) != 0 ) ||
- namepre_out[u].pressure != namepre_in[(size_t)start+u].pressure ) {
+ int iistart = (int) start;
+ if ( ( strcmp( namepre_out[i].name, namepre_in[iistart+i].name ) != 0 ) ||
+ namepre_out[i].pressure != namepre_in[iistart+i].pressure ) {
goto out;
}
}
+
+
+
PASSED();
/*-------------------------------------------------------------------------
@@ -1084,12 +1111,12 @@ test_table(hid_t fid, int do_write)
*
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
TESTING2("writing fields by index");
/* make an empty table */
- if (H5TBmake_table(TITLE,fid,"table11",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table11",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,NULL)<0)
goto out;
@@ -1120,13 +1147,13 @@ test_table(hid_t fid, int do_write)
goto out;
/* Compare the extracted table with the initial values */
- for( u = 0; u < (size_t)NRECORDS; u++ )
+ for( i = 0; i < NRECORDS; i++ )
{
- if ( u >= 2 && u <= 4 )
+ if ( i >= 2 && i <= 4 )
{
- if ( rbuf[u].lati != position_in[u-(size_t)NRECORDS_ADD+1].lati ||
- rbuf[u].longi != position_in[u-(size_t)NRECORDS_ADD+1].longi ||
- rbuf[u].pressure != pressure_in[u-(size_t)NRECORDS_ADD+1] )
+ if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati ||
+ rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi ||
+ rbuf[i].pressure != pressure_in[i-NRECORDS_ADD+1] )
goto out;
}
}
@@ -1146,10 +1173,10 @@ test_table(hid_t fid, int do_write)
TESTING2("reading fields by index");
- if (do_write)
+ if (write)
{
/* make an empty table */
- if (H5TBmake_table(TITLE,fid,"table12",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table12",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,NULL)<0)
goto out;
@@ -1177,9 +1204,9 @@ test_table(hid_t fid, int do_write)
goto out;
/* compare the extracted table with the initial values */
- for( u = 0; u < (size_t)NRECORDS; u++ )
+ for( i = 0; i < NRECORDS; i++ )
{
- if ( pressure_out[u] != pressure_in[u] ) {
+ if ( pressure_out[i] != pressure_in[i] ) {
goto out;
}
}
@@ -1188,7 +1215,7 @@ test_table(hid_t fid, int do_write)
* write and read the "Latitude,Longitude" fields
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
/* write the new longitude and latitude information to all the records */
nfields = 2;
@@ -1208,10 +1235,10 @@ test_table(hid_t fid, int do_write)
goto out;
/* compare the extracted table with the initial values */
- for( u = 0; u < (size_t)NRECORDS_ADD; u++ )
+ for( i = 0; i < NRECORDS_ADD; i++ )
{
- if ( position_out[u].lati != position_in[u].lati ||
- position_out[u].longi != position_in[u].longi ) {
+ if ( position_out[i].lati != position_in[i].lati ||
+ position_out[i].longi != position_in[i].longi ) {
goto out;
}
}
@@ -1221,7 +1248,7 @@ test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
/* write the new name and pressure information to all the records */
nfields = 2;
@@ -1242,19 +1269,19 @@ test_table(hid_t fid, int do_write)
goto out;
/* compare the extracted table with the initial values */
- for( u = 0; u < (size_t)NRECORDS; u++ )
+ for( i = 0; i < NRECORDS; i++ )
{
- if ( ( strcmp( namepre_out[u].name, namepre_in[u].name ) != 0 ) ||
- namepre_out[u].pressure != namepre_in[u].pressure ) {
+ if ( ( strcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) ||
+ namepre_out[i].pressure != namepre_in[i].pressure ) {
goto out;
}
}
/* reset buffer */
- for( u = 0; u < (size_t)NRECORDS; u++ )
+ for( i = 0; i < NRECORDS; i++ )
{
- strcpy( namepre_out[u].name, "\0" );
- namepre_out[u].pressure = -1;
+ strcpy( namepre_out[i].name, "\0" );
+ namepre_out[i].pressure = -1;
}
/*-------------------------------------------------------------------------
@@ -1272,10 +1299,11 @@ test_table(hid_t fid, int do_write)
goto out;
/* compare the extracted table with the initial values */
- for( u = 0; u < 3; u++ )
+ for( i = 0; i < 3; i++ )
{
- if ( ( strcmp( namepre_out[u].name, wbuf[(size_t)start+u].name ) != 0 ) ||
- namepre_out[u].pressure != wbuf[(size_t)start+u].pressure ) {
+ int iistart = (int) start;
+ if ( ( strcmp( namepre_out[i].name, wbuf[iistart+i].name ) != 0 ) ||
+ namepre_out[i].pressure != wbuf[iistart+i].pressure ) {
goto out;
}
}
@@ -1292,12 +1320,12 @@ test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
TESTING2("inserting fields");
/* make a table */
- if (H5TBmake_table(TITLE,fid,"table13",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table13",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill1,compress,wbuf)<0)
goto out;
@@ -1313,14 +1341,14 @@ test_table(hid_t fid, int do_write)
goto out;
/* compare the extracted table with the original array */
- for( u = 0; u < (size_t)NRECORDS; u++ )
+ for( i = 0; i < NRECORDS; i++ )
{
- if ( ( strcmp( rbuf2[u].name, wbuf[u].name ) != 0 ) ||
- rbuf2[u].lati != wbuf[u].lati ||
- rbuf2[u].longi != wbuf[u].longi ||
- rbuf2[u].pressure != wbuf[u].pressure ||
- rbuf2[u].temperature != wbuf[u].temperature ||
- rbuf2[u].new_field != buf_new[u] ) {
+ if ( ( strcmp( rbuf2[i].name, wbuf[i].name ) != 0 ) ||
+ rbuf2[i].lati != wbuf[i].lati ||
+ rbuf2[i].longi != wbuf[i].longi ||
+ rbuf2[i].pressure != wbuf[i].pressure ||
+ rbuf2[i].temperature != wbuf[i].temperature ||
+ rbuf2[i].new_field != buf_new[i] ) {
goto out;
}
}
@@ -1336,12 +1364,12 @@ test_table(hid_t fid, int do_write)
*
*-------------------------------------------------------------------------
*/
- if (do_write)
+ if (write)
{
TESTING2("deleting fields");
/* make a table */
- if (H5TBmake_table(TITLE,fid,"table14",NFIELDS,NRECORDS,type_size_mem,
+ if (H5TBmake_table(TITLE,fid,"table14",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
chunk_size,fill,compress,wbuf)<0)
goto out;
@@ -1356,12 +1384,12 @@ test_table(hid_t fid, int do_write)
goto out;
/* compare the extracted table with the original array */
- for( u = 0; u < (size_t)NRECORDS; u++ )
+ for( i = 0; i < NRECORDS; i++ )
{
- if ( ( strcmp( rbuf3[u].name, wbuf[u].name ) != 0 ) ||
- rbuf3[u].lati != wbuf[u].lati ||
- rbuf3[u].longi != wbuf[u].longi ||
- rbuf3[u].temperature != wbuf[u].temperature ) {
+ if ( ( strcmp( rbuf3[i].name, wbuf[i].name ) != 0 ) ||
+ rbuf3[i].lati != wbuf[i].lati ||
+ rbuf3[i].longi != wbuf[i].longi ||
+ rbuf3[i].temperature != wbuf[i].temperature ) {
goto out;
}
}
@@ -1404,26 +1432,26 @@ test_table(hid_t fid, int do_write)
/* alocate */
names_out = malloc( sizeof(char*) * (size_t)NFIELDS );
- for ( u = 0; u < (size_t)NFIELDS; u++)
+ for ( i = 0; i < NFIELDS; i++)
{
- names_out[u] = malloc( sizeof(char) * 255 );
+ names_out[i] = malloc( sizeof(char) * 255 );
}
/* Get field info */
if ( H5TBget_field_info(fid, "table1", names_out, sizes_out, offset_out, &size_out ) < 0 )
goto out;
- for ( u = 0; u < (size_t)NFIELDS; u++)
+ for ( i = 0; i < NFIELDS; i++)
{
- if ( (strcmp( field_names[u], names_out[u] ) != 0)) {
+ if ( (strcmp( field_names[i], names_out[i] ) != 0)) {
goto out;
}
}
/* release */
- for ( u = 0; u < (size_t)NFIELDS; u++)
+ for ( i = 0; i < NFIELDS; i++)
{
- free ( names_out[u] );
+ free ( names_out[i] );
}
free ( names_out );
@@ -1550,9 +1578,8 @@ static hid_t h5file_open(const char *fname, unsigned flags)
* function that compares one particle
*-------------------------------------------------------------------------
*/
-static int cmp_par(hsize_t _i, hsize_t _j, particle_t *rbuf, particle_t *wbuf )
+static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf )
{
- size_t i = (size_t)_i, j = (size_t)_j;
if ( ( strcmp( rbuf[i].name, wbuf[j].name ) != 0 ) ||
rbuf[i].lati != wbuf[j].lati ||
rbuf[i].longi != wbuf[j].longi ||
@@ -1593,4 +1620,3 @@ static int compare_deleted(hsize_t rrecords, hsize_t dstart, hsize_t drecords,
return 0;
}
-
diff --git a/hl/tools/gif2h5/Makefile.am b/hl/tools/gif2h5/Makefile.am
index a17c6ca..f4a1558 100644
--- a/hl/tools/gif2h5/Makefile.am
+++ b/hl/tools/gif2h5/Makefile.am
@@ -25,11 +25,14 @@ INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src
# These are our main targets, the tools
+TEST_SCRIPT=$(srcdir)/h52giftest.sh
+check_SCRIPTS=$(TEST_SCRIPT)
+
bin_PROGRAMS=gif2h5 h52gif h52gifgentst
gif2h5_SOURCES=gif2hdf.c gif2mem.c decompress.c gifread.c writehdf.c
-h52gif_SOURCES=hdf2gif.c hdfgifwr.c readhdf.c
+h52gif_SOURCES=hdf2gif.c hdfgifwr.c
h52gifgentst_SOURCES=h52gifgentst.c
diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in
index 41b7611..df2fd5c 100644
--- a/hl/tools/gif2h5/Makefile.in
+++ b/hl/tools/gif2h5/Makefile.in
@@ -77,8 +77,7 @@ am__DEPENDENCIES_2 = $(top_builddir)/tools/lib/libh5tools.la
am__DEPENDENCIES_3 = $(top_builddir)/src/libhdf5.la
gif2h5_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
$(am__DEPENDENCIES_3)
-am_h52gif_OBJECTS = hdf2gif.$(OBJEXT) hdfgifwr.$(OBJEXT) \
- readhdf.$(OBJEXT)
+am_h52gif_OBJECTS = hdf2gif.$(OBJEXT) hdfgifwr.$(OBJEXT)
h52gif_OBJECTS = $(am_h52gif_OBJECTS)
h52gif_LDADD = $(LDADD)
h52gif_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
@@ -344,8 +343,12 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# 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, the tools
+TEST_SCRIPT = $(srcdir)/h52giftest.sh
+check_SCRIPTS = $(TEST_SCRIPT)
gif2h5_SOURCES = gif2hdf.c gif2mem.c decompress.c gifread.c writehdf.c
-h52gif_SOURCES = hdf2gif.c hdfgifwr.c readhdf.c
+h52gif_SOURCES = hdf2gif.c hdfgifwr.c
h52gifgentst_SOURCES = h52gifgentst.c
# Programs all depend on the hdf5 library, the tools library, and the HL
@@ -452,7 +455,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h52gifgentst.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hdf2gif.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hdfgifwr.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readhdf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/writehdf.Po@am__quote@
.c.o:
@@ -563,6 +565,7 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile $(PROGRAMS) all-local
diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c
index e8c49ba..b019ab4 100644
--- a/hl/tools/gif2h5/h52gifgentst.c
+++ b/hl/tools/gif2h5/h52gifgentst.c
@@ -36,7 +36,7 @@
#define WIDTH (hsize_t)400
#define HEIGHT (hsize_t)200
#define PAL_ENTRIES 256
-#define IMAGE1_NAME "12345678"
+#define IMAGE1_NAME "image"
#define PAL_NAME "palette"
/*-------------------------------------------------------------------------
@@ -102,3 +102,4 @@ int main(void)
return 0;
}
+
diff --git a/hl/tools/gif2h5/h52giftest.sh b/hl/tools/gif2h5/h52giftest.sh
index 1300f03..80f6910 100644
--- a/hl/tools/gif2h5/h52giftest.sh
+++ b/hl/tools/gif2h5/h52giftest.sh
@@ -15,6 +15,7 @@
#
# HDF Utilities Test script
+
TESTFILE1="$srcdir/../testfiles/h52giftst.h5"
TESTFILE2="$srcdir/../testfiles/image1.gif"
@@ -26,36 +27,39 @@ TESTING() {
echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
}
+
+
TOOLTEST1()
{
-err=0
-$RUNSERIAL ./h52gif $*
-
-if [ $err -eq 1 ]; then
-errors="` expr $errors + 1 `";
+ $RUNSERIAL ./h52gif $*
+
+ RET=$?
+ if [ $RET != 0 ] ; then
echo "*FAILED*"
-else
+ errors="` expr $errors + 1 `";
+ else
echo " PASSED"
-fi
+ fi
+
}
TOOLTEST2()
{
-err=0
-$RUNSERIAL ./gif2h5 $*
-
-if [ $err -eq 1 ]; then
-errors="` expr $errors + 1 `";
+ $RUNSERIAL ./gif2h5 $*
+
+ RET=$?
+ if [ $RET != 0 ] ; then
echo "*FAILED*"
-else
+ errors="` expr $errors + 1 `";
+ else
echo " PASSED"
-fi
+ fi
}
-TESTING "./h52gif h52giftst.h5 image1.gif -i 12345678 -p palette"
-TOOLTEST1 $TESTFILE1 image1.gif -i 12345678 -p palette
+TESTING "./h52gif h52giftst.h5 image1.gif -i image"
+TOOLTEST1 $TESTFILE1 image1.gif -i image
TESTING "./gif2h5 image1.gif image1.h5"
TOOLTEST2 $TESTFILE2 image1.h5
diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c
index 8f06bd2..9ac0eb7 100644
--- a/hl/tools/gif2h5/hdf2gif.c
+++ b/hl/tools/gif2h5/hdf2gif.c
@@ -28,6 +28,8 @@
#include <stdio.h>
#include <assert.h>
#include "gif.h"
+#include "H5IMpublic.h"
+
#define MAX_FILE_LEN 256
#define MAX_NUMBER_IMAGES 50
@@ -56,27 +58,21 @@ putword(int w, FILE *fp)
static void
usage(void)
{
- printf("Usage: h52gif <h5_file> <gif_file> -i <h5_image> [-p <h5_palette>]\n");
+ printf("Usage: h52gif <h5_file> <gif_file> -i <h5_image>\n");
printf("h52gif expects *at least* one h5_image.\n");
- printf("You may repeat -i <h5_image> [-p <h5_palette>] at most 50 times\n");
+ printf("You may repeat -i <h5_image> at most 50 times\n");
printf("(maximum of 50 images).\n");
}
FILE *fpGif = NULL;
int main(int argc , char **argv)
{
-
-
- hsize_t dim_sizes[2];
BYTE *Image;
/* compression structs */
CHAR *HDFName = NULL;
CHAR *GIFName = NULL;
- /* reference variables */
- int has_local_palette; /* treated as a flag */
-
BYTE* b;
BYTE GlobalPalette[256][3];
@@ -85,16 +81,10 @@ int main(int argc , char **argv)
BYTE Blue[256];
int RWidth, RHeight;
-#ifdef UNUSED
- int LeftOfs, TopOfs;
- int CountDown;
- int curx , cury;
- int w,h;
-#endif /* UNUSED */
int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
int j,nc;
int i;
- int numcols = 256;
+ int numcols;
int time_out = 0; /* time between two images in the animation */
int n_images , idx;
@@ -104,128 +94,125 @@ int main(int argc , char **argv)
int number_of_images = 0;
int arg_index = 2;
int bool_is_image = 0; /* 0 = false , 1 = true */
- int bool_is_palette = 0;
CHAR* image_name_arr[MAX_NUMBER_IMAGES];
- CHAR* pal_name_arr[MAX_NUMBER_IMAGES];
- if (argc < 5) {
+ if (argc < 4)
+ {
/* they didn't supply at least one image -- bail */
usage();
- return 0;
+ return 1;
}
memset(image_name_arr , 0 , MAX_NUMBER_IMAGES);
- memset(pal_name_arr , 0 , MAX_NUMBER_IMAGES);
- HDFName = (CHAR *)malloc (strlen(argv[1]) + 1);
- GIFName = (CHAR *)malloc (strlen(argv[2]) + 1);
-
- if (strlen(argv[1] + 1) > MAX_FILE_LEN || strlen(argv[2] + 1) > MAX_FILE_LEN) {
+ if (strlen(argv[1] + 1) > MAX_FILE_LEN || strlen(argv[2] + 1) > MAX_FILE_LEN)
+ {
/* supplied file names are too long. bail. */
usage();
printf("Supplied filenames exceed maximum length of 256 bytes\n");
}
- strcpy(HDFName , argv[1]);
- strcpy(GIFName , argv[2]);
+ HDFName = argv[1];
+ GIFName = argv[2];
/* get the options */
- while (arg_index++ < argc - 1 && number_of_images < MAX_NUMBER_IMAGES) {
+ while (arg_index++ < argc - 1 && number_of_images < MAX_NUMBER_IMAGES)
+ {
if (!strcmp(argv[arg_index] , "-i")) {
bool_is_image = 1;
continue;
}
- if (!strcmp(argv[arg_index] , "-p")) {
- bool_is_palette = 1;
- continue;
- }
-
if (!strcmp(argv[arg_index] , "-a")) {
time_out = 10;
continue;
}
- if (bool_is_image) {
+ if (bool_is_image)
+ {
/* this is an image */
/* allocate space to store the image name */
size_t len = strlen(argv[arg_index]);
image_name_arr[number_of_images] = (CHAR*) malloc( len + 1);
strcpy(image_name_arr[number_of_images] , argv[arg_index]);
- /* make the palette array for this NULL */
- pal_name_arr[number_of_images] = NULL;
number_of_images++;
bool_is_image = 0;
continue;
}
- if (bool_is_palette) {
- /* this is a palette */
- /* allocate space to store the pal name */
- /* the palette was probably allocated for a previous image */
- size_t len = strlen(argv[arg_index]);
- pal_name_arr[number_of_images-1] = (CHAR*) malloc( len + 1);
- strcpy(pal_name_arr[number_of_images - 1], argv[arg_index]);
- bool_is_palette = 0;
- continue;
- }
-
/* oops. This was not meant to happen */
usage();
- while (number_of_images--) {
- cleanup(image_name_arr[number_of_images]);
- cleanup(pal_name_arr[number_of_images]);
- }
-
- return -1;
+ goto out;
}
- /* we shall always have a palette - read hdf will see to that */
- has_local_palette = true;
-
- /* Do Endian Order testing and set Endian Order */
+ /* Do Endian Order testing and set Endian Order */
idx = 0x0001;
b = (BYTE *) &idx;
EndianOrder = (b[0] ? 1:0);
- if (!(fpGif = fopen(GIFName , "wb"))) {
+ if (!(fpGif = fopen(GIFName , "wb")))
+ {
printf("Error opening gif file for output. Aborting.\n");
- return -1;
+ goto out;
}
/* hardwire n_images to 1 for now. */
n_images = number_of_images;
Background = 0;
- for (idx = 0 ; idx < n_images ; idx++) {
- /* try to read the image and the palette */
-
- /*
- * Lots of funky stuff to support multiple images has been taken off.
- * Just in case you're extending code, here's what you need to do in
- * short: figure out if there is a global palette or not, if there is
- * one store that one only. If they are all local or a combination of
- * local and global palettes, you will have to write the global
- * palette out and then independantly write the smaller local palettes
- */
- if (ReadHDF(&Image, GlobalPalette, dim_sizes, HDFName,
- image_name_arr[idx], pal_name_arr[idx]) < 0) {
- fprintf(stderr , "Unable to read image %s from HDF file %s\n",image_name_arr[idx],HDFName);
- return -1;
+ for (idx = 0 ; idx < n_images ; idx++)
+ {
+
+ hsize_t width, height, planes;
+ hid_t fid;
+ char interlace[20];
+ hssize_t npals;
+ hsize_t pal_dims[2];
+ unsigned char *pal;
+ char *image_name = image_name_arr[idx];
+
+ if ((fid = H5Fopen(HDFName , H5F_ACC_RDONLY , H5P_DEFAULT)) < 0) {
+ fprintf(stderr , "Unable to open HDF file for input. Aborting.\n");
+ goto out;
}
+
+ /* read image */
+ if ( H5IMget_image_info( fid, image_name, &width, &height, &planes, interlace, &npals ) < 0 )
+ goto out;
+
+ Image = (BYTE*) malloc( (size_t) width * (size_t) height );
+
+ if ( H5IMread_image( fid, image_name, Image ) < 0 )
+ goto out;
+
+ if (npals)
+ {
+ if ( H5IMget_palette_info( fid, image_name, 0, pal_dims ) < 0 )
+ goto out;
+
+ pal = (BYTE*) malloc( (size_t) pal_dims[0] * (size_t) pal_dims[1] );
+
+ if ( H5IMget_palette( fid, image_name, 0, pal ) < 0 )
+ goto out;
+
+ numcols = (int) pal_dims[0];
+
+ for (i = 0, j = 0 ; i < numcols ; j+=3, i++)
+ {
+ GlobalPalette[i][0] = pal[j];
+ GlobalPalette[i][1] = pal[j+1];
+ GlobalPalette[i][2] = pal[j+2];
+ }
- assert(dim_sizes[0]==(hsize_t)((int)dim_sizes[0]));
- assert(dim_sizes[1]==(hsize_t)((int)dim_sizes[1]));
- RWidth = (int)dim_sizes[1];
- RHeight = (int)dim_sizes[0];
-#ifdef UNUSED
- w = dim_sizes[1];
- h = dim_sizes[0];
-
- LeftOfs = TopOfs = 0;
-#endif /* UNUSED */
+ free(pal);
+ }
+
+ H5Fclose(fid);
+
+ RWidth = (int)width;
+ RHeight = (int)height;
/*
@@ -237,48 +224,61 @@ int main(int argc , char **argv)
* palette
* 2. Check for palettes in any of the other images.
*/
- if (!has_local_palette) {
- for (i = 0 ; i < 256 ; i++) {
+ if (!npals)
+ {
+ numcols = 256;
+ for (i = 0 ; i < numcols ; i++)
+ {
Red[i] = 255 - i;
Green[i] = 255 - i;
Blue[i] = 255 - i;
}
- } else {
- for (i = 0 ; i < 256 ; i++){
+ }
+ else
+ {
+ for (i = 0 ; i < numcols ; i++)
+ {
Red[i] = GlobalPalette[i][0];
Green[i] = GlobalPalette[i][1];
Blue[i] = GlobalPalette[i][2];
}
}
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < numcols; i++)
+ {
pc2nc[i] = r1[i] = g1[i] = b1[i] = 0;
}
/* compute number of unique colors */
nc = 0;
- for (i = 0; i < numcols; i++) {
+ for (i = 0; i < numcols; i++)
+ {
/* see if color #i is already used */
- for (j = 0; j < i; j++) {
+ for (j = 0; j < i; j++)
+ {
if (Red[i] == Red[j] && Green[i] == Green[j] && Blue[i] == Blue[j])
break;
}
-
- if (j==i) {
+
+ if (j==i)
+ {
/* wasn't found */
pc2nc[i] = nc;
r1[nc] = Red[i];
g1[nc] = Green[i];
b1[nc] = Blue[i];
nc++;
- } else {
+ }
+ else
+ {
pc2nc[i] = pc2nc[j];
}
}
/* figure out 'BitsPerPixel' */
- for (i = 1; i < 8; i++) {
+ for (i = 1; i < 8; i++)
+ {
if ((1<<i) >= nc)
break;
}
@@ -286,33 +286,30 @@ int main(int argc , char **argv)
BitsPerPixel = i;
ColorMapSize = 1 << BitsPerPixel;
-#ifdef UNUSED
- CountDown = w * h; /* # of pixels we'll be doing */
-#endif /* UNUSED */
-
if (BitsPerPixel <= 1)
InitCodeSize = 2;
else
InitCodeSize = BitsPerPixel;
-#ifdef UNUSED
- curx = cury = 0;
-#endif /* UNUSED */
-
- if (!fpGif) {
+ if (!fpGif)
+ {
fprintf(stderr, "WriteGIF: file not open for writing\n" );
- return (1);
+ goto out;
}
/*
* If it is the first image we do all the header stuff that isn't
* required for the rest of the images.
*/
- if (idx == 0) {
+ if (idx == 0)
+ {
/* Write out the GIF header and logical screen descriptor */
- if (n_images > 1) {
+ if (n_images > 1)
+ {
fwrite("GIF89a", sizeof( char ), 6, fpGif); /* the GIF magic number */
- } else {
+ }
+ else
+ {
fwrite("GIF87a", sizeof( char ), 6, fpGif); /* the GIF magic number */
}
@@ -331,7 +328,8 @@ int main(int argc , char **argv)
* If loop_times is 0 , put in the application extension to make
* the gif anime loop indefinitely
*/
- if (time_out > 0) {
+ if (time_out > 0)
+ {
fputc(0x21 , fpGif);
fputc(0xFF , fpGif);
fputc(11 , fpGif);
@@ -344,7 +342,8 @@ int main(int argc , char **argv)
}
}
- if (n_images > 1) {
+ if (n_images > 1)
+ {
/* write a graphic control block */
fputc(0x21 , fpGif);
fputc(0xF9 , fpGif);
@@ -368,7 +367,8 @@ int main(int argc , char **argv)
/* since we always have a local color palette ... */
fputc((0x80 | (BitsPerPixel - 1)) , fpGif);
- for (i = 0; i < ColorMapSize; i++) {
+ for (i = 0; i < ColorMapSize; i++)
+ {
/* write out Global colormap */
fputc(r1[i], fpGif);
fputc(g1[i], fpGif);
@@ -377,32 +377,42 @@ int main(int argc , char **argv)
fputc(InitCodeSize , fpGif);
- i = hdfWriteGIF(fpGif , Image , 0 , (int)dim_sizes[0] ,
- (int)dim_sizes[1] , r1, g1 , b1 , pc2nc , 256 , 8 ,
- BitsPerPixel);
+ i = hdfWriteGIF(fpGif , Image , 0 , RHeight , RWidth , r1, g1 , b1 , pc2nc , 256 , 8 , BitsPerPixel);
fputc(0x00, fpGif);
free(Image);
}
- if (fputc(';',fpGif) == EOF) {
+ if (fputc(';',fpGif) == EOF)
+ {
/* Write GIF file terminator */
fprintf(stderr , "Error!");
- return -1;
+ goto out;
}
- fclose(fpGif);
+ if (fpGif != NULL)
+ fclose(fpGif);
- if (HDFName != NULL)
- free(HDFName);
- if (GIFName != NULL)
- free(GIFName);
- while(number_of_images--) {
+ while(number_of_images--)
+ {
if (image_name_arr[number_of_images])
free(image_name_arr[number_of_images]);
- if (pal_name_arr[number_of_images])
- free(pal_name_arr[number_of_images]);
}
+
return 0;
+
+
+out:
+
+ while(number_of_images--)
+ {
+ if (image_name_arr[number_of_images])
+ free(image_name_arr[number_of_images]);
+ }
+ if (fpGif != NULL)
+ fclose(fpGif);
+
+
+ return 1;
}
diff --git a/hl/tools/gif2h5/readhdf.c b/hl/tools/gif2h5/readhdf.c
deleted file mode 100644
index a66bf85..0000000
--- a/hl/tools/gif2h5/readhdf.c
+++ /dev/null
@@ -1,255 +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 "gif.h"
-#include "h5tools.h"
-
-
-/* just a small cleanup routine before we leave */
-void
-cleanup(BYTE *ptr)
-{
- if (ptr)
- free(ptr);
-}
-
-/* Function: ReadHDF
-** Return: 0 on completion without error, -1 on error
-** Input: CHAR *h5_file - HDF file name
-** CHAR *dset_name - Name of the HDF Image dataset
-** CHAR *pal_name - Name of the HDF palette
-** Output: BYTE** data - the HDF Image to be converted
-** BYTE palette[256][3] - the corresponding palette
-** hsize_t* image_size - the size of each dimension of the image
-**
-** Future Notes:
-** The way readHDF works right now is that it expects the user
-** to know the exact path to the HDF image. Thus it does not
-** parse the HDF file looking for image datasets and corresponding
-** palettes. Also it takes in the default palette for the image
-** specified, if the palette is missing, it makes a default greyscale
-** palette and throws it in.
-**
-** Modifications: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu
-** Date: December 15, 2005
-** Changed the HDF5 read routines to use memory types and sizes,
-** for both the image and pallete datasets
-**
-*/
-int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
- CHAR *h5_file, CHAR *dset_name, CHAR *pal_name)
-{
- hid_t fHfile; /* H5 file to open */
- hid_t dspace; /* dataspace identifier for the the dataset */
- hid_t dtype; /* datatype identifier for the the dataset */
- hid_t mtype_id; /* memory data type ID */
- size_t msize; /* memory size of memory type */
- hid_t dset; /* dataset identifier */
- hid_t pal_set; /* dataset for palette */
- hid_t pal_space; /* dataspace for palette */
- hid_t pal_dtype; /* datatype for palette */
- hsize_t datasize; /* size of the image */
- int pal_exist=0; /* do we have a palette? */
-
- /* check stuff */
- if (!h5_file || !dset_name || !image_size) {
- fprintf(stderr, "NULL is not an acceptable input for HDFread. Aborting.\n");
- return -1;
- }
-
- /* do we have a palette ? */
- if (pal_name) {
- pal_exist = 1;
- }
-
- /* try opening the file */
- /* H5 file open calls */
- if ((fHfile = H5Fopen(h5_file , H5F_ACC_RDONLY , H5P_DEFAULT)) < 0) {
- fprintf(stderr , "Unable to open HDF file for input. Aborting.\n");
- return -1;
- }
-
- /* open the dataset for reading */
- if ((dset = H5Dopen(fHfile , dset_name)) < 0) {
- fprintf(stderr , "Unable to open dataset\n");
- return -1;
- }
-
- dtype = H5Dget_type(dset);
- if (dtype < 0) {
- fprintf(stderr , "Unable to open datatype\n");
- return -1;
- }
- if (H5Tget_class(dtype) != H5T_INTEGER) {
- fprintf(stderr , "Data is not integer. Cannot convert to GIF\n");
- return -1;
- }
- if (H5Tget_size(dtype) != 1) {
- fprintf(stderr , "Data is %d bytes per pixel. Cannot convert to GIF\n",(int)H5Tget_size(dtype));
- return -1;
- }
-
- /* get the dataspace */
- if ((dspace = H5Dget_space(dset)) < 0) {
- fprintf(stderr , "Unable to get dataspace\n");
- return -1;
- }
-
- /* get the dimension size of the image */
- if (H5Sget_simple_extent_dims(dspace , image_size , NULL) <0 ) {
- fprintf(stderr , "Unable to get dimension info\n");
- return -1;
- }
-
- /* get memory type */
- if ((mtype_id=h5tools_get_native_type(dtype))<0){
- fprintf(stderr , "Unable to get memory type\n");
- return -1;
- }
-
- /* get memory datatype size */
- if ((msize=H5Tget_size(mtype_id))==0){
- fprintf(stderr , "Unable to get memory size\n");
- return -1;
- }
-
- /* size needed to store the image */
- datasize = image_size[0] * image_size[1];
-
- /* allocate memory to store the image */
- if ((*data = (BYTE*) malloc((size_t)datasize*msize)) == NULL) {
- fprintf(stderr , "Out of memory, exiting");
- return -1;
- }
-
- /* get the actual image */
- if (H5Dread(dset , mtype_id, H5S_ALL , H5S_ALL , H5P_DEFAULT , *data) < 0) {
- fprintf(stderr , "Unable to read data \n");
- cleanup(*data);
- return -1;
- }
-
- if (pal_exist) {
- hsize_t loc_pal_size[2];
- hsize_t pal_datasize;
- hid_t pal_mtype_id;
- void *temp_buf;
-
- /* get the palette dataset */
- if ((pal_set = H5Dopen(fHfile , pal_name)) < 0) {
- fprintf(stderr , "Unable to open dataset\n");
- pal_exist = 0;
- return -1;
- }
-
- pal_dtype = H5Dget_type(pal_set);
- if (dtype < 0) {
- fprintf(stderr , "Unable to open palette datatype\n");
- return -1;
- }
- if (H5Tget_class(pal_dtype) != H5T_INTEGER) {
- fprintf(stderr , "Palette data is not integer. Cannot convert to GIF\n");
- return -1;
- }
- if (H5Tget_size(pal_dtype) != 1) {
- fprintf(stderr , "Palette data is %d bytes per pixel. Cannot convert to GIF\n",(int)H5Tget_size(pal_dtype));
- return -1;
- }
-
- /* get the dataspace */
- if ((pal_space = H5Dget_space(pal_set)) < 0) {
- fprintf(stderr , "Unable to get dataspace\n");
- pal_exist = 0;
- return -1;
- }
-
- /* get the dimension size of the palette. */
- if (H5Sget_simple_extent_dims(pal_space , loc_pal_size , NULL) !=2 ) {
- fprintf(stderr , "Unable to get dimension info\n");
- pal_exist = 0;
- return -1;
- }
-
- /* get memory type */
- if ((pal_mtype_id=h5tools_get_native_type(pal_dtype))<0){
- fprintf(stderr , "Unable to get memory type\n");
- return -1;
- }
-
- /* get memory datatype size */
- if ((msize=H5Tget_size(pal_mtype_id))==0){
- fprintf(stderr , "Unable to get memory size\n");
- return -1;
- }
-
- /* size needed to store the image */
- pal_datasize = loc_pal_size[0] * loc_pal_size[1];
-
- /* copy stuff into a temp buffer and then copy 256*3 elements to palette */
- temp_buf=(void *) malloc((unsigned)(pal_datasize*msize));
- if ( temp_buf==NULL){
- printf( "cannot read into memory\n" );
- return -1;
- }
- /*
- * make sure that the palette is actually 256 X 3 so that we don't
- * create overflows
- */
- if (pal_datasize > 256 * 3) {
- fprintf(stderr , "Palette seems to be more than 256X3 bytes\n");
- fprintf(stderr , "Truncating palette to 256 colors. This might cause a problem with the final image\n");
- pal_datasize = 256 * 3;
- }
-
- /* get the actual palette */
- if (H5Dread(pal_set , pal_mtype_id, H5S_ALL , H5S_ALL , H5P_DEFAULT , temp_buf) < 0) {
- fprintf(stderr , "Unable to read data \n");
- cleanup(*data);
- cleanup(temp_buf);
- return -1;
- }
-
- /* copy stuff into the actual palette */
- memcpy(palette , temp_buf , (size_t)pal_datasize);
-
- /* get rid of the temp memory */
- cleanup(temp_buf);
-
- /* close pal ids */
- H5Dclose(pal_set);
- H5Sclose(pal_space);
- H5Tclose(pal_dtype);
- H5Tclose(pal_mtype_id);
- /* end of if (pal_exist) */
- } else {
- int i;
- /*
- * if palette does not exist we just go ahead and create a uniform
- * greyscale palette
- */
- for (i = 0 ; i < 256 ; i++) {
- palette[i][0] = 255 - i;
- palette[i][1] = 255 - i;
- palette[i][2] = 255 - i;
- }
- }
-
- /* close everything */
- H5Dclose(dset);
- H5Sclose(dspace);
- H5Tclose(dtype);
- H5Tclose(mtype_id);
- H5Fclose(fHfile);
- return 0;
-}
diff --git a/hl/tools/testfiles/h52giftst.h5 b/hl/tools/testfiles/h52giftst.h5
new file mode 100644
index 0000000..a827b3b
--- /dev/null
+++ b/hl/tools/testfiles/h52giftst.h5
Binary files differ
diff --git a/hl/tools/testfiles/image1.gif b/hl/tools/testfiles/image1.gif
new file mode 100644
index 0000000..b90b23a
--- /dev/null
+++ b/hl/tools/testfiles/image1.gif
Binary files differ