Changes between Version 1 and Version 2 of Develop/FileFormats/PKM


Ignore:
Timestamp:
Jan 19, 2018, 10:34:10 AM (6 years ago)
Author:
PulkoMandy
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Develop/FileFormats/PKM

    v1 v2  
    9797= The PICTURE PACKING METHOD: =
    9898
    99   The PKM compression method is some sort of Run-Length-Compression which is
    100 very efficient on pictures with long horizontal color repetitions.
    101   Actually, the compression is efficient if there are often more than 3 times
    102 the same color consecutively.
    103 
    104   I think that it would be better to give you the algorithm instead of swim-
    105 ming in incomprehensible explanations.
    106 
    107 {{{
     99The PKM compression method is some sort of Run-Length-Compression which is very efficient on pictures with long horizontal color repetitions.
     100
     101Actually, the compression is efficient if there are often more than 3 times the same color consecutively.
     102
     103I think that it would be better to give you the algorithm instead of swimming in incomprehensible explanations.
     104
     105{{{#!C
    108106  BEGIN
    109107    /*
     
    182180}}}
    183181
    184   For example, the following sequence:
    185     (we suppose that Pack_byte=01 and Pack_word=02)
     182For example, the following sequence (we suppose that Pack_byte=01 and Pack_word=02):
     183
     184{{{
    186185    04 03 01 05 06 03 02 00 01 2C
    187   will be decoded as:
     186}}}
     187
     188will be decoded as:
     189
     190{{{
    188191    04 03 05 05 05 05 05 05 03 00 00 00 ... (repeat 0 300 times (012Ch=300))
     192}}}
    189193
    190194  Repetitions that fit in a word must be written with their higher byte first.
     
    196200== Packing advices: ==
    197201
    198   * As you can see, there could be a problem when you'd want to pack a raw
    199   pixel with a color equal to Pack_byte or Pack_word. These pixels should
    200   always be coded as a packet even if there is only one pixel.
    201 
    202     Example: (we suppose that Pack_byte=9)
    203       9   will be encoded 9,9,1     (The 1st 9 in the encoded...
    204       9,9 will be encoded 9,9,2     ... sequence is Pack_byte)
    205       etc...
     202* As you can see, there could be a problem when you'd want to pack a raw pixel with a color equal to Pack_byte or Pack_word. These pixels should always be coded as a packet even if there is only one pixel.
     203
     204Example: (we suppose that Pack_byte=9)
     205* {{{9}}}   will be encoded {{{9,9,1}}}     (The 1st 9 in the encoded sequence is Pack_byte)
     206* {{{9,9}}} will be encoded {{{9,9,2}}}
     207* etc...
    206208
    207209  * It seems obvious to find values for Pack_byte and Pack_word that are