summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2008-07-03 19:10:56 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2008-07-03 19:10:56 (GMT)
commit44be564ca46d5a9b2a00c936f30e49c0456f8583 (patch)
treefac638cc63a480ee51bcf5186a19e1b1f6bb02e0
parent5bf91156a7146cd3fec6a2faedd3694f29424fd2 (diff)
downloadhdf5-44be564ca46d5a9b2a00c936f30e49c0456f8583.zip
hdf5-44be564ca46d5a9b2a00c936f30e49c0456f8583.tar.gz
hdf5-44be564ca46d5a9b2a00c936f30e49c0456f8583.tar.bz2
[svn-r15316] added one more palette to the test generator file
tested: windows, linux
-rw-r--r--MANIFEST6
-rw-r--r--hl/tools/h52jpeg/h52jpegtst.c72
-rw-r--r--hl/tools/h52jpeg/h52jpegtst.h286
-rw-r--r--hl/tools/h52jpeg/testfiles/h52jpegtst.h5bin227613 -> 227613 bytes
4 files changed, 331 insertions, 33 deletions
diff --git a/MANIFEST b/MANIFEST
index dbba608..646fc04 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1518,15 +1518,15 @@
./tools/testfiles/h5mkgrp_version.ls
#h52jpeg
-./hl/tools/h52jpeg/testfiles/h52jpegtst.h5
+./hl/tools/h52jpeg/h52jpegtst.h
./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/Makefile.in
./hl/tools/h52jpeg/h52jpeg.sh
-
+./hl/tools/h52jpeg/testfiles/h52jpegtst.h5
# high level libraries
./hl/COPYING
diff --git a/hl/tools/h52jpeg/h52jpegtst.c b/hl/tools/h52jpeg/h52jpegtst.c
index d22be87..c22f232 100644
--- a/hl/tools/h52jpeg/h52jpegtst.c
+++ b/hl/tools/h52jpeg/h52jpegtst.c
@@ -16,26 +16,21 @@
#include "hdf5.h"
#include "hdf5_hl.h"
#include "H5private.h"
+#include "hdf5_hl.h"
+#include "h52jpegtst.h"
#include <stdlib.h>
#include <string.h>
-#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
-
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 */
+static int read_data(const char* fname, hsize_t *width, hsize_t *height );
+unsigned char *gbuf = NULL; /* global buffer for image data */
/*-------------------------------------------------------------------------
* Function: main
*
- * Purpose: h52jpegtst main program. Generate images and datasets to be used
+ * Purpose: h52jpegtst main program. Generate images to be used
* by h52jpeg tests
*
* Programmer: Pedro Vicente, pvn@hdfgroup.org
@@ -79,50 +74,67 @@ 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 */
+ unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */
int i, n;
+ /*-------------------------------------------------------------------------
+ * indexed image
+ *-------------------------------------------------------------------------
+ */
+
/* read first data file */
- if ( read_data( DATA_FILE1, &width, &height ) < 0 )
+ if ( read_data( "image8.txt", &width, &height ) < 0 )
goto out;
/* make the image */
- if ( H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, gbuf ) < 0 )
+ if ( H5IMmake_image_8bit( fid, "img8", width, height, gbuf ) < 0 )
goto out;
- /*-------------------------------------------------------------------------
- * define a palette, blue to red tones
- *-------------------------------------------------------------------------
- */
- for ( i=0, n=0; i<PAL_ENTRIES*3; i+=3, n++)
+ /* make a palette */
+ if ( H5IMmake_palette( fid, "pal1", pal_dims, pal_rgb ) < 0 )
+ goto out;
+
+ /* attach the palette to the image */
+ if ( H5IMlink_palette( fid, "img8", "pal1" ) < 0 )
{
- pal[i] =n; /* red */
- pal[i+1]=0; /* green */
- pal[i+2]=255-n; /* blue */
+ goto out;
}
- /* make a palette */
- if ( H5IMmake_palette( fid, PAL_NAME, pal_dims, pal ) < 0 )
+ /*-------------------------------------------------------------------------
+ * define another palette, green tones
+ *-------------------------------------------------------------------------
+ */
+ for ( i = 0, n = 0; i < PAL_ENTRIES*3; i+=3, n++)
+ {
+ pal[i] =0; /* red */
+ pal[i+1]=n; /* green */
+ pal[i+2]=0; /* blue */
+ }
+
+ /* save the palette */
+ if ( H5IMmake_palette( fid, "pal2", pal_dims, pal ) < 0 )
goto out;
/* attach the palette to the image */
- if ( H5IMlink_palette( fid, IMAGE1_NAME, PAL_NAME ) < 0 )
+ if ( H5IMlink_palette( fid, "img8", "pal2" ) < 0 )
+ {
goto out;
+ }
/*-------------------------------------------------------------------------
- * true color image example with pixel interlace in RGB type
- *-------------------------------------------------------------------------
- */
+ * true color image with pixel interlace in RGB type
+ *-------------------------------------------------------------------------
+ */
/* read second data file */
- if ( read_data( DATA_FILE2, &width, &height ) < 0 )
+ if ( read_data( "image24pixel.txt", &width, &height ) < 0 )
goto out;
/* make dataset */
- if ( H5IMmake_image_24bit( fid, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", gbuf ) < 0 )
+ if ( H5IMmake_image_24bit( fid, "img24", width, height, "INTERLACE_PIXEL", gbuf ) < 0 )
goto out;
-
+
return 0;
out:
diff --git a/hl/tools/h52jpeg/h52jpegtst.h b/hl/tools/h52jpeg/h52jpegtst.h
new file mode 100644
index 0000000..749e571
--- /dev/null
+++ b/hl/tools/h52jpeg/h52jpegtst.h
@@ -0,0 +1,286 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef _PAL_RGB_H
+#define _PAL_RGB_H
+
+#define PAL_ENTRIES 256
+
+const unsigned char pal_rgb[PAL_ENTRIES*3] = {0,0,0,
+0,0,131,
+0,0,135,
+0,0,139,
+0,0,143,
+0,0,147,
+0,0,151,
+0,0,155,
+0,0,159,
+0,0,163,
+0,0,167,
+0,0,171,
+0,0,175,
+0,0,179,
+0,0,183,
+0,0,187,
+0,0,191,
+0,0,195,
+0,0,199,
+0,0,203,
+0,0,207,
+0,0,211,
+0,0,215,
+0,0,219,
+0,0,223,
+0,0,227,
+0,0,231,
+0,0,235,
+0,0,239,
+0,0,243,
+0,0,247,
+0,0,251,
+0,0,255,
+0,0,255,
+0,3,255,
+0,7,255,
+0,11,255,
+0,15,255,
+0,19,255,
+0,23,255,
+0,27,255,
+0,31,255,
+0,35,255,
+0,39,255,
+0,43,255,
+0,47,255,
+0,51,255,
+0,55,255,
+0,59,255,
+0,63,255,
+0,67,255,
+0,71,255,
+0,75,255,
+0,79,255,
+0,83,255,
+0,87,255,
+0,91,255,
+0,95,255,
+0,99,255,
+0,103,255,
+0,107,255,
+0,111,255,
+0,115,255,
+0,119,255,
+0,123,255,
+0,127,255,
+0,131,255,
+0,135,255,
+0,139,255,
+0,143,255,
+0,147,255,
+0,151,255,
+0,155,255,
+0,159,255,
+0,163,255,
+0,167,255,
+0,171,255,
+0,175,255,
+0,179,255,
+0,183,255,
+0,187,255,
+0,191,255,
+0,195,255,
+0,199,255,
+0,203,255,
+0,207,255,
+0,211,255,
+0,215,255,
+0,219,255,
+0,223,255,
+0,227,255,
+0,231,255,
+0,235,255,
+0,239,255,
+0,243,255,
+0,247,255,
+0,251,255,
+0,255,255,
+0,255,255,
+3,255,251,
+7,255,247,
+11,255,243,
+15,255,239,
+19,255,235,
+23,255,231,
+27,255,227,
+31,255,223,
+35,255,219,
+39,255,215,
+43,255,211,
+47,255,207,
+51,255,203,
+55,255,199,
+59,255,195,
+63,255,191,
+67,255,187,
+71,255,183,
+75,255,179,
+79,255,175,
+83,255,171,
+87,255,167,
+91,255,163,
+95,255,159,
+99,255,155,
+103,255,151,
+107,255,147,
+111,255,143,
+115,255,139,
+119,255,135,
+123,255,131,
+127,255,127,
+131,255,123,
+135,255,119,
+139,255,115,
+143,255,111,
+147,255,107,
+151,255,103,
+155,255,99,
+159,255,95,
+163,255,91,
+167,255,87,
+171,255,83,
+175,255,79,
+179,255,75,
+183,255,71,
+187,255,67,
+191,255,63,
+195,255,59,
+199,255,55,
+203,255,51,
+207,255,47,
+211,255,43,
+215,255,39,
+219,255,35,
+223,255,31,
+227,255,27,
+231,255,23,
+235,255,19,
+239,255,15,
+243,255,11,
+247,255,7,
+251,255,3,
+255,255,0,
+255,251,0,
+255,247,0,
+255,243,0,
+255,239,0,
+255,235,0,
+255,231,0,
+255,227,0,
+255,223,0,
+255,219,0,
+255,215,0,
+255,211,0,
+255,207,0,
+255,203,0,
+255,199,0,
+255,195,0,
+255,191,0,
+255,187,0,
+255,183,0,
+255,179,0,
+255,175,0,
+255,171,0,
+255,167,0,
+255,163,0,
+255,159,0,
+255,155,0,
+255,151,0,
+255,147,0,
+255,143,0,
+255,139,0,
+255,135,0,
+255,131,0,
+255,127,0,
+255,123,0,
+255,119,0,
+255,115,0,
+255,111,0,
+255,107,0,
+255,103,0,
+255,99,0,
+255,95,0,
+255,91,0,
+255,87,0,
+255,83,0,
+255,79,0,
+255,75,0,
+255,71,0,
+255,67,0,
+255,63,0,
+255,59,0,
+255,55,0,
+255,51,0,
+255,47,0,
+255,43,0,
+255,39,0,
+255,35,0,
+255,31,0,
+255,27,0,
+255,23,0,
+255,19,0,
+255,15,0,
+255,11,0,
+255,7,0,
+255,3,0,
+255,0,0,
+250,0,0,
+246,0,0,
+241,0,0,
+237,0,0,
+233,0,0,
+228,0,0,
+224,0,0,
+219,0,0,
+215,0,0,
+211,0,0,
+206,0,0,
+202,0,0,
+197,0,0,
+193,0,0,
+189,0,0,
+184,0,0,
+180,0,0,
+175,0,0,
+171,0,0,
+167,0,0,
+162,0,0,
+158,0,0,
+153,0,0,
+149,0,0,
+145,0,0,
+140,0,0,
+136,0,0,
+131,0,0,
+127,0,0
+};
+
+
+
+#endif /* _PAL_RGB_H */
+
+
+
+
diff --git a/hl/tools/h52jpeg/testfiles/h52jpegtst.h5 b/hl/tools/h52jpeg/testfiles/h52jpegtst.h5
index 859abe8..8f65e59 100644
--- a/hl/tools/h52jpeg/testfiles/h52jpegtst.h5
+++ b/hl/tools/h52jpeg/testfiles/h52jpegtst.h5
Binary files differ