Shop OBEX P1 Docs P2 Docs Learn Events
wild question re compression — Parallax Forums

wild question re compression

ArchiverArchiver Posts: 46,084
edited 2000-11-07 14:33 in General Discussion
Here is a wild question. I need a compression algorythm that is agressive on small ammounts of data (44-50) of the charicters A-Z a-z and 0-9. Huffman is "ok" but does anyone know of a better tequniuqe? Anything with the stamp's limitation is prefered but even C code is helpful. Thank you for the help.
MH

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-11-07 14:33
    I did an article a long time ago for Visual Developer on Base 40
    compression. The idea is to make your symbols fit in 40 characters (usually
    A-Z 0-9 space and 3 punctuation of your choice). Now you can fit 3
    characters in two bytes using:

    Word = C2*40**2 + C1*40**1 + C0*40**0
    ** is exponentiation which you precompute to be:
    C2*1600+C1*40+C0

    Then you can split them apart just like you split a hex number (but using
    40) / is integer division:

    C2=Word/1600
    C1=(Word-C2*1600)/40
    C0=Word//40 ' remainder operation

    Why not 41? Because

    39*1600+39*40+39=63999 (<2**16)
    but
    40*1681+40*41+40 = 68920 (>2**16)

    This is an old mainframe trick which goes to prove that if you remember
    things long enough you can make them new again :-)

    Earthweb bought the rights to all the old Visual Developer articles when
    Coriolis shut it down, so you might find the article on their Web site (it
    was called Pack it Up I think) Try www.developer.com
    They have a lot of my old columns online (my wife likes to read the stories
    and then quits when they get technical). But I didn't see that one online
    off the top of my head.

    Regards,

    Al Williams
    AWC
    * Floating point math for the Stamp, PIC, SX, or any microcontroller at
    http://www.al-williams.com/awce/pak1.htm



    Original Message
    From: Michael Hendricks [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=KLrteXoMnQ1y0j2OkEW9rk51NgKNFopqSyaG5hsTVO99w9815quCzUHZMO4qI17zK1Mwfq3UmOYPlull]mjh80@b...[/url
    Sent: Monday, November 06, 2000 10:54 PM
    To: basicstamps@egroups.com
    Subject: [noparse][[/noparse]basicstamps] wild question re compression


    Here is a wild question. I need a compression algorythm that is agressive on
    small ammounts of data (44-50) of the charicters A-Z a-z and 0-9. Huffman is
    "ok" but does anyone know of a better tequniuqe? Anything with the stamp's
    limitation is prefered but even C code is helpful. Thank you for the help.
    MH
Sign In or Register to comment.