- added code to force VGA not hi_color on GIF (will not work with custom definations)
- j_copy_block_rows, j_copy_samp_rows was changed to use _fmemcpy which is a lot faster
- changed jzero_far to _fsetmem() for Borland C - nice speed improvement
- changed copying to buffer from inner drawing loop to _fmemcpy on super_vga for speed - can't do on hi_color due to bit packing
-at version 2.0 [beta]
- converted jvdraw to assembler and doubled the speed
- speed up gifs, 1 pass quantize by converting jpeg routines to assembler and tuning for 32 bit
- threw in 24 bit video support for Tseng card
- fixed panning in 286 version - need to recompile and hand tweak for 386 version
-at version 2.a
- added patch to vidsetup use vidsetup -X to aviod video testing --> it trashes some computer's CMOS!! (Paradise with 1M)
- fixed VESA driver
- revamped so that you have to run vidsetup first
- only the usable modes are stored in the file (ie dvpeg does not have access to all modes)
- added 24 bit modes and revamped drivers to make the 24 bit modes standard access to bank-switching
- put trident "cards" (8900, 8800) together and put hi_color modes under the respective card
- revamped video setup so that AX, BX is given simplifying a lot of the setup for newer cards
- video card lists are now of variable length and easy to expand - no more double indexing to get a video cards resolution (X, Y size ...)
- video mode resolution (8, 15, 24 bit) are now in the video data - it is no longer dependant upon location in the list
- changed config file load/save format to save all video info required for each mode + info for vidsetup to find custom modes
- added unix'y passing ie dvpeg e:*.jpg will do just that
- at version 2.b
- added tint .. for hi-color (hit normal tint controls)
- added multiplier for tint controls ie F2 = 2* normal tint amount
- hi-color is saved as 24 bit for better contrast controls ..
- setup is done for a preference of tint, contrast, bright to effect pic when its first loaded
- added Diamond Speedstar X24 (S3??) code --> Can't detect the card though
- at version 2.1
- fixed up file name, path, drive passing - its now fully UNIXish
- problem d:\gifs\new is new a path or a file ??? how tell ??
- non-256 color modes now have the panning on or off (need to be able to flag it differently for tint, bright ...
- finally (?) fixed the Speedstar code
- fixed the VESA driver again (table was reversed)
- taking a guess that S3 based cards are VESA compatable ie AX was same as VESA
- added N, P for next, previous picture without going thru the text screens
- at version 2.1
- added Paradise, Ahead B modes
- custom text mode support ie 50 line, 132 col ...
- seperated drawing routines so that I can put them to assembler and leave them alone
- fixed bug in Tseng 3000 detection
- added Trident hi-color modes ?????? (did I ????)
- fixed custom video mode sticking on Ahead A
- changed 24 bit modes from 1920 bytes/row to 2048 (as per SpeedStar 24X specs
- added (correct ?) 24 bit vesa mode
- went to Borland C 3.1
- dropped all .asm versions of the IJG C modules (only 1% speed loss)
- went to version 4 of the IJG code
- tried dynamic memory alloc for file data records - very slow + problems reusing
- went to a block alloc of fixed size for file data records from far memory (ie possible to make larger, smaller during execution
- all jpeg warnings are turned off so you will just get a junk file as it tries but no error msg will be printed unless its unrecoverable
- beep bit now turns off beep when picture is loaded
- error messages can be turned off but it will still beep on error and pause for a key
- HOME, END do that for the file list
- added delete command so can delete files with Del key
- slide show is added (10 files max), s = show, S = continous loop
- added F7 function to change extra defaults
- added a flag to enable or disable hi-color tint ... controls on jpegs (ie on = buffering = panning ... )
- the code size now exceeds 64k and so I had to move upto a medium memory model
- problems with the new memory model means I had to combine point.asm and banks.asm to get it to compile (??? why ???)
-at version 2.1b
- added picture X axis centering when viewing (only if picture is smaller than the screen)
- speed up drawing by simplifying looping in panning
- split 256 color panning for better speed
- tried a S3 driver - may not work (ie don't know if numbers were hex or dec
- if greyscale then drop to a 256 color mode
- seperated panning from tint ... for better speed
- added support for wider file (ie file size) info packets on text screen with file info
-at version 2.1c
- if store_hicolor_in_24 is set use 24 bit storage and enable panning on JPEG always
- if the jpeg is < screen and 24 bit storage is not set then don't buffer image - if its bigger buffer for panning
- can sort in ascending or descending order
- new file sort routines useing bisection search for speed
- new file structure with an extra byte per file to include things like a slide show flag => slide show has unlimited # of files but you can't set an order of viewing
- 'A' selects all files for slide show
- 24 bit fixed and working with ATI Wonder XL24
- use memcpy for copying lines to graphics screen if shrink = 1 (hi-color, 24 bit, vga)
- to speed up file list generation I went to a memcpy instead of copying the struct element by element
- changed the contrast, tint controls to remove 1 multiply each - that just leaves 1 divide (each) to slow it down on the 15, 24 bit modes
- can have multiple file masks (5 currently) - hit 'del' when entering erases the current mask
- R repaints a picture ie setups up video mode and redraws - when in picture viewing mode - only if panning is on
- r is like R but does not reset the contrast, bright, tint controls
- if multiple arguements are given it is assumed that they are file names and will be shown in order (wait for keypress between)
- if a '-' arguement is given after the file name(s) dvpeg will exit and not go into the menu
- if you try to enlarge (ie hit ++) when panning is on and zoom is 1 then the you will zoom to the next video mode
- if try to shrink 5 times and panning is on the video mode will change to the next largest
- 24 bit tint controls by going thru video memory - ie does not need a buffered copy of the image
- 15 bit tint controls by working on the video memory directly
- at version 2.1d Feb 15, 1993
- fixed problem with dvpeg.cfg file format (file was getting corrupted
- fixed some tinting problems when working on the memory
- went to a faster tinting equation
- at version 2.1e Feb 26, 1993
- new IJG V4A code (greyscale 35% faster, color 11%, 13% faster for 1 pass, 2 pass)
- new global vars for drawing routines which are recalculated after mode change ....
- this removed calc's from drawing routines & tests since the picture and screen boundaries were defined
- this prepares the way for multiple windows with a struct describing each
- this also removed if tests from drawing routines => bit faster
- added a shrink lock-out flag and make the shrink automatic (ie it can't be set anymore)
- the shrink to fit only works if panning is off
- can shrink gifs now (as they are being loaded without the panning turned on)
- this will not work on interlaced gifs
- at version 2.2 Feb 22, 1993
- fixed panning problems on some hi-color modes & 24 bit mode
- fixed problem of getting a list full of 320 * 200 if you only have 256 color modes
- reformatted screen info so that the file names are right centered and the file length are left centered and aligned
- if 24 bit panning is on for hi-color then panning is always on
- hitting E (instead of enter) will use 'Editing mode' ie all buffering of the picture is on and it is 24 bit for hi-color tint controls
- modified flood fill video test to set only 1 color and all others to background -> better test
- fixed svgamode() because DI was trashed by VESA testing
- redid video modes so that 320 * 200 was only under VGA and mode selection was better (ie 4 bit only added if necessary)
- redid the interface on vidsetup a bit to show cursor (inverse) and selected modes (as red) as well as all video cards used (in red)
- changed file selection so that a zero length file is now 1 byte long -> this allows deleting, and it will not appear as a directory
- fixed minor bug in sizing the F3 window
-> removed fast drawing of two lines at once -> bugging panning on large images ie picture buffer has some bad lines! ie junk
-> panning problem, if picture dimension < screen then the panning controls are reversed
- at 3.0e Nov 30/93
- changed gif decoding pointers to near -> no speedup [ uses aprox 16k of near space ]
- changed targa input file pointer to global for a bit of speed; also cleaned up static vars by removing unused ones
- added more VESA 15,16,24 bit modes
- removed VESA duplicate 640 * 480 mode that had a different line length, VESA length detection works with good VESA drivers
-> the 16 bit modes work with univbe! -> first proof that they really work
- fixed H?V? JPEG detection -> will work as follows: H2V2 is only true for {{1,1},{2,2},{2,2}}
H1V1 is only true for {{1,1},{1,1},{1,1}} -> all else is considered H2V1
- brightest color selection will not only search first 16 colors for VGA modes (used to search all 256)
- 16 color modes now use the normal force grayscale and 1/2 pass quantize variables instead of dedicated ones
- sped up VGA (16 color) panning by a factor of 2 using memory moves (by line) [ still 2* slower than QPEG panning! ]
-> It could be sped up a lot if the zoom option was not used; that would explain the 2*
- at 3.0f Dec 4/93
- This will be the last vesion as I will be going to SVGAkit for the graphics
- VGA quantizing ie 256 colors -> 16 grayshades is very crude - should use histogram
To do:
- fix up reordering of interlaced GIFs during panning
- need tint for all pans, ie load a prev. tinted image, pan it -> no tints since buffered copy is not tinted
- 1 pass dithering ??
- add wrapping of file selection from left to right and vise-versa?
-15/16/24 bit modes will tint the image if redrawn from the buffer
Problems
- clearning of VGA screen is done by resetting video mode -> better way??
- need cleanup of viewing defaults ie removing multiple declerations for one picture
- can't free and create new file_info structure - ie if you try the system halts with a memory alloc. error
- 15/16/24 bit does not tint when it redraws
To add
- add support so that interlaced gifs can be shrunk, panned ....
- large screen sized buffer for slide show ie decode into buffer while the picture is pausing (how alloc the far memory ??? without getting upset by IJG code?)
- add selectable colors for file info
- rotate by 90 deg??
- still have to figure out Cirrus card
- problem with Compaq, Cirrus? bank selector ???
*
*/
#include "viewdef.h" /* definations for the viewer */
#include "extern.h" /* external declerations for viewer plus IJG includes */
#include <share.h>
#ifdef INCLUDES_ARE_ANSI
#include <stdlib.h> /* to declare exit() */
#endif
#ifdef NEED_SIGNAL_CATCHER
#include <signal.h> /* to declare signal() */
#endif
/* define mode parameters for fopen() */
#define READ_BINARY "rb"
#define WRITE_BINARY "wb"
#ifndef EXIT_FAILURE /* define exit() codes if not provided */
#define EXIT_FAILURE 1
#endif
#include <dir.h>
#include <string.h>
#include <dos.h>
#include <conio.h>
#include <setjmp.h>
#include <alloc.h>
#include <time.h>
void parse_path(char * arg);
extern unsigned _stklen = 7000;
#include "jvsetup.h" /* constants viewer */
/* Neat little trick to do a jump and clean up stack */
jmp_buf setjmp_buffer;
static external_methods_ptr emethods; /* needed for access to message_parm */
JSAMPARRAY patch_colormap; /* color map pointer for when I need to create a fake colormap */
int no_warning = 0; /* flag to indicate that the error message is not a warning but a fatal error */
/*
* Signal catcher to ensure that temporary files are removed before aborting.
* NB: for Amiga Manx C this is actually a global routine named _abort();
* see -Dsignal_catcher=_abort in CFLAGS. Talk about bogus...
*/
#ifdef NEED_SIGNAL_CATCHER
GLOBAL void
signal_catcher (int signum)
{
prep_for_exit();
printf("Severe exit from signal_catcher\n");
emethods->trace_level = 0; /* turn off trace output */
cinfo->out_color_space = CS_GRAYSCALE; /* this forces the color-map writing routine to only use the first component of the colormap to generate greyscale */
cinfo->color_map_present = TRUE;
cinfo->actual_number_of_colors = num_colors;
}
/*
* This routine gets control after the JPEG file header has been read;
* at this point the image size and colorspace are known.
* The routine must determine what output routines are to be used, and make
* any decompression parameter changes that are desirable. For example,
* if it is found that the JPEG file is grayscale, you might want to do
* things differently than if it is color. You can also delay setting
* quantize_colors and associated options until this point.
*
* j_d_defaults initializes out_color_space to CS_RGB. If you want grayscale
* output you should set out_color_space to CS_GRAYSCALE. Note that you can
* force grayscale output from a color JPEG file (though not vice versa).
*/
METHODDEF void
d_ui_method_selection (decompress_info_ptr cinfo)
{
static int
i, temp,
repaint,
video_mode_pointed; /* the video mode (index into ok_mode[] list currently selected */
/* setup important drawing info */
picture_x_size = cinfo->image_width;
picture_x_center = picture_x_size >> 1;
picture_y_size = cinfo->image_height;
picture_y_center = picture_y_size >> 1;
shrink = 1;
/* now check to see if we have the right H/W for the image
ie a picture with >> 256 colors can not be displayed on SVGA
-> if the picture has >> 256 colors fake a greyscale image for quick and dirty viewing
*/
/* if grayscale input, force grayscale output; */
/* else leave the output colorspace as set by main routine. */
if (cinfo->jpeg_color_space == CS_GRAYSCALE)
cinfo->out_color_space = CS_GRAYSCALE;
#ifdef small_viewer /* if it is small we only support non quantized grayscale */
cinfo->out_color_space = CS_GRAYSCALE;
#endif
/* select output routines */
cinfo->methods->output_init = output_init;
cinfo->methods->put_color_map = put_color_map;
cinfo->methods->output_term = output_term;
make_mode_list(cinfo);
/* - first find good window size */
video_mode_pointed = pick_screen_mode();
video_mode_used = ok_mode[video_mode_pointed];
/* setup enable pan because the user may have the menu turned off */
autocheck_panning(video_mode_used);
autocheck_shrinking(video_mode_used);
video_mode_pointed = pick_screen_mode();
video_mode_used = ok_mode[video_mode_pointed];
repaint = 1;
i = 0;
/*
* make sure we do this once if asked for
*
* this loop is only entered if the menu is being shown
*/
while ( (i != RTN) && (view_defaults & ask_size_bit)){
/* only clear and repaint if absolutely necessary - ie avoid the flicker */