Demo or Die #01
28 февраля 1999

Video - Converting animation on the example attribute the video.

<b>Video</b> - Converting animation on the example
 attribute the video.
__________________________________________

Author: Rain / April
Music: Foxx / April

 Converting animation on the example

           attribute Videos

1. Entry


   Recently, a very strong steel
growing trend towards the use of
demostroenii animated inserts. This we
can see an example of dem, both
Binary Love, Forever, Power Up, Refresh,
Blame, Shit 4 brains ... Using
qualitatively skonverchennoy animation Deme
not only beautify the latest, but will brighten
many flaws and omissions. :) And do not
believe people who say that
Animation - suxx. Everything is good in moderation.
Importantly, based on what beauty is in the
world - is the golden mean. These people
night quietly include blue screens
their TVs and monitors, and with widely
eyed look of cartoons
Star Heritage and Black Crow ...


   First of all, the animation should be divided into
two groups: the animation is finished
(Multiple avi, fli, flc, gif, mpeg,
video discs), and animation created by
pc / amiga is designed to transfer
at the Spectrum. Matters relating to
I am creating here will not be regarded as
because we study the process of converting
ready-made cartoons, movies and the like.
If your intention is to make a movie,
For example, in 3D Studio Max, then everything is
just great and the quality factor
distillation rush to 100%. If you
understand why - read on.

2. Problem Statement


   So, we need to overtake on the Spectrum
avi file. Shall not overtake it in the form
chunks, we will not overtake him in
dvuhbitnom interlaced mode. Will
original - make a video attribute.

   I hope you know what
attributes? Hopefully, yes. You
probably have seen many attribute
plasma, panoramic roto zoomer'y and
Voxel space? So our
attribute of video and will be built on this
technology.

   What do we have? 32x24 = 768 bytes of attributes.
15 colors - you might say. Enough. Topics
more in the resolution 32x24. However, if
screen to fill in a form Paterno -
the number of pseudocolor sharply
increase. Have a look at some of Vibrations with
Enlight96 - where merging two balls.
Here you have one example of Paterno.
Paterno could be any number of species.
They represent the texture 8x8
pixels, which fills the screen for
subsequent coloring attributes. When
Seen from afar the eye area generalizes
images, making patern
responsible for the mixing proportion Ink
and Paper.

For example, patern:

10101010
00000000
10101010
00000000
10101010
00000000
10101010
00000000


   allows the use of combinations
two standard colors as the ink,
bright paper and create eight
pseudocolor!

p

Red - 2 Yellow - 6:

ink paper bright
 2 6 0
 6 2 0
 2 2 0
 6 6 0
 2 6 1
 6 2 1
 2 2 1
 6 6 1


   But we still take the patern simpler, although
no fundamental difference.
Surely, you already saw somewhere:

10101010
01010101
10101010
01010101
10101010
01010101
10101010
01010101


   As is evident from its structure, ink and paper
are absolutely equal. It allows
create two colors 6 pseudocolor:



But back to our avi.
Its characteristics are:
Frame size: 232x164
Fps: 25
Colors: 65536


   Not bad. Fps leave the same.
Permission will have to reduce. If
preserve the aspect ratio decreases (4:3),
then 232x164 -> 34x24. We'll have more on the edges
to cut up to 32x24. And how many colors
will attribute our videos?

3. Creating a palette


   Take an Art Studio and draw all
Possible false color, which can be
obtained with the help of our Paterna. Not
difficult to show that there will be 71. Will not
deal here combinatorics - it's
I believe so. :) Just take the paper
0. And going through all the ink from 0 to 7 draw
squares pseudocolor. Then take
paper 1 and iterate over the ink from 1 to 7. And so
on. Then repeat the same thing with
bright on. Do not forget that the black
color is not bright. Got some
similarity of palette.

atr1.scr


   However, to work with her on
pc / amiga need to bring it into either a
standard. Assume that this standard will be RGB
8 bits per channel - or what is called True
Color - more than 16 million colors.


   It is time to decide what we will
work on the pc, but not on the mysterious
Amiga nicknamed rulez.


   First translate our picture of Art
