⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qccenthuffmantable.3

📁 spiht for linux this is used to decod and encode vedio i wich all enjoy
💻 3
字号:
.TH QCCENTHUFFMANTABLE 3 "QCCPACK" "".SH NAMEQccENTHuffmanTable \- data structure .B QccENTHuffmanTableand corresponding.B HUFfile formatfor Huffman encoding and decoding.SH SYNOPSIS.B #include "libQccPack.h".sp.BI "int QccENTHuffmanTableInitialize(QccENTHuffmanTable *" table );.br.BI "int QccENTHuffmanTableAlloc(QccENTHuffmanTable *" table );.br.BI "void QccENTHuffmanTableFree(QccENTHuffmanTable *" table );.br.BI "int QccENTHuffmanTablePrint(const QccENTHuffmanTable *" table );.br.BI "int QccENTHuffmanTableRead(QccENTHuffmanTable *" table );.br.BI "int QccENTHuffmanTableWrite(QccENTHuffmanTable *" table );.SH DESCRIPTIONQccPack provides data structure.B QccENTHuffmanTablefor representing the Huffman code table to use in Huffman encoding anddecoding..LPThe main component of a.B QccENTHuffmanTableis an array of.B QccENTHuffmanTableEntryentries (see below).  Each of these entries contain a source symbol(an integer) and its correspoding Huffman codeword..SH "DATA STRUCTURE"The.B QccENTHuffmanTabledata structure is defined as:.RS.nftypedef struct{  QccString filename;  QccString magic_num;  int major_version;  int minor_version;  int table_type;  int table_length;  QccENTHuffmanTableEntry *table;  int *num_codewords_list;  int num_codewords_list_length;  int *symbol_list;  int symbol_list_length;  int codeword_max[QCCENTHUFFMAN_MAXCODEWORDLEN];  int codeword_min[QCCENTHUFFMAN_MAXCODEWORDLEN];  int codeword_ptr[QCCENTHUFFMAN_MAXCODEWORDLEN];} QccENTHuffmanTable;.fi.RE.LPThe fields of.B QccENTHuffmanTableare as follows:.TP.I filenameFor tables associated with a file, this is the name of the file..TP.IR magic_num ", " major_version ", " minor_versionFor tables associated with a file, these arethe magic number and version of the file..TP.I table_typethe type of the table, .B QCCENTHUFFMAN_DECODETABLE for a decoding table,.B QCCENTHUFFMAN_ENCODETABLEfor an encoding table..TP.I table_lengththe number of entries in the table.TP.I tablethe table of symbols and codewords.TP.IR num_codewords_list ", " num_codewords_list_length ,.IR symbol_list ", " symbol_list_lengtharrays and array lengths used for creating the Huffman table;see.BR QccENTHuffmanTableCreateDecodeTable (3).TP.IR codeword_max ", " codeword_min ", " codeword_ptrauxiliary arrays used for .B QCCENTHUFFMAN_DECODETABLEtype tables for the Huffman decoding process(for internal QccPack use only).LPThe.B QccENTHuffmanTableEntrydata structure, used to hold source symbols and theircorresponding codewords is defined as:.RS.nftypedef struct{  int symbol;  QccENTHuffmanCodeword codeword;} QccENTHuffmanTableEntry;.fi.RE.LPThe fields of.B QccENTHuffmanTableEntryare as follows:.TP.I symbolthe source symbol represented as an integer greater than or equal to 0and less than or equal to.B QCCENTHUFFMAN_MAXSYMBOL.TP.I codewordthe Huffman codeword.LPThe.B QccENTHuffmanCodeworddata structure, used to hold the Huffman codeword itself,is defined as:.RS.nftypedef struct{  int length;  int codeword;} QccENTHuffmanCodeword;.RE.LPThe fields of.B QccENTHuffmanCodewordare as follows:.TP.I lengththe length, in bits, of the codeword.TP.I codewordthe actual Huffman codeword, stored in the least-significant.I lengthbits of the.I codewordinteger; the most-significant bit of the Huffman codeword (i.e.,at the "root" of the Huffman tree and the first bit to be outputduring the encoding of the corresponding symbol) is stored in theleft-most position.SH "FILE FORMAT"For reading and writing structuresof type.BR QccENTHuffmanTable ,QccPack provides the.B HUFfile format.This file format starts with an ASCII header followed byASCII data.The ASCII header consists of magic-number/revisioninformationfollowed by any amount of white space(space, `\\t' (tab), `\\n' (newline), `\\r' (return)) and/orcomments lines (lines starting with `#').  Following this white space,additional ASCIIheader information is given, separated by blanks and newlines.ASCII data follows this ASCII header information..LPThe.B HUFfile format consists of the following information:.RS.sp.BI HUF X.X.br.I "<white space>".br.I num_codewords_list_length.br.I symbol_list_length.br.I num_codewords_list.br\|..br\|..br\|..br.I symbol_list.br\|..br\|..br\|..br.sp.REwhere.B HUFis the magic number,.I X.Xis the version number,.I "<white space>"is white space and/or comment lines, .I num_codewords_list_lengthis the length of the .I num_codewords_listto appear later in the file,and.I symbol_list_lengthis the length of the.I symbol_listto appear later in the file..I num_codewords_listis the list of the number of codewords, starting with length 1..I symbol_listis the list of symbols (in decimal integers) corresponding to the codewords..LPFor example, if the Huffman table has the following symbols andcodewords,.RS.nf  Symbol     Codeword Length      Codeword-------------------------------------------   'a'              2                00   'b'              2                01   'c'              3                100   'd'              4                1010   'e'              4                1011.fi.REthe corresponding.BR HUF -formatfile would be:.RS.nfHUFX.X# Optional comment(s) here450               <----- Start with length = 121297              <----- Decimal integer representation of symbols9899100101.fi.RENote: the stuff starting with the "<----" arrows is merely an annotation and is not actually a legal part of the file..SH "ROUTINES".B QccENTHuffmanTableInitialize()should be called before any use of a.B QccENTHuffmanTablestructure..B QccENTHuffmanTableInitialize()initializes the fields of.I tableto the following values:.RS.IR table_type :.B QCCENTHUFFMAN_DECODETABLE.br.IR table :.B NULL.br.IR table_length :0.RE.LP.B QccENTHuffmanTableAlloc()allocates the Huffman table. .I table_lengthmust be set before calling.BR QccENTHuffmanTableAlloc() ..LP.B QccENTHuffmanTableFree()frees the .I tablearray..LP.B QccENTHuffmanTablePrint()prints the contents of.I tableto stdout..LP.BR QccENTHuffmanTableRead()reads a Huffman table from a .BR HUF -formatfile..I tableis returned as either a decoding or encoding table; set.IR table -> table_typeto either.B QCCENTHUFFMAN_ENCODETABLEor.BR QCCENTHUFFMAN_DECODETABLE ,respectively,before calling.BR QccENTHuffmanTableRead() ..BR QccENTHuffmanTableRead()reads the list of numbers of codewords and the list of symbols fromthe file whose name is given by.IR table -> filename(must be set before calling.BR QccENTHuffmanTableRead() )and then calls either.BR QccENTHuffmanTableCreateEncodeTable (3)or.BR QccENTHuffmanTableCreateDecodeTable (3),as appropriate,to generate the actual table,.IR table -> table ,of Huffman codewords..LP.BR QccENTHuffmanTableWrite()writes the Huffman table,.IR table ,to the .BR HUF -formatfile whose name is given in.IR table -> filename .Usually, .I tablewill be either an encoding table.RI ( table -> table_type=.BR QCCENTHUFFMAN_ENCODETABLE )or a decoding table.RI ( table -> table_type=.BR QCCENTHUFFMAN_DECODETABLE )that was created by a call to.BR QccENTHuffmanDesign (3)..SH "RETURN VALUE"These routines return 0 on success, and 1 on failure..SH "SEE ALSO".BR QccENTHuffmanTableCreateDecodeTable (3),.BR QccENTHuffmanTableCreateEncodeTable (3),.BR QccENTHuffmanDecode (3),.BR QccENTHuffmanEncode (3),.BR QccENTHuffmanDesign (3),.BR QccPackENT (3),.BR QccPack (3).LPD. A. Huffman, "A Method for the Construction of Minimum-Redundancy Codes,".IR "Proceedings of the IRE" ,vol. 40, pp. 1098-1101, September 1952..SH AUTHORCopyright (C) 1997-2009  James E. Fowler.\"  The programs herein are free software; you can redistribute them an.or.\"  modify them under the terms of the GNU General Public License.\"  as published by the Free Software Foundation; either version 2.\"  of the License, or (at your option) any later version..\"  .\"  These programs are distributed in the hope that they will be useful,.\"  but WITHOUT ANY WARRANTY; without even the implied warranty of.\"  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the.\"  GNU General Public License for more details..\"  .\"  You should have received a copy of the GNU General Public License.\"  along with these programs; if not, write to the Free Software.\"  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -