summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMuQun Yang <ymuqun@hdfgroup.org>2001-08-17 20:29:07 (GMT)
committerMuQun Yang <ymuqun@hdfgroup.org>2001-08-17 20:29:07 (GMT)
commit6218bc7efa1e7b8b9291f79e468aff9aa81b9398 (patch)
tree89bc472be7369547a235c05ec6f3b937c2d1280d /tools
parent510a1b341590786b46a870b4f534b1aad7c6a942 (diff)
downloadhdf5-6218bc7efa1e7b8b9291f79e468aff9aa81b9398.zip
hdf5-6218bc7efa1e7b8b9291f79e468aff9aa81b9398.tar.gz
hdf5-6218bc7efa1e7b8b9291f79e468aff9aa81b9398.tar.bz2
[svn-r4369]
Purpose: add a real raster-24 bit testing for interlace mode. Description: 1. GR interfaces will never create an HDF4 file with interlace mode other than pixel interleaved. DF24 interfaces can create HDF4 file with different interleaved. There are inconsistent behaviors between GRreqimageil and GRreadimage, data read into the memory will not behave properly if a new interlace mode is asked. 2. Currently HDF5 image spec. supports pixel interleaved and plane interleaved. We make a real image file to test whether the converter is doing the right thing. Solution: We use DF24 bit APIs to generate a real image file that can be tested by H5view. Platforms tested: linux and sol2.7
Diffstat (limited to 'tools')
-rw-r--r--tools/h4toh5/h4toh5test.c158
1 files changed, 151 insertions, 7 deletions
diff --git a/tools/h4toh5/h4toh5test.c b/tools/h4toh5/h4toh5test.c
index 4a985d6..043f417 100644
--- a/tools/h4toh5/h4toh5test.c
+++ b/tools/h4toh5/h4toh5test.c
@@ -798,7 +798,7 @@ int test_grtyp() {
uint32 image_data321[Y_LENGTH][X_LENGTH];
int16 image_data16[Y_LENGTH][X_LENGTH][3];
int16 image_data161[Y_LENGTH][X_LENGTH];
- int i, j;
+ intn i, j;
int32 CUB_SIZE;
int istat;
@@ -970,7 +970,7 @@ int test_ras8() {
int32 start[2], edges[2],dims[2];
int8 image_data8[Y_LENGTH][X_LENGTH];
uint8 image_datau8[Y_LENGTH][X_LENGTH];
- int i, j;
+ intn i, j;
int32 CUB_SIZE;
CUB_SIZE = (X_LENGTH-1)*(Y_LENGTH-1);
@@ -1071,7 +1071,9 @@ int test_ras24() {
int32 start[2], edges[2],dims[2];
int8 image_data24[Y_LENGTH][X_LENGTH][3];
uint8 image_datau24[Y_LENGTH][X_LENGTH][3];
- int i, j;
+ unsigned char t24[13][15][3],tl24[13][3][15],tp24[3][13][15];
+ int32 dimst24[2];
+ intn i, j,k,m,n,p,q,co;
int32 CUB_SIZE;
@@ -1095,6 +1097,69 @@ int test_ras24() {
}
}
+ k =0;
+ m = 0;
+ n = 0;
+ for (j = 0; j < 13; j++) {
+ for (i = 0; i < 15; i++) {
+ t24[j][i][0] = k;
+ t24[j][i][1] = k;
+ t24[j][i][2] = k;
+ k = k+1;
+ n = n+1;
+ if(n%13==0) {
+ k=m+1;
+ m++;
+ }
+ }
+ }
+
+ k = 0;
+ m = 0;
+ n = 0;
+ p = 0;
+ for (j = 0; j < 13; j++) {
+ for (co =0;co<3;co++) {
+ for (i = 0; i < 15; i++) {
+ tl24[j][co][i] = k;
+ k = k+1;
+ p = p+1;
+ if(p%13==0) {
+ m=m+1;
+ if(m%3==0) n++;
+ k = n;
+ }
+ }
+ }
+ }
+
+ k = 0;
+ m = 0;
+ n = 0;
+ p = 0;
+ q = 0;
+ for (co = 0; co < 3; co++) {
+ for (j =0;j<13;j++) {
+ for (i = 0; i < 15; i++) {
+ tp24[co][j][i] = k;
+ k++;
+ m++;
+ q++;
+ p++;
+ if(p%13 ==0) {
+ n++;
+ k = n;
+ }
+ if(q%(13*15)==0) {
+ k = 0;
+ n = 0;
+ }
+ }
+ }
+ }
+ dimst24[0] = 13;
+ dimst24[1] = 15;
+
/* Open the file. */
file_id = Hopen(FILERAS24, DFACC_CREATE, 0);
@@ -1157,6 +1222,85 @@ int test_ras24() {
printf("fail to write GR image.\n");
return FAIL;
}
+ /* Terminate access to the image. */
+ GRendaccess(ri_id);
+
+
+/* pixel interlaced.*/
+ncomp = 3;
+il = MFGR_INTERLACE_PIXEL;
+for(i=0;i<2;i++)
+{
+
+ start[i] =0;
+ edges[i] = dimst24[i];
+}
+ ri_id = GRcreate(gr_id, "t24", ncomp, DFNT_UCHAR8, il, dimst24);
+ if(ri_id == FAIL) {
+ printf("fail to create GR object.\n");
+ return FAIL;
+ }
+ istat = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)t24);
+ if(istat == FAIL) {
+ printf("fail to write GR image.\n");
+ return FAIL;
+ }
+
+ GRendaccess(ri_id);
+
+ /* we will use DF24 APIs to test interlace function of image. */
+ DF24setil(MFGR_INTERLACE_PIXEL);
+ DF24addimage("ras24il.hdf",(VOIDP)t24,13,15);
+ DF24setil(MFGR_INTERLACE_COMPONENT);
+ DF24addimage("ras24il.hdf",(VOIDP)tp24,13,15);
+
+/* component interlaced.*/
+ ncomp = 3;
+ il = MFGR_INTERLACE_COMPONENT;
+
+for(i=0;i<2;i++)
+{
+
+ start[i] =0;
+ edges[i] = dimst24[i];
+}
+ /* Create the array. */
+ ri_id = GRcreate(gr_id, "tp24", ncomp, DFNT_UCHAR8, il, dimst24);
+ if(ri_id == FAIL) {
+ printf("fail to create GR object.\n");
+ return FAIL;
+ }
+ /* Write the stored data to the image array. */
+ istat = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)tp24);
+ if(istat == FAIL) {
+ printf("fail to write GR image.\n");
+ return FAIL;
+ }
+
+ /* Terminate access to the image. */
+ GRendaccess(ri_id);
+
+/* line interlaced. */
+ ncomp = 3;
+ il = MFGR_INTERLACE_LINE;
+for(i=0;i<2;i++)
+{
+
+ start[i] =0;
+ edges[i] = dimst24[i];
+}
+ /* Create the array. */
+ ri_id = GRcreate(gr_id, "tl24", ncomp, DFNT_UCHAR8, il, dimst24);
+ if(ri_id == FAIL) {
+ printf("fail to create GR object.\n");
+ return FAIL;
+ }
+ /* Write the stored data to the image array. */
+ istat = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)tl24);
+ if(istat == FAIL) {
+ printf("fail to write GR image.\n");
+ return FAIL;
+ }
/* Terminate access to the image. */
GRendaccess(ri_id);
@@ -1178,7 +1322,7 @@ int test_imageattr() {
uint8 palette_data[NUM_COLORS * 3];
int32 num_comp,num_entries;
- int i, j;
+ intn i, j;
/* Open the file. */
file_id = Hopen(FILEGRPAL, DFACC_CREATE, 0);
@@ -1442,7 +1586,7 @@ int test_vgnameclash() {
int32 file_id, vgroupa_ref, vgroupa_id,vgroupb_ref,vgroupb_id;
int32 vgroupc_id,vgroupc_ref;
int32 dim_sizes[TYP_RANK];
- int i, j;
+ intn i, j;
int32 sd_id,sds_id;
int32 sds_ref;
int32 array_data[X_LENGTH][Y_LENGTH];
@@ -1566,7 +1710,7 @@ int test_sdsnameclash() {
int32 file_id, vgroupa_ref, vgroupa_id,vgroupb_ref,vgroupb_id;
int32 dim_sizes[TYP_RANK];
int32 vgroupc_ref,vgroupc_id;
- int i, j,istat;
+ intn i, j,istat;
int32 sd_id,sds_id;
int32 sds_ref;
int32 array_data[X_LENGTH][Y_LENGTH];
@@ -2904,7 +3048,7 @@ int test_vgall() {
int32 vgroupd_ref, vgroupd_id,vgroupe_ref,vgroupe_id;
int32 vdata_id,values[4]={32, 16, 32, 8};
- int i, j,k;
+ intn i, j,k;
uint8 *databuf, *pntr;
int bufsize, recsize;