ACE is able to process images in double integer precision (65536 levels of gray). In principle this should be stunning, but you may find that your `12-bit' images really only have 8-bit accuracy. Double-precision ACE generally uses a special gray format. (However, the extra precision available with colour might be exploited but is currently disabled.) PNMACE is optimised for size rather than speed with regard to double-precision operation. Therefore it doesn't make best use of the floating-point calculations required and don't judge the method from this implementation.
It is important to give me feedback about this facility, since I am likely to stop supporting it.
For convenience the PPM file format is used with the high-byte read from the green field and the low byte read from the blue field. (When writing, the red field is also filled with the high byte.) I have written a utility for converting to this format. The program, which is called `dbltoppm', is provided in the utils subdirectory of the non-GIMP software distribution.
Give pnmace extra arguments to tell it to work in double precision.
You can ask for output in single precision pgm or double precision ppm:
pnmace ... -doublep -gg input-image.ppm > output-image.pgm
pnmace ... -doublep input-image.ppm > output-image.ppm
Use of the PPM format may seem crazy and lazy, but it makes testing really simple. For example, you can download the colour mapping files from the software directory and use them to try it out. The following also makes use of an example image which you can download from the same place.
We can use `pgmtoppm -map' to map the example pgm file to a
double-precision ppm file. The file `map-iden.ppm' is a simple
pgmtoppm -map map-iden.ppm sf4g.pgm | pnmace 21 21 17 -f 0.0 -h -gg -doublep - > tmp1.pgm
We can apply ACE directly to the original:
pnmace 21 21 17 -f 0.0 -h sf4g.pgm > tmp2.pgm
Using the `pgmmse' program (also in the utils part of the distribution) we can confirm that the results are the same:
pgmmse tmp1.pgm tmp2.pgm
The other mapping files are designed to show that double precision
works. They map the values 0-256 to 64-128.
A single-precision map file `map-q-s.ppm' can be used to map the original image. We can apply this and then use one-byte ACE:
pgmtoppm -map map-q-s.ppm sf4g.pgm | ppmtorgb3
pnmace 21 21 68 -f 0.0 -h -tol -1.0 noname.grn > tmp3.pgm
Or we can use two-byte ACE (somewhat wasteful):
pgmtoppm -map map-q-s.ppm sf4g.pgm | pnmace 21 21 68 -f 0.0 -gg -h -doublep - > tmp4.pgm
Have a look at the results of applying ACE to the original with 17
terms and this last result using 68 terms. Now have a look at the
result using double precision:
pgmtoppm -map map-q-d.ppm sf4g.pgm | pnmace 21 21 68 -f 0.0 -gg -h -doublep - > tmp5.pgm
pgmmse tmp1.pgm tmp5.pgm
This shows that the two-byte process gives a substantial improvement. When the GLs were compressed by 0.25 and we used 4 times as many terms (68 as compared to 17), double precision was almost identical to direct process.
You can use the `pnmnoraw' program in the libgr/pbmplus suite to examine the mapping files. The following commands were used to generate them. (The last pixel of map-high.pgm was edited by hand.)   ppmmake rgb:0/0/0 256 1 | ppmtopgm > map-zero.pgm
Return to ACE homepage