Home
Tutorials
Code Snippets
Code Samples
Downloads
The Forum
Links

The Blog
Our Projects
Guest Book
About
Contact

ShOuT b0X:
::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:1575
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[58314]
Keyboard Hook[55958]
2D Rotated Rectangles Collision Detection[49665]
UDP[41164]
HTTP Proxy[28040]

::Top 5 Samples::
2D ColDet Rotated Rectangles[8505]
PS2 Mouse Driver[5181]
Reading FAT12[4157]
Wave Format Player[4004]
CodeGuru[3800]

::Link to RageStorm::

::Affiliates::
AngelCode
YOV408 Technologies
FireStorm


All rights reserved to RageStorm © 2009