Studio in some sort of normal
graphics format (bmp, pcx, png ...) For
this, we use a ZX Screen
Viewer by Oldman for win32, which
allows you to record bmp images
using three (!) possibilities
represent colors Spectrum or
grabanem screen from view $ by Busy. This is a very
responsible operation because of the fact
interpreted as a color in the Spectrum
viewer'e this will depend on the final
result. Both of the above programs
Spectrum shows a picture very
similar to the original - the authors successfully
picked up the palette. Personally, I do
used all his. You too can do it
do, why there you have a palette RGB by
Busy, corresponding to the standard 15
colors of the Spectrum:


   0 1 2 3 4 5 6 7
R 0 0 191 191 0 0 191 191
G 0 0 0 0 191 191 191 191
B 0 191 0 191 0 191 0 191


   With bright:


   1b 2b 3b 4b 5b 6b 7b
R 0,255,255 0 0,255,255
G 0 0 0 248 248 248 248
B 255 0 255 0 255 0 255


   Next, we need to Adobe Photoshop
version higher than 4.0. Download it to our
picture. Clear to everyone that if we now
blur it, the new palette will be
required. Translate the image in RGB mode
and apply the filter Mosaic (Mosaic) with
parameter 8 pixels (This filter
changes the color of the field on average). Now
Using the Dropper tool, we can
poke him in the obtained color
squares, so that with my own eyes
contemplate options RGB. If you poke
very carefully, or just a good look,
you will notice that many of the false color
after smearing were identical. : (But since
it should be - the sum of their constituent
RGB components are equal. Using the eraser
erase duplicates of identical colors. So, for
the screen remains black and 52 squares
background. 53 colors. That's how much and allows
is to create our patern.

atr2.scr


   Now we face the challenge: Write
array whose elements have been
ready to attribute byte, and the index was
to color in the RGB palette. And create a palette
for pc, elements of which would be
components of RGB. For each of the colors 0-52
we should have three RGB bytes and bytes
attributes. Two files. This can be done
in many ways. I did: first
manually created a file of 53 bytes
contents of which are the bytes of attributes
located in approximately the
order in which I drew them. Then in
Adobe did change the picture->
indexed color-> custom palette.
Before me was the editor palette.
We select all the cells in the mouse and palette
release the left mouse button. We choose the initial
0,0,0 RGB color and the final 0,0,0 RGB. This
We cleanse the palette. Now, starting with
the first cell will fill palette
poking a pipette to the region pictures
appropriate bytes of the file attribute.
Number of cells will be color-index
(0-52) to fill all cells
keep the palette. act

   Now everything is great! For
dull again: We have received two
file. Taking any number 0-52 and using
it as an index, you can learn from
first file - an attribute byte, and from
second - 3 bytes of the components R, G, B.

4. Convert

4.1 Expansion of the footage


   This is most easily done using
Program Adobe Premiere 4.2, it
understands almost any video format
with respectively the established
ACM drivers video compression. Open our
. Avi in ​​Adobe Premiere. Create a new
draft mode, the maximum
relevant to our file. For us:
Offline video tape - PAL: 384x288, 25 fps.
Drag your mouse our. Avi in ​​window
Construction Window. Now, using
any preview, and permotki
listening, moving the yellow
stripes at the top Construction Window
we highlight a portion of the roller. Now
make the Make-> Make movie-> Output options.
Disable the audio, we introduce a frame size
232x164 (disabling the 4:3 ratio), in the window
output as establish a bitmap sequence,
Enter a name and save. The result was a mountain bmp
files occupy a huge amount
places that we actually need.

4.2 Distillation in a convenient size and

    palette.


   This is done using Adobe Photoshop
4.0 Take any picture from our
file. In the window of Operations will begin recording
new macro. For quality of the distillation
you must first remove the image small
details contours. They still do not visible in
32x24, they only create extraneous
shades. This is done as follows:
First apply to the frame of the sequence
two filters: Other-> High and
Other-> Minimum. This will get rid of
thin dark outlines on the
cartoon image. Then
apply filter 'Smart' Blur - Smart
blur. Parameters have to pick ourselves. This
provide a uniform coloring of the frame,
removes defects associated with loss and
distortion during compression. Now change
brightness / contrast to taste (brightness
-20 - +20; Contrast - +10 - +80), or
find experimentally. Scale
Kartika in 34x24 pixels, using
interpolation of neighbor. Bicubic
interpolation creates a lot of unnecessary
shades. Circumcised pixels -
32x24. Now the most important thing: translate
Picture Mode-> Indexed Color.
Choose a custom palette - ours, which
we've done. There are two ways to transfer:
dither and ordered. Dither - missing
colors in the picture will be displayed by
selection of neighbors. But this we do not need, so
as there is such a mess ... Choose
ordered - when each of the 16 million
colors chosen from the most similar
custom palettes. Oops. Click Stop to
window operations (all of our actions
written as a macro) Now click
button with an arrow to the right by the window
Operation. Select the point Packet
treatment. Set our source directory
bmp from Adobe Premiere, directory
result and our opertsatsiyu macros. Go
tea / vodka - optional.

end of part 1

part 2

4.3 Distillation at the Spectrum.


   So we have a bunch of bmp. Outstrip
very simple. We will not go into the format
bmp file, except to say that the screen is stored
at the end of the file upside down.
For example, you have a picture 4x4:

abcd
efgh
ijkl

Will be in the form of bmp:

0 (?) Header
+? (?) Palette
+? (?) Raster:

       ijkl

       efgh

       abcd


   Element of the matrix (0-52) and will be an index
the RGB palette. Hence, we take an element
raster. Choose from an array of attributes
element with this index. Put it in
an attribute file to the desired mecto.
Write. The next frame. And so on.
Personally, I have all this worked
program written in Borland C + +,
which conducted the entire process for
second. And then every two interrupts
toss in the frame on the screen, unforgettable
pre-fill it with Paterno.

5. Compression


   I will not go into detail algorithm
I'll just say the basic principles. Not packed
easy shots, and the difference between them. In
different cases need a different algorithm. For
this: create a movie not just from staff,
but only their differences. Ie place
attribute in the new frame just in case
if it is not in the previous year. Otherwise,
Writes a byte of attributes is equal to 0. When
Do not forget to rename the palette
0-color attribute to what some other -
For example, ink 7, flash 1. (So ​​you do not
perceived it as a lack of differences from
previous frame). Then scroll through the entire
film, drawing attention to the nature of
information. In my case, the differences
consisted of 20-60 randomly
located attributes on the screen,
in fact, never repetitive, and not
located next to each other. Sometimes,
however, when a sharp change of image
there was something else. I
chosen compression method, which
mainly include the prefixes for
changes in displacement (of several kinds of
range) and the prefix for encoding
identical bytes of consecutive
(Rle). Very useful to examine this
an attribute roll for discarding of
unused palette of colors. In my
case of the 53 colors in Photoshop all
animation only used 40. This gave
opportunity for the introduction of bit fields:

76543210
XXYYZZZZ


   Golf YYZZZZ (0-63) is used to
store color (0-39).

   XX field in most cases is responsible
short relative offset (1 -
4 familiarity)

   If both bits are set to field YY
1, then the field together with the field ZZZZ XX
means the displacement of the average range (5 -
68 familiarity).

   If the field YYZZZZ more than 39 but less than
48, it refers to the various commands
whose parameters are given in the following
bytes.


   Command-prefix:


   End of frame, long offset (0-767
familiarity), repetition (familiarity 2-17)
long repetition (familiarity 0-767).

   As a result, it turns out quite
not bad. 706 frames of 768 bytes
packaged somewhere in 77 kb. Ratio - 15%
!

   The program, written by me again on the
BC + + thrown away unused colors
create a new palette, compressed and
sliced ​​into blocks of just under 16 KB. I
not even imagine such a process to
Spectrum. A lot of things without any help
pc to almost useless. With regard to
Amiga, the people it almost does not know -
write a wrapper attribute video
ordinary user Amiga would have been very
problematic.

6. Player


   Since decompressing the different frames
needed at different times, the player
need to calculate, if passed by
time output the previous frame is
two interrupts (at 25 fps). If it has been
one - we must wait. Otherwise -
kick start the frame. I'm also still
made a change to an inverted Paterna
each interrupt with two
screens. This creates the illusion of greater
blur. In this case, a frame from the buffer
at maximum speed with a stack
discarded in the early termination on both
screen. By the way, I made myself a player,
that if no time frame for the unpacked
two interrupts, then winks at Border
red. However, as shown
practice, you have virtually no rights
see a wink. ;)

