Inferno #10
30 апреля 2007

Opportunities Spectrum - The format ani-files on the ZX.

<b>Opportunities Spectrum</b> - The format ani-files on the ZX.
         Ani-format files on the ZX

  (Program JpeGif Laboratory (GFXcon),

        Little Viewer, Ani Editor)

Sam Style

+00 "GIF animation": the signature
+13 = 0
14 Size of X in familiarity (1-32)
15 the size of the Y in pixels (1-192)
+16 ... Data animation (frames)


   Animation is a sequence
sequence of frames. For each frame on
beginning of the next two bytes:

0 frame duration of 1 / 50 sec
A type of packaging frame


   If the duration = 255 or the type of packaging
player is not recognized, then the cartoon Returning
is the very first frame.

   And the converter, and a beta editor chooses
the best method of packing of the 9 available
(By the method of image compression).

---- Type 0


   This neupakovany sprite in a linear form
mate. It happens that in any frame of any one
another method is not clinging.

   In the presence of colored string attribute is
after every 8 lines of the image.

---- Type 1


   Taken from the article "Compressing Graphics Institute
formation and that this can be obtained "by
Vitamin/CAIG/2001.

   Frame is divided into familiarity (size
on Y increases to the nearest multiple
8 numbers). Consider the packaging of the mark
 Attraction:

     # 55, # ff, # 55, # ff, # ff, # ff, # 50, # 05

   Starting from the second byte of doing XOR'ing
 with the previous:

     # 55, # aa, # aa, # aa, # 00, # 00, # af, # 55

   We will create a flag byte - note the zero
vym bit bytes that are equal to the previous one,
and single bit, which is not equal. For
1 byte of the previous is 0. Only
bits in reverse order - the right bits correspond
 denotes the first byte. Obtain:

          1,1,0,1,0,0,1,1 = # D3

   Now we derive the flow initially a flag
bytes, and then - those bytes XOR'inga for which
 ryh bit set in the flag byte:

         # D3, # 55, # AA, # 00, # AF, # 1955

   As a result, instead of 8 bytes of familiarity floor
Chile 6 byte packed format.

   Unpacking is the following algorithm
Therefore:

byte = 0
xorbyte = 0
flag = flag byte
 Cycle 8

  RR flag

  if carry = 1

   then take from the stream of new xorbyte

  byte = byte xor xorbyte
 output byte on the screen
KC


   The number of packed blocks, natural
but equal to that of familiarity in the frame. Familiar
hundred packed left to right, top to bottom
(Ie first series of the top, then the next
series, and so to the bottom).

---- Type 2


   Very similar to type 1, but in a byte of flags
reset bits corresponding to zeros in
XOR'inge. Ie As an example of the type 1 flags
 will:

          1,1,0,0,1,1,1,1 = # CF

    And the stream will give

       # CF, # 55, # AA, # AA, # AA, # AF, # 1955

   There turned out that the gain is minimal, but
This does not mean he is worse than type 1.

   Here unpacking this:

byte = 0
flag = flag byte
 Cycle 8

  RR flag

  if carry = 1

   then byte = byte xor (byte from the stream)
 output byte on the screen
KC

---- Type 3


   This is the same type 1, but In the name of
location does not appear directly on the screen, and the
imposes to XOR the corresponding values
COMEST previous frame.

---- Type 4


   Similarly: the frame is packed type 2 and
XOR is applied to the previous one.

   If the frame does not change much, in Achiev
ltate his XOR'inga the previous frame
get a lot of empty familiarity that
packaged the best, and in this case the type of
3 and type 4 is a cut above other types of
packaging.

   Now on new types:

---- Types 5.9


   This type of compressed 1-4.Vvoditsya that
some notion of how to flag the 2 nd urovnya.Bity it
determine the state of the flag byte flag
gov for 8 following behind him familiarity. If
bit = 0 then flag = 0 (in this case, the flow
written only color, and even then, if it exists)
and if = 1, then the flag is not zero, and the unit goes into
flow for the full program (flag, data, and
could, color).

   An example:

   Assume packed frame (for the latitude
outlook will be unpacked with color)
begins ...

DB% 10010000
DB 1
DB 2
DB 3
DB 4
DB% 00100001, # FF, # 55,5
DB 6
DB 7
DB% 10000000, # 77.1


   The first byte - indicates level 2. Enjoying
the state of the bits, starting from zero
(Right):

0 - block is empty (types 5,6) or unchanged

    (Types 7,8). From the data block in the flow

    only the color (= 1)
0 - the same (color 2)
0 - the same (color 3)
0 - the same (color 4)
1 - Aha! Block in the flow is fully lined.

    Take the flag of the block (% 00100001) and

    according to the type extract

    block. 5 Color
