- this->codetable = node::makecodetable(bwt,n);
- alphabetrank = new THuffAlphabetRank(bwt,n, this->codetable,0);
- //if (alphabetrank->Test(bwt,n)) printf("alphabetrank ok\n");
+// this->codetable = node::makecodetable(bwt,n);
+// alphabetrank = new THuffAlphabetRank(bwt,n, this->codetable,0);
+// delete [] bwt;
+ //alphabetrank = new RLWaveletTree(bwt, n); // Deletes bwt!
+
+ uint *text = new uint[n];
+ for (i = 0; i < n; ++i) // Silly
+ text[i] = bwt[i];
+ delete [] bwt;
+ bwt = 0;
+
+ alphabet_mapper * am = new alphabet_mapper_none();
+ static_bitsequence_builder * bmb = new static_bitsequence_builder_rrr02(16); // FIXME samplerate?
+
+ //cout << "Building Huffman table..."; cout.flush();
+
+ wt_coder * wtc = new wt_coder_huff(text,n,am);
+
+ //cout << "done" << endl; cout.flush();
+ //cout << "Building static_sequence..."; cout.flush();
+
+ alphabetrank = new static_sequence_wvtree(text,n,wtc,bmb,am);
+ delete [] text;
+ text = 0;