ACNews #13
31 октября 2002

Guide - The format of the packed tricolor .888.

<b>Guide</b> - The format of the packed tricolor .888.
■ ■ ■ ■ ■ ■ ■ ■ ■

  ■ ■ ■ ■ ■ ■ ■ ■ ■ ■


               Format packed tricolor .888

Files in this format will be generated editor 8col, starting 
with version v0. Of course, the support of all the old formats 
remain as to read and write. 

Heading out!
The body file contains data about the contents of consecutive
familiarity 8x8 (left to right, top to bottom, 32 familiarity 
in the horizontal and 24 vertical). In total there are 8 colors 
- 2 gradation for each color component: G, R, B.


The body of the file are mixed 2 streams: bit and byte, similar 
to format hrust2.1 (see AlCoNews # 11). Bit stream is a 
trustee, the first byte of the file belongs to him. 

Record of each member of familiarity of the fields:
3 bits - the type of color (specifies the number of colors)
[Optional] - use colors in order of increasing frequently
   you (ie, starting with the very rare)
[Optional] as a bit or perhaps 24 bytes - pix
   lnye familiarity data according to its type.

Types of color:
0 - 8-color familiarity, in the byte stream is 24 bytes of data
   GOVERNMENTAL, by 3 bytes (in the order R, G, B) for each 
pixel line 

   familiarity. (A byte stream, except as here, nowhere else

   used.) Palette missing.
1 - used the latter use is not 8-color type color
   In particular, the palette also taken the old one.
2 - monochrome familiarity. In the palette of one item, 
indicating 

   this color. Element palette takes 3 bits: G, R, B. Pixel
   experimental data available.
3 - two-tone familiarity. In the pixel data are pixels

   left to right, top to bottom, 1 bit per pixel. 0 - Naib
   most frequent pixel (the last element of the palette), 1 - 
most 

   rare pixel (the first element of the palette).
4 - tricolor familiarity. Color pixels are coded: 0, 10, 11

   (In descending order of frequency, ie, in descending order 
of numbers 

   panel).
5 - four-familiarity. Color pixels are coded: 00,

   01, 10, 11 (in descending order of frequency).
6 - five-colored familiarity. Color pixels are coded: 00, 01,

   10, 110, 111 (in descending order of frequency).
7 - six-color familiarity. Color pixels are coded: 00, 01,

   100, 101, 110, 111 (in descending order of frequency).

Compression ratio of the average trikoloriny slightly stronger 
than hrust2.1, at the same compression rate is many times 
higher. 

Unpacking:

; Palette is not remembered if
, 8 colors, or using the old palette

The color in reverse order: starting with the rare

FROM = # D000
TO = # 8000

        ORG # 6000
TCOL_S; DS 6
GO

        LD HL, FROM

        LD C, 128

        EXX

        LD HL, TO

        LD DE, 125

        LD C, 1
DEP EXX

        CALL DEP3

        CALL NZ, oldcl

        JR NZ, COLQQ

        LD B, 8
COL80 LD E, (HL); R

        INC HL

        LD D, (HL); G

        INC HL
; (DE) =% 0GRB0grb

       DUP 4

        XOR A

        RL D

        RLA

        RL E

        RLA

        RLC (HL)

        RLA

        ADD A, A

        RL D

        RLA

        RL E

        RLA

        RLC (HL)

        RLA

        EXX

        LD (HL), A

        INC L

        EXX

       EDUP

        ORG $ -2

        ADD HL, DE

        EXX

        INC HL

        DJNZ COL80
COLQQ EXX

        LD A, H

        INC L, L, L, L

        JP PE, $ +6

        SUB 4

        LD H, A

        RES 7, L

        CP 'TO +96

        JP C, DEP
CHL LD C, (HL)

        INC HL

        RL C

        RET

oldcl LD D, 'TCOL_S

        DEC A

        JR Z, COLOLD

        LD LX, A

        LD E, A
DEPTAB CALL DEP3

        DEC E

        LD (DE), A

        JR NZ, DEPTAB
COLOLD LD A, LX

        LD B, 64

        CP 4

        JR NC, COL45O

        DEC A

        JR Z, COL1

        DEC A

        JR Z, COL2
2 = 11
, 1 = 10
, 0 = 0
COL3

        LD A, # 80

        CALL DEPCOL0

        JR Z, COL3N1

       SLA C

       CALL Z, CHL

        RLA

        DEC A
COL3N1 CALL PUTCOL

        DJNZ COL3

        RET
, 1 = 1
, 0 = 0
COL2

        LD A, # 80

        CALL DEPCOL0

        CALL PUTCOL

        DJNZ COL2

        RET
COL45O

        JR Z, COL4

        RRA

        JR C, COL5
, 5 = 111
4 = 110
3 = 101
2 = 100
, 1 = 01
, 0 = 00
COL6 LD A, # 40

        CALL DEPCOL0

        CP 2

        JR C, COL6N1

        DEC A

        SLA C

        CALL Z, CHL

        RLA
COL6N1 CALL PUTCOL

        DJNZ COL6

        RET
4 = 111
3 = 110
2 = 10
, 1 = 01
, 0 = 00
COL5 LD A, # 40

        CALL DEPCOL0

        CP 3

        JR C, COL5N1

        SLA C

        CALL Z, CHL

        RLA

        SUB 3
COL5N1 CALL PUTCOL

        DJNZ COL5

        RET
3 = 11
2 = 10
, 1 = 01
, 0 = 00
COL4

        LD A, # 40

        CALL DEPCOL0

        CALL PUTCOL

        DJNZ COL4

        RET
COL1

        LD A, (DE)

        LD D, A

        RLCA

        RLCA

        RLCA

        RLCA

        OR D

        EXX

        LD B, 8
COL10 LD (HL), A

        INC L

        LD (HL), A

        INC L

        LD (HL), A

        INC L

        LD (HL), A

        ADD HL, DE

        DJNZ COL10

        EXX

        RET

PUTCOL LD E, A

        LD A, (DE)

        EXX

       RLD

       LD A, C

       AND # 2A

       JR Z, $ +3

       INC L

       RLC C

       JR NC, $ +3

       ADD HL, DE

        EXX

        RET
DEP3

        LD A, # 20
DEPCOL0 SLA C

        CALL Z, CHL

        ADC A, A

        JR NC, DEPCOL0

        RET




Other articles:

News - Do John'a burned pentagon, Slip / Ottodix released a new game The Dune: Imperia II, news of Vitamin / caig, we completed the Nik-O Rule The Compo.

Olds - criticism Alone Coder Journal Kpuk # 2.

Guide - The format of the packed tricolor .888.

Fun - music chart from Alone Coder.

Honor and Eternal - List of Honored Members AC Edit.


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

Similar articles:
Authoring - Presentation of a Copy CLV COPIER v1.0, and programs to record digital audio DSRv2.0.
Presentation - All programs: TOP COPY
Event - a survey of visitors Spectrum Amiga-pisishnoy exhibition and sale of Baltic Suscess.

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