Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Sample Code - Huffman Decoder
Author:Arkon
Category:Code Crunching
File Name:hdecode.asm
File Size:~ 5.06KB
Uploaded at:15-Aug-03
Downloads:2489
Description:
  Tiny program which extracts Huffman data block and prints it.
User Contributed Comments(2)
 [1] bitRAKE | 2008-01-06 07:06:51

How about 23 bytes?

start:
  mov bx,root
  mov cx,last_data_bit
read_bit:
  bt [si],cx
  adc al,node_0-root
  xlatb
  or al,al
  jns c
  xlatb
  int $29
  salc
c: loopne read_bit
x: ret

Can save a few bits if data matches code or tree. I remember reading of a 19 byte decompressor, but I cannot find reference to it...will need to be re-discovered... (c:
 [2] arkon | 2008-01-11 22:53:26

the bt instructions rocks cause you can access the memory as a long stream, thus you don't need to inc si every time like i did. very nice improvement.
but now i need to reverse the data, anyways when i have some time for this i will change the code.

btw - the drawback is that it only supports 7 bit symbols, could be ownage to support 8 bits symbols so it can extract code as well.
NOTE:
Comments that will hurt anyone in any way will be deleted.
Don't ask for features, advertise or curse.
If you want to leave a message to the author use the contacts,
if you have any question in relation to your comments please use the forum.
Comments which violate any of these requests will be deleted without further
notice. Use the comment system decently.

Post your comment:
Name:
email:
Comment:
::Top 5 Tutorials::
Embedded Python[121025]
2D Rotated Rectangles Collision Detection[90659]
Keyboard Hook[79324]
UDP[67183]
HTTP Proxy[42651]

::Top 5 Samples::
2D ColDet Rotated Rectangles[11652]
PS2 Mouse Driver[7046]
Wave Format Player[5875]
Reading FAT12[5688]
CodeGuru[5450]


All rights reserved to RageStorm © 2009