/*
 * History:
 *
 * 90/12/16 1.0 rosenkra   - initial release (posted to c.s.atari.st)
 *
 * 91/1/7 1.1 rosenkra     - change -i to -r
 *                         - change -q to -i
 *                         - started to add -q (quantize), not complete
 *                         - fix bug with zero'ed accumulation arrays
 *                           which was being done with every call to
 *                           rasterize
 *                         - add histogram for each rgb value (eliminate
 *                           the "intensity order" histogram, too)
 *                         - make UseNTSC global
 *                         - fix scan_CM (bug in gemlib read)
 *                         - make default -s of 40
 *                         - histogram now impacted by -N (NTSC)
 *                         - add -f option
 * 91/2/25 1.2 rosenkra    - add -b option
 *                         - -i does not print color map. use -i -i
 * 91/6/3 3.0 rosenkra     - major rewrite using "flicker"
 *                         - really interactive only now
 *                         - ReadGIF now single entry point
 *                         - flicker is single entry point
 *                         - does lots of image processing (menu)
 *                           including size, blur, brighten, log scale,
 *                           contrast expansion, median filter
 * 91/6/3 3.2 rosenkra     - add convolutions
 *                         - release to usenet
 * 91/6/6 3.3 rosenkra     - add cut, rotate, mirror
 *                         - add flicker file write (*.fl)
 * 91/6/9 3.4 rosenkra     - fix some bugs in file write, median, log
 *                           scale, etc
 *                         - enlarge/shrink by direction
 *                         - cut can work beyond screen size
 *                         - add support for .pi1 and .pi2 files
 * 91/6/13 3.5 rosenkra    - point coord selection by crosshairs
 *                         - add zoom (2x)
 *                         - add histogram on screen in flicker screen
 *                         - add copy orig<-->new
 *
 ****
 **** Development continued by Johan Klockars (d8klojo@dtek.chalmers.se)
 ****
 * 92/11/09 4.0 Klockars   - support for GCC, Lattice C and Turbo C added
 *                         - changed to dynamic memory allocation
 *                         - less memory used now
 *                         - fixed and enhanced clipping
 *                         - improved speed in cmaptoint
 *                         - file loading speeded up (especially floppy)
 * 92/12/14 4.1 Klockars   - added quick preview using half tone matrix
 *                         - cleaned up code to eliminate warnings
 *                         - zoom function fixed
 *                         - removed slow flickering
 *                         - some improvements in the flicker routines
 *                         - no assembly linea functions anymore
 *                         - memory problem from v4.0 fixed
 *                         - pipe operation support begun (MiNT)
 *                         - JPEG support by Frank Mhle added
 *                         - mgif.c split into three files (command, info)
 *                         - convolution works now (it never did before)
 *                         - command.c rewritten for array of rasters
 *                         - some rewrites to use memset and memcpy
 *                         - improved information screen (what)
 *                         - speedups in histogram code
 *                         - NTSC colour conversion is now default
 *                         - command line switches for buffer size added
 * 93/05/14 4.2 Klockars   - GIF89 support added using code by Howard Chu
 *                         - lots of rewrites to use movemem for speed
 *                         - vertical and horizontal shearing added
 *                         - vertical and horizontal scaleing added
 *                         - rotation to any angle added
 *                         - support for overscan etc by Howard Chu
 *                         - changes to make windowed use possible
 *                         - now works in any (?) bit plane mode
 *                         - no wait for key on start up default
 *                         - flag for wait on key on start up added
 *                         - .fl format handles aspect ratios 1:1, 2:1
 *                         - don't allocate any buffers when inquire
 *                         - permit wildcards for files (not .fl)
 *                         - terrible bug in PI1 read code fixed
 *                         - rewrite of PI? code for enhanced speed
 *                         - correct colour setting in Falcon modes
 *                         - quick view in the Falcon true colour mode
 *                         - upgraded to JPEG code v 4a
 *                         - first attempt at Falcon true colour dither
 *                         - improved and centralized key handling
 *                         - use only one screen when in true colour
 *                         - changed stderr to stdout in most places
 *                         - dithering improved by table lookup
 *                         - improved cross hair implementation
 * 93/07/07 4.3 Klockars   - GIF decoding speeded up very much
 *                         - more speedup due to better interlace handling
 *                         - drawing speedup by doing F-S line by line
 *                         - TARGA/PPM read supported
 *                         - NonTC greyscale support added with switch
 *                         - Hold at end switch added
 *                         - tell memory handler when raster[1] is freed
 *                         - improved memory allocation error handling
 *                         - changed help screen
 *                         - gif loader now closes files correctly
 *                         - name and version info moved to global.c
 *                         - IJG gif loader used when small new image
 *                         - better i/o handling in command.c
 *                         - better checks for image size in process.c
 *                         - colour support for jpeg:s added
 *                         - source/destination instead of original/new
 *                         - support for more than two image buffers added
 *                         - general colour support started
 *                         - better handling of differently sized buffers
 *                         - mapped and direct colour in true colour mode
 *                         - slide show option added
 *                         - 24 bit jpeg, targa and ppm read
 *                         - demap of gifs added
 *                         - lots of changes in command.c and process.c
 *                         - several files split
 *                         - repeat and test commands added
 *                         - tempfile bug fixed
 *                         - fast gif loading even with small second buffer
 *                         - better buffer size defaults
 *                         - RGB mode for operations
 *                         - colour dithering in true colour mode
 *                         - TT support added
 *                         - non-malloc jmemtos to remove reallocation errors
 *                         - colour dithering in 16/256 colour using IJG code
 *                         - ST colour support added
 *                         - changes to use buffer struct
 *                         - changes to use options struct
 *                         - Lattice C and Turbo C fixes
 * 93/09/21 4.4 Klockars   - GEM interface added
 *                         - lots of changes to incorporate GUI
 *                         - lots of fixes and improvements to GUI
 *                         - lots of file splits and new files
 *                         - separate check and allocate screen
 *                         - destination buffer save/load added
 *                         - GIF, PPM and targa save added
 *                         - made start with no args equivalent to -gem
 *                         - fast assembly 8 bit chunky to planar conversion
 *                         - progress window for write, jpeg read and quantize
 *                         - relative positions for cut etc
 *                         - even faster chunky to planar
 *                         - some small fixes in display code
 *                         - buffers in alternate ram if single screen
 *                         - assembly optimizations for '030 GIF decode
 *                         - assembly optimizations for normal GIF decode
 *                         - total rewrite of menu handling code
 *                         - centering of images added
 *                         - skipping of conversion to grey added
 *                         - colour dither in 16/256 colours added
 *                         - all dither matrices read from file
 *                         - optimized assembly code for 256 colour dither
 *                         - small bug fix in chunky to planar routine
 *                         - test buffer creation from menu added
 *                         - menu option for ordered dither
 *                         - probably fixed odd address buffer problem
 *                         - switches from command line and/or file
 *                         - fixes in draw select logic
 *                         - switches from environment and program file
 *                         - menu option for display after load
 *                         - show and flicker draw fixes
 *                         - support for GEMView dither matrices
 *                         - oil paint effect from xv added
 *                         - rewrites in command parsing code
 *                         - assembly for 16 colour 24 bit with and w/o dither
 *                         - bias added to convolutions for emboss etc
 *                         - clip (0-255) disable added for convolutions
 *                         - a few bugs in the convolution dialog fixed
 *                         - smarter progress report window update
 *                         - even more optimization of GIF decode
 *                         - assembly for 16 colour mapped display with dither
 *                         - selectable number of colours for quantize
 *                         - assembly greyscale drawing
 *                         - mouse controlled zoom/cut
 *                         - improved support for alternate RAM
 *                         - use quick chunky to planar when FS-dithering
 *                         - assembly FS-dither
 *                         - assembly chunky to single plane
 *                         - flicker draw speeded up
 *                         - some bug fixes in load/save code
 *                         - lmin/lmax added
 *                         - image subtract added
 *                         - loading of AIM .IM files supported
 *                         - lots of GUI changes
 *                         - popup menu functionality added
 *                         - two times median filter speed up
 *                         - GUI fixes and updates
 *                         - popups implemented as dialog class
 *                         - general keyboard short-cuts added
 *                         - save dialog popup actually used
 *                         - new graphics mode representation
 *                         - zoom/cut select code cleaned up
 *                         - zoom/cut scroll around added
 *                         - old bug in monochrome ordered dither fixed
 *                         - many more old bugs fixed
 *                         - wildcard .FL load added
 *                         - file load on startup for GEM version added
 *                         - some new switches added
 *                         - improved checks for alternate memory
 *                         - totally mouse controlled zoom/cut
 *                         - click continue/end for .FL show added
 *                         - .FL load from GUI implemented
 *                         - convolution dialog behaves correctly again
 *                         - support for self-loading .FL files added
 *                         - IMG load added
 *                         - some option dialog changes
 *                         - scrollable normal view added
 *                         - a number of small bugs fixed
 *                         - switch for fit to screen on load added
 *                         - various new switches added
 *                         - a couple of simple new dialogs used
 *                         - switches etc for aspect correction
 *                         - more error alert boxes
 *                         - faster greyscale loading of Targa and PPM
 *                         - better handling of startup memory allocation
 *                         - write IMG added
 *                         - use free space in buffers instead of malloc
 *                         - minor memory leakages patched up
 *                         - switch for debugging added
 *                         - full dialog functionality for IMG save
 *                         - F-S dithering for IMG save added
 *                         - some minor bug fixes
 *                         - some VDI support for 256 colours implemented
 *                         - memory alignment problems on draw fixed
 *                         - border function added
 *                         - extended commands for text interface
 *                         - general image combine function added
 *                         - support for UNDO added
 *                         - time delay for slide show added
 *                         - switch for TT grey mode added
 *                         - various improvements
 *                         - image type change added
 *                         - local colour maps
 *                         - better handling of image types when processing
 *                         - real logarithms for log scale
 *                         - all point operations done by redistribution
 * MGIF 5.00 is now the official name, this is after all a _major_ update
 *                         - more drawing types stoppable
 *                         - a couple of more switches
 *                         - full VDI draw support for 8 bit modes
 *                         - default setting in program file implemented
 *                         - improved coordinate showing for cut/zoom
 *                         - a little MultiAES awareness added
 *                         - smarter buffer handling for GIF load
 *                         - in place (but slower) deinterlace
 *                         - switch for GIF decoder select added
 *                         - pixelize function added
 *                         - startup dialog improved
 *                         - switch for busy bee added
 *                         - screen size on load for non-GUI mode
 *                         - load control code cleaned up a bit
 *                         - some slide-show cleanups
 *                         - slide-show loop, random and script file added
 *                         - (X)IMG load bugs for < '020 fixed
 *                         - switch for stable flicker under MiNT added
 *                         - various crash problems eliminated
 *                         - save from destination now possible
 *                         - smarter buffer handling for image loading
 *                         - JPEGD use for non-mapped (not distributed)
 *                         - more user defined for border, blur and oil
 *                         - various bug fixes
 *                         - various minor improvements
 *
 *             95/12/21   MGIF 5.00 finally released!
 */

MGIF v5.01 (released 960312)
----------------------------
960208 - A DSP routine capable of both convolutions and median
         filtering (3x3 squares) was added.
         Speedup of about ten and five times respectively!

960312 - Some minor fixes regarding mouse and text cursor visibility.
         The DSP code loader now behaves better.
