Re: simple compression mathod to code itself?

Liste des GroupesRevenir à cl c  
Sujet : Re: simple compression mathod to code itself?
De : nospam (at) *nospam* needed.invalid (Paul)
Groupes : comp.lang.c
Date : 06. Apr 2024, 03:18:01
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <uuq7sa$1mutb$1@dont-email.me>
References : 1 2
User-Agent : Ratcatcher/2.0.0.25 (Windows/20130802)
On 4/5/2024 7:28 PM, David LaRue wrote:
fir <fir@grunge.pl> wrote in news:uupflr$5t1n$1@i2pn2.org:
 
i not code at all in recent years
(recently i coded half of my compuler with a plan to write second half
but its to ambitious to lazy coding mood i got recently)
but recently i started this slamm coding modd and found
ite pleasurable
>
searching for lazy side things i could code in such mood
i thought maybe i wopuld like to have compression routine
but i would like to write it myself sortla like i use quicksort
or so but i also want to write it myself
>
so is there maybe some method i could use i mean some simple
routine that compresses and uncompresses an array of bytes but
maybe something a bit more complex than RLE (rune length encoding)
- only thing i know from this domain
>
 
Hello fir,
 
A method a bit more complex that you might try builds a table of all bytes
as you scan them from the input.  The compressed output is a reference to
the table you just built (wnhem repeated byte strings are found, otherwise
feed the input to the compressed image so that the expansion method can
build the sme dynamic table the encoder built.  The table generally has a
limit on the number of entries (usually a good size) and allows the table
of bytes to dynamically change as new patterns are read from the input.
 
This is a well known and documented compression/expansion algorithm.  PKZIP
and other engines use this as one of their compression methodz.  Look for
the description of that if you need more details to figure out what you
need to write.
 
Expansion is the reverse.  Read the source (now the compressed image) and
build the compression table from the bytes.  As encoded references to the
compression table are read from the compressed image output the source byte
sequences.  The output should be the same as what your encoder originally
read.
 
A good check on the final code is to compare the original input with the
eventual output and make sure they agree exactly.
 
Have fun,
 
David
 

Some people have written compression codes, purely for educational purposes.
That's why I got a copy of this, some years ago. For fun.

https://github.com/grtamayo/RLE

    gtrle35.c    # Run Length Encoding, one of the simpler compressors

  Paul

Date Sujet#  Auteur
5 Apr 24 * simple compression mathod to code itself?12fir
6 Apr 24 `* Re: simple compression mathod to code itself?11David LaRue
6 Apr 24  +* Re: simple compression mathod to code itself?2Paul
6 Apr 24  i`- Re: simple compression mathod to code itself?1fir
6 Apr 24  `* Re: simple compression mathod to code itself?8fir
6 Apr 24   +* Re: simple compression mathod to code itself?5fir
6 Apr 24   i+* Re: simple compression mathod to code itself?2bart
6 Apr 24   ii`- Re: simple compression mathod to code itself?1fir
6 Apr 24   i`* Re: simple compression mathod to code itself?2David LaRue
7 Apr 24   i `- Re: simple compression mathod to code itself?1BGB
6 Apr 24   `* Re: simple compression mathod to code itself?2David LaRue
6 Apr 24    `- Re: simple compression mathod to code itself?1fir

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal