Posted By
Harry Potter on 2022-06-01 14:54:44
| Re: cc65 compressor too slow: help needed optimizing
I'm sorry, but that I wasted your time. I deprecated the technique, because I found a technique that's both better and faster. It still pauses for split seconds at a time, though, and I suspect Adaptive Huffman Codes to be the culprit. Following are some of the functions:
-------------------- void __fastcall__ AddHuffNYT (void) { // struct HuffEnv_Entry//* top = GetHuffEntry (HuffEnv.top), //&HuffEnv.Entry[HuffEnv.top], // //*bottomleft = GetHuffEntry (HuffEnv.top-2), //&HuffEnv.Entry[HuffEnv.top-2], // *bottomright = GetHuffEntry (HuffEnv.top-1); //&HuffEnv.Entry[HuffEnv.top-1]; e1 = GetHuffEntry (HuffEnv.top-1); //bottomleft = GetHuffEntry (HuffEnv.top-2); bottomleft = e1; --bottomleft; //backcol++; //e2 = GetHuffEntry (HuffEnv.top-1); //HuffEnv.Entry[HuffEnv.top].child[1] = HuffEnv.top-1; //HuffEnv.Entry[HuffEnv.top].child[0] = HuffEnv.top-2; //top->child[1] = HuffEnv.top-1; //top->child[0] = HuffEnv.top-2; //top->occur++; bottomright->occur = 1; //++top->occur;bottomright->occur = 1; //top->occur = bottomright->occur = e1->bit = 1; //bottomleft->bit = 0; bottomleft->parent = e1->parent = HuffEnv.top; //bottomright->bit = 1; HuffEnv.entrynum[c] = HuffEnv.top-1; e1->c = //HuffEnv.top-1; c; HuffEnv.top- = 2; //relits| = 1<<(c>>4); --numhuffs; //relits| = 1<<(c>>4); }
static unsigned __fastcall__ GetHuffGreatestInBlock (unsigned c) { //register unsigned k; //struct HuffEnv_Entry* h = GetHuffEntry (512); unsigned j = (GetHuffEntry (c))->occur; //register int c2 = GetHuffEntry (c)->c; //register int c2 = e3->c; for (tmpcptr = 512; 1; --tmpcptr){ //if (HuffEnv.Entry[tmpcptr].occur == j) k = tmpcptr; //if (GetHuffEntry (tmpcptr)->occur == j) k = tmpcptr; if (GetHuffEntry (tmpcptr)->occur == j /*&& c2^h->c> = 0*/) return tmpcptr; //--h; } //return c;
}
//void UpdateHuffCode (unsigned char c) void __fastcall__ UpdateHuffCode (void) { //unsigned z = 0; unsigned n, ch = HuffEnv.entrynum[c], x, y; //static struct HuffEnv_Entry* e1; HuffEnv.Entry[512].parent = -1; //do { //backcol = 8; while (ch<512) { //printc ('.'); if (z>10) { // /*cgetc();*/ z = 0;} ++z; //n = GetHuffGreatestInBlock (HuffEnv.Entry[ch].occur); //HuffEnv.Entry[512].parent = -1; e1 = GetHuffEntry (n = GetHuffGreatestInBlock (ch)); e2 = GetHuffEntry (ch); //e1 = GetHuffEntry (n); //if (n> = 512) break; if (n! = ch && e2->parent! = n){ if (/*HuffEnv.Entry[n].c*/((int)e2->c)> = 0) { HuffEnv.entrynum[e2->c] = n; } if (((int)e1->c)> = 0) { HuffEnv.entrynum[e1->c] = ch; } __asm__ ( "\tldy\t#3\n" "\t@a01:\n" "\tlda\t(_e1),y\n" "\tpha\n" "\tlda\t(_e2),y\n" "\tsta\t(_e1),y\n" "\tpla\n" "\tsta\t(_e2),y\n" "\tiny\n" "\tcpy\t#7\n" "\tbcc\t@a01\n" ); } ++e2->occur; ch = e2->parent;//HuffEnv.Entry[ch].parent; } ++HuffEnv.Entry[512].occur; } --------------------
|