필터 지우기
필터 지우기

Size of the array after Huffman Encoding

조회 수: 1 (최근 30일)
Ayesha
Ayesha 2014년 6월 18일
답변: José-Luis 2014년 6월 18일
Hello,
I have observed that the size of the array generally increasing after huffman encoding process in MATLAB. For example:
sig = repmat([3 3 1 3 3 3 3 3 2 3],1,5); % Data to encode
symbols = [1 2 3]; % Distinct data symbols appearing in sig
p = [0.1 0.1 0.8]; % Probability of each data symbol
dict = huffmandict(symbols,p); % Create the dictionary.
hcode = huffmanenco(sig,dict); % Encode the data.
Here, sig: 1x50 double, however, after encoding, hcode becomes 1x60 double. I thought encoding process would reduce the number of elements. I would appreciate if someone could explain this and if possible, how to determine the size of array after encoding.
Thanks

답변 (1개)

José-Luis
José-Luis 2014년 6월 18일
The performance of encoding algorithms will depend on the structure of the underlying data. The combination of structure/algorithm will yield better or worse results depending on the fit. Sometimes you might get a longer file than what you originally had.
If you want to get the size of the array, please look at the built-in function size()

카테고리

Help CenterFile Exchange에서 Denoising and Compression에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by