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

📄 huff_dec.m

📁 huffman 和 arithtic code run in the matlab
💻 M
字号:
function x=huff_dec(table,y)% Usage: x=huff_dec(table,y)% huffman decoding algorithm% table: p by dmax+1 matrix. Last column consists of length of code%    1st to 2nd last column is the  actual code (by row)%        huffman table is generated by huff_tbl% x: output symbol stream. Each element is an integer%    between 1 and p.  % y: row vector, input binary stream.  % Yu Hen Hu (copyright 1996)% Last revision: 2/6/1996%N=length(y);[p,dm1]=size(table);depth=table(:,dm1);x=[];mark=0;  % mark= 1 is the end of a binary stream corresponding         % to a symbol.i=1; d=1;tmp=ones(p,1);while i<=N,   % match y(i) to that of the d-th bit in the table   tmp=tmp.*[table(:,d)==y(i)]; % tmp is a vector of 0 and 1              % with 1 indicate a match   if sum(tmp)==1,  % narrow down to one symbol, find it      [isort,idx]=sort(tmp);  % after sorting, index of       x=[x idx(p)]; % the 1 location is at the last element.      mark=1;       % indicating a new symbol is decoded.      d=1;          % reset pointer to columns of table.      tmp=ones(p,1);      % otherwise, continue to match the next column in table   elseif d <       d=d+1; mark=0;   end   i=i+1; end

⌨️ 快捷键说明

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