Results 1 to 4 of 4

Thread: defdb a tool to dump the deflate stream from .gz and .png files

  1. #1
    Member caveman's Avatar
    Join Date
    Jul 2009
    Location
    Strasbourg, France
    Posts
    190
    Thanks
    8
    Thanked 62 Times in 33 Posts

    defdb a tool to dump the deflate stream from .gz and .png files

    This is an update of pngdb (since it handles .gz files the name has changed)

    Code:
    defdb: displays deflate block Type Boundary and Size & full stream size in bits.
    Version 0.4b (18 May 2014) by Frederic Kayser
    Usage: defdb [-s|-d|-t|-a|-w] file[.png|.gz]
    Options: -s displays only the Deflate stream overall size
             -d dumps the entire Deflate stream in human readable form
             -t same as option d plus printable ASCII literals
             -a displays header analyse
             -w writes the raw deflate stream in file raw_deflate_stream
    Version 0.4e new option b, more relaxed PNG checks (CRC and IEND can be bogus for instance), has an hidden r option that was useful with Zopfli KrzYmod versions prior to v14.

    -s is for quick comparison of stream lengths in bits
    -a is not finished yet, it is ment to compare the current header and a zlib produced one.
    -d is a nice way to understand how a deflate stream is actually made.
    Each line represents an element of the stream, its size (in bits) is figured between square brackets [].
    Concerning the block headers you have to be familiar with RFC 1951 to understand them.
    Once in the data stream itself these conventions are used:
    - [size] XX, a literal value XX in hexa (ranges from 00 to FF that is 0 to 255), takes size bits.
    - [size] (length, distance), LZ pair in decimal -length between 3 and 258, distance between 1 and 32768-, takes size bits.
    - [size] EofB, End of Block, takes size bits.

    It looks like this:
    Code:
     [3] 00
     [9] (3,1)
     [5] 1E
     [3] 00
    [11] (7,1)
     [5] 21
    [10] (8,9)
     [4] 40
     [4] 80
     [8] (6,9)
    ...
    [12] (9,432)
    [12] (9,450)
    [12] (9,468)
    [12] (9,486)
    [6] EoB
    [3] 00 -> a literal of value 00, takes 3 bits in the stream
    [9] (3,1) -> an LZ match of length 3 and distance 1, takes 9 bits in the stream (9 is the sum of two parts: the lenght length and the distance length these can be found in the block header).

    I've started an experimental work to display compression efficiency of text files in the same way as pngthermal, it's called gzthermal.
    Attached Files Attached Files
    Last edited by caveman; 27th July 2015 at 03:36. Reason: New version 0.4e number of blocks

  2. Thanks (3):

    Bulat Ziganshin (19th May 2014),Jaff (7th October 2013),lorents17 (29th August 2015)

  3. #2
    Member m^2's Avatar
    Join Date
    Sep 2008
    Location
    Ślůnsk, PL
    Posts
    1,611
    Thanks
    30
    Thanked 65 Times in 47 Posts
    Thank you.

  4. #3
    Member caveman's Avatar
    Join Date
    Jul 2009
    Location
    Strasbourg, France
    Posts
    190
    Thanks
    8
    Thanked 62 Times in 33 Posts
    New version 0.4b adds option "t" for text which is the same as "d" but will also display the ASCII char equivalent for literals. (First post updated, I'm a bit late with the Windows version, expect it tomorrow).
    Last edited by caveman; 22nd May 2014 at 12:34.

  5. Thanks:

    Paul W. (19th May 2014)

  6. #4
    Member
    Join Date
    Apr 2011
    Location
    Russia
    Posts
    168
    Thanks
    163
    Thanked 9 Times in 8 Posts
    good evening!
    Long ago I have noticed one feature, by optimization of any PNG through zlib, Tokens value always identical. What it is connected with?

    Code:
    truepng -zc9 -zm1-9 -zs0-3 -force 1.png
    TruePNG 0.6.2.2 : PNG Optimizer
    by x128 (2010-2016)
    x128@ua.fm
    
    Input file: 1.png | 1049311 bytes
    Image: 512x512 pixels | 8 bits/sample | RGB & Alpha
    Delta filter: Mixed
    Chunks: only critical
    
    Output format: 8 bits/sample | RGB & Alpha
    Chunks: only critical
    
    try...
    IDAT=287937     file=287994     complete=100%
                                                                                    
    best:
    zc:9    zm:9    zs:3    fs:2    f:5     IDAT=287937     file=287994
    
    defdb 1.png
    T Boundary   Tokens   h.size   b.size
    2        0    32767      705   114605
    2    11a56    32767      871   108322
    2    1d636    32767      734   117365
    2    292bb    32767      743   128934
    2    34bd9    32767      628   118804
    2    403b9    32767      588   116162
    2    4ba24    32767      740   129292
    2    56dcb    32767      948   119709
    2    62494    32767      927   122822
    2    6dc9e    32767      870   121216
    2    79747    32767      835   122919
    2    8576e    32767      910   117154
    2    91c5a    32767      838   109703
    2    9d6bc    32767      896   114656
    2    a9295    32767      871   108363
    2    b4b62    32767      327    87718
    2    c0b73    32767      717    91286
    2    cce97    32767      817   100589
    2    d9029    32767      834   100609
    2    e5622    32767      777    99370
    2    f0f53    15332      681    53845
    2303443 bits long (21 blocks)
    
    advdef -z4 -i15 1.png
          287994      274250  95% C:\Users\Lorents\Desktop\1.png
          287994      274250  95%
    
    defdb 1.png
    T Boundary   Tokens   h.size   b.size
    2        0     2280      475    28193
    2     8b28     2244      389    19496
    2     b928     7825      561    83750
    2    16213     3370      530    23867
    2    18569    23944      560   101192
    2    23ace   147574      644   580621
    2    5b73d   134112      716   510765
    2    8df89    41410      582   135204
    2    9d5d9    43785      633   155608
    2    ad5c1    21014      458    61675
    2    b56a8      276      171      888
    2    b57e9    11405      380    90033
    2    c2594    89637      632   313608
    2    eb7d1     2420      477    25291
    2    ee46e     3525      388    35933
    2    f30c2      432      328     4819
    2    f4240     1411      503    17358
    2    fa348      402      256     5193
    2193494 bits long (18 blocks)

Similar Threads

  1. convert swf files to avi files
    By Jabilo in forum The Off-Topic Lounge
    Replies: 13
    Last Post: 26th October 2016, 12:39
  2. Comparison of lossless PNG compression tools
    By Surfer in forum Data Compression
    Replies: 54
    Last Post: 19th September 2011, 23:58
  3. Direct edit if palette entry in PNG?
    By SvenBent in forum The Off-Topic Lounge
    Replies: 2
    Last Post: 14th September 2009, 23:51
  4. Easy way for BMF to png
    By SvenBent in forum Data Compression
    Replies: 5
    Last Post: 13th November 2008, 09:13
  5. unsupported PNG verient for Precomp
    By maadjordan in forum Data Compression
    Replies: 5
    Last Post: 22nd May 2008, 17:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •