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:1941
Description:
  Tiny program which extracts Huffman data block and prints it.
User Contributed Comments(2)
 [1] bitRAKE | 2008-01-06 02: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 17: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[105824]
2D Rotated Rectangles Collision Detection[79071]
Keyboard Hook[68618]
UDP[52685]
HTTP Proxy[35960]

::Top 5 Samples::
2D ColDet Rotated Rectangles[10591]
PS2 Mouse Driver[6084]
Wave Format Player[4969]
Reading FAT12[4856]
CodeGuru[4544]


All rights reserved to RageStorm © 2009