-
+/* wt_coder_huff.cpp
+ * Copyright (C) 2008, Francisco Claude, all rights reserved.
+ *
+ * wt_coder_huff definition
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
#include <wt_coder_huff.h>
wt_coder_huff::wt_coder_huff(uint * symbs, uint n, alphabet_mapper * am) {
symbs[i] = am->unmap(symbs[i]);
}
+wt_coder_huff::wt_coder_huff(uchar * symbs, uint n, alphabet_mapper * am) {
+ for(uint i=0;i<n;i++)
+ symbs[i] = (uchar)am->map((uint)symbs[i]);
+ hc = new huffman_codes(symbs, n);
+ buffer = new uint[hc->max_length()/W+1];
+ s_len = 0; last_symbol = (uint)-1;
+ for(uint i=0;i<n;i++)
+ symbs[i] = (uchar)am->unmap((uint)symbs[i]);
+}
+
wt_coder_huff::wt_coder_huff() {}
wt_coder_huff::~wt_coder_huff() {