0 - block is empty. 6 Color
0 - block is empty. Color 7
1 - a full block. (Flag% 10000000, data

    # 77, color 1.)


   All you have finished with 8 blocks ...

   Then you need the same thing - a flag 2-nd
level, and all that attached to it.

   Of course, the total number of blocks in the frame is not
necessarily a multiple of 8. In such cases,
unnecessary bits of the last flag Tier 2
are not counted.

   What we get from this? Each zero
byte flags shrinks to 1-bit flag 2-nd
level, but every non-zero decay
Hayot to 9 bits. For example, a completely blank
frame without color uzhmetsya the terrible 64 times
(First, empty familiarity huddle in
Zero the flags byte, and secondly, each
Zero the flags byte clinging to the 1-bit flag
2-Tier).

---- Now about the color


   Information on the availability of color and packed
VKY (yes, it is also there!) to senior
bits of the frame type.

b7 = 0 if no color flow (ie, it

       completely identical to the flow

        previous frame)

   = 1 if it is
b6 = 0, if the color is not encoded (ie

       each packed with familiarity comes

        1 byte color)

   = 1 if the coded (passed

       familiarity with the unchanging color)


   And now I say a piece of paper ...

   When packing the color entered and controlled more
flax bytes for color. Very, very similar
the flag of the Level 2 - if it bit = 0,
the color of familiarity is not changed with respect to
Niya to the previous frame and the flow otsuts
tvuet. If bit = 1, then follow the sign
place is its color. As the flag 2 nd UB
vnya, coat color occurs every 8 characters
places. If both of these flags are present (in
For example, type 5 with a packed color: # C5), then
always comes first flag level 2, but for
it - the flag colors.

   Gross flow diagram of the frame as you like
looks like this:

[Duration]
[Type] b0 .. 5 - Packaging Type

                 b6 - color pressed

                 b7 - color is present
[Flag Level 2] only for types 09.05

                 (Detects the presence of steam

                 [Flag] [block])
[Flag color] only for compressed

                 color (detects

                 component [color])
[Flag 1] [block 1] [color 1]
[Flag 2] [Unit 2] [color 2]
[Flag 3] [Unit 3] [color 3]
[Flag 4] [Unit 4] [4 color]
[Flag 5] [Unit 5] [5 color]
[Flag 6] [Unit 6] [color 6]
[Flag 7], [Block 7] [color 7]
[Flag 8] [Box 8] [color 8]
[Flag Level 2]
...


   Well, as always, the priority in choosing T
na package (and images, and colors) - again
measures ...




Other articles:

Likbez - Batteries. Practices.

Likbez - Batteries. Results of experiments with different batteries.

Opportunities Spectrum - The format ani-files on the ZX.

Inferno - The authors of the magazine.

Opportunities Spectrum - How to play multichannel music on beeper.

Opportunities Spectrum - Support for the DVD format on ZX.

Gameland - On the competition absurd (or clumsy) games for the ZX Spectrum - Crap Games Competition.

Graphics - How to quickly draw colorful pictures.

Inferno - Entered from the editor.

Inferno - Errors in the previous numbers.

For Coderz - Gray code and optimization programs.

For Coderz - Building a graphical user interface.

Formats - details on the decoder jpeg.

Iron - Description of Products K561PU4.

Inferno - Letters to the Editor.

Formats - The format of a packed file MegaLZ.

Scorpion ZS - The structure of the markup on a computer hard drive Scorpion.

ZX Clones - multiplatform on the ZX Spectrum. Computers SAM Coupe and MSX.

Advertising - Advertising NedoPC.

Inferno - On the shell.

Activities - The "Spectrum" at the competition on the night orienteering Okinchitsa 2004.

Softinka - Comparative table of the results of packing code files with various packers.

Advertising - Advertising King of Evil.

Softinka - Software for printing in the annex to the magazine.

Softinka - Music Editor Pro Tracker v3.71. Revision history.

Advertising - Ads by V. Bogdanovich.

Iron - Some RND-generators.

Opportunities Spectrum - A hardware scrolling on ZX Spectrum.

Pentagon - Sinhroselektor video at Pentagon. Problems and the scheme.

DIY - Universal TAPE interface. Scheme of loading and recording tapes.

Sound - Features audio device TurboSound FM.

DIY - The scheme of the analyzer state TTL output.

Future Spectrum - Video Display V9990. Enhanced graphics capabilities ZX Spectrum.

Softinka - Updates to the image viewer: ANSI viewer, MCX viewer.

Interview - An interview with musician X-Raizor of Omega Hackers Group.


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

Similar articles:
Notes programmer - bug monitor debugger ZS Scorpion 256.
From the world of bat - an interview with a group of STEP (the creators Spectrofon and Star Heritage).
XOR'em ALL - Ksorka with the team LDIR, Inverse ksorki.
Iron - The scheme of the converter 5 -> 12 for feeding VGshki.

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