Googles appar
Huvudmeny

Post a Comment On: cbloom rants

"08-12-10 - The Lost Huffman Paper"

9 Comments -

1 – 9 of 9
Anonymous Anonymous said...

did you lose a while, and a shift in the final table lookup?

August 12, 2010 at 2:43 PM

Blogger cbloom said...

eh, yeah..

August 12, 2010 at 4:00 PM

Blogger Thatcher Ulrich said...

When did you discover the paper?

August 12, 2010 at 5:12 PM

Blogger cbloom said...

A few weeks ago, after we had reinvented the same idea. I actually found it when I was looking for length-limited huffman code building stuff cuz I knew Moffat had a good paper on that topic.

August 12, 2010 at 5:51 PM

Blogger Rich Geldreich said...

FWIW, this is the same technique used by the LZHAM codec's decoder:
http://code.google.com/p/lzham/

August 16, 2010 at 1:41 AM

Blogger cbloom said...

Hi Rich, I just downloaded LZHAM.

It looks pretty much like LZMA but with the arithmetic for match lens and literals replaced with quasi-adaptive-huffman , yes?

The code is actually readable for one thing which is nice.

BTW it would be nice if you write a little about it. A few things in particular have always befuddled me in LZMA :

1. Where does the state transition table come from exactly? Do you understand it intuitively?

2. How does his optimal parse work exactly? It looks like you are doing a full forward Dijkstra on some # of bytes forward (up to 1024), which is pretty damn slow. LZMA's is much faster than that so it must be something else.

August 16, 2010 at 2:38 PM

Blogger cbloom said...

BTW I suspect that the "polar codes" is actually a Shannon-Fano or BRE code. You're using a pow2 "deferred summation" model.

August 16, 2010 at 2:41 PM

Blogger Rich Geldreich said...

Hi Charles,
I copied the state transition table straight from Igor's decoder (lzmaDec.c). I haven't spent any time trying to really understand it yet.

His coding style makes my head hurt. I've tried several times to comprehend wtf is really going on in there.

Yea, the forward Dijkstra search is very expensive, but without it lzham's ratio isn't competitive. My flexible parsing experiments where mostly failures (in a comp. ratio sense). I'm still looking for a smarter way to do this.

The latest development version of lzham accelerates parsing by breaking up the lookahead buffer into (up to) four 3KB blocks and assigns each block to a worker thread to be independently parsed starting from the same state. After all blocks are parsed the main thread takes the lz decisions from each block and codes them using the real state. I added a special code that is issued after each block that tells the decompressor to reset its cur_state and match history.

I also moved a lot of redundant get_cost() calculations out of the innermost matchlen truncation loop, and simplified/tweaked a bunch of stuff.

The matchlen truncation loop is probably the next area I'm going to explore. Exhaustively trying all possible truncations doesn't seem worth the effort.

With these changes the new compressor is 3-4x faster on a core i7, and is now faster than 7za -mx9. But I'm still using way more overall CPU than LZMA.

-Rich

August 29, 2010 at 1:24 AM

Blogger cbloom said...

"The matchlen truncation loop is probably the next area I'm going to explore. Exhaustively trying all possible truncations doesn't seem worth the effort."

I have a good solution to this for the backwards optimal parse, but it doesn't work with forwards parse. It's "LowestCostPrecedingPos"
( http://cbloomrants.blogspot.com/2008/10/10-10-08-2.html ). I think a similar idea might work for forwards actually, but it requires a bit more book-keeping.

August 29, 2010 at 9:31 AM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.