GRABBER: The VB3 or VB4 programmer has, in this product,
a highly effective alternative to conventional image
handling. By putting images into a library rather than
handle them one file at a time, the images take much
less media space and load faster.

DEMO VERSION AVAILABLE. READ ON.

This text file contains a description of the shareware
product "T4 DIB Library", and following that, benchmark
data comparing images in libraries vs. standalone files.

******************************************************
*               PRODUCT DESCRIPTION                  *
******************************************************
 
T4 DIB Library
Library Utility and VB Custom Control

This text describes the shareware version of this
product. The only difference between the demo and
shareware versions is, the demo version allows only 4
max members per library. Otherwise, it's fully
functional. You can obtain the free "demo" by finding
T4DIBLIB.ZIP in this forum. To register, GO SWREG and
select #7733.

Product Highlights

The T4 DIB Library is a Visual Basic add-on which
handles image management and processing in a new way.
It's ideal for such applications as animation,
galleries, multi-media "stills", and any other
application which uses "lots" of image files.

This product consolidates individual image files into a
single quick-load library. Each image is a "member"
(1-32 character name), optionally compressed. The base
format used for storage is the DIB (device-independent
bitmap), but input image files can be in any of a
variety of types.

The product's two primary components are the
T4DIBLIB.EXE utility, and the T4DILIB.VBX custom
control.

T4DIBLIB.EXE Utility

Using this utility, you can draw in a variety of image
files (list in a minute). You can place the DIB images
of these files in a single library as "members". Each
member can have a name up to 32 characters, and can
optionally be compressed.

Although the libraries can contain images as high as 24
bpp (bits per pixel), it works best with color depth of
1, 4 and 8 bpp.

This product supports transforming most variations of
these file-types for library use: BMP, DIB, GIF, ICO,
JPG, PCX, RLE, TGA, TIF and WMF.

T4DILIB.VBX Custom Control

This VBX is the interface between the DIB library and
the "target" control that's to display the image.
Through typical property settings, you open and close
libraries, and select members for display in the target.
The target control can be one that usually gets it image
through VB's LoadPicture function, or one that accepts
an hDib directly. The VBX can build either image-type.
You just fetch the image from the library into the VBX,
then assign the target control's Picture property (or
whatever its called) to the VBX's Picture property; or
hDib property to the VBX's hDib property.

You can effectively keep images "resident" by assigning
one of these VBX's to each image. You can even choose
between keeping the typically-smaller DIB resident, or
if speed is important, keeping the device-dependent
variation (PIC, in VB) resident. This makes T4DIBLIB a
valuable animation tool.

You can also, of course, get information about the
library and/or individual members through the VBX's
properties. Library properties include filename, public
or private, and number of members. Member properties
include member name, member number, color depth (bpp),
size, what compression is used.

******************************************************
*                  BENCHMARK DATA                    *
******************************************************

These benchmarks illustrates the benefits of consol-

idating individual image-files into a compressed DIB
Library.

The machine used was a 486DX-33, 8MB RAM, Windows 3.1
with SmartDrv set at 1MB. The video was 256-color
1024x768.

The images chosen were 106 256-color TIF files. Each
file was about 25K. The aggregate size of the files was
26MB. I then created a DIB Library from these members
(all 106), compressing all of them. The resulting DIB
Library size was 14MB.

SPACE SAVINGS: The DIB Library was 54% of the size of
the original total file sizes. In general, 256-color
images compress 40-50%, and 16-color images compress
85%+.

***********

To determine performance, I first sequentially displayed
and timed individual TIF files (load and show), and then
did the same for the same images from a fully compressed
DIB Library. I used a variety of storage media,
specifically:

- Hard-drive (EISA SCSI, pretty fast), all 106 images. I
used
  both a standard-spaced and a double-spaced volume.
- IOMEGA Bernoulli 90, all 106 images.
- NEC 84 CD-ROM drive, all 106 images, TIF files only.
- 3-1/2" Diskette drive, 5 images.

For all of these tests, the volumes were read-cached to
a 1MB SmartDrive.

The following shows the frame-per-second (fps)
performance of these tests. Note that since I had no way
of writing a DIB Library to the CD-ROM drive, I
extrapolated that value based on a straight-line
projection between the two other closest media (Diskette
and Bernoulli). This projection is probably not
completely accurate, but it's better than nothing.

              FRAMES PER SECOND
                RAW     DIB      PERCENT
MEDIA          FILES  LIBRARY  IMPROVEMENT
Std Spaced HD  .475    .434      - 9.7%
DblSpaced HD   .427    .445        4.2%
Bernoulli      .391    .400        2.3%
CD-ROM         .228    .259 *     13.6% *
Diskette       .063    .082       30.2%

* = Extrapolated based on straight-line approximation.

In general, performance of a compressed DIB Library,
compared to single-image files, INCREASES as:
- CPU performance characteristics INCREASE and/or
- Media performance characteristics DECREASE and/or
- SmartDrive cache-hit ratios DECREASE.

Since SmartDrv was a "wildcard" in the above benchmark
(unpredictable cache hit/miss), I ran a duplicate demo,
but with SmartDrv shut off altogether. I know none of
your users would think of working this way, but this
next benchmark does show the effect of a 0% cache-hit
situation. Again, I did an approximation for the effect
of a library on the CD-ROM.

              FRAMES PER SECOND
                RAW     DIB      PERCENT
MEDIA          FILES  LIBRARY  IMPROVEMENT
Std Spaced HD  .393    .438       11.5%
DblSpaced HD   .402    .445       10.7%
Bernoulli      .344    .408       18.6%
CD-ROM         .230    .286 *     24.3% *
Diskette       .049    .094       91.8%

* = Extrapolated based on straight-line approximation.

The above benchmark can be used to show another
dimension - how much the performance VARIES with
SmartDrv on and off. These values can be used to
illustrate CONSISTENCY in performance. I have left out
the CD-ROM in this table, since that data is
extrapolated anyway. 

             PERFORMANCE VARIANCE
MEDIA           FILES   LIBRARY
Std Spaced HD   20.9%    1.0% 
DblSpaced HD     6.2%    0.0%
Bernoulli       13.7%    1.6%
Diskette        28.6%   12.8%

As you can see, the DIB Library is less sensitive to
SmartDrv issues than the single-image files.

Finally, just because someone might want to see it, I
included a benchmark on uncompressed libraries. You may
find the results somewhat surprising in that
uncompressed members do not always significantly
outperform compressed members. This is because the time
to read the member vs. the time to decompress it is very
dependent upon a specific machine configuration.

              FRAMES PER SECOND
                RAW     DIB      PERCENT
MEDIA          FILES  LIBRARY  IMPROVEMENT
Std Spaced HD  .475    .616       29.7%
DblSpaced HD   .427    .535       25.3%
Bernoulli      .391    .471       20.5%
CD-ROM         .228    .268 *     17.5% *
Diskette       .063    .060      - 1.6%

* = Extrapolated based on straight-line approximation.

From this, you can see the DIB Library can, under the
right circumstances, offer a significant performance
improvement over single-image files. Since you can elect
compression on a per-member basis, if you know the kind
of device your library will wind up on, you can tune the
library for the best combination of performance and
size.
