Six more parameters control what kinds of video card JAY will attempt to use, and color depth. But first, a description of the video mode selection process will help to understand the effect of these options.
Normally JAY assumes VGA mode 13 (320x200 display with 256 colors) is available, and it also tests for VESA functionality. The actual video mode is then determined by the size of the image as follows:
If the image is in color the smallest size video mode which can completely display the image is chosen. If DITHER=0 this mode must also be a HI-COLOR (32K colors) or TRUE COLOR (16M colors) mode. If no color mode can display the entire image, scaling is attempted from 7:8, to 1:8 in steps of 1.
If the image is monochrome, or MONO=TRUE, or scaling failed to allow complete display of the image, or DITHER=2, then the process is performed using only the 256 color modes.
When using the 256 color modes JAY will dither the colors using a preset palette unless MONO has been set true, in which case JAY uses a palette of 256 grey tones.
|MONO||a boolean value which, if true, forces JAY to use monochromatic rendering.
The default for MONO is FALSE
|DITHER||a numerical value which determines when a 256 color palette may be used.
In most cases it is better to allow some image reduction rather than use a dithered rendering since the reduction in color depth will almost always produce a "palettized" appearance, wheareas the method used to reduce image size eliminates aliasing, even at the 1:8 ratio.
The default for DITHER is 0 (only when no other method)
|VGA||a boolean value which, if false, disables video mode 13.
The default for VGA is TRUE
|VESA||a boolean value which, if false, disables the VESA modes.
The default for VESA is TRUE
|MAXWIDE||Specifies the maximum display width mode to use. This can be used to limit
JAY to modes which, although supported by the video card, exceed the capability of the
default = 1024
|ERASE||a boolean value which, if FALSE, will not erase the previous image if the
next image can be rendered in the same video mode.
default = TRUE
MONO can be used to force monochromatic displays, which can sometimes have higher resolution than the color counterpart due to video memory limitations, and, therefore, avoid the decimation process used in scaling.
Some answers to some common questions
Q. How accurate is the rendering of JAY?
A. As accurate as the video mode being used allows. There was no sacrifice in accuracy used to achieve the speed, only better math.
Q. Does JAY interpolate pixels during reduction or monochromatic rendering?
A. No, reduction is done by using a modification of the IDCT process to yield fewer pixels per coding block. This not only reduces errors, but is actually faster than interpolation. Monochrome images are rendered by simply discarding the color information, if any. JPEG images are stored in a color space called YCbCr, which stands for luminance (Y), chrominance-blue (Cb) and chrominance-red (Cr), by ignoring CbCr a monochrome image is obtained with less work.
Note: it is for these reasons that some programs can very rapidly produce monochromatic thumbnail images, usually at 1/8th the width and height, by discarding the color data and skipping the IDCT altogether.
Q. If you use only integer math, why does JAY require a 386 or better
A. The answer to this one has nothing to do with integer vs floating point math, but the methods used in two areas required 32-bit registers or 386 instructions to perform well. One area is the process of extracting the Huffman encoded data from the file, and the other deals with the very large numbers at the end of the IDCT and beginning of color space conversion. An 8086 version could be written, but very few machines prior to the 386 are still in existance or outfitted with VGA or SVGA displays.
Q. What is this strange background on the JAY page?
A. It is a code fragment from JAY, in it you can see how the YCbCr information is changed into RGB information for the Green color element. (However, this is an older version than is currently used)
Back to MPUCoder Home
Background image: "Forming the green element" code fragment from JAY.