summaryrefslogtreecommitdiffstats
path: root/tools/h4toh5/h4toh5image.c
diff options
context:
space:
mode:
authorMuQun Yang <ymuqun@hdfgroup.org>2001-08-13 20:56:33 (GMT)
committerMuQun Yang <ymuqun@hdfgroup.org>2001-08-13 20:56:33 (GMT)
commit018a8be1165ad0ac1b7725b4a0f2d9e58384aa9f (patch)
tree80f74dac86b4805a815e4df3ffdbc6fb0de295ae /tools/h4toh5/h4toh5image.c
parente5451a115739b034cfef5ab1669cf1bc8d7bc476 (diff)
downloadhdf5-018a8be1165ad0ac1b7725b4a0f2d9e58384aa9f.zip
hdf5-018a8be1165ad0ac1b7725b4a0f2d9e58384aa9f.tar.gz
hdf5-018a8be1165ad0ac1b7725b4a0f2d9e58384aa9f.tar.bz2
[svn-r4338]
Purpose: check-in the second time to update the handling of data transfer in h4toh5. This will make up for the cvs conflict checking a couple hours ago. Description: Solution: Platforms tested: eirene
Diffstat (limited to 'tools/h4toh5/h4toh5image.c')
-rw-r--r--tools/h4toh5/h4toh5image.c185
1 files changed, 6 insertions, 179 deletions
diff --git a/tools/h4toh5/h4toh5image.c b/tools/h4toh5/h4toh5image.c
index 9662904..94fa08f 100644
--- a/tools/h4toh5/h4toh5image.c
+++ b/tools/h4toh5/h4toh5image.c
@@ -411,9 +411,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
/* HDF4 can support various compression methods including simple RLE, NBIT, Skip Huffman, gzip,Jpeg , HDF5 currently only supports gzip compression.
By default, we will compress HDF5 dataset by using gzip compression if HDF5 file is compressed. */
-<<<<<<< h4toh5image.c
-=======
-
+ /* we don't use data transfer property list.
write_plist = H5Pcreate_list(H5P_DATASET_XFER_NEW);
bufsize = h4memsize *h5dims[1]*ncomp;
@@ -422,11 +420,9 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
free(image_data);
free(h5cimage_name);
H5Pclose(create_plist);
- H5Pclose_list(write_plist);
return FAIL;
}
-
->>>>>>> 1.3
+ */
if (ncomp == 1) {
h5d_sid = H5Screate_simple(2,h5dims,NULL);
@@ -436,10 +432,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
free(image_data);
free(h5cimage_name);
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
return FAIL;
}
@@ -450,10 +442,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
free(image_data);
free(h5cimage_name);
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
return FAIL;
}
@@ -463,123 +451,14 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
free(image_data);
free(h5cimage_name);
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
return FAIL;
}
- }
-<<<<<<< h4toh5image.c
-=======
-
- else { /* compound datatype. */
-
- h5_ctype = H5Tcreate(H5T_COMPOUND,ncomp*h4size);
- if (h5_ctype < 0) {
- printf("error in generating hdf5 compound data type. \n");
- free(image_data);
- free(h5cimage_name);
- H5Pclose(create_plist);
- H5Pclose_list(write_plist);
- return FAIL;
- }
-
- h5_cmemtype = H5Tcreate(H5T_COMPOUND,ncomp*h4memsize);
- if (h5_cmemtype < 0) {
- printf("error in generating hdf5 memory compound data type. \n");
- free(image_data);
- free(h5cimage_name);
- H5Pclose(create_plist);
- H5Pclose_list(write_plist);
- return FAIL;
- }
-
->>>>>>> 1.3
+ }
- else { /* 24-bit image */
+ else { /* 24-bit image */
-<<<<<<< h4toh5image.c
h5d_sid = H5Screate_simple(3,h5dims24,NULL);
-=======
- {
- hid_t arr_type; /* Array datatype for inserting fields */
-
- /* Create array datatype */
- if((arr_type=H5Tarray_create(h5ty_id,1,fielddim,NULL))<0) {
- printf("error creating array datatype.\n");
- free(image_data);
- free(h5cimage_name);
- H5Pclose(create_plist);
- H5Pclose_list(write_plist);
- return FAIL;
- }
-
- ret = H5Tinsert(h5_ctype,"HDF4Image_data",0,arr_type);
- if(ret < 0) {
- printf("error in inserting array of compound datatype. \n");
- free(image_data);
- free(h5cimage_name);
- H5Pclose(create_plist);
- H5Pclose_list(write_plist);
- return FAIL;
- }
-
- /* Close array datatype */
- if(H5Tclose(arr_type)<0) {
- printf("error closing array datatype.\n");
- free(image_data);
- free(h5cimage_name);
- H5Pclose(create_plist);
- H5Pclose_list(write_plist);
- return FAIL;
- }
-
- /* Create array datatype */
- if((arr_type=H5Tarray_create(h5memtype,1,fielddim,NULL))<0) {
- printf("error creating array datatype.\n");
- free(image_data);
- free(h5cimage_name);
- H5Pclose(create_plist);
- H5Pclose_list(write_plist);
- return FAIL;
- }
-
- ret = H5Tinsert(h5_cmemtype,"HDF4Image_data",0,arr_type);
- if(ret < 0) {
- printf("error in inserting array of compound datatype at memory. \n");
- free(image_data);
- free(h5cimage_name);
- H5Pclose(create_plist);
- H5Pclose_list(write_plist);
- return FAIL;
- }
-
- /* Close array datatype */
- if(H5Tclose(arr_type)<0) {
- printf("error closing array datatype.\n");
- free(image_data);
- free(h5cimage_name);
- H5Pclose(create_plist);
- H5Pclose_list(write_plist);
- return FAIL;
- }
- }
-
- h5d_sid = H5Screate_simple(2,h5dims,NULL);
->>>>>>> 1.3
- if(h5d_sid < 0) {
- printf("error in creating space. \n");
- free(image_data);
- free(h5cimage_name);
- H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
- return FAIL;
- }
h5dset = H5Dcreate(h5_group,h5cimage_name,h5ty_id,h5d_sid,
create_plist);
@@ -588,10 +467,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
free(image_data);
free(h5cimage_name);
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
return FAIL;
}
@@ -601,13 +476,9 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
free(image_data);
free(h5cimage_name);
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
return FAIL;
}
- }
+ }
free(image_data);
/* convert image annotation into attribute of image dataset.
@@ -622,10 +493,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
printf("failed to convert image annotation into hdf5 attribute.\n");
free(h5cimage_name);
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
H5Sclose(h5d_sid);
H5Dclose(h5dset);
return FAIL;
@@ -635,10 +502,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
printf("failed to convert image annotation into hdf5 attribute.\n");
free(h5cimage_name);
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
H5Sclose(h5d_sid);
H5Dclose(h5dset);
return FAIL;
@@ -648,10 +511,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
printf("failed to convert image annotation into hdf5 attribute.\n");
free(h5cimage_name);
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
H5Sclose(h5d_sid);
H5Dclose(h5dset);
return FAIL;
@@ -665,10 +524,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
if(gr_tranattrs(ri_id,h5dset,ngrattrs,check_gloattr)==FAIL){
printf(" cannot obtain attributes. \n");
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
H5Sclose(h5d_sid);
H5Dclose(h5dset);
return FAIL;
@@ -692,10 +547,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
if(h4_transpredattrs(h5dset,HDF4_OBJECT_TYPE,grlabel)==FAIL){
printf("error in getting hdf4 image type attribute \n");
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
H5Sclose(h5d_sid);
H5Dclose(h5dset);
free(h5cimage_name);
@@ -706,10 +557,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
if(h4_transpredattrs(h5dset,HDF4_OBJECT_NAME,image_name)==FAIL){
printf("error in getting hdf4 image name attribute. \n");
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
H5Sclose(h5d_sid);
H5Dclose(h5dset);
free(h5cimage_name);
@@ -719,10 +566,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
if(h4_transpredattrs(h5dset,HDF4_IMAGE_CLASS,image_class)==FAIL){
printf("error in getting hdf4 image class attribute. \n");
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
H5Sclose(h5d_sid);
H5Dclose(h5dset);
free(h5cimage_name);
@@ -782,10 +625,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
if(gr_ref == 0) {
printf("error in obtaining reference number of GR.\n");
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
H5Sclose(h5d_sid);
H5Dclose(h5dset);
free(h5cimage_name);
@@ -795,10 +634,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
if(h4_transnumattr(h5dset,HDF4_REF_NUM,gr_ref)==FAIL) {
printf("error in getting hdf4 image number attribute.\n");
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
H5Sclose(h5d_sid);
H5Dclose(h5dset);
free(h5cimage_name);
@@ -810,10 +645,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
if(gr_palette(file_id,ri_id,h5dset,h5_palgroup,h4_attr)== FAIL) {
printf("error in translating palette into h5 dataset.\n");
H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- H5Pclose_list(write_plist);
->>>>>>> 1.3
H5Sclose(h5d_sid);
H5Dclose(h5dset);
free(h5cimage_name);
@@ -821,16 +652,12 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
}
ret = H5Pclose(create_plist);
-<<<<<<< h4toh5image.c
-=======
- ret = H5Pclose_list(write_plist);
->>>>>>> 1.3
ret = H5Sclose(h5d_sid);
ret = H5Dclose(h5dset);
istat = GRendaccess(ri_id);
free(h5cimage_name);
return SUCCEED;
-}
+ }
/**** palette routine. ****/
/*-------------------------------------------------------------------------