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

📄 entropy_enco.m

📁 MATLAB编写的huffman编解码程序
💻 M
字号:
function [enco,dict,R] = entropy_enco(index,Nb,Np)

[m,n] = size(index);
% Count the probability & Generate the quantized vector
for j=1:n
    for i=1:m
        if  index(i,j)>0
            sig(index(i,j)) = j;
            if  i==m
                prob(j) = i/Nb;
            end
        else
            prob(j) = (i-1)/Nb;
            break;
        end
    end
end
% Generates the binary Huffman code dictionary
num = 1:n;
[dict,avglen] = huffmanDic(num,prob);
% Huffman coding
enco = huffmanEnco(sig,dict);
% Count compression rate
R = size(enco,2)/(8*Nb*Np);

⌨️ 快捷键说明

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