Faultless #09
24 мая 1998

GFK Fraktiuit - Secrets of the graphic standards GX1.

<b>GFK Fraktiuit</b> - Secrets of the graphic standards GX1.
Topic: Secrets of the graphic standards GX1
Author: Fenev SV
---------------------------------------

  This article can serve as Dep
vnoy point for programmers who wish to use in their work
graphic standard GX1.

  Graphic images appearing on the screen, cause sometimes 
people carrying leading admiration for programmers professional 
interest. Which graphics Shell, that the format, what is the 
length of file that stores the image -

These and many other questions arise in
such situations, people who have represented
resistivity of the graphic capabilities inherent in the 
computer. 

  Specificity of the Soviet program, "Bazaar" - the spread of 
extremely vulnerable to copying software products - 
substantially restricted access to the world market of software 

  Among wandering on our computers
versions of most graphic editors
popular, perhaps, Paint
Brush Company ZSOFT. Used it
Packaging image format GX1 supported in many other software
Drugs, encountered in some games
Remember how often you met Faye
ly with the extension. gx1.

  Beyond doubt the feasibility packaging
graphic image, because for
store all the information from the screen to display adapter 
EGA mode 640 * 350 items, 16 colors, requires 128

KByte.

  "Picture" with the normal intensity
images compressed in a format GX1,
placed in a file length of approximately 15-25
KByte. Without giving comparative analysis format used (this
Material can be found in one of the closest
issue of electronic journal FAULTLESS)
note the compactness of this standard:
graphic design, packaged in GX1,
It takes approximately one and a half times
less memory capacity than the same figure, packaged in a format 
PCX. 


         Format structure GX1.

  File format GX1 has the following structure
structure:

  - Header file, a length of 3 bytes

  - Information about the used panel

    (For EGA)

  - Data describing the image.

  So, the file header:

  - 1 byte - FA - graphic, FB - tex

    The quantum regime

  - 2 bytes - the screen mode in a 16-chnom form

  - 3 bytes - the number of bytes in the color palette and

    Background:

      0 - CGA 40 * 25 monohr.tekst.

      1 - CGA 40 * 25 color. text.

      2 - CGA 80 * 25 monohr.tekst.

          (4 senior level)

      3 - CGA 80 * 25 color. text.

          0 - Dark

              green-red-brown

      4 - CGA 320 * 200 4 tsvet.graf.

          1 - Light

              green-red-yellow

                 ...

          2 - Dark

              blue-pink-white

      8 - HGC 720 * 348 monohr.graf.

          3 - Light

              blue-pink-white

      9 - EGA 640 * 350 monohr.graf.

          4 - dark

              blue-red-white

      A - EGA 320 * 200 16 tsvet.graf.

          5 - Bright

               blue-red-white

      B - EGA 640 * 200 16 tsvet.graf.

          6 - monochrome graph.

               CGA mode

      C - EGA 640 * 350 4 tsvet.graf.

          640 * 200

      D - EGA 640 * 350 16 tsvet.graf.

                 ...

        (4 LSB)

  0 - black 8 - Gray

  1 - blue 9 - bright blue

  2 - Green A - Light Green

  3 - Blue B - Light Blue

  4 - Red C - light red

  5 - Pink D - light pink

  6 - Brown E - yellow

  7 - White F - bright white

  The presence of the third byte must
even under conditions in which he has no
sense. Just above 3 bytes are not
are described below package.

  If you try to sort out the string
kture files with the extension. gx1, prosmat
By considering their content, it is likely
These attempts will fail. But the principle
ciples used in image compression, are rather trivial.


          Compression algorithm.

  When you create a file in a format GX1 are two of the 
algorithm. At the base of the first lies an indisputable fact: 
the horizontal line is often very slightly different from the 
next row image located above and below. Originally dedicated to 
the memory buffer is placed first upper row of images. After 
that each subsequent line compared with the previous byte, for

each line is formed by the so-called
map differences. So for graphics display adapter CGA mode 320 * 
200 elements every mapping string occupies 80 bytes. Packing

CA is as follows: map the differences formed a length of 10 
bytes each bit map corresponds to a byte string iso

mapping. If this bit - 1, hence
but the bytes in the current row is different from
byte of the previous line. New byte value is placed after the 
map. Number of bytes equal to the number of bits with value 1. 
This algorithm is called vertical compression. 

  Once the package is executed every
mapping, in the buffer data
compressed, is used in this version
familiar to many of the group method of coding. These are 
divided into groups, each of which begins with the total number 
meaning the number of repetitions tions of a byte. If the byte 
value occurs in a series of more than three times, then there 
is a "byte repetition." This Byte MSB unlike all the other 
installed in the unit, and the remaining bits indicate the 
number of repetitions bytes whose value can be found in the 
following byte. To make it clearer, we illustrate

