X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=libcds%2Fsrc%2Fstatic_sequence%2Fwt_coder_huff.cpp;h=5ba633bc58ba1c7128a45b131ad38304529eaca9;hb=e38bc834442d5369a523ba47d74865e48995ace4;hp=f5fafef464df1ca4ea3834a8fba0a9f9c1a79a39;hpb=0bf9688e2615a9fc07860c5762240e4ce26ee5d3;p=SXSI%2FXMLTree.git diff --git a/libcds/src/static_sequence/wt_coder_huff.cpp b/libcds/src/static_sequence/wt_coder_huff.cpp index f5fafef..5ba633b 100644 --- a/libcds/src/static_sequence/wt_coder_huff.cpp +++ b/libcds/src/static_sequence/wt_coder_huff.cpp @@ -1,4 +1,24 @@ - +/* 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::wt_coder_huff(uint * symbs, uint n, alphabet_mapper * am) { @@ -11,6 +31,16 @@ 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;imap((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;iunmap((uint)symbs[i]); +} + wt_coder_huff::wt_coder_huff() {} wt_coder_huff::~wt_coder_huff() {