What's New in 7.24
- Run-time code generation
- vips now generates vector code at run-time for morphology, convolution and image add. You typically get a 4x speedup, see below.
- Open via disc mode
- By default, vips now opens images via temporary disc files if necessary. This produces a huge drop in memory use when handling some file formats, see below.
- Workspace as Graph mode for nip2
- nip2 has a new menu item,
View / Workspace as Graphwhich shows you graphically how rows in your workspace interrelate. See below.
- FITS image format
- vips can now load FITS images, a popular format in astronomy.
- VIPS rewrite
- We've redone inplace, mask and morphology, just another 6 packages to go. See the API docs for the new stuff. The new versions are faster, more general, and have some obvious missing features added. The old API is still there for compatibility.
- Better nibs in paintbox
- The nip2 paintbox now has selectable nib radius.
- Better TIFF and JPEG load
- The TIFF reader is about twice as fast and needs 3mb less memory. The JPEG reader supports EXIF thumbnails and warns you about interlaced JPEG files.
Plus the usual minor speed-ups, portability improvements, enhancements and bug fixes. What's New in 7.22 is still there if you're interested.
Run-time code generation
Vips now uses Orc for convolution, erode, dilate and add.
Orc is a wrapper around sse/sse2/sse3/mmx/altivec/arm/ti-dsp and similar vector instruction sets. You write a bit of code in a pseudo-assembly language and at runtime it "compiles" it down to real instructions for the exact host CPU, using whatever capabilities it has. The idea is that many apps have to maintain multiple code paths for various annoying media instruction sets, so this thing abstracts that away and lets you write your code just once.
im_conv() goes one step further and generates the Orc code at runtime, optimised for the exact matrix and image to be processed.
Here's VIPS doing im_conv on a 10,000 x 10,000 pixel 8-bit RGB image:
$ time vips --vips-novector im_conv wtc.v wtc2.v blur3x3.con real 0m7.956s user 0m7.810s sys 0m0.920s
That's with -O2 on a 2.7GHz Opteron 254. Now with Orc:
$ time vips im_conv wtc.v wtc2.v blur3x3.con real 0m4.881s user 0m2.280s sys 0m0.880s
About a 3.5x speedup. You get a similar speedup, in the 3x to 5x range, for morphology and add as well. We expect to add run-time code generation to other operations in the next version.
Open via disc
vips has a new open mode which opens via a disc file. In the previous version, when you opened a large image in a format which did not support random access (such as JPEG), the image was uncompressed to memory and then processed from there. So for example:
time vips im_rot180 wtc.jpg wtc90.png real 0m49.1s user 0m48.1s sys 0m0.5s peak RES 310mb
where wtc.jpg is a 10,000 x 10,000 pixel RGB image, and
im_rot180 does a 180 degree rotate, is processed like this:
- vips allocates a large memory buffer (300MB in this case) and runs
im_jpeg2vips()into this buffer.
- vips creates a "p" virtual image and runs
im_rot180()from the memory image into the virtual image.
- Finally, it runs
im_vips2png()from the virtual image to the output file name.
The problem here is that memory is limited and images can be very large. vips has a new open mode, "rd", which is used everywhere. This mode allocates a temporary disc file and uncompresses to that rather than to memory.
Here's what you get now:
time vips im_rot180 wtc.jpg wtc90.png real 0m51.8s user 0m48.1s sys 0m1.1s peak RES 10mb
So higher systime, because of all the extra disc IO, but now there is very little memory use and there is no longer any filesize limit. You can use the
--vips-disc-threshold command-line flag and the
IM_DISC_THRESHOLD environment variable to turn the temp file feature on and off, see the docs for details.
View Workspace as Graph
nip2 now has a
View / Workspace as Graph menu item. It uses GraphViz to show the relationships between rows in the workspace. Here's a screenshot:
The graph updates as you edit the workspace. It's fun! And arguably a bit clearer than the normal workspace view.