VOGONS


First post, by Harry Potter

User metadata
Rank Oldbie
Rank
Oldbie

Hi! I'm working on several compression techniques, and one for 8-bit systems uses MTF. It seems to be pretty good there but not elsewhere. Now, I'm wondering how I can improve it. Wikipedia's article on MTF recommended I use it as a back end to BWT. However, applying it only cost me. 🙁 This technique does pretty well but not very well. I'm looking for ways to better MTF. Following is the code I'm using to write a MTF byte:

void mtfWriteVal (void)
{
unsigned char m=mtfGetVal (CPos[k]);
//writeoutf (CPos[k], 8); return;
/*if (0 && m<32) {
writeoutf_x2 (0);
writeoutf (m, 5);
//} else if (m<128+16+32+32) {
} else //if (m<32+32+64) {
//++brdrcol;
*/
//WriteDist (m-32, 128-32);
brdrcol=m;
if (m<32) {
writeoutf_11 ();
writeoutf (m, 5);
//} else if (m<128+16+32+32) {
} else if (m<64) {
//writeoutf_11 ();
writeoutf_x2 (2);
writeoutf (m-32, 5);
} else if (m<128) {
//writeoutf_01 ();
writeoutf_x3 (5);
writeoutf (m-64, 6);
} else {
writeoutf_x3 (6);
// if (m<192) {writeoutf_11 (); writeoutf (m-128, 6);}
// else {writeoutf_01 (); writeoutf (m-192, 6);}
writeoutf (m-128, 7);
} //continue;
}

where mtfGetVal() converts the current byte to an index in the MTF table, the writeoutf_##() functions write the second number of bits to the output and writeoutf() writes the number of bits given in the second parameter. BTW, brdrcol is just a way to visualize the writing of the converted variable.

Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community