Revision 3: 30 Oct. 98.
Earlier, I said that the assignment would be variational surface modeling, but that appeared too involved for the short time we have, so I settled on this simpler assignment.
where "float/b" means whether coefficients are float, double, or quantized, and if quantized, what was the value of b; and "cf" means compression factor (frac*b/8). If cf>1 then we have expansion, not compression. For example, five different compression runs on the same picture might be summarized thus:picture-name npixels frac float/b cf rel.err time(sec.)
Note that the two right-hand columns in this example are wild guesses. Run each picture at least four times with results ranging from the most compression (smallest cf) that looked indistinguishable from the original down to a highly compressed version with relative error of .2 or so. See Stollnitz figure 3.5 for an example.face.pgm 512x512 1 float 32 0 20s face.pgm 512x512 .1 float 3.2 .1 20s face.pgm 512x512 1 32 32 .05 20s face.pgm 512x512 1 8 1 .15 20s face.pgm 512x512 .01 4 .005 .2 20s
double c[i,j] #define TINY .001 // cmax is max of |c[i,j]| for all i,j // (probably the coeff of the level 0 scaling fn, I'm guessing) double scalefactor = (pow(2,b-1)-.5-TINY)/cmax int qc[i,j] = floor(scalefactor*c[i,j] + .5) // qc is an integer in [-2^(b-1)+1,2^(b-1)-1] double rc[i,j] = qc[i,j]/scalefactor // rc is approximately equal to c // the more bits you use (large b) the closer it is
c2[pow(2,j)/2+i] = (c[2*i-1]-c[2*i])/sqrt(2);Use "1<<(j-1)" instead of "pow(2,j)/2", or better yet precompute that outside the loop! The fastest implementation would use pointers.
15-859, Hierarchical Methods for Simulation