7. Convert your videos


   If you create videos directly attribute
in 3D Studio Max, or some sort of
another program, all strongly
simplified. You will immediately carry out the process in
desired resolution with the correct palette. In
this case, everything will look just
perfect. Unless of course you will not be
granulate with the details.

8. Future prospects


   Can be put on stream creation
attribute video flops. Above described
Automation is capable of converting videos
gigabytes. It would be that. Indeed, because of
low-resolution animation need to
large images - cartoons, flights
over cities, lakes, forests, mountains ...
Tour of the solar system, too
would look bad. But the firing of the
automata and scuffle in the dark gray
lane would never looked. You would
simply did not understand anything from the mash
attributes.


   When creating a video disc is not necessary
break in the frame on the sector. Must
consider the disk as a continuous file -
this will give Dramatic capacity.
True, the 25 fps does not succeed, but will
very nice.


   Paterno using the new form can be
achieve even more
pseudocolor.


   Compression can be complicated. For example,
introduce almost no language to describe
graphic primitives, which
split shot. Apply mpeg methods
prevents only performance. Can
packing every frame has the top
Hafmanom, but this again depends on the fps, and
content of the file - Speccy might not
time to unpack. Knowing the way of packing
You can adjust the image slightly
for better compression - method losses.
In short, the field of research is still very
widely.


   As for quality - a lot
