Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MTF better than AdaptHuff?

26 views
Skip to first unread message

Harry Potter

unread,
Dec 24, 2022, 12:16:16 PM12/24/22
to
Hi! I am working on several compression techniques right now. I was at one time working on a form of MTF but abandoned it thinking it did worse than AdaptHuff. However, a few weeks ago, I resurrected it and found it was *better* than AdaptHuff. Following is the code I'm using to write MTF values:
----------------------
void mtfWriteVal (unsigned c)
{
unsigned m=mtfGetVal (c);
if (m<32) {
writeoutf_11 ();
writeoutf (m, 5);
} else if (m<64) {
writeoutf_x2 (2);
writeoutf (m-32, 5);
} else if (m<128) {
writeoutf (5, 3);
writeoutf (m-64, 6);
} else {
writeoutf (6, 3);
writeoutf (m-128, 7);
}
}
------------
where mtfGetVal() gives the value translated to MTF, writeoutf_01() and writeoutf_11() write one bit, writeoutf_x2() writes two bits and writeoutf() writes the number of bits given in the second argument.

Phil Carmody

unread,
Dec 26, 2022, 6:40:40 PM12/26/22
to
Harry Potter <rose.j...@yahoo.com> writes:
> Hi! I am working on several compression techniques right now. I was at one time working on a form of MTF but abandoned it thinking it did worse than AdaptHuff. However, a few weeks ago, I resurrected it and found it was *better* than AdaptHuff. Following is the code I'm using to write MTF values:

This is an apples to oranges comparison. MTF could be included before
AdaptHuff, they aren't competing with each other.

Phil
--
We are no longer hunters and nomads. No longer awed and frightened, as we have
gained some understanding of the world in which we live. As such, we can cast
aside childish remnants from the dawn of our civilization.
-- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/
0 new messages