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
|
PPM to AGA Framebuffer Release 0.8
----------------------------------
Originally by Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>
Extensive modifications by Chris Lawrence <lawrencc@debian.org>
** To build and run in place, use 'make root' as root, or
the sequence 'make ppmtoagafb' 'su' 'make root'
To build and install, use 'make install' or
the sequence 'make ppmtoagafb' 'su' 'make install'
The eighth release is a Debianized version. The fact I've been away from
the code for over a year has probably benefitted both me and it.
The seventh release fixes a few more bugs, and is linked against my
non-maintainer release of the Debian netpbm-dev package. I got off my
butt and created a man page, too, and rewrote EncodeHAM8 in "native"
C. A proper Debian release will follow.
The sixth release fixes some bugs. It also lowers the default epsilon
value from 8 to 5, because there is no notable difference in quality
and a slight speed increase for doing so.
The biggest bug fix relates to screens that aren't an even multiple of
64 pixels wide. These caused previous versions of the program to
crash with signal 11 (segmentation violation). This release also
fixes a limitation that affects people who boot using a serial
console (CONFIG_SERIAL_CONSOLE).
The fifth release added a '--verbose' option for displaying some
information about the images that are displayed. It also uses a new
color allocation algorithm, which appears to do a better job than the
old one (and is faster, too). HAM-8 display is a bit faster due to
some optimizations in EncodeHAM8 [it could still be faster], and
there's a lot less 'color splotching' (large areas that are in a
similar shade rendered as one color) now. Grayscale display is a also
tad faster (due to a reimplementation of the luminance algorithm using
integer math). Finally, ppmtoagafb is now linked against static
NetPBM libraries.
The fourth release added a '--grayscale' (or '--greyscale') option,
which renders all graphics in grayscale (using luminance values,
similar to a NTSC color->b/w conversion).
This version also automatically renders graphics with fewer than 256
colors (like the Linux Penguin) in planar mode with "exact" colors.
In planar mode, the background will be black unless the image has 256
colors (in which case the background will most likely be the color of
the upper left corner). Histograms must be on for this to work (they
are required to find out how many colors are in the image -- PPM
doesn't store data in planes, and doesn't report how many colors are
in the image, which REALLY slows this down -- histograms take several
seconds per image).
Finally, I have included version information in the program and
allowed '--centre' as a variant of '--center' (apologies to all for
previous Amerocentrism ;)
The third release added a '--delay' option (default is 5), a
'--center' option, and allowed you to specify a filename of '-' to get
files from stdin. That option allows you to do neat stuff with pipes,
like:
cat *.p?m | ppmtoagafb -
and (if you have pngtopnm)
pngtopnm coolthing.png | pnmscale -xysize 640 480 | ppmtoagafb \
--centre -
The latest release (included) of agaview uses this functionality.
The second release included a histogram facility, which is enabled
by default. The histogram uses a parameter '--epsilon' which you can
set yourself; it tries to guess one if you don't supply it.
To disable the histogram, use '--no-histogram'. If you want the 63
most common unique colors in the palette, use '--exact-colors' (which
is the same as using '--epsilon 1'). Note that this may use more than
the first 63 colors since some colors may 'merge' due to the HAM8
color resolution only being 6 bits per gun (as opposed to 8 bits in
normal AGA).
The epsilon setting basically affects the distance between colors in
the palette. If you have a large area of various colors of one shade,
with a small area of various colors of another, a larger epsilon will
reduce the bias towards the larger area. This is especially important
in scanned images, where hundreds of colors are more or less the same.
This version retains the HAM 8 encoding used in Gnther Rhrich's
JpegAGA for the Amiga. His original algorithm is in the public
domain; I have placed my changes under the GPL.
The HAM 8 encoding was slightly modified so that histogrammed pictures
would be less predisposed to use the palette (and more likely to use
the hold and modify step). Non-histogrammed pictures fringe badly
with this change (so it isn't done on them).
With histograms disabled, this version is about 10% slower than
Geert's original. With histograms on, it will be at least twice as
slow (depending on epsilon). However, I really don't recommend
running with histograms off. If you are in a hurry, use --grayscale
or use:
ppmqvga <file> | ppmtoagafb -
(The latter reduces the image to 256 colors with NetPBM first, and is
probably slower than just letting ppmtoagafb do its own thing)
My testing shows that grayscale is always faster than a color mode.
HAM 8 --no-histogram is faster than planar display, which in turn is
(much) faster than HAM 8 with histograms.
I have included Geert's original source file and both of mine; to just
install this stuff, use 'make install'; to re-make it, 'make clean;
make'. You'll need the ppmcmap.h header to recompile (it isn't
installed by default by non-Debian releases of netpbm).
This program is essentially useless without programs to convert to the
PPM format. The "netpbm" package handles most of the common formats
(GIF, IFF, BMP, PCX, etc.); the "pnmtopng" package handles PNG (it's
available from http://www.wco.com/~png/, not yet in Debian) and the
Independent JPEG Group's "jpeg" package (version 6a+) handles JPEG
(including Progressive JPEG).
I included a PPM of the Linux Penguin, one of my test images. I have done
some work on the euid problem (normal users shouldn't have access to root's
files any more), but the underlying problem of tty ownership is not
addressed.
Finally, agaview.py is the latest version of the Python front-end that
automagically converts graphics to PPM and scales them to your screen
if they are too large. This version makes use of the stdin feature of
this ppmtoagafb and is incompatible with versions before 0.3. [Python
is a neat, 100% free, object-oriented programming language; see
http://www.python.org/ for details]
TO DO:
* Rewrite to use libfb (aka oFBsis)
* Build-in conversion from other formats. Planar images could benefit
(speed-wise) from not needing to histogram before display.
Chris
2 August 1998
NB: 'make install' by default installs to /usr/bin for FSSTND compliance.
You may want to use /usr/local/bin instead.
|