options, filters and programs was not
tested. I did not even took on a powerful
package Corel - but there is a medium very
powerful video processing. Who knows, maybe
money can be raised by another order of magnitude -
seemed to me not very logical choice
Photoshop'om most resembling the color of the
custom palette for the combination of RGB.

9. Conclusion


   All the above-described can help you, even
If you are a video and do not go near
going. For example, have been described
processes that are necessary and mandatory for
convert any graphics
information. Perhaps you are afraid to stop
use a reputable software package and
means of production created, it seemed
would certainly not atribunogo video.
It is likely that you have found here is
that the long sought, without which your life was
painful. (As Vyacheslav Mednonogov not
knew about the possibility of batch processing
files in Adobe Photoshop 4.0). Certainly,
All of the techniques useful for
Any other type of video - and chunk'ovyh
normal, reproducing from memory and with
disc.

   By the way, I was very impressed authors
Plutonium # 11 - more specifically, a
Lynx / Infotek. He talks about the so-
mpeg compression methods called by
Packing no less than the difference between
personnel. Moreover, he argues that
This method mpeg compression was first
carried out in the intro to the game MegaBoom
(Tricolor flicker in the corner of the screen) by some
Kovinovym. Yes. Want to cry and
laugh. The boy must have heard about
that if well-packed - it mpeg. But
he had never heard of that method
compression of the difference between frames was
invented yet when he - the author of the article
Plutonium - was still only in draft. ;)
These old formats like FLI, FLC
reproducible to 80,286 were not applying
only this method for packing. Guy
just do not know what to mpeg implies
complicated mathematical analysis, prediction
the next frame on the basis of previous
generation corrections. Not without reason the format
mpeg born and has become widely
used only with the advent
CPU pentium. This again suggests
incompetence of the authors of some
articles about how low the quality of
Spectrum of most publications. I
also very much want to see and appreciate
video discs, released by some
advanced stsenovymi groups. Quite
probably I'll do them myself
production. And now - bye!


                          9.03.99 20:00:21

    2:5025 / 54.29 @ FidoNet to: Alex Baskakov
__________________________________________







Other articles:

Demo-Building - an algorithm to PROCESSING visibility of surfaces 3D-figup.

Demo-Building - Fill the triangle Gupo shading, texture mapping.

Demo-Building - Proetsirvoanie 3D> 2D.

Demo-Building - filtration pastpovyh izobpazheny. An algorithm to postpoeniya bugpyvistyh of surfaces. Flame effect. blurring in fast movement. Sharpening

Digital Design - A new music editor for digital music.

Greetz - Greetings to all who have not yet dropped the most Kulnev complex in the world - Spectrum!!!

Partys - Sonstructions Chaos 1999 about budschem demopati.

Slang - Slenogovy dictionary demoscene.

Turbo / Slow - The scheme uskoryalki and Lagsters com.

Video - Converting animation on the example attribute the video.

Interview - Random / Chaos Constructions.

Interview - An interview with Lithuanian musicians zHenYa / zERo.

From pedaktsii - From the authors.

Application - Pinkword, Digital Desing.

Advertising - Advertising and announcements.


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

Similar articles:
Simm on ZX! - On connecting 30-pin Simm to ZX.
Iron - CONTROLLER Flash / RAM / ROM-DISK, ZX LPRINT III, AY-8910.

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