this with specific examples. So, the next group (16-dimensional 
representation) 84 00 indicates the presence of four well

lei:

    2-ary representation:

        1000 0100 0000 0000

         > Bit-sign

  And FF 00 - respectively 127 zeros.
By the way, a number of repeated
values ​​can be encoded in two bytes using the method described 
above group coding.


  Together, these methods
provides a very compact
representation of graphic images.
In this case, there is a seal of information because of its 
specificity as a vertical and horizontally. When packing the 
screen in text mode only works the second method. At the same 
value of the first byte header, and hence, total

file is equal to FB.

Subject: The compression algorithm LZSS
Author: Unknown
---------------------------------------

              METHOD LZSS

  This scheme uses the algorithm of Lempel
(Lempel) and Ziv (Ziv). Slightly modified version described 
Storer (Storer) and Szymanski (Szymanski). Development, use

forming a binary tree to accelerate the search suggested that 
Bell (Bell). 

  We introduce the following definitions used
the description of the method.

  1. Input stream - is any file (data set), which should be 
compressed. 

  2. Output - is a file that
recorded the results of the method.

  3. The circular buffer is an array of some length, whose "end 
is connected to beginning ", that is, if working with it a 
pointer to jump beyond the end of this buffer, then it is 
automatically set to the top Similarly, if a pointer to cross 
the border beginning of the buffer, it will be installed in the 
end (the last item in the buffer). 

  4. The size of the ring buffer is usually 4,8,16, or 32 KB of 
data. 

  5. Maximum length sequences - a long sequence of characters 
that uniquely encode the packer. If the length of the sequence 
exceeds this value, then the packer will divide it into pieces 
no longer than the maximum. 

  6. Current index is a marker in the ring buffer, indicating 
the beginning of another uncompressed text.


  7. Forward-pointer - a marker of
circular buffer indicating the byte
following the last symbol is read from the input stream. 
Forward-decree Tel differs from the current pointer

maximum length sequences. In
this method, the maximum length sequence is 264, so 
forwardukazatel will be greater than the current 264. 

  8. A pointer to the beginning of the coincidence - it
marker in the ring buffer, which decrees
cates the beginning of a byte sequence is the sequence
bytes, the first symbol is set to the current index.

  Ring buffer initially filled with blanks. From the input 
stream in a circular buffer read sequence of bytes, the number 
which is equal to difference between forward-pointer from the 
current pointer in this case 264 bytes. 

  Current index is set to
beginning of the buffer and forward-pointer - in
the end of the read sequence and exact
it to the byte immediately following the last
symbol of the read data.

  We then proceed according to the algorithm:

  1. We are looking back on the length of the buffer (we assume 
that the buffer length is equal to 4 KB) naibolschuyu sequence 
of characters coinciding with the current, ie with the 
sequence, which is the beginning of the current schy pointer.


  2. Analyze the following situations:

   a) The length of the repeating sequence is equal to zero or 
one. The output stream to record: 1 bit (equal to unity -

a sign that more is nezapakovanny bytes), 8 bits (the current 
byte). Current Index increased by one.


  If you do not reach the end of the file, then read
Th symbol from the input stream and write
at forward-ukazatelya.Forward-pointer increment. Otherwise from
input stream, nothing to read and
forward-pointer does not increase.

  If the current pointer is forwardukazatelyu, the process is 
complete, otherwise go to step 1.


   b) The length of the repeating sequences of more than one. 
In the output stream to write: 1 bit (equal to zero - a sign 
that is packed on the sequence), 12 bits (offset back from the 
current pointer to an identical sequence sequence, the maximum 
displacement is 2 ^ 12 = 4096), the length of the repeating 
sequence: 

    1) in 3 bits, if the length from 2 to 8
(Coded 000 .. 110);

    2) 3 8 bits if the length from 9 to 264.
The first 3 bits contain a combination of 9 (111)
which means: the true length is
in the next 8 bits (length 9 .. 264, coded 00000000 .. 
11111111). 

  Current Index increased by
the length of repetitive sequences.
If you do not reach the end of the file, then consider
from the input stream for a number of
characters, equal to the length of repetitive sequences at 
forward-pointer. Forward-pointer to increase by the same length 
as the current index. 

  If end of file met earlier than
been read the required number of bytes, the
forward-pointer to read by increasing the number of bytes.

  Otherwise, the input stream does not read, forward-pointer 
does not change. 

  If the current pointer is forwardukazatelyu, then complete 
