huff_enc.m
来自「huffman 和 arithtic code run in the matla」· M 代码 · 共 20 行
M
20 行
function y=huff_enc(table,x)% Usage: y=huff_enc(table,x)% huffman encoding 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: input stream. N x 1 vector. Assume each element is an integer% between 1 and p. % y: row vector, output stream. Length unknown. consists of 0 and 1.% % Yu Hen Hu (copyright 1996)% Last revision: 2/6/1996%N=length(x);[p,dm1]=size(table);depth=table(:,dm1);y=[];for i=1:N, y=[y table(x(i),1:depth(x(i)))];end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?