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

📄 huffman_bench1.m

📁 哈夫曼编码
💻 M
字号:
function huffman_bench1
%HUFFMAN_BENCH1
%   This file is a simple benchmark.
%   It uses this M-file as text string to be used.


%   $Author: Giuseppe Ridino' $
%   $Revision: 1.0 $  $Date: 02-Jul-2004 16:47:25 $


% select this file to be red
file = [mfilename '.m'];

% Reading data
fprintf('Reading file %s ... ',file)
tic
fid = fopen(file,'r');
data = fread(fid,inf,'uint8');
fclose(fid);
toc
fprintf('Done!\n')
data = uint8(data);

fprintf('Compresing data... ')

tic
[zipped,info] = norm2huff(data);
toc

fprintf('Done!\n')

fprintf('Decompressing data...')

tic
unzipped = huff2norm(zipped,info);
toc

fprintf('Done!\n')

isOK = isequal(data(:),unzipped(:))

whos data zipped unzipped

bar(frequency(data)); axis tight

⌨️ 快捷键说明

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