the process, otherwise go to p.1.Esli current index is 
forward-pointer, then complete the process, otherwise go to 
step 1. 

  It is worth noting a few nuances
in search: 1. If you implement the usual
search back at 4 Kbytes (for
this case) under which originally sought to match the first 
symbol, and If matched, then the second, etc., then this

means that the packer must for every byte of text to make at 
least 4097 comparisons: 4096 comparisons back and one

Comparison vpered.Netrudno guess what
package will be extremely slow
slowly. 2. We note an important point: as
uses a circular buffer, then if
looking back index jumped search
through the buffer, it automatically
Move to the end of the buffer. 3.Pri
compared to the coincidence index of coincidence can jump 
through the current pointer, as long as the top match was 
earlier this ukazatelya.Privedem example: 


     sequence length


     with and on for a while about a

             current pointer


     with and on for a while about a

             pointer to start matching


  and the text looks like this:
 and b but with a W on to with a shock of ASP and Art and 
Design Bureau 


  We give two examples of this
method:

 Example 1:
 Source text:



m and to m and m and m s for a while TT TT TT TT and



 Compressed text:
 1, "m", 1, "a", 1 "to", 0, 4,
 1b. 8b. 1b. 8b. 1b. 8b. 1b. 12b.
 0, 0, 2, 0,
 36. 16. 126. 36.
 1, "", 1, "m", 1, "s", 1 "to"
 1b. 8b. 1b. 8b. 1b. 8b. 1b. 8b.
 1, "B", 0, 6, 1, 0, 0,
 16. 86. 16. 126. 36. 16. 126.
 6, 1, "and"
 3b. 1b. 8b.

 Percentage compression = 160 bit/200 bit = 80.0%

 Example 2:
 Source text:


and b p and b to a to b and b to b to abrabkabkabk



   Compressed text:

 1, "a", 1, "b", 1, "p",
 1b. 8b. 1b. 8b. 1b. 8b.
 0, 3, 0, 1, "k", 0, 3, 4,
 16. 126. 36. 16. 86. 16. 12. 36.
 0, 5, 2, 0, 14, 7, 2
 1b. 12b. 3b. 1b. 12b. 3b. 8b.

 Percentage compression = 108 bit/216 bit = 50%

---------------------------------------

       Sample from FRACTINT.DOC


     Fractint Version 15.0 Page 27


    Barnsley IFS Fractals (type = ifs,
ifs3d) One of the most remarkable
spin-offs of fractal geometry is the
ability to "encode" realistic images in
very small sets of numbers-parameters
for a set of functions that map a region
of two-dimensional space onto itself. In
principle (and increasingly in
practice), a scene of any level of
complexity and detail can be stored as a
handful of numbers, achieving amazing
"Compression" ratios ... how about a
super-VGA image of a forest, more than
300,000 pixels at eight bits apiece,
from a 1-KB "seed" file? Again, Michael
Barnsley and his co-workers at the
Georgia Institute of Technology are to
be thanked for pushing the development
of these iterated function systems
(IFS).

    -Sean Burke

       Los Angeles, December 1991






Other articles:

ASM4KOFF - Run the compiled melodies. Loader at ACME. Using on-screen file ArtStudio (display). Maximum speed on the conclusion of sprites. As quickly as possible output points. Fastest up the stack.

CCLFSTM - All disk copier 128/512K.

CCLFSTM - The album "Backstreet Boys"

CCLFSTM - News from the Spark group

CCLFSTM - Description of system software: Power Code Decrusher v6.2

Demo Design - On the history demomeykinga.

Demo Design - Useful and interesting solution algorithms (implementation Fong).

Flash - The extension of the color palette ZX-Spectrum.

GFK Fraktiuit - Secrets of the graphic standards GX1.

LZW and GIF - Description of image formats. LZW and. GIF.

MUSICNEWS1 - Music kaleidoscope of pop ...

MUSICNEWS2 - METALL NEWS.

NEWS of Picon - The draft of the future ROMs. BASIC subroutine 48.

OPERATEXT - From the history of the demo Oper'y.

PRICE - Price list for products firm Scorpio.

RUSH - On the coterie in Chernigov, in April 1998.

SPECCY AF - Immortal Speccy.

Did you know - Passwords, eternal time and the bombs in the game Last Courier. Passwords for the game: X-Reversy; and muzykalkam: Branch of Mind demo, Diesirae demo. Hidden part in Faultless 2, 3, 4, 5, 8 (passwords) ...

Introduction - On the pros and cons of numbers.

Medem - The history of Zaporizhzhya modem.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Program BOX - New unusual boot - Program BOX v2.0.
Advertising - Advertising and announcements.

В этот день...   21 November