1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
C Copyright by The HDF Group. *
C Copyright by the Board of Trustees of the University of Illinois. *
C All rights reserved. *
C *
C This file is part of HDF. The full HDF copyright notice, including *
C terms governing use, modification, and redistribution, is contained in *
C the COPYING file, which can be found at the root of the source code *
C distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. *
C If you do not have access to either file, you may request a copy from *
C help@hdfgroup.org. *
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
C
C
subroutine tr8f (number_failed)
implicit none
include 'fortest.inc'
C
C Test program:
C Writes images together with pals to a file.
C Reads images from the file.
C Writes and reads images with specified ref's.
C Input file: none
C Output file: tdfr8f.hdf
C
integer number_failed
character*20 myname
parameter (myname = 'r8')
character im1(100,100), im2(321, 111)
character ii1(100, 100), ii2(321, 111)
character pal1(768), pal2(768), ipal(768)
character*64 TESTFILE
character*1 CR
integer x, y, ret, num_images
integer d1, d2, ispal
integer ref1, ref2, ref3
call ptestban('Testing', myname)
TESTFILE = 'tdfr8f.hdf'
number_failed = 0
num_images = 0
CR = char(10)
do 120 x=1, 100
do 100 y=1, 100
im1(y,x) = char(x+y)
100 continue
120 continue
do 180 x=1, 111
do 150 y=1, 321
im2(y,x) = char(y-x)
150 continue
180 continue
do 200 x=1, 256
pal1(3*x - 2) = char(x)
pal1(3*x - 1) = char(x)
pal1(3*x ) = char(x)
pal2(x) = char(x)
pal2(x+256) = char(x)
pal2(x+512) = char(x)
200 continue
C Start here
call MESSAGE(VERBO_HI, 'Setting palette 1')
ret = d8spal(pal1)
call VRFY(ret, 'd8spal',number_failed)
call MESSAGE(VERBO_HI,
+ 'Putting image 1 with pal 1, no compression')
ret=d8pimg(TESTFILE, im1, 100, 100, 0)
call VRFY(ret, 'd8pimg',number_failed)
num_images = num_images + 1
call MESSAGE(VERBO_HI, 'Getting ref1')
ref1 = d8lref()
call MESSAGE(VERBO_HI,
+ 'Putting image 2 with pal 1, REL compression')
ret=d8aimg(TESTFILE, im2, 321, 111, DFTAG_RLE)
call VRFY(ret, 'd8aimg',number_failed)
num_images = num_images + 1
call MESSAGE(VERBO_HI, 'Getting ref2')
ref2 = d8lref()
call MESSAGE(VERBO_HI, 'Setting palette 2')
ret = d8spal(pal2)
call VRFY(ret, 'd8spal',number_failed)
call MESSAGE(VERBO_HI,
+ 'Putting image 2 with pal 2, IMCOMP compression')
ret=d8aimg(TESTFILE, im2, 321, 111, DFTAG_IMCOMP)
call VRFY(ret, 'd8aimg',number_failed)
num_images = num_images + 1
call MESSAGE(VERBO_HI, 'Getting ref3')
ref3 = d8lref()
call MESSAGE(VERBO_HI, 'Getting number of images')
ret = d8nims(TESTFILE)
if (ret .ne. num_images) then
print *, ' >>>> WRONG NUMBER OF IMAGES <<< '
else
if (Verbosity .ge. VERBO_HI) then
print *, ret, ' images in the file'
endif
endif
call MESSAGE(VERBO_HI, 'Restarting file')
ret = d8first()
call VRFY(ret, 'd8first',number_failed)
call MESSAGE(VERBO_HI, 'Getting dimensions of first image')
ret=d8gdims(TESTFILE, d1, d2, ispal)
call VRFY(ret, 'd8gdims',number_failed)
call MESSAGE(VERBO_HI, 'Getting image 1')
ret=d8gimg(TESTFILE, ii1, 100, 100, ipal)
call VRFY(ret, 'd8gimg',number_failed)
call check_im1_pal(100, 100, d1, d2, im1, ii1, pal1, ipal)
call MESSAGE(VERBO_HI, 'Getting dimensions of image2')
ret=d8gdims(TESTFILE, d1, d2, ispal)
call VRFY(ret, 'd8gdims',number_failed)
call MESSAGE(VERBO_HI, 'Getting dimensions of image 3')
ret=d8gdims(TESTFILE, d1, d2, ispal)
call VRFY(ret, ' d8gdims',number_failed)
call MESSAGE(VERBO_HI, 'Getting image 3')
ret = d8gimg(TESTFILE, ii2, 321, 111, ipal)
call VRFY(ret, 'd8gimg',number_failed)
call MESSAGE(VERBO_HI, 'setting read ref2')
ret = d8rref(TESTFILE, ref2)
call VRFY(ret, 'd8rref',number_failed)
call MESSAGE(VERBO_HI, 'Getting image 2')
ret = d8gimg(TESTFILE, ii2, 321, 111,ipal)
call VRFY(ret, 'd8gimg',number_failed)
call check_im2_pal(321,111,321, 111, im2, ii2, pal1, ipal)
call MESSAGE(VERBO_HI,'Setting write ref1')
ret = d8wref(TESTFILE, ref1)
call VRFY(ret, 'd8wref',number_failed)
call MESSAGE(VERBO_HI, 'Setting palette 2')
ret = d8spal(pal2)
call VRFY(ret, 'd8spal',number_failed)
call MESSAGE(VERBO_HI,'Putting image 1 with pal 2, RLE')
ret = d8aimg(TESTFILE, im1, 100, 100, DFTAG_RLE)
call VRFY(ret, 'd8aimg',number_failed)
call MESSAGE(VERBO_HI, 'Setting read ref1')
ret = d8rref(TESTFILE, ref1)
call VRFY(ret, 'd8rref',number_failed)
call MESSAGE(VERBO_HI, 'Getting dimensions of first image')
ret = d8gdims(TESTFILE, d1, d2, ispal)
call VRFY(ret, 'd8gdims',number_failed)
call MESSAGE(VERBO_HI, 'Getting image 1')
ret = d8gimg(TESTFILE, ii1, d1, d2, ipal)
call VRFY(ret, 'd8gimg',number_failed)
call check_im1_pal(100, 100, d1, d2, im1, ii1, pal2, ipal)
if (number_failed .eq. 0) then
call MESSAGE(VERBO_HI, '****** ALL TESTS SUCCESSFUL *******')
else
print *, '****' , number_failed, ' TESTS FAILED ****'
endif
return
end
C********************************************************
C
C check_im1_pal
C
C********************************************************
subroutine check_im1_pal(od1,od2,nd1,nd2,oim,nim,opal,npal)
implicit none
include 'fortest.inc'
integer od1, od2, nd1, nd2
character oim(100, 100), nim(100, 100)
character opal(768), npal(768)
integer prob, i, j
prob = 0
call MESSAGE(VERBO_HI, 'Checking image and palette')
if (od1 .ne. nd1 .OR. od2 .ne. nd2) then
print *, ' >>> DIMENSIONS WRONG <<< '
prob = 1
endif
do 520 j=1, 100
do 500 i=1,100
if (oim(i,j) .ne. nim(i,j)) then
print *, ' ERROR at ', i, j,' old image: ',
* oim(i,j), ' new image: ', nim(i,j)
prob = 1
endif
500 continue
520 continue
if (prob .eq. 0) then
call MESSAGE(VERBO_HI, 'Image is correct')
endif
prob = 0
do 550 i=1,768
if (opal(i) .ne. npal(i)) then
print *, ' ERROR at ',i, 'old pal: ', opal(i),
* ' new pal: ', npal(i)
prob = 1
endif
550 continue
if (prob .eq. 0) then
call MESSAGE(VERBO_HI, 'Palette is correct')
endif
return
end
C********************************************************
C
C check_im2_pal
C
C********************************************************
subroutine check_im2_pal(od1,od2,nd1,nd2,oim,nim,opal,npal)
implicit none
include 'fortest.inc'
integer od1, od2, nd1, nd2
character oim(321, 111), nim(321, 111)
character opal(768), npal(768)
integer prob, i, j
prob = 0
call MESSAGE(VERBO_HI, 'Checking image and palette')
if (od1 .ne. nd1 .OR. od2 .ne. nd2) then
print *, ' >>> DIMENSIONS WRONG <<< '
prob = 1
endif
do 520 j=1, 111
do 500 i=1,321
if (oim(i,j) .ne. nim(i,j)) then
print *, ' ERROR at ', i, j,' old image: ',
* oim(i,j), ' new image: ', nim(i,j)
prob = 1
endif
500 continue
520 continue
if (prob .eq. 0) then
call MESSAGE(VERBO_HI, 'Image is correct')
endif
prob = 0
do 550 i=1,768
if (opal(i) .ne. npal(i)) then
print *, ' ERROR at ',i, 'old pal: ', opal(i),
* ' new pal: ', npal(i)
prob = 1
endif
550 continue
if (prob .eq. 0) then
call MESSAGE(VERBO_HI, 'Palette is correct')
endif
return
end
|