- Mark

]]>1)” no semicolon at end of struct or union

} NODE;”

2)” error: unknown type name ‘BIT_FIle’

void expand_data( BIT_FIle *input, FILE *output, NODE

*nodes,”

3)” expected ‘)’ before ‘!’ token

if ( nodes[ next ]. count ! = 0 )

^”

Hi Priyansh,

The definition of “binary tree” is very simple: a tree in which every node has at most two children.

One can also have specialized versions of a binary tree: for example, a binary tree can be balanced, or it can be sorted.

In this case, you have assumed that the Huffman tree would be a sorted binary tree, but this not the case. When constructing the tree, we have rules about the creation of nodes, but keeping them sorted is not a requirement.

Thanks for reading!

- Mark

]]>i have query on huffman algorithm.

i read your “The data compression book 2nd edition

in this book “page no 32 and 33″ an exmaple of huffman tree is given. as per i read huffman tree is builting builting like binary tree. but in example figure on page 33 have not follow rule of binary tree(small in left and high right) it made confusion. please solve my query ]]>

- Mark

]]>Just starting to read The Data Compression Book. Enjoying it very much so far!

Just curious, in the second chapter, under Lossy Compression, about JPEG compression:

“Using the JPEG algorithm on images can result in dramatic compression ratios. With little or no degradation, compression ratios of 5-10 percent are routine. Accepting minor degradation achieves ratios as low as 1-2 percent.”

Why does the compression ratio decrease with increased output degradation? I would expect the opposite. It seems like the text is implying that the lower compression ratio is better, when it has previously been stated that a ratio of 0 is no compression and negative ratio would be increased output size. Came here looking for an errata that maybe mentioned this… or maybe I am just misunderstanding! :-)

Thanks!

– Daniel

Thanks for the unbelievably simple and straight approach in the book. no other book in data compression gives ideas without support of mathematical explanations. Feels like the author talking to me when I read it. Thanks, thanks a lot.

I’ve tried your code for fractal compression, I’m getting it working, but there are problems with the decoded file. What shall I do to get pixel values from the decoded file?

I’m working on some different schemes for domain classification.

There were many typos in the book – back in they days when we printed long listings like this, it was tough on the proofreaders – they didn’t understand C. Not only that, but the people who typeset the book had to take my code for printouts and type it in by hand – and they didn’t know C either.

The disk that accompanied the book had correct code, but if you are looking at the book right now it is very unlikely that you have a copy of the diskette.

The line in question should be:

min_2 = min_1;

Somehow that = sign was converted to a plus sign.

Thanks for reading!

- Mark

if ( nodes[ i ].count != 0)

{

if ( nodes[ i ].count < nodes[ min_1 ].count)

{

min_2 + min_1;

min_1 = i;

}

else if ( nodes[ i ].count < nodes[ min_2 ].count)

min_2 = i;

}

[/c]

What is meant by min_2 + min_1,please?ShouldnÂ´t it be min_2 = min_2 + min_1?Code is from function build_tree from The Huffman algorithm chapter…

Thank you for